sag_components 1.0.897 → 1.0.899

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.
@@ -15,6 +15,15 @@ var _PerformanceAnalyticsTotals = require("./PerformanceAnalyticsTotals");
15
15
  var _PerformanceAnalyticsLegend = require("./PerformanceAnalyticsLegend");
16
16
  var _CommonFunctions = require("./CommonFunctions");
17
17
  var _PerformanceAnalytics = require("./PerformanceAnalytics.style");
18
+ /* eslint-disable no-use-before-define */
19
+ /* eslint-disable react/jsx-no-bind */
20
+ /* eslint-disable no-nested-ternary */
21
+ /* eslint-disable camelcase */
22
+ /* eslint-disable react/prop-types */
23
+ /* eslint-disable no-shadow */
24
+ /* eslint-disable no-unsafe-optional-chaining */
25
+ /* eslint-disable react/no-unstable-nested-components */
26
+
18
27
  const INDIVIDUAL_PERFORMANCE_STR = 'Individual Performance';
19
28
  const PERCENT_INCREMENTAL_GROWTH_STR = '% Incremental Growth';
20
29
  const PERCENT_CONTRIBUTION_OF_TOTAL_STR = '% Contribution of Total';
@@ -24,12 +24,13 @@ const SingleBarLineCharts = props => {
24
24
  className,
25
25
  width,
26
26
  height,
27
+ title,
27
28
  barSize,
28
29
  maxRange,
29
30
  barChartHeight,
30
31
  lineChartHeight,
31
32
  showSecondBar,
32
- isLineChartPercent,
33
+ isLineChartCurrency,
33
34
  isLineChartBolded,
34
35
  isTopBarPercent,
35
36
  showPeriod,
@@ -61,7 +62,6 @@ const SingleBarLineCharts = props => {
61
62
  const isSecondBar = payload[0].dataKey === 'secondBarValue';
62
63
  const percentage = isSecondBar ? currentSecondBarValue / totalSecondBarValue * 100 : currentBarValue / totalBarValue * 100;
63
64
  return /*#__PURE__*/_react.default.createElement(_TspanTooltip.default, {
64
- id: "Tooltip",
65
65
  content: `${percentage.toFixed(1)}%`,
66
66
  top: coordinate.y - (isSecondBar ? currentSecondBarValue : currentBarValue),
67
67
  left: coordinate.x,
@@ -174,7 +174,15 @@ const SingleBarLineCharts = props => {
174
174
  fontWeight: isLineChartBolded ? 600 : 400,
175
175
  fontSize: "0.6em",
176
176
  textAnchor: "middle"
177
- }, `${value}${isLineChartPercent ? '%' : ''}`);
177
+ }, `${isLineChartCurrency ? currencySign : ''}${value}`);
178
+ };
179
+ const isNegativeValueFound = () => {
180
+ if (data && data.length > 0) {
181
+ const negativeData = data.filter(item => item.barValue < 0 || item.secondBarValue < 0);
182
+ if (negativeData && negativeData.length > 0) return true;
183
+ return false;
184
+ }
185
+ return false;
178
186
  };
179
187
  return /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.ControlsContainer, {
180
188
  className: className,
@@ -182,7 +190,7 @@ const SingleBarLineCharts = props => {
182
190
  height: height
183
191
  }, (data === null || data === void 0 ? void 0 : data.length) > 0 ? /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.Controls, {
184
192
  className: "Controls"
185
- }, totalsData.length > 0 && /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.LinnerDataBoxWrap, {
193
+ }, title !== '' && /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.Title, null, title), totalsData.length > 0 && /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.LinnerDataBoxWrap, {
186
194
  width: "40%",
187
195
  height: "60px",
188
196
  data: totalsData
@@ -220,15 +228,17 @@ const SingleBarLineCharts = props => {
220
228
  tick: CustomizedTickBarChart,
221
229
  tickLine: false,
222
230
  height: 120,
223
- stroke: "#D0D0D0",
224
- fill: "#212121",
225
- allowDataOverflow: true
231
+ stroke: isNegativeValueFound() === true ? '#D0D0D0' : '#000',
232
+ fill: "#212121"
226
233
  }), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
227
234
  type: "number",
228
235
  width: 0,
229
236
  display: "none",
230
- domain: [0, dataMax => dataMax * maxRange],
237
+ domain: ['auto', dataMax => dataMax * maxRange],
231
238
  allowDataOverflow: true
239
+ }), /*#__PURE__*/_react.default.createElement(_recharts.ReferenceLine, {
240
+ y: 0,
241
+ stroke: "#D0D0D0"
232
242
  }), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
233
243
  dataKey: "barValue",
234
244
  barSize: barSize !== null && barSize !== void 0 ? barSize : 60,
@@ -263,12 +273,13 @@ exports.SingleBarLineCharts = SingleBarLineCharts;
263
273
  var _default = exports.default = SingleBarLineCharts;
264
274
  SingleBarLineCharts.defaultProps = {
265
275
  className: '',
276
+ title: '',
266
277
  width: '100%',
267
278
  height: '100%',
268
279
  barSize: 60,
269
280
  barChartHeight: 250,
270
281
  lineChartHeight: 50,
271
- isLineChartPercent: false,
282
+ isLineChartCurrency: false,
272
283
  isLineChartBolded: false,
273
284
  isTopBarPercent: true,
274
285
  maxRange: 1,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.SegmentedButtonContainer = exports.LinnerDataBoxWrap = exports.LabelText = exports.LabelBoldText = exports.ControlsContainer = exports.Controls = void 0;
7
+ exports.Title = exports.SegmentedButtonContainer = exports.LinnerDataBoxWrap = exports.LabelText = exports.LabelBoldText = exports.ControlsContainer = exports.Controls = void 0;
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  var _LinnerDataBox = require("./LinnerDataBox");
10
10
  const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
@@ -26,6 +26,13 @@ const ControlsContainer = exports.ControlsContainer = _styledComponents.default.
26
26
  box-sizing: border-box;
27
27
  }
28
28
  `;
29
+ const Title = exports.Title = _styledComponents.default.span`
30
+ color: black;
31
+ display: inline-block;
32
+ font-size: 18px;
33
+ font-weight: 400;
34
+ margin-bottom: 12px;
35
+ `;
29
36
  const Controls = exports.Controls = _styledComponents.default.div`
30
37
  width: 100%;
31
38
  height: 100%;
@@ -12,7 +12,7 @@ const TooltipContainer = exports.TooltipContainer = _styledComponents.default.di
12
12
  --tooltip-margin: 40px;
13
13
  --tooltip-arrow-size: 10px;
14
14
  position: absolute;
15
- z-index: 9999;
15
+ z-index: 999999;
16
16
  top: ${props => props.top};
17
17
  left: ${props => props.left};
18
18
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.897",
3
+ "version": "1.0.899",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {