@elliemae/ds-slider 2.0.0-alpha.1 → 2.0.0-alpha.13
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 +7 -2
- package/cjs/components/SliderImp.js +24 -20
- package/cjs/components/Thumb.js +15 -8
- package/cjs/components/TickMarks.js +4 -4
- package/cjs/components/TickMarksValues.js +7 -5
- package/cjs/components/Track.js +14 -8
- package/cjs/components/context.js +1 -1
- package/cjs/components/styled.js +29 -20
- package/cjs/components/utils.js +21 -11
- package/cjs/index.js +1 -1
- 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/types/DSSlider.d.ts +84 -14
- package/types/components/styled.d.ts +8 -7
- package/types/prop-types.d.ts +92 -13
- 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');
|
|
@@ -15,7 +20,7 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
15
20
|
|
|
16
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
22
|
|
|
18
|
-
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[
|
|
23
|
+
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; }
|
|
19
24
|
|
|
20
25
|
const DSSlider = props => /*#__PURE__*/jsxRuntime.jsx(SliderImp, _objectSpread({}, props));
|
|
21
26
|
|
|
@@ -25,4 +30,4 @@ DSSliderWithSchema.propTypes = propTypes.sliderPropTypes;
|
|
|
25
30
|
|
|
26
31
|
exports.DSSlider = DSSlider;
|
|
27
32
|
exports.DSSliderWithSchema = DSSliderWithSchema;
|
|
28
|
-
exports[
|
|
33
|
+
exports["default"] = DSSlider;
|
|
@@ -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;
|
|
@@ -121,14 +122,14 @@ const SliderImp = props => {
|
|
|
121
122
|
const [finalLabelText, finalValueText] = React.useMemo(() => utils.conformedLabel(rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep), [rangeValues, label, labelWithValue, withTwoHandles, customTickMarksValues, parsedStep]);
|
|
122
123
|
|
|
123
124
|
const SliderLabel = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
124
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
125
|
+
children: [/*#__PURE__*/_jsx__default["default"](styled.LabelText, {}, void 0, finalLabelText), finalLabelText && ' ', /*#__PURE__*/_jsx__default["default"](styled.ValueText, {
|
|
125
126
|
disabled: disabled
|
|
126
127
|
}, void 0, finalValueText)]
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
return /*#__PURE__*/_jsx__default[
|
|
130
|
+
return /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText.TooltipTextProvider, {}, void 0, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
130
131
|
ref: ref,
|
|
131
|
-
children: /*#__PURE__*/_jsx__default[
|
|
132
|
+
children: /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
132
133
|
width: "100%",
|
|
133
134
|
style: {
|
|
134
135
|
maxWidth: '100%'
|
|
@@ -136,7 +137,7 @@ const SliderImp = props => {
|
|
|
136
137
|
containerProps: containerProps,
|
|
137
138
|
"data-testid": "slider",
|
|
138
139
|
rows: ['auto', 'auto']
|
|
139
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
140
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](context.SliderContext.Provider, {
|
|
140
141
|
value: {
|
|
141
142
|
disabled,
|
|
142
143
|
sliderUUID,
|
|
@@ -154,11 +155,11 @@ const SliderImp = props => {
|
|
|
154
155
|
fullSelectedValues,
|
|
155
156
|
zIndex
|
|
156
157
|
}
|
|
157
|
-
}, void 0, finalLabelText && /*#__PURE__*/_jsx__default[
|
|
158
|
+
}, void 0, finalLabelText && /*#__PURE__*/_jsx__default["default"](styled.LabelWrapper, {
|
|
158
159
|
width: width
|
|
159
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
160
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
160
161
|
value: SliderLabel
|
|
161
|
-
})), /*#__PURE__*/_jsx__default[
|
|
162
|
+
})), /*#__PURE__*/_jsx__default["default"](styled.StyledRangeWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](reactRange.Range, {
|
|
162
163
|
step: parsedStep,
|
|
163
164
|
min: parsedMinValue,
|
|
164
165
|
max: parsedMaxValue,
|
|
@@ -169,23 +170,26 @@ 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,
|
|
181
185
|
props: thumbProps,
|
|
182
186
|
isDragged
|
|
183
187
|
} = renderArgs;
|
|
184
|
-
return /*#__PURE__*/_jsx__default[
|
|
188
|
+
return /*#__PURE__*/_jsx__default["default"](Thumb, {
|
|
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');
|
|
@@ -18,13 +24,14 @@ var _TooltipArrow;
|
|
|
18
24
|
|
|
19
25
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
20
26
|
|
|
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__default[
|
|
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,
|
|
@@ -53,10 +60,10 @@ const Thumb = ({
|
|
|
53
60
|
index: index,
|
|
54
61
|
onMouseEnter: () => setIsHovered(true),
|
|
55
62
|
onMouseLeave: () => setIsHovered(false),
|
|
56
|
-
children: /*#__PURE__*/_jsx__default[
|
|
63
|
+
children: /*#__PURE__*/_jsx__default["default"](styled.TooltipContainerStyled, {
|
|
57
64
|
isDragged: isDragged,
|
|
58
65
|
isHovered: isHovered
|
|
59
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsTooltip.TooltipText, {}, void 0, utils.conformedThumbLabel(rangeValues, customTickMarksValues, index, step, minValue)), _TooltipArrow || (_TooltipArrow = /*#__PURE__*/_jsx__default["default"](styled.TooltipArrow, {})))
|
|
60
67
|
}))
|
|
61
68
|
);
|
|
62
69
|
};
|
|
@@ -24,22 +24,22 @@ const TickMarks = () => {
|
|
|
24
24
|
|
|
25
25
|
for (let index = minValue || 0; index <= maxValue; index += step) {
|
|
26
26
|
const isActive = withTwoHandles ? rangeValues[0] <= index && index < rangeValues[1] : rangeValues[0] > index;
|
|
27
|
-
dots.push( /*#__PURE__*/_jsx__default[
|
|
27
|
+
dots.push( /*#__PURE__*/_jsx__default["default"](Dot, {
|
|
28
28
|
"data-testid": "slider-dot",
|
|
29
29
|
isActive: isActive
|
|
30
30
|
}, index));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
return /*#__PURE__*/_jsx__default[
|
|
33
|
+
return /*#__PURE__*/_jsx__default["default"](DotsContainer, {
|
|
34
34
|
"data-testid": "slider-tick-marks",
|
|
35
35
|
zIndex: zIndex
|
|
36
36
|
}, void 0, dots);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const Dot = /*#__PURE__*/styled__default[
|
|
39
|
+
const Dot = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
40
40
|
componentId: "sc-15z2sh4-0"
|
|
41
41
|
})(["&:after{content:'';background:", ";border-radius:", ";display:block;position:relative;width:2px;height:2px;}"], props => props.isActive ? props.theme.colors.brand[300] : props.theme.colors.neutral[400], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs));
|
|
42
|
-
const DotsContainer = /*#__PURE__*/styled__default[
|
|
42
|
+
const DotsContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
43
43
|
componentId: "sc-15z2sh4-1"
|
|
44
44
|
})(["padding:0 calc(", " * 0.5);align-items:center;display:flex;justify-content:space-between;pointer-events:none;position:absolute;top:0;left:0;right:0;bottom:0;z-index:", ";"], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => props.zIndex - 1);
|
|
45
45
|
|
|
@@ -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');
|
|
@@ -21,20 +23,20 @@ const TickMarks = () => {
|
|
|
21
23
|
} = React.useContext(context.SliderContext);
|
|
22
24
|
const TickMarksLabels = React.useMemo(() => parsedValuesArray.map(value => {
|
|
23
25
|
const isSelected = fullSelectedValues.findIndex(selectedVal => selectedVal === value) >= 0;
|
|
24
|
-
return /*#__PURE__*/_jsx__default[
|
|
26
|
+
return /*#__PURE__*/_jsx__default["default"](TickMarkValue, {
|
|
25
27
|
isSelected: isSelected
|
|
26
|
-
},
|
|
28
|
+
}, "".concat(sliderUUID, "-").concat(value), value);
|
|
27
29
|
}), [parsedValuesArray, sliderUUID, fullSelectedValues]);
|
|
28
|
-
const PureTickMArksValues = React.useMemo(() => _TickMarksContainer || (_TickMarksContainer = /*#__PURE__*/_jsx__default[
|
|
30
|
+
const PureTickMArksValues = React.useMemo(() => _TickMarksContainer || (_TickMarksContainer = /*#__PURE__*/_jsx__default["default"](TickMarksContainer, {
|
|
29
31
|
"data-testid": "slider-tick-marks-values"
|
|
30
32
|
}, void 0, TickMarksLabels)), [TickMarksLabels]);
|
|
31
33
|
return PureTickMArksValues;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
|
-
const TickMarkValue = /*#__PURE__*/styled__default[
|
|
36
|
+
const TickMarkValue = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
35
37
|
componentId: "sc-lq3yel-0"
|
|
36
38
|
})(["margin:", " 0;overflow:visible;transform:translateX(-100%);width:", ";color:", ";"], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.s), props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => props.isSelected ? props.theme.colors.neutral[800] : props.theme.colors.neutral[500]);
|
|
37
|
-
const TickMarksContainer = /*#__PURE__*/styled__default[
|
|
39
|
+
const TickMarksContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
38
40
|
componentId: "sc-lq3yel-1"
|
|
39
41
|
})(["display:flex;justify-content:space-between;"]);
|
|
40
42
|
|
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');
|
|
@@ -21,12 +26,13 @@ var _TickMarks, _TickMarksValues;
|
|
|
21
26
|
|
|
22
27
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
23
28
|
|
|
24
|
-
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[
|
|
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,
|
|
@@ -44,12 +50,12 @@ const Track = ({
|
|
|
44
50
|
maxValue: maxValue,
|
|
45
51
|
rangeValues: rangeValues,
|
|
46
52
|
withTwoHandles: withTwoHandles,
|
|
47
|
-
children: [children, withTickMarks && !disabled && (_TickMarks || (_TickMarks = /*#__PURE__*/_jsx__default[
|
|
48
|
-
})), withTickMarksValues && (_TickMarksValues || (_TickMarksValues = /*#__PURE__*/_jsx__default[
|
|
53
|
+
children: [children, withTickMarks && !disabled && (_TickMarks || (_TickMarks = /*#__PURE__*/_jsx__default["default"](TickMarks, {})))]
|
|
54
|
+
})), withTickMarksValues && (_TickMarksValues || (_TickMarksValues = /*#__PURE__*/_jsx__default["default"](TickMarksValues, {})))]
|
|
49
55
|
});
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
const TrackStyled = /*#__PURE__*/styled__default[
|
|
58
|
+
const TrackStyled = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
53
59
|
componentId: "sc-13fbuj5-0"
|
|
54
60
|
})(["position:relative;height:", ";width:100%;min-width:", ";border-radius:", ";background:", ";"], props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxl), props => dsSystem.__UNSAFE_SPACE_TO_DIMSUM(props.theme.space.xxs), props => props.disabled ? props.theme.colors.neutral[100] : reactRange.getTrackBackground({
|
|
55
61
|
values: props.rangeValues,
|
|
@@ -8,6 +8,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
const SliderContext = /*#__PURE__*/React__default[
|
|
11
|
+
const SliderContext = /*#__PURE__*/React__default["default"].createContext();
|
|
12
12
|
|
|
13
13
|
exports.SliderContext = SliderContext;
|
package/cjs/components/styled.js
CHANGED
|
@@ -11,35 +11,44 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
12
|
|
|
13
13
|
/* eslint-disable indent */
|
|
14
|
-
const ThumbStyled = /*#__PURE__*/styled__default[
|
|
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
|
-
|
|
20
|
-
|
|
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
|
+
});
|
|
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
|
-
const TooltipArrow = /*#__PURE__*/styled__default[
|
|
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
|
-
const LabelWrapper = /*#__PURE__*/styled__default[
|
|
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 =>
|
|
33
|
-
const LabelText = /*#__PURE__*/styled__default[
|
|
38
|
+
})(["margin-bottom:", ";max-width:100%;width:", ";"], props => props.theme.space.xxs, props => "".concat(props.width || 0, "px"));
|
|
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
|
-
const ValueText = /*#__PURE__*/styled__default[
|
|
42
|
+
const ValueText = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
37
43
|
componentId: "sc-24in0j-5"
|
|
38
|
-
})(["color:", ";"],
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
})(["color:", ";"], _ref3 => {
|
|
45
|
+
let {
|
|
46
|
+
disabled,
|
|
47
|
+
theme
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return theme.colors.neutral[disabled ? 500 : 800];
|
|
50
|
+
});
|
|
51
|
+
const StyledRangeWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
43
52
|
componentId: "sc-24in0j-6"
|
|
44
53
|
})(["min-height:28px;margin:0 10px;"]);
|
|
45
54
|
|
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/cjs/index.js
CHANGED
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-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
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-alpha.
|
|
76
|
-
"@elliemae/ds-system": "2.0.0-alpha.
|
|
77
|
-
"@elliemae/ds-tooltip": "2.0.0-alpha.
|
|
78
|
-
"@elliemae/ds-truncated-tooltip-text": "2.0.0-alpha.
|
|
79
|
-
"@elliemae/ds-utilities": "2.0.0-alpha.
|
|
75
|
+
"@elliemae/ds-grid": "2.0.0-alpha.13",
|
|
76
|
+
"@elliemae/ds-system": "2.0.0-alpha.13",
|
|
77
|
+
"@elliemae/ds-tooltip": "2.0.0-alpha.13",
|
|
78
|
+
"@elliemae/ds-truncated-tooltip-text": "2.0.0-alpha.13",
|
|
79
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.13",
|
|
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/types/DSSlider.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare const DSSlider: {
|
|
3
4
|
(props: any): JSX.Element;
|
|
@@ -17,21 +18,90 @@ declare const DSSlider: {
|
|
|
17
18
|
zIndex: number;
|
|
18
19
|
};
|
|
19
20
|
propTypes: {
|
|
20
|
-
containerProps:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
containerProps: {
|
|
22
|
+
defaultValue<T = unknown>(arg: T): {
|
|
23
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
defaultValue<T = unknown>(arg: T): {
|
|
29
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
label: {
|
|
34
|
+
defaultValue<T = unknown>(arg: T): {
|
|
35
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
39
|
+
labelWithValue: {
|
|
40
|
+
defaultValue<T = unknown>(arg: T): {
|
|
41
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
minValue: {
|
|
46
|
+
defaultValue<T = unknown>(arg: T): {
|
|
47
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
51
|
+
maxValue: {
|
|
52
|
+
defaultValue<T = unknown>(arg: T): {
|
|
53
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
56
|
+
};
|
|
57
|
+
step: {
|
|
58
|
+
defaultValue<T = unknown>(arg: T): {
|
|
59
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
60
|
+
};
|
|
61
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
62
|
+
};
|
|
63
|
+
onChange: {
|
|
64
|
+
defaultValue<T = unknown>(arg: T): {
|
|
65
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
66
|
+
};
|
|
67
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
68
|
+
};
|
|
69
|
+
withTickMarks: {
|
|
70
|
+
defaultValue<T = unknown>(arg: T): {
|
|
71
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
72
|
+
};
|
|
73
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
74
|
+
};
|
|
75
|
+
withTickMarksValues: {
|
|
76
|
+
defaultValue<T = unknown>(arg: T): {
|
|
77
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
78
|
+
};
|
|
79
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
80
|
+
};
|
|
81
|
+
withTwoHandles: {
|
|
82
|
+
defaultValue<T = unknown>(arg: T): {
|
|
83
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
84
|
+
};
|
|
85
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
86
|
+
};
|
|
87
|
+
customTickMarksValues: {
|
|
88
|
+
defaultValue<T = unknown>(arg: T): {
|
|
89
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
90
|
+
};
|
|
91
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
92
|
+
};
|
|
93
|
+
zIndex: {
|
|
94
|
+
defaultValue<T = unknown>(arg: T): {
|
|
95
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
96
|
+
};
|
|
97
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
98
|
+
};
|
|
33
99
|
};
|
|
34
100
|
};
|
|
35
|
-
declare const DSSliderWithSchema:
|
|
101
|
+
declare const DSSliderWithSchema: {
|
|
102
|
+
(props?: any): JSX.Element;
|
|
103
|
+
propTypes: unknown;
|
|
104
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
105
|
+
};
|
|
36
106
|
export { DSSlider, DSSliderWithSchema };
|
|
37
107
|
export default DSSlider;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ThumbStyled: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const TooltipContainerStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>, import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const TooltipArrow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
+
export declare const LabelWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const LabelText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const ValueText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledRangeWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
package/types/prop-types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
export declare const defaultProps: {
|
|
2
3
|
containerProps: {};
|
|
3
4
|
disabled: boolean;
|
|
@@ -15,29 +16,107 @@ export declare const defaultProps: {
|
|
|
15
16
|
};
|
|
16
17
|
export declare const sliderPropTypes: {
|
|
17
18
|
/** props to inject to slider wrapper */
|
|
18
|
-
containerProps:
|
|
19
|
+
containerProps: {
|
|
20
|
+
defaultValue<T = unknown>(arg: T): {
|
|
21
|
+
/** disable slider */
|
|
22
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
+
};
|
|
24
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
25
|
+
};
|
|
19
26
|
/** disable slider */
|
|
20
|
-
disabled:
|
|
27
|
+
disabled: {
|
|
28
|
+
defaultValue<T = unknown>(arg: T): {
|
|
29
|
+
/** disable slider */
|
|
30
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
31
|
+
};
|
|
32
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
33
|
+
};
|
|
21
34
|
/** label for slider */
|
|
22
|
-
label:
|
|
35
|
+
label: {
|
|
36
|
+
defaultValue<T = unknown>(arg: T): {
|
|
37
|
+
/** disable slider */
|
|
38
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
39
|
+
};
|
|
40
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
41
|
+
};
|
|
23
42
|
/** if the label comes with value attached for slider or not */
|
|
24
|
-
labelWithValue:
|
|
43
|
+
labelWithValue: {
|
|
44
|
+
defaultValue<T = unknown>(arg: T): {
|
|
45
|
+
/** disable slider */
|
|
46
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
+
};
|
|
48
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
49
|
+
};
|
|
25
50
|
/** min value for slider */
|
|
26
|
-
minValue:
|
|
51
|
+
minValue: {
|
|
52
|
+
defaultValue<T = unknown>(arg: T): {
|
|
53
|
+
/** disable slider */
|
|
54
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
55
|
+
};
|
|
56
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
57
|
+
};
|
|
27
58
|
/** max value for slider */
|
|
28
|
-
maxValue:
|
|
59
|
+
maxValue: {
|
|
60
|
+
defaultValue<T = unknown>(arg: T): {
|
|
61
|
+
/** disable slider */
|
|
62
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
63
|
+
};
|
|
64
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
65
|
+
};
|
|
29
66
|
/** steps of values from min to max */
|
|
30
|
-
step:
|
|
67
|
+
step: {
|
|
68
|
+
defaultValue<T = unknown>(arg: T): {
|
|
69
|
+
/** disable slider */
|
|
70
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
71
|
+
};
|
|
72
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
73
|
+
};
|
|
31
74
|
/** change handler */
|
|
32
|
-
onChange:
|
|
75
|
+
onChange: {
|
|
76
|
+
defaultValue<T = unknown>(arg: T): {
|
|
77
|
+
/** disable slider */
|
|
78
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
79
|
+
};
|
|
80
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
81
|
+
};
|
|
33
82
|
/** add tick marks between steps */
|
|
34
|
-
withTickMarks:
|
|
83
|
+
withTickMarks: {
|
|
84
|
+
defaultValue<T = unknown>(arg: T): {
|
|
85
|
+
/** disable slider */
|
|
86
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
87
|
+
};
|
|
88
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
89
|
+
};
|
|
35
90
|
/** add step value to tickmark */
|
|
36
|
-
withTickMarksValues:
|
|
91
|
+
withTickMarksValues: {
|
|
92
|
+
defaultValue<T = unknown>(arg: T): {
|
|
93
|
+
/** disable slider */
|
|
94
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
95
|
+
};
|
|
96
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
97
|
+
};
|
|
37
98
|
/** add two handles */
|
|
38
|
-
withTwoHandles:
|
|
99
|
+
withTwoHandles: {
|
|
100
|
+
defaultValue<T = unknown>(arg: T): {
|
|
101
|
+
/** disable slider */
|
|
102
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
103
|
+
};
|
|
104
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
105
|
+
};
|
|
39
106
|
/** change manually tickmark values */
|
|
40
|
-
customTickMarksValues:
|
|
107
|
+
customTickMarksValues: {
|
|
108
|
+
defaultValue<T = unknown>(arg: T): {
|
|
109
|
+
/** disable slider */
|
|
110
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
111
|
+
};
|
|
112
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
113
|
+
};
|
|
41
114
|
/** z index for thumb */
|
|
42
|
-
zIndex:
|
|
115
|
+
zIndex: {
|
|
116
|
+
defaultValue<T = unknown>(arg: T): {
|
|
117
|
+
/** disable slider */
|
|
118
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
119
|
+
};
|
|
120
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
121
|
+
};
|
|
43
122
|
};
|
package/cjs/package.json
DELETED