@elliemae/ds-slider 2.0.0-alpha.9 → 2.0.0-next.12
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/cjs/DSSlider.js +5 -0
- package/cjs/components/SliderImp.js +16 -12
- package/cjs/components/Thumb.js +12 -5
- package/cjs/components/TickMarksValues.js +3 -1
- package/cjs/components/Track.js +10 -4
- package/cjs/components/styled.js +22 -13
- package/cjs/components/utils.js +21 -11
- package/esm/DSSlider.js +5 -0
- package/esm/components/SliderImp.js +15 -10
- package/esm/components/Thumb.js +12 -5
- package/esm/components/TickMarksValues.js +3 -1
- package/esm/components/Track.js +10 -4
- package/esm/components/styled.js +22 -13
- package/esm/components/utils.js +18 -8
- package/package.json +8 -8
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/DSSlider.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
require('react');
|
|
7
12
|
var reactDesc = require('react-desc');
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var uuid = require('uuid');
|
|
6
7
|
var reactRange = require('react-range');
|
|
7
|
-
var
|
|
8
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
9
|
var DSTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
9
10
|
var dsGrid = require('@elliemae/ds-grid');
|
|
10
11
|
var Track = require('./Track.js');
|
|
@@ -17,11 +18,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
17
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
19
|
|
|
19
20
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
20
|
-
var usePrevious__default = /*#__PURE__*/_interopDefaultLegacy(usePrevious);
|
|
21
21
|
var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTruncatedTooltipText);
|
|
22
22
|
|
|
23
|
-
const getSubArrayFromRange = (arr,
|
|
24
|
-
|
|
23
|
+
const getSubArrayFromRange = function (arr, _ref) {
|
|
24
|
+
let [minVal, maxVal] = _ref;
|
|
25
|
+
let isCustomTickMarksValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
25
26
|
const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;
|
|
26
27
|
const minIndex = arr.findIndex(el => el === trueMinVal);
|
|
27
28
|
|
|
@@ -93,7 +94,7 @@ const SliderImp = props => {
|
|
|
93
94
|
const selectedRangeValues = getSubArrayFromRange(parsedValuesArray, rangeValues, !!(customTickMarksValues !== null && customTickMarksValues !== void 0 && customTickMarksValues.length));
|
|
94
95
|
setFullSelectedValues(selectedRangeValues);
|
|
95
96
|
}, [parsedValuesArray, rangeValues, customTickMarksValues === null || customTickMarksValues === void 0 ? void 0 : customTickMarksValues.length]);
|
|
96
|
-
const prevWithTwoHandles =
|
|
97
|
+
const prevWithTwoHandles = dsUtilities.usePrevious(withTwoHandles);
|
|
97
98
|
|
|
98
99
|
const resizeHandler = () => {
|
|
99
100
|
var _ref$current;
|
|
@@ -169,12 +170,15 @@ const SliderImp = props => {
|
|
|
169
170
|
setRangeValues(values);
|
|
170
171
|
onChange(values);
|
|
171
172
|
},
|
|
172
|
-
renderTrack:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
renderTrack: _ref2 => {
|
|
174
|
+
let {
|
|
175
|
+
props: trackProps,
|
|
176
|
+
children
|
|
177
|
+
} = _ref2;
|
|
178
|
+
return /*#__PURE__*/_jsx__default["default"](Track, {
|
|
179
|
+
props: trackProps
|
|
180
|
+
}, void 0, children);
|
|
181
|
+
},
|
|
178
182
|
renderThumb: renderArgs => {
|
|
179
183
|
const {
|
|
180
184
|
index,
|
|
@@ -185,7 +189,7 @@ const SliderImp = props => {
|
|
|
185
189
|
props: thumbProps,
|
|
186
190
|
isDragged: isDragged,
|
|
187
191
|
index: index
|
|
188
|
-
},
|
|
192
|
+
}, "".concat(sliderUUID, "-").concat(thumbProps.key));
|
|
189
193
|
},
|
|
190
194
|
allowOverlap: false
|
|
191
195
|
}))))
|
package/cjs/components/Thumb.js
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
11
|
var React = require('react');
|
|
6
12
|
var dsTooltip = require('@elliemae/ds-tooltip');
|
|
7
13
|
var context = require('./context.js');
|
|
@@ -20,11 +26,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
26
|
|
|
21
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
28
|
|
|
23
|
-
const Thumb =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const Thumb = _ref => {
|
|
30
|
+
let {
|
|
31
|
+
index,
|
|
32
|
+
props,
|
|
33
|
+
isDragged
|
|
34
|
+
} = _ref;
|
|
28
35
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
29
36
|
const {
|
|
30
37
|
disabled,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
4
6
|
var React = require('react');
|
|
5
7
|
var styled = require('styled-components');
|
|
6
8
|
var dsSystem = require('@elliemae/ds-system');
|
|
@@ -23,7 +25,7 @@ const TickMarks = () => {
|
|
|
23
25
|
const isSelected = fullSelectedValues.findIndex(selectedVal => selectedVal === value) >= 0;
|
|
24
26
|
return /*#__PURE__*/_jsx__default["default"](TickMarkValue, {
|
|
25
27
|
isSelected: isSelected
|
|
26
|
-
},
|
|
28
|
+
}, "".concat(sliderUUID, "-").concat(value), value);
|
|
27
29
|
}), [parsedValuesArray, sliderUUID, fullSelectedValues]);
|
|
28
30
|
const PureTickMArksValues = React.useMemo(() => _TickMarksContainer || (_TickMarksContainer = /*#__PURE__*/_jsx__default["default"](TickMarksContainer, {
|
|
29
31
|
"data-testid": "slider-tick-marks-values"
|
package/cjs/components/Track.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
3
8
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
9
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
10
|
var React = require('react');
|
|
@@ -23,10 +28,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
23
28
|
|
|
24
29
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
30
|
|
|
26
|
-
const Track =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
const Track = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
children,
|
|
34
|
+
props
|
|
35
|
+
} = _ref;
|
|
30
36
|
const {
|
|
31
37
|
disabled,
|
|
32
38
|
minValue,
|
package/cjs/components/styled.js
CHANGED
|
@@ -13,32 +13,41 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
13
13
|
/* eslint-disable indent */
|
|
14
14
|
const ThumbStyled = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
15
15
|
componentId: "sc-24in0j-0"
|
|
16
|
-
})(["height:20px;width:20px;background-color:", ";border-radius:10px;border:1px solid ", ";:focus{border:1px solid ", ";outline:unset;}:hover{background-color:", ";}"], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000'], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400], props => props.theme.colors.brand[600],
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
})(["height:20px;width:20px;background-color:", ";border-radius:10px;border:1px solid ", ";:focus{border:1px solid ", ";outline:unset;}:hover{background-color:", ";}"], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000'], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400], props => props.theme.colors.brand[600], _ref => {
|
|
17
|
+
let {
|
|
18
|
+
disabled,
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return disabled ? theme.colors.neutral[100] : theme.colors.brand[200];
|
|
22
|
+
});
|
|
20
23
|
const TooltipContainerStyled = /*#__PURE__*/styled__default["default"](dsTooltip.TooltipContainer).withConfig({
|
|
21
24
|
componentId: "sc-24in0j-1"
|
|
22
|
-
})(["position:relative;display:flex;align-items:center;flex-direction:column;top:-35px;width:max-content;left:50%;transform:translateX(-50%);visibility:", ";"],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
})(["position:relative;display:flex;align-items:center;flex-direction:column;top:-35px;width:max-content;left:50%;transform:translateX(-50%);visibility:", ";"], _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
isDragged,
|
|
28
|
+
isHovered
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return isDragged || isHovered ? 'visible' : 'hidden';
|
|
31
|
+
}); // TODO: didn't work with DSTooltip, see how to improve
|
|
26
32
|
|
|
27
33
|
const TooltipArrow = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
28
34
|
componentId: "sc-24in0j-2"
|
|
29
35
|
})(["position:absolute;width:0;height:0;top:20px;border-left:calc(", " * 2.5) solid transparent;border-right:calc(", " * 2.5) solid transparent;border-top:calc(", " * 2.5) solid ", ";"], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => props.theme.colors.neutral[0]);
|
|
30
36
|
const LabelWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
31
37
|
componentId: "sc-24in0j-3"
|
|
32
|
-
})(["margin-bottom:", ";max-width:100%;width:", ";"], props => props.theme.space.xxs, props =>
|
|
38
|
+
})(["margin-bottom:", ";max-width:100%;width:", ";"], props => props.theme.space.xxs, props => "".concat(props.width || 0, "px"));
|
|
33
39
|
const LabelText = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
34
40
|
componentId: "sc-24in0j-4"
|
|
35
41
|
})(["color:", ";"], props => props.theme.colors.neutral[600]);
|
|
36
42
|
const ValueText = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
37
43
|
componentId: "sc-24in0j-5"
|
|
38
|
-
})(["color:", ";"],
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
})(["color:", ";"], _ref3 => {
|
|
45
|
+
let {
|
|
46
|
+
disabled,
|
|
47
|
+
theme
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return theme.colors.neutral[disabled ? 500 : 800];
|
|
50
|
+
});
|
|
42
51
|
const StyledRangeWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
43
52
|
componentId: "sc-24in0j-6"
|
|
44
53
|
})(["min-height:28px;margin:0 10px;"]);
|
package/cjs/components/utils.js
CHANGED
|
@@ -2,34 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-params */
|
|
8
|
-
const conformedLabel = (rangeValues
|
|
8
|
+
const conformedLabel = function (rangeValues) {
|
|
9
|
+
let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
10
|
+
let labelWithValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
11
|
+
let withTwoHandles = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
12
|
+
let customTickMarksValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
13
|
+
let step = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
14
|
+
let minValue = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
9
15
|
const msg = label.trim();
|
|
10
16
|
let value = '';
|
|
11
17
|
|
|
12
|
-
if (!
|
|
18
|
+
if (!dsUtilities.isEmpty(customTickMarksValues) && labelWithValue && label) {
|
|
13
19
|
const firstValue = customTickMarksValues[(rangeValues[0] - minValue) / step];
|
|
14
20
|
const secondValue = customTickMarksValues[(rangeValues[1] - minValue) / step];
|
|
15
|
-
value =
|
|
21
|
+
value = "".concat(firstValue || rangeValues[0].toFixed(1), " ").concat(withTwoHandles ? ", ".concat(secondValue || rangeValues[1].toFixed(1)) : '', " ");
|
|
16
22
|
} else if (labelWithValue && label) {
|
|
17
23
|
var _rangeValues$;
|
|
18
24
|
|
|
19
|
-
value =
|
|
25
|
+
value = "".concat(rangeValues[0].toFixed(1), " ").concat(withTwoHandles ? ", ".concat((_rangeValues$ = rangeValues[1]) === null || _rangeValues$ === void 0 ? void 0 : _rangeValues$.toFixed(1)) : '', " ");
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
value = value.trim();
|
|
23
29
|
return [msg, value];
|
|
24
30
|
};
|
|
25
|
-
const conformedThumbLabel = (rangeValues
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
const conformedThumbLabel = function (rangeValues) {
|
|
32
|
+
let customTickMarksValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
33
|
+
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
34
|
+
let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
35
|
+
let minValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
36
|
+
let msg = "Value: ";
|
|
37
|
+
|
|
38
|
+
if (!dsUtilities.isEmpty(customTickMarksValues)) {
|
|
29
39
|
const foundValue = customTickMarksValues[(rangeValues[index] - minValue) / step];
|
|
30
|
-
msg +=
|
|
40
|
+
msg += "".concat(foundValue || rangeValues[index].toFixed(1));
|
|
31
41
|
} else {
|
|
32
|
-
msg +=
|
|
42
|
+
msg += "".concat(rangeValues[index].toFixed(1));
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
return msg;
|
package/esm/DSSlider.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import 'react';
|
|
3
8
|
import { describe } from 'react-desc';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import { useRef, useState, useMemo, useEffect } from 'react';
|
|
3
4
|
import { v4 } from 'uuid';
|
|
4
5
|
import { Range } from 'react-range';
|
|
5
|
-
import usePrevious from '@elliemae/ds-utilities
|
|
6
|
+
import { usePrevious } from '@elliemae/ds-utilities';
|
|
6
7
|
import DSTruncatedTooltipText, { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';
|
|
7
8
|
import { Grid } from '@elliemae/ds-grid';
|
|
8
9
|
import Track from './Track.js';
|
|
@@ -12,8 +13,9 @@ import { conformedLabel } from './utils.js';
|
|
|
12
13
|
import { SliderContext } from './context.js';
|
|
13
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
15
|
|
|
15
|
-
const getSubArrayFromRange = (arr,
|
|
16
|
-
|
|
16
|
+
const getSubArrayFromRange = function (arr, _ref) {
|
|
17
|
+
let [minVal, maxVal] = _ref;
|
|
18
|
+
let isCustomTickMarksValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
17
19
|
const trueMinVal = isCustomTickMarksValues ? arr[minVal] : minVal;
|
|
18
20
|
const minIndex = arr.findIndex(el => el === trueMinVal);
|
|
19
21
|
|
|
@@ -161,12 +163,15 @@ const SliderImp = props => {
|
|
|
161
163
|
setRangeValues(values);
|
|
162
164
|
onChange(values);
|
|
163
165
|
},
|
|
164
|
-
renderTrack:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
renderTrack: _ref2 => {
|
|
167
|
+
let {
|
|
168
|
+
props: trackProps,
|
|
169
|
+
children
|
|
170
|
+
} = _ref2;
|
|
171
|
+
return /*#__PURE__*/_jsx(Track, {
|
|
172
|
+
props: trackProps
|
|
173
|
+
}, void 0, children);
|
|
174
|
+
},
|
|
170
175
|
renderThumb: renderArgs => {
|
|
171
176
|
const {
|
|
172
177
|
index,
|
|
@@ -177,7 +182,7 @@ const SliderImp = props => {
|
|
|
177
182
|
props: thumbProps,
|
|
178
183
|
isDragged: isDragged,
|
|
179
184
|
index: index
|
|
180
|
-
},
|
|
185
|
+
}, "".concat(sliderUUID, "-").concat(thumbProps.key));
|
|
181
186
|
},
|
|
182
187
|
allowOverlap: false
|
|
183
188
|
}))))
|
package/esm/components/Thumb.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
9
|
import { useState, useContext } from 'react';
|
|
4
10
|
import { TooltipText } from '@elliemae/ds-tooltip';
|
|
5
11
|
import { SliderContext } from './context.js';
|
|
@@ -13,11 +19,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
13
19
|
|
|
14
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
21
|
|
|
16
|
-
const Thumb =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const Thumb = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
index,
|
|
25
|
+
props,
|
|
26
|
+
isDragged
|
|
27
|
+
} = _ref;
|
|
21
28
|
const [isHovered, setIsHovered] = useState(false);
|
|
22
29
|
const {
|
|
23
30
|
disabled,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
2
4
|
import { useContext, useMemo } from 'react';
|
|
3
5
|
import styled from 'styled-components';
|
|
4
6
|
import { __UNSAFE_SPACE_TO_DIMSUM } from '@elliemae/ds-system';
|
|
@@ -16,7 +18,7 @@ const TickMarks = () => {
|
|
|
16
18
|
const isSelected = fullSelectedValues.findIndex(selectedVal => selectedVal === value) >= 0;
|
|
17
19
|
return /*#__PURE__*/_jsx(TickMarkValue, {
|
|
18
20
|
isSelected: isSelected
|
|
19
|
-
},
|
|
21
|
+
}, "".concat(sliderUUID, "-").concat(value), value);
|
|
20
22
|
}), [parsedValuesArray, sliderUUID, fullSelectedValues]);
|
|
21
23
|
const PureTickMArksValues = useMemo(() => _TickMarksContainer || (_TickMarksContainer = /*#__PURE__*/_jsx(TickMarksContainer, {
|
|
22
24
|
"data-testid": "slider-tick-marks-values"
|
package/esm/components/Track.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import { useContext } from 'react';
|
|
@@ -15,10 +20,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
20
|
|
|
16
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
22
|
|
|
18
|
-
const Track =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
const Track = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
children,
|
|
26
|
+
props
|
|
27
|
+
} = _ref;
|
|
22
28
|
const {
|
|
23
29
|
disabled,
|
|
24
30
|
minValue,
|
package/esm/components/styled.js
CHANGED
|
@@ -5,32 +5,41 @@ import { TooltipContainer } from '@elliemae/ds-tooltip';
|
|
|
5
5
|
/* eslint-disable indent */
|
|
6
6
|
const ThumbStyled = /*#__PURE__*/styled.div.withConfig({
|
|
7
7
|
componentId: "sc-24in0j-0"
|
|
8
|
-
})(["height:20px;width:20px;background-color:", ";border-radius:10px;border:1px solid ", ";:focus{border:1px solid ", ";outline:unset;}:hover{background-color:", ";}"], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000'], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400], props => props.theme.colors.brand[600],
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
})(["height:20px;width:20px;background-color:", ";border-radius:10px;border:1px solid ", ";:focus{border:1px solid ", ";outline:unset;}:hover{background-color:", ";}"], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral['000'], props => props.disabled ? props.theme.colors.neutral[100] : props.theme.colors.neutral[400], props => props.theme.colors.brand[600], _ref => {
|
|
9
|
+
let {
|
|
10
|
+
disabled,
|
|
11
|
+
theme
|
|
12
|
+
} = _ref;
|
|
13
|
+
return disabled ? theme.colors.neutral[100] : theme.colors.brand[200];
|
|
14
|
+
});
|
|
12
15
|
const TooltipContainerStyled = /*#__PURE__*/styled(TooltipContainer).withConfig({
|
|
13
16
|
componentId: "sc-24in0j-1"
|
|
14
|
-
})(["position:relative;display:flex;align-items:center;flex-direction:column;top:-35px;width:max-content;left:50%;transform:translateX(-50%);visibility:", ";"],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
})(["position:relative;display:flex;align-items:center;flex-direction:column;top:-35px;width:max-content;left:50%;transform:translateX(-50%);visibility:", ";"], _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
isDragged,
|
|
20
|
+
isHovered
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return isDragged || isHovered ? 'visible' : 'hidden';
|
|
23
|
+
}); // TODO: didn't work with DSTooltip, see how to improve
|
|
18
24
|
|
|
19
25
|
const TooltipArrow = /*#__PURE__*/styled.div.withConfig({
|
|
20
26
|
componentId: "sc-24in0j-2"
|
|
21
27
|
})(["position:absolute;width:0;height:0;top:20px;border-left:calc(", " * 2.5) solid transparent;border-right:calc(", " * 2.5) solid transparent;border-top:calc(", " * 2.5) solid ", ";"], props => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => __UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => props.theme.colors.neutral[0]);
|
|
22
28
|
const LabelWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
23
29
|
componentId: "sc-24in0j-3"
|
|
24
|
-
})(["margin-bottom:", ";max-width:100%;width:", ";"], props => props.theme.space.xxs, props =>
|
|
30
|
+
})(["margin-bottom:", ";max-width:100%;width:", ";"], props => props.theme.space.xxs, props => "".concat(props.width || 0, "px"));
|
|
25
31
|
const LabelText = /*#__PURE__*/styled.span.withConfig({
|
|
26
32
|
componentId: "sc-24in0j-4"
|
|
27
33
|
})(["color:", ";"], props => props.theme.colors.neutral[600]);
|
|
28
34
|
const ValueText = /*#__PURE__*/styled.span.withConfig({
|
|
29
35
|
componentId: "sc-24in0j-5"
|
|
30
|
-
})(["color:", ";"],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
})(["color:", ";"], _ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
disabled,
|
|
39
|
+
theme
|
|
40
|
+
} = _ref3;
|
|
41
|
+
return theme.colors.neutral[disabled ? 500 : 800];
|
|
42
|
+
});
|
|
34
43
|
const StyledRangeWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
35
44
|
componentId: "sc-24in0j-6"
|
|
36
45
|
})(["min-height:28px;margin:0 10px;"]);
|
package/esm/components/utils.js
CHANGED
|
@@ -1,31 +1,41 @@
|
|
|
1
|
-
import { isEmpty } from '@elliemae/ds-utilities
|
|
1
|
+
import { isEmpty } from '@elliemae/ds-utilities';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable max-params */
|
|
4
|
-
const conformedLabel = (rangeValues
|
|
4
|
+
const conformedLabel = function (rangeValues) {
|
|
5
|
+
let label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
6
|
+
let labelWithValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7
|
+
let withTwoHandles = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8
|
+
let customTickMarksValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
9
|
+
let step = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
10
|
+
let minValue = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
5
11
|
const msg = label.trim();
|
|
6
12
|
let value = '';
|
|
7
13
|
|
|
8
14
|
if (!isEmpty(customTickMarksValues) && labelWithValue && label) {
|
|
9
15
|
const firstValue = customTickMarksValues[(rangeValues[0] - minValue) / step];
|
|
10
16
|
const secondValue = customTickMarksValues[(rangeValues[1] - minValue) / step];
|
|
11
|
-
value =
|
|
17
|
+
value = "".concat(firstValue || rangeValues[0].toFixed(1), " ").concat(withTwoHandles ? ", ".concat(secondValue || rangeValues[1].toFixed(1)) : '', " ");
|
|
12
18
|
} else if (labelWithValue && label) {
|
|
13
19
|
var _rangeValues$;
|
|
14
20
|
|
|
15
|
-
value =
|
|
21
|
+
value = "".concat(rangeValues[0].toFixed(1), " ").concat(withTwoHandles ? ", ".concat((_rangeValues$ = rangeValues[1]) === null || _rangeValues$ === void 0 ? void 0 : _rangeValues$.toFixed(1)) : '', " ");
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
value = value.trim();
|
|
19
25
|
return [msg, value];
|
|
20
26
|
};
|
|
21
|
-
const conformedThumbLabel = (rangeValues
|
|
22
|
-
let
|
|
27
|
+
const conformedThumbLabel = function (rangeValues) {
|
|
28
|
+
let customTickMarksValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
29
|
+
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
30
|
+
let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
31
|
+
let minValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
32
|
+
let msg = "Value: ";
|
|
23
33
|
|
|
24
34
|
if (!isEmpty(customTickMarksValues)) {
|
|
25
35
|
const foundValue = customTickMarksValues[(rangeValues[index] - minValue) / step];
|
|
26
|
-
msg +=
|
|
36
|
+
msg += "".concat(foundValue || rangeValues[index].toFixed(1));
|
|
27
37
|
} else {
|
|
28
|
-
msg +=
|
|
38
|
+
msg += "".concat(rangeValues[index].toFixed(1));
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
return msg;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-slider",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-next.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Slider",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -72,23 +72,23 @@
|
|
|
72
72
|
"build": "node ../../scripts/build/build.js"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-grid": "2.0.0-
|
|
76
|
-
"@elliemae/ds-system": "2.0.0-
|
|
77
|
-
"@elliemae/ds-tooltip": "2.0.0-
|
|
78
|
-
"@elliemae/ds-truncated-tooltip-text": "2.0.0-
|
|
79
|
-
"@elliemae/ds-utilities": "2.0.0-
|
|
75
|
+
"@elliemae/ds-grid": "2.0.0-next.12",
|
|
76
|
+
"@elliemae/ds-system": "2.0.0-next.12",
|
|
77
|
+
"@elliemae/ds-tooltip": "2.0.0-next.12",
|
|
78
|
+
"@elliemae/ds-truncated-tooltip-text": "2.0.0-next.12",
|
|
79
|
+
"@elliemae/ds-utilities": "2.0.0-next.12",
|
|
80
80
|
"prop-types": "~15.7.2",
|
|
81
81
|
"react-desc": "~4.1.3",
|
|
82
82
|
"react-range": "~1.8.11",
|
|
83
83
|
"uuid": "~8.3.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"styled-components": "~5.3.
|
|
86
|
+
"styled-components": "~5.3.3"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"react": "^17.0.2",
|
|
90
90
|
"react-dom": "^17.0.2",
|
|
91
|
-
"styled-components": "^5.3.
|
|
91
|
+
"styled-components": "^5.3.3"
|
|
92
92
|
},
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public",
|
package/cjs/package.json
DELETED