@zag-js/slider 0.2.9 → 0.2.11

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.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  connect
3
- } from "./chunk-WMQQQRK5.mjs";
3
+ } from "./chunk-X363CZYV.mjs";
4
4
  import "./chunk-3Y7IIPR5.mjs";
5
- import "./chunk-SGCWELVB.mjs";
6
- import "./chunk-J5IGGBVE.mjs";
7
- import "./chunk-YREEXXZP.mjs";
5
+ import "./chunk-3UP6QL6A.mjs";
6
+ import "./chunk-55KEN77D.mjs";
7
+ import "./chunk-IJAAAKZQ.mjs";
8
8
  export {
9
9
  connect
10
10
  };
@@ -29,31 +29,23 @@ function isDocument(el) {
29
29
  return el.nodeType === Node.DOCUMENT_NODE;
30
30
  }
31
31
  function isWindow(value) {
32
- return (value == null ? void 0 : value.toString()) === "[object Window]";
32
+ return value?.toString() === "[object Window]";
33
33
  }
34
34
  function getDocument(el) {
35
- var _a;
36
35
  if (isWindow(el))
37
36
  return el.document;
38
37
  if (isDocument(el))
39
38
  return el;
40
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
39
+ return el?.ownerDocument ?? document;
41
40
  }
42
41
  function getWindow(el) {
43
- var _a;
44
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
42
+ return el?.ownerDocument.defaultView ?? window;
45
43
  }
46
44
  function defineDomHelpers(helpers) {
47
45
  const dom2 = {
48
- getRootNode: (ctx) => {
49
- var _a, _b;
50
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
51
- },
46
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
52
47
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
53
- getWin: (ctx) => {
54
- var _a;
55
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
56
- },
48
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
57
49
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
58
50
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
59
51
  };
@@ -97,20 +89,18 @@ function getPointRelativeToNode(point, element) {
97
89
 
98
90
  // ../../utilities/form-utils/src/input-event.ts
99
91
  function getDescriptor(el, options) {
100
- var _a;
101
92
  const { type, property = "value" } = options;
102
93
  const proto = getWindow(el)[type].prototype;
103
- return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
94
+ return Object.getOwnPropertyDescriptor(proto, property) ?? {};
104
95
  }
105
96
  function dispatchInputValueEvent(el, value) {
106
- var _a;
107
97
  if (!el)
108
98
  return;
109
99
  const win = getWindow(el);
110
100
  if (!(el instanceof win.HTMLInputElement))
111
101
  return;
112
102
  const desc = getDescriptor(el, { type: "HTMLInputElement", property: "value" });
113
- (_a = desc.set) == null ? void 0 : _a.call(el, value);
103
+ desc.set?.call(el, value);
114
104
  const event = new win.Event("input", { bubbles: true });
115
105
  el.dispatchEvent(event);
116
106
  }
@@ -121,14 +111,12 @@ var import_numeric_range2 = require("@zag-js/numeric-range");
121
111
  // src/slider.style.ts
122
112
  var import_numeric_range = require("@zag-js/numeric-range");
123
113
  function getVerticalThumbOffset(ctx) {
124
- var _a;
125
- const { height = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
114
+ const { height = 0 } = ctx.thumbSize ?? {};
126
115
  const getValue = (0, import_numeric_range.getValueTransformer)([ctx.min, ctx.max], [-height / 2, height / 2]);
127
116
  return parseFloat(getValue(ctx.value).toFixed(2));
128
117
  }
129
118
  function getHorizontalThumbOffset(ctx) {
130
- var _a;
131
- const { width = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
119
+ const { width = 0 } = ctx.thumbSize ?? {};
132
120
  if (ctx.isRtl) {
133
121
  const getValue2 = (0, import_numeric_range.getValueTransformer)([ctx.max, ctx.min], [-width * 1.5, -width / 2]);
134
122
  return -1 * parseFloat(getValue2(ctx.value).toFixed(2));
@@ -235,35 +223,14 @@ var styles = {
235
223
  // src/slider.dom.ts
236
224
  var dom = defineDomHelpers({
237
225
  ...styles,
238
- getRootId: (ctx) => {
239
- var _a, _b;
240
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `slider:${ctx.id}`;
241
- },
242
- getThumbId: (ctx) => {
243
- var _a, _b;
244
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.thumb) != null ? _b : `slider:${ctx.id}:thumb`;
245
- },
246
- getControlId: (ctx) => {
247
- var _a, _b;
248
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `slider:${ctx.id}:control`;
249
- },
226
+ getRootId: (ctx) => ctx.ids?.root ?? `slider:${ctx.id}`,
227
+ getThumbId: (ctx) => ctx.ids?.thumb ?? `slider:${ctx.id}:thumb`,
228
+ getControlId: (ctx) => ctx.ids?.control ?? `slider:${ctx.id}:control`,
250
229
  getHiddenInputId: (ctx) => `slider:${ctx.id}:input`,
251
- getOutputId: (ctx) => {
252
- var _a, _b;
253
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.output) != null ? _b : `slider:${ctx.id}:output`;
254
- },
255
- getTrackId: (ctx) => {
256
- var _a, _b;
257
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:${ctx.id}track`;
258
- },
259
- getRangeId: (ctx) => {
260
- var _a, _b;
261
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:${ctx.id}:range`;
262
- },
263
- getLabelId: (ctx) => {
264
- var _a, _b;
265
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `slider:${ctx.id}:label`;
266
- },
230
+ getOutputId: (ctx) => ctx.ids?.output ?? `slider:${ctx.id}:output`,
231
+ getTrackId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}track`,
232
+ getRangeId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}:range`,
233
+ getLabelId: (ctx) => ctx.ids?.label ?? `slider:${ctx.id}:label`,
267
234
  getMarkerId: (ctx, value) => `slider:${ctx.id}:marker:${value}`,
268
235
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
269
236
  getThumbEl: (ctx) => dom.getById(ctx, dom.getThumbId(ctx)),
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  dom
3
- } from "./chunk-J5IGGBVE.mjs";
4
- import "./chunk-YREEXXZP.mjs";
3
+ } from "./chunk-55KEN77D.mjs";
4
+ import "./chunk-IJAAAKZQ.mjs";
5
5
  export {
6
6
  dom
7
7
  };
@@ -28,11 +28,11 @@ var import_core = require("@zag-js/core");
28
28
  // ../../utilities/core/src/functions.ts
29
29
  var runIfFn = (v, ...a) => {
30
30
  const res = typeof v === "function" ? v(...a) : v;
31
- return res != null ? res : void 0;
31
+ return res ?? void 0;
32
32
  };
33
33
  var callAll = (...fns) => (...a) => {
34
34
  fns.forEach(function(fn) {
35
- fn == null ? void 0 : fn(...a);
35
+ fn?.(...a);
36
36
  });
37
37
  };
38
38
 
@@ -53,9 +53,8 @@ function compact(obj) {
53
53
  // ../../utilities/dom/src/platform.ts
54
54
  var isDom = () => typeof window !== "undefined";
55
55
  function getPlatform() {
56
- var _a;
57
56
  const agent = navigator.userAgentData;
58
- return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
57
+ return agent?.platform ?? navigator.platform;
59
58
  }
60
59
  var pt = (v) => isDom() && v.test(getPlatform());
61
60
  var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
@@ -68,31 +67,23 @@ function isDocument(el) {
68
67
  return el.nodeType === Node.DOCUMENT_NODE;
69
68
  }
70
69
  function isWindow(value) {
71
- return (value == null ? void 0 : value.toString()) === "[object Window]";
70
+ return value?.toString() === "[object Window]";
72
71
  }
73
72
  function getDocument(el) {
74
- var _a;
75
73
  if (isWindow(el))
76
74
  return el.document;
77
75
  if (isDocument(el))
78
76
  return el;
79
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
77
+ return el?.ownerDocument ?? document;
80
78
  }
81
79
  function getWindow(el) {
82
- var _a;
83
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
80
+ return el?.ownerDocument.defaultView ?? window;
84
81
  }
85
82
  function defineDomHelpers(helpers) {
86
83
  const dom2 = {
87
- getRootNode: (ctx) => {
88
- var _a, _b;
89
- return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
90
- },
84
+ getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
91
85
  getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
92
- getWin: (ctx) => {
93
- var _a;
94
- return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
95
- },
86
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
96
87
  getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
97
88
  getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
98
89
  };
@@ -156,14 +147,13 @@ function extractInfo(event, type = "page") {
156
147
  }
157
148
  function addDomEvent(target, eventName, handler, options) {
158
149
  const node = isRef(target) ? target.current : runIfFn(target);
159
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
150
+ node?.addEventListener(eventName, handler, options);
160
151
  return () => {
161
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
152
+ node?.removeEventListener(eventName, handler, options);
162
153
  };
163
154
  }
164
155
  function addPointerEvent(target, event, listener, options) {
165
- var _a;
166
- const type = (_a = getEventName(event)) != null ? _a : event;
156
+ const type = getEventName(event) ?? event;
167
157
  return addDomEvent(target, type, wrapHandler(listener, event === "pointerdown"), options);
168
158
  }
169
159
  function wrapHandler(fn, filter = false) {
@@ -174,8 +164,7 @@ function wrapHandler(fn, filter = false) {
174
164
  }
175
165
  function filterPrimaryPointer(fn) {
176
166
  return (event) => {
177
- var _a;
178
- const win = (_a = event.view) != null ? _a : window;
167
+ const win = event.view ?? window;
179
168
  const isMouseEvent2 = event instanceof win.MouseEvent;
180
169
  const isPrimary = !isMouseEvent2 || isMouseEvent2 && event.button === 0;
181
170
  if (isPrimary)
@@ -251,7 +240,7 @@ var state = "default";
251
240
  var savedUserSelect = "";
252
241
  var modifiedElementMap = /* @__PURE__ */ new WeakMap();
253
242
  function disableTextSelection({ target, doc } = {}) {
254
- const _document = doc != null ? doc : document;
243
+ const _document = doc ?? document;
255
244
  if (isIos()) {
256
245
  if (state === "default") {
257
246
  savedUserSelect = _document.documentElement.style.webkitUserSelect;
@@ -265,7 +254,7 @@ function disableTextSelection({ target, doc } = {}) {
265
254
  return () => restoreTextSelection({ target, doc: _document });
266
255
  }
267
256
  function restoreTextSelection({ target, doc } = {}) {
268
- const _document = doc != null ? doc : document;
257
+ const _document = doc ?? document;
269
258
  if (isIos()) {
270
259
  if (state !== "disabled")
271
260
  return;
@@ -285,7 +274,7 @@ function restoreTextSelection({ target, doc } = {}) {
285
274
  if (target && modifiedElementMap.has(target)) {
286
275
  let targetOldUserSelect = modifiedElementMap.get(target);
287
276
  if (target.style.userSelect === "none") {
288
- target.style.userSelect = targetOldUserSelect != null ? targetOldUserSelect : "";
277
+ target.style.userSelect = targetOldUserSelect ?? "";
289
278
  }
290
279
  if (target.getAttribute("style") === "") {
291
280
  target.removeAttribute("style");
@@ -324,20 +313,18 @@ var import_element_size = require("@zag-js/element-size");
324
313
 
325
314
  // ../../utilities/form-utils/src/input-event.ts
326
315
  function getDescriptor(el, options) {
327
- var _a;
328
316
  const { type, property = "value" } = options;
329
317
  const proto = getWindow(el)[type].prototype;
330
- return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
318
+ return Object.getOwnPropertyDescriptor(proto, property) ?? {};
331
319
  }
332
320
  function dispatchInputValueEvent(el, value) {
333
- var _a;
334
321
  if (!el)
335
322
  return;
336
323
  const win = getWindow(el);
337
324
  if (!(el instanceof win.HTMLInputElement))
338
325
  return;
339
326
  const desc = getDescriptor(el, { type: "HTMLInputElement", property: "value" });
340
- (_a = desc.set) == null ? void 0 : _a.call(el, value);
327
+ desc.set?.call(el, value);
341
328
  const event = new win.Event("input", { bubbles: true });
342
329
  el.dispatchEvent(event);
343
330
  }
@@ -356,13 +343,13 @@ function trackFormReset(el, callback) {
356
343
  if (!el)
357
344
  return;
358
345
  const form = getClosestForm(el);
359
- form == null ? void 0 : form.addEventListener("reset", callback, { passive: true });
346
+ form?.addEventListener("reset", callback, { passive: true });
360
347
  return () => {
361
- form == null ? void 0 : form.removeEventListener("reset", callback);
348
+ form?.removeEventListener("reset", callback);
362
349
  };
363
350
  }
364
351
  function trackFieldsetDisabled(el, callback) {
365
- const fieldset = el == null ? void 0 : el.closest("fieldset");
352
+ const fieldset = el?.closest("fieldset");
366
353
  if (!fieldset)
367
354
  return;
368
355
  callback(fieldset.disabled);
@@ -380,7 +367,7 @@ function trackFormControl(el, options) {
380
367
  })
381
368
  ];
382
369
  return () => {
383
- cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
370
+ cleanups.forEach((cleanup) => cleanup?.());
384
371
  };
385
372
  }
386
373
 
@@ -393,14 +380,12 @@ var import_numeric_range2 = require("@zag-js/numeric-range");
393
380
  // src/slider.style.ts
394
381
  var import_numeric_range = require("@zag-js/numeric-range");
395
382
  function getVerticalThumbOffset(ctx) {
396
- var _a;
397
- const { height = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
383
+ const { height = 0 } = ctx.thumbSize ?? {};
398
384
  const getValue = (0, import_numeric_range.getValueTransformer)([ctx.min, ctx.max], [-height / 2, height / 2]);
399
385
  return parseFloat(getValue(ctx.value).toFixed(2));
400
386
  }
401
387
  function getHorizontalThumbOffset(ctx) {
402
- var _a;
403
- const { width = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
388
+ const { width = 0 } = ctx.thumbSize ?? {};
404
389
  if (ctx.isRtl) {
405
390
  const getValue2 = (0, import_numeric_range.getValueTransformer)([ctx.max, ctx.min], [-width * 1.5, -width / 2]);
406
391
  return -1 * parseFloat(getValue2(ctx.value).toFixed(2));
@@ -507,35 +492,14 @@ var styles = {
507
492
  // src/slider.dom.ts
508
493
  var dom = defineDomHelpers({
509
494
  ...styles,
510
- getRootId: (ctx) => {
511
- var _a, _b;
512
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.root) != null ? _b : `slider:${ctx.id}`;
513
- },
514
- getThumbId: (ctx) => {
515
- var _a, _b;
516
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.thumb) != null ? _b : `slider:${ctx.id}:thumb`;
517
- },
518
- getControlId: (ctx) => {
519
- var _a, _b;
520
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.control) != null ? _b : `slider:${ctx.id}:control`;
521
- },
495
+ getRootId: (ctx) => ctx.ids?.root ?? `slider:${ctx.id}`,
496
+ getThumbId: (ctx) => ctx.ids?.thumb ?? `slider:${ctx.id}:thumb`,
497
+ getControlId: (ctx) => ctx.ids?.control ?? `slider:${ctx.id}:control`,
522
498
  getHiddenInputId: (ctx) => `slider:${ctx.id}:input`,
523
- getOutputId: (ctx) => {
524
- var _a, _b;
525
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.output) != null ? _b : `slider:${ctx.id}:output`;
526
- },
527
- getTrackId: (ctx) => {
528
- var _a, _b;
529
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:${ctx.id}track`;
530
- },
531
- getRangeId: (ctx) => {
532
- var _a, _b;
533
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.track) != null ? _b : `slider:${ctx.id}:range`;
534
- },
535
- getLabelId: (ctx) => {
536
- var _a, _b;
537
- return (_b = (_a = ctx.ids) == null ? void 0 : _a.label) != null ? _b : `slider:${ctx.id}:label`;
538
- },
499
+ getOutputId: (ctx) => ctx.ids?.output ?? `slider:${ctx.id}:output`,
500
+ getTrackId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}track`,
501
+ getRangeId: (ctx) => ctx.ids?.track ?? `slider:${ctx.id}:range`,
502
+ getLabelId: (ctx) => ctx.ids?.label ?? `slider:${ctx.id}:label`,
539
503
  getMarkerId: (ctx, value) => `slider:${ctx.id}:marker:${value}`,
540
504
  getRootEl: (ctx) => dom.getById(ctx, dom.getRootId(ctx)),
541
505
  getThumbEl: (ctx) => dom.getById(ctx, dom.getThumbId(ctx)),
@@ -574,7 +538,7 @@ function decrement(ctx, step) {
574
538
  const index = 0;
575
539
  const values = (0, import_numeric_range3.getPreviousStepValue)(index, {
576
540
  ...ctx,
577
- step: step != null ? step : ctx.step,
541
+ step: step ?? ctx.step,
578
542
  values: [ctx.value]
579
543
  });
580
544
  return values[index];
@@ -583,7 +547,7 @@ function increment(ctx, step) {
583
547
  const index = 0;
584
548
  const values = (0, import_numeric_range3.getNextStepValue)(index, {
585
549
  ...ctx,
586
- step: step != null ? step : ctx.step,
550
+ step: step ?? ctx.step,
587
551
  values: [ctx.value]
588
552
  });
589
553
  return values[index];
@@ -595,7 +559,7 @@ function machine(userContext) {
595
559
  return (0, import_core.createMachine)(
596
560
  {
597
561
  id: "slider",
598
- initial: "unknown",
562
+ initial: "idle",
599
563
  context: {
600
564
  thumbSize: null,
601
565
  thumbAlignment: "contain",
@@ -634,15 +598,8 @@ function machine(userContext) {
634
598
  actions: "decrement"
635
599
  }
636
600
  },
601
+ entry: ["checkValue"],
637
602
  states: {
638
- unknown: {
639
- on: {
640
- SETUP: {
641
- target: "idle",
642
- actions: ["checkValue"]
643
- }
644
- }
645
- },
646
603
  idle: {
647
604
  on: {
648
605
  POINTER_DOWN: {
@@ -749,16 +706,13 @@ function machine(userContext) {
749
706
  ctx2.initialValue = value;
750
707
  },
751
708
  invokeOnChangeStart(ctx2) {
752
- var _a;
753
- (_a = ctx2.onChangeStart) == null ? void 0 : _a.call(ctx2, { value: ctx2.value });
709
+ ctx2.onChangeStart?.({ value: ctx2.value });
754
710
  },
755
711
  invokeOnChangeEnd(ctx2) {
756
- var _a;
757
- (_a = ctx2.onChangeEnd) == null ? void 0 : _a.call(ctx2, { value: ctx2.value });
712
+ ctx2.onChangeEnd?.({ value: ctx2.value });
758
713
  },
759
714
  invokeOnChange(ctx2) {
760
- var _a;
761
- (_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: ctx2.value });
715
+ ctx2.onChange?.({ value: ctx2.value });
762
716
  },
763
717
  dispatchChangeEvent(ctx2) {
764
718
  dom.dispatchChangeEvent(ctx2);
@@ -770,10 +724,7 @@ function machine(userContext) {
770
724
  ctx2.value = (0, import_numeric_range4.clampValue)(value, ctx2.min, ctx2.max);
771
725
  },
772
726
  focusThumb(ctx2) {
773
- raf(() => {
774
- var _a;
775
- return (_a = dom.getThumbEl(ctx2)) == null ? void 0 : _a.focus();
776
- });
727
+ raf(() => dom.getThumbEl(ctx2)?.focus());
777
728
  },
778
729
  decrement(ctx2, evt) {
779
730
  ctx2.value = decrement(ctx2, evt.step);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-A2ZK6G4F.mjs";
4
- import "./chunk-SGCWELVB.mjs";
5
- import "./chunk-J5IGGBVE.mjs";
6
- import "./chunk-YREEXXZP.mjs";
7
- import "./chunk-DRAPR6JV.mjs";
3
+ } from "./chunk-5XVLG734.mjs";
4
+ import "./chunk-3UP6QL6A.mjs";
5
+ import "./chunk-55KEN77D.mjs";
6
+ import "./chunk-IJAAAKZQ.mjs";
7
+ import "./chunk-YGFSMEUO.mjs";
8
8
  export {
9
9
  machine
10
10
  };
@@ -25,14 +25,12 @@ __export(slider_style_exports, {
25
25
  module.exports = __toCommonJS(slider_style_exports);
26
26
  var import_numeric_range = require("@zag-js/numeric-range");
27
27
  function getVerticalThumbOffset(ctx) {
28
- var _a;
29
- const { height = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
28
+ const { height = 0 } = ctx.thumbSize ?? {};
30
29
  const getValue = (0, import_numeric_range.getValueTransformer)([ctx.min, ctx.max], [-height / 2, height / 2]);
31
30
  return parseFloat(getValue(ctx.value).toFixed(2));
32
31
  }
33
32
  function getHorizontalThumbOffset(ctx) {
34
- var _a;
35
- const { width = 0 } = (_a = ctx.thumbSize) != null ? _a : {};
33
+ const { width = 0 } = ctx.thumbSize ?? {};
36
34
  if (ctx.isRtl) {
37
35
  const getValue2 = (0, import_numeric_range.getValueTransformer)([ctx.max, ctx.min], [-width * 1.5, -width / 2]);
38
36
  return -1 * parseFloat(getValue2(ctx.value).toFixed(2));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles
3
- } from "./chunk-YREEXXZP.mjs";
3
+ } from "./chunk-IJAAAKZQ.mjs";
4
4
  export {
5
5
  styles
6
6
  };
@@ -137,7 +137,7 @@ type ComputedContext = Readonly<{
137
137
  type PrivateContext = Context<{}>;
138
138
  type MachineContext = PublicContext & ComputedContext & PrivateContext;
139
139
  type MachineState = {
140
- value: "unknown" | "idle" | "dragging" | "focus";
140
+ value: "idle" | "dragging" | "focus";
141
141
  };
142
142
  type State = StateMachine.State<MachineContext, MachineState>;
143
143
  type Send = StateMachine.Send<StateMachine.AnyEventObject>;
@@ -38,7 +38,7 @@ function decrement(ctx, step) {
38
38
  const index = 0;
39
39
  const values = (0, import_numeric_range.getPreviousStepValue)(index, {
40
40
  ...ctx,
41
- step: step != null ? step : ctx.step,
41
+ step: step ?? ctx.step,
42
42
  values: [ctx.value]
43
43
  });
44
44
  return values[index];
@@ -47,7 +47,7 @@ function increment(ctx, step) {
47
47
  const index = 0;
48
48
  const values = (0, import_numeric_range.getNextStepValue)(index, {
49
49
  ...ctx,
50
- step: step != null ? step : ctx.step,
50
+ step: step ?? ctx.step,
51
51
  values: [ctx.value]
52
52
  });
53
53
  return values[index];
@@ -3,7 +3,7 @@ import {
3
3
  constrainValue,
4
4
  decrement,
5
5
  increment
6
- } from "./chunk-DRAPR6JV.mjs";
6
+ } from "./chunk-YGFSMEUO.mjs";
7
7
  export {
8
8
  clampPercent,
9
9
  constrainValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/slider",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Core logic for the slider widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,17 +26,17 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/anatomy": "0.1.3",
30
- "@zag-js/core": "0.2.5",
31
- "@zag-js/element-size": "0.3.1",
32
- "@zag-js/numeric-range": "0.1.0",
33
- "@zag-js/types": "0.3.3"
29
+ "@zag-js/anatomy": "0.1.4",
30
+ "@zag-js/core": "0.2.7",
31
+ "@zag-js/element-size": "0.3.2",
32
+ "@zag-js/numeric-range": "0.1.1",
33
+ "@zag-js/types": "0.3.4"
34
34
  },
35
35
  "devDependencies": {
36
36
  "clean-package": "2.2.0",
37
- "@zag-js/dom-utils": "0.2.3",
38
- "@zag-js/form-utils": "0.2.3",
39
- "@zag-js/utils": "0.3.2"
37
+ "@zag-js/dom-utils": "0.2.4",
38
+ "@zag-js/form-utils": "0.2.4",
39
+ "@zag-js/utils": "0.3.3"
40
40
  },
41
41
  "clean-package": "../../../clean-package.config.json",
42
42
  "main": "dist/index.js",