@synerise/ds-slider 0.10.43 → 0.11.2
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/CHANGELOG.md +32 -0
- package/dist/Allocation/Allocation.js +18 -29
- package/dist/Allocation/Allocation.types.js +1 -0
- package/dist/Allocation/utils.js +40 -31
- package/dist/Slider.js +13 -27
- package/dist/Slider.styles.js +4 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.11.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.11.1...@synerise/ds-slider@0.11.2) (2021-11-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.11.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.44...@synerise/ds-slider@0.11.1) (2021-11-09)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [0.11.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.44...@synerise/ds-slider@0.11.0) (2021-11-09)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.10.44](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.43...@synerise/ds-slider@0.10.44) (2021-11-05)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [0.10.43](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.41...@synerise/ds-slider@0.10.43) (2021-10-26)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @synerise/ds-slider
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1
|
+
var _excluded = ["allocationConfig", "tracksColorMap", "description", "tipFormatter"];
|
|
8
2
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
-
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
4
|
|
|
17
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
6
|
|
|
@@ -28,7 +16,7 @@ var Allocation = function Allocation(_ref) {
|
|
|
28
16
|
tracksColorMap = _ref.tracksColorMap,
|
|
29
17
|
description = _ref.description,
|
|
30
18
|
_tipFormatter = _ref.tipFormatter,
|
|
31
|
-
rest =
|
|
19
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
20
|
|
|
33
21
|
var _ref2 = allocationConfig,
|
|
34
22
|
variants = _ref2.variants,
|
|
@@ -38,27 +26,26 @@ var Allocation = function Allocation(_ref) {
|
|
|
38
26
|
controlGroupTooltip = _ref2.controlGroupTooltip;
|
|
39
27
|
|
|
40
28
|
var _React$useState = React.useState(countAllocation(variants, controlGroupEnabled)),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setAllocations = _React$useState2[1];
|
|
29
|
+
allocations = _React$useState[0],
|
|
30
|
+
setAllocations = _React$useState[1];
|
|
44
31
|
|
|
45
32
|
var intl = useIntl();
|
|
46
33
|
React.useEffect(function () {
|
|
47
34
|
setAllocations(countAllocation(variants, controlGroupEnabled));
|
|
48
35
|
}, [variants, controlGroupEnabled]);
|
|
49
36
|
var markRenderer = React.useCallback(function (value, index, allocationVariants) {
|
|
50
|
-
return React.createElement(S.Mark, {
|
|
37
|
+
return /*#__PURE__*/React.createElement(S.Mark, {
|
|
51
38
|
className: "slider-mark"
|
|
52
|
-
}, React.createElement(S.MarkValue, null, value), allocationVariants[index] && React.createElement(Tooltip, {
|
|
53
|
-
title: React.createElement(S.MarkTooltipWrapper, null, allocationVariants[index].tabLetter)
|
|
54
|
-
}, React.createElement(S.MarkLetter, {
|
|
39
|
+
}, /*#__PURE__*/React.createElement(S.MarkValue, null, value), allocationVariants[index] && /*#__PURE__*/React.createElement(Tooltip, {
|
|
40
|
+
title: /*#__PURE__*/React.createElement(S.MarkTooltipWrapper, null, allocationVariants[index].tabLetter)
|
|
41
|
+
}, /*#__PURE__*/React.createElement(S.MarkLetter, {
|
|
55
42
|
index: index
|
|
56
|
-
}, allocationVariants[index].tabLetter)), !allocationVariants[index] && React.createElement(Tooltip, {
|
|
43
|
+
}, allocationVariants[index].tabLetter)), !allocationVariants[index] && /*#__PURE__*/React.createElement(Tooltip, {
|
|
57
44
|
title: controlGroupTooltip || intl.formatMessage({
|
|
58
45
|
id: 'DS.SLIDER.CONTROL-GROUP',
|
|
59
46
|
defaultMessage: 'Control group'
|
|
60
47
|
})
|
|
61
|
-
}, React.createElement(S.MarkLetter, {
|
|
48
|
+
}, /*#__PURE__*/React.createElement(S.MarkLetter, {
|
|
62
49
|
index: "cg"
|
|
63
50
|
}, controlGroupLabel || intl.formatMessage({
|
|
64
51
|
id: 'DS.SLIDER.CONTROL-GROUP-TOOLTIP',
|
|
@@ -73,7 +60,7 @@ var Allocation = function Allocation(_ref) {
|
|
|
73
60
|
var calculatedVariants = mapSliderValueToVariants(value, variants);
|
|
74
61
|
!isLowerOrUpperBound(value, calculatedVariants) && onAllocationChange && onAllocationChange(calculatedVariants);
|
|
75
62
|
}, [onAllocationChange, variants]);
|
|
76
|
-
return React.createElement(S.AllocationSlider, _extends({}, rest, {
|
|
63
|
+
return /*#__PURE__*/React.createElement(S.AllocationSlider, _extends({}, rest, {
|
|
77
64
|
useColorPalette: true,
|
|
78
65
|
tracksColorMap: tracksColorMap,
|
|
79
66
|
dots: false,
|
|
@@ -85,14 +72,16 @@ var Allocation = function Allocation(_ref) {
|
|
|
85
72
|
onChange: handleChange,
|
|
86
73
|
step: 1,
|
|
87
74
|
tipFormatter: function tipFormatter(value) {
|
|
88
|
-
return React.createElement(DescriptionWrapper, null, description && React.createElement(Description, null, description), _tipFormatter && _tipFormatter(value));
|
|
75
|
+
return /*#__PURE__*/React.createElement(DescriptionWrapper, null, description && /*#__PURE__*/React.createElement(Description, null, description), _tipFormatter && _tipFormatter(value));
|
|
89
76
|
}
|
|
90
|
-
}), React.createElement(S.TrackContainer, {
|
|
77
|
+
}), /*#__PURE__*/React.createElement(S.TrackContainer, {
|
|
91
78
|
controlGroup: controlGroupEnabled
|
|
92
79
|
}, allocations.map(function (u, index) {
|
|
93
|
-
return (
|
|
80
|
+
return (
|
|
81
|
+
/*#__PURE__*/
|
|
82
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
94
83
|
React.createElement(S.Track, {
|
|
95
|
-
key:
|
|
84
|
+
key: u + "-" + index,
|
|
96
85
|
index: index,
|
|
97
86
|
width: u
|
|
98
87
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Allocation/utils.js
CHANGED
|
@@ -4,27 +4,23 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
|
|
13
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
14
|
-
|
|
15
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
18
|
-
|
|
19
7
|
export var countControlGroupAllocation = function countControlGroupAllocation(userAllocation) {
|
|
20
8
|
return 100 - userAllocation.reduce(function (prev, curr) {
|
|
21
9
|
return prev + curr;
|
|
22
10
|
}, 0);
|
|
23
11
|
};
|
|
24
|
-
export var countAllocation = function countAllocation() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
export var countAllocation = function countAllocation(variants, controlGroup, recalculate) {
|
|
13
|
+
if (variants === void 0) {
|
|
14
|
+
variants = [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (controlGroup === void 0) {
|
|
18
|
+
controlGroup = false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (recalculate === void 0) {
|
|
22
|
+
recalculate = false;
|
|
23
|
+
}
|
|
28
24
|
|
|
29
25
|
if (variants.length === 0) {
|
|
30
26
|
return [];
|
|
@@ -35,10 +31,10 @@ export var countAllocation = function countAllocation() {
|
|
|
35
31
|
var percentPerVariant = Math.floor(100 / numberOfVariants);
|
|
36
32
|
var percentLeft = 100 - numberOfVariants * percentPerVariant;
|
|
37
33
|
var recalculatedArr = new Array(numberOfVariants - 1).fill(percentPerVariant);
|
|
38
|
-
return [].concat(
|
|
34
|
+
return [].concat(recalculatedArr, [percentPerVariant + percentLeft]);
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
var allocation =
|
|
37
|
+
var allocation = [].concat(variants.map(function (v) {
|
|
42
38
|
return v.percentage;
|
|
43
39
|
}));
|
|
44
40
|
|
|
@@ -48,42 +44,55 @@ export var countAllocation = function countAllocation() {
|
|
|
48
44
|
|
|
49
45
|
return allocation;
|
|
50
46
|
};
|
|
51
|
-
export var mergeAllocationWithVariants = function mergeAllocationWithVariants() {
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
export var mergeAllocationWithVariants = function mergeAllocationWithVariants(variants, allocation) {
|
|
48
|
+
if (variants === void 0) {
|
|
49
|
+
variants = [];
|
|
50
|
+
}
|
|
51
|
+
|
|
54
52
|
return variants.map(function (v, index) {
|
|
55
53
|
return _objectSpread({}, v, {
|
|
56
54
|
percentage: allocation[index]
|
|
57
55
|
});
|
|
58
56
|
});
|
|
59
57
|
};
|
|
60
|
-
export var recalculateVariantsAllocation = function recalculateVariantsAllocation(variants) {
|
|
61
|
-
|
|
58
|
+
export var recalculateVariantsAllocation = function recalculateVariantsAllocation(variants, controlGroup) {
|
|
59
|
+
if (controlGroup === void 0) {
|
|
60
|
+
controlGroup = false;
|
|
61
|
+
}
|
|
62
|
+
|
|
62
63
|
var allocation = countAllocation(variants, controlGroup, true);
|
|
63
64
|
return mergeAllocationWithVariants(variants, allocation);
|
|
64
65
|
};
|
|
65
66
|
export var mapUserAllocationToHandles = function mapUserAllocationToHandles(userAllocation) {
|
|
66
67
|
return userAllocation.reduce(function (result, item, index) {
|
|
67
|
-
return [].concat(
|
|
68
|
+
return [].concat(result, [parseInt(item, 10) + parseInt(result[index - 1] || 0, 10)]);
|
|
68
69
|
}, []).slice(0, userAllocation.length - 1);
|
|
69
70
|
};
|
|
70
|
-
export var mapUserAllocationToMarks = function mapUserAllocationToMarks(userAllocation, markRenderer) {
|
|
71
|
-
|
|
71
|
+
export var mapUserAllocationToMarks = function mapUserAllocationToMarks(userAllocation, markRenderer, variants) {
|
|
72
|
+
if (variants === void 0) {
|
|
73
|
+
variants = [];
|
|
74
|
+
}
|
|
75
|
+
|
|
72
76
|
return userAllocation.map(function (a, i) {
|
|
73
77
|
return {
|
|
74
|
-
value:
|
|
78
|
+
value: a + "%",
|
|
75
79
|
view: a / 2 + (i ? userAllocation.slice(0, i).reduce(function (result, item) {
|
|
76
80
|
return result + item;
|
|
77
81
|
}, 0) : 0)
|
|
78
82
|
};
|
|
79
83
|
}).reduce(function (result, item, index) {
|
|
80
|
-
|
|
84
|
+
var _objectSpread2;
|
|
85
|
+
|
|
86
|
+
return _objectSpread({}, result, (_objectSpread2 = {}, _objectSpread2[item.view] = markRenderer(item.value, index, variants), _objectSpread2));
|
|
81
87
|
}, {});
|
|
82
88
|
};
|
|
83
|
-
export var mapSliderValueToVariants = function mapSliderValueToVariants(value) {
|
|
84
|
-
|
|
89
|
+
export var mapSliderValueToVariants = function mapSliderValueToVariants(value, variants) {
|
|
90
|
+
if (variants === void 0) {
|
|
91
|
+
variants = [];
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
var allocation = value.reduce(function (prev, curr) {
|
|
86
|
-
return [].concat(
|
|
95
|
+
return [].concat(prev, [curr - prev.reduce(function (previous, current) {
|
|
87
96
|
return previous + current;
|
|
88
97
|
}, 0)]);
|
|
89
98
|
}, []);
|
package/dist/Slider.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1
|
+
var _excluded = ["useColorPalette", "label", "inverted", "getTooltipPopupContainer", "tracksColorMap", "type", "thickness", "description", "tipFormatter", "allocationConfig", "hideMinAndMaxMarks", "disabled", "max", "min", "value", "range"];
|
|
8
2
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
-
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
4
|
|
|
17
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
6
|
|
|
@@ -49,23 +37,21 @@ var Slider = function Slider(props) {
|
|
|
49
37
|
min = props.min,
|
|
50
38
|
value = props.value,
|
|
51
39
|
range = props.range,
|
|
52
|
-
antdProps =
|
|
40
|
+
antdProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
53
41
|
|
|
54
42
|
var _React$useState = React.useState(false),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
setReachedEnd = _React$useState2[1];
|
|
43
|
+
reachedEnd = _React$useState[0],
|
|
44
|
+
setReachedEnd = _React$useState[1];
|
|
58
45
|
|
|
59
|
-
var _React$
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
setReachedStart = _React$useState4[1];
|
|
46
|
+
var _React$useState2 = React.useState(false),
|
|
47
|
+
reachedStart = _React$useState2[0],
|
|
48
|
+
setReachedStart = _React$useState2[1];
|
|
63
49
|
|
|
64
50
|
var calcHandlePosition = React.useCallback(function () {
|
|
65
51
|
var handler = document.querySelectorAll('.ant-slider-handle');
|
|
66
52
|
var markTexts = document.querySelectorAll('.ant-slider-mark-text');
|
|
67
53
|
|
|
68
|
-
if (handler &&
|
|
54
|
+
if (handler && markTexts != null && markTexts.length) {
|
|
69
55
|
var firstMark = markTexts[0].getBoundingClientRect();
|
|
70
56
|
var lastMark = markTexts[markTexts.length - 1].getBoundingClientRect();
|
|
71
57
|
var firstHandler = handler[0].getBoundingClientRect();
|
|
@@ -95,14 +81,14 @@ var Slider = function Slider(props) {
|
|
|
95
81
|
}, 0);
|
|
96
82
|
}, [calcHandlePosition, value]);
|
|
97
83
|
var labelElement = React.useMemo(function () {
|
|
98
|
-
return label ? React.createElement(S.LabelWrapper, null, React.createElement(Label, null, label)) : null;
|
|
84
|
+
return label ? /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(Label, null, label)) : null;
|
|
99
85
|
}, [label]);
|
|
100
86
|
|
|
101
87
|
if (type === SliderTypes.ALLOCATION && !!allocationConfig) {
|
|
102
|
-
return React.createElement(React.Fragment, null, labelElement, React.createElement(Allocation, props));
|
|
88
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, labelElement, /*#__PURE__*/React.createElement(Allocation, props));
|
|
103
89
|
}
|
|
104
90
|
|
|
105
|
-
return React.createElement(React.Fragment, null, labelElement, React.createElement(S.AntdSlider, _extends({}, antdProps, {
|
|
91
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, labelElement, /*#__PURE__*/React.createElement(S.AntdSlider, _extends({}, antdProps, {
|
|
106
92
|
max: max,
|
|
107
93
|
value: value,
|
|
108
94
|
reachedEnd: reachedEnd,
|
|
@@ -115,7 +101,7 @@ var Slider = function Slider(props) {
|
|
|
115
101
|
description: description,
|
|
116
102
|
hideMinAndMaxMarks: hideMinAndMaxMarks,
|
|
117
103
|
tipFormatter: function tipFormatter(tipValue) {
|
|
118
|
-
return React.createElement(S.DescriptionWrapper, null, description && React.createElement(S.Description, {
|
|
104
|
+
return /*#__PURE__*/React.createElement(S.DescriptionWrapper, null, description && /*#__PURE__*/React.createElement(S.Description, {
|
|
119
105
|
range: range
|
|
120
106
|
}, description), _tipFormatter && _tipFormatter(tipValue));
|
|
121
107
|
},
|
package/dist/Slider.styles.js
CHANGED
|
@@ -29,12 +29,12 @@ export var DescriptionWrapper = styled.div.withConfig({
|
|
|
29
29
|
componentId: "sc-1gtvqj9-2"
|
|
30
30
|
})(["display:flex;direction:column;align-items:center;justify-content:center;position:relative;user-select:none;bottom:0;right:0;"]);
|
|
31
31
|
export var applyTooltipStyles = function applyTooltipStyles(props) {
|
|
32
|
-
return css([".ant-tooltip-inner{font-size:13px;padding:3px 7px;user-select:none;}", " ", " &&&.ant-slider-disabled{.ant-slider-dot-active{background-color:", ";}.ant-slider-rail{background-color:", ";}}.ant-slider-handle:hover,.ant-slider-handle:focus{", "}.ant-slider-handle:focus{", " .ant-slider-handle:hover:not(:focus){background-color:", ";}.ant-slider-handle:not(:focus){.ant-tooltip-content:hover{background-color:transparent !important;border-radius:3px;}.ant-tooltip-inner:hover{color:", " !important;}}.ant-slider-dot[style*='left: 100%;'],.ant-slider-dot:first-of-type{visibility:", ";}.ant-slider-mark-text:last-of-type{padding-right:30px;}.ant-slider-mark-text:last-of-type{", "}.ant-slider-mark-text:first-of-type{", "}.ant-slider-handle-dragging{border-color:", " !important;box-shadow:0 0 0 3px rgba(35,138,254,0.25) !important;}"], props.disabled && ".ant-tooltip-inner {\n color: "
|
|
32
|
+
return css([".ant-tooltip-inner{font-size:13px;padding:3px 7px;user-select:none;}", " ", " &&&.ant-slider-disabled{.ant-slider-dot-active{background-color:", ";}.ant-slider-rail{background-color:", ";}}.ant-slider-handle:hover,.ant-slider-handle:focus{", "}.ant-slider-handle:focus{", " .ant-slider-handle:hover:not(:focus){background-color:", ";}.ant-slider-handle:not(:focus){.ant-tooltip-content:hover{background-color:transparent !important;border-radius:3px;}.ant-tooltip-inner:hover{color:", " !important;}}.ant-slider-dot[style*='left: 100%;'],.ant-slider-dot:first-of-type{visibility:", ";}.ant-slider-mark-text:last-of-type{padding-right:30px;}.ant-slider-mark-text:last-of-type{", "}.ant-slider-mark-text:first-of-type{", "}.ant-slider-handle-dragging{border-color:", " !important;box-shadow:0 0 0 3px rgba(35,138,254,0.25) !important;}"], props.disabled && ".ant-tooltip-inner {\n color: " + props.theme.palette['grey-400'] + ";\n }\n ", props.disabled && ".ant-slider-dot {\n background-color: " + props.theme.palette.white + ";\n }\n ", props.theme.palette.white, props.theme.palette['grey-200'], !props.disabled && "\n .ant-tooltip-content {\n background-color: " + props.theme.palette['grey-900'] + ";\n border-radius: 3px;\n }\n " + Description + " {\n color: " + (!props.disabled && props.theme.palette['grey-600']) + ";\n }\n .ant-tooltip-inner {\n color: " + props.theme.palette['grey-050'] + ";\n }\n ", !props.disabled && "\n " + Description + " {\n " + (props.range && "opacity: 1") + ";\n }\n }\n ", !props.disabled && props.theme.palette['grey-500'], !props.disabled && props.theme.palette['grey-600'], props.hideMinAndMaxMarks ? 'hidden' : 'visible', props.reachedEnd && "opacity: 0", props.reachedStart && "opacity: 0", props.theme.palette['grey-050']);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
var createTracksStyles = function createTracksStyles(props, colorsMap) {
|
|
36
36
|
var styles = Object.values(colorsMap).map(function (color, index) {
|
|
37
|
-
return "\n .ant-slider-track-"
|
|
37
|
+
return "\n .ant-slider-track-" + (index + 1) + ",\n .ant-slider-track-" + (index + 11) + " {\n background-color: " + props.theme.palette[color] + ";\n }\n .ant-slider-dot-active" + (index + 1) + ",\n .ant-slider-dot-active" + (index + 11) + " {\n background-color: " + props.theme.palette[color] + ";\n }\n ";
|
|
38
38
|
});
|
|
39
39
|
var style = styles.join('');
|
|
40
40
|
return css([".ant-slider-track{background-color:", ";}.ant-slider-dot-active{background-color:", ";}&.ant-slider-inverted{.ant-slider-dot{background-color:", ";&.ant-slider-dot-active{background-color:", ";}}.ant-slider-rail{background-color:", ";}.ant-slider-track{background-color:", ";}&&&.ant-slider-disabled{.ant-slider-rail{background-color:", ";}.ant-slider-dot{background-color:", " !important;border-color:", " !important;}.ant-slider-track{background-color:", " !important;}.ant-slider-dot-active{border-color:", " !important;}}}", ""], props.theme.palette[colorsMap[0]], props.theme.palette[colorsMap[0]], props.theme.palette[colorsMap[0]], props.theme.palette['grey-300'], props.theme.palette[colorsMap[0]], props.theme.palette['grey-200'], props.theme.palette['grey-400'], props.theme.palette['grey-050'], props.theme.palette['grey-400'], props.theme.palette['grey-200'], props.theme.palette['grey-200'], style);
|
|
@@ -47,11 +47,11 @@ export var AntdSlider = styled(Slider).withConfig({
|
|
|
47
47
|
})(["", " .ant-slider-track{height:", ";}&.ant-slider:hover{", ";}.ant-slider-rail{height:", ";}", " .ant-slider-handle{z-index:99;margin-top:", ";}.ant-slider-dot{margin-top:", ";}&&&.ant-slider{margin-top:", ";}"], function (props) {
|
|
48
48
|
return props.useColorPalette ? createTracksStyles(props, props.tracksColorMap ? props.tracksColorMap : INDEX_MAP) : css([""]);
|
|
49
49
|
}, function (props) {
|
|
50
|
-
return props.thickness ?
|
|
50
|
+
return props.thickness ? props.thickness + "px" : "3px";
|
|
51
51
|
}, function (props) {
|
|
52
52
|
return props.useColorPalette ? createTracksStyles(props, props.tracksColorMap ? props.tracksColorMap : INDEX_MAP) : css([""]);
|
|
53
53
|
}, function (props) {
|
|
54
|
-
return props.thickness ?
|
|
54
|
+
return props.thickness ? props.thickness + "px" : "3px";
|
|
55
55
|
}, function (props) {
|
|
56
56
|
return applyTooltipStyles(props);
|
|
57
57
|
}, function (props) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-slider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Slider UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-tooltip": "^0.
|
|
36
|
-
"@synerise/ds-typography": "^0.
|
|
35
|
+
"@synerise/ds-tooltip": "^0.11.2",
|
|
36
|
+
"@synerise/ds-typography": "^0.12.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@synerise/ds-core": "*",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@synerise/ds-utils": "^0.19.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "2468359677783819939fb9f1ef5acc36667ecd1a"
|
|
47
47
|
}
|