@cdx-ui/primitives 0.0.1-beta.170 → 0.0.1-beta.172

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.
Files changed (112) hide show
  1. package/lib/commonjs/accordion/Accordion.js +59 -0
  2. package/lib/commonjs/accordion/Accordion.js.map +1 -0
  3. package/lib/commonjs/accordion/AccordionItem.js +68 -0
  4. package/lib/commonjs/accordion/AccordionItem.js.map +1 -0
  5. package/lib/commonjs/accordion/AccordionPanel.js +71 -0
  6. package/lib/commonjs/accordion/AccordionPanel.js.map +1 -0
  7. package/lib/commonjs/accordion/AccordionTrigger.js +122 -0
  8. package/lib/commonjs/accordion/AccordionTrigger.js.map +1 -0
  9. package/lib/commonjs/accordion/context.js +26 -0
  10. package/lib/commonjs/accordion/context.js.map +1 -0
  11. package/lib/commonjs/accordion/index.js +59 -0
  12. package/lib/commonjs/accordion/index.js.map +1 -0
  13. package/lib/commonjs/accordion/types.js +6 -0
  14. package/lib/commonjs/accordion/types.js.map +1 -0
  15. package/lib/commonjs/accordion/utils.js +24 -0
  16. package/lib/commonjs/accordion/utils.js.map +1 -0
  17. package/lib/commonjs/index.js +12 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/slider/SliderRail.js +35 -9
  20. package/lib/commonjs/slider/SliderRail.js.map +1 -1
  21. package/lib/commonjs/slider/SliderRoot.js +155 -97
  22. package/lib/commonjs/slider/SliderRoot.js.map +1 -1
  23. package/lib/commonjs/slider/SliderThumb.js +182 -68
  24. package/lib/commonjs/slider/SliderThumb.js.map +1 -1
  25. package/lib/commonjs/slider/context.js +4 -1
  26. package/lib/commonjs/slider/context.js.map +1 -1
  27. package/lib/commonjs/slider/index.js +36 -0
  28. package/lib/commonjs/slider/index.js.map +1 -1
  29. package/lib/commonjs/slider/useSliderPointer.js +1 -1
  30. package/lib/commonjs/slider/useSliderPointer.js.map +1 -1
  31. package/lib/commonjs/slider/utils.js +68 -0
  32. package/lib/commonjs/slider/utils.js.map +1 -1
  33. package/lib/module/accordion/Accordion.js +55 -0
  34. package/lib/module/accordion/Accordion.js.map +1 -0
  35. package/lib/module/accordion/AccordionItem.js +64 -0
  36. package/lib/module/accordion/AccordionItem.js.map +1 -0
  37. package/lib/module/accordion/AccordionPanel.js +67 -0
  38. package/lib/module/accordion/AccordionPanel.js.map +1 -0
  39. package/lib/module/accordion/AccordionTrigger.js +118 -0
  40. package/lib/module/accordion/AccordionTrigger.js.map +1 -0
  41. package/lib/module/accordion/context.js +20 -0
  42. package/lib/module/accordion/context.js.map +1 -0
  43. package/lib/module/accordion/index.js +8 -0
  44. package/lib/module/accordion/index.js.map +1 -0
  45. package/lib/module/accordion/types.js +4 -0
  46. package/lib/module/accordion/types.js.map +1 -0
  47. package/lib/module/accordion/utils.js +19 -0
  48. package/lib/module/accordion/utils.js.map +1 -0
  49. package/lib/module/index.js +1 -0
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/slider/SliderRail.js +35 -9
  52. package/lib/module/slider/SliderRail.js.map +1 -1
  53. package/lib/module/slider/SliderRoot.js +157 -99
  54. package/lib/module/slider/SliderRoot.js.map +1 -1
  55. package/lib/module/slider/SliderThumb.js +185 -71
  56. package/lib/module/slider/SliderThumb.js.map +1 -1
  57. package/lib/module/slider/context.js +1 -0
  58. package/lib/module/slider/context.js.map +1 -1
  59. package/lib/module/slider/index.js +2 -2
  60. package/lib/module/slider/index.js.map +1 -1
  61. package/lib/module/slider/useSliderPointer.js +1 -1
  62. package/lib/module/slider/useSliderPointer.js.map +1 -1
  63. package/lib/module/slider/utils.js +63 -0
  64. package/lib/module/slider/utils.js.map +1 -1
  65. package/lib/typescript/accordion/Accordion.d.ts +8 -0
  66. package/lib/typescript/accordion/Accordion.d.ts.map +1 -0
  67. package/lib/typescript/accordion/AccordionItem.d.ts +8 -0
  68. package/lib/typescript/accordion/AccordionItem.d.ts.map +1 -0
  69. package/lib/typescript/accordion/AccordionPanel.d.ts +7 -0
  70. package/lib/typescript/accordion/AccordionPanel.d.ts.map +1 -0
  71. package/lib/typescript/accordion/AccordionTrigger.d.ts +6 -0
  72. package/lib/typescript/accordion/AccordionTrigger.d.ts.map +1 -0
  73. package/lib/typescript/accordion/context.d.ts +6 -0
  74. package/lib/typescript/accordion/context.d.ts.map +1 -0
  75. package/lib/typescript/accordion/index.d.ts +7 -0
  76. package/lib/typescript/accordion/index.d.ts.map +1 -0
  77. package/lib/typescript/accordion/types.d.ts +50 -0
  78. package/lib/typescript/accordion/types.d.ts.map +1 -0
  79. package/lib/typescript/accordion/utils.d.ts +4 -0
  80. package/lib/typescript/accordion/utils.d.ts.map +1 -0
  81. package/lib/typescript/index.d.ts +1 -0
  82. package/lib/typescript/index.d.ts.map +1 -1
  83. package/lib/typescript/slider/SliderRail.d.ts.map +1 -1
  84. package/lib/typescript/slider/SliderRoot.d.ts +2 -2
  85. package/lib/typescript/slider/SliderRoot.d.ts.map +1 -1
  86. package/lib/typescript/slider/SliderThumb.d.ts.map +1 -1
  87. package/lib/typescript/slider/context.d.ts +53 -9
  88. package/lib/typescript/slider/context.d.ts.map +1 -1
  89. package/lib/typescript/slider/index.d.ts +4 -4
  90. package/lib/typescript/slider/index.d.ts.map +1 -1
  91. package/lib/typescript/slider/types.d.ts +44 -8
  92. package/lib/typescript/slider/types.d.ts.map +1 -1
  93. package/lib/typescript/slider/utils.d.ts +8 -0
  94. package/lib/typescript/slider/utils.d.ts.map +1 -1
  95. package/package.json +5 -3
  96. package/src/accordion/Accordion.tsx +72 -0
  97. package/src/accordion/AccordionItem.tsx +70 -0
  98. package/src/accordion/AccordionPanel.tsx +72 -0
  99. package/src/accordion/AccordionTrigger.tsx +120 -0
  100. package/src/accordion/context.tsx +22 -0
  101. package/src/accordion/index.ts +21 -0
  102. package/src/accordion/types.ts +56 -0
  103. package/src/accordion/utils.ts +22 -0
  104. package/src/index.ts +1 -0
  105. package/src/slider/SliderRail.tsx +56 -8
  106. package/src/slider/SliderRoot.tsx +255 -136
  107. package/src/slider/SliderThumb.tsx +240 -88
  108. package/src/slider/context.tsx +53 -9
  109. package/src/slider/index.ts +9 -2
  110. package/src/slider/types.ts +49 -8
  111. package/src/slider/useSliderPointer.ts +1 -1
  112. package/src/slider/utils.ts +76 -0
@@ -1,25 +1,32 @@
1
- import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
2
- import {
3
- Platform,
4
- View,
5
- type NativeSyntheticEvent,
6
- type TargetedEvent,
7
- type ViewProps,
8
- } from 'react-native';
1
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Platform, View, type ViewProps } from 'react-native';
9
3
  import { composeEventHandlers, useControllableState } from '@cdx-ui/utils';
10
- import { useFocus } from '@react-native-aria/focus';
11
4
  import { Slot } from '../slot';
12
5
  import { dataAttributes } from '../utils/dataAttributes';
13
6
  import { SliderProvider, type SliderTrackLayout } from './context';
14
- import type { InterfaceSliderProps } from './types';
15
- import { clamp, formatSliderValue, snapToStep, valueToPercent } from './utils';
16
-
17
- const STEP_KEYS = new Set(['ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft', 'Home', 'End']);
7
+ import type { SliderRootImplementationProps } from './types';
8
+ import {
9
+ arraysEqual,
10
+ clamp,
11
+ denormalizeSliderValue,
12
+ formatSliderValue,
13
+ getClosestValueIndex,
14
+ normalizeSliderValue,
15
+ snapToStep,
16
+ valueToPercent,
17
+ } from './utils';
18
18
 
19
- export interface SliderRootProps extends InterfaceSliderProps {
19
+ export interface SliderRootProps extends SliderRootImplementationProps {
20
20
  readonly asChild?: boolean;
21
21
  }
22
22
 
23
+ function isArrayShape(
24
+ value: number | readonly number[] | undefined,
25
+ defaultValue: number | readonly number[] | undefined,
26
+ ): boolean {
27
+ return Array.isArray(value) || Array.isArray(defaultValue);
28
+ }
29
+
23
30
  export const SliderRoot = forwardRef<View, SliderRootProps>(
24
31
  (
25
32
  {
@@ -35,8 +42,6 @@ export const SliderRoot = forwardRef<View, SliderRootProps>(
35
42
  orientation = 'horizontal',
36
43
  accessibilityLabel,
37
44
  accessibilityValue: accessibilityValueProp,
38
- accessibilityRole = 'adjustable',
39
- role = 'slider',
40
45
  children,
41
46
  onLayout,
42
47
  ...props
@@ -45,42 +50,173 @@ export const SliderRoot = forwardRef<View, SliderRootProps>(
45
50
  ) => {
46
51
  const [trackLayout, setTrackLayoutState] = useState<SliderTrackLayout | null>(null);
47
52
  const [thumbSize, setThumbSizeState] = useState(20);
48
- const [isDragging, setIsDragging] = useState(false);
49
- const [isHovered, setIsHovered] = useState(false);
50
- const [isFocusedState, setIsFocusedState] = useState(false);
51
- const thumbRef = useRef<View>(null);
52
- const { focusProps, isFocused } = useFocus();
53
-
54
- const resolvedDefault = defaultValue ?? min;
55
- const [value, setValueState] = useControllableState<number>({
56
- prop: valueProp,
57
- defaultProp: resolvedDefault,
58
- onChange,
53
+ const [draggingIndex, setDraggingIndex] = useState<number | null>(null);
54
+ const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
55
+ const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
56
+ const [registeredThumbCounts, setRegisteredThumbCounts] = useState<Map<number, number>>(
57
+ () => new Map(),
58
+ );
59
+ const deprecatedThumbRef = useRef<View>(null);
60
+
61
+ const isRangeShapeRef = useRef(isArrayShape(valueProp, defaultValue));
62
+ isRangeShapeRef.current = isArrayShape(valueProp, defaultValue);
63
+
64
+ const resolvedDefaultScalar = typeof defaultValue === 'number' ? defaultValue : min;
65
+ const resolvedDefaultArray = Array.isArray(defaultValue)
66
+ ? [...defaultValue]
67
+ : [resolvedDefaultScalar];
68
+
69
+ const [values, setValuesState] = useControllableState<readonly number[]>({
70
+ prop:
71
+ valueProp == null ? undefined : normalizeSliderValue(valueProp, min, resolvedDefaultScalar),
72
+ defaultProp: resolvedDefaultArray,
73
+ onChange: onChange
74
+ ? (next) => {
75
+ const denormalized = denormalizeSliderValue(next, isRangeShapeRef.current);
76
+ if (isRangeShapeRef.current) {
77
+ (onChange as (value: number[]) => void)(denormalized as number[]);
78
+ } else {
79
+ (onChange as (value: number) => void)(denormalized as number);
80
+ }
81
+ }
82
+ : undefined,
59
83
  });
60
84
 
61
- const currentValue = snapToStep(value ?? resolvedDefault, min, max, step);
62
- const percent = valueToPercent(currentValue, min, max);
85
+ const currentValues = useMemo(() => {
86
+ const source = values ?? resolvedDefaultArray;
87
+ return source.map((value) => snapToStep(value, min, max, step));
88
+ }, [max, min, resolvedDefaultArray, step, values]);
63
89
 
64
- const setValue = useCallback(
65
- (next: number, complete = false) => {
90
+ const registeredThumbCount = [...registeredThumbCounts.values()].reduce(
91
+ (total, count) => total + count,
92
+ 0,
93
+ );
94
+ const hasDuplicateThumbIndices = [...registeredThumbCounts.values()].some((count) => count > 1);
95
+ const thumbCount = Math.max(currentValues.length, registeredThumbCount);
96
+
97
+ const registerThumb = useCallback((index: number) => {
98
+ setRegisteredThumbCounts((prev) => {
99
+ const next = new Map(prev);
100
+ next.set(index, (next.get(index) ?? 0) + 1);
101
+ return next;
102
+ });
103
+
104
+ return () => {
105
+ setRegisteredThumbCounts((prev) => {
106
+ const count = prev.get(index);
107
+ if (count == null) {
108
+ return prev;
109
+ }
110
+
111
+ const next = new Map(prev);
112
+ if (count === 1) {
113
+ next.delete(index);
114
+ } else {
115
+ next.set(index, count - 1);
116
+ }
117
+ return next;
118
+ });
119
+ };
120
+ }, []);
121
+
122
+ useEffect(() => {
123
+ if (!__DEV__) {
124
+ return;
125
+ }
126
+
127
+ const renderedCount = registeredThumbCount;
128
+ if (renderedCount > 0 && renderedCount !== currentValues.length) {
129
+ console.warn(
130
+ `[Slider] Thumb count (${String(renderedCount)}) does not match value count (${String(currentValues.length)}).`,
131
+ );
132
+ }
133
+
134
+ if (hasDuplicateThumbIndices) {
135
+ console.warn('[Slider] Multiple thumbs share the same `index` prop.');
136
+ }
137
+ }, [currentValues.length, hasDuplicateThumbIndices, registeredThumbCount]);
138
+
139
+ const getThumbMinValue = useCallback(
140
+ (index: number) => {
141
+ if (index <= 0) {
142
+ return min;
143
+ }
144
+ return currentValues[index - 1] ?? min;
145
+ },
146
+ [currentValues, min],
147
+ );
148
+
149
+ const getThumbMaxValue = useCallback(
150
+ (index: number) => {
151
+ if (index >= currentValues.length - 1) {
152
+ return max;
153
+ }
154
+ return currentValues[index + 1] ?? max;
155
+ },
156
+ [currentValues, max],
157
+ );
158
+
159
+ const getThumbPercent = useCallback(
160
+ (index: number) => valueToPercent(currentValues[index] ?? min, min, max),
161
+ [currentValues, max, min],
162
+ );
163
+
164
+ const commitValues = useCallback(
165
+ (nextValues: number[], complete = false) => {
66
166
  if (isDisabled) {
67
167
  return;
68
168
  }
69
- const snapped = snapToStep(next, min, max, step);
70
- setValueState(snapped);
71
- if (complete) {
72
- onChangeComplete?.(snapped);
169
+
170
+ const unchanged = arraysEqual(nextValues, currentValues);
171
+
172
+ if (!unchanged) {
173
+ setValuesState(nextValues);
174
+ }
175
+
176
+ if (complete && onChangeComplete) {
177
+ const denormalized = denormalizeSliderValue(
178
+ unchanged ? currentValues : nextValues,
179
+ isRangeShapeRef.current,
180
+ );
181
+ if (isRangeShapeRef.current) {
182
+ (onChangeComplete as (value: number[]) => void)(denormalized as number[]);
183
+ } else {
184
+ (onChangeComplete as (value: number) => void)(denormalized as number);
185
+ }
73
186
  }
74
187
  },
75
- [isDisabled, max, min, onChangeComplete, setValueState, step],
188
+ [currentValues, isDisabled, onChangeComplete, setValuesState],
76
189
  );
77
190
 
78
- const setValueFromRatio = useCallback(
79
- (ratio: number, complete = false) => {
191
+ const setThumbValue = useCallback(
192
+ (index: number, next: number, complete = false) => {
193
+ if (isDisabled || index < 0 || index >= currentValues.length) {
194
+ return;
195
+ }
196
+
197
+ const snapped = snapToStep(next, getThumbMinValue(index), getThumbMaxValue(index), step);
198
+ const nextValues = [...currentValues];
199
+ nextValues[index] = snapped;
200
+ commitValues(nextValues, complete);
201
+ },
202
+ [commitValues, currentValues, getThumbMaxValue, getThumbMinValue, isDisabled, step],
203
+ );
204
+
205
+ const setThumbValueFromRatio = useCallback(
206
+ (index: number, ratio: number, complete = false) => {
80
207
  const next = min + clamp(ratio, 0, 1) * (max - min);
81
- setValue(next, complete);
208
+ setThumbValue(index, next, complete);
209
+ },
210
+ [max, min, setThumbValue],
211
+ );
212
+
213
+ const setNearestThumbValueFromRatio = useCallback(
214
+ (ratio: number, complete = false) => {
215
+ const target = min + clamp(ratio, 0, 1) * (max - min);
216
+ const index = getClosestValueIndex(currentValues, target);
217
+ setThumbValue(index, target, complete);
82
218
  },
83
- [max, min, setValue],
219
+ [currentValues, max, min, setThumbValue],
84
220
  );
85
221
 
86
222
  const setTrackLayout = useCallback((layout: SliderTrackLayout) => {
@@ -102,96 +238,112 @@ export const SliderRoot = forwardRef<View, SliderRootProps>(
102
238
  setThumbSizeState((prev) => (prev === size ? prev : size));
103
239
  }, []);
104
240
 
105
- const accessibilityValue = useMemo(() => {
106
- const defaults = {
107
- min,
108
- max,
109
- now: currentValue,
110
- text: formatSliderValue(currentValue),
111
- };
241
+ const getThumbValueLabel = useCallback(
242
+ (index: number) => formatSliderValue(currentValues[index] ?? min),
243
+ [currentValues, min],
244
+ );
112
245
 
113
- if (accessibilityValueProp === undefined) {
114
- return defaults;
115
- }
246
+ const isThumbDragging = useCallback(
247
+ (index: number) => draggingIndex === index,
248
+ [draggingIndex],
249
+ );
116
250
 
117
- return { ...defaults, ...accessibilityValueProp };
118
- }, [accessibilityValueProp, currentValue, max, min]);
251
+ const setValue = useCallback(
252
+ (next: number, complete = false) => setThumbValue(0, next, complete),
253
+ [setThumbValue],
254
+ );
119
255
 
120
- const getValueLabel = useCallback(() => accessibilityValue.text, [accessibilityValue.text]);
256
+ const setValueFromRatio = useCallback(
257
+ (ratio: number, complete = false) => setNearestThumbValueFromRatio(ratio, complete),
258
+ [setNearestThumbValueFromRatio],
259
+ );
121
260
 
122
- const handleKeyDown = useCallback(
123
- (event: NativeSyntheticEvent<TargetedEvent> & { nativeEvent: { key?: string } }) => {
124
- if (isDisabled) {
125
- return;
126
- }
127
- const key = event.nativeEvent.key;
128
- if (!key || !STEP_KEYS.has(key)) {
129
- return;
130
- }
131
- if (Platform.OS === 'web') {
132
- (event as unknown as { preventDefault: () => void }).preventDefault();
133
- }
261
+ const setIsDragging = useCallback((dragging: boolean) => {
262
+ setDraggingIndex(dragging ? 0 : null);
263
+ }, []);
134
264
 
135
- let next = currentValue;
136
- if (key === 'ArrowUp' || key === 'ArrowRight') {
137
- next = currentValue + step;
138
- } else if (key === 'ArrowDown' || key === 'ArrowLeft') {
139
- next = currentValue - step;
140
- } else if (key === 'Home') {
141
- next = min;
142
- } else if (key === 'End') {
143
- next = max;
144
- }
265
+ const setIsHovered = useCallback((hovered: boolean) => {
266
+ setHoveredIndex(hovered ? 0 : null);
267
+ }, []);
145
268
 
146
- setValue(next, true);
147
- },
148
- [currentValue, isDisabled, max, min, setValue, step],
149
- );
269
+ const setIsFocused = useCallback((focused: boolean) => {
270
+ setFocusedIndex(focused ? 0 : null);
271
+ }, []);
150
272
 
151
273
  const contextValue = useMemo(
152
274
  () => ({
153
- value: currentValue,
275
+ values: currentValues,
154
276
  min,
155
277
  max,
156
278
  step,
157
- percent,
158
279
  orientation,
159
280
  isDisabled,
160
- isDragging,
161
- isHovered,
162
- isFocused: isFocused || isFocusedState,
281
+ draggingIndex,
282
+ hoveredIndex,
283
+ focusedIndex,
163
284
  trackLayout,
164
285
  thumbSize,
165
- setValue,
166
- setValueFromRatio,
286
+ thumbCount,
287
+ groupAccessibilityLabel: accessibilityLabel,
288
+ accessibilityValueProp,
289
+ getThumbPercent,
290
+ getThumbMinValue,
291
+ getThumbMaxValue,
292
+ setThumbValue,
293
+ setThumbValueFromRatio,
294
+ setNearestThumbValueFromRatio,
167
295
  setTrackLayout,
168
296
  setThumbSize,
297
+ setDraggingIndex,
298
+ setHoveredIndex,
299
+ setFocusedIndex,
300
+ getThumbValueLabel,
301
+ registerThumb,
302
+ isThumbDragging,
303
+ value: currentValues[0] ?? min,
304
+ percent: getThumbPercent(0),
305
+ isDragging: draggingIndex !== null,
306
+ isHovered: hoveredIndex !== null,
307
+ isFocused: focusedIndex !== null,
308
+ getValueLabel: () => getThumbValueLabel(0),
309
+ setValue,
310
+ setValueFromRatio,
311
+ thumbRef: deprecatedThumbRef,
169
312
  setIsDragging,
170
313
  setIsHovered,
171
- setIsFocused: setIsFocusedState,
172
- getValueLabel,
173
- thumbRef,
314
+ setIsFocused,
174
315
  }),
175
316
  [
176
- currentValue,
177
- getValueLabel,
317
+ accessibilityLabel,
318
+ accessibilityValueProp,
319
+ currentValues,
320
+ draggingIndex,
321
+ focusedIndex,
322
+ getThumbMaxValue,
323
+ getThumbMinValue,
324
+ getThumbPercent,
325
+ getThumbValueLabel,
326
+ hoveredIndex,
178
327
  isDisabled,
179
- isDragging,
180
- isFocused,
181
- isFocusedState,
182
- isHovered,
328
+ isThumbDragging,
183
329
  max,
184
330
  min,
185
331
  orientation,
186
- percent,
187
- setTrackLayout,
332
+ registerThumb,
333
+ setIsDragging,
334
+ setIsFocused,
335
+ setIsHovered,
336
+ setNearestThumbValueFromRatio,
188
337
  setThumbSize,
338
+ setThumbValue,
339
+ setThumbValueFromRatio,
340
+ setTrackLayout,
189
341
  setValue,
190
342
  setValueFromRatio,
191
343
  step,
344
+ thumbCount,
192
345
  thumbSize,
193
346
  trackLayout,
194
- thumbRef,
195
347
  ],
196
348
  );
197
349
 
@@ -199,10 +351,10 @@ export const SliderRoot = forwardRef<View, SliderRootProps>(
199
351
  slot: 'slider',
200
352
  orientation,
201
353
  disabled: isDisabled,
202
- dragging: isDragging,
203
- hover: isHovered,
204
- focus: isFocused,
205
- value: String(currentValue),
354
+ dragging: draggingIndex !== null,
355
+ hover: hoveredIndex !== null,
356
+ focus: focusedIndex !== null,
357
+ values: currentValues.join(','),
206
358
  min: String(min),
207
359
  max: String(max),
208
360
  });
@@ -211,49 +363,16 @@ export const SliderRoot = forwardRef<View, SliderRootProps>(
211
363
 
212
364
  const handleLayout = composeEventHandlers(onLayout, () => undefined);
213
365
 
214
- const webKeyProps =
215
- Platform.OS === 'web'
216
- ? {
217
- tabIndex: isDisabled ? -1 : 0,
218
- onKeyDown: composeEventHandlers(
219
- (props as ViewProps & { onKeyDown?: (event: unknown) => void }).onKeyDown,
220
- handleKeyDown as never,
221
- ),
222
- }
223
- : {};
224
-
225
366
  return (
226
367
  <SliderProvider value={contextValue}>
227
368
  <Comp
228
369
  ref={ref}
229
370
  {...(props as ViewProps)}
230
- {...focusProps}
231
- {...webKeyProps}
232
371
  onLayout={handleLayout}
233
- onFocus={composeEventHandlers(
234
- composeEventHandlers(
235
- props.onFocus as (...args: unknown[]) => unknown,
236
- focusProps.onFocus,
237
- ),
238
- () => setIsFocusedState(true),
239
- )}
240
- onBlur={composeEventHandlers(
241
- composeEventHandlers(
242
- props.onBlur as (...args: unknown[]) => unknown,
243
- focusProps.onBlur,
244
- ),
245
- () => setIsFocusedState(false),
246
- )}
247
- accessibilityRole={accessibilityRole}
248
372
  accessibilityLabel={accessibilityLabel}
249
- accessibilityValue={accessibilityValue}
250
373
  accessibilityState={{ disabled: isDisabled }}
251
- aria-valuemin={min}
252
- aria-valuemax={max}
253
- aria-valuenow={currentValue}
254
- aria-orientation={orientation}
255
374
  aria-disabled={isDisabled}
256
- role={role}
375
+ role={Platform.OS === 'web' ? 'group' : undefined}
257
376
  {...dataAttrs}
258
377
  >
259
378
  {children}