@synerise/ds-slider 0.10.41 → 0.11.0

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 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.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.44...@synerise/ds-slider@0.11.0) (2021-11-09)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-slider
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-slider
17
+
18
+
19
+
20
+
21
+
22
+ ## [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)
23
+
24
+ **Note:** Version bump only for package @synerise/ds-slider
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.10.42](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.41...@synerise/ds-slider@0.10.42) (2021-10-19)
31
+
32
+ **Note:** Version bump only for package @synerise/ds-slider
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.10.41](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@0.10.40...@synerise/ds-slider@0.10.41) (2021-10-19)
7
39
 
8
40
  **Note:** Version bump only for package @synerise/ds-slider
@@ -1,14 +1,16 @@
1
+ var _excluded = ["allocationConfig", "tracksColorMap", "description", "tipFormatter"];
2
+
1
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); }
2
4
 
3
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
6
 
5
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."); }
6
8
 
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); }
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); }
8
10
 
9
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; }
10
12
 
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; }
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; }
12
14
 
13
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
16
 
@@ -28,7 +30,7 @@ var Allocation = function Allocation(_ref) {
28
30
  tracksColorMap = _ref.tracksColorMap,
29
31
  description = _ref.description,
30
32
  _tipFormatter = _ref.tipFormatter,
31
- rest = _objectWithoutProperties(_ref, ["allocationConfig", "tracksColorMap", "description", "tipFormatter"]);
33
+ rest = _objectWithoutProperties(_ref, _excluded);
32
34
 
33
35
  var _ref2 = allocationConfig,
34
36
  variants = _ref2.variants,
@@ -47,18 +49,18 @@ var Allocation = function Allocation(_ref) {
47
49
  setAllocations(countAllocation(variants, controlGroupEnabled));
48
50
  }, [variants, controlGroupEnabled]);
49
51
  var markRenderer = React.useCallback(function (value, index, allocationVariants) {
50
- return React.createElement(S.Mark, {
52
+ return /*#__PURE__*/React.createElement(S.Mark, {
51
53
  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, {
54
+ }, /*#__PURE__*/React.createElement(S.MarkValue, null, value), allocationVariants[index] && /*#__PURE__*/React.createElement(Tooltip, {
55
+ title: /*#__PURE__*/React.createElement(S.MarkTooltipWrapper, null, allocationVariants[index].tabLetter)
56
+ }, /*#__PURE__*/React.createElement(S.MarkLetter, {
55
57
  index: index
56
- }, allocationVariants[index].tabLetter)), !allocationVariants[index] && React.createElement(Tooltip, {
58
+ }, allocationVariants[index].tabLetter)), !allocationVariants[index] && /*#__PURE__*/React.createElement(Tooltip, {
57
59
  title: controlGroupTooltip || intl.formatMessage({
58
60
  id: 'DS.SLIDER.CONTROL-GROUP',
59
61
  defaultMessage: 'Control group'
60
62
  })
61
- }, React.createElement(S.MarkLetter, {
63
+ }, /*#__PURE__*/React.createElement(S.MarkLetter, {
62
64
  index: "cg"
63
65
  }, controlGroupLabel || intl.formatMessage({
64
66
  id: 'DS.SLIDER.CONTROL-GROUP-TOOLTIP',
@@ -73,7 +75,7 @@ var Allocation = function Allocation(_ref) {
73
75
  var calculatedVariants = mapSliderValueToVariants(value, variants);
74
76
  !isLowerOrUpperBound(value, calculatedVariants) && onAllocationChange && onAllocationChange(calculatedVariants);
75
77
  }, [onAllocationChange, variants]);
76
- return React.createElement(S.AllocationSlider, _extends({}, rest, {
78
+ return /*#__PURE__*/React.createElement(S.AllocationSlider, _extends({}, rest, {
77
79
  useColorPalette: true,
78
80
  tracksColorMap: tracksColorMap,
79
81
  dots: false,
@@ -85,12 +87,14 @@ var Allocation = function Allocation(_ref) {
85
87
  onChange: handleChange,
86
88
  step: 1,
87
89
  tipFormatter: function tipFormatter(value) {
88
- return React.createElement(DescriptionWrapper, null, description && React.createElement(Description, null, description), _tipFormatter && _tipFormatter(value));
90
+ return /*#__PURE__*/React.createElement(DescriptionWrapper, null, description && /*#__PURE__*/React.createElement(Description, null, description), _tipFormatter && _tipFormatter(value));
89
91
  }
90
- }), React.createElement(S.TrackContainer, {
92
+ }), /*#__PURE__*/React.createElement(S.TrackContainer, {
91
93
  controlGroup: controlGroupEnabled
92
94
  }, allocations.map(function (u, index) {
93
- return (// eslint-disable-next-line react/no-array-index-key
95
+ return (
96
+ /*#__PURE__*/
97
+ // eslint-disable-next-line react/no-array-index-key
94
98
  React.createElement(S.Track, {
95
99
  key: "".concat(u, "-").concat(index),
96
100
  index: index,
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
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; }
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
 
@@ -8,9 +8,9 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
8
8
 
9
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
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); }
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
12
 
13
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
14
 
15
15
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
16
 
@@ -52,7 +52,7 @@ export var mergeAllocationWithVariants = function mergeAllocationWithVariants()
52
52
  var variants = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
53
53
  var allocation = arguments.length > 1 ? arguments[1] : undefined;
54
54
  return variants.map(function (v, index) {
55
- return _objectSpread({}, v, {
55
+ return _objectSpread(_objectSpread({}, v), {}, {
56
56
  percentage: allocation[index]
57
57
  });
58
58
  });
@@ -77,7 +77,7 @@ export var mapUserAllocationToMarks = function mapUserAllocationToMarks(userAllo
77
77
  }, 0) : 0)
78
78
  };
79
79
  }).reduce(function (result, item, index) {
80
- return _objectSpread({}, result, _defineProperty({}, item.view, markRenderer(item.value, index, variants)));
80
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, item.view, markRenderer(item.value, index, variants)));
81
81
  }, {});
82
82
  };
83
83
  export var mapSliderValueToVariants = function mapSliderValueToVariants(value) {
package/dist/Slider.js CHANGED
@@ -1,14 +1,16 @@
1
+ var _excluded = ["useColorPalette", "label", "inverted", "getTooltipPopupContainer", "tracksColorMap", "type", "thickness", "description", "tipFormatter", "allocationConfig", "hideMinAndMaxMarks", "disabled", "max", "min", "value", "range"];
2
+
1
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); }
2
4
 
3
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
6
 
5
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."); }
6
8
 
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); }
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); }
8
10
 
9
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; }
10
12
 
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; }
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; }
12
14
 
13
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
16
 
@@ -49,7 +51,7 @@ var Slider = function Slider(props) {
49
51
  min = props.min,
50
52
  value = props.value,
51
53
  range = props.range,
52
- antdProps = _objectWithoutProperties(props, ["useColorPalette", "label", "inverted", "getTooltipPopupContainer", "tracksColorMap", "type", "thickness", "description", "tipFormatter", "allocationConfig", "hideMinAndMaxMarks", "disabled", "max", "min", "value", "range"]);
54
+ antdProps = _objectWithoutProperties(props, _excluded);
53
55
 
54
56
  var _React$useState = React.useState(false),
55
57
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -65,7 +67,7 @@ var Slider = function Slider(props) {
65
67
  var handler = document.querySelectorAll('.ant-slider-handle');
66
68
  var markTexts = document.querySelectorAll('.ant-slider-mark-text');
67
69
 
68
- if (handler && (markTexts === null || markTexts === void 0 ? void 0 : markTexts.length)) {
70
+ if (handler && markTexts !== null && markTexts !== void 0 && markTexts.length) {
69
71
  var firstMark = markTexts[0].getBoundingClientRect();
70
72
  var lastMark = markTexts[markTexts.length - 1].getBoundingClientRect();
71
73
  var firstHandler = handler[0].getBoundingClientRect();
@@ -95,14 +97,14 @@ var Slider = function Slider(props) {
95
97
  }, 0);
96
98
  }, [calcHandlePosition, value]);
97
99
  var labelElement = React.useMemo(function () {
98
- return label ? React.createElement(S.LabelWrapper, null, React.createElement(Label, null, label)) : null;
100
+ return label ? /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(Label, null, label)) : null;
99
101
  }, [label]);
100
102
 
101
103
  if (type === SliderTypes.ALLOCATION && !!allocationConfig) {
102
- return React.createElement(React.Fragment, null, labelElement, React.createElement(Allocation, props));
104
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labelElement, /*#__PURE__*/React.createElement(Allocation, props));
103
105
  }
104
106
 
105
- return React.createElement(React.Fragment, null, labelElement, React.createElement(S.AntdSlider, _extends({}, antdProps, {
107
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labelElement, /*#__PURE__*/React.createElement(S.AntdSlider, _extends({}, antdProps, {
106
108
  max: max,
107
109
  value: value,
108
110
  reachedEnd: reachedEnd,
@@ -115,7 +117,7 @@ var Slider = function Slider(props) {
115
117
  description: description,
116
118
  hideMinAndMaxMarks: hideMinAndMaxMarks,
117
119
  tipFormatter: function tipFormatter(tipValue) {
118
- return React.createElement(S.DescriptionWrapper, null, description && React.createElement(S.Description, {
120
+ return /*#__PURE__*/React.createElement(S.DescriptionWrapper, null, description && /*#__PURE__*/React.createElement(S.Description, {
119
121
  range: range
120
122
  }, description), _tipFormatter && _tipFormatter(tipValue));
121
123
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-slider",
3
- "version": "0.10.41",
3
+ "version": "0.11.0",
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.10.53",
36
- "@synerise/ds-typography": "^0.11.9"
35
+ "@synerise/ds-tooltip": "^0.11.0",
36
+ "@synerise/ds-typography": "^0.12.0"
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": "1fdb5eb22cd9c4d5f786d33d75531c31eba7ece3"
46
+ "gitHead": "a797e1d5e1233f121f8f7dfbeaf97b48a8195d25"
47
47
  }