@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.
- package/_helpers/globals.js +9 -10
- package/_helpers/pagination.js +10 -15
- package/_helpers/story-example.js +16 -39
- package/_helpers/story-helpers.js +15 -14
- package/_helpers/story-stack.js +22 -43
- package/_helpers/uniqueId.js +2 -5
- package/_helpers/utils.js +28 -4
- package/atoms/avatar/avatar.js +19 -42
- package/atoms/avatar/avatar.story.js +25 -58
- package/atoms/avatar/index.js +13 -11
- package/atoms/badge/badge.js +14 -37
- package/atoms/badge/badge.story.js +45 -103
- package/atoms/badge/index.js +12 -10
- package/atoms/button/button.js +85 -161
- package/atoms/button/button.story.js +354 -508
- package/atoms/button/index.js +5 -9
- package/atoms/card/card.js +26 -55
- package/atoms/card/card.story.js +39 -88
- package/atoms/card/index.js +12 -10
- package/atoms/cardStack/cardStack.js +88 -147
- package/atoms/cardStack/cardStack.story.js +106 -210
- package/atoms/cardStack/index.js +12 -10
- package/atoms/cardV2/cardV2.js +57 -106
- package/atoms/cardV2/cardV2.story.js +184 -232
- package/atoms/cardV2/content.js +154 -256
- package/atoms/cardV2/index.js +4 -8
- package/atoms/cardV2/thumbnail.js +138 -208
- package/atoms/cardV2/timeline.js +167 -123
- package/atoms/checkbox/checkbox.js +85 -157
- package/atoms/checkbox/checkbox.story.js +237 -365
- package/atoms/checkbox/index.js +4 -9
- package/atoms/customSelect/customSelect.js +136 -215
- package/atoms/customSelect/customSelect.story.js +745 -851
- package/atoms/customSelect/index.js +4 -8
- package/atoms/datePicker/datePicker.js +299 -431
- package/atoms/datePicker/datePicker.story.js +453 -501
- package/atoms/datePicker/index.js +4 -8
- package/atoms/dateTime/dateTime.js +3 -6
- package/atoms/dateTime/dateTime.story.js +17 -63
- package/atoms/dateTime/index.js +5 -9
- package/atoms/draftInputText/draftInputText.js +121 -189
- package/atoms/draftInputText/draftInputText.story.js +200 -249
- package/atoms/draftInputText/index.js +5 -9
- package/atoms/dropdown/dropdown.js +38 -66
- package/atoms/dropdown/dropdown.story.js +102 -262
- package/atoms/dropdown/index.js +4 -8
- package/atoms/dropdownList/dropdownList.js +78 -108
- package/atoms/dropdownList/dropdownList.story.js +1546 -1621
- package/atoms/dropdownList/index.js +4 -8
- package/atoms/graphs/barGraph/barGraph.js +95 -146
- package/atoms/graphs/barGraph/barGraph.story.js +65 -87
- package/atoms/graphs/barGraph/index.js +4 -8
- package/atoms/graphs/circleDonut/circleDonut.js +177 -229
- package/atoms/graphs/circleDonut/circleDonut.story.js +328 -394
- package/atoms/graphs/circleDonut/index.js +5 -9
- package/atoms/graphs/circleGraph/circleGraph.js +60 -90
- package/atoms/graphs/circleGraph/circleGraph.story.js +36 -54
- package/atoms/graphs/circleGraph/index.js +4 -8
- package/atoms/graphs/circleNested/circleNested.js +216 -262
- package/atoms/graphs/circleNested/circleNested.story.js +91 -116
- package/atoms/graphs/circleNested/index.js +5 -9
- package/atoms/graphs/pieChart/index.js +4 -8
- package/atoms/graphs/pieChart/pieChart.js +162 -191
- package/atoms/graphs/pieChart/pieChart.story.js +147 -176
- package/atoms/graphs/verticalBarGraph/index.js +5 -9
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.js +75 -98
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.story.js +26 -45
- package/atoms/icon/icon.js +41 -72
- package/atoms/icon/icon.story.js +831 -260
- package/atoms/icon/index.js +19 -12
- package/atoms/image/image.js +18 -32
- package/atoms/image/image.story.js +10 -19
- package/atoms/image/index.js +4 -8
- package/atoms/inputText/index.js +4 -8
- package/atoms/inputText/inputText.js +86 -131
- package/atoms/inputText/inputText.story.js +191 -255
- package/atoms/label/index.js +4 -8
- package/atoms/label/label.js +25 -50
- package/atoms/label/label.story.js +42 -83
- package/atoms/loader/CircleLoader.js +29 -63
- package/atoms/loader/ShimmerComponent/CollabShimmerCard.js +39 -50
- package/atoms/loader/ShimmerComponent/CollabShimmerCardTray.js +41 -42
- package/atoms/loader/ShimmerComponent/FiltersShimmer.js +30 -30
- package/atoms/loader/ShimmerComponent/GraphDetailShimmer.js +21 -34
- package/atoms/loader/ShimmerComponent/GraphTitleShimmer.js +30 -34
- package/atoms/loader/ShimmerComponent/GraphsComponentShimmer.js +23 -32
- package/atoms/loader/ShimmerComponent/Shimmer.js +24 -32
- package/atoms/loader/ThreeDotLoader.js +14 -29
- package/atoms/loader/index.js +13 -11
- package/atoms/loader/loader.js +34 -58
- package/atoms/loader/loader.story.js +48 -52
- package/atoms/loader/spinningLoader.js +23 -34
- package/atoms/popup/index.js +5 -9
- package/atoms/popup/popup.js +123 -208
- package/atoms/popup/popup.story.js +97 -131
- package/atoms/radio/index.js +18 -11
- package/atoms/radio/radio.js +58 -112
- package/atoms/radio/radio.story.js +197 -420
- package/atoms/select/index.js +4 -8
- package/atoms/select/select.js +48 -86
- package/atoms/sideBar/index.js +5 -9
- package/atoms/sideBar/sidebar.js +89 -140
- package/atoms/switch/index.js +4 -8
- package/atoms/switch/switch.js +56 -86
- package/atoms/switch/switch.story.js +268 -415
- package/atoms/tag/index.js +12 -10
- package/atoms/tag/tag.js +29 -63
- package/atoms/tag/tag.story.js +135 -209
- package/atoms/textarea/index.js +5 -9
- package/atoms/textarea/textarea.js +55 -99
- package/atoms/textarea/textarea.story.js +48 -41
- package/atoms/thematicBreak/index.js +12 -10
- package/atoms/thematicBreak/thematicBreak.js +20 -38
- package/atoms/thematicBreak/thematicBreak.story.js +25 -37
- package/atoms/timeCodeInput/index.js +4 -8
- package/atoms/timeCodeInput/timCodeInput.story.js +21 -35
- package/atoms/timeCodeInput/timeCodeInput.js +33 -51
- package/atoms/timer/index.js +5 -9
- package/atoms/timer/timer.js +57 -108
- package/atoms/timer/timer.story.js +13 -26
- package/atoms/toast/index.js +5 -9
- package/atoms/toast/toast.js +81 -116
- package/atoms/toast/toast.story.js +50 -76
- package/atoms/videoCard/index.js +12 -10
- package/atoms/videoCard/videoCard.js +265 -447
- package/atoms/videoCard/videoCard.story.js +495 -710
- package/components.js +411 -294
- package/index.js +350 -61
- package/molecules/carousel/carousel.js +121 -207
- package/molecules/carousel/carousel.story.js +240 -223
- package/molecules/carousel/index.js +5 -9
- package/molecules/errorScreen/CollabErrorScreen.js +35 -66
- package/molecules/errorScreen/TableErrorScreen.js +109 -102
- package/molecules/errorScreen/TableErrorScreen.jsx +7 -6
- package/molecules/errorScreen/errorScreen.js +41 -94
- package/molecules/filter/constants.js +1 -0
- package/molecules/filter/filter.js +378 -562
- package/molecules/filter/filter.story.js +79 -104
- package/molecules/filter/index.js +5 -9
- package/molecules/graphCard/graphCard.js +97 -193
- package/molecules/graphCard/graphCard.story.js +159 -191
- package/molecules/graphCard/index.js +4 -8
- package/molecules/graphCard/loader.js +28 -68
- package/molecules/graphDetailCard/graphDetailCard.js +115 -183
- package/molecules/graphDetailCard/graphDetailCard.story.js +218 -254
- package/molecules/graphDetailCard/index.js +5 -9
- package/molecules/pageHeader/index.js +12 -10
- package/molecules/pageHeader/pageHeader.js +38 -79
- package/molecules/pageHeader/pageHeader.story.js +34 -55
- package/molecules/pagination/index.js +4 -8
- package/molecules/pagination/pagination.js +126 -202
- package/molecules/pagination/pagination.story.js +40 -52
- package/molecules/richTextInput/RichTextInput.js +354 -0
- package/molecules/richTextInput/RichTextInput.story.js +50 -0
- package/molecules/richTextInput/index.js +9 -0
- package/molecules/table/index.js +4 -8
- package/molecules/table/table-column.js +10 -16
- package/molecules/table/table-header.js +31 -72
- package/molecules/table/table.js +743 -1075
- package/molecules/table/table.story.js +274 -304
- package/molecules/tabs/index.js +4 -8
- package/molecules/tabs/tabs.js +112 -184
- package/molecules/tabs/tabs.story.js +66 -133
- package/molecules/videoCardList/index.js +4 -8
- package/molecules/videoCardList/videoCardList.js +24 -41
- package/molecules/videoCardList/videoCardList.story.js +449 -664
- package/molecules/videoPlayer/index.js +4 -8
- package/molecules/videoPlayer/videoPlayer.js +1019 -1097
- package/molecules/videoPlayer/videoPlayer.story.js +10 -21
- package/package.json +2 -2
|
@@ -1,119 +1,94 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var _react2 =
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
name: 'Failed',
|
|
51
|
-
value: 'failed',
|
|
52
|
-
index: 4,
|
|
53
|
-
data: 2,
|
|
54
|
-
pending: 17
|
|
55
|
-
}]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']],
|
|
59
|
-
graphPlaceholder: false,
|
|
60
|
-
valueSub: 'Assets'
|
|
61
|
-
})
|
|
62
|
-
)
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@storybook/react");
|
|
6
|
+
var _storyHelpers = require("../../../_helpers/story-helpers");
|
|
7
|
+
var _components = require("../../../../components");
|
|
8
|
+
(0, _react2.storiesOf)('CircleNested').add('light theme', function () {
|
|
9
|
+
return /*#__PURE__*/_react["default"].createElement(_storyHelpers.Example, {
|
|
10
|
+
title: "Appearances"
|
|
11
|
+
}, /*#__PURE__*/_react["default"].createElement(_storyHelpers.Stack, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
12
|
+
style: {
|
|
13
|
+
width: '295px',
|
|
14
|
+
height: '295px'
|
|
15
|
+
}
|
|
16
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.CircleNested, {
|
|
17
|
+
data: {
|
|
18
|
+
graph_name: 'circle-nested',
|
|
19
|
+
graph_type: '',
|
|
20
|
+
data: {
|
|
21
|
+
from_date: 1609698600000,
|
|
22
|
+
to_date: 1610389799000,
|
|
23
|
+
name: 'Ingest',
|
|
24
|
+
total: 10,
|
|
25
|
+
values: [{
|
|
26
|
+
name: 'Finished',
|
|
27
|
+
value: 'ingested',
|
|
28
|
+
index: 1,
|
|
29
|
+
data: 3,
|
|
30
|
+
processed: 66
|
|
31
|
+
}, {
|
|
32
|
+
name: 'In Progress',
|
|
33
|
+
value: 'started',
|
|
34
|
+
index: 2,
|
|
35
|
+
data: 5,
|
|
36
|
+
inprogress: 7
|
|
37
|
+
}, {
|
|
38
|
+
name: 'Failed',
|
|
39
|
+
value: 'failed',
|
|
40
|
+
index: 4,
|
|
41
|
+
data: 2,
|
|
42
|
+
pending: 17
|
|
43
|
+
}]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']],
|
|
47
|
+
graphPlaceholder: false,
|
|
48
|
+
valueSub: 'Assets'
|
|
49
|
+
})))));
|
|
66
50
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']],
|
|
112
|
-
graphPlaceholder: false,
|
|
113
|
-
valueSub: 'Asset'
|
|
114
|
-
})
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
118
|
-
);
|
|
51
|
+
(0, _react2.storiesOf)('CircleNested').add('dark theme', function () {
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement(_storyHelpers.Example, {
|
|
53
|
+
title: "Tag",
|
|
54
|
+
background: "dark"
|
|
55
|
+
}, /*#__PURE__*/_react["default"].createElement(_storyHelpers.Stack, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
56
|
+
style: {
|
|
57
|
+
width: '295px',
|
|
58
|
+
height: '295px'
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.CircleNested, {
|
|
61
|
+
data: {
|
|
62
|
+
graph_name: 'circle-nested',
|
|
63
|
+
graph_type: '',
|
|
64
|
+
data: {
|
|
65
|
+
from_date: 1609698600000,
|
|
66
|
+
to_date: 1610389799000,
|
|
67
|
+
name: 'Ingest',
|
|
68
|
+
total: 10,
|
|
69
|
+
values: [{
|
|
70
|
+
name: 'Finished',
|
|
71
|
+
value: 'ingested',
|
|
72
|
+
index: 1,
|
|
73
|
+
data: 3,
|
|
74
|
+
processed: 66
|
|
75
|
+
}, {
|
|
76
|
+
name: 'In Progress',
|
|
77
|
+
value: 'started',
|
|
78
|
+
index: 2,
|
|
79
|
+
data: 5,
|
|
80
|
+
inprogress: 7
|
|
81
|
+
}, {
|
|
82
|
+
name: 'Failed',
|
|
83
|
+
value: 'failed',
|
|
84
|
+
index: 4,
|
|
85
|
+
data: 2,
|
|
86
|
+
pending: 17
|
|
87
|
+
}]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']],
|
|
91
|
+
graphPlaceholder: false,
|
|
92
|
+
valueSub: 'Asset'
|
|
93
|
+
})))));
|
|
119
94
|
});
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var _circleNested = require(
|
|
8
|
-
|
|
9
|
-
var _circleNested2 = _interopRequireDefault(_circleNested);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
exports.default = _circleNested2.default;
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _circleNested = _interopRequireDefault(require("./circleNested"));
|
|
9
|
+
var _default = exports["default"] = _circleNested["default"];
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
var _pieChart = require("./pieChart");
|
|
8
|
-
|
|
9
|
-
var _pieChart2 = _interopRequireDefault(_pieChart);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
exports.default = _pieChart2.default;
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _pieChart = _interopRequireDefault(require("./pieChart"));
|
|
9
|
+
var _default = exports["default"] = _pieChart["default"];
|
|
@@ -1,204 +1,175 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
6
|
+
value: true
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var z = 0; // Size z
|
|
54
|
-
var x = 0; // Side x
|
|
55
|
-
var y = 0; // Side y
|
|
56
|
-
var X = 0; // SVG X coordinate
|
|
57
|
-
var Y = 0; // SVG Y coordinate
|
|
58
|
-
var R = 0; // Rotation
|
|
59
|
-
var aCalc = 0;
|
|
60
|
-
var arcSweep = 0;
|
|
61
|
-
|
|
62
|
-
data.values.map(function (item, key) {
|
|
63
|
-
var percent = (data.total != 0 ? item.data : 10) / totalItems;
|
|
64
|
-
a = 360 * percent;
|
|
65
|
-
aCalc = a > 180 ? 360 - a : a;
|
|
66
|
-
aRad = aCalc * Math.PI / 180;
|
|
67
|
-
z = Math.sqrt(2 * l * l - 2 * l * l * Math.cos(aRad));
|
|
68
|
-
if (aCalc <= 90) {
|
|
69
|
-
x = l * Math.sin(aRad);
|
|
70
|
-
} else {
|
|
71
|
-
x = l * Math.sin((180 - aCalc) * Math.PI / 180);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
y = Math.sqrt(z * z - x * x);
|
|
75
|
-
Y = y;
|
|
76
|
-
|
|
77
|
-
if (a <= 180) {
|
|
78
|
-
X = l + x;
|
|
79
|
-
arcSweep = 0;
|
|
80
|
-
} else {
|
|
81
|
-
X = l - x;
|
|
82
|
-
arcSweep = 1;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
sectors.push({
|
|
86
|
-
percentage: percent,
|
|
87
|
-
label: item.name,
|
|
88
|
-
arcSweep: arcSweep,
|
|
89
|
-
value: item.value,
|
|
90
|
-
L: l,
|
|
91
|
-
X: X,
|
|
92
|
-
Y: Y,
|
|
93
|
-
R: R
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
R = R + a;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
return sectors;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
_this.componentDidMount = function () {
|
|
103
|
-
var dataObj = _this.generateData(_this.props.data);
|
|
104
|
-
_this.setState({ dataObj: dataObj });
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
_this.state = {
|
|
108
|
-
dataObj: null
|
|
109
|
-
};
|
|
110
|
-
return _this;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
_createClass(PieChart, [{
|
|
114
|
-
key: 'getColors',
|
|
115
|
-
value: function getColors(idx) {
|
|
116
|
-
var arr = ["completed", "rejected", "pending", "failed"];
|
|
117
|
-
return arr[idx];
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
var _tokens = require("@desynova-digital/tokens");
|
|
21
|
+
var _templateObject, _templateObject2;
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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)); }
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
var PieChart = /*#__PURE__*/function (_React$Component) {
|
|
27
|
+
function PieChart(props) {
|
|
28
|
+
var _this;
|
|
29
|
+
(0, _classCallCheck2["default"])(this, PieChart);
|
|
30
|
+
_this = _callSuper(this, PieChart, [props]);
|
|
31
|
+
(0, _defineProperty2["default"])(_this, "generateData", function (data) {
|
|
32
|
+
var sectors = [];
|
|
33
|
+
var l = (typeof _this.props.width == 'string' ? 100 : _this.props.width) / 2;
|
|
34
|
+
var totalItems = data.total !== 0 ? data.total : 10;
|
|
35
|
+
var a = 0; // Angle
|
|
36
|
+
var aRad = 0; // Angle in Rad
|
|
37
|
+
var z = 0; // Size z
|
|
38
|
+
var x = 0; // Side x
|
|
39
|
+
var y = 0; // Side y
|
|
40
|
+
var X = 0; // SVG X coordinate
|
|
41
|
+
var Y = 0; // SVG Y coordinate
|
|
42
|
+
var R = 0; // Rotation
|
|
43
|
+
var aCalc = 0;
|
|
44
|
+
var arcSweep = 0;
|
|
45
|
+
data.values.map(function (item, key) {
|
|
46
|
+
var percent = (data.total != 0 ? item.data : 10) / totalItems;
|
|
47
|
+
a = 360 * percent;
|
|
48
|
+
aCalc = a > 180 ? 360 - a : a;
|
|
49
|
+
aRad = aCalc * Math.PI / 180;
|
|
50
|
+
z = Math.sqrt(2 * l * l - 2 * l * l * Math.cos(aRad));
|
|
51
|
+
if (aCalc <= 90) {
|
|
52
|
+
x = l * Math.sin(aRad);
|
|
53
|
+
} else {
|
|
54
|
+
x = l * Math.sin((180 - aCalc) * Math.PI / 180);
|
|
118
55
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
56
|
+
y = Math.sqrt(z * z - x * x);
|
|
57
|
+
Y = y;
|
|
58
|
+
if (a <= 180) {
|
|
59
|
+
X = l + x;
|
|
60
|
+
arcSweep = 0;
|
|
61
|
+
} else {
|
|
62
|
+
X = l - x;
|
|
63
|
+
arcSweep = 1;
|
|
64
|
+
}
|
|
65
|
+
sectors.push({
|
|
66
|
+
percentage: percent,
|
|
67
|
+
label: item.name,
|
|
68
|
+
arcSweep: arcSweep,
|
|
69
|
+
value: item.value,
|
|
70
|
+
L: l,
|
|
71
|
+
X: X,
|
|
72
|
+
Y: Y,
|
|
73
|
+
R: R
|
|
74
|
+
});
|
|
75
|
+
R = R + a;
|
|
76
|
+
});
|
|
77
|
+
return sectors;
|
|
78
|
+
});
|
|
79
|
+
(0, _defineProperty2["default"])(_this, "componentDidMount", function () {
|
|
80
|
+
var dataObj = _this.generateData(_this.props.data);
|
|
81
|
+
_this.setState({
|
|
82
|
+
dataObj: dataObj
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
_this.state = {
|
|
86
|
+
dataObj: null
|
|
87
|
+
};
|
|
88
|
+
return _this;
|
|
89
|
+
}
|
|
90
|
+
(0, _inherits2["default"])(PieChart, _React$Component);
|
|
91
|
+
return (0, _createClass2["default"])(PieChart, [{
|
|
92
|
+
key: "getColors",
|
|
93
|
+
value: function getColors(idx) {
|
|
94
|
+
var arr = ["completed", "rejected", "pending", "failed"];
|
|
95
|
+
return arr[idx];
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "render",
|
|
99
|
+
value: function render() {
|
|
100
|
+
var _this2 = this;
|
|
101
|
+
var width = typeof this.props.width == 'string' ? 100 : this.props.width;
|
|
102
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.state.dataObj ? /*#__PURE__*/_react["default"].createElement(GraphSVG, (0, _extends2["default"])({}, typeof this.props.width == 'string' ? "" : {
|
|
103
|
+
"width": width
|
|
104
|
+
}, typeof this.props.width == 'string' ? "" : {
|
|
105
|
+
"height": this.props.height
|
|
106
|
+
}, {
|
|
107
|
+
viewBox: "0 0 ".concat(width, " ").concat(this.props.height)
|
|
108
|
+
}), this.state.dataObj.map(function (data, index) {
|
|
109
|
+
return data.percentage !== 1 ? /*#__PURE__*/_react["default"].createElement(StyledPath, (0, _extends2["default"])({}, _this2.props, {
|
|
110
|
+
key: index,
|
|
111
|
+
fill: _tokens.colors[_this2.props.theme].graph[_this2.getColors(index)],
|
|
112
|
+
d: "M".concat(data.L, ", ").concat(data.L, " L").concat(data.L, ",0 A").concat(data.L, ",").concat(data.L, " 1 ").concat(data.arcSweep, ",1 ").concat(data.X, ", ").concat(data.Y, " z"),
|
|
113
|
+
transform: "rotate(".concat(data.R, ", ").concat(data.L, ",").concat(data.L, ")")
|
|
114
|
+
})) : /*#__PURE__*/_react["default"].createElement(StyledPath, (0, _extends2["default"])({}, _this2.props, {
|
|
115
|
+
key: index,
|
|
116
|
+
fill: _tokens.colors[_this2.props.theme].graph[_this2.getColors(index)],
|
|
117
|
+
d: " \
|
|
144
118
|
M " + width / 2 + ", " + width / 2 + " \
|
|
145
119
|
m -" + width / 2 + ", 0 \
|
|
146
120
|
a " + width / 2 + "," + width / 2 + " 0 1,0 " + width / 2 * 2 + ",0 \
|
|
147
121
|
a " + width / 2 + "," + width / 2 + " 0 1,0 -" + width / 2 * 2 + ",0 \
|
|
148
|
-
",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
122
|
+
",
|
|
123
|
+
transform: "rotate(".concat(data.R, ", ").concat(data.L, ",").concat(data.L, ")")
|
|
124
|
+
}));
|
|
125
|
+
}), this.props.type === 'donut' || this.props.type === 'donutThin' ? /*#__PURE__*/_react["default"].createElement("circle", {
|
|
126
|
+
cx: width / 2,
|
|
127
|
+
cy: width / 2,
|
|
128
|
+
r: width / 2 * (this.props.type === 'donutThin' ? 0.97 : 0.90),
|
|
129
|
+
fill: _tokens.colors[this.props.theme].base
|
|
130
|
+
}) : null) : null);
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
}(_react["default"].Component);
|
|
134
|
+
var StyledPath = _styledComponents["default"].path(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n stroke: ", ";\n stroke-width: 0;\n"])), function (props) {
|
|
135
|
+
return _tokens.colors[props.theme].base;
|
|
161
136
|
});
|
|
162
|
-
|
|
163
|
-
var GraphSVG = _styledComponents2.default.svg(_templateObject2);
|
|
164
|
-
|
|
137
|
+
var GraphSVG = _styledComponents["default"].svg(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: block;\n margin: 10px auto;\n"])));
|
|
165
138
|
PieChart.propTypes = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
139
|
+
/** Graph Data */
|
|
140
|
+
data: _propTypes["default"].object.isRequired,
|
|
141
|
+
/** Graph size */
|
|
142
|
+
// width: PropTypes.number,
|
|
143
|
+
height: _propTypes["default"].number,
|
|
144
|
+
colorType: _propTypes["default"].oneOf(['gradient', 'normal']),
|
|
145
|
+
theme: _propTypes["default"].oneOf(['light', 'dark']),
|
|
146
|
+
type: _propTypes["default"].oneOf(['pie', 'donut', 'donutThin'])
|
|
174
147
|
};
|
|
175
|
-
|
|
176
148
|
PieChart.defaultProps = {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
149
|
+
data: {
|
|
150
|
+
"name": "Archieve",
|
|
151
|
+
"total": 0,
|
|
152
|
+
"values": [{
|
|
153
|
+
"name": "Archieved",
|
|
154
|
+
"value": "archieved",
|
|
155
|
+
"data": 0,
|
|
156
|
+
"index": 1
|
|
157
|
+
}, {
|
|
158
|
+
"name": "InProcess",
|
|
159
|
+
"value": "inprocess",
|
|
160
|
+
"data": 0,
|
|
161
|
+
"index": 2
|
|
162
|
+
}, {
|
|
163
|
+
"name": "Pending",
|
|
164
|
+
"value": "pending",
|
|
165
|
+
"data": 0,
|
|
166
|
+
"index": 3
|
|
167
|
+
}]
|
|
168
|
+
},
|
|
169
|
+
theme: 'light',
|
|
170
|
+
width: 400,
|
|
171
|
+
height: 400,
|
|
172
|
+
colorType: 'normal',
|
|
173
|
+
type: 'donut'
|
|
202
174
|
};
|
|
203
|
-
|
|
204
|
-
exports.default = PieChart;
|
|
175
|
+
var _default = exports["default"] = PieChart;
|