carbon-addons-iot-react 2.149.0-next.45 → 2.149.0-next.46
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 +22 -0
- package/css/carbon-addons-iot-react.css +43 -0
- package/css/carbon-addons-iot-react.css.map +1 -1
- package/es/components/Card/Card.js +58 -11
- package/es/components/Card/CardTypeContent.js +162 -0
- package/es/components/MeterChartCard/MeterChartCard.js +126 -0
- package/es/components/SparklineChartCard/SparklineChartCard.js +120 -0
- package/es/components/StackedAreaChartCard/StackedAreaChartCard.js +125 -0
- package/es/constants/CardPropTypes.js +56 -1
- package/es/constants/ChartPropTypes.js +79 -0
- package/es/constants/LayoutConstants.js +4 -1
- package/es/index.js +4 -0
- package/es/utils/cardTypeUtilityFunctions.js +103 -0
- package/lib/components/Card/Card.js +57 -10
- package/lib/components/Card/CardTypeContent.js +172 -0
- package/lib/components/MeterChartCard/MeterChartCard.js +135 -0
- package/lib/components/SparklineChartCard/SparklineChartCard.js +129 -0
- package/lib/components/StackedAreaChartCard/StackedAreaChartCard.js +134 -0
- package/lib/constants/CardPropTypes.js +58 -0
- package/lib/constants/ChartPropTypes.js +91 -0
- package/lib/constants/LayoutConstants.js +4 -1
- package/lib/css/carbon-addons-iot-react.css +43 -0
- package/lib/css/carbon-addons-iot-react.css.map +1 -1
- package/lib/index.js +25 -0
- package/lib/scss/components/MeterChartCard/_meter-chart-card.scss +14 -0
- package/lib/scss/components/SparklineChartCard/_sparkline-chart-card.scss +30 -0
- package/lib/scss/components/StackedAreaChartCard/_stacked-area-chart-card.scss +6 -0
- package/lib/scss/styles.scss +3 -0
- package/lib/utils/cardTypeUtilityFunctions.js +112 -0
- package/package.json +2 -2
- package/scss/components/MeterChartCard/_meter-chart-card.scss +14 -0
- package/scss/components/SparklineChartCard/_sparkline-chart-card.scss +30 -0
- package/scss/components/StackedAreaChartCard/_stacked-area-chart-card.scss +6 -0
- package/scss/styles.scss +3 -0
- package/umd/carbon-addons-iot-react.js +2296 -1566
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
5
|
+
var defaultsDeep = require('../../node_modules/lodash-es/defaultsDeep.js');
|
|
6
|
+
require('core-js/modules/es.array.concat.js');
|
|
7
|
+
require('core-js/modules/es.array.map.js');
|
|
8
|
+
require('core-js/modules/es.regexp.exec.js');
|
|
9
|
+
require('core-js/modules/es.string.replace.js');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var PropTypes = require('prop-types');
|
|
12
|
+
var classnames = require('classnames');
|
|
13
|
+
var LayoutConstants = require('../../constants/LayoutConstants.js');
|
|
14
|
+
var ChartPropTypes = require('../../constants/ChartPropTypes.js');
|
|
15
|
+
var Settings = require('../../constants/Settings.js');
|
|
16
|
+
var cardTypeUtilityFunctions = require('../../utils/cardTypeUtilityFunctions.js');
|
|
17
|
+
var chartsReact = require('@carbon/charts-react');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
22
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
24
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
26
|
+
|
|
27
|
+
var iotPrefix = Settings.settings.iotPrefix;
|
|
28
|
+
var propTypes = {
|
|
29
|
+
testId: PropTypes__default['default'].string,
|
|
30
|
+
isExpanded: PropTypes__default['default'].bool,
|
|
31
|
+
type: PropTypes__default['default'].oneOf([LayoutConstants.CARD_TYPES.METER_CHART, LayoutConstants.CARD_TYPES.SPARKLINE_CHART, LayoutConstants.CARD_TYPES.STACKED_AREA_CHART]).isRequired,
|
|
32
|
+
data: PropTypes__default['default'].oneOf([ChartPropTypes.MeterChartPropTypes.data, ChartPropTypes.SparklineChartPropTypes.data]),
|
|
33
|
+
content: PropTypes__default['default'].oneOf([ChartPropTypes.MeterChartPropTypes.content, ChartPropTypes.SparklineChartPropTypes.content])
|
|
34
|
+
};
|
|
35
|
+
var defaultProps = {
|
|
36
|
+
testId: 'cart-type-content',
|
|
37
|
+
isExpanded: false,
|
|
38
|
+
data: [],
|
|
39
|
+
content: null
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var CardTypeContent = function CardTypeContent(_ref) {
|
|
43
|
+
var _listRef$current2, _content$listContent, _contentWithDefaults$;
|
|
44
|
+
|
|
45
|
+
var testId = _ref.testId,
|
|
46
|
+
isExpanded = _ref.isExpanded,
|
|
47
|
+
type = _ref.type,
|
|
48
|
+
data = _ref.data,
|
|
49
|
+
content = _ref.content;
|
|
50
|
+
var listRef = React.useRef(null);
|
|
51
|
+
|
|
52
|
+
var _useState = React.useState(),
|
|
53
|
+
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
54
|
+
listHeight = _useState2[0],
|
|
55
|
+
setListHeight = _useState2[1];
|
|
56
|
+
|
|
57
|
+
var contentWithDefaults = React.useMemo(function () {
|
|
58
|
+
return defaultsDeep({}, content, defaultProps.content);
|
|
59
|
+
}, [content]);
|
|
60
|
+
var options = cardTypeUtilityFunctions.getChartOptions(type, data.length > 1, contentWithDefaults);
|
|
61
|
+
React.useEffect(function () {
|
|
62
|
+
var _listRef$current;
|
|
63
|
+
|
|
64
|
+
setListHeight((_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.clientHeight);
|
|
65
|
+
}, [(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.clientHeight]);
|
|
66
|
+
var Chart = type === LayoutConstants.CARD_TYPES.METER_CHART ? chartsReact.MeterChart : type === LayoutConstants.CARD_TYPES.SPARKLINE_CHART ? chartsReact.AreaChart : type === LayoutConstants.CARD_TYPES.STACKED_AREA_CHART ? chartsReact.StackedAreaChart : null;
|
|
67
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
68
|
+
className: classnames__default['default']("".concat(iotPrefix, "--").concat(type.replaceAll('_', '-').toLowerCase(), "--wrapper"), _defineProperty__default['default']({}, "".concat(iotPrefix, "--").concat(type.replaceAll('_', '-').toLowerCase(), "--wrapper__expanded"), isExpanded)),
|
|
69
|
+
style: {
|
|
70
|
+
'--card-list-height': ((_content$listContent = content.listContent) === null || _content$listContent === void 0 ? void 0 : _content$listContent.length) > 0 ? "".concat(listHeight, "px") : '0px'
|
|
71
|
+
}
|
|
72
|
+
}, /*#__PURE__*/React__default['default'].createElement(Chart, {
|
|
73
|
+
data: data,
|
|
74
|
+
options: options
|
|
75
|
+
}), ((_contentWithDefaults$ = contentWithDefaults.listContent) === null || _contentWithDefaults$ === void 0 ? void 0 : _contentWithDefaults$.length) > 0 ? /*#__PURE__*/React__default['default'].createElement("div", {
|
|
76
|
+
ref: listRef,
|
|
77
|
+
"data-testid": "".concat(testId, "-list")
|
|
78
|
+
}, contentWithDefaults.listContent.map(function (_ref2) {
|
|
79
|
+
var label = _ref2.label,
|
|
80
|
+
value = _ref2.value;
|
|
81
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
82
|
+
className: "".concat(iotPrefix, "--").concat(type.replace('_', '-').toLowerCase(), "--wrapper--list")
|
|
83
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", null, label), /*#__PURE__*/React__default['default'].createElement("span", null, value));
|
|
84
|
+
})) : null);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
CardTypeContent.propTypes = propTypes;
|
|
88
|
+
CardTypeContent.defaultProps = defaultProps;
|
|
89
|
+
CardTypeContent.__docgenInfo = {
|
|
90
|
+
"description": "",
|
|
91
|
+
"methods": [],
|
|
92
|
+
"displayName": "CardTypeContent",
|
|
93
|
+
"props": {
|
|
94
|
+
"testId": {
|
|
95
|
+
"defaultValue": {
|
|
96
|
+
"value": "'cart-type-content'",
|
|
97
|
+
"computed": false
|
|
98
|
+
},
|
|
99
|
+
"type": {
|
|
100
|
+
"name": "string"
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"description": ""
|
|
104
|
+
},
|
|
105
|
+
"isExpanded": {
|
|
106
|
+
"defaultValue": {
|
|
107
|
+
"value": "false",
|
|
108
|
+
"computed": false
|
|
109
|
+
},
|
|
110
|
+
"type": {
|
|
111
|
+
"name": "bool"
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"description": ""
|
|
115
|
+
},
|
|
116
|
+
"data": {
|
|
117
|
+
"defaultValue": {
|
|
118
|
+
"value": "[]",
|
|
119
|
+
"computed": false
|
|
120
|
+
},
|
|
121
|
+
"type": {
|
|
122
|
+
"name": "enum",
|
|
123
|
+
"value": [{
|
|
124
|
+
"value": "MeterChartPropTypes.data",
|
|
125
|
+
"computed": true
|
|
126
|
+
}, {
|
|
127
|
+
"value": "SparklineChartPropTypes.data",
|
|
128
|
+
"computed": true
|
|
129
|
+
}]
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"description": ""
|
|
133
|
+
},
|
|
134
|
+
"content": {
|
|
135
|
+
"defaultValue": {
|
|
136
|
+
"value": "null",
|
|
137
|
+
"computed": false
|
|
138
|
+
},
|
|
139
|
+
"type": {
|
|
140
|
+
"name": "enum",
|
|
141
|
+
"value": [{
|
|
142
|
+
"value": "MeterChartPropTypes.content",
|
|
143
|
+
"computed": true
|
|
144
|
+
}, {
|
|
145
|
+
"value": "SparklineChartPropTypes.content",
|
|
146
|
+
"computed": true
|
|
147
|
+
}]
|
|
148
|
+
},
|
|
149
|
+
"required": false,
|
|
150
|
+
"description": ""
|
|
151
|
+
},
|
|
152
|
+
"type": {
|
|
153
|
+
"type": {
|
|
154
|
+
"name": "enum",
|
|
155
|
+
"value": [{
|
|
156
|
+
"value": "CARD_TYPES.METER_CHART",
|
|
157
|
+
"computed": true
|
|
158
|
+
}, {
|
|
159
|
+
"value": "CARD_TYPES.SPARKLINE_CHART",
|
|
160
|
+
"computed": true
|
|
161
|
+
}, {
|
|
162
|
+
"value": "CARD_TYPES.STACKED_AREA_CHART",
|
|
163
|
+
"computed": true
|
|
164
|
+
}]
|
|
165
|
+
},
|
|
166
|
+
"required": true,
|
|
167
|
+
"description": ""
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
module.exports = CardTypeContent;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.object.keys.js');
|
|
4
|
+
require('core-js/modules/es.symbol.js');
|
|
5
|
+
require('core-js/modules/es.array.filter.js');
|
|
6
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
7
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
8
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
9
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
10
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
require('core-js/modules/es.array.iterator.js');
|
|
13
|
+
require('core-js/modules/es.object.to-string.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
15
|
+
var React = require('react');
|
|
16
|
+
var LayoutConstants = require('../../constants/LayoutConstants.js');
|
|
17
|
+
var CardPropTypes = require('../../constants/CardPropTypes.js');
|
|
18
|
+
var Card = require('../Card/Card.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
23
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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__default['default'](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; }
|
|
30
|
+
|
|
31
|
+
var propTypes = _objectSpread(_objectSpread({}, CardPropTypes.CardPropTypes), CardPropTypes.MeterChartCardPropTypes);
|
|
32
|
+
|
|
33
|
+
var defaultProps = {
|
|
34
|
+
size: LayoutConstants.CARD_SIZES.MEDIUMWIDE,
|
|
35
|
+
title: '',
|
|
36
|
+
content: {
|
|
37
|
+
peak: null,
|
|
38
|
+
meterTotal: 100,
|
|
39
|
+
meterUnit: 'Unit',
|
|
40
|
+
legendPosition: 'bottom',
|
|
41
|
+
color: {
|
|
42
|
+
pairing: {
|
|
43
|
+
option: 2
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
footerContent: null,
|
|
48
|
+
locale: 'en',
|
|
49
|
+
values: []
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var MeterChartCard = function MeterChartCard(_ref) {
|
|
53
|
+
var title = _ref.title,
|
|
54
|
+
content = _ref.content,
|
|
55
|
+
values = _ref.values,
|
|
56
|
+
size = _ref.size,
|
|
57
|
+
breakpoint = _ref.breakpoint,
|
|
58
|
+
footerContent = _ref.footerContent,
|
|
59
|
+
locale = _ref.locale,
|
|
60
|
+
isExpanded = _ref.isExpanded,
|
|
61
|
+
isLoading = _ref.isLoading,
|
|
62
|
+
testId = _ref.testId,
|
|
63
|
+
i18n = _ref.i18n,
|
|
64
|
+
others = _objectWithoutProperties__default['default'](_ref, ["title", "content", "values", "size", "breakpoint", "footerContent", "locale", "isExpanded", "isLoading", "testId", "i18n"]);
|
|
65
|
+
|
|
66
|
+
return /*#__PURE__*/React__default['default'].createElement(Card['default'], _extends__default['default']({
|
|
67
|
+
title: title,
|
|
68
|
+
size: size,
|
|
69
|
+
breakpoint: breakpoint,
|
|
70
|
+
locale: locale,
|
|
71
|
+
isExpanded: isExpanded,
|
|
72
|
+
isLoading: isLoading,
|
|
73
|
+
testId: testId,
|
|
74
|
+
footerContent: !isExpanded ? footerContent : null,
|
|
75
|
+
i18n: i18n,
|
|
76
|
+
data: values,
|
|
77
|
+
type: LayoutConstants.CARD_TYPES.METER_CHART,
|
|
78
|
+
content: content
|
|
79
|
+
}, others));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
MeterChartCard.propTypes = propTypes;
|
|
83
|
+
MeterChartCard.defaultProps = defaultProps;
|
|
84
|
+
MeterChartCard.__docgenInfo = {
|
|
85
|
+
"description": "",
|
|
86
|
+
"methods": [],
|
|
87
|
+
"displayName": "MeterChartCard",
|
|
88
|
+
"props": {
|
|
89
|
+
"size": {
|
|
90
|
+
"defaultValue": {
|
|
91
|
+
"value": "CARD_SIZES.MEDIUMWIDE",
|
|
92
|
+
"computed": true
|
|
93
|
+
},
|
|
94
|
+
"required": false
|
|
95
|
+
},
|
|
96
|
+
"title": {
|
|
97
|
+
"defaultValue": {
|
|
98
|
+
"value": "''",
|
|
99
|
+
"computed": false
|
|
100
|
+
},
|
|
101
|
+
"required": false
|
|
102
|
+
},
|
|
103
|
+
"content": {
|
|
104
|
+
"defaultValue": {
|
|
105
|
+
"value": "{\n peak: null,\n meterTotal: 100,\n meterUnit: 'Unit',\n legendPosition: 'bottom',\n color: {\n pairing: {\n option: 2,\n },\n },\n}",
|
|
106
|
+
"computed": false
|
|
107
|
+
},
|
|
108
|
+
"required": false
|
|
109
|
+
},
|
|
110
|
+
"footerContent": {
|
|
111
|
+
"defaultValue": {
|
|
112
|
+
"value": "null",
|
|
113
|
+
"computed": false
|
|
114
|
+
},
|
|
115
|
+
"required": false
|
|
116
|
+
},
|
|
117
|
+
"locale": {
|
|
118
|
+
"defaultValue": {
|
|
119
|
+
"value": "'en'",
|
|
120
|
+
"computed": false
|
|
121
|
+
},
|
|
122
|
+
"required": false
|
|
123
|
+
},
|
|
124
|
+
"values": {
|
|
125
|
+
"defaultValue": {
|
|
126
|
+
"value": "[]",
|
|
127
|
+
"computed": false
|
|
128
|
+
},
|
|
129
|
+
"required": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"composes": ["../../constants/CardPropTypes"]
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = MeterChartCard;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.object.keys.js');
|
|
4
|
+
require('core-js/modules/es.symbol.js');
|
|
5
|
+
require('core-js/modules/es.array.filter.js');
|
|
6
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
7
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
8
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
9
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
10
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
require('core-js/modules/es.array.iterator.js');
|
|
13
|
+
require('core-js/modules/es.object.to-string.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
15
|
+
var React = require('react');
|
|
16
|
+
var Card = require('../Card/Card.js');
|
|
17
|
+
var LayoutConstants = require('../../constants/LayoutConstants.js');
|
|
18
|
+
var CardPropTypes = require('../../constants/CardPropTypes.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
23
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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__default['default'](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; }
|
|
30
|
+
|
|
31
|
+
var propTypes = _objectSpread(_objectSpread({}, CardPropTypes.CardPropTypes), CardPropTypes.SparklineChartCardPropTypes);
|
|
32
|
+
|
|
33
|
+
var defaultProps = {
|
|
34
|
+
size: LayoutConstants.CARD_SIZES.MEDIUMWIDE,
|
|
35
|
+
title: null,
|
|
36
|
+
content: {
|
|
37
|
+
xLabel: 'x label',
|
|
38
|
+
yLabel: 'y label'
|
|
39
|
+
},
|
|
40
|
+
footerContent: null,
|
|
41
|
+
locale: 'en',
|
|
42
|
+
values: []
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var SparklineChartCard = function SparklineChartCard(_ref) {
|
|
46
|
+
var title = _ref.title,
|
|
47
|
+
values = _ref.values,
|
|
48
|
+
content = _ref.content,
|
|
49
|
+
size = _ref.size,
|
|
50
|
+
breakpoint = _ref.breakpoint,
|
|
51
|
+
locale = _ref.locale,
|
|
52
|
+
isLoading = _ref.isLoading,
|
|
53
|
+
testId = _ref.testId,
|
|
54
|
+
footerContent = _ref.footerContent,
|
|
55
|
+
isExpanded = _ref.isExpanded,
|
|
56
|
+
i18n = _ref.i18n;
|
|
57
|
+
_ref.style;
|
|
58
|
+
var others = _objectWithoutProperties__default['default'](_ref, ["title", "values", "content", "size", "breakpoint", "locale", "isLoading", "testId", "footerContent", "isExpanded", "i18n", "style"]);
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/React__default['default'].createElement(Card['default'], _extends__default['default']({
|
|
61
|
+
title: title,
|
|
62
|
+
size: size,
|
|
63
|
+
breakpoint: breakpoint,
|
|
64
|
+
locale: locale,
|
|
65
|
+
isExpanded: isExpanded,
|
|
66
|
+
isLoading: isLoading,
|
|
67
|
+
testId: testId,
|
|
68
|
+
footerContent: !isExpanded ? footerContent : null,
|
|
69
|
+
i18n: i18n,
|
|
70
|
+
data: values,
|
|
71
|
+
type: LayoutConstants.CARD_TYPES.SPARKLINE_CHART,
|
|
72
|
+
content: content
|
|
73
|
+
}, others));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
SparklineChartCard.propTypes = propTypes;
|
|
77
|
+
SparklineChartCard.defaultProps = defaultProps;
|
|
78
|
+
SparklineChartCard.__docgenInfo = {
|
|
79
|
+
"description": "",
|
|
80
|
+
"methods": [],
|
|
81
|
+
"displayName": "SparklineChartCard",
|
|
82
|
+
"props": {
|
|
83
|
+
"size": {
|
|
84
|
+
"defaultValue": {
|
|
85
|
+
"value": "CARD_SIZES.MEDIUMWIDE",
|
|
86
|
+
"computed": true
|
|
87
|
+
},
|
|
88
|
+
"required": false
|
|
89
|
+
},
|
|
90
|
+
"title": {
|
|
91
|
+
"defaultValue": {
|
|
92
|
+
"value": "null",
|
|
93
|
+
"computed": false
|
|
94
|
+
},
|
|
95
|
+
"required": false
|
|
96
|
+
},
|
|
97
|
+
"content": {
|
|
98
|
+
"defaultValue": {
|
|
99
|
+
"value": "{\n xLabel: 'x label',\n yLabel: 'y label',\n}",
|
|
100
|
+
"computed": false
|
|
101
|
+
},
|
|
102
|
+
"required": false
|
|
103
|
+
},
|
|
104
|
+
"footerContent": {
|
|
105
|
+
"defaultValue": {
|
|
106
|
+
"value": "null",
|
|
107
|
+
"computed": false
|
|
108
|
+
},
|
|
109
|
+
"required": false
|
|
110
|
+
},
|
|
111
|
+
"locale": {
|
|
112
|
+
"defaultValue": {
|
|
113
|
+
"value": "'en'",
|
|
114
|
+
"computed": false
|
|
115
|
+
},
|
|
116
|
+
"required": false
|
|
117
|
+
},
|
|
118
|
+
"values": {
|
|
119
|
+
"defaultValue": {
|
|
120
|
+
"value": "[]",
|
|
121
|
+
"computed": false
|
|
122
|
+
},
|
|
123
|
+
"required": false
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"composes": ["../../constants/CardPropTypes"]
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
module.exports = SparklineChartCard;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.object.keys.js');
|
|
4
|
+
require('core-js/modules/es.symbol.js');
|
|
5
|
+
require('core-js/modules/es.array.filter.js');
|
|
6
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
7
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
8
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
9
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
10
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
require('core-js/modules/es.array.iterator.js');
|
|
13
|
+
require('core-js/modules/es.object.to-string.js');
|
|
14
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
15
|
+
var React = require('react');
|
|
16
|
+
var Card = require('../Card/Card.js');
|
|
17
|
+
var LayoutConstants = require('../../constants/LayoutConstants.js');
|
|
18
|
+
var CardPropTypes = require('../../constants/CardPropTypes.js');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
23
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
24
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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__default['default'](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; }
|
|
30
|
+
|
|
31
|
+
var propTypes = _objectSpread(_objectSpread({}, CardPropTypes.CardPropTypes), CardPropTypes.StackedAreaChartCardPropTypes);
|
|
32
|
+
|
|
33
|
+
var defaultProps = {
|
|
34
|
+
size: LayoutConstants.CARD_SIZES.MEDIUM,
|
|
35
|
+
title: null,
|
|
36
|
+
testId: 'stacked-area-chart-testId',
|
|
37
|
+
content: {
|
|
38
|
+
xLabel: 'x label',
|
|
39
|
+
yLabel: 'y label',
|
|
40
|
+
pairing: {
|
|
41
|
+
option: 1
|
|
42
|
+
},
|
|
43
|
+
legendPosition: 'bottom',
|
|
44
|
+
curve: 'curveMonotoneX'
|
|
45
|
+
},
|
|
46
|
+
locale: 'en',
|
|
47
|
+
values: []
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var StackedAreaChartCard = function StackedAreaChartCard(_ref) {
|
|
51
|
+
var title = _ref.title,
|
|
52
|
+
values = _ref.values,
|
|
53
|
+
content = _ref.content,
|
|
54
|
+
size = _ref.size,
|
|
55
|
+
breakpoint = _ref.breakpoint,
|
|
56
|
+
locale = _ref.locale,
|
|
57
|
+
isLoading = _ref.isLoading,
|
|
58
|
+
testId = _ref.testId,
|
|
59
|
+
footerContent = _ref.footerContent,
|
|
60
|
+
isExpanded = _ref.isExpanded,
|
|
61
|
+
i18n = _ref.i18n;
|
|
62
|
+
_ref.style;
|
|
63
|
+
var others = _objectWithoutProperties__default['default'](_ref, ["title", "values", "content", "size", "breakpoint", "locale", "isLoading", "testId", "footerContent", "isExpanded", "i18n", "style"]);
|
|
64
|
+
|
|
65
|
+
return /*#__PURE__*/React__default['default'].createElement(Card['default'], _extends__default['default']({
|
|
66
|
+
title: title,
|
|
67
|
+
size: size,
|
|
68
|
+
breakpoint: breakpoint,
|
|
69
|
+
locale: locale,
|
|
70
|
+
isExpanded: isExpanded,
|
|
71
|
+
isLoading: isLoading,
|
|
72
|
+
testId: testId,
|
|
73
|
+
footerContent: !isExpanded ? footerContent : null,
|
|
74
|
+
i18n: i18n,
|
|
75
|
+
data: values,
|
|
76
|
+
type: LayoutConstants.CARD_TYPES.STACKED_AREA_CHART,
|
|
77
|
+
content: content
|
|
78
|
+
}, others));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
StackedAreaChartCard.propTypes = propTypes;
|
|
82
|
+
StackedAreaChartCard.defaultProps = defaultProps;
|
|
83
|
+
StackedAreaChartCard.__docgenInfo = {
|
|
84
|
+
"description": "",
|
|
85
|
+
"methods": [],
|
|
86
|
+
"displayName": "StackedAreaChartCard",
|
|
87
|
+
"props": {
|
|
88
|
+
"size": {
|
|
89
|
+
"defaultValue": {
|
|
90
|
+
"value": "CARD_SIZES.MEDIUM",
|
|
91
|
+
"computed": true
|
|
92
|
+
},
|
|
93
|
+
"required": false
|
|
94
|
+
},
|
|
95
|
+
"title": {
|
|
96
|
+
"defaultValue": {
|
|
97
|
+
"value": "null",
|
|
98
|
+
"computed": false
|
|
99
|
+
},
|
|
100
|
+
"required": false
|
|
101
|
+
},
|
|
102
|
+
"testId": {
|
|
103
|
+
"defaultValue": {
|
|
104
|
+
"value": "'stacked-area-chart-testId'",
|
|
105
|
+
"computed": false
|
|
106
|
+
},
|
|
107
|
+
"required": false
|
|
108
|
+
},
|
|
109
|
+
"content": {
|
|
110
|
+
"defaultValue": {
|
|
111
|
+
"value": "{\n xLabel: 'x label',\n yLabel: 'y label',\n pairing: {\n option: 1,\n },\n legendPosition: 'bottom',\n curve: 'curveMonotoneX',\n}",
|
|
112
|
+
"computed": false
|
|
113
|
+
},
|
|
114
|
+
"required": false
|
|
115
|
+
},
|
|
116
|
+
"locale": {
|
|
117
|
+
"defaultValue": {
|
|
118
|
+
"value": "'en'",
|
|
119
|
+
"computed": false
|
|
120
|
+
},
|
|
121
|
+
"required": false
|
|
122
|
+
},
|
|
123
|
+
"values": {
|
|
124
|
+
"defaultValue": {
|
|
125
|
+
"value": "[]",
|
|
126
|
+
"computed": false
|
|
127
|
+
},
|
|
128
|
+
"required": false
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"composes": ["../../constants/CardPropTypes"]
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
module.exports = StackedAreaChartCard;
|
|
@@ -17,6 +17,7 @@ var deprecate = require('../internal/deprecate.js');
|
|
|
17
17
|
var DateTimePickerV2 = require('../components/DateTimePicker/DateTimePickerV2.js');
|
|
18
18
|
var LayoutConstants = require('./LayoutConstants.js');
|
|
19
19
|
var SharedPropTypes = require('./SharedPropTypes.js');
|
|
20
|
+
var ChartPropTypes = require('./ChartPropTypes.js');
|
|
20
21
|
|
|
21
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
23
|
|
|
@@ -670,6 +671,60 @@ var MapCardPropTypes = {
|
|
|
670
671
|
/** the ref used needed by a drag and drop library like react-dnd. Is added to the map container element. */
|
|
671
672
|
dropRef: PropTypes__default['default'].oneOfType([PropTypes__default['default'].shape({}), PropTypes__default['default'].func])
|
|
672
673
|
};
|
|
674
|
+
var MeterChartCardPropTypes = {
|
|
675
|
+
content: ChartPropTypes.MeterChartPropTypes.content,
|
|
676
|
+
values: ChartPropTypes.MeterChartPropTypes.data,
|
|
677
|
+
size: function size(props, propName, componentName) {
|
|
678
|
+
var error;
|
|
679
|
+
|
|
680
|
+
if (!Object.keys(LayoutConstants.CARD_SIZES).includes(props[propName])) {
|
|
681
|
+
error = new Error("`".concat(componentName, "` prop `").concat(propName, "` must be one of ").concat(Object.keys(LayoutConstants.CARD_SIZES).join(','), "."));
|
|
682
|
+
} // If the size
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
if (props[propName] === LayoutConstants.CARD_SIZES.SMALL || props[propName] === LayoutConstants.CARD_SIZES.SMALLWIDE || props[propName] === LayoutConstants.CARD_SIZES.SMALLFULL || props[propName] === LayoutConstants.CARD_SIZES.MEDIUMTHIN) {
|
|
686
|
+
error = new Error("Deprecation notice: `".concat(componentName, "` prop `").concat(propName, "` cannot be `").concat(props[propName], "` as the charts will not render correctly. Minimum size is `MEDIUM`"));
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
return error;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
var SparklineChartCardPropTypes = {
|
|
693
|
+
content: ChartPropTypes.SparklineChartPropTypes.content,
|
|
694
|
+
values: ChartPropTypes.SparklineChartPropTypes.data,
|
|
695
|
+
size: function size(props, propName, componentName) {
|
|
696
|
+
var error;
|
|
697
|
+
|
|
698
|
+
if (!Object.keys(LayoutConstants.CARD_SIZES).includes(props[propName])) {
|
|
699
|
+
error = new Error("`".concat(componentName, "` prop `").concat(propName, "` must be one of ").concat(Object.keys(LayoutConstants.CARD_SIZES).join(','), "."));
|
|
700
|
+
} // If the size
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
if (props[propName] === LayoutConstants.CARD_SIZES.SMALL || props[propName] === LayoutConstants.CARD_SIZES.SMALLWIDE || props[propName] === LayoutConstants.CARD_SIZES.SMALLFULL || props[propName] === LayoutConstants.CARD_SIZES.MEDIUMTHIN) {
|
|
704
|
+
error = new Error("Deprecation notice: `".concat(componentName, "` prop `").concat(propName, "` cannot be `").concat(props[propName], "` as the charts will not render correctly. Minimum size is `MEDIUM`"));
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return error;
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
var StackedAreaChartCardPropTypes = {
|
|
711
|
+
content: ChartPropTypes.StackedAreaChartPropTypes.content,
|
|
712
|
+
values: ChartPropTypes.StackedAreaChartPropTypes.data,
|
|
713
|
+
size: function size(props, propName, componentName) {
|
|
714
|
+
var error;
|
|
715
|
+
|
|
716
|
+
if (!Object.keys(LayoutConstants.CARD_SIZES).includes(props[propName])) {
|
|
717
|
+
error = new Error("`".concat(componentName, "` prop `").concat(propName, "` must be one of ").concat(Object.keys(LayoutConstants.CARD_SIZES).join(','), "."));
|
|
718
|
+
} // If the size
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
if (props[propName] === LayoutConstants.CARD_SIZES.SMALL || props[propName] === LayoutConstants.CARD_SIZES.SMALLWIDE || props[propName] === LayoutConstants.CARD_SIZES.SMALLFULL || props[propName] === LayoutConstants.CARD_SIZES.MEDIUMTHIN) {
|
|
722
|
+
error = new Error("Deprecation notice: `".concat(componentName, "` prop `").concat(propName, "` cannot be `").concat(props[propName], "` as the charts will not render correctly. Minimum size is `MEDIUM`"));
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return error;
|
|
726
|
+
}
|
|
727
|
+
};
|
|
673
728
|
var DATE_PICKER_OPTIONS = {
|
|
674
729
|
ICON_ONLY: 'iconOnly',
|
|
675
730
|
FULL: 'full'
|
|
@@ -862,8 +917,11 @@ exports.ImageCardPropTypes = ImageCardPropTypes;
|
|
|
862
917
|
exports.ImageCardValuesPropType = ImageCardValuesPropType;
|
|
863
918
|
exports.MapCardPropTypes = MapCardPropTypes;
|
|
864
919
|
exports.MapControlPropType = MapControlPropType;
|
|
920
|
+
exports.MeterChartCardPropTypes = MeterChartCardPropTypes;
|
|
865
921
|
exports.PieCardPropTypes = PieCardPropTypes;
|
|
866
922
|
exports.RowHeightPropTypes = RowHeightPropTypes;
|
|
923
|
+
exports.SparklineChartCardPropTypes = SparklineChartCardPropTypes;
|
|
924
|
+
exports.StackedAreaChartCardPropTypes = StackedAreaChartCardPropTypes;
|
|
867
925
|
exports.TableCardPropTypes = TableCardPropTypes;
|
|
868
926
|
exports.TimeRangeOptionsPropTypes = TimeRangeOptionsPropTypes;
|
|
869
927
|
exports.TruncationPropTypes = TruncationPropTypes;
|