sag_components 2.0.0-beta70 → 2.0.0-beta71
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/dist/index.esm.js +742 -685
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +741 -684
- package/dist/index.js.map +1 -1
- package/dist/types/components/BrushChart/BrushChart.style.d.ts +38 -0
- package/dist/types/components/BrushChart/Charts/BarLine.d.ts +2 -4
- package/dist/types/components/BrushChart/Charts/InnerBar.d.ts +2 -3
- package/dist/types/components/BrushChart/Charts/SingleChart.d.ts +2 -5
- package/dist/types/utils/CommonFunctions.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import styled, { keyframes, css } from 'styled-components';
|
|
3
|
-
import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip as Tooltip$2, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Bar, LabelList, ReferenceLine, Brush, LineChart, Line, AreaChart as AreaChart$1, Legend, Area, ScatterChart, ZAxis, Scatter
|
|
3
|
+
import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip as Tooltip$2, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Bar, LabelList, ReferenceLine, Brush, LineChart, Line, AreaChart as AreaChart$1, Legend, Area, ScatterChart, ZAxis, Scatter } from 'recharts';
|
|
4
4
|
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
|
|
5
5
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
6
|
|
|
@@ -1682,6 +1682,12 @@ const getCurrencySign = (currencyTypeToConvert, value) => {
|
|
|
1682
1682
|
currencySign = currencyFormatter.format(Math.abs(value)).substring(0, 1);
|
|
1683
1683
|
return currencySign;
|
|
1684
1684
|
};
|
|
1685
|
+
const getMaxCharsPerLine = len => {
|
|
1686
|
+
if (len <= 20) return 20; // 1‒10 items
|
|
1687
|
+
if (len <= 40) return 15; // 1‒40 items
|
|
1688
|
+
if (len <= 80) return 10; // 41‒80 items
|
|
1689
|
+
return 5; // 81+ items
|
|
1690
|
+
};
|
|
1685
1691
|
const getFormattedUnits = num => {
|
|
1686
1692
|
if (num === undefined || num === null) {
|
|
1687
1693
|
return '';
|
|
@@ -9480,70 +9486,67 @@ const DropdownMain = styled.div`
|
|
|
9480
9486
|
`;
|
|
9481
9487
|
|
|
9482
9488
|
/* eslint-disable react/prop-types */
|
|
9483
|
-
const DropdownNew =
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
elementType: elementType
|
|
9545
|
-
}));
|
|
9546
|
-
};
|
|
9489
|
+
const DropdownNew = ({
|
|
9490
|
+
isMulti,
|
|
9491
|
+
label,
|
|
9492
|
+
labelEmptyValue,
|
|
9493
|
+
options,
|
|
9494
|
+
selectedValue,
|
|
9495
|
+
placeHolder,
|
|
9496
|
+
onChange,
|
|
9497
|
+
required,
|
|
9498
|
+
disabled,
|
|
9499
|
+
width,
|
|
9500
|
+
error,
|
|
9501
|
+
errorMessage,
|
|
9502
|
+
labelColor,
|
|
9503
|
+
checkBoxColor,
|
|
9504
|
+
xIconShow,
|
|
9505
|
+
showLabelOnTop,
|
|
9506
|
+
orderBy,
|
|
9507
|
+
elementType
|
|
9508
|
+
}) => /*#__PURE__*/React$1.createElement(DropdownMain, {
|
|
9509
|
+
className: "DropdownMain",
|
|
9510
|
+
width: width
|
|
9511
|
+
}, isMulti ? /*#__PURE__*/React$1.createElement(DropdownMultiNew, {
|
|
9512
|
+
className: "DropdownMultiNew",
|
|
9513
|
+
placeHolder: placeHolder,
|
|
9514
|
+
label: label,
|
|
9515
|
+
labelEmptyValue: labelEmptyValue,
|
|
9516
|
+
labelColor: labelColor,
|
|
9517
|
+
checkBoxColor: checkBoxColor,
|
|
9518
|
+
required: required,
|
|
9519
|
+
options: options,
|
|
9520
|
+
width: width,
|
|
9521
|
+
disabled: disabled,
|
|
9522
|
+
error: error,
|
|
9523
|
+
errorMessage: errorMessage,
|
|
9524
|
+
selectedValue: selectedValue,
|
|
9525
|
+
xIconShow: xIconShow,
|
|
9526
|
+
onChange: onChange,
|
|
9527
|
+
showLabelOnTop: showLabelOnTop,
|
|
9528
|
+
orderBy: orderBy,
|
|
9529
|
+
elementType: elementType
|
|
9530
|
+
}) : /*#__PURE__*/React$1.createElement(DropdownSingleNew, {
|
|
9531
|
+
className: "DropdownSingleNew",
|
|
9532
|
+
placeHolder: placeHolder,
|
|
9533
|
+
label: label,
|
|
9534
|
+
labelEmptyValue: labelEmptyValue,
|
|
9535
|
+
labelColor: labelColor,
|
|
9536
|
+
checkBoxColor: checkBoxColor,
|
|
9537
|
+
required: required,
|
|
9538
|
+
options: options,
|
|
9539
|
+
width: width,
|
|
9540
|
+
disabled: disabled,
|
|
9541
|
+
error: error,
|
|
9542
|
+
errorMessage: errorMessage,
|
|
9543
|
+
selectedValue: selectedValue,
|
|
9544
|
+
xIconShow: xIconShow,
|
|
9545
|
+
onChange: onChange,
|
|
9546
|
+
showLabelOnTop: showLabelOnTop,
|
|
9547
|
+
orderBy: orderBy,
|
|
9548
|
+
elementType: elementType
|
|
9549
|
+
}));
|
|
9547
9550
|
DropdownNew.propTypes = {
|
|
9548
9551
|
placeHolder: PropTypes.string,
|
|
9549
9552
|
label: PropTypes.string,
|
|
@@ -9971,21 +9974,20 @@ const DatePicker = ({
|
|
|
9971
9974
|
};
|
|
9972
9975
|
|
|
9973
9976
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
9974
|
-
const RangePicker =
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
} = _ref;
|
|
9977
|
+
const RangePicker = ({
|
|
9978
|
+
label,
|
|
9979
|
+
onChange,
|
|
9980
|
+
borderRadius,
|
|
9981
|
+
required,
|
|
9982
|
+
width,
|
|
9983
|
+
height,
|
|
9984
|
+
placeholder,
|
|
9985
|
+
disabled,
|
|
9986
|
+
borderColor,
|
|
9987
|
+
borderColorFocus,
|
|
9988
|
+
textColor,
|
|
9989
|
+
selectedValue
|
|
9990
|
+
}) => {
|
|
9989
9991
|
const [isFocused, setIsFocused] = useState(false);
|
|
9990
9992
|
const [isOpen, setIsOpen] = useState(false);
|
|
9991
9993
|
const [value, setValue] = useState(''); // Added value state
|
|
@@ -10426,23 +10428,22 @@ const QuarterPopupPicker = ({
|
|
|
10426
10428
|
};
|
|
10427
10429
|
|
|
10428
10430
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10429
|
-
const QuarterPicker =
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
} = _ref;
|
|
10431
|
+
const QuarterPicker = ({
|
|
10432
|
+
availableQuarters,
|
|
10433
|
+
// ["Q1-2024"]
|
|
10434
|
+
label,
|
|
10435
|
+
onChange,
|
|
10436
|
+
borderRadius,
|
|
10437
|
+
required,
|
|
10438
|
+
width,
|
|
10439
|
+
height,
|
|
10440
|
+
placeholder,
|
|
10441
|
+
disabled,
|
|
10442
|
+
borderColor,
|
|
10443
|
+
borderColorFocus,
|
|
10444
|
+
textColor,
|
|
10445
|
+
selectedValue
|
|
10446
|
+
}) => {
|
|
10446
10447
|
const [isFocused, setIsFocused] = useState(false);
|
|
10447
10448
|
const [isOpen, setIsOpen] = useState(false);
|
|
10448
10449
|
const [value, setValue] = useState('');
|
|
@@ -10889,22 +10890,21 @@ const MonthPopupPicker = ({
|
|
|
10889
10890
|
};
|
|
10890
10891
|
|
|
10891
10892
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10892
|
-
const MonthPicker =
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
} = _ref;
|
|
10893
|
+
const MonthPicker = ({
|
|
10894
|
+
availableMonths,
|
|
10895
|
+
label,
|
|
10896
|
+
onChange,
|
|
10897
|
+
borderRadius,
|
|
10898
|
+
required,
|
|
10899
|
+
width,
|
|
10900
|
+
height,
|
|
10901
|
+
placeholder,
|
|
10902
|
+
disabled,
|
|
10903
|
+
borderColor,
|
|
10904
|
+
borderColorFocus,
|
|
10905
|
+
textColor,
|
|
10906
|
+
selectedValue
|
|
10907
|
+
}) => {
|
|
10908
10908
|
const [isFocused, setIsFocused] = useState(false);
|
|
10909
10909
|
const [isOpen, setIsOpen] = useState(false);
|
|
10910
10910
|
const [value, setValue] = useState('');
|
|
@@ -24130,22 +24130,21 @@ const DeleteIcon = styled.div`
|
|
|
24130
24130
|
position: absolute;
|
|
24131
24131
|
`;
|
|
24132
24132
|
|
|
24133
|
-
const QuickFilterDropdownSingle =
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
} = _ref;
|
|
24133
|
+
const QuickFilterDropdownSingle = ({
|
|
24134
|
+
label,
|
|
24135
|
+
hoverColor,
|
|
24136
|
+
options,
|
|
24137
|
+
selectedValue,
|
|
24138
|
+
placeHolder,
|
|
24139
|
+
onChange,
|
|
24140
|
+
disabled,
|
|
24141
|
+
width,
|
|
24142
|
+
error,
|
|
24143
|
+
errorMessage,
|
|
24144
|
+
xIconShow,
|
|
24145
|
+
labelColor,
|
|
24146
|
+
showLabelOnTop
|
|
24147
|
+
}) => {
|
|
24149
24148
|
const [isFocused, setIsFocused] = useState(false);
|
|
24150
24149
|
const [showOptions, setShowOptions] = useState(false);
|
|
24151
24150
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -24543,24 +24542,23 @@ const IconContainer$2 = styled.div`
|
|
|
24543
24542
|
cursor: pointer;
|
|
24544
24543
|
`;
|
|
24545
24544
|
|
|
24546
|
-
const QuickFilterDropdownMultiSelection =
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24555
|
-
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
} = _ref;
|
|
24545
|
+
const QuickFilterDropdownMultiSelection = ({
|
|
24546
|
+
label,
|
|
24547
|
+
labelEmptyValue,
|
|
24548
|
+
options,
|
|
24549
|
+
selectedValue,
|
|
24550
|
+
placeHolder,
|
|
24551
|
+
onChange,
|
|
24552
|
+
required,
|
|
24553
|
+
disabled,
|
|
24554
|
+
width,
|
|
24555
|
+
error,
|
|
24556
|
+
errorMessage,
|
|
24557
|
+
labelColor,
|
|
24558
|
+
xIconShow,
|
|
24559
|
+
checkBoxColor,
|
|
24560
|
+
showLabelOnTop
|
|
24561
|
+
}) => {
|
|
24564
24562
|
const [isFocused, setIsFocused] = useState(false);
|
|
24565
24563
|
const [showOptions, setShowOptions] = useState(false);
|
|
24566
24564
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -25174,8 +25172,8 @@ function styleInject(css, ref) {
|
|
|
25174
25172
|
}
|
|
25175
25173
|
}
|
|
25176
25174
|
|
|
25177
|
-
var css_248z = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n user-select: none;\n overflow: hidden;\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: var(\n --custom-highlight-background,\n linear-gradient(\n 90deg,\n var(--base-color) 0%,\n var(--highlight-color) 50%,\n var(--base-color) 100%\n )\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n\n@media (prefers-reduced-motion) {\n .react-loading-skeleton {\n --pseudo-element-display: none; /* Disable animation */\n }\n}\n";
|
|
25178
|
-
styleInject(css_248z);
|
|
25175
|
+
var css_248z$1 = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n user-select: none;\n overflow: hidden;\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: var(\n --custom-highlight-background,\n linear-gradient(\n 90deg,\n var(--base-color) 0%,\n var(--highlight-color) 50%,\n var(--base-color) 100%\n )\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n\n@media (prefers-reduced-motion) {\n .react-loading-skeleton {\n --pseudo-element-display: none; /* Disable animation */\n }\n}\n";
|
|
25176
|
+
styleInject(css_248z$1);
|
|
25179
25177
|
|
|
25180
25178
|
const OneColumnContainer = props => {
|
|
25181
25179
|
const {
|
|
@@ -30302,7 +30300,7 @@ const ChartSubtitle = styled.p`
|
|
|
30302
30300
|
color: #484A4C;
|
|
30303
30301
|
margin: 0;
|
|
30304
30302
|
`;
|
|
30305
|
-
const ChartContainer = styled.div`
|
|
30303
|
+
const ChartContainer$1 = styled.div`
|
|
30306
30304
|
position: relative;
|
|
30307
30305
|
width: 100%;
|
|
30308
30306
|
height: 90%; /* Reduced from 93% to make room for the zoom controls */
|
|
@@ -30910,7 +30908,7 @@ const BubbleChart = _ref => {
|
|
|
30910
30908
|
"data-testid": "chart-title"
|
|
30911
30909
|
}, title), /*#__PURE__*/React$1.createElement(ChartSubtitle, {
|
|
30912
30910
|
"data-testid": "chart-subtitle"
|
|
30913
|
-
}, subtitle)), /*#__PURE__*/React$1.createElement(ChartContainer, {
|
|
30911
|
+
}, subtitle)), /*#__PURE__*/React$1.createElement(ChartContainer$1, {
|
|
30914
30912
|
ref: scatterChartRef,
|
|
30915
30913
|
"data-testid": "chart-container"
|
|
30916
30914
|
}, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
|
|
@@ -31411,120 +31409,312 @@ const BatteryChart = props => {
|
|
|
31411
31409
|
}))))))), starText !== "" && /*#__PURE__*/React$1.createElement(StarText, null, starText));
|
|
31412
31410
|
};
|
|
31413
31411
|
|
|
31414
|
-
const Container = styled.div`
|
|
31415
|
-
width: ${props => props.width};
|
|
31416
|
-
height: ${props => props.height};
|
|
31417
|
-
padding: 15px;
|
|
31418
|
-
display: flex;
|
|
31419
|
-
flex-direction: column;
|
|
31420
|
-
#Segment {
|
|
31421
|
-
width: auto;
|
|
31422
|
-
white-space: nowrap;
|
|
31423
|
-
font-size: 14px;
|
|
31424
|
-
font-weight: 500;
|
|
31425
|
-
font-family: "Poppins"
|
|
31426
|
-
}
|
|
31427
|
-
`;
|
|
31428
|
-
const Title$1 = styled.h2`
|
|
31429
|
-
color: #212121;
|
|
31430
|
-
font-family: "Poppins";
|
|
31431
|
-
font-size: 18px;
|
|
31432
|
-
font-style: normal;
|
|
31433
|
-
font-weight: 400;
|
|
31434
|
-
line-height: normal;
|
|
31435
|
-
margin: 0 0 16px 0;
|
|
31436
|
-
`;
|
|
31437
31412
|
styled.div`
|
|
31438
|
-
|
|
31439
|
-
|
|
31413
|
+
display: flex;
|
|
31414
|
+
gap: 28px;
|
|
31415
|
+
@media (max-width: 1536px) {
|
|
31416
|
+
gap: 20px;
|
|
31417
|
+
}
|
|
31418
|
+
@media (max-width: 1366px) {
|
|
31419
|
+
gap: 17px;
|
|
31420
|
+
}
|
|
31440
31421
|
`;
|
|
31441
|
-
styled.div`
|
|
31442
|
-
|
|
31422
|
+
const ButtonsControlsContainer = styled.div`
|
|
31423
|
+
display: flex;
|
|
31424
|
+
font: ${props => props.fontSize?.toString().concat('', 'px Poppins, sans-serif')};
|
|
31425
|
+
margin: 0;
|
|
31426
|
+
--highlight-width: auto;
|
|
31427
|
+
--highlight-x-pos: 0;
|
|
31428
|
+
-webkit-font-smoothing: antialiased;
|
|
31429
|
+
-moz-osx-font-smoothing: grayscale;
|
|
31430
|
+
float: left;
|
|
31431
|
+
|
|
31432
|
+
&:not(:first-of-type) {
|
|
31433
|
+
padding-left: 40px;
|
|
31434
|
+
@media (max-width: 1536px) {
|
|
31435
|
+
padding-left: 35px;
|
|
31436
|
+
}
|
|
31437
|
+
@media (max-width: 1366px) {
|
|
31438
|
+
padding-left: 24px;
|
|
31439
|
+
}
|
|
31440
|
+
}
|
|
31443
31441
|
`;
|
|
31444
|
-
styled.div`
|
|
31445
|
-
|
|
31442
|
+
const Controls = styled.div`
|
|
31443
|
+
display: inline-flex;
|
|
31444
|
+
justify-content: space-between;
|
|
31445
|
+
background: #f2f2f2;
|
|
31446
|
+
border-radius: ${props => props.controlradius.toString().concat('', 'px')}; //12px
|
|
31447
|
+
// max-width: 500px; //use this to limit max lenght of the control
|
|
31448
|
+
padding: 6px;
|
|
31449
|
+
gap: ${props => props.gap};
|
|
31450
|
+
overflow: hidden;
|
|
31451
|
+
position: relative;
|
|
31452
|
+
&.controls::before {
|
|
31453
|
+
content: "";
|
|
31454
|
+
color: #212121;
|
|
31455
|
+
background: #FFFFFF;
|
|
31456
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
31457
|
+
border-radius: ${props => props.segmentradius.toString().concat('', 'px')};
|
|
31458
|
+
width: var(--highlight-width);
|
|
31459
|
+
transform: translateX(var(--highlight-x-pos));
|
|
31460
|
+
position: absolute;
|
|
31461
|
+
top: 3px;
|
|
31462
|
+
bottom: 3px;
|
|
31463
|
+
left: 0;
|
|
31464
|
+
z-index: 0;
|
|
31465
|
+
}
|
|
31466
|
+
&.controls.ready::before {
|
|
31467
|
+
transition: transform 0.3s ease, width 0.3s ease;
|
|
31468
|
+
}
|
|
31446
31469
|
`;
|
|
31447
|
-
styled.
|
|
31470
|
+
const ControlsInput = styled.input`
|
|
31471
|
+
opacity: 0;
|
|
31472
|
+
margin: 0;
|
|
31473
|
+
top: 0;
|
|
31474
|
+
right: 0;
|
|
31475
|
+
bottom: 0;
|
|
31476
|
+
left: 0;
|
|
31477
|
+
position: absolute;
|
|
31478
|
+
width: 100%;
|
|
31479
|
+
cursor: pointer;
|
|
31448
31480
|
height: 100%;
|
|
31449
|
-
display: flex;
|
|
31450
|
-
flex-direction: column;
|
|
31451
|
-
background-color: white;
|
|
31452
|
-
`;
|
|
31453
|
-
const TooltipContainer = styled.div`
|
|
31454
|
-
background: white;
|
|
31455
|
-
padding: 10px;
|
|
31456
|
-
border-radius: 5px;
|
|
31457
|
-
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
|
|
31458
|
-
border: 1px solid #ddd;
|
|
31459
|
-
font-family: Poppins, sans-serif;
|
|
31460
|
-
font-weight: 500;
|
|
31461
|
-
font-size: 14px;
|
|
31462
31481
|
`;
|
|
31463
|
-
const
|
|
31464
|
-
|
|
31465
|
-
|
|
31466
|
-
|
|
31482
|
+
const Segment = styled.div`
|
|
31483
|
+
/* width: 100%; uncomment for each segment to have matching width */
|
|
31484
|
+
width: 50%;
|
|
31485
|
+
min-width: ${props => props.segmentwidth.toString().concat('', 'px')}; //120px;
|
|
31486
|
+
position: relative;
|
|
31487
|
+
text-align: center;
|
|
31488
|
+
z-index: 1;
|
|
31467
31489
|
`;
|
|
31468
|
-
const
|
|
31469
|
-
|
|
31470
|
-
|
|
31490
|
+
const SegmentLabel = styled.label`
|
|
31491
|
+
cursor: pointer;
|
|
31492
|
+
display: block;
|
|
31493
|
+
padding: 0 6px;
|
|
31494
|
+
transition: color 0.5s ease;
|
|
31495
|
+
&.active {
|
|
31496
|
+
color: ${props => props.selectedtextcolor};
|
|
31497
|
+
}
|
|
31498
|
+
&.inactive {
|
|
31499
|
+
color: ${props => props.unselectedtextcolor};
|
|
31500
|
+
}
|
|
31471
31501
|
`;
|
|
31472
31502
|
|
|
31473
|
-
|
|
31474
|
-
|
|
31475
|
-
|
|
31476
|
-
|
|
31477
|
-
|
|
31478
|
-
|
|
31479
|
-
|
|
31480
|
-
|
|
31481
|
-
|
|
31482
|
-
|
|
31483
|
-
|
|
31484
|
-
|
|
31485
|
-
|
|
31486
|
-
|
|
31487
|
-
|
|
31488
|
-
|
|
31489
|
-
|
|
31490
|
-
|
|
31491
|
-
|
|
31492
|
-
|
|
31493
|
-
|
|
31494
|
-
|
|
31495
|
-
|
|
31496
|
-
|
|
31497
|
-
|
|
31498
|
-
|
|
31499
|
-
|
|
31500
|
-
|
|
31501
|
-
|
|
31503
|
+
/* eslint-disable react/require-default-props */
|
|
31504
|
+
|
|
31505
|
+
/* SegmentedButton */
|
|
31506
|
+
const SegmentedButton = props => {
|
|
31507
|
+
const {
|
|
31508
|
+
className,
|
|
31509
|
+
name,
|
|
31510
|
+
options,
|
|
31511
|
+
width,
|
|
31512
|
+
height,
|
|
31513
|
+
controlradius,
|
|
31514
|
+
segmentradius,
|
|
31515
|
+
fontSize,
|
|
31516
|
+
selectedsegmentcolor,
|
|
31517
|
+
selectedtextcolor,
|
|
31518
|
+
unselectedtextcolor,
|
|
31519
|
+
defaultIndex,
|
|
31520
|
+
onClick,
|
|
31521
|
+
gap
|
|
31522
|
+
} = props;
|
|
31523
|
+
const [activeIndex, setActiveIndex] = useState(defaultIndex);
|
|
31524
|
+
const controlRef = useRef();
|
|
31525
|
+
const componentReady = useRef();
|
|
31526
|
+
const optionsRef = options?.map((item, i) => ({
|
|
31527
|
+
...item,
|
|
31528
|
+
id: i,
|
|
31529
|
+
ref: useRef()
|
|
31530
|
+
}));
|
|
31531
|
+
|
|
31532
|
+
// Determine when the component is "ready"
|
|
31533
|
+
useEffect(() => {
|
|
31534
|
+
componentReady.current = true;
|
|
31535
|
+
}, []);
|
|
31536
|
+
useEffect(() => {
|
|
31537
|
+
if (defaultIndex >= 0 && defaultIndex < options?.length) {
|
|
31538
|
+
setActiveIndex(defaultIndex);
|
|
31502
31539
|
}
|
|
31503
|
-
|
|
31504
|
-
|
|
31505
|
-
|
|
31506
|
-
|
|
31507
|
-
|
|
31508
|
-
|
|
31509
|
-
|
|
31510
|
-
|
|
31511
|
-
|
|
31512
|
-
|
|
31513
|
-
|
|
31514
|
-
|
|
31515
|
-
x
|
|
31516
|
-
|
|
31517
|
-
|
|
31518
|
-
|
|
31519
|
-
|
|
31520
|
-
|
|
31521
|
-
|
|
31522
|
-
|
|
31523
|
-
|
|
31524
|
-
const data = payload[0]?.payload;
|
|
31525
|
-
if (!data) return null;
|
|
31526
|
-
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, `${data.label}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales: ${getFormattedValue(data.inc_sales)}${getFormattedUnits(data.inc_sales)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales ROI: ${getFormattedValue(data.inc_roi)}${getFormattedUnits(data.inc_roi)}`));
|
|
31540
|
+
}, [defaultIndex]);
|
|
31541
|
+
useEffect(() => {
|
|
31542
|
+
const activeSegmentRef = optionsRef[activeIndex].ref;
|
|
31543
|
+
setTimeout(() => {
|
|
31544
|
+
const {
|
|
31545
|
+
offsetWidth,
|
|
31546
|
+
offsetLeft
|
|
31547
|
+
} = activeSegmentRef.current;
|
|
31548
|
+
const {
|
|
31549
|
+
style
|
|
31550
|
+
} = controlRef.current;
|
|
31551
|
+
style.setProperty("--highlight-width", `${offsetWidth}px`);
|
|
31552
|
+
style.setProperty("--highlight-x-pos", `${offsetLeft}px`);
|
|
31553
|
+
}, 0);
|
|
31554
|
+
}, [activeIndex, controlRef, optionsRef]);
|
|
31555
|
+
const onInputChangeHandler = (value, index) => {
|
|
31556
|
+
setActiveIndex(index);
|
|
31557
|
+
onClick({
|
|
31558
|
+
index,
|
|
31559
|
+
value
|
|
31560
|
+
});
|
|
31527
31561
|
};
|
|
31562
|
+
let segmentwidth = 120;
|
|
31563
|
+
if (options && options.length > 0 && width && width > 0) {
|
|
31564
|
+
segmentwidth = width / options.length;
|
|
31565
|
+
}
|
|
31566
|
+
return /*#__PURE__*/React$1.createElement(ButtonsControlsContainer, {
|
|
31567
|
+
className: className,
|
|
31568
|
+
fontSize: fontSize,
|
|
31569
|
+
ref: controlRef
|
|
31570
|
+
}, /*#__PURE__*/React$1.createElement(Controls, {
|
|
31571
|
+
id: "Controls",
|
|
31572
|
+
selectedsegmentcolor: selectedsegmentcolor,
|
|
31573
|
+
segmentradius: segmentradius,
|
|
31574
|
+
gap: gap,
|
|
31575
|
+
controlradius: controlradius,
|
|
31576
|
+
segmentwidth: segmentwidth,
|
|
31577
|
+
className: `controls ${componentReady.current ? "ready" : "idle"}`
|
|
31578
|
+
}, optionsRef?.map((item, i) => /*#__PURE__*/React$1.createElement(Segment, {
|
|
31579
|
+
id: "Segment",
|
|
31580
|
+
key: item.id,
|
|
31581
|
+
selectedsegmentcolor: selectedsegmentcolor,
|
|
31582
|
+
controlradius: controlradius,
|
|
31583
|
+
segmentwidth: segmentwidth,
|
|
31584
|
+
className: `${activeIndex === i ? "active" : "inactive"}`,
|
|
31585
|
+
ref: item.ref
|
|
31586
|
+
}, /*#__PURE__*/React$1.createElement(ControlsInput, {
|
|
31587
|
+
type: "radio",
|
|
31588
|
+
value: item.value,
|
|
31589
|
+
id: item.id,
|
|
31590
|
+
name: name,
|
|
31591
|
+
onChange: () => onInputChangeHandler(item.value, item.id),
|
|
31592
|
+
checked: i === activeIndex
|
|
31593
|
+
}), /*#__PURE__*/React$1.createElement(SegmentLabel, {
|
|
31594
|
+
id: "SegmentLabel",
|
|
31595
|
+
selectedtextcolor: selectedtextcolor,
|
|
31596
|
+
unselectedtextcolor: unselectedtextcolor,
|
|
31597
|
+
segmentheight: height / 5,
|
|
31598
|
+
className: `${activeIndex === i ? "active" : "inactive"} `,
|
|
31599
|
+
htmlFor: item.value
|
|
31600
|
+
}, item.value)))));
|
|
31601
|
+
};
|
|
31602
|
+
SegmentedButton.propTypes = {
|
|
31603
|
+
name: PropTypes.string,
|
|
31604
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
31605
|
+
value: PropTypes.string
|
|
31606
|
+
})),
|
|
31607
|
+
width: PropTypes.number,
|
|
31608
|
+
height: PropTypes.number,
|
|
31609
|
+
controlradius: PropTypes.number,
|
|
31610
|
+
segmentradius: PropTypes.number,
|
|
31611
|
+
gap: PropTypes.string,
|
|
31612
|
+
fontSize: PropTypes.number,
|
|
31613
|
+
selectedsegmentcolor: PropTypes.string,
|
|
31614
|
+
selectedtextcolor: PropTypes.string,
|
|
31615
|
+
unselectedtextcolor: PropTypes.string,
|
|
31616
|
+
defaultIndex: PropTypes.number,
|
|
31617
|
+
onClick: PropTypes.func
|
|
31618
|
+
};
|
|
31619
|
+
SegmentedButton.defaultProps = {
|
|
31620
|
+
name: "",
|
|
31621
|
+
options: [{
|
|
31622
|
+
value: "4 w"
|
|
31623
|
+
}, {
|
|
31624
|
+
value: "8 w"
|
|
31625
|
+
}, {
|
|
31626
|
+
value: "13 w"
|
|
31627
|
+
}],
|
|
31628
|
+
width: 120,
|
|
31629
|
+
height: 40,
|
|
31630
|
+
controlradius: 8,
|
|
31631
|
+
segmentradius: 8,
|
|
31632
|
+
gap: "0px",
|
|
31633
|
+
fontSize: 14,
|
|
31634
|
+
selectedsegmentcolor: "#3a9df9",
|
|
31635
|
+
selectedtextcolor: "#212121",
|
|
31636
|
+
unselectedtextcolor: "black",
|
|
31637
|
+
defaultIndex: 0,
|
|
31638
|
+
onClick: () => {}
|
|
31639
|
+
};
|
|
31640
|
+
|
|
31641
|
+
const Container = styled.div`
|
|
31642
|
+
width: ${props => props.width};
|
|
31643
|
+
height: ${props => props.height};
|
|
31644
|
+
margin: 10px;
|
|
31645
|
+
gap: 10px;
|
|
31646
|
+
display: flex;
|
|
31647
|
+
flex-direction: column;
|
|
31648
|
+
`;
|
|
31649
|
+
const SegmentedContainer = styled(SegmentedButton)`
|
|
31650
|
+
height: auto;
|
|
31651
|
+
#Segment {
|
|
31652
|
+
width: auto;
|
|
31653
|
+
white-space: nowrap;
|
|
31654
|
+
font-size: 14px;
|
|
31655
|
+
font-weight: 500;
|
|
31656
|
+
font-family: "Poppins";
|
|
31657
|
+
}
|
|
31658
|
+
`;
|
|
31659
|
+
const ChartContainer = styled.div`
|
|
31660
|
+
width: 100%;
|
|
31661
|
+
height: calc(100% - 70px);
|
|
31662
|
+
`;
|
|
31663
|
+
const Title$1 = styled.h2`
|
|
31664
|
+
color: #212121;
|
|
31665
|
+
font-family: "Poppins";
|
|
31666
|
+
font-size: 18px;
|
|
31667
|
+
font-style: normal;
|
|
31668
|
+
font-weight: 400;
|
|
31669
|
+
height: 10px;
|
|
31670
|
+
line-height: normal;
|
|
31671
|
+
margin: 0 0 16px 0;
|
|
31672
|
+
`;
|
|
31673
|
+
styled.div`
|
|
31674
|
+
font-family: sans-serif;
|
|
31675
|
+
text-align: center;
|
|
31676
|
+
`;
|
|
31677
|
+
styled.div`
|
|
31678
|
+
height: 25%;
|
|
31679
|
+
`;
|
|
31680
|
+
styled.div`
|
|
31681
|
+
height: 75%;
|
|
31682
|
+
`;
|
|
31683
|
+
styled.div`
|
|
31684
|
+
height: 100%;
|
|
31685
|
+
display: flex;
|
|
31686
|
+
flex-direction: column;
|
|
31687
|
+
background-color: white;
|
|
31688
|
+
`;
|
|
31689
|
+
const TooltipContainer = styled.div`
|
|
31690
|
+
background: white;
|
|
31691
|
+
padding: 10px;
|
|
31692
|
+
border-radius: 5px;
|
|
31693
|
+
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
|
|
31694
|
+
border: 1px solid #ddd;
|
|
31695
|
+
font-family: Poppins, sans-serif;
|
|
31696
|
+
font-weight: 500;
|
|
31697
|
+
font-size: 14px;
|
|
31698
|
+
`;
|
|
31699
|
+
const TooltipTitle = styled.p`
|
|
31700
|
+
font-weight: 700;
|
|
31701
|
+
margin-top: 5px;
|
|
31702
|
+
margin-bottom: 5px;
|
|
31703
|
+
`;
|
|
31704
|
+
const TooltipText = styled.p`
|
|
31705
|
+
margin-top: 5px;
|
|
31706
|
+
margin-bottom: 5px;
|
|
31707
|
+
`;
|
|
31708
|
+
|
|
31709
|
+
var css_248z = ".custom-brush .recharts-brush-slide { /* selected area */\r\n fill: #212121;\r\n}\r\n\r\n ";
|
|
31710
|
+
styleInject(css_248z);
|
|
31711
|
+
|
|
31712
|
+
const BarLine = props => {
|
|
31713
|
+
const {
|
|
31714
|
+
brushAreaBarData
|
|
31715
|
+
} = props;
|
|
31716
|
+
const MAX_CHARS_PER_LINE = getMaxCharsPerLine(brushAreaBarData.length);
|
|
31717
|
+
const MAX_LINES = 2;
|
|
31528
31718
|
const chartMargins = {
|
|
31529
31719
|
top: 30,
|
|
31530
31720
|
right: 30,
|
|
@@ -31535,9 +31725,71 @@ const SeparatedLineBarChart = ({
|
|
|
31535
31725
|
top: 30,
|
|
31536
31726
|
right: 30,
|
|
31537
31727
|
left: 20,
|
|
31538
|
-
bottom:
|
|
31728
|
+
bottom: 0
|
|
31539
31729
|
};
|
|
31540
|
-
const
|
|
31730
|
+
const CustomizedTick = /*#__PURE__*/React$1.memo(({
|
|
31731
|
+
x,
|
|
31732
|
+
y,
|
|
31733
|
+
payload
|
|
31734
|
+
}) => {
|
|
31735
|
+
const fullText = payload?.value ?? "";
|
|
31736
|
+
|
|
31737
|
+
/* ── 1. split text into lines that are ≤ MAX_CHARS_PER_LINE ─────────────── */
|
|
31738
|
+
const words = fullText.split(" ");
|
|
31739
|
+
const lines = [];
|
|
31740
|
+
let current = "";
|
|
31741
|
+
words.forEach(w => {
|
|
31742
|
+
// +1 so we count the space that will be added
|
|
31743
|
+
if ((current.length ? current.length + 1 : 0) + w.length > MAX_CHARS_PER_LINE) {
|
|
31744
|
+
lines.push(current.trim());
|
|
31745
|
+
current = w;
|
|
31746
|
+
} else {
|
|
31747
|
+
current += (current ? " " : "") + w;
|
|
31748
|
+
}
|
|
31749
|
+
});
|
|
31750
|
+
if (current) lines.push(current.trim());
|
|
31751
|
+
|
|
31752
|
+
/* ── 2. squash down to two lines & add "..." if necessary ───────────────── */
|
|
31753
|
+
if (lines.length > MAX_LINES) {
|
|
31754
|
+
const firstLine = lines[0]; // keep it as-is
|
|
31755
|
+
// join everything after the first line and truncate
|
|
31756
|
+
let secondLine = lines.slice(1).join(" ");
|
|
31757
|
+
if (secondLine.length > MAX_CHARS_PER_LINE - 3) {
|
|
31758
|
+
secondLine = secondLine.slice(0, MAX_CHARS_PER_LINE - 3).trim();
|
|
31759
|
+
}
|
|
31760
|
+
lines.length = 0;
|
|
31761
|
+
lines.push(firstLine, `${secondLine}…`);
|
|
31762
|
+
}
|
|
31763
|
+
|
|
31764
|
+
/* ── 3. render ──────────────────────────────────────────────────────────── */
|
|
31765
|
+
return /*#__PURE__*/React$1.createElement("g", {
|
|
31766
|
+
transform: `translate(${x},${y})`
|
|
31767
|
+
}, /*#__PURE__*/React$1.createElement("text", {
|
|
31768
|
+
textAnchor: "middle",
|
|
31769
|
+
fontFamily: "Poppins",
|
|
31770
|
+
fontSize: 14,
|
|
31771
|
+
fill: "#212121"
|
|
31772
|
+
}, lines.map((line, idx) => /*#__PURE__*/React$1.createElement("tspan", {
|
|
31773
|
+
key: idx,
|
|
31774
|
+
x: 0
|
|
31775
|
+
/* first line sits on the baseline (≈ 0.71 em down); every
|
|
31776
|
+
additional line gets another 1.2 em offset */,
|
|
31777
|
+
dy: idx === 0 ? "0.71em" : "1.2em"
|
|
31778
|
+
}, line))));
|
|
31779
|
+
});
|
|
31780
|
+
const CustomTooltip = /*#__PURE__*/React$1.memo(({
|
|
31781
|
+
active,
|
|
31782
|
+
payload
|
|
31783
|
+
}) => {
|
|
31784
|
+
if (!active || !payload?.length) return null;
|
|
31785
|
+
const {
|
|
31786
|
+
label,
|
|
31787
|
+
description,
|
|
31788
|
+
inc_sales,
|
|
31789
|
+
inc_roi
|
|
31790
|
+
} = payload[0].payload;
|
|
31791
|
+
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, label), /*#__PURE__*/React$1.createElement(TooltipText, null, description), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales: ${getFormattedValue(inc_sales)}${getFormattedUnits(inc_sales)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales ROI: ${getFormattedValue(inc_roi)}${getFormattedUnits(inc_roi)}`));
|
|
31792
|
+
});
|
|
31541
31793
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
31542
31794
|
style: {
|
|
31543
31795
|
width: "100%",
|
|
@@ -31551,7 +31803,7 @@ const SeparatedLineBarChart = ({
|
|
|
31551
31803
|
width: "100%",
|
|
31552
31804
|
height: "100%"
|
|
31553
31805
|
}, /*#__PURE__*/React$1.createElement(LineChart, {
|
|
31554
|
-
data:
|
|
31806
|
+
data: brushAreaBarData,
|
|
31555
31807
|
margin: chartMargins,
|
|
31556
31808
|
syncId: "composedChart",
|
|
31557
31809
|
syncMethod: "index"
|
|
@@ -31567,7 +31819,8 @@ const SeparatedLineBarChart = ({
|
|
|
31567
31819
|
},
|
|
31568
31820
|
hide: true
|
|
31569
31821
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
31570
|
-
|
|
31822
|
+
type: "number",
|
|
31823
|
+
domain: [0, dataMax => dataMax * 1.3],
|
|
31571
31824
|
hide: true
|
|
31572
31825
|
}), /*#__PURE__*/React$1.createElement(Line, {
|
|
31573
31826
|
type: "monotone",
|
|
@@ -31579,15 +31832,13 @@ const SeparatedLineBarChart = ({
|
|
|
31579
31832
|
fill: "#F8CD00"
|
|
31580
31833
|
},
|
|
31581
31834
|
activeDot: false,
|
|
31582
|
-
name: "INC Sales ROI"
|
|
31583
|
-
barCategoryGap: BAR_CATEGORY_GAP,
|
|
31584
|
-
barGap: 0
|
|
31835
|
+
name: "INC Sales ROI"
|
|
31585
31836
|
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
31586
31837
|
dataKey: "inc_roi",
|
|
31587
31838
|
position: "top",
|
|
31588
31839
|
formatter: value => `$${getFormattedValue(value)}${getFormattedUnits(value)}`,
|
|
31589
31840
|
fill: "#212121",
|
|
31590
|
-
fontSize:
|
|
31841
|
+
fontSize: 15,
|
|
31591
31842
|
fontWeight: "400",
|
|
31592
31843
|
fontFamily: "Poppins"
|
|
31593
31844
|
})), /*#__PURE__*/React$1.createElement(Brush, {
|
|
@@ -31595,25 +31846,23 @@ const SeparatedLineBarChart = ({
|
|
|
31595
31846
|
height: 30,
|
|
31596
31847
|
stroke: "#212121",
|
|
31597
31848
|
startIndex: 0,
|
|
31598
|
-
endIndex: Math.min(6,
|
|
31849
|
+
endIndex: Math.min(6, brushAreaBarData.length - 1),
|
|
31599
31850
|
y: 330,
|
|
31600
31851
|
travellerWidth: 10,
|
|
31601
31852
|
tickFormatter: (value, index) => index + 1,
|
|
31602
31853
|
hide: true
|
|
31603
31854
|
})))), /*#__PURE__*/React$1.createElement("div", {
|
|
31604
31855
|
style: {
|
|
31605
|
-
height: "
|
|
31856
|
+
height: "65%"
|
|
31606
31857
|
}
|
|
31607
31858
|
}, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
|
|
31608
31859
|
width: "100%",
|
|
31609
31860
|
height: "100%"
|
|
31610
|
-
}, /*#__PURE__*/React$1.createElement(
|
|
31611
|
-
data:
|
|
31861
|
+
}, /*#__PURE__*/React$1.createElement(BarChart$1, {
|
|
31862
|
+
data: brushAreaBarData,
|
|
31612
31863
|
margin: chartMargins2,
|
|
31613
31864
|
syncId: "composedChart",
|
|
31614
|
-
syncMethod: "index"
|
|
31615
|
-
barCategoryGap: BAR_CATEGORY_GAP,
|
|
31616
|
-
barGap: 0
|
|
31865
|
+
syncMethod: "index"
|
|
31617
31866
|
}, /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
31618
31867
|
strokeDasharray: "3 3",
|
|
31619
31868
|
vertical: false
|
|
@@ -31621,401 +31870,190 @@ const SeparatedLineBarChart = ({
|
|
|
31621
31870
|
dataKey: "label",
|
|
31622
31871
|
tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
|
|
31623
31872
|
interval: 0,
|
|
31624
|
-
height:
|
|
31873
|
+
height: 50,
|
|
31625
31874
|
tickLine: false
|
|
31626
31875
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
31627
|
-
|
|
31876
|
+
type: "number",
|
|
31877
|
+
domain: [0, dataMax => dataMax * 1.3],
|
|
31628
31878
|
hide: true
|
|
31629
31879
|
}), /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
31630
|
-
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
|
|
31880
|
+
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null),
|
|
31881
|
+
cursor: brushAreaBarData.length > 80
|
|
31631
31882
|
}), /*#__PURE__*/React$1.createElement(Bar, {
|
|
31632
31883
|
dataKey: "inc_sales",
|
|
31633
31884
|
fill: "#CCDCDD",
|
|
31634
31885
|
gap: 4,
|
|
31635
|
-
|
|
31636
|
-
barSize: 40,
|
|
31886
|
+
barSize: 53,
|
|
31637
31887
|
name: "INC Sales"
|
|
31638
31888
|
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
31639
31889
|
dataKey: "inc_sales",
|
|
31640
31890
|
position: "top",
|
|
31641
31891
|
formatter: value => `$${getFormattedValue(value)}${getFormattedUnits(value)}`,
|
|
31642
31892
|
fill: "#212121",
|
|
31643
|
-
fontSize:
|
|
31644
|
-
fontWeight: "400",
|
|
31645
|
-
fontFamily: "Poppins"
|
|
31646
|
-
})), /*#__PURE__*/React$1.createElement(Brush, {
|
|
31647
|
-
dataKey: "label",
|
|
31648
|
-
height: 30,
|
|
31649
|
-
stroke: "#212121",
|
|
31650
|
-
startIndex: 0,
|
|
31651
|
-
endIndex: Math.min(6, processedData.length - 1),
|
|
31652
|
-
travellerWidth: 10,
|
|
31653
|
-
tickFormatter: (value, index) => index + 1
|
|
31654
|
-
})), /*#__PURE__*/React$1.createElement("div", null)), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
|
|
31655
|
-
width: "100%",
|
|
31656
|
-
height: "40px",
|
|
31657
|
-
legendData: [{
|
|
31658
|
-
iconColor: "#CCDCDD",
|
|
31659
|
-
iconType: "Square",
|
|
31660
|
-
title: "INC Sales"
|
|
31661
|
-
}, {
|
|
31662
|
-
iconColor: "#F8CD00",
|
|
31663
|
-
iconType: "LegendUnionIcon",
|
|
31664
|
-
title: "INC Sales ROI"
|
|
31665
|
-
}]
|
|
31666
|
-
})));
|
|
31667
|
-
};
|
|
31668
|
-
|
|
31669
|
-
function SingleChart({
|
|
31670
|
-
barData,
|
|
31671
|
-
height = 450,
|
|
31672
|
-
width = "100%"
|
|
31673
|
-
}) {
|
|
31674
|
-
const dataWithIndex = barData?.map((item, index) => ({
|
|
31675
|
-
...item,
|
|
31676
|
-
index,
|
|
31677
|
-
shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
|
|
31678
|
-
}));
|
|
31679
|
-
const CustomizedTick = ({
|
|
31680
|
-
x,
|
|
31681
|
-
y,
|
|
31682
|
-
payload
|
|
31683
|
-
}) => {
|
|
31684
|
-
const label = dataWithIndex[payload.value]?.label ?? "";
|
|
31685
|
-
const words = label.split(' ');
|
|
31686
|
-
const chunks = [];
|
|
31687
|
-
let currentChunk = '';
|
|
31688
|
-
words.forEach(word => {
|
|
31689
|
-
if (currentChunk.length + word.length > 15) {
|
|
31690
|
-
chunks.push(currentChunk.trim());
|
|
31691
|
-
currentChunk = word;
|
|
31692
|
-
} else {
|
|
31693
|
-
currentChunk += (currentChunk ? ' ' : '') + word;
|
|
31694
|
-
}
|
|
31695
|
-
});
|
|
31696
|
-
if (currentChunk) {
|
|
31697
|
-
chunks.push(currentChunk.trim());
|
|
31698
|
-
}
|
|
31699
|
-
return /*#__PURE__*/React$1.createElement("g", {
|
|
31700
|
-
transform: `translate(${x},${y})`
|
|
31701
|
-
}, /*#__PURE__*/React$1.createElement("text", {
|
|
31702
|
-
x: 0,
|
|
31703
|
-
y: 0,
|
|
31704
|
-
dy: 16,
|
|
31705
|
-
textAnchor: "middle",
|
|
31706
|
-
fill: "#212121",
|
|
31707
|
-
fontSize: 10,
|
|
31708
|
-
fontFamily: "Poppins"
|
|
31709
|
-
}, chunks.map((chunk, i) => /*#__PURE__*/React$1.createElement("tspan", {
|
|
31710
|
-
key: i,
|
|
31711
|
-
x: 0,
|
|
31712
|
-
dy: i === 0 ? "0.71em" : "1.2em"
|
|
31713
|
-
}, chunk))));
|
|
31714
|
-
};
|
|
31715
|
-
const CustomTooltip = ({
|
|
31716
|
-
active,
|
|
31717
|
-
payload
|
|
31718
|
-
}) => {
|
|
31719
|
-
if (!active || !payload || !payload.length) return null;
|
|
31720
|
-
const data = payload[0]?.payload;
|
|
31721
|
-
if (!data) return null;
|
|
31722
|
-
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, `${data.label}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.typeTitle}: ${getFormattedValue(data.value)}${getFormattedUnits(data.value)}`));
|
|
31723
|
-
};
|
|
31724
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
31725
|
-
style: {
|
|
31726
|
-
width: "100%",
|
|
31727
|
-
height: "100%"
|
|
31728
|
-
}
|
|
31729
|
-
}, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
|
|
31730
|
-
width: "100%",
|
|
31731
|
-
height: "95%"
|
|
31732
|
-
}, /*#__PURE__*/React$1.createElement(ComposedChart, {
|
|
31733
|
-
data: dataWithIndex,
|
|
31734
|
-
margin: {
|
|
31735
|
-
top: 40,
|
|
31736
|
-
right: 40,
|
|
31737
|
-
left: 20,
|
|
31738
|
-
bottom: 40
|
|
31739
|
-
}
|
|
31740
|
-
}, /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
31741
|
-
strokeDasharray: "3 3",
|
|
31742
|
-
vertical: false
|
|
31743
|
-
}), /*#__PURE__*/React$1.createElement(XAxis, {
|
|
31744
|
-
dataKey: "index",
|
|
31745
|
-
tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
|
|
31746
|
-
interval: 0,
|
|
31747
|
-
height: 80,
|
|
31748
|
-
padding: {
|
|
31749
|
-
left: 20,
|
|
31750
|
-
right: 20
|
|
31751
|
-
},
|
|
31752
|
-
tickLine: false
|
|
31753
|
-
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
31754
|
-
tickFormatter: v => `$${v / 1000}k`,
|
|
31755
|
-
hide: true
|
|
31756
|
-
}), /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
31757
|
-
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
|
|
31758
|
-
}), /*#__PURE__*/React$1.createElement(Bar, {
|
|
31759
|
-
dataKey: "value",
|
|
31760
|
-
fill: "#CCDCDD",
|
|
31761
|
-
gap: "4px",
|
|
31762
|
-
borderRadius: [4, 4, 0, 8],
|
|
31763
|
-
barSize: 40,
|
|
31764
|
-
name: "INC Sales"
|
|
31765
|
-
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
31766
|
-
dataKey: "value",
|
|
31767
|
-
position: "top",
|
|
31768
|
-
formatter: value => `$${getFormattedValue(value)}${getFormattedUnits(value)}`,
|
|
31769
|
-
fill: "#212121",
|
|
31770
|
-
fontSize: 12,
|
|
31893
|
+
fontSize: 16,
|
|
31771
31894
|
fontWeight: "400",
|
|
31772
31895
|
fontFamily: "Poppins"
|
|
31773
31896
|
})), /*#__PURE__*/React$1.createElement(Brush, {
|
|
31774
31897
|
height: 30,
|
|
31898
|
+
fill: "#EFEFEF",
|
|
31775
31899
|
travellerWidth: 10,
|
|
31776
31900
|
startIndex: 0,
|
|
31777
|
-
endIndex: Math.min(6,
|
|
31778
|
-
|
|
31901
|
+
endIndex: Math.min(6, brushAreaBarData.length - 1),
|
|
31902
|
+
className: "custom-brush"
|
|
31903
|
+
})))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
|
|
31779
31904
|
width: "100%",
|
|
31780
|
-
height: "40px",
|
|
31781
|
-
legendData: [{
|
|
31782
|
-
iconColor: "#CCDCDD",
|
|
31783
|
-
iconType: "Square",
|
|
31784
|
-
title: "INC
|
|
31785
|
-
}
|
|
31786
|
-
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
|
|
31790
|
-
|
|
31791
|
-
|
|
31792
|
-
@media (max-width: 1536px) {
|
|
31793
|
-
gap: 20px;
|
|
31794
|
-
}
|
|
31795
|
-
@media (max-width: 1366px) {
|
|
31796
|
-
gap: 17px;
|
|
31797
|
-
}
|
|
31798
|
-
`;
|
|
31799
|
-
const ButtonsControlsContainer = styled.div`
|
|
31800
|
-
display: flex;
|
|
31801
|
-
font: ${props => props.fontSize?.toString().concat('', 'px Poppins, sans-serif')};
|
|
31802
|
-
margin: 0;
|
|
31803
|
-
--highlight-width: auto;
|
|
31804
|
-
--highlight-x-pos: 0;
|
|
31805
|
-
-webkit-font-smoothing: antialiased;
|
|
31806
|
-
-moz-osx-font-smoothing: grayscale;
|
|
31807
|
-
float: left;
|
|
31808
|
-
|
|
31809
|
-
&:not(:first-of-type) {
|
|
31810
|
-
padding-left: 40px;
|
|
31811
|
-
@media (max-width: 1536px) {
|
|
31812
|
-
padding-left: 35px;
|
|
31813
|
-
}
|
|
31814
|
-
@media (max-width: 1366px) {
|
|
31815
|
-
padding-left: 24px;
|
|
31816
|
-
}
|
|
31817
|
-
}
|
|
31818
|
-
`;
|
|
31819
|
-
const Controls = styled.div`
|
|
31820
|
-
display: inline-flex;
|
|
31821
|
-
justify-content: space-between;
|
|
31822
|
-
background: #f2f2f2;
|
|
31823
|
-
border-radius: ${props => props.controlradius.toString().concat('', 'px')}; //12px
|
|
31824
|
-
// max-width: 500px; //use this to limit max lenght of the control
|
|
31825
|
-
padding: 6px;
|
|
31826
|
-
gap: ${props => props.gap};
|
|
31827
|
-
overflow: hidden;
|
|
31828
|
-
position: relative;
|
|
31829
|
-
&.controls::before {
|
|
31830
|
-
content: "";
|
|
31831
|
-
color: #212121;
|
|
31832
|
-
background: #FFFFFF;
|
|
31833
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
31834
|
-
border-radius: ${props => props.segmentradius.toString().concat('', 'px')};
|
|
31835
|
-
width: var(--highlight-width);
|
|
31836
|
-
transform: translateX(var(--highlight-x-pos));
|
|
31837
|
-
position: absolute;
|
|
31838
|
-
top: 3px;
|
|
31839
|
-
bottom: 3px;
|
|
31840
|
-
left: 0;
|
|
31841
|
-
z-index: 0;
|
|
31842
|
-
}
|
|
31843
|
-
&.controls.ready::before {
|
|
31844
|
-
transition: transform 0.3s ease, width 0.3s ease;
|
|
31845
|
-
}
|
|
31846
|
-
`;
|
|
31847
|
-
const ControlsInput = styled.input`
|
|
31848
|
-
opacity: 0;
|
|
31849
|
-
margin: 0;
|
|
31850
|
-
top: 0;
|
|
31851
|
-
right: 0;
|
|
31852
|
-
bottom: 0;
|
|
31853
|
-
left: 0;
|
|
31854
|
-
position: absolute;
|
|
31855
|
-
width: 100%;
|
|
31856
|
-
cursor: pointer;
|
|
31857
|
-
height: 100%;
|
|
31858
|
-
`;
|
|
31859
|
-
const Segment = styled.div`
|
|
31860
|
-
/* width: 100%; uncomment for each segment to have matching width */
|
|
31861
|
-
width: 50%;
|
|
31862
|
-
min-width: ${props => props.segmentwidth.toString().concat('', 'px')}; //120px;
|
|
31863
|
-
position: relative;
|
|
31864
|
-
text-align: center;
|
|
31865
|
-
z-index: 1;
|
|
31866
|
-
`;
|
|
31867
|
-
const SegmentLabel = styled.label`
|
|
31868
|
-
cursor: pointer;
|
|
31869
|
-
display: block;
|
|
31870
|
-
padding: 0 6px;
|
|
31871
|
-
transition: color 0.5s ease;
|
|
31872
|
-
&.active {
|
|
31873
|
-
color: ${props => props.selectedtextcolor};
|
|
31874
|
-
}
|
|
31875
|
-
&.inactive {
|
|
31876
|
-
color: ${props => props.unselectedtextcolor};
|
|
31877
|
-
}
|
|
31878
|
-
`;
|
|
31879
|
-
|
|
31880
|
-
/* eslint-disable react/require-default-props */
|
|
31905
|
+
height: "40px",
|
|
31906
|
+
legendData: [{
|
|
31907
|
+
iconColor: "#CCDCDD",
|
|
31908
|
+
iconType: "Square",
|
|
31909
|
+
title: "INC Sales"
|
|
31910
|
+
}, {
|
|
31911
|
+
iconColor: "#F8CD00",
|
|
31912
|
+
iconType: "LegendUnionIcon",
|
|
31913
|
+
title: "INC Sales ROI"
|
|
31914
|
+
}]
|
|
31915
|
+
}));
|
|
31916
|
+
};
|
|
31881
31917
|
|
|
31882
|
-
|
|
31883
|
-
const SegmentedButton = props => {
|
|
31918
|
+
const SingleChart = props => {
|
|
31884
31919
|
const {
|
|
31885
|
-
|
|
31886
|
-
options,
|
|
31887
|
-
width,
|
|
31888
|
-
height,
|
|
31889
|
-
controlradius,
|
|
31890
|
-
segmentradius,
|
|
31891
|
-
fontSize,
|
|
31892
|
-
selectedsegmentcolor,
|
|
31893
|
-
selectedtextcolor,
|
|
31894
|
-
unselectedtextcolor,
|
|
31895
|
-
defaultIndex,
|
|
31896
|
-
onClick,
|
|
31897
|
-
gap
|
|
31920
|
+
barData
|
|
31898
31921
|
} = props;
|
|
31899
|
-
const
|
|
31900
|
-
const
|
|
31901
|
-
const
|
|
31902
|
-
const optionsRef = options?.map((item, i) => ({
|
|
31922
|
+
const MAX_CHARS_PER_LINE = getMaxCharsPerLine(barData.length);
|
|
31923
|
+
const MAX_LINES = 2;
|
|
31924
|
+
const dataWithIndex = barData?.map((item, index) => ({
|
|
31903
31925
|
...item,
|
|
31904
|
-
|
|
31905
|
-
|
|
31926
|
+
index,
|
|
31927
|
+
shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
|
|
31906
31928
|
}));
|
|
31929
|
+
const CustomizedTick = /*#__PURE__*/React$1.memo(({
|
|
31930
|
+
x,
|
|
31931
|
+
y,
|
|
31932
|
+
payload
|
|
31933
|
+
}) => {
|
|
31934
|
+
const fullText = payload?.value ?? "";
|
|
31935
|
+
|
|
31936
|
+
/* ── 1. split text into lines that are ≤ MAX_CHARS_PER_LINE ─────────────── */
|
|
31937
|
+
const words = fullText.split(" ");
|
|
31938
|
+
const lines = [];
|
|
31939
|
+
let current = "";
|
|
31940
|
+
words.forEach(w => {
|
|
31941
|
+
// +1 so we count the space that will be added
|
|
31942
|
+
if ((current.length ? current.length + 1 : 0) + w.length > MAX_CHARS_PER_LINE) {
|
|
31943
|
+
lines.push(current.trim());
|
|
31944
|
+
current = w;
|
|
31945
|
+
} else {
|
|
31946
|
+
current += (current ? " " : "") + w;
|
|
31947
|
+
}
|
|
31948
|
+
});
|
|
31949
|
+
if (current) lines.push(current.trim());
|
|
31907
31950
|
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
|
|
31911
|
-
|
|
31912
|
-
|
|
31913
|
-
|
|
31914
|
-
|
|
31951
|
+
/* ── 2. squash down to two lines & add "..." if necessary ───────────────── */
|
|
31952
|
+
if (lines.length > MAX_LINES) {
|
|
31953
|
+
const firstLine = lines[0]; // keep it as-is
|
|
31954
|
+
// join everything after the first line and truncate
|
|
31955
|
+
let secondLine = lines.slice(1).join(" ");
|
|
31956
|
+
if (secondLine.length > MAX_CHARS_PER_LINE - 3) {
|
|
31957
|
+
secondLine = secondLine.slice(0, MAX_CHARS_PER_LINE - 3).trim();
|
|
31958
|
+
}
|
|
31959
|
+
lines.length = 0;
|
|
31960
|
+
lines.push(firstLine, `${secondLine}…`);
|
|
31915
31961
|
}
|
|
31916
|
-
|
|
31917
|
-
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
|
|
31921
|
-
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
|
|
31928
|
-
|
|
31929
|
-
|
|
31930
|
-
|
|
31931
|
-
|
|
31932
|
-
|
|
31933
|
-
|
|
31934
|
-
|
|
31935
|
-
|
|
31936
|
-
|
|
31962
|
+
|
|
31963
|
+
/* ── 3. render ──────────────────────────────────────────────────────────── */
|
|
31964
|
+
return /*#__PURE__*/React$1.createElement("g", {
|
|
31965
|
+
transform: `translate(${x},${y})`
|
|
31966
|
+
}, /*#__PURE__*/React$1.createElement("text", {
|
|
31967
|
+
textAnchor: "middle",
|
|
31968
|
+
fontFamily: "Poppins",
|
|
31969
|
+
fontSize: 14,
|
|
31970
|
+
fill: "#212121"
|
|
31971
|
+
}, lines.map((line, idx) => /*#__PURE__*/React$1.createElement("tspan", {
|
|
31972
|
+
key: idx,
|
|
31973
|
+
x: 0
|
|
31974
|
+
/* first line sits on the baseline (≈ 0.71 em down); every
|
|
31975
|
+
additional line gets another 1.2 em offset */,
|
|
31976
|
+
dy: idx === 0 ? "0.71em" : "1.2em"
|
|
31977
|
+
}, line))));
|
|
31978
|
+
});
|
|
31979
|
+
const CustomTooltip = ({
|
|
31980
|
+
active,
|
|
31981
|
+
payload
|
|
31982
|
+
}) => {
|
|
31983
|
+
if (!active || !payload || !payload.length) return null;
|
|
31984
|
+
const data = payload[0]?.payload;
|
|
31985
|
+
if (!data) return null;
|
|
31986
|
+
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, `${data.label}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.typeTitle}: ${getFormattedValue(data.value)}${getFormattedUnits(data.value)}`));
|
|
31937
31987
|
};
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31960
|
-
|
|
31961
|
-
|
|
31962
|
-
|
|
31963
|
-
|
|
31964
|
-
|
|
31965
|
-
|
|
31966
|
-
|
|
31967
|
-
|
|
31968
|
-
|
|
31969
|
-
|
|
31970
|
-
|
|
31971
|
-
|
|
31972
|
-
|
|
31973
|
-
|
|
31974
|
-
|
|
31975
|
-
},
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
31984
|
-
|
|
31985
|
-
|
|
31986
|
-
|
|
31987
|
-
|
|
31988
|
-
|
|
31989
|
-
|
|
31990
|
-
|
|
31991
|
-
|
|
31992
|
-
|
|
31993
|
-
|
|
31994
|
-
|
|
31995
|
-
|
|
31996
|
-
|
|
31997
|
-
|
|
31998
|
-
}
|
|
31999
|
-
value: "8 w"
|
|
32000
|
-
}, {
|
|
32001
|
-
value: "13 w"
|
|
32002
|
-
}],
|
|
32003
|
-
width: 120,
|
|
32004
|
-
height: 40,
|
|
32005
|
-
controlradius: 8,
|
|
32006
|
-
segmentradius: 8,
|
|
32007
|
-
gap: "0px",
|
|
32008
|
-
fontSize: 14,
|
|
32009
|
-
selectedsegmentcolor: "#3a9df9",
|
|
32010
|
-
selectedtextcolor: "#212121",
|
|
32011
|
-
unselectedtextcolor: "black",
|
|
32012
|
-
defaultIndex: 0,
|
|
32013
|
-
onClick: () => {}
|
|
31988
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
31989
|
+
style: {
|
|
31990
|
+
width: "100%",
|
|
31991
|
+
height: "100%"
|
|
31992
|
+
}
|
|
31993
|
+
}, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
|
|
31994
|
+
width: "100%",
|
|
31995
|
+
height: "90%"
|
|
31996
|
+
}, /*#__PURE__*/React$1.createElement(BarChart$1, {
|
|
31997
|
+
data: dataWithIndex,
|
|
31998
|
+
margin: {
|
|
31999
|
+
top: 40,
|
|
32000
|
+
right: 40,
|
|
32001
|
+
left: 20,
|
|
32002
|
+
bottom: 0
|
|
32003
|
+
}
|
|
32004
|
+
}, /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
32005
|
+
strokeDasharray: "3 3",
|
|
32006
|
+
vertical: false
|
|
32007
|
+
}), /*#__PURE__*/React$1.createElement(XAxis, {
|
|
32008
|
+
dataKey: "label",
|
|
32009
|
+
tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
|
|
32010
|
+
interval: 0,
|
|
32011
|
+
height: 50,
|
|
32012
|
+
tickLine: false
|
|
32013
|
+
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
32014
|
+
type: "number",
|
|
32015
|
+
domain: [0, dataMax => dataMax * 1.3],
|
|
32016
|
+
hide: true
|
|
32017
|
+
}), /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
32018
|
+
cursor: barData.length > 80,
|
|
32019
|
+
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
|
|
32020
|
+
}), /*#__PURE__*/React$1.createElement(Bar, {
|
|
32021
|
+
dataKey: "value",
|
|
32022
|
+
fill: "#CCDCDD",
|
|
32023
|
+
barSize: 53,
|
|
32024
|
+
name: "INC Sales"
|
|
32025
|
+
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
32026
|
+
dataKey: "value",
|
|
32027
|
+
position: "top",
|
|
32028
|
+
formatter: value => `$${getFormattedValue(value)}${getFormattedUnits(value)}`,
|
|
32029
|
+
fill: "#212121",
|
|
32030
|
+
fontSize: 16,
|
|
32031
|
+
fontWeight: "400",
|
|
32032
|
+
fontFamily: "Poppins"
|
|
32033
|
+
})), /*#__PURE__*/React$1.createElement(Brush, {
|
|
32034
|
+
height: 30,
|
|
32035
|
+
fill: "#EFEFEF",
|
|
32036
|
+
travellerWidth: 10,
|
|
32037
|
+
startIndex: 0,
|
|
32038
|
+
endIndex: Math.min(6, barData.length - 1),
|
|
32039
|
+
className: "custom-brush"
|
|
32040
|
+
}))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
|
|
32041
|
+
width: "100%",
|
|
32042
|
+
height: "40px",
|
|
32043
|
+
legendData: [{
|
|
32044
|
+
iconColor: "#CCDCDD",
|
|
32045
|
+
iconType: "Square",
|
|
32046
|
+
title: "INC Units"
|
|
32047
|
+
}]
|
|
32048
|
+
}));
|
|
32014
32049
|
};
|
|
32015
32050
|
|
|
32016
|
-
|
|
32017
|
-
|
|
32018
|
-
|
|
32051
|
+
const InnerBar = props => {
|
|
32052
|
+
const {
|
|
32053
|
+
brushInnerBarData
|
|
32054
|
+
} = props;
|
|
32055
|
+
const MAX_CHARS_PER_LINE = getMaxCharsPerLine(brushInnerBarData.length);
|
|
32056
|
+
const MAX_LINES = 2;
|
|
32019
32057
|
const BarWithInner = props => {
|
|
32020
32058
|
const {
|
|
32021
32059
|
x,
|
|
@@ -32040,7 +32078,7 @@ function InnerBarChart({
|
|
|
32040
32078
|
x: x + width / 2,
|
|
32041
32079
|
y: y - 8,
|
|
32042
32080
|
textAnchor: "middle",
|
|
32043
|
-
fontSize:
|
|
32081
|
+
fontSize: 16,
|
|
32044
32082
|
fontWeight: 400,
|
|
32045
32083
|
fontFamily: "Poppins",
|
|
32046
32084
|
fill: "#212121"
|
|
@@ -32056,61 +32094,76 @@ function InnerBarChart({
|
|
|
32056
32094
|
x: x + width / 2,
|
|
32057
32095
|
y: innerY - 6,
|
|
32058
32096
|
textAnchor: "middle",
|
|
32059
|
-
fontSize:
|
|
32097
|
+
fontSize: 16,
|
|
32060
32098
|
fontWeight: 400,
|
|
32061
32099
|
fontFamily: "Poppins",
|
|
32062
32100
|
fill: "#212121"
|
|
32063
32101
|
}, `${getFormattedValue(payload.actual)}${getFormattedUnits(payload.actual)}`));
|
|
32064
32102
|
};
|
|
32065
|
-
const CustomTooltip = ({
|
|
32103
|
+
const CustomTooltip = /*#__PURE__*/React$1.memo(({
|
|
32066
32104
|
active,
|
|
32067
|
-
payload
|
|
32068
|
-
label
|
|
32105
|
+
payload
|
|
32069
32106
|
}) => {
|
|
32070
32107
|
if (!active || !payload || !payload.length) return null;
|
|
32071
|
-
const data = payload[0].payload;
|
|
32072
|
-
const repeaterPercentage = (data.actual / data.total * 100).toFixed(1);
|
|
32073
|
-
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, `${data.label}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `New Shoppers: ${getFormattedValue(data.total)}${getFormattedUnits(data.total)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `Repeaters: ${getFormattedValue(data.actual)}${getFormattedUnits(data.actual)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `% Repeaters: ${repeaterPercentage}%`));
|
|
32074
|
-
};
|
|
32075
|
-
const CustomizedTick = props => {
|
|
32076
32108
|
const {
|
|
32077
|
-
|
|
32078
|
-
|
|
32079
|
-
|
|
32080
|
-
|
|
32081
|
-
|
|
32082
|
-
|
|
32083
|
-
|
|
32084
|
-
|
|
32085
|
-
|
|
32086
|
-
|
|
32087
|
-
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32109
|
+
label,
|
|
32110
|
+
description,
|
|
32111
|
+
total,
|
|
32112
|
+
actual
|
|
32113
|
+
} = payload[0].payload;
|
|
32114
|
+
const repeaterPercentage = (actual / total * 100).toFixed(1);
|
|
32115
|
+
return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, null, label), /*#__PURE__*/React$1.createElement(TooltipText, null, description), /*#__PURE__*/React$1.createElement(TooltipText, null, `New Shoppers: ${getFormattedValue(total)}${getFormattedUnits(total)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `Repeaters: ${getFormattedValue(actual)}${getFormattedUnits(actual)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `% Repeaters: ${repeaterPercentage}%`));
|
|
32116
|
+
});
|
|
32117
|
+
const CustomizedTick = /*#__PURE__*/React$1.memo(({
|
|
32118
|
+
x,
|
|
32119
|
+
y,
|
|
32120
|
+
payload
|
|
32121
|
+
}) => {
|
|
32122
|
+
const fullText = payload?.value ?? "";
|
|
32123
|
+
|
|
32124
|
+
/* ── 1. split text into lines that are ≤ MAX_CHARS_PER_LINE ─────────────── */
|
|
32125
|
+
const words = fullText.split(" ");
|
|
32126
|
+
const lines = [];
|
|
32127
|
+
let current = "";
|
|
32128
|
+
words.forEach(w => {
|
|
32129
|
+
// +1 so we count the space that will be added
|
|
32130
|
+
if ((current.length ? current.length + 1 : 0) + w.length > MAX_CHARS_PER_LINE) {
|
|
32131
|
+
lines.push(current.trim());
|
|
32132
|
+
current = w;
|
|
32091
32133
|
} else {
|
|
32092
|
-
|
|
32134
|
+
current += (current ? " " : "") + w;
|
|
32093
32135
|
}
|
|
32094
32136
|
});
|
|
32095
|
-
if (
|
|
32096
|
-
|
|
32137
|
+
if (current) lines.push(current.trim());
|
|
32138
|
+
|
|
32139
|
+
/* ── 2. squash down to two lines & add "..." if necessary ───────────────── */
|
|
32140
|
+
if (lines.length > MAX_LINES) {
|
|
32141
|
+
const firstLine = lines[0]; // keep it as-is
|
|
32142
|
+
// join everything after the first line and truncate
|
|
32143
|
+
let secondLine = lines.slice(1).join(" ");
|
|
32144
|
+
if (secondLine.length > MAX_CHARS_PER_LINE - 3) {
|
|
32145
|
+
secondLine = secondLine.slice(0, MAX_CHARS_PER_LINE - 3).trim();
|
|
32146
|
+
}
|
|
32147
|
+
lines.length = 0;
|
|
32148
|
+
lines.push(firstLine, `${secondLine}…`);
|
|
32097
32149
|
}
|
|
32150
|
+
|
|
32151
|
+
/* ── 3. render ──────────────────────────────────────────────────────────── */
|
|
32098
32152
|
return /*#__PURE__*/React$1.createElement("g", {
|
|
32099
32153
|
transform: `translate(${x},${y})`
|
|
32100
32154
|
}, /*#__PURE__*/React$1.createElement("text", {
|
|
32101
|
-
x: 0,
|
|
32102
|
-
y: 0,
|
|
32103
|
-
dy: 16,
|
|
32104
32155
|
textAnchor: "middle",
|
|
32105
|
-
|
|
32106
|
-
fontSize:
|
|
32107
|
-
|
|
32108
|
-
},
|
|
32109
|
-
key:
|
|
32110
|
-
x: 0
|
|
32111
|
-
|
|
32112
|
-
|
|
32113
|
-
|
|
32156
|
+
fontFamily: "Poppins",
|
|
32157
|
+
fontSize: 14,
|
|
32158
|
+
fill: "#212121"
|
|
32159
|
+
}, lines.map((line, idx) => /*#__PURE__*/React$1.createElement("tspan", {
|
|
32160
|
+
key: idx,
|
|
32161
|
+
x: 0
|
|
32162
|
+
/* first line sits on the baseline (≈ 0.71 em down); every
|
|
32163
|
+
additional line gets another 1.2 em offset */,
|
|
32164
|
+
dy: idx === 0 ? "0.71em" : "1.2em"
|
|
32165
|
+
}, line))));
|
|
32166
|
+
});
|
|
32114
32167
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
32115
32168
|
style: {
|
|
32116
32169
|
width: "100%",
|
|
@@ -32118,14 +32171,14 @@ function InnerBarChart({
|
|
|
32118
32171
|
}
|
|
32119
32172
|
}, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
|
|
32120
32173
|
width: "100%",
|
|
32121
|
-
height: "
|
|
32174
|
+
height: "90%"
|
|
32122
32175
|
}, /*#__PURE__*/React$1.createElement(BarChart$1, {
|
|
32123
32176
|
data: brushInnerBarData,
|
|
32124
32177
|
margin: {
|
|
32125
32178
|
top: 30,
|
|
32126
|
-
right:
|
|
32179
|
+
right: 20,
|
|
32127
32180
|
left: 20,
|
|
32128
|
-
bottom:
|
|
32181
|
+
bottom: 0
|
|
32129
32182
|
}
|
|
32130
32183
|
}, /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
32131
32184
|
strokeDasharray: "3 3",
|
|
@@ -32133,23 +32186,27 @@ function InnerBarChart({
|
|
|
32133
32186
|
}), /*#__PURE__*/React$1.createElement(XAxis, {
|
|
32134
32187
|
dataKey: "label",
|
|
32135
32188
|
tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
|
|
32136
|
-
height:
|
|
32189
|
+
height: 50,
|
|
32190
|
+
tickLine: false,
|
|
32137
32191
|
interval: 0
|
|
32138
32192
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
32139
32193
|
type: "number",
|
|
32140
|
-
domain: [0,
|
|
32194
|
+
domain: [0, dataMax => dataMax * 1.3],
|
|
32141
32195
|
hide: true
|
|
32142
32196
|
}), /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
32197
|
+
cursor: brushInnerBarData.length > 80,
|
|
32143
32198
|
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
|
|
32144
32199
|
}), /*#__PURE__*/React$1.createElement(Bar, {
|
|
32145
32200
|
dataKey: "total",
|
|
32146
32201
|
shape: /*#__PURE__*/React$1.createElement(BarWithInner, null),
|
|
32147
|
-
barSize:
|
|
32202
|
+
barSize: 55
|
|
32148
32203
|
}), /*#__PURE__*/React$1.createElement(Brush, {
|
|
32149
32204
|
height: 30,
|
|
32205
|
+
fill: "#EFEFEF",
|
|
32150
32206
|
travellerWidth: 10,
|
|
32151
32207
|
startIndex: 0,
|
|
32152
|
-
endIndex: Math.min(6, brushInnerBarData.length - 1)
|
|
32208
|
+
endIndex: Math.min(6, brushInnerBarData.length - 1),
|
|
32209
|
+
className: "custom-brush"
|
|
32153
32210
|
}))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
|
|
32154
32211
|
width: "100%",
|
|
32155
32212
|
height: "40px",
|
|
@@ -32163,7 +32220,7 @@ function InnerBarChart({
|
|
|
32163
32220
|
title: "Repeaters"
|
|
32164
32221
|
}]
|
|
32165
32222
|
}));
|
|
32166
|
-
}
|
|
32223
|
+
};
|
|
32167
32224
|
|
|
32168
32225
|
const BrushChart = props => {
|
|
32169
32226
|
const {
|
|
@@ -32173,14 +32230,14 @@ const BrushChart = props => {
|
|
|
32173
32230
|
brushBarIncData,
|
|
32174
32231
|
brushBarBasketData,
|
|
32175
32232
|
brushAreaBarData,
|
|
32233
|
+
segmentedbuttonOptions,
|
|
32176
32234
|
title
|
|
32177
32235
|
} = props;
|
|
32178
|
-
const segmentedbuttonOptions = ["New Shoppers & Repeaters", "INC Sales & ROI", "INC Units", "Basket Lift"];
|
|
32179
32236
|
const [selectedOption, setSelectedOption] = useState(segmentedbuttonOptions[0]);
|
|
32180
32237
|
return /*#__PURE__*/React$1.createElement(Container, {
|
|
32181
32238
|
height: height,
|
|
32182
32239
|
width: width
|
|
32183
|
-
}, /*#__PURE__*/React$1.createElement(Title$1, null, title), /*#__PURE__*/React$1.createElement(
|
|
32240
|
+
}, /*#__PURE__*/React$1.createElement(Title$1, null, title), /*#__PURE__*/React$1.createElement(SegmentedContainer, {
|
|
32184
32241
|
gap: "8px",
|
|
32185
32242
|
options: segmentedbuttonOptions.map(value => ({
|
|
32186
32243
|
value
|
|
@@ -32191,15 +32248,15 @@ const BrushChart = props => {
|
|
|
32191
32248
|
} = _ref;
|
|
32192
32249
|
return setSelectedOption(value);
|
|
32193
32250
|
}
|
|
32194
|
-
}), selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React$1.createElement(
|
|
32251
|
+
}), /*#__PURE__*/React$1.createElement(ChartContainer, null, selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React$1.createElement(InnerBar, {
|
|
32195
32252
|
brushInnerBarData: brushInnerBarData
|
|
32196
|
-
}), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React$1.createElement(
|
|
32253
|
+
}), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React$1.createElement(BarLine, {
|
|
32197
32254
|
brushAreaBarData: brushAreaBarData
|
|
32198
32255
|
}), selectedOption === "INC Units" && /*#__PURE__*/React$1.createElement(SingleChart, {
|
|
32199
32256
|
barData: brushBarIncData
|
|
32200
32257
|
}), selectedOption === "Basket Lift" && /*#__PURE__*/React$1.createElement(SingleChart, {
|
|
32201
32258
|
barData: brushBarBasketData
|
|
32202
|
-
}));
|
|
32259
|
+
})));
|
|
32203
32260
|
};
|
|
32204
32261
|
|
|
32205
32262
|
const Overlay = styled.div`
|