@desynova-digital/components 9.0.26 → 9.1.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.
Files changed (170) hide show
  1. package/_helpers/globals.js +9 -10
  2. package/_helpers/pagination.js +10 -15
  3. package/_helpers/story-example.js +16 -39
  4. package/_helpers/story-helpers.js +15 -14
  5. package/_helpers/story-stack.js +22 -43
  6. package/_helpers/uniqueId.js +2 -5
  7. package/_helpers/utils.js +28 -4
  8. package/atoms/avatar/avatar.js +19 -42
  9. package/atoms/avatar/avatar.story.js +25 -58
  10. package/atoms/avatar/index.js +13 -11
  11. package/atoms/badge/badge.js +14 -37
  12. package/atoms/badge/badge.story.js +45 -103
  13. package/atoms/badge/index.js +12 -10
  14. package/atoms/button/button.js +85 -161
  15. package/atoms/button/button.story.js +354 -508
  16. package/atoms/button/index.js +5 -9
  17. package/atoms/card/card.js +26 -55
  18. package/atoms/card/card.story.js +39 -88
  19. package/atoms/card/index.js +12 -10
  20. package/atoms/cardStack/cardStack.js +88 -147
  21. package/atoms/cardStack/cardStack.story.js +106 -210
  22. package/atoms/cardStack/index.js +12 -10
  23. package/atoms/cardV2/cardV2.js +57 -106
  24. package/atoms/cardV2/cardV2.story.js +184 -232
  25. package/atoms/cardV2/content.js +154 -256
  26. package/atoms/cardV2/index.js +4 -8
  27. package/atoms/cardV2/thumbnail.js +138 -208
  28. package/atoms/cardV2/timeline.js +167 -123
  29. package/atoms/checkbox/checkbox.js +85 -157
  30. package/atoms/checkbox/checkbox.story.js +237 -365
  31. package/atoms/checkbox/index.js +4 -9
  32. package/atoms/customSelect/customSelect.js +136 -215
  33. package/atoms/customSelect/customSelect.story.js +745 -851
  34. package/atoms/customSelect/index.js +4 -8
  35. package/atoms/datePicker/datePicker.js +299 -431
  36. package/atoms/datePicker/datePicker.story.js +453 -501
  37. package/atoms/datePicker/index.js +4 -8
  38. package/atoms/dateTime/dateTime.js +3 -6
  39. package/atoms/dateTime/dateTime.story.js +17 -63
  40. package/atoms/dateTime/index.js +5 -9
  41. package/atoms/draftInputText/draftInputText.js +121 -189
  42. package/atoms/draftInputText/draftInputText.story.js +200 -249
  43. package/atoms/draftInputText/index.js +5 -9
  44. package/atoms/dropdown/dropdown.js +38 -66
  45. package/atoms/dropdown/dropdown.story.js +102 -262
  46. package/atoms/dropdown/index.js +4 -8
  47. package/atoms/dropdownList/dropdownList.js +78 -108
  48. package/atoms/dropdownList/dropdownList.story.js +1546 -1621
  49. package/atoms/dropdownList/index.js +4 -8
  50. package/atoms/graphs/barGraph/barGraph.js +95 -146
  51. package/atoms/graphs/barGraph/barGraph.story.js +65 -87
  52. package/atoms/graphs/barGraph/index.js +4 -8
  53. package/atoms/graphs/circleDonut/circleDonut.js +177 -229
  54. package/atoms/graphs/circleDonut/circleDonut.story.js +328 -394
  55. package/atoms/graphs/circleDonut/index.js +5 -9
  56. package/atoms/graphs/circleGraph/circleGraph.js +60 -90
  57. package/atoms/graphs/circleGraph/circleGraph.story.js +36 -54
  58. package/atoms/graphs/circleGraph/index.js +4 -8
  59. package/atoms/graphs/circleNested/circleNested.js +216 -262
  60. package/atoms/graphs/circleNested/circleNested.story.js +91 -116
  61. package/atoms/graphs/circleNested/index.js +5 -9
  62. package/atoms/graphs/pieChart/index.js +4 -8
  63. package/atoms/graphs/pieChart/pieChart.js +162 -191
  64. package/atoms/graphs/pieChart/pieChart.story.js +147 -176
  65. package/atoms/graphs/verticalBarGraph/index.js +5 -9
  66. package/atoms/graphs/verticalBarGraph/verticalBarGraph.js +75 -98
  67. package/atoms/graphs/verticalBarGraph/verticalBarGraph.story.js +26 -45
  68. package/atoms/icon/icon.js +41 -72
  69. package/atoms/icon/icon.story.js +831 -260
  70. package/atoms/icon/index.js +19 -12
  71. package/atoms/image/image.js +18 -32
  72. package/atoms/image/image.story.js +10 -19
  73. package/atoms/image/index.js +4 -8
  74. package/atoms/inputText/index.js +4 -8
  75. package/atoms/inputText/inputText.js +86 -131
  76. package/atoms/inputText/inputText.story.js +191 -255
  77. package/atoms/label/index.js +4 -8
  78. package/atoms/label/label.js +25 -50
  79. package/atoms/label/label.story.js +42 -83
  80. package/atoms/loader/CircleLoader.js +29 -63
  81. package/atoms/loader/ShimmerComponent/CollabShimmerCard.js +39 -50
  82. package/atoms/loader/ShimmerComponent/CollabShimmerCardTray.js +41 -42
  83. package/atoms/loader/ShimmerComponent/FiltersShimmer.js +30 -30
  84. package/atoms/loader/ShimmerComponent/GraphDetailShimmer.js +21 -34
  85. package/atoms/loader/ShimmerComponent/GraphTitleShimmer.js +30 -34
  86. package/atoms/loader/ShimmerComponent/GraphsComponentShimmer.js +23 -32
  87. package/atoms/loader/ShimmerComponent/Shimmer.js +24 -32
  88. package/atoms/loader/ThreeDotLoader.js +14 -29
  89. package/atoms/loader/index.js +13 -11
  90. package/atoms/loader/loader.js +34 -58
  91. package/atoms/loader/loader.story.js +48 -52
  92. package/atoms/loader/spinningLoader.js +23 -34
  93. package/atoms/popup/index.js +5 -9
  94. package/atoms/popup/popup.js +123 -208
  95. package/atoms/popup/popup.story.js +97 -131
  96. package/atoms/radio/index.js +18 -11
  97. package/atoms/radio/radio.js +58 -112
  98. package/atoms/radio/radio.story.js +197 -420
  99. package/atoms/select/index.js +4 -8
  100. package/atoms/select/select.js +48 -86
  101. package/atoms/sideBar/index.js +5 -9
  102. package/atoms/sideBar/sidebar.js +89 -140
  103. package/atoms/switch/index.js +4 -8
  104. package/atoms/switch/switch.js +56 -86
  105. package/atoms/switch/switch.story.js +268 -415
  106. package/atoms/tag/index.js +12 -10
  107. package/atoms/tag/tag.js +29 -63
  108. package/atoms/tag/tag.story.js +135 -209
  109. package/atoms/textarea/index.js +5 -9
  110. package/atoms/textarea/textarea.js +55 -99
  111. package/atoms/textarea/textarea.story.js +48 -41
  112. package/atoms/thematicBreak/index.js +12 -10
  113. package/atoms/thematicBreak/thematicBreak.js +20 -38
  114. package/atoms/thematicBreak/thematicBreak.story.js +25 -37
  115. package/atoms/timeCodeInput/index.js +4 -8
  116. package/atoms/timeCodeInput/timCodeInput.story.js +21 -35
  117. package/atoms/timeCodeInput/timeCodeInput.js +33 -51
  118. package/atoms/timer/index.js +5 -9
  119. package/atoms/timer/timer.js +57 -108
  120. package/atoms/timer/timer.story.js +13 -26
  121. package/atoms/toast/index.js +5 -9
  122. package/atoms/toast/toast.js +81 -116
  123. package/atoms/toast/toast.story.js +50 -76
  124. package/atoms/videoCard/index.js +12 -10
  125. package/atoms/videoCard/videoCard.js +265 -447
  126. package/atoms/videoCard/videoCard.story.js +495 -710
  127. package/components.js +411 -294
  128. package/index.js +350 -61
  129. package/molecules/carousel/carousel.js +121 -207
  130. package/molecules/carousel/carousel.story.js +240 -223
  131. package/molecules/carousel/index.js +5 -9
  132. package/molecules/errorScreen/CollabErrorScreen.js +35 -66
  133. package/molecules/errorScreen/TableErrorScreen.js +109 -102
  134. package/molecules/errorScreen/TableErrorScreen.jsx +7 -6
  135. package/molecules/errorScreen/errorScreen.js +41 -94
  136. package/molecules/filter/constants.js +1 -0
  137. package/molecules/filter/filter.js +378 -562
  138. package/molecules/filter/filter.story.js +79 -104
  139. package/molecules/filter/index.js +5 -9
  140. package/molecules/graphCard/graphCard.js +97 -193
  141. package/molecules/graphCard/graphCard.story.js +159 -191
  142. package/molecules/graphCard/index.js +4 -8
  143. package/molecules/graphCard/loader.js +28 -68
  144. package/molecules/graphDetailCard/graphDetailCard.js +115 -183
  145. package/molecules/graphDetailCard/graphDetailCard.story.js +218 -254
  146. package/molecules/graphDetailCard/index.js +5 -9
  147. package/molecules/pageHeader/index.js +12 -10
  148. package/molecules/pageHeader/pageHeader.js +38 -79
  149. package/molecules/pageHeader/pageHeader.story.js +34 -55
  150. package/molecules/pagination/index.js +4 -8
  151. package/molecules/pagination/pagination.js +126 -202
  152. package/molecules/pagination/pagination.story.js +40 -52
  153. package/molecules/richTextInput/RichTextInput.js +354 -0
  154. package/molecules/richTextInput/RichTextInput.story.js +50 -0
  155. package/molecules/richTextInput/index.js +9 -0
  156. package/molecules/table/index.js +4 -8
  157. package/molecules/table/table-column.js +10 -16
  158. package/molecules/table/table-header.js +31 -72
  159. package/molecules/table/table.js +743 -1075
  160. package/molecules/table/table.story.js +274 -304
  161. package/molecules/tabs/index.js +4 -8
  162. package/molecules/tabs/tabs.js +112 -184
  163. package/molecules/tabs/tabs.story.js +66 -133
  164. package/molecules/videoCardList/index.js +4 -8
  165. package/molecules/videoCardList/videoCardList.js +24 -41
  166. package/molecules/videoCardList/videoCardList.story.js +449 -664
  167. package/molecules/videoPlayer/index.js +4 -8
  168. package/molecules/videoPlayer/videoPlayer.js +1019 -1097
  169. package/molecules/videoPlayer/videoPlayer.story.js +10 -21
  170. package/package.json +2 -2
@@ -1,278 +1,232 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
5
  Object.defineProperty(exports, "__esModule", {
4
- value: true
6
+ value: true
5
7
  });
6
-
7
- var _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; };
8
-
9
- var _templateObject = _taggedTemplateLiteral(['\n\nposition: relative;\n.circular-chart {\n display: block;\n margin: 0px auto;\n max-width: 200px;\n max-height: 250px;\n }\n \n .circle {\n fill: none;\n stroke-width: 2;\n //stroke-linecap: butt;\n stroke-linecap: round;\n\n &.base{\n stroke: #121D29;\n }\n \n &.main{\n //animation: progress 1s ease-out forwards;\n transition: all 1s ease;\n opacity:1;\n &.stroke-transparent{\n opacity:0;\n }\n }\n\n }\n \n @keyframes progress {\n 0% {\n stroke-dasharray: 0 100;\n }\n }\n\n\n\n .display-info {\n color: #fff;\n width: auto;\n display: inline-block; \n text-align: center;\n position: absolute;\n top: 75px;\n left: 150px;\n font-size: 30px;\n font-family: \'SFUIText-Medium\';\n transform: translate(-50%, 0px );\n opacity: 0;\n top: 50%;\n left: 50%;\n transform: translate(-50%,-50%);\n & > div{\n font-size: 10px;\n font-family: \'SFUIText-Regular\';\n margin-top:5px;\n }\n }\n\n .active.display-info {\n opacity: 1;\n display: inline-block;\n }\n\n'], ['\n\nposition: relative;\n.circular-chart {\n display: block;\n margin: 0px auto;\n max-width: 200px;\n max-height: 250px;\n }\n \n .circle {\n fill: none;\n stroke-width: 2;\n //stroke-linecap: butt;\n stroke-linecap: round;\n\n &.base{\n stroke: #121D29;\n }\n \n &.main{\n //animation: progress 1s ease-out forwards;\n transition: all 1s ease;\n opacity:1;\n &.stroke-transparent{\n opacity:0;\n }\n }\n\n }\n \n @keyframes progress {\n 0% {\n stroke-dasharray: 0 100;\n }\n }\n\n\n\n .display-info {\n color: #fff;\n width: auto;\n display: inline-block; \n text-align: center;\n position: absolute;\n top: 75px;\n left: 150px;\n font-size: 30px;\n font-family: \'SFUIText-Medium\';\n transform: translate(-50%, 0px );\n opacity: 0;\n top: 50%;\n left: 50%;\n transform: translate(-50%,-50%);\n & > div{\n font-size: 10px;\n font-family: \'SFUIText-Regular\';\n margin-top:5px;\n }\n }\n\n .active.display-info {\n opacity: 1;\n display: inline-block;\n }\n\n']);
10
-
11
- var _react = require('react');
12
-
13
- var _react2 = _interopRequireDefault(_react);
14
-
15
- var _propTypes = require('prop-types');
16
-
17
- var _propTypes2 = _interopRequireDefault(_propTypes);
18
-
19
- var _styledComponents = require('styled-components');
20
-
21
- var _styledComponents2 = _interopRequireDefault(_styledComponents);
22
-
23
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
-
25
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
-
27
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
28
-
29
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
30
-
31
- function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
32
-
8
+ exports["default"] = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
+ var _react = _interopRequireWildcard(require("react"));
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
20
+ var _templateObject;
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
23
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
26
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
33
27
  var propTypes = {};
34
-
35
- var StyledCircleDonut = _styledComponents2.default.div(_templateObject);
36
-
28
+ var StyledCircleDonut = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n\nposition: relative;\n.circular-chart {\n display: block;\n margin: 0px auto;\n max-width: 200px;\n max-height: 250px;\n }\n \n .circle {\n fill: none;\n stroke-width: 2;\n //stroke-linecap: butt;\n stroke-linecap: round;\n\n &.base{\n stroke: #121D29;\n }\n \n &.main{\n //animation: progress 1s ease-out forwards;\n transition: all 1s ease;\n opacity:1;\n &.stroke-transparent{\n opacity:0;\n }\n }\n\n }\n \n @keyframes progress {\n 0% {\n stroke-dasharray: 0 100;\n }\n }\n\n\n\n .display-info {\n color: #fff;\n width: auto;\n display: inline-block; \n text-align: center;\n position: absolute;\n top: 75px;\n left: 150px;\n font-size: 30px;\n font-family: 'SFUIText-Medium';\n transform: translate(-50%, 0px );\n opacity: 0;\n top: 50%;\n left: 50%;\n transform: translate(-50%,-50%);\n & > div{\n font-size: 10px;\n font-family: 'SFUIText-Regular';\n margin-top:5px;\n }\n }\n\n .active.display-info {\n opacity: 1;\n display: inline-block;\n }\n\n"])));
37
29
  var circleList = [{
38
- d: "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",
39
- c: 100
30
+ d: "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",
31
+ c: 100
40
32
  }, {
41
- d: "M18 6.0633691856671295 a 11.93663081433287 11.93663081433287 0 0 1 0 23.87326162866574 a 11.93663081433287 11.93663081433287 0 0 1 0 -23.87326162866574",
42
- c: 75
33
+ d: "M18 6.0633691856671295 a 11.93663081433287 11.93663081433287 0 0 1 0 23.87326162866574 a 11.93663081433287 11.93663081433287 0 0 1 0 -23.87326162866574",
34
+ c: 75
43
35
  }, {
44
- d: "M18 10.042246123778087 a 7.957753876221913 7.957753876221913 0 0 1 0 15.915507752443826 a 7.957753876221913 7.957753876221913 0 0 1 0 -15.915507752443826",
45
- c: 50
36
+ d: "M18 10.042246123778087 a 7.957753876221913 7.957753876221913 0 0 1 0 15.915507752443826 a 7.957753876221913 7.957753876221913 0 0 1 0 -15.915507752443826",
37
+ c: 50
46
38
  }, {
47
- d: "M18 14.021123061889043 a 3.9788769381109566 3.9788769381109566 0 0 1 0 7.957753876221913 a 3.9788769381109566 3.9788769381109566 0 0 1 0 -7.957753876221913",
48
- c: 25
39
+ d: "M18 14.021123061889043 a 3.9788769381109566 3.9788769381109566 0 0 1 0 7.957753876221913 a 3.9788769381109566 3.9788769381109566 0 0 1 0 -7.957753876221913",
40
+ c: 25
49
41
  }];
50
-
51
- var CircleNested = function (_Component) {
52
- _inherits(CircleNested, _Component);
53
-
54
- function CircleNested(props) {
55
- _classCallCheck(this, CircleNested);
56
-
57
- var _this = _possibleConstructorReturn(this, (CircleNested.__proto__ || Object.getPrototypeOf(CircleNested)).call(this, props));
58
-
59
- _this.componentDidMount = function () {
60
- setTimeout(function () {
61
-
62
- _this.setState({
63
- animate: true
64
- });
65
- }, 1000);
66
- };
67
-
68
- _this.hightlightme = function (e) {
69
- _this.setState({
70
- activeInfo: parseInt(e.target.getAttribute('idx'))
71
- });
72
- };
73
-
74
- _this.onMouseOut = function (e) {
75
- //console.log('onMouseOut ==', e.target.getAttribute('idx'));
76
- _this.setState({
77
- activeInfo: null
78
- });
79
- };
80
-
81
- _this.onMouseMove = function (e) {
82
- //console.log('onMouseMove >>>', e.target.getAttribute('idx'));
83
- };
84
-
85
- _this.render = function () {
86
- var graphColors = _this.props.graphColors;
87
- var _this$state = _this.state,
88
- animate = _this$state.animate,
89
- activeInfo = _this$state.activeInfo;
90
-
91
-
92
- var percentDataArr = [];
93
- var valueArr = _this.props.data.data.values || [];
94
-
95
- if (animate) {
96
-
97
- var highestValue = 0;
98
- if (_this.props.data.data && _this.props.data.data.total > 0) {
99
- var totalMatched = false;
100
- valueArr = valueArr.map(function (dataItem, idx) {
101
- if (idx === 0) {
102
- highestValue = dataItem.data;
103
- } else {
104
- highestValue = dataItem.data > highestValue ? dataItem.data : highestValue;
105
- }
106
- if (dataItem.data === _this.props.data.data.total) {
107
- totalMatched = true;
108
- }
109
-
110
- return _extends({}, dataItem, { mainIndex: idx });
111
- });
112
-
113
- // valueArr.sort((a,b)=>{
114
- // return b.data-a.data
115
- // })
116
-
117
- highestValue = totalMatched ? _this.props.data.data.total : highestValue * 110 / 100;
118
- }
119
-
120
- percentDataArr = valueArr.map(function (item, idx) {
121
- return !highestValue > 0 ? 0 : item.data / highestValue * 100;
122
- });
42
+ var CircleNested = /*#__PURE__*/function (_Component) {
43
+ function CircleNested(props) {
44
+ var _this;
45
+ (0, _classCallCheck2["default"])(this, CircleNested);
46
+ _this = _callSuper(this, CircleNested, [props]);
47
+ (0, _defineProperty2["default"])(_this, "componentDidMount", function () {
48
+ setTimeout(function () {
49
+ _this.setState({
50
+ animate: true
51
+ });
52
+ }, 1000);
53
+ });
54
+ (0, _defineProperty2["default"])(_this, "hightlightme", function (e) {
55
+ _this.setState({
56
+ activeInfo: parseInt(e.target.getAttribute('idx'))
57
+ });
58
+ });
59
+ (0, _defineProperty2["default"])(_this, "onMouseOut", function (e) {
60
+ //console.log('onMouseOut ==', e.target.getAttribute('idx'));
61
+ _this.setState({
62
+ activeInfo: null
63
+ });
64
+ });
65
+ (0, _defineProperty2["default"])(_this, "onMouseMove", function (e) {
66
+ //console.log('onMouseMove >>>', e.target.getAttribute('idx'));
67
+ });
68
+ (0, _defineProperty2["default"])(_this, "render", function () {
69
+ var graphColors = _this.props.graphColors;
70
+ var _this$state = _this.state,
71
+ animate = _this$state.animate,
72
+ activeInfo = _this$state.activeInfo;
73
+ var percentDataArr = [];
74
+ var valueArr = _this.props.data.data.values || [];
75
+ if (animate) {
76
+ var highestValue = 0;
77
+ if (_this.props.data.data && _this.props.data.data.total > 0) {
78
+ var totalMatched = false;
79
+ valueArr = valueArr.map(function (dataItem, idx) {
80
+ if (idx === 0) {
81
+ highestValue = dataItem.data;
123
82
  } else {
124
- percentDataArr = [0, 0, 0];
83
+ highestValue = dataItem.data > highestValue ? dataItem.data : highestValue;
125
84
  }
126
-
127
- var graphTitleName = _this.props.data && _this.props.data.data && _this.props.data.data.name ? _this.props.data.data.name : new Date().getTime() + '';
128
-
129
- return _react2.default.createElement(
130
- StyledCircleDonut,
131
- _extends({}, _this.props, { className: 'circle-donut',
132
- onClick: function onClick() {
133
- _this.setState({
134
- // percentDataArr : [ 100 , 75, 10]
135
- });
136
- }
137
- }),
138
- _react2.default.createElement(
139
- 'svg',
140
- { viewBox: '0 0 36 36', className: 'circular-chart' },
141
- _react2.default.createElement(
142
- 'defs',
143
- null,
144
- graphColors ? graphColors.map(function (item, idx) {
145
- return _react2.default.createElement(
146
- 'linearGradient',
147
- { key: graphTitleName + 'gradient-nested-color' + idx, id: graphTitleName + 'gradient-nested-color' + idx,
148
- x1: '0%', y1: '0%', x2: '53%', y2: '7%'
149
- //x1="2.15968" y1="101.504" x2="46.8631" y2="106.505" gradientUnits="userSpaceOnUse"
150
- },
151
- _react2.default.createElement('stop', { offset: '0%', stopColor: item[1] }),
152
- _react2.default.createElement('stop', { offset: '100%', stopColor: item[0] })
153
- );
154
- }) : null
155
- ),
156
- _react2.default.createElement('circle', { className: 'placeholder-base', idx: -1, cx: '18', cy: '18', r: '15.9155', fill: 'transparent',
157
- onMouseOver: function onMouseOver(e) {
158
- _this.hightlightme(e);
159
- },
160
- onMouseOut: function onMouseOut(e) {
161
- _this.onMouseOut(e);
162
- },
163
- onMouseMove: function onMouseMove(e) {
164
- _this.onMouseMove(e);
165
- }
166
- }),
167
- valueArr.map(function (item, idx) {
168
- return percentDataArr[idx] > -1 && _react2.default.createElement(
169
- _react2.default.Fragment,
170
- { key: graphTitleName + 'circle-fragment' + idx },
171
- _react2.default.createElement('path', { className: 'circle base',
172
- idx: idx,
173
- key: graphTitleName + 'circle-base' + idx,
174
- strokeDasharray: circleList[idx].c + ", " + circleList[idx].c,
175
- d: circleList[idx].d,
176
- onMouseOver: function onMouseOver(e) {
177
- _this.hightlightme(e);
178
- },
179
- onMouseOut: function onMouseOut(e) {
180
- _this.onMouseOut(e);
181
- },
182
- onMouseMove: function onMouseMove(e) {
183
- _this.onMouseMove(e);
184
- }
185
- }),
186
- _react2.default.createElement('path', { idx: idx,
187
- key: graphTitleName + 'circle-main' + idx,
188
- strokeDasharray: "" + circleList[idx].c * percentDataArr[idx] / 100 + ", " + circleList[idx].c
189
- //stroke={!percentDataArr[idx] >0 || !this.props.data.data.total > 0 ? "url(#"+'gradient-a-color'+idx +")": "url(#"+'gradient-a-color'+idx +")"}
190
- , stroke: "url(#" + graphTitleName + 'gradient-nested-color' + item.mainIndex + ")",
191
-
192
- className: percentDataArr[idx] == 0 || _this.props.data.data.total === 0 ? "circle main stroke-transparent" : "circle main",
193
-
194
- d: circleList[idx].d,
195
- onMouseOver: function onMouseOver(e) {
196
- _this.hightlightme(e);
197
- },
198
- onMouseOut: function onMouseOut(e) {
199
- _this.onMouseOut(e);
200
- },
201
- onMouseMove: function onMouseMove(e) {
202
- _this.onMouseMove(e);
203
- }
204
- })
205
- );
206
- })
207
- ),
208
- _react2.default.createElement(
209
- 'div',
210
- { className: activeInfo === null ? "active display-info" : "display-info" },
211
- _react2.default.createElement(
212
- 'span',
213
- { style: {
214
- color: '#FFF'
215
- } },
216
- _this.props.data.data.total
217
- ),
218
- _react2.default.createElement(
219
- 'div',
220
- null,
221
- _this.props.valueSub
222
- )
223
- ),
224
- _this.props.data.data.total > 0 && valueArr.map(function (item, idx) {
225
- return _react2.default.createElement(
226
- 'div',
227
- { key: graphTitleName + 'display-info' + idx, className: activeInfo === idx ? "active display-info" : "display-info" },
228
- _react2.default.createElement(
229
- 'span',
230
- { style: {
231
- color: typeof item.mainIndex === 'number' ? graphColors[item.mainIndex][0] : graphColors[idx][0]
232
- } },
233
- item.data
234
- ),
235
- _react2.default.createElement(
236
- 'div',
237
- null,
238
- item.name
239
- )
240
- );
241
- })
242
- );
243
- };
244
-
245
- _this.state = {
246
- animate: false,
247
- activeInfo: null
248
- };
249
- return _this;
250
- }
251
-
252
- return CircleNested;
85
+ if (dataItem.data === _this.props.data.data.total) {
86
+ totalMatched = true;
87
+ }
88
+ return _objectSpread(_objectSpread({}, dataItem), {}, {
89
+ mainIndex: idx
90
+ });
91
+ });
92
+
93
+ // valueArr.sort((a,b)=>{
94
+ // return b.data-a.data
95
+ // })
96
+
97
+ highestValue = totalMatched ? _this.props.data.data.total : highestValue * 110 / 100;
98
+ }
99
+ percentDataArr = valueArr.map(function (item, idx) {
100
+ return !highestValue > 0 ? 0 : item.data / highestValue * 100;
101
+ });
102
+ } else {
103
+ percentDataArr = [0, 0, 0];
104
+ }
105
+ var graphTitleName = _this.props.data && _this.props.data.data && _this.props.data.data.name ? _this.props.data.data.name : new Date().getTime() + '';
106
+ return /*#__PURE__*/_react["default"].createElement(StyledCircleDonut, (0, _extends2["default"])({}, _this.props, {
107
+ className: "circle-donut",
108
+ onClick: function onClick() {
109
+ _this.setState({
110
+ // percentDataArr : [ 100 , 75, 10]
111
+ });
112
+ }
113
+ }), /*#__PURE__*/_react["default"].createElement("svg", {
114
+ viewBox: "0 0 36 36",
115
+ className: "circular-chart"
116
+ }, /*#__PURE__*/_react["default"].createElement("defs", null, graphColors ? graphColors.map(function (item, idx) {
117
+ return /*#__PURE__*/_react["default"].createElement("linearGradient", {
118
+ key: graphTitleName + 'gradient-nested-color' + idx,
119
+ id: graphTitleName + 'gradient-nested-color' + idx,
120
+ x1: "0%",
121
+ y1: "0%",
122
+ x2: "53%",
123
+ y2: "7%"
124
+ //x1="2.15968" y1="101.504" x2="46.8631" y2="106.505" gradientUnits="userSpaceOnUse"
125
+ }, /*#__PURE__*/_react["default"].createElement("stop", {
126
+ offset: "0%",
127
+ stopColor: item[1]
128
+ }), /*#__PURE__*/_react["default"].createElement("stop", {
129
+ offset: "100%",
130
+ stopColor: item[0]
131
+ }));
132
+ }) : null), /*#__PURE__*/_react["default"].createElement("circle", {
133
+ className: "placeholder-base",
134
+ idx: -1,
135
+ cx: "18",
136
+ cy: "18",
137
+ r: "15.9155",
138
+ fill: "transparent",
139
+ onMouseOver: function onMouseOver(e) {
140
+ _this.hightlightme(e);
141
+ },
142
+ onMouseOut: function onMouseOut(e) {
143
+ _this.onMouseOut(e);
144
+ },
145
+ onMouseMove: function onMouseMove(e) {
146
+ _this.onMouseMove(e);
147
+ }
148
+ }), valueArr.map(function (item, idx) {
149
+ return percentDataArr[idx] > -1 && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
150
+ key: graphTitleName + 'circle-fragment' + idx
151
+ }, /*#__PURE__*/_react["default"].createElement("path", {
152
+ className: "circle base",
153
+ idx: idx,
154
+ key: graphTitleName + 'circle-base' + idx,
155
+ strokeDasharray: circleList[idx].c + ", " + circleList[idx].c,
156
+ d: circleList[idx].d,
157
+ onMouseOver: function onMouseOver(e) {
158
+ _this.hightlightme(e);
159
+ },
160
+ onMouseOut: function onMouseOut(e) {
161
+ _this.onMouseOut(e);
162
+ },
163
+ onMouseMove: function onMouseMove(e) {
164
+ _this.onMouseMove(e);
165
+ }
166
+ }), /*#__PURE__*/_react["default"].createElement("path", {
167
+ idx: idx,
168
+ key: graphTitleName + 'circle-main' + idx,
169
+ strokeDasharray: "" + circleList[idx].c * percentDataArr[idx] / 100 + ", " + circleList[idx].c
170
+ //stroke={!percentDataArr[idx] >0 || !this.props.data.data.total > 0 ? "url(#"+'gradient-a-color'+idx +")": "url(#"+'gradient-a-color'+idx +")"}
171
+ ,
172
+ stroke: "url(#" + graphTitleName + 'gradient-nested-color' + item.mainIndex + ")",
173
+ className: percentDataArr[idx] == 0 || _this.props.data.data.total === 0 ? "circle main stroke-transparent" : "circle main",
174
+ d: circleList[idx].d,
175
+ onMouseOver: function onMouseOver(e) {
176
+ _this.hightlightme(e);
177
+ },
178
+ onMouseOut: function onMouseOut(e) {
179
+ _this.onMouseOut(e);
180
+ },
181
+ onMouseMove: function onMouseMove(e) {
182
+ _this.onMouseMove(e);
183
+ }
184
+ }));
185
+ })), /*#__PURE__*/_react["default"].createElement("div", {
186
+ className: activeInfo === null ? "active display-info" : "display-info"
187
+ }, /*#__PURE__*/_react["default"].createElement("span", {
188
+ style: {
189
+ color: '#FFF'
190
+ }
191
+ }, _this.props.data.data.total), /*#__PURE__*/_react["default"].createElement("div", null, _this.props.valueSub)), _this.props.data.data.total > 0 && valueArr.map(function (item, idx) {
192
+ return /*#__PURE__*/_react["default"].createElement("div", {
193
+ key: graphTitleName + 'display-info' + idx,
194
+ className: activeInfo === idx ? "active display-info" : "display-info"
195
+ }, /*#__PURE__*/_react["default"].createElement("span", {
196
+ style: {
197
+ color: typeof item.mainIndex === 'number' ? graphColors[item.mainIndex][0] : graphColors[idx][0]
198
+ }
199
+ }, item.data), /*#__PURE__*/_react["default"].createElement("div", null, item.name));
200
+ }));
201
+ });
202
+ _this.state = {
203
+ animate: false,
204
+ activeInfo: null
205
+ };
206
+ return _this;
207
+ }
208
+ (0, _inherits2["default"])(CircleNested, _Component);
209
+ return (0, _createClass2["default"])(CircleNested);
253
210
  }(_react.Component);
254
-
255
211
  CircleNested.propTypes = {
256
- data: _propTypes2.default.shape({
257
- graph_name: _propTypes2.default.string,
258
- graph_type: _propTypes2.default.string,
259
- data: _propTypes2.default.shape({
260
- total: _propTypes2.default.number.isRequired,
261
- name: _propTypes2.default.string,
262
- values: _propTypes2.default.arrayOf(_propTypes2.default.shape({
263
- data: _propTypes2.default.number.isRequired
264
- }).isRequired)
265
- })
266
- }).isRequired,
267
- theme: _propTypes2.default.oneOf(['light', 'dark']),
268
- graphColors: _propTypes2.default.array,
269
- graphPlaceholder: _propTypes2.default.bool,
270
- valueSub: _propTypes2.default.string
212
+ data: _propTypes["default"].shape({
213
+ graph_name: _propTypes["default"].string,
214
+ graph_type: _propTypes["default"].string,
215
+ data: _propTypes["default"].shape({
216
+ total: _propTypes["default"].number.isRequired,
217
+ name: _propTypes["default"].string,
218
+ values: _propTypes["default"].arrayOf(_propTypes["default"].shape({
219
+ data: _propTypes["default"].number.isRequired
220
+ }).isRequired)
221
+ })
222
+ }).isRequired,
223
+ theme: _propTypes["default"].oneOf(['light', 'dark']),
224
+ graphColors: _propTypes["default"].array,
225
+ graphPlaceholder: _propTypes["default"].bool,
226
+ valueSub: _propTypes["default"].string
271
227
  };
272
-
273
228
  CircleNested.defaultProps = {
274
- theme: 'light',
275
- graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']]
229
+ theme: 'light',
230
+ graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']]
276
231
  };
277
-
278
- exports.default = CircleNested;
232
+ var _default = exports["default"] = CircleNested;