@zag-js/slider 1.47.0 → 1.49.0

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,354 +1,374 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/slider.connect.ts
31
- var slider_connect_exports = {};
32
- __export(slider_connect_exports, {
33
- connect: () => connect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(slider_connect_exports);
36
- var import_dom_query = require("@zag-js/dom-query");
37
- var import_utils = require("@zag-js/utils");
38
- var import_slider = require("./slider.anatomy.js");
39
- var dom = __toESM(require("./slider.dom.js"));
40
- var import_slider2 = require("./slider.style.js");
41
- var import_slider3 = require("./slider.utils.js");
5
+ let _zag_js_dom_query = require("@zag-js/dom-query");
6
+ let _zag_js_utils = require("@zag-js/utils");
7
+ const require_slider_anatomy = require("./slider.anatomy.js");
8
+ const require_slider_dom = require("./slider.dom.js");
9
+ const require_slider_style = require("./slider.style.js");
10
+ const require_slider_utils = require("./slider.utils.js");
11
+ // src/slider.connect.ts
42
12
  function connect(service, normalize) {
43
- const { state, send, context, prop, computed, scope } = service;
44
- const ariaLabel = prop("aria-label");
45
- const ariaLabelledBy = prop("aria-labelledby");
46
- const sliderValue = context.get("value");
47
- const focusedIndex = context.get("focusedIndex");
48
- const focused = state.matches("focus");
49
- const dragging = state.matches("dragging");
50
- const disabled = computed("isDisabled");
51
- const invalid = prop("invalid");
52
- const interactive = computed("isInteractive");
53
- const isHorizontal = prop("orientation") === "horizontal";
54
- const isVertical = prop("orientation") === "vertical";
55
- function getValuePercentFn(value) {
56
- return (0, import_utils.getValuePercent)(value, prop("min"), prop("max"));
57
- }
58
- function getPercentValueFn(percent) {
59
- return (0, import_utils.getPercentValue)(percent, prop("min"), prop("max"), prop("step"));
60
- }
61
- return {
62
- value: sliderValue,
63
- dragging,
64
- focused,
65
- setValue(value) {
66
- send({ type: "SET_VALUE", value });
67
- },
68
- getThumbValue(index) {
69
- return sliderValue[index];
70
- },
71
- setThumbValue(index, value) {
72
- send({ type: "SET_VALUE", index, value });
73
- },
74
- getValuePercent: getValuePercentFn,
75
- getPercentValue: getPercentValueFn,
76
- getThumbPercent(index) {
77
- return getValuePercentFn(sliderValue[index]);
78
- },
79
- setThumbPercent(index, percent) {
80
- const value = getPercentValueFn(percent);
81
- send({ type: "SET_VALUE", index, value });
82
- },
83
- getThumbMin(index) {
84
- return (0, import_slider3.getRangeAtIndex)(service, index).min;
85
- },
86
- getThumbMax(index) {
87
- return (0, import_slider3.getRangeAtIndex)(service, index).max;
88
- },
89
- increment(index) {
90
- send({ type: "INCREMENT", index });
91
- },
92
- decrement(index) {
93
- send({ type: "DECREMENT", index });
94
- },
95
- focus() {
96
- if (!interactive) return;
97
- send({ type: "FOCUS", index: 0 });
98
- },
99
- getLabelProps() {
100
- return normalize.label({
101
- ...import_slider.parts.label.attrs,
102
- dir: prop("dir"),
103
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
104
- "data-orientation": prop("orientation"),
105
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
106
- "data-dragging": (0, import_dom_query.dataAttr)(dragging),
107
- "data-focus": (0, import_dom_query.dataAttr)(focused),
108
- id: dom.getLabelId(scope),
109
- htmlFor: dom.getHiddenInputId(scope, 0),
110
- onClick(event) {
111
- if (!interactive) return;
112
- event.preventDefault();
113
- dom.getFirstThumbEl(scope)?.focus();
114
- },
115
- style: {
116
- userSelect: "none",
117
- WebkitUserSelect: "none"
118
- }
119
- });
120
- },
121
- getRootProps() {
122
- return normalize.element({
123
- ...import_slider.parts.root.attrs,
124
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
125
- "data-orientation": prop("orientation"),
126
- "data-dragging": (0, import_dom_query.dataAttr)(dragging),
127
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
128
- "data-focus": (0, import_dom_query.dataAttr)(focused),
129
- id: dom.getRootId(scope),
130
- dir: prop("dir"),
131
- style: (0, import_slider2.getRootStyle)(service)
132
- });
133
- },
134
- getValueTextProps() {
135
- return normalize.element({
136
- ...import_slider.parts.valueText.attrs,
137
- dir: prop("dir"),
138
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
139
- "data-orientation": prop("orientation"),
140
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
141
- "data-focus": (0, import_dom_query.dataAttr)(focused),
142
- id: dom.getValueTextId(scope)
143
- });
144
- },
145
- getTrackProps() {
146
- return normalize.element({
147
- ...import_slider.parts.track.attrs,
148
- dir: prop("dir"),
149
- id: dom.getTrackId(scope),
150
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
151
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
152
- "data-dragging": (0, import_dom_query.dataAttr)(dragging),
153
- "data-orientation": prop("orientation"),
154
- "data-focus": (0, import_dom_query.dataAttr)(focused),
155
- style: { position: "relative" }
156
- });
157
- },
158
- getThumbProps(props) {
159
- const { index = 0, name } = props;
160
- const value = sliderValue[index];
161
- const range = (0, import_slider3.getRangeAtIndex)(service, index);
162
- const valueText = prop("getAriaValueText")?.({ value, index });
163
- const _ariaLabel = Array.isArray(ariaLabel) ? ariaLabel[index] : ariaLabel;
164
- const _ariaLabelledBy = Array.isArray(ariaLabelledBy) ? ariaLabelledBy[index] : ariaLabelledBy;
165
- return normalize.element({
166
- ...import_slider.parts.thumb.attrs,
167
- dir: prop("dir"),
168
- "data-index": index,
169
- "data-name": name,
170
- id: dom.getThumbId(scope, index),
171
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
172
- "data-orientation": prop("orientation"),
173
- "data-focus": (0, import_dom_query.dataAttr)(focused && focusedIndex === index),
174
- "data-dragging": (0, import_dom_query.dataAttr)(dragging && focusedIndex === index),
175
- draggable: false,
176
- "aria-disabled": (0, import_dom_query.ariaAttr)(disabled),
177
- "aria-label": _ariaLabel,
178
- "aria-labelledby": _ariaLabelledBy ?? dom.getLabelId(scope),
179
- "aria-orientation": prop("orientation"),
180
- "aria-valuemax": range.max,
181
- "aria-valuemin": range.min,
182
- "aria-valuenow": sliderValue[index],
183
- "aria-valuetext": valueText,
184
- role: "slider",
185
- tabIndex: disabled ? void 0 : 0,
186
- style: (0, import_slider2.getThumbStyle)(service, index),
187
- onPointerDown(event) {
188
- if (!interactive) return;
189
- if (!(0, import_dom_query.isLeftClick)(event)) return;
190
- const thumbEl = event.currentTarget;
191
- const rect = thumbEl.getBoundingClientRect();
192
- const midpoint = {
193
- x: rect.left + rect.width / 2,
194
- y: rect.top + rect.height / 2
195
- };
196
- const offset = {
197
- x: event.clientX - midpoint.x,
198
- y: event.clientY - midpoint.y
199
- };
200
- send({ type: "THUMB_POINTER_DOWN", index, offset });
201
- event.stopPropagation();
202
- },
203
- onBlur() {
204
- if (!interactive) return;
205
- send({ type: "BLUR" });
206
- },
207
- onFocus() {
208
- if (!interactive) return;
209
- send({ type: "FOCUS", index });
210
- },
211
- onKeyDown(event) {
212
- if (event.defaultPrevented) return;
213
- if (!interactive) return;
214
- const step = (0, import_dom_query.getEventStepValue)(event, { step: prop("step"), largeStep: prop("largeStep") });
215
- const keyMap = {
216
- ArrowUp() {
217
- if (isHorizontal) return;
218
- send({ type: "ARROW_INC", step, src: "ArrowUp" });
219
- },
220
- ArrowDown() {
221
- if (isHorizontal) return;
222
- send({ type: "ARROW_DEC", step, src: "ArrowDown" });
223
- },
224
- ArrowLeft() {
225
- if (isVertical) return;
226
- send({ type: "ARROW_DEC", step, src: "ArrowLeft" });
227
- },
228
- ArrowRight() {
229
- if (isVertical) return;
230
- send({ type: "ARROW_INC", step, src: "ArrowRight" });
231
- },
232
- PageUp() {
233
- send({ type: "ARROW_INC", step, src: "PageUp" });
234
- },
235
- PageDown() {
236
- send({ type: "ARROW_DEC", step, src: "PageDown" });
237
- },
238
- Home() {
239
- send({ type: "HOME" });
240
- },
241
- End() {
242
- send({ type: "END" });
243
- }
244
- };
245
- const key = (0, import_dom_query.getEventKey)(event, {
246
- dir: prop("dir"),
247
- orientation: prop("orientation")
248
- });
249
- const exec = keyMap[key];
250
- if (exec) {
251
- exec(event);
252
- event.preventDefault();
253
- event.stopPropagation();
254
- }
255
- }
256
- });
257
- },
258
- getHiddenInputProps(props) {
259
- const { index = 0, name } = props;
260
- return normalize.input({
261
- name: name ?? (prop("name") ? prop("name") + (sliderValue.length > 1 ? "[]" : "") : void 0),
262
- form: prop("form"),
263
- type: "text",
264
- hidden: true,
265
- defaultValue: sliderValue[index],
266
- id: dom.getHiddenInputId(scope, index)
267
- });
268
- },
269
- getRangeProps() {
270
- return normalize.element({
271
- id: dom.getRangeId(scope),
272
- ...import_slider.parts.range.attrs,
273
- dir: prop("dir"),
274
- "data-dragging": (0, import_dom_query.dataAttr)(dragging),
275
- "data-focus": (0, import_dom_query.dataAttr)(focused),
276
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
277
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
278
- "data-orientation": prop("orientation"),
279
- style: (0, import_slider2.getRangeStyle)(service)
280
- });
281
- },
282
- getControlProps() {
283
- return normalize.element({
284
- ...import_slider.parts.control.attrs,
285
- dir: prop("dir"),
286
- id: dom.getControlId(scope),
287
- "data-dragging": (0, import_dom_query.dataAttr)(dragging),
288
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
289
- "data-orientation": prop("orientation"),
290
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
291
- "data-focus": (0, import_dom_query.dataAttr)(focused),
292
- style: (0, import_slider2.getControlStyle)(),
293
- onPointerDown(event) {
294
- if (!interactive) return;
295
- if (!(0, import_dom_query.isLeftClick)(event)) return;
296
- if ((0, import_dom_query.isModifierKey)(event)) return;
297
- const point = (0, import_dom_query.getEventPoint)(event);
298
- send({ type: "POINTER_DOWN", point });
299
- event.preventDefault();
300
- event.stopPropagation();
301
- }
302
- });
303
- },
304
- getMarkerGroupProps() {
305
- return normalize.element({
306
- ...import_slider.parts.markerGroup.attrs,
307
- role: "presentation",
308
- dir: prop("dir"),
309
- "aria-hidden": true,
310
- "data-orientation": prop("orientation"),
311
- style: (0, import_slider2.getMarkerGroupStyle)()
312
- });
313
- },
314
- getMarkerProps(props) {
315
- const style = (0, import_slider2.getMarkerStyle)(service, props.value);
316
- let markerState;
317
- if (props.value < (0, import_utils.first)(sliderValue)) {
318
- markerState = "under-value";
319
- } else if (props.value > (0, import_utils.last)(sliderValue)) {
320
- markerState = "over-value";
321
- } else {
322
- markerState = "at-value";
323
- }
324
- return normalize.element({
325
- ...import_slider.parts.marker.attrs,
326
- id: dom.getMarkerId(scope, props.value),
327
- role: "presentation",
328
- dir: prop("dir"),
329
- "data-orientation": prop("orientation"),
330
- "data-value": props.value,
331
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
332
- "data-state": markerState,
333
- style
334
- });
335
- },
336
- getDraggingIndicatorProps(props) {
337
- const { index = 0 } = props;
338
- const isDragging = index === focusedIndex && dragging;
339
- return normalize.element({
340
- ...import_slider.parts.draggingIndicator.attrs,
341
- role: "presentation",
342
- dir: prop("dir"),
343
- hidden: !isDragging,
344
- "data-orientation": prop("orientation"),
345
- "data-state": isDragging ? "open" : "closed",
346
- style: (0, import_slider2.getThumbStyle)(service, index)
347
- });
348
- }
349
- };
13
+ const { state, send, context, prop, computed, scope } = service;
14
+ const ariaLabel = prop("aria-label");
15
+ const ariaLabelledBy = prop("aria-labelledby");
16
+ const sliderValue = context.get("value");
17
+ const focusedIndex = context.get("focusedIndex");
18
+ const focused = state.matches("focus");
19
+ const dragging = state.matches("dragging");
20
+ const disabled = computed("isDisabled");
21
+ const invalid = prop("invalid");
22
+ const interactive = computed("isInteractive");
23
+ const isHorizontal = prop("orientation") === "horizontal";
24
+ const isVertical = prop("orientation") === "vertical";
25
+ function getValuePercentFn(value) {
26
+ return (0, _zag_js_utils.getValuePercent)(value, prop("min"), prop("max"));
27
+ }
28
+ function getPercentValueFn(percent) {
29
+ return (0, _zag_js_utils.getPercentValue)(percent, prop("min"), prop("max"), prop("step"));
30
+ }
31
+ return {
32
+ value: sliderValue,
33
+ dragging,
34
+ focused,
35
+ setValue(value) {
36
+ send({
37
+ type: "SET_VALUE",
38
+ value
39
+ });
40
+ },
41
+ getThumbValue(index) {
42
+ return sliderValue[index];
43
+ },
44
+ setThumbValue(index, value) {
45
+ send({
46
+ type: "SET_VALUE",
47
+ index,
48
+ value
49
+ });
50
+ },
51
+ getValuePercent: getValuePercentFn,
52
+ getPercentValue: getPercentValueFn,
53
+ getThumbPercent(index) {
54
+ return getValuePercentFn(sliderValue[index]);
55
+ },
56
+ setThumbPercent(index, percent) {
57
+ const value = getPercentValueFn(percent);
58
+ send({
59
+ type: "SET_VALUE",
60
+ index,
61
+ value
62
+ });
63
+ },
64
+ getThumbMin(index) {
65
+ return require_slider_utils.getRangeAtIndex(service, index).min;
66
+ },
67
+ getThumbMax(index) {
68
+ return require_slider_utils.getRangeAtIndex(service, index).max;
69
+ },
70
+ increment(index) {
71
+ send({
72
+ type: "INCREMENT",
73
+ index
74
+ });
75
+ },
76
+ decrement(index) {
77
+ send({
78
+ type: "DECREMENT",
79
+ index
80
+ });
81
+ },
82
+ focus() {
83
+ if (!interactive) return;
84
+ send({
85
+ type: "FOCUS",
86
+ index: 0
87
+ });
88
+ },
89
+ getLabelProps() {
90
+ return normalize.label({
91
+ ...require_slider_anatomy.parts.label.attrs,
92
+ dir: prop("dir"),
93
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
94
+ "data-orientation": prop("orientation"),
95
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
96
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging),
97
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
98
+ id: require_slider_dom.getLabelId(scope),
99
+ htmlFor: require_slider_dom.getHiddenInputId(scope, 0),
100
+ onClick(event) {
101
+ if (!interactive) return;
102
+ event.preventDefault();
103
+ require_slider_dom.getFirstThumbEl(scope)?.focus();
104
+ },
105
+ style: {
106
+ userSelect: "none",
107
+ WebkitUserSelect: "none"
108
+ }
109
+ });
110
+ },
111
+ getRootProps() {
112
+ return normalize.element({
113
+ ...require_slider_anatomy.parts.root.attrs,
114
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
115
+ "data-orientation": prop("orientation"),
116
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging),
117
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
118
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
119
+ id: require_slider_dom.getRootId(scope),
120
+ dir: prop("dir"),
121
+ style: require_slider_style.getRootStyle(service)
122
+ });
123
+ },
124
+ getValueTextProps() {
125
+ return normalize.element({
126
+ ...require_slider_anatomy.parts.valueText.attrs,
127
+ dir: prop("dir"),
128
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
129
+ "data-orientation": prop("orientation"),
130
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
131
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
132
+ id: require_slider_dom.getValueTextId(scope)
133
+ });
134
+ },
135
+ getTrackProps() {
136
+ return normalize.element({
137
+ ...require_slider_anatomy.parts.track.attrs,
138
+ dir: prop("dir"),
139
+ id: require_slider_dom.getTrackId(scope),
140
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
141
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
142
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging),
143
+ "data-orientation": prop("orientation"),
144
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
145
+ style: { position: "relative" }
146
+ });
147
+ },
148
+ getThumbProps(props) {
149
+ const { index = 0, name } = props;
150
+ const value = sliderValue[index];
151
+ const range = require_slider_utils.getRangeAtIndex(service, index);
152
+ const valueText = prop("getAriaValueText")?.({
153
+ value,
154
+ index
155
+ });
156
+ const _ariaLabel = Array.isArray(ariaLabel) ? ariaLabel[index] : ariaLabel;
157
+ const _ariaLabelledBy = Array.isArray(ariaLabelledBy) ? ariaLabelledBy[index] : ariaLabelledBy;
158
+ return normalize.element({
159
+ ...require_slider_anatomy.parts.thumb.attrs,
160
+ dir: prop("dir"),
161
+ "data-index": index,
162
+ "data-name": name,
163
+ id: require_slider_dom.getThumbId(scope, index),
164
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
165
+ "data-orientation": prop("orientation"),
166
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused && focusedIndex === index),
167
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging && focusedIndex === index),
168
+ draggable: false,
169
+ "aria-disabled": (0, _zag_js_dom_query.ariaAttr)(disabled),
170
+ "aria-label": _ariaLabel,
171
+ "aria-labelledby": _ariaLabelledBy ?? require_slider_dom.getLabelId(scope),
172
+ "aria-orientation": prop("orientation"),
173
+ "aria-valuemax": range.max,
174
+ "aria-valuemin": range.min,
175
+ "aria-valuenow": sliderValue[index],
176
+ "aria-valuetext": valueText,
177
+ role: "slider",
178
+ tabIndex: disabled ? void 0 : 0,
179
+ style: require_slider_style.getThumbStyle(service, index),
180
+ onPointerDown(event) {
181
+ if (!interactive) return;
182
+ if (!(0, _zag_js_dom_query.isLeftClick)(event)) return;
183
+ const rect = event.currentTarget.getBoundingClientRect();
184
+ const midpoint = {
185
+ x: rect.left + rect.width / 2,
186
+ y: rect.top + rect.height / 2
187
+ };
188
+ const offset = {
189
+ x: event.clientX - midpoint.x,
190
+ y: event.clientY - midpoint.y
191
+ };
192
+ send({
193
+ type: "THUMB_POINTER_DOWN",
194
+ index,
195
+ offset
196
+ });
197
+ event.stopPropagation();
198
+ },
199
+ onBlur() {
200
+ if (!interactive) return;
201
+ send({ type: "BLUR" });
202
+ },
203
+ onFocus() {
204
+ if (!interactive) return;
205
+ send({
206
+ type: "FOCUS",
207
+ index
208
+ });
209
+ },
210
+ onKeyDown(event) {
211
+ if (event.defaultPrevented) return;
212
+ if (!interactive) return;
213
+ const step = (0, _zag_js_dom_query.getEventStepValue)(event, {
214
+ step: prop("step"),
215
+ largeStep: prop("largeStep")
216
+ });
217
+ const exec = {
218
+ ArrowUp() {
219
+ if (isHorizontal) return;
220
+ send({
221
+ type: "ARROW_INC",
222
+ step,
223
+ src: "ArrowUp"
224
+ });
225
+ },
226
+ ArrowDown() {
227
+ if (isHorizontal) return;
228
+ send({
229
+ type: "ARROW_DEC",
230
+ step,
231
+ src: "ArrowDown"
232
+ });
233
+ },
234
+ ArrowLeft() {
235
+ if (isVertical) return;
236
+ send({
237
+ type: "ARROW_DEC",
238
+ step,
239
+ src: "ArrowLeft"
240
+ });
241
+ },
242
+ ArrowRight() {
243
+ if (isVertical) return;
244
+ send({
245
+ type: "ARROW_INC",
246
+ step,
247
+ src: "ArrowRight"
248
+ });
249
+ },
250
+ PageUp() {
251
+ send({
252
+ type: "ARROW_INC",
253
+ step,
254
+ src: "PageUp"
255
+ });
256
+ },
257
+ PageDown() {
258
+ send({
259
+ type: "ARROW_DEC",
260
+ step,
261
+ src: "PageDown"
262
+ });
263
+ },
264
+ Home() {
265
+ send({ type: "HOME" });
266
+ },
267
+ End() {
268
+ send({ type: "END" });
269
+ }
270
+ }[(0, _zag_js_dom_query.getEventKey)(event, {
271
+ dir: prop("dir"),
272
+ orientation: prop("orientation")
273
+ })];
274
+ if (exec) {
275
+ exec(event);
276
+ event.preventDefault();
277
+ event.stopPropagation();
278
+ }
279
+ }
280
+ });
281
+ },
282
+ getHiddenInputProps(props) {
283
+ const { index = 0, name } = props;
284
+ return normalize.input({
285
+ name: name ?? (prop("name") ? prop("name") + (sliderValue.length > 1 ? "[]" : "") : void 0),
286
+ form: prop("form"),
287
+ type: "text",
288
+ hidden: true,
289
+ defaultValue: sliderValue[index],
290
+ id: require_slider_dom.getHiddenInputId(scope, index)
291
+ });
292
+ },
293
+ getRangeProps() {
294
+ return normalize.element({
295
+ id: require_slider_dom.getRangeId(scope),
296
+ ...require_slider_anatomy.parts.range.attrs,
297
+ dir: prop("dir"),
298
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging),
299
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
300
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
301
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
302
+ "data-orientation": prop("orientation"),
303
+ style: require_slider_style.getRangeStyle(service)
304
+ });
305
+ },
306
+ getControlProps() {
307
+ return normalize.element({
308
+ ...require_slider_anatomy.parts.control.attrs,
309
+ dir: prop("dir"),
310
+ id: require_slider_dom.getControlId(scope),
311
+ "data-dragging": (0, _zag_js_dom_query.dataAttr)(dragging),
312
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
313
+ "data-orientation": prop("orientation"),
314
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
315
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
316
+ style: require_slider_style.getControlStyle(),
317
+ onPointerDown(event) {
318
+ if (!interactive) return;
319
+ if (!(0, _zag_js_dom_query.isLeftClick)(event)) return;
320
+ if ((0, _zag_js_dom_query.isModifierKey)(event)) return;
321
+ const point = (0, _zag_js_dom_query.getEventPoint)(event);
322
+ send({
323
+ type: "POINTER_DOWN",
324
+ point
325
+ });
326
+ event.preventDefault();
327
+ event.stopPropagation();
328
+ }
329
+ });
330
+ },
331
+ getMarkerGroupProps() {
332
+ return normalize.element({
333
+ ...require_slider_anatomy.parts.markerGroup.attrs,
334
+ role: "presentation",
335
+ dir: prop("dir"),
336
+ "aria-hidden": true,
337
+ "data-orientation": prop("orientation"),
338
+ style: require_slider_style.getMarkerGroupStyle()
339
+ });
340
+ },
341
+ getMarkerProps(props) {
342
+ const style = require_slider_style.getMarkerStyle(service, props.value);
343
+ let markerState;
344
+ if (props.value < (0, _zag_js_utils.first)(sliderValue)) markerState = "under-value";
345
+ else if (props.value > (0, _zag_js_utils.last)(sliderValue)) markerState = "over-value";
346
+ else markerState = "at-value";
347
+ return normalize.element({
348
+ ...require_slider_anatomy.parts.marker.attrs,
349
+ id: require_slider_dom.getMarkerId(scope, props.value),
350
+ role: "presentation",
351
+ dir: prop("dir"),
352
+ "data-orientation": prop("orientation"),
353
+ "data-value": props.value,
354
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
355
+ "data-state": markerState,
356
+ style
357
+ });
358
+ },
359
+ getDraggingIndicatorProps(props) {
360
+ const { index = 0 } = props;
361
+ const isDragging = index === focusedIndex && dragging;
362
+ return normalize.element({
363
+ ...require_slider_anatomy.parts.draggingIndicator.attrs,
364
+ role: "presentation",
365
+ dir: prop("dir"),
366
+ hidden: !isDragging,
367
+ "data-orientation": prop("orientation"),
368
+ "data-state": isDragging ? "open" : "closed",
369
+ style: require_slider_style.getThumbStyle(service, index)
370
+ });
371
+ }
372
+ };
350
373
  }
351
- // Annotate the CommonJS export names for ESM import in node:
352
- 0 && (module.exports = {
353
- connect
354
- });
374
+ exports.connect = connect;