@synerise/ds-slider 0.11.1 → 0.11.5
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 +4 -19
- package/dist/Allocation/utils.js +42 -33
- package/dist/Slider.js +7 -23
- 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.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.11.4...@synerise/ds-slider@0.11.5) (2022-02-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.11.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.11.3...@synerise/ds-slider@0.11.4) (2022-01-17)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.11.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.11.2...@synerise/ds-slider@0.11.3) (2021-12-22)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [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)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [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)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @synerise/ds-slider
|
|
@@ -2,20 +2,6 @@ var _excluded = ["allocationConfig", "tracksColorMap", "description", "tipFormat
|
|
|
2
2
|
|
|
3
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); }
|
|
4
4
|
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
|
|
7
|
-
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."); }
|
|
8
|
-
|
|
9
|
-
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(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
14
|
-
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
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; }
|
|
20
6
|
|
|
21
7
|
import * as React from 'react';
|
|
@@ -30,7 +16,7 @@ var Allocation = function Allocation(_ref) {
|
|
|
30
16
|
tracksColorMap = _ref.tracksColorMap,
|
|
31
17
|
description = _ref.description,
|
|
32
18
|
_tipFormatter = _ref.tipFormatter,
|
|
33
|
-
rest =
|
|
19
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
20
|
|
|
35
21
|
var _ref2 = allocationConfig,
|
|
36
22
|
variants = _ref2.variants,
|
|
@@ -40,9 +26,8 @@ var Allocation = function Allocation(_ref) {
|
|
|
40
26
|
controlGroupTooltip = _ref2.controlGroupTooltip;
|
|
41
27
|
|
|
42
28
|
var _React$useState = React.useState(countAllocation(variants, controlGroupEnabled)),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setAllocations = _React$useState2[1];
|
|
29
|
+
allocations = _React$useState[0],
|
|
30
|
+
setAllocations = _React$useState[1];
|
|
46
31
|
|
|
47
32
|
var intl = useIntl();
|
|
48
33
|
React.useEffect(function () {
|
|
@@ -96,7 +81,7 @@ var Allocation = function Allocation(_ref) {
|
|
|
96
81
|
/*#__PURE__*/
|
|
97
82
|
// eslint-disable-next-line react/no-array-index-key
|
|
98
83
|
React.createElement(S.Track, {
|
|
99
|
-
key:
|
|
84
|
+
key: u + "-" + index,
|
|
100
85
|
index: index,
|
|
101
86
|
width: u
|
|
102
87
|
})
|
package/dist/Allocation/utils.js
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly)
|
|
1
|
+
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; }
|
|
2
2
|
|
|
3
3
|
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; }
|
|
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(o); 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" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) 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
|
-
return _objectSpread(
|
|
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
|
@@ -2,20 +2,6 @@ var _excluded = ["useColorPalette", "label", "inverted", "getTooltipPopupContain
|
|
|
2
2
|
|
|
3
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); }
|
|
4
4
|
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
|
|
7
|
-
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."); }
|
|
8
|
-
|
|
9
|
-
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(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
14
|
-
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
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; }
|
|
20
6
|
|
|
21
7
|
import * as React from 'react';
|
|
@@ -51,23 +37,21 @@ var Slider = function Slider(props) {
|
|
|
51
37
|
min = props.min,
|
|
52
38
|
value = props.value,
|
|
53
39
|
range = props.range,
|
|
54
|
-
antdProps =
|
|
40
|
+
antdProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
41
|
|
|
56
42
|
var _React$useState = React.useState(false),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setReachedEnd = _React$useState2[1];
|
|
43
|
+
reachedEnd = _React$useState[0],
|
|
44
|
+
setReachedEnd = _React$useState[1];
|
|
60
45
|
|
|
61
|
-
var _React$
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setReachedStart = _React$useState4[1];
|
|
46
|
+
var _React$useState2 = React.useState(false),
|
|
47
|
+
reachedStart = _React$useState2[0],
|
|
48
|
+
setReachedStart = _React$useState2[1];
|
|
65
49
|
|
|
66
50
|
var calcHandlePosition = React.useCallback(function () {
|
|
67
51
|
var handler = document.querySelectorAll('.ant-slider-handle');
|
|
68
52
|
var markTexts = document.querySelectorAll('.ant-slider-mark-text');
|
|
69
53
|
|
|
70
|
-
if (handler && markTexts
|
|
54
|
+
if (handler && markTexts != null && markTexts.length) {
|
|
71
55
|
var firstMark = markTexts[0].getBoundingClientRect();
|
|
72
56
|
var lastMark = markTexts[markTexts.length - 1].getBoundingClientRect();
|
|
73
57
|
var firstHandler = handler[0].getBoundingClientRect();
|
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.11.
|
|
3
|
+
"version": "0.11.5",
|
|
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.11.
|
|
36
|
-
"@synerise/ds-typography": "^0.12.
|
|
35
|
+
"@synerise/ds-tooltip": "^0.11.5",
|
|
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": "27ef26e44f1814e7fc97b46668078e9a78e8f217"
|
|
47
47
|
}
|