@react-stately/slider 3.0.5 → 3.0.6-nightly.3113

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.
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
- var $m1uKO$reactariautils = require("@react-aria/utils");
2
- var $m1uKO$reactstatelyutils = require("@react-stately/utils");
3
- var $m1uKO$react = require("react");
1
+ var $ltQvC$reactariautils = require("@react-aria/utils");
2
+ var $ltQvC$reactstatelyutils = require("@react-stately/utils");
3
+ var $ltQvC$react = require("react");
4
4
 
5
5
  function $parcel$exportWildcard(dest, source) {
6
6
  Object.keys(source).forEach(function(key) {
@@ -21,27 +21,27 @@ function $parcel$exportWildcard(dest, source) {
21
21
  function $parcel$export(e, n, v, s) {
22
22
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
23
23
  }
24
- var $37396301f90211cc$exports = {};
24
+ var $e86753598efd0f02$exports = {};
25
25
 
26
- $parcel$export($37396301f90211cc$exports, "useSliderState", () => $37396301f90211cc$export$e5fda3247f5d67f9);
26
+ $parcel$export($e86753598efd0f02$exports, "useSliderState", () => $e86753598efd0f02$export$e5fda3247f5d67f9);
27
27
 
28
28
 
29
29
 
30
- const $37396301f90211cc$var$DEFAULT_MIN_VALUE = 0;
31
- const $37396301f90211cc$var$DEFAULT_MAX_VALUE = 100;
32
- const $37396301f90211cc$var$DEFAULT_STEP_VALUE = 1;
33
- function $37396301f90211cc$export$e5fda3247f5d67f9(props) {
34
- const { isDisabled: isDisabled , minValue: minValue = $37396301f90211cc$var$DEFAULT_MIN_VALUE , maxValue: maxValue = $37396301f90211cc$var$DEFAULT_MAX_VALUE , numberFormatter: formatter , step: step = $37396301f90211cc$var$DEFAULT_STEP_VALUE } = props;
30
+ const $e86753598efd0f02$var$DEFAULT_MIN_VALUE = 0;
31
+ const $e86753598efd0f02$var$DEFAULT_MAX_VALUE = 100;
32
+ const $e86753598efd0f02$var$DEFAULT_STEP_VALUE = 1;
33
+ function $e86753598efd0f02$export$e5fda3247f5d67f9(props) {
34
+ const { isDisabled: isDisabled , minValue: minValue = $e86753598efd0f02$var$DEFAULT_MIN_VALUE , maxValue: maxValue = $e86753598efd0f02$var$DEFAULT_MAX_VALUE , numberFormatter: formatter , step: step = $e86753598efd0f02$var$DEFAULT_STEP_VALUE } = props;
35
35
  var _defaultValue;
36
- const [values, setValues] = $m1uKO$reactstatelyutils.useControlledState(props.value, (_defaultValue = props.defaultValue) !== null && _defaultValue !== void 0 ? _defaultValue : [
36
+ const [values, setValues] = $ltQvC$reactstatelyutils.useControlledState(props.value, (_defaultValue = props.defaultValue) !== null && _defaultValue !== void 0 ? _defaultValue : [
37
37
  minValue
38
38
  ], props.onChange);
39
- const [isDraggings, setDraggings] = $m1uKO$react.useState(new Array(values.length).fill(false));
40
- const isEditablesRef = $m1uKO$react.useRef(new Array(values.length).fill(true));
41
- const [focusedIndex, setFocusedIndex] = $m1uKO$react.useState(undefined);
42
- const valuesRef = $m1uKO$react.useRef(null);
39
+ const [isDraggings, setDraggings] = $ltQvC$react.useState(new Array(values.length).fill(false));
40
+ const isEditablesRef = $ltQvC$react.useRef(new Array(values.length).fill(true));
41
+ const [focusedIndex, setFocusedIndex] = $ltQvC$react.useState(undefined);
42
+ const valuesRef = $ltQvC$react.useRef(null);
43
43
  valuesRef.current = values;
44
- const isDraggingsRef = $m1uKO$react.useRef(null);
44
+ const isDraggingsRef = $ltQvC$react.useRef(null);
45
45
  isDraggingsRef.current = isDraggings;
46
46
  function getValuePercent(value) {
47
47
  return (value - minValue) / (maxValue - minValue);
@@ -63,14 +63,14 @@ function $37396301f90211cc$export$e5fda3247f5d67f9(props) {
63
63
  const thisMin = getThumbMinValue(index);
64
64
  const thisMax = getThumbMaxValue(index);
65
65
  // Round value to multiple of step, clamp value between min and max
66
- value = $m1uKO$reactariautils.snapValueToStep(value, thisMin, thisMax, step);
67
- valuesRef.current = $37396301f90211cc$var$replaceIndex(valuesRef.current, index, value);
66
+ value = $ltQvC$reactariautils.snapValueToStep(value, thisMin, thisMax, step);
67
+ valuesRef.current = $e86753598efd0f02$var$replaceIndex(valuesRef.current, index, value);
68
68
  setValues(valuesRef.current);
69
69
  }
70
70
  function updateDragging(index, dragging) {
71
71
  if (isDisabled || !isThumbEditable(index)) return;
72
72
  const wasDragging = isDraggingsRef.current[index];
73
- isDraggingsRef.current = $37396301f90211cc$var$replaceIndex(isDraggingsRef.current, index, dragging);
73
+ isDraggingsRef.current = $e86753598efd0f02$var$replaceIndex(isDraggingsRef.current, index, dragging);
74
74
  setDraggings(isDraggingsRef.current);
75
75
  // Call onChangeEnd if no handles are dragging.
76
76
  if (props.onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean)) props.onChangeEnd(valuesRef.current);
@@ -86,7 +86,7 @@ function $37396301f90211cc$export$e5fda3247f5d67f9(props) {
86
86
  }
87
87
  function getPercentValue(percent) {
88
88
  const val = percent * (maxValue - minValue) + minValue;
89
- return $m1uKO$reactariautils.clamp(getRoundedValue(val), minValue, maxValue);
89
+ return $ltQvC$reactariautils.clamp(getRoundedValue(val), minValue, maxValue);
90
90
  }
91
91
  return {
92
92
  values: values,
@@ -113,7 +113,7 @@ function $37396301f90211cc$export$e5fda3247f5d67f9(props) {
113
113
  step: step
114
114
  };
115
115
  }
116
- function $37396301f90211cc$var$replaceIndex(array, index, value) {
116
+ function $e86753598efd0f02$var$replaceIndex(array, index, value) {
117
117
  if (array[index] === value) return array;
118
118
  return [
119
119
  ...array.slice(0, index),
@@ -123,7 +123,7 @@ function $37396301f90211cc$var$replaceIndex(array, index, value) {
123
123
  }
124
124
 
125
125
 
126
- $parcel$exportWildcard(module.exports, $37396301f90211cc$exports);
126
+ $parcel$exportWildcard(module.exports, $e86753598efd0f02$exports);
127
127
 
128
128
 
129
129
  //# sourceMappingURL=main.js.map
package/dist/module.js CHANGED
@@ -1,31 +1,31 @@
1
- import {snapValueToStep as $drHW0$snapValueToStep, clamp as $drHW0$clamp} from "@react-aria/utils";
2
- import {useControlledState as $drHW0$useControlledState} from "@react-stately/utils";
3
- import {useState as $drHW0$useState, useRef as $drHW0$useRef} from "react";
1
+ import {snapValueToStep as $aTwux$snapValueToStep, clamp as $aTwux$clamp} from "@react-aria/utils";
2
+ import {useControlledState as $aTwux$useControlledState} from "@react-stately/utils";
3
+ import {useState as $aTwux$useState, useRef as $aTwux$useRef} from "react";
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
6
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
7
  }
8
- var $8f011f344c0ccbcc$exports = {};
8
+ var $28f99e3e86e6ec45$exports = {};
9
9
 
10
- $parcel$export($8f011f344c0ccbcc$exports, "useSliderState", () => $8f011f344c0ccbcc$export$e5fda3247f5d67f9);
10
+ $parcel$export($28f99e3e86e6ec45$exports, "useSliderState", () => $28f99e3e86e6ec45$export$e5fda3247f5d67f9);
11
11
 
12
12
 
13
13
 
14
- const $8f011f344c0ccbcc$var$DEFAULT_MIN_VALUE = 0;
15
- const $8f011f344c0ccbcc$var$DEFAULT_MAX_VALUE = 100;
16
- const $8f011f344c0ccbcc$var$DEFAULT_STEP_VALUE = 1;
17
- function $8f011f344c0ccbcc$export$e5fda3247f5d67f9(props) {
18
- const { isDisabled: isDisabled , minValue: minValue = $8f011f344c0ccbcc$var$DEFAULT_MIN_VALUE , maxValue: maxValue = $8f011f344c0ccbcc$var$DEFAULT_MAX_VALUE , numberFormatter: formatter , step: step = $8f011f344c0ccbcc$var$DEFAULT_STEP_VALUE } = props;
14
+ const $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE = 0;
15
+ const $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE = 100;
16
+ const $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE = 1;
17
+ function $28f99e3e86e6ec45$export$e5fda3247f5d67f9(props) {
18
+ const { isDisabled: isDisabled , minValue: minValue = $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE , maxValue: maxValue = $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE , numberFormatter: formatter , step: step = $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE } = props;
19
19
  var _defaultValue;
20
- const [values, setValues] = $drHW0$useControlledState(props.value, (_defaultValue = props.defaultValue) !== null && _defaultValue !== void 0 ? _defaultValue : [
20
+ const [values, setValues] = $aTwux$useControlledState(props.value, (_defaultValue = props.defaultValue) !== null && _defaultValue !== void 0 ? _defaultValue : [
21
21
  minValue
22
22
  ], props.onChange);
23
- const [isDraggings, setDraggings] = $drHW0$useState(new Array(values.length).fill(false));
24
- const isEditablesRef = $drHW0$useRef(new Array(values.length).fill(true));
25
- const [focusedIndex, setFocusedIndex] = $drHW0$useState(undefined);
26
- const valuesRef = $drHW0$useRef(null);
23
+ const [isDraggings, setDraggings] = $aTwux$useState(new Array(values.length).fill(false));
24
+ const isEditablesRef = $aTwux$useRef(new Array(values.length).fill(true));
25
+ const [focusedIndex, setFocusedIndex] = $aTwux$useState(undefined);
26
+ const valuesRef = $aTwux$useRef(null);
27
27
  valuesRef.current = values;
28
- const isDraggingsRef = $drHW0$useRef(null);
28
+ const isDraggingsRef = $aTwux$useRef(null);
29
29
  isDraggingsRef.current = isDraggings;
30
30
  function getValuePercent(value) {
31
31
  return (value - minValue) / (maxValue - minValue);
@@ -47,14 +47,14 @@ function $8f011f344c0ccbcc$export$e5fda3247f5d67f9(props) {
47
47
  const thisMin = getThumbMinValue(index);
48
48
  const thisMax = getThumbMaxValue(index);
49
49
  // Round value to multiple of step, clamp value between min and max
50
- value = $drHW0$snapValueToStep(value, thisMin, thisMax, step);
51
- valuesRef.current = $8f011f344c0ccbcc$var$replaceIndex(valuesRef.current, index, value);
50
+ value = $aTwux$snapValueToStep(value, thisMin, thisMax, step);
51
+ valuesRef.current = $28f99e3e86e6ec45$var$replaceIndex(valuesRef.current, index, value);
52
52
  setValues(valuesRef.current);
53
53
  }
54
54
  function updateDragging(index, dragging) {
55
55
  if (isDisabled || !isThumbEditable(index)) return;
56
56
  const wasDragging = isDraggingsRef.current[index];
57
- isDraggingsRef.current = $8f011f344c0ccbcc$var$replaceIndex(isDraggingsRef.current, index, dragging);
57
+ isDraggingsRef.current = $28f99e3e86e6ec45$var$replaceIndex(isDraggingsRef.current, index, dragging);
58
58
  setDraggings(isDraggingsRef.current);
59
59
  // Call onChangeEnd if no handles are dragging.
60
60
  if (props.onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean)) props.onChangeEnd(valuesRef.current);
@@ -70,7 +70,7 @@ function $8f011f344c0ccbcc$export$e5fda3247f5d67f9(props) {
70
70
  }
71
71
  function getPercentValue(percent) {
72
72
  const val = percent * (maxValue - minValue) + minValue;
73
- return $drHW0$clamp(getRoundedValue(val), minValue, maxValue);
73
+ return $aTwux$clamp(getRoundedValue(val), minValue, maxValue);
74
74
  }
75
75
  return {
76
76
  values: values,
@@ -97,7 +97,7 @@ function $8f011f344c0ccbcc$export$e5fda3247f5d67f9(props) {
97
97
  step: step
98
98
  };
99
99
  }
100
- function $8f011f344c0ccbcc$var$replaceIndex(array, index, value) {
100
+ function $28f99e3e86e6ec45$var$replaceIndex(array, index, value) {
101
101
  if (array[index] === value) return array;
102
102
  return [
103
103
  ...array.slice(0, index),
@@ -109,5 +109,5 @@ function $8f011f344c0ccbcc$var$replaceIndex(array, index, value) {
109
109
 
110
110
 
111
111
 
112
- export {$8f011f344c0ccbcc$export$e5fda3247f5d67f9 as useSliderState};
112
+ export {$28f99e3e86e6ec45$export$e5fda3247f5d67f9 as useSliderState};
113
113
  //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/slider",
3
- "version": "3.0.5",
3
+ "version": "3.0.6-nightly.3113+404d41859",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,10 +18,10 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/i18n": "^3.3.6",
22
- "@react-aria/utils": "^3.11.2",
23
- "@react-stately/utils": "^3.4.1",
24
- "@react-types/slider": "^3.0.4"
21
+ "@react-aria/i18n": "3.0.0-nightly.1417+404d41859",
22
+ "@react-aria/utils": "3.0.0-nightly.1417+404d41859",
23
+ "@react-stately/utils": "3.0.0-nightly.1417+404d41859",
24
+ "@react-types/slider": "3.0.5-nightly.3113+404d41859"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "^16.8.0 || ^17.0.0-rc.1"