@react-native-aria/slider 0.2.10 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/commonjs/index.js +0 -2
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/textSelection.js +13 -8
  5. package/lib/commonjs/textSelection.js.map +1 -1
  6. package/lib/commonjs/useMove.js +4 -13
  7. package/lib/commonjs/useMove.js.map +1 -1
  8. package/lib/commonjs/useMove.web.js +5 -27
  9. package/lib/commonjs/useMove.web.js.map +1 -1
  10. package/lib/commonjs/usePanResponder.js +0 -9
  11. package/lib/commonjs/usePanResponder.js.map +1 -1
  12. package/lib/commonjs/useSlider.js +9 -25
  13. package/lib/commonjs/useSlider.js.map +1 -1
  14. package/lib/commonjs/useSlider.web.js +17 -52
  15. package/lib/commonjs/useSlider.web.js.map +1 -1
  16. package/lib/commonjs/useSliderThumb.js +7 -30
  17. package/lib/commonjs/useSliderThumb.js.map +1 -1
  18. package/lib/commonjs/useSliderThumb.web.js +10 -33
  19. package/lib/commonjs/useSliderThumb.web.js.map +1 -1
  20. package/lib/commonjs/utils.js +1 -5
  21. package/lib/commonjs/utils.js.map +1 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/textSelection.js +7 -5
  24. package/lib/module/textSelection.js.map +1 -1
  25. package/lib/module/useMove.js +3 -5
  26. package/lib/module/useMove.js.map +1 -1
  27. package/lib/module/useMove.web.js +6 -24
  28. package/lib/module/useMove.web.js.map +1 -1
  29. package/lib/module/usePanResponder.js +0 -5
  30. package/lib/module/usePanResponder.js.map +1 -1
  31. package/lib/module/useSlider.js +9 -19
  32. package/lib/module/useSlider.js.map +1 -1
  33. package/lib/module/useSlider.web.js +17 -43
  34. package/lib/module/useSlider.web.js.map +1 -1
  35. package/lib/module/useSliderThumb.js +7 -22
  36. package/lib/module/useSliderThumb.js.map +1 -1
  37. package/lib/module/useSliderThumb.web.js +10 -24
  38. package/lib/module/useSliderThumb.web.js.map +1 -1
  39. package/lib/module/utils.js +0 -2
  40. package/lib/module/utils.js.map +1 -1
  41. package/lib/typescript/index.d.ts +1 -0
  42. package/lib/typescript/index.d.ts.map +1 -0
  43. package/lib/typescript/textSelection.d.ts +1 -0
  44. package/lib/typescript/textSelection.d.ts.map +1 -0
  45. package/lib/typescript/useMove.d.ts +1 -0
  46. package/lib/typescript/useMove.d.ts.map +1 -0
  47. package/lib/typescript/useMove.web.d.ts +1 -0
  48. package/lib/typescript/useMove.web.d.ts.map +1 -0
  49. package/lib/typescript/usePanResponder.d.ts +2 -1
  50. package/lib/typescript/usePanResponder.d.ts.map +1 -0
  51. package/lib/typescript/useSlider.d.ts +1 -0
  52. package/lib/typescript/useSlider.d.ts.map +1 -0
  53. package/lib/typescript/useSlider.web.d.ts +1 -0
  54. package/lib/typescript/useSlider.web.d.ts.map +1 -0
  55. package/lib/typescript/useSliderThumb.d.ts +1 -0
  56. package/lib/typescript/useSliderThumb.d.ts.map +1 -0
  57. package/lib/typescript/useSliderThumb.web.d.ts +1 -0
  58. package/lib/typescript/useSliderThumb.web.d.ts.map +1 -0
  59. package/lib/typescript/utils.d.ts +1 -0
  60. package/lib/typescript/utils.d.ts.map +1 -0
  61. package/package.json +8 -4
  62. package/src/useMove.ts +0 -1
  63. package/src/useMove.web.ts +3 -0
@@ -5,26 +5,25 @@ import { setInteractionModality } from '@react-aria/interactions';
5
5
  import { useLabel } from '@react-aria/label';
6
6
  import { mapDomPropsToRN, isRTL } from '@react-native-aria/utils';
7
7
  import { useMove } from './useMove';
8
-
9
8
  function useSliderWeb(props, state, trackLayout, isReversed) {
10
- var _labelProps$id;
11
-
12
9
  let {
13
10
  labelProps,
14
11
  fieldProps
15
12
  } = useLabel(props);
16
- let isVertical = props.orientation === 'vertical'; // Attach id of the label to the state so it can be accessed by useSliderThumb.
13
+ let isVertical = props.orientation === 'vertical';
17
14
 
18
- sliderIds.set(state, (_labelProps$id = labelProps.id) !== null && _labelProps$id !== void 0 ? _labelProps$id : fieldProps.id);
15
+ // Attach id of the label to the state so it can be accessed by useSliderThumb.
16
+ sliderIds.set(state, labelProps.id ?? fieldProps.id);
19
17
  const direction = isRTL() ? 'rtl' : undefined;
20
18
  let {
21
19
  addGlobalListener,
22
20
  removeGlobalListener
23
- } = useGlobalListeners(); // When the user clicks or drags the track, we want the motion to set and drag the
21
+ } = useGlobalListeners();
22
+
23
+ // When the user clicks or drags the track, we want the motion to set and drag the
24
24
  // closest thumb. Hence we also need to install useMove() on the track element.
25
25
  // Here, we keep track of which index is the "closest" to the drag start point.
26
26
  // It is set onMouseDown/onTouchDown; see trackProps below.
27
-
28
27
  const realTimeTrackDraggingIndex = useRef(null);
29
28
  const stateRef = useRef(null);
30
29
  stateRef.current = state;
@@ -36,19 +35,15 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
36
35
  onMoveStart() {
37
36
  currentPosition.current = null;
38
37
  },
39
-
40
38
  onMove({
41
39
  deltaX,
42
40
  deltaY
43
41
  }) {
44
42
  let size = isVertical ? trackLayout.height : trackLayout.width;
45
-
46
43
  if (currentPosition.current == null) {
47
44
  currentPosition.current = stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) * size;
48
45
  }
49
-
50
46
  let delta = isVertical ? deltaY : deltaX;
51
-
52
47
  if (reverseX) {
53
48
  if (!isVertical) {
54
49
  delta = -delta;
@@ -58,35 +53,29 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
58
53
  delta = -delta;
59
54
  }
60
55
  }
61
-
62
56
  currentPosition.current += delta;
63
-
64
57
  if (realTimeTrackDraggingIndex.current != null) {
65
58
  const percent = clamp(currentPosition.current / size, 0, 1);
66
59
  stateRef.current.setThumbPercent(realTimeTrackDraggingIndex.current, percent);
67
60
  }
68
61
  },
69
-
70
62
  onMoveEnd() {
71
63
  if (realTimeTrackDraggingIndex.current != null) {
72
64
  stateRef.current.setThumbDragging(realTimeTrackDraggingIndex.current, false);
73
65
  realTimeTrackDraggingIndex.current = null;
74
66
  }
75
67
  }
76
-
77
68
  });
78
69
  let currentPointer = useRef(undefined);
79
-
80
70
  let onDownTrack = (e, id, clientX, clientY) => {
81
71
  // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.
82
72
  if (!props.isDisabled && state.values.every((_, i) => !state.isThumbDragging(i))) {
83
- let size = isVertical ? trackLayout.height : trackLayout.width; // Find the closest thumb
84
-
73
+ let size = isVertical ? trackLayout.height : trackLayout.width;
74
+ // Find the closest thumb
85
75
  const trackPosition = trackLayout[isVertical ? 'top' : 'left'];
86
76
  const clickPosition = isVertical ? clientY : clientX;
87
77
  const offset = clickPosition - trackPosition;
88
78
  let percent = offset / size;
89
-
90
79
  if (reverseX) {
91
80
  if (!isVertical) {
92
81
  percent = 1 - percent;
@@ -96,12 +85,11 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
96
85
  percent = 1 - percent;
97
86
  }
98
87
  }
88
+ let value = state.getPercentValue(percent);
99
89
 
100
- let value = state.getPercentValue(percent); // to find the closet thumb we split the array based on the first thumb position to the "right/end" of the click.
101
-
90
+ // to find the closet thumb we split the array based on the first thumb position to the "right/end" of the click.
102
91
  let closestThumb;
103
92
  let split = state.values.findIndex(v => value - v < 0);
104
-
105
93
  if (split === 0) {
106
94
  // If the index is zero then the closetThumb is the first one
107
95
  closestThumb = split;
@@ -110,16 +98,16 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
110
98
  closestThumb = state.values.length - 1;
111
99
  } else {
112
100
  let lastLeft = state.values[split - 1];
113
- let firstRight = state.values[split]; // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one
114
-
101
+ let firstRight = state.values[split];
102
+ // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one
115
103
  if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {
116
104
  closestThumb = split - 1;
117
105
  } else {
118
106
  closestThumb = split;
119
107
  }
120
- } // Confirm that the found closest thumb is editable, not disabled, and move it
121
-
108
+ }
122
109
 
110
+ // Confirm that the found closest thumb is editable, not disabled, and move it
123
111
  if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {
124
112
  // Don't unfocus anything
125
113
  e.preventDefault();
@@ -136,41 +124,33 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
136
124
  }
137
125
  }
138
126
  };
139
-
140
127
  let onUpTrack = e => {
141
- var _e$pointerId, _e$changedTouches;
142
-
143
- let id = (_e$pointerId = e.pointerId) !== null && _e$pointerId !== void 0 ? _e$pointerId : (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches[0].identifier;
144
-
128
+ var _e$changedTouches;
129
+ let id = e.pointerId ?? ((_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches[0].identifier);
145
130
  if (id === currentPointer.current) {
146
131
  if (realTimeTrackDraggingIndex.current != null) {
147
132
  state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
148
133
  realTimeTrackDraggingIndex.current = null;
149
134
  }
150
-
151
135
  removeGlobalListener(window, 'mouseup', onUpTrack, false);
152
136
  removeGlobalListener(window, 'touchend', onUpTrack, false);
153
137
  removeGlobalListener(window, 'pointerup', onUpTrack, false);
154
138
  }
155
139
  };
156
-
157
140
  if (labelProps.htmlFor) {
158
141
  // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS
159
142
  // causes this to override the `aria-labelledby` on the thumb. This causes the first
160
143
  // thumb to only be announced as the slider label rather than its individual name as well.
161
144
  // See https://bugs.webkit.org/show_bug.cgi?id=172464.
162
145
  delete labelProps.htmlFor;
163
-
164
146
  labelProps.onClick = () => {
165
147
  var _document$getElementB;
166
-
167
148
  // Safari does not focus <input type="range"> elements when clicking on an associated <label>,
168
149
  // so do it manually. In addition, make sure we show the focus ring.
169
- (_document$getElementB = document.getElementById(getSliderThumbId(state, 0))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
150
+ (_document$getElementB = document.getElementById(getSliderThumbId(state, 0))) === null || _document$getElementB === void 0 || _document$getElementB.focus();
170
151
  setInteractionModality('keyboard');
171
152
  };
172
153
  }
173
-
174
154
  return {
175
155
  labelProps,
176
156
  // The root element of the Slider will have role="group" to group together
@@ -185,22 +165,17 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
185
165
  if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
186
166
  return;
187
167
  }
188
-
189
168
  onDownTrack(e, undefined, e.clientX, e.clientY);
190
169
  },
191
-
192
170
  onPointerDown(e) {
193
171
  if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {
194
172
  return;
195
173
  }
196
-
197
174
  onDownTrack(e, e.pointerId, e.clientX, e.clientY);
198
175
  },
199
-
200
176
  onTouchStart(e) {
201
177
  onDownTrack(e, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
202
178
  }
203
-
204
179
  }, moveProps),
205
180
  outputProps: {
206
181
  'htmlFor': state.values.map((_, index) => getSliderThumbId(state, index)).join(' '),
@@ -208,7 +183,6 @@ function useSliderWeb(props, state, trackLayout, isReversed) {
208
183
  }
209
184
  };
210
185
  }
211
-
212
186
  export const useSlider = (props, state, ref, isReversed) => {
213
187
  let {
214
188
  groupProps: webGroupProps,
@@ -1 +1 @@
1
- {"version":3,"sources":["useSlider.web.ts"],"names":["clamp","mergeProps","useGlobalListeners","getSliderThumbId","sliderIds","useRef","setInteractionModality","useLabel","mapDomPropsToRN","isRTL","useMove","useSliderWeb","props","state","trackLayout","isReversed","labelProps","fieldProps","isVertical","orientation","set","id","direction","undefined","addGlobalListener","removeGlobalListener","realTimeTrackDraggingIndex","stateRef","current","reverseX","currentPosition","moveProps","onMoveStart","onMove","deltaX","deltaY","size","height","width","getThumbPercent","delta","percent","setThumbPercent","onMoveEnd","setThumbDragging","currentPointer","onDownTrack","e","clientX","clientY","isDisabled","values","every","_","i","isThumbDragging","trackPosition","clickPosition","offset","value","getPercentValue","closestThumb","split","findIndex","v","length","lastLeft","firstRight","Math","abs","isThumbEditable","preventDefault","setFocusedThumb","setThumbValue","window","onUpTrack","pointerId","changedTouches","identifier","htmlFor","onClick","document","getElementById","focus","groupProps","role","trackProps","onMouseDown","button","altKey","ctrlKey","metaKey","onPointerDown","pointerType","onTouchStart","outputProps","map","index","join","useSlider","ref","webGroupProps","rest"],"mappings":"AACA,SAASA,KAAT,EAAgBC,UAAhB,EAA4BC,kBAA5B,QAAsD,mBAAtD;AACA,SAASC,gBAAT,EAA2BC,SAA3B,QAA4C,SAA5C;AACA,SAAgBC,MAAhB,QAA8B,OAA9B;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AAEA,SAASC,QAAT,QAAyB,mBAAzB;AACA,SAASC,eAAT,EAA0BC,KAA1B,QAAuC,0BAAvC;AACA,SAASC,OAAT,QAAwB,WAAxB;;AAgBA,SAASC,YAAT,CACEC,KADF,EAEEC,KAFF,EAGEC,WAHF,EAWEC,UAXF,EAYc;AAAA;;AACZ,MAAI;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA6BV,QAAQ,CAACK,KAAD,CAAzC;AAEA,MAAIM,UAAU,GAAGN,KAAK,CAACO,WAAN,KAAsB,UAAvC,CAHY,CAKZ;;AACAf,EAAAA,SAAS,CAACgB,GAAV,CAAcP,KAAd,oBAAqBG,UAAU,CAACK,EAAhC,2DAAsCJ,UAAU,CAACI,EAAjD;AAEA,QAAMC,SAAS,GAAGb,KAAK,KAAK,KAAL,GAAac,SAApC;AAEA,MAAI;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAA8CvB,kBAAkB,EAApE,CAVY,CAYZ;AACA;AACA;AACA;;AACA,QAAMwB,0BAA0B,GAAGrB,MAAM,CAAgB,IAAhB,CAAzC;AAEA,QAAMsB,QAAQ,GAAGtB,MAAM,CAAc,IAAd,CAAvB;AACAsB,EAAAA,QAAQ,CAACC,OAAT,GAAmBf,KAAnB;AACA,Q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lF,KAAK,CAACsC,MAAN,CACR6C,GADQ,CACJ,CAAC3C,CAAD,EAAI4C,KAAJ,KAAc9F,gBAAgB,CAACU,KAAD,EAAQoF,KAAR,CAD1B,EAERC,IAFQ,CAEH,GAFG,CADA;AAIX,mBAAa;AAJF;AArCR,GAAP;AA4CD;;AAED,OAAO,MAAMC,SAAS,GAAG,CACvBvF,KADuB,EAEvBC,KAFuB,EAGvBuF,GAHuB,EAIvBrF,UAJuB,KAKpB;AACH,MAAI;AAAEqE,IAAAA,UAAU,EAAEiB,aAAd;AAA6B,OAAGC;AAAhC,MAAyC3F,YAAY,CACvDC,KADuD,EAEvDC,KAFuD,EAGvDuF,GAHuD,EAIvDrF,UAJuD,CAAzD;AAMA,MAAIqE,UAAU,GAAG5E,eAAe,CAAC6F,aAAD,CAAhC;AACA,MAAIrF,UAAU,GAAGR,eAAe,CAAC8F,IAAI,CAACtF,UAAN,CAAhC;AACA,SAAO;AAAEoE,IAAAA,UAAF;AAAc,OAAGkB,IAAjB;AAAuBtF,IAAAA;AAAvB,GAAP;AACD,CAfM","sourcesContent":["import { AriaSliderProps } from '@react-types/slider';\nimport { clamp, mergeProps, useGlobalListeners } from '@react-aria/utils';\nimport { getSliderThumbId, sliderIds } from './utils';\nimport React, { useRef } from 'react';\nimport { setInteractionModality } from '@react-aria/interactions';\nimport { SliderState } from '@react-stately/slider';\nimport { useLabel } from '@react-aria/label';\nimport { mapDomPropsToRN, isRTL } from '@react-native-aria/utils';\nimport { useMove } from './useMove';\n\ninterface SliderAria {\n /** Props for the label element. */\n labelProps: any;\n\n /** Props for the root element of the slider component; groups slider inputs. */\n groupProps: any;\n\n /** Props for the track element. */\n trackProps: any;\n\n /** Props for the output element, displaying the value of the slider thumbs. */\n outputProps: any;\n}\n\nfunction useSliderWeb(\n props: AriaSliderProps,\n state: SliderState,\n trackLayout: {\n height: number;\n width: number;\n top: number;\n left: number;\n x: number;\n y: number;\n },\n isReversed?: boolean\n): SliderAria {\n let { labelProps, fieldProps } = useLabel(props);\n\n let isVertical = props.orientation === 'vertical';\n\n // Attach id of the label to the state so it can be accessed by useSliderThumb.\n sliderIds.set(state, labelProps.id ?? fieldProps.id);\n\n const direction = isRTL() ? 'rtl' : undefined;\n\n let { addGlobalListener, removeGlobalListener } = useGlobalListeners();\n\n // When the user clicks or drags the track, we want the motion to set and drag the\n // closest thumb. Hence we also need to install useMove() on the track element.\n // Here, we keep track of which index is the \"closest\" to the drag start point.\n // It is set onMouseDown/onTouchDown; see trackProps below.\n const realTimeTrackDraggingIndex = useRef<number | null>(null);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n const reverseX = isReversed || direction === 'rtl';\n\n const currentPosition = useRef<number>(null);\n const { moveProps } = useMove({\n onMoveStart() {\n currentPosition.current = null;\n },\n onMove({ deltaX, deltaY }) {\n let size = isVertical ? trackLayout.height : trackLayout.width;\n\n if (currentPosition.current == null) {\n currentPosition.current =\n stateRef.current.getThumbPercent(realTimeTrackDraggingIndex.current) *\n size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (reverseX) {\n if (!isVertical) {\n delta = -delta;\n }\n } else {\n if (isVertical) {\n delta = -delta;\n }\n }\n\n currentPosition.current += delta;\n\n if (realTimeTrackDraggingIndex.current != null) {\n const percent = clamp(currentPosition.current / size, 0, 1);\n stateRef.current.setThumbPercent(\n realTimeTrackDraggingIndex.current,\n percent\n );\n }\n },\n onMoveEnd() {\n if (realTimeTrackDraggingIndex.current != null) {\n stateRef.current.setThumbDragging(\n realTimeTrackDraggingIndex.current,\n false\n );\n realTimeTrackDraggingIndex.current = null;\n }\n },\n });\n\n let currentPointer = useRef<number | null | undefined>(undefined);\n let onDownTrack = (\n e: React.UIEvent,\n id: number,\n clientX: number,\n clientY: number\n ) => {\n // We only trigger track-dragging if the user clicks on the track itself and nothing is currently being dragged.\n if (\n !props.isDisabled &&\n state.values.every((_, i) => !state.isThumbDragging(i))\n ) {\n let size = isVertical ? trackLayout.height : trackLayout.width;\n // Find the closest thumb\n const trackPosition = trackLayout[isVertical ? 'top' : 'left'];\n const clickPosition = isVertical ? clientY : clientX;\n const offset = clickPosition - trackPosition;\n let percent = offset / size;\n if (reverseX) {\n if (!isVertical) {\n percent = 1 - percent;\n }\n } else {\n if (isVertical) {\n percent = 1 - percent;\n }\n }\n let value = state.getPercentValue(percent);\n\n // to find the closet thumb we split the array based on the first thumb position to the \"right/end\" of the click.\n let closestThumb;\n let split = state.values.findIndex((v) => value - v < 0);\n if (split === 0) {\n // If the index is zero then the closetThumb is the first one\n closestThumb = split;\n } else if (split === -1) {\n // If no index is found they've clicked past all the thumbs\n closestThumb = state.values.length - 1;\n } else {\n let lastLeft = state.values[split - 1];\n let firstRight = state.values[split];\n // Pick the last left/start thumb, unless they are stacked on top of each other, then pick the right/end one\n if (Math.abs(lastLeft - value) < Math.abs(firstRight - value)) {\n closestThumb = split - 1;\n } else {\n closestThumb = split;\n }\n }\n\n // Confirm that the found closest thumb is editable, not disabled, and move it\n if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {\n // Don't unfocus anything\n e.preventDefault();\n\n realTimeTrackDraggingIndex.current = closestThumb;\n state.setFocusedThumb(closestThumb);\n currentPointer.current = id;\n\n state.setThumbDragging(realTimeTrackDraggingIndex.current, true);\n state.setThumbValue(closestThumb, value);\n\n addGlobalListener(window, 'mouseup', onUpTrack, false);\n addGlobalListener(window, 'touchend', onUpTrack, false);\n addGlobalListener(window, 'pointerup', onUpTrack, false);\n } else {\n realTimeTrackDraggingIndex.current = null;\n }\n }\n };\n\n let onUpTrack = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n if (realTimeTrackDraggingIndex.current != null) {\n state.setThumbDragging(realTimeTrackDraggingIndex.current, false);\n realTimeTrackDraggingIndex.current = null;\n }\n\n removeGlobalListener(window, 'mouseup', onUpTrack, false);\n removeGlobalListener(window, 'touchend', onUpTrack, false);\n removeGlobalListener(window, 'pointerup', onUpTrack, false);\n }\n };\n\n if (labelProps.htmlFor) {\n // Ideally the `for` attribute should point to the first thumb, but VoiceOver on iOS\n // causes this to override the `aria-labelledby` on the thumb. This causes the first\n // thumb to only be announced as the slider label rather than its individual name as well.\n // See https://bugs.webkit.org/show_bug.cgi?id=172464.\n delete labelProps.htmlFor;\n labelProps.onClick = () => {\n // Safari does not focus <input type=\"range\"> elements when clicking on an associated <label>,\n // so do it manually. In addition, make sure we show the focus ring.\n document.getElementById(getSliderThumbId(state, 0))?.focus();\n setInteractionModality('keyboard');\n };\n }\n\n return {\n labelProps,\n // The root element of the Slider will have role=\"group\" to group together\n // all the thumb inputs in the Slider. The label of the Slider will\n // be used to label the group.\n groupProps: {\n role: 'group',\n ...fieldProps,\n },\n trackProps: mergeProps(\n {\n onMouseDown(e: React.MouseEvent<HTMLElement>) {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDownTrack(e, undefined, e.clientX, e.clientY);\n },\n onPointerDown(e: React.PointerEvent<HTMLElement>) {\n if (\n e.pointerType === 'mouse' &&\n (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)\n ) {\n return;\n }\n onDownTrack(e, e.pointerId, e.clientX, e.clientY);\n },\n onTouchStart(e: React.TouchEvent<HTMLElement>) {\n onDownTrack(\n e,\n e.changedTouches[0].identifier,\n e.changedTouches[0].clientX,\n e.changedTouches[0].clientY\n );\n },\n },\n moveProps\n ),\n outputProps: {\n 'htmlFor': state.values\n .map((_, index) => getSliderThumbId(state, index))\n .join(' '),\n 'aria-live': 'off',\n },\n };\n}\n\nexport const useSlider = (\n props: any,\n state: any,\n ref: any,\n isReversed?: boolean\n) => {\n let { groupProps: webGroupProps, ...rest } = useSliderWeb(\n props,\n state,\n ref,\n isReversed\n );\n let groupProps = mapDomPropsToRN(webGroupProps);\n let labelProps = mapDomPropsToRN(rest.labelProps);\n return { groupProps, ...rest, labelProps };\n};\n"]}
1
+ {"version":3,"names":["clamp","mergeProps","useGlobalListeners","getSliderThumbId","sliderIds","useRef","setInteractionModality","useLabel","mapDomPropsToRN","isRTL","useMove","useSliderWeb","props","state","trackLayout","isReversed","labelProps","fieldProps","isVertical","orientation","set","id","direction","undefined","addGlobalListener","removeGlobalListener","realTimeTrackDraggingIndex","stateRef","current","reverseX","currentPosition","moveProps","onMoveStart","onMove","deltaX","deltaY","size","height","width","getThumbPercent","delta","percent","setThumbPercent","onMoveEnd","setThumbDragging","currentPointer","onDownTrack","e","clientX","clientY","isDisabled","values","every","_","i","isThumbDragging","trackPosition","clickPosition","offset","value","getPercentValue","closestThumb","split","findIndex","v","length","lastLeft","firstRight","Math","abs","isThumbEditable","preventDefault","setFocusedThumb","setThumbValue","window","onUpTrack","_e$changedTouches","pointerId","changedTouches","identifier","htmlFor","onClick","_document$getElementB","document","getElementById","focus","groupProps","role","trackProps","onMouseDown","button","altKey","ctrlKey","metaKey","onPointerDown","pointerType","onTouchStart","outputProps","map","index","join","useSlider","ref","webGroupProps","rest"],"sourceRoot":"../../src","sources":["useSlider.web.ts"],"mappings":"AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,SAAS;AACrD,SAAgBC,MAAM,QAAQ,OAAO;AACrC,SAASC,sBAAsB,QAAQ,0BAA0B;AAEjE,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,eAAe,EAAEC,KAAK,QAAQ,0BAA0B;AACjE,SAASC,OAAO,QAAQ,WAAW;AAgBnC,SAASC,YAAYA,CACnBC,KAAsB,EACtBC,KAAkB,EAClBC,WAOC,EACDC,UAAoB,EACR;EACZ,IAAI;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGV,QAAQ,CAACK,KAAK,CAAC;EAEhD,IAAIM,UAAU,GAAGN,KAAK,CAACO,WAAW,KAAK,UAAU;;EAEjD;EACAf,SAAS,CAACgB,GAAG,CAACP,KAAK,EAAEG,UAAU,CAACK,EAAE,IAAIJ,UAA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AAEpF,KAAK,CAACsC,MAAM,CACpB+C,GAAG,CAAC,CAAC7C,CAAC,EAAE8C,KAAK,KAAKhG,gBAAgB,CAACU,KAAK,EAAEsF,KAAK,CAAC,CAAC,CACjDC,IAAI,CAAC,GAAG,CAAC;MACZ,WAAW,EAAE;IACf;EACF,CAAC;AACH;AAEA,OAAO,MAAMC,SAAS,GAAGA,CACvBzF,KAAU,EACVC,KAAU,EACVyF,GAAQ,EACRvF,UAAoB,KACjB;EACH,IAAI;IAAEuE,UAAU,EAAEiB,aAAa;IAAE,GAAGC;EAAK,CAAC,GAAG7F,YAAY,CACvDC,KAAK,EACLC,KAAK,EACLyF,GAAG,EACHvF,UACF,CAAC;EACD,IAAIuE,UAAU,GAAG9E,eAAe,CAAC+F,aAAa,CAAC;EAC/C,IAAIvF,UAAU,GAAGR,eAAe,CAACgG,IAAI,CAACxF,UAAU,CAAC;EACjD,OAAO;IAAEsE,UAAU;IAAE,GAAGkB,IAAI;IAAExF;EAAW,CAAC;AAC5C,CAAC"}
@@ -4,7 +4,6 @@ import { useRef, useState } from 'react';
4
4
  import { useLabel } from '@react-aria/label';
5
5
  import { useMove } from './useMove';
6
6
  import { isRTL } from '@react-native-aria/utils';
7
-
8
7
  /**
9
8
  * Provides behavior and accessibility for a thumb of a slider component.
10
9
  *
@@ -12,8 +11,6 @@ import { isRTL } from '@react-native-aria/utils';
12
11
  * @param state Slider state, created via `useSliderState`.
13
12
  */
14
13
  export function useSliderThumb(opts, state, isReversed) {
15
- var _opts$ariaLabelledby;
16
-
17
14
  let {
18
15
  index,
19
16
  isDisabled,
@@ -25,9 +22,10 @@ export function useSliderThumb(opts, state, isReversed) {
25
22
  const {
26
23
  labelProps,
27
24
  fieldProps
28
- } = useLabel({ ...opts,
25
+ } = useLabel({
26
+ ...opts,
29
27
  'id': getSliderThumbId(state, index),
30
- 'aria-labelledby': `${labelId} ${(_opts$ariaLabelledby = opts['aria-labelledby']) !== null && _opts$ariaLabelledby !== void 0 ? _opts$ariaLabelledby : ''}`.trim()
28
+ 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()
31
29
  });
32
30
  const stateRef = useRef(null);
33
31
  stateRef.current = state;
@@ -42,19 +40,15 @@ export function useSliderThumb(opts, state, isReversed) {
42
40
  let size = isVertical ? trackLayout.height : trackLayout.width;
43
41
  setStartPosition(stateRef.current.getThumbPercent(index) * size);
44
42
  },
45
-
46
43
  onMove({
47
44
  deltaX,
48
45
  deltaY
49
46
  }) {
50
47
  let size = isVertical ? trackLayout.height : trackLayout.width;
51
-
52
48
  if (currentPosition.current == null) {
53
49
  currentPosition.current = stateRef.current.getThumbPercent(index) * size;
54
50
  }
55
-
56
51
  let delta = isVertical ? deltaY : deltaX;
57
-
58
52
  if (reverseX) {
59
53
  if (!isVertical) {
60
54
  delta = -delta;
@@ -64,43 +58,34 @@ export function useSliderThumb(opts, state, isReversed) {
64
58
  delta = -delta;
65
59
  }
66
60
  }
67
-
68
61
  const position = startPosition + delta;
69
62
  stateRef.current.setThumbPercent(index, clamp(position / size, 0, 1));
70
63
  },
71
-
72
64
  onMoveEnd() {
73
65
  state.setThumbDragging(index, false);
74
66
  }
75
-
76
67
  });
77
68
  state.setThumbEditable(index, !isDisabled);
78
-
79
69
  const onAccessibilityAction = event => {
80
- var _ref, _ref2;
81
-
82
70
  const max = state.getThumbMinValue(index);
83
71
  const min = state.getThumbMaxValue(index);
84
72
  const value = state.getThumbValue(index);
85
- const incrementValue = Math.min((_ref = value + state.step) !== null && _ref !== void 0 ? _ref : 1, max);
86
- const decrementValue = Math.max((_ref2 = value - state.step) !== null && _ref2 !== void 0 ? _ref2 : 1, min);
87
-
73
+ const incrementValue = Math.min(value + state.step ?? 1, max);
74
+ const decrementValue = Math.max(value - state.step ?? 1, min);
88
75
  switch (event.nativeEvent.actionName) {
89
76
  case 'increment':
90
77
  state.setThumbValue(index, incrementValue);
91
78
  break;
92
-
93
79
  case 'decrement':
94
80
  state.setThumbValue(index, decrementValue);
95
81
  break;
96
-
97
82
  default:
98
83
  break;
99
84
  }
100
85
  };
101
-
102
86
  return {
103
- inputProps: { ...fieldProps,
87
+ inputProps: {
88
+ ...fieldProps,
104
89
  'disabled': isDisabled,
105
90
  'role': 'adjustable',
106
91
  'aria-value': {
@@ -1 +1 @@
1
- {"version":3,"sources":["useSliderThumb.ts"],"names":["clamp","getSliderThumbId","sliderIds","useRef","useState","useLabel","useMove","isRTL","useSliderThumb","opts","state","isReversed","index","isDisabled","trackLayout","isVertical","orientation","direction","undefined","labelId","get","labelProps","fieldProps","trim","stateRef","current","reverseX","currentPosition","startPosition","setStartPosition","moveProps","onMoveStart","setThumbDragging","size","height","width","getThumbPercent","onMove","deltaX","deltaY","delta","position","setThumbPercent","onMoveEnd","setThumbEditable","onAccessibilityAction","event","max","getThumbMinValue","min","getThumbMaxValue","value","getThumbValue","incrementValue","Math","step","decrementValue","nativeEvent","actionName","setThumbValue","inputProps","now","name","label","thumbProps"],"mappings":"AACA,SAASA,KAAT,QAAsB,mBAAtB;AACA,SAASC,gBAAT,EAA2BC,SAA3B,QAA4C,SAA5C;AACA,SAASC,MAAT,EAAiBC,QAAjB,QAAiC,OAAjC;AAEA,SAASC,QAAT,QAAyB,mBAAzB;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,KAAT,QAAsB,0BAAtB;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAT,CACLC,IADK,EAELC,KAFK,EAGLC,UAHK,EAIY;AAAA;;AACjB,MAAI;AAAEC,IAAAA,KAAF;AAASC,IAAAA,UAAT;AAAqBC,IAAAA;AAArB,MAAqCL,IAAzC;AAEA,MAAIM,UAAU,GAAGN,IAAI,CAACO,WAAL,KAAqB,UAAtC;AACA,QAAMC,SAAS,GAAGV,KAAK,KAAK,KAAL,GAAaW,SAApC;AAEA,MAAIC,OAAO,GAAGjB,SAAS,CAACkB,GAAV,CAAcV,KAAd,CAAd;AACA,QAAM;AAAEW,IAAAA,UAAF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A1B;AACE,WAAK,WAAL;AACEhD,QAAAA,KAAK,CAACiD,aAAN,CAAoB/C,KAApB,EAA2ByC,cAA3B;AACA;;AACF,WAAK,WAAL;AACE3C,QAAAA,KAAK,CAACiD,aAAN,CAAoB/C,KAApB,EAA2B4C,cAA3B;AACA;;AACF;AACE;AARJ;AAUD,GAlBD;;AAoBA,SAAO;AACLI,IAAAA,UAAU,EAAE,EACV,GAAGtC,UADO;AAEV,kBAAYT,UAFF;AAGV,cAAQ,YAHE;AAIV,oBAAc;AACZoC,QAAAA,GAAG,EAAEvC,KAAK,CAACsC,gBAAN,CAAuBpC,KAAvB,CADO;AAEZmC,QAAAA,GAAG,EAAErC,KAAK,CAACwC,gBAAN,CAAuBtC,KAAvB,CAFO;AAGZiD,QAAAA,GAAG,EAAEnD,KAAK,CAAC0C,aAAN,CAAoBxC,KAApB;AAHO,OAJJ;AASV,8BAAwB,CACtB;AACEkD,QAAAA,IAAI,EAAE,WADR;AAEEC,QAAAA,KAAK,EAAE;AAFT,OADsB,EAKtB;AACED,QAAAA,IAAI,EAAE,WADR;AAEEC,QAAAA,KAAK,EAAE;AAFT,OALsB,CATd;AAmBVlB,MAAAA;AAnBU,KADP;AAsBLmB,IAAAA,UAAU,EAAE,CAACnD,UAAD,GAAciB,SAAd,GAA0B,EAtBjC;AAuBLT,IAAAA;AAvBK,GAAP;AAyBD","sourcesContent":["import { AriaSliderThumbProps } from '@react-types/slider';\nimport { clamp } from '@react-aria/utils';\nimport { getSliderThumbId, sliderIds } from './utils';\nimport { useRef, useState } from 'react';\nimport { SliderState } from '@react-stately/slider';\nimport { useLabel } from '@react-aria/label';\nimport { useMove } from './useMove';\nimport { isRTL } from '@react-native-aria/utils';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: any;\n\n /** Props for the visually hidden range input element. */\n inputProps: any;\n\n /** Props for the label element for this thumb (optional). */\n labelProps: any;\n}\n\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackLayout: any;\n /** A ref to the thumb input element. */\n inputRef: any;\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: SliderThumbOptions,\n state: SliderState,\n isReversed?: boolean\n): SliderThumbAria {\n let { index, isDisabled, trackLayout } = opts;\n\n let isVertical = opts.orientation === 'vertical';\n const direction = isRTL() ? 'rtl' : undefined;\n\n let labelId = sliderIds.get(state);\n const { labelProps, fieldProps } = useLabel({\n ...opts,\n 'id': getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim(),\n });\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n let reverseX = isReversed || direction === 'rtl';\n let currentPosition = useRef<number>(null);\n\n const [startPosition, setStartPosition] = useState(0);\n\n let { moveProps } = useMove({\n onMoveStart() {\n state.setThumbDragging(index, true);\n let size = isVertical ? trackLayout.height : trackLayout.width;\n setStartPosition(stateRef.current.getThumbPercent(index) * size);\n },\n onMove({ deltaX, deltaY }) {\n let size = isVertical ? trackLayout.height : trackLayout.width;\n\n if (currentPosition.current == null) {\n currentPosition.current =\n stateRef.current.getThumbPercent(index) * size;\n }\n\n let delta = isVertical ? deltaY : deltaX;\n if (reverseX) {\n if (!isVertical) {\n delta = -delta;\n }\n } else {\n if (isVertical) {\n delta = -delta;\n }\n }\n\n const position = startPosition + delta;\n\n stateRef.current.setThumbPercent(index, clamp(position / size, 0, 1));\n },\n onMoveEnd() {\n state.setThumbDragging(index, false);\n },\n });\n\n state.setThumbEditable(index, !isDisabled);\n\n const onAccessibilityAction = (event: any) => {\n const max = state.getThumbMinValue(index);\n const min = state.getThumbMaxValue(index);\n const value = state.getThumbValue(index);\n\n const incrementValue = Math.min(value + state.step ?? 1, max);\n const decrementValue = Math.max(value - state.step ?? 1, min);\n\n switch (event.nativeEvent.actionName) {\n case 'increment':\n state.setThumbValue(index, incrementValue);\n break;\n case 'decrement':\n state.setThumbValue(index, decrementValue);\n break;\n default:\n break;\n }\n };\n\n return {\n inputProps: {\n ...fieldProps,\n 'disabled': isDisabled,\n 'role': 'adjustable',\n 'aria-value': {\n min: state.getThumbMinValue(index),\n max: state.getThumbMaxValue(index),\n now: state.getThumbValue(index),\n },\n 'accessibilityActions': [\n {\n name: 'increment',\n label: 'Increment',\n },\n {\n name: 'decrement',\n label: 'Decrement',\n },\n ],\n onAccessibilityAction,\n },\n thumbProps: !isDisabled ? moveProps : {},\n labelProps,\n };\n}\n"]}
1
+ {"version":3,"names":["clamp","getSliderThumbId","sliderIds","useRef","useState","useLabel","useMove","isRTL","useSliderThumb","opts","state","isReversed","index","isDisabled","trackLayout","isVertical","orientation","direction","undefined","labelId","get","labelProps","fieldProps","trim","stateRef","current","reverseX","currentPosition","startPosition","setStartPosition","moveProps","onMoveStart","setThumbDragging","size","height","width","getThumbPercent","onMove","deltaX","deltaY","delta","position","setThumbPercent","onMoveEnd","setThumbEditable","onAccessibilityAction","event","max","getThumbMinValue","min","getThumbMaxValue","value","getThumbValue","incrementValue","Math","step","decrementValue","nativeEvent","actionName","setThumbValue","inputProps","now","name","label","thumbProps"],"sourceRoot":"../../src","sources":["useSliderThumb.ts"],"mappings":"AACA,SAASA,KAAK,QAAQ,mBAAmB;AACzC,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,SAAS;AACrD,SAASC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAExC,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,KAAK,QAAQ,0BAA0B;AAoBhD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,IAAwB,EACxBC,KAAkB,EAClBC,UAAoB,EACH;EACjB,IAAI;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAY,CAAC,GAAGL,IAAI;EAE7C,IAAIM,UAAU,GAAGN,I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AAK,CAACW,WAAW,CAACC,UAAU;MAClC,KAAK,WAAW;QACdhD,KAAK,CAACiD,aAAa,CAAC/C,KAAK,EAAEyC,cAAc,CAAC;QAC1C;MACF,KAAK,WAAW;QACd3C,KAAK,CAACiD,aAAa,CAAC/C,KAAK,EAAE4C,cAAc,CAAC;QAC1C;MACF;QACE;IACJ;EACF,CAAC;EAED,OAAO;IACLI,UAAU,EAAE;MACV,GAAGtC,UAAU;MACb,UAAU,EAAET,UAAU;MACtB,MAAM,EAAE,YAAY;MACpB,YAAY,EAAE;QACZoC,GAAG,EAAEvC,KAAK,CAACsC,gBAAgB,CAACpC,KAAK,CAAC;QAClCmC,GAAG,EAAErC,KAAK,CAACwC,gBAAgB,CAACtC,KAAK,CAAC;QAClCiD,GAAG,EAAEnD,KAAK,CAAC0C,aAAa,CAACxC,KAAK;MAChC,CAAC;MACD,sBAAsB,EAAE,CACtB;QACEkD,IAAI,EAAE,WAAW;QACjBC,KAAK,EAAE;MACT,CAAC,EACD;QACED,IAAI,EAAE,WAAW;QACjBC,KAAK,EAAE;MACT,CAAC,CACF;MACDlB;IACF,CAAC;IACDmB,UAAU,EAAE,CAACnD,UAAU,GAAGiB,SAAS,GAAG,CAAC,CAAC;IACxCT;EACF,CAAC;AACH"}
@@ -5,7 +5,6 @@ import { useFocusable } from '@react-aria/focus';
5
5
  import { useLabel } from '@react-aria/label';
6
6
  import { useMove } from './useMove';
7
7
  import { isRTL } from '@react-native-aria/utils';
8
-
9
8
  /**
10
9
  * Provides behavior and accessibility for a thumb of a slider component.
11
10
  *
@@ -13,8 +12,6 @@ import { isRTL } from '@react-native-aria/utils';
13
12
  * @param state Slider state, created via `useSliderState`.
14
13
  */
15
14
  export function useSliderThumb(opts, state, isReversed) {
16
- var _opts$ariaLabelledby;
17
-
18
15
  let {
19
16
  index,
20
17
  isRequired,
@@ -33,9 +30,10 @@ export function useSliderThumb(opts, state, isReversed) {
33
30
  const {
34
31
  labelProps,
35
32
  fieldProps
36
- } = useLabel({ ...opts,
33
+ } = useLabel({
34
+ ...opts,
37
35
  'id': getSliderThumbId(state, index),
38
- 'aria-labelledby': `${labelId} ${(_opts$ariaLabelledby = opts['aria-labelledby']) !== null && _opts$ariaLabelledby !== void 0 ? _opts$ariaLabelledby : ''}`.trim()
36
+ 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim()
39
37
  });
40
38
  const value = state.values[index];
41
39
  const focusInput = useCallback(() => {
@@ -60,18 +58,15 @@ export function useSliderThumb(opts, state, isReversed) {
60
58
  currentPosition.current = null;
61
59
  state.setThumbDragging(index, true);
62
60
  },
63
-
64
61
  onMove({
65
62
  deltaX,
66
63
  deltaY,
67
64
  pointerType
68
65
  }) {
69
66
  let size = isVertical ? trackLayout.height : trackLayout.width;
70
-
71
67
  if (currentPosition.current == null) {
72
68
  currentPosition.current = stateRef.current.getThumbPercent(index) * size;
73
69
  }
74
-
75
70
  if (pointerType === 'keyboard') {
76
71
  // (invert left/right according to language direction) + (according to vertical)
77
72
  let delta = ((reverseX ? -deltaX : deltaX) + (reverseX ? deltaY : -deltaY)) * stateRef.current.step;
@@ -79,7 +74,6 @@ export function useSliderThumb(opts, state, isReversed) {
79
74
  stateRef.current.setThumbValue(index, stateRef.current.getThumbValue(index) + delta);
80
75
  } else {
81
76
  let delta = isVertical ? deltaY : deltaX;
82
-
83
77
  if (reverseX) {
84
78
  if (!isVertical) {
85
79
  delta = -delta;
@@ -89,18 +83,16 @@ export function useSliderThumb(opts, state, isReversed) {
89
83
  delta = -delta;
90
84
  }
91
85
  }
92
-
93
86
  currentPosition.current += delta;
94
87
  stateRef.current.setThumbPercent(index, clamp(currentPosition.current / size, 0, 1));
95
88
  }
96
89
  },
97
-
98
90
  onMoveEnd() {
99
91
  state.setThumbDragging(index, false);
100
92
  }
93
+ });
101
94
 
102
- }); // Immediately register editability with the state
103
-
95
+ // Immediately register editability with the state
104
96
  state.setThumbEditable(index, !isDisabled);
105
97
  const {
106
98
  focusableProps
@@ -109,7 +101,6 @@ export function useSliderThumb(opts, state, isReversed) {
109
101
  onBlur: () => state.setFocusedThumb(undefined)
110
102
  }), inputRef);
111
103
  let currentPointer = useRef(undefined);
112
-
113
104
  let onDown = id => {
114
105
  focusInput();
115
106
  currentPointer.current = id;
@@ -118,12 +109,9 @@ export function useSliderThumb(opts, state, isReversed) {
118
109
  addGlobalListener(window, 'touchend', onUp, false);
119
110
  addGlobalListener(window, 'pointerup', onUp, false);
120
111
  };
121
-
122
112
  let onUp = e => {
123
- var _e$pointerId, _e$changedTouches;
124
-
125
- let id = (_e$pointerId = e.pointerId) !== null && _e$pointerId !== void 0 ? _e$pointerId : (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches[0].identifier;
126
-
113
+ var _e$changedTouches;
114
+ let id = e.pointerId ?? ((_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches[0].identifier);
127
115
  if (id === currentPointer.current) {
128
116
  focusInput();
129
117
  state.setThumbDragging(index, false);
@@ -131,12 +119,12 @@ export function useSliderThumb(opts, state, isReversed) {
131
119
  removeGlobalListener(window, 'touchend', onUp, false);
132
120
  removeGlobalListener(window, 'pointerup', onUp, false);
133
121
  }
134
- }; // We install mouse handlers for the drag motion on the thumb div, but
122
+ };
123
+
124
+ // We install mouse handlers for the drag motion on the thumb div, but
135
125
  // not the key handler for moving the thumb with the slider. Instead,
136
126
  // we focus the range input, and let the browser handle the keyboard
137
127
  // interactions; we then listen to input's onChange to update state.
138
-
139
-
140
128
  return {
141
129
  inputProps: mergeProps(focusableProps, fieldProps, {
142
130
  'type': 'range',
@@ -160,14 +148,12 @@ export function useSliderThumb(opts, state, isReversed) {
160
148
  if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
161
149
  return;
162
150
  }
163
-
164
151
  onDown();
165
152
  },
166
153
  onPointerDown: e => {
167
154
  if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
168
155
  return;
169
156
  }
170
-
171
157
  onDown(e.pointerId);
172
158
  },
173
159
  onTouchStart: e => {
@@ -1 +1 @@
1
- {"version":3,"sources":["useSliderThumb.web.ts"],"names":["clamp","focusWithoutScrolling","mergeProps","useGlobalListeners","getSliderThumbId","sliderIds","useCallback","useEffect","useRef","useFocusable","useLabel","useMove","isRTL","useSliderThumb","opts","state","isReversed","index","isRequired","isDisabled","validationState","trackLayout","inputRef","isVertical","orientation","direction","undefined","addGlobalListener","removeGlobalListener","labelId","get","labelProps","fieldProps","trim","value","values","focusInput","current","isFocused","focusedThumb","stateRef","reverseX","currentPosition","moveProps","onMoveStart","setThumbDragging","onMove","deltaX","deltaY","pointerType","size","height","width","getThumbPercent","delta","step","setThumbValue","getThumbValue","setThumbPercent","onMoveEnd","setThumbEditable","focusableProps","onFocus","setFocusedThumb","onBlur","currentPointer","onDown","id","window","onUp","e","pointerId","changedTouches","identifier","inputProps","getThumbMinValue","getThumbMaxValue","getThumbValueLabel","parseFloat","target","thumbProps","onMouseDown","button","altKey","ctrlKey","metaKey","onPointerDown","onTouchStart"],"mappings":"AACA,SACEA,KADF,EAEEC,qBAFF,EAGEC,UAHF,EAIEC,kBAJF,QAKO,mBALP;AAMA,SAASC,gBAAT,EAA2BC,SAA3B,QAA4C,SAA5C;AACA,SAMEC,WANF,EAOEC,SAPF,EAQEC,MARF,QASO,OATP;AAWA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,QAAT,QAAyB,mBAAzB;AACA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,KAAT,QAAsB,0BAAtB;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAT,CACLC,IADK,EAELC,KAFK,EAGLC,UAHK,EAIY;AAAA;;AACjB,MAAI;AACFC,IAAAA,KADE;AAEFC,IAAAA,UAFE;AAGFC,IAAAA,UAHE;AAIFC,IAAAA,eAJE;AAKFC,IAAAA,WALE;AAMFC,IAAAA;AANE,MAOAR,IAPJ;AASA,MA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AAAA,KAAK,CAACyC,aAAN,CAAoBvC,KAApB,EAA2B6D,UAAU,CAACR,CAAC,CAACS,MAAF,CAAS7C,KAAV,CAArC;AACD;AAfgD,KAA7B,CADjB;AAkBL8C,IAAAA,UAAU,EAAE,CAAC7D,UAAD,GACRjB,UAAU,CAACyC,SAAD,EAAY;AACpBsC,MAAAA,WAAW,EAAGX,CAAD,IAAsC;AACjD,YAAIA,CAAC,CAACY,MAAF,KAAa,CAAb,IAAkBZ,CAAC,CAACa,MAApB,IAA8Bb,CAAC,CAACc,OAAhC,IAA2Cd,CAAC,CAACe,OAAjD,EAA0D;AACxD;AACD;;AACDnB,QAAAA,MAAM;AACP,OANmB;AAOpBoB,MAAAA,aAAa,EAAGhB,CAAD,IAAwC;AACrD,YAAIA,CAAC,CAACY,MAAF,KAAa,CAAb,IAAkBZ,CAAC,CAACa,MAApB,IAA8Bb,CAAC,CAACc,OAAhC,IAA2Cd,CAAC,CAACe,OAAjD,EAA0D;AACxD;AACD;;AACDnB,QAAAA,MAAM,CAACI,CAAC,CAACC,SAAH,CAAN;AACD,OAZmB;AAapBgB,MAAAA,YAAY,EAAGjB,CAAD,IAAsC;AAClDJ,QAAAA,MAAM,CAACI,CAAC,CAACE,cAAF,CAAiB,CAAjB,EAAoBC,UAArB,CAAN;AACD;AAfmB,KAAZ,CADF,GAkBR,EApCC;AAqCL1C,IAAAA;AArCK,GAAP;AAuCD","sourcesContent":["import { AriaSliderThumbProps } from '@react-types/slider';\nimport {\n clamp,\n focusWithoutScrolling,\n mergeProps,\n useGlobalListeners,\n} from '@react-aria/utils';\nimport { getSliderThumbId, sliderIds } from './utils';\nimport React, {\n ChangeEvent,\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\nimport { SliderState } from '@react-stately/slider';\nimport { useFocusable } from '@react-aria/focus';\nimport { useLabel } from '@react-aria/label';\nimport { useMove } from './useMove';\nimport { isRTL } from '@react-native-aria/utils';\n\ninterface SliderThumbAria {\n /** Props for the root thumb element; handles the dragging motion. */\n thumbProps: HTMLAttributes<HTMLElement>;\n\n /** Props for the visually hidden range input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>;\n\n /** Props for the label element for this thumb (optional). */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>;\n}\n\ninterface SliderThumbOptions extends AriaSliderThumbProps {\n /** A ref to the track element. */\n trackLayout: any;\n /** A ref to the thumb input element. */\n inputRef: RefObject<HTMLInputElement>;\n}\n\n/**\n * Provides behavior and accessibility for a thumb of a slider component.\n *\n * @param opts Options for this Slider thumb.\n * @param state Slider state, created via `useSliderState`.\n */\nexport function useSliderThumb(\n opts: SliderThumbOptions,\n state: SliderState,\n isReversed?: boolean\n): SliderThumbAria {\n let {\n index,\n isRequired,\n isDisabled,\n validationState,\n trackLayout,\n inputRef,\n } = opts;\n\n let isVertical = opts.orientation === 'vertical';\n\n let direction = isRTL() ? 'rtl' : undefined;\n let { addGlobalListener, removeGlobalListener } = useGlobalListeners();\n\n let labelId = sliderIds.get(state);\n const { labelProps, fieldProps } = useLabel({\n ...opts,\n 'id': getSliderThumbId(state, index),\n 'aria-labelledby': `${labelId} ${opts['aria-labelledby'] ?? ''}`.trim(),\n });\n\n const value = state.values[index];\n\n const focusInput = useCallback(() => {\n if (inputRef.current) {\n focusWithoutScrolling(inputRef.current);\n }\n }, [inputRef]);\n\n const isFocused = state.focusedThumb === index;\n\n useEffect(() => {\n if (isFocused) {\n focusInput();\n }\n }, [isFocused, focusInput]);\n\n const stateRef = useRef<SliderState>(null);\n stateRef.current = state;\n let reverseX = isReversed || direction === 'rtl';\n let currentPosition = useRef<number>(null);\n let { moveProps } = useMove({\n onMoveStart() {\n currentPosition.current = null;\n state.setThumbDragging(index, true);\n },\n onMove({ deltaX, deltaY, pointerType }) {\n let size = isVertical ? trackLayout.height : trackLayout.width;\n\n if (currentPosition.current == null) {\n currentPosition.current =\n stateRef.current.getThumbPercent(index) * size;\n }\n if (pointerType === 'keyboard') {\n // (invert left/right according to language direction) + (according to vertical)\n let delta =\n ((reverseX ? -deltaX : deltaX) + (reverseX ? deltaY : -deltaY)) *\n stateRef.current.step;\n currentPosition.current += delta * size;\n stateRef.current.setThumbValue(\n index,\n stateRef.current.getThumbValue(index) + delta\n );\n } else {\n let delta = isVertical ? deltaY : deltaX;\n if (reverseX) {\n if (!isVertical) {\n delta = -delta;\n }\n } else {\n if (isVertical) {\n delta = -delta;\n }\n }\n currentPosition.current += delta;\n stateRef.current.setThumbPercent(\n index,\n clamp(currentPosition.current / size, 0, 1)\n );\n }\n },\n onMoveEnd() {\n state.setThumbDragging(index, false);\n },\n });\n\n // Immediately register editability with the state\n state.setThumbEditable(index, !isDisabled);\n\n const { focusableProps } = useFocusable(\n mergeProps(opts, {\n onFocus: () => state.setFocusedThumb(index),\n onBlur: () => state.setFocusedThumb(undefined),\n }),\n inputRef\n );\n\n let currentPointer = useRef<number | undefined>(undefined);\n let onDown = (id?: number) => {\n focusInput();\n currentPointer.current = id;\n state.setThumbDragging(index, true);\n\n addGlobalListener(window, 'mouseup', onUp, false);\n addGlobalListener(window, 'touchend', onUp, false);\n addGlobalListener(window, 'pointerup', onUp, false);\n };\n\n let onUp = (e) => {\n let id = e.pointerId ?? e.changedTouches?.[0].identifier;\n if (id === currentPointer.current) {\n focusInput();\n state.setThumbDragging(index, false);\n removeGlobalListener(window, 'mouseup', onUp, false);\n removeGlobalListener(window, 'touchend', onUp, false);\n removeGlobalListener(window, 'pointerup', onUp, false);\n }\n };\n\n // We install mouse handlers for the drag motion on the thumb div, but\n // not the key handler for moving the thumb with the slider. Instead,\n // we focus the range input, and let the browser handle the keyboard\n // interactions; we then listen to input's onChange to update state.\n return {\n inputProps: mergeProps(focusableProps, fieldProps, {\n 'type': 'range',\n 'tabIndex': !isDisabled ? 0 : undefined,\n 'min': state.getThumbMinValue(index),\n 'max': state.getThumbMaxValue(index),\n 'step': state.step,\n 'value': value,\n 'disabled': isDisabled,\n 'aria-orientation': opts.orientation,\n 'aria-valuetext': state.getThumbValueLabel(index),\n 'aria-required': isRequired || undefined,\n 'aria-invalid': validationState === 'invalid' || undefined,\n 'aria-errormessage': opts['aria-errormessage'],\n 'onChange': (e: ChangeEvent<HTMLInputElement>) => {\n state.setThumbValue(index, parseFloat(e.target.value));\n },\n }),\n thumbProps: !isDisabled\n ? mergeProps(moveProps, {\n onMouseDown: (e: React.MouseEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown();\n },\n onPointerDown: (e: React.PointerEvent<HTMLElement>) => {\n if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n onDown(e.pointerId);\n },\n onTouchStart: (e: React.TouchEvent<HTMLElement>) => {\n onDown(e.changedTouches[0].identifier);\n },\n })\n : {},\n labelProps,\n };\n}\n"]}
1
+ {"version":3,"names":["clamp","focusWithoutScrolling","mergeProps","useGlobalListeners","getSliderThumbId","sliderIds","useCallback","useEffect","useRef","useFocusable","useLabel","useMove","isRTL","useSliderThumb","opts","state","isReversed","index","isRequired","isDisabled","validationState","trackLayout","inputRef","isVertical","orientation","direction","undefined","addGlobalListener","removeGlobalListener","labelId","get","labelProps","fieldProps","trim","value","values","focusInput","current","isFocused","focusedThumb","stateRef","reverseX","currentPosition","moveProps","onMoveStart","setThumbDragging","onMove","deltaX","deltaY","pointerType","size","height","width","getThumbPercent","delta","step","setThumbValue","getThumbValue","setThumbPercent","onMoveEnd","setThumbEditable","focusableProps","onFocus","setFocusedThumb","onBlur","currentPointer","onDown","id","window","onUp","e","_e$changedTouches","pointerId","changedTouches","identifier","inputProps","getThumbMinValue","getThumbMaxValue","getThumbValueLabel","parseFloat","target","thumbProps","onMouseDown","button","altKey","ctrlKey","metaKey","onPointerDown","onTouchStart"],"sourceRoot":"../../src","sources":["useSliderThumb.web.ts"],"mappings":"AACA,SACEA,KAAK,EACLC,qBAAqB,EACrBC,UAAU,EACVC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EAAEL,IAAI,CAACU,WAAW;MACpC,gBAAgB,EAAET,KAAK,CAAC+D,kBAAkB,CAAC7D,KAAK,CAAC;MACjD,eAAe,EAAEC,UAAU,IAAIQ,SAAS;MACxC,cAAc,EAAEN,eAAe,KAAK,SAAS,IAAIM,SAAS;MAC1D,mBAAmB,EAAEZ,IAAI,CAAC,mBAAmB,CAAC;MAC9C,UAAU,EAAGwD,CAAgC,IAAK;QAChDvD,KAAK,CAACyC,aAAa,CAACvC,KAAK,EAAE8D,UAAU,CAACT,CAAC,CAACU,MAAM,CAAC9C,KAAK,CAAC,CAAC;MACxD;IACF,CAAC,CAAC;IACF+C,UAAU,EAAE,CAAC9D,UAAU,GACnBjB,UAAU,CAACyC,SAAS,EAAE;MACpBuC,WAAW,EAAGZ,CAAgC,IAAK;QACjD,IAAIA,CAAC,CAACa,MAAM,KAAK,CAAC,IAAIb,CAAC,CAACc,MAAM,IAAId,CAAC,CAACe,OAAO,IAAIf,CAAC,CAACgB,OAAO,EAAE;UACxD;QACF;QACApB,MAAM,CAAC,CAAC;MACV,CAAC;MACDqB,aAAa,EAAGjB,CAAkC,IAAK;QACrD,IAAIA,CAAC,CAACa,MAAM,KAAK,CAAC,IAAIb,CAAC,CAACc,MAAM,IAAId,CAAC,CAACe,OAAO,IAAIf,CAAC,CAACgB,OAAO,EAAE;UACxD;QACF;QACApB,MAAM,CAACI,CAAC,CAACE,SAAS,CAAC;MACrB,CAAC;MACDgB,YAAY,EAAGlB,CAAgC,IAAK;QAClDJ,MAAM,CAACI,CAAC,CAACG,cAAc,CAAC,CAAC,CAAC,CAACC,UAAU,CAAC;MACxC;IACF,CAAC,CAAC,GACF,CAAC,CAAC;IACN3C;EACF,CAAC;AACH"}
@@ -1,11 +1,9 @@
1
1
  export const sliderIds = new WeakMap();
2
2
  export function getSliderThumbId(state, index) {
3
3
  let id = sliderIds.get(state);
4
-
5
4
  if (!id) {
6
5
  throw new Error('Unknown slider state');
7
6
  }
8
-
9
7
  return `${id}-${index}`;
10
8
  }
11
9
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["sliderIds","WeakMap","getSliderThumbId","state","index","id","get","Error"],"mappings":"AAEA,OAAO,MAAMA,SAAS,GAAG,IAAIC,OAAJ,EAAlB;AAEP,OAAO,SAASC,gBAAT,CAA0BC,KAA1B,EAA8CC,KAA9C,EAA6D;AAClE,MAAIC,EAAE,GAAGL,SAAS,CAACM,GAAV,CAAcH,KAAd,CAAT;;AACA,MAAI,CAACE,EAAL,EAAS;AACP,UAAM,IAAIE,KAAJ,CAAU,sBAAV,CAAN;AACD;;AAED,SAAQ,GAAEF,EAAG,IAAGD,KAAM,EAAtB;AACD","sourcesContent":["import { SliderState } from '@react-stately/slider';\n\nexport const sliderIds = new WeakMap<SliderState, string>();\n\nexport function getSliderThumbId(state: SliderState, index: number) {\n let id = sliderIds.get(state);\n if (!id) {\n throw new Error('Unknown slider state');\n }\n\n return `${id}-${index}`;\n}\n"]}
1
+ {"version":3,"names":["sliderIds","WeakMap","getSliderThumbId","state","index","id","get","Error"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":"AAEA,OAAO,MAAMA,SAAS,GAAG,IAAIC,OAAO,CAAsB,CAAC;AAE3D,OAAO,SAASC,gBAAgBA,CAACC,KAAkB,EAAEC,KAAa,EAAE;EAClE,IAAIC,EAAE,GAAGL,SAAS,CAACM,GAAG,CAACH,KAAK,CAAC;EAC7B,IAAI,CAACE,EAAE,EAAE;IACP,MAAM,IAAIE,KAAK,CAAC,sBAAsB,CAAC;EACzC;EAEA,OAAQ,GAAEF,EAAG,IAAGD,KAAM,EAAC;AACzB"}
@@ -1,2 +1,3 @@
1
1
  export { useSlider } from './useSlider';
2
2
  export { useSliderThumb } from './useSliderThumb';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare function disableTextSelection(): void;
2
2
  export declare function restoreTextSelection(): void;
3
+ //# sourceMappingURL=textSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textSelection.d.ts","sourceRoot":"","sources":["../../src/textSelection.ts"],"names":[],"mappings":"AA4BA,wBAAgB,oBAAoB,SAOnC;AAED,wBAAgB,oBAAoB,SA2BnC"}
@@ -9,3 +9,4 @@ interface MoveResult {
9
9
  */
10
10
  export declare function useMove(props: any): MoveResult;
11
11
  export {};
12
+ //# sourceMappingURL=useMove.d.ts.map