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