@majoo-ui/react 1.63.3 → 2.0.1

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/charts.esm.js ADDED
@@ -0,0 +1,1453 @@
1
+ import { s as styled } from './stitches.config.esm.js';
2
+ import { B as Box, F as Flex, b as Button, H as Heading, T as Text, a as Paragraph, I as Image } from './ModalDialog.esm.js';
3
+ import { p as Tooltip$1, T as Tag, o as InputSelect, c as InputCheckbox, a as Separator } from './Separator.esm.js';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { foundations } from '@majoo-ui/core';
6
+ import React__default, { useState, useRef, useEffect } from 'react';
7
+ import { ResponsiveContainer, LineChart as LineChart$1, XAxis, YAxis, CartesianGrid, Tooltip as Tooltip$2, Line, BarChart, Legend, Bar, Cell, LabelList, PieChart as PieChart$1, Pie, Sector } from 'recharts';
8
+ import moment from 'moment';
9
+ import { CloseOutline, PlusOutline } from '@majoo-ui/icons';
10
+ import '@stitches/react';
11
+ import 'react-i18next';
12
+ import '@radix-ui/react-dialog';
13
+ import '@majoo-ui/helpers';
14
+ import '@radix-ui/react-checkbox';
15
+ import '@radix-ui/react-label';
16
+ import 'react-dom/server';
17
+ import 'downshift';
18
+ import 'lodash.debounce';
19
+ import 'react-infinite-scroller';
20
+ import '@floating-ui/react';
21
+ import '@radix-ui/react-tooltip';
22
+ import '@radix-ui/react-separator';
23
+
24
+ var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHEAAACNCAYAAACALpWyAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAADCcSURBVHgB7X0JnFxVlff/bbVXd/XeSTohKwlbgCwswSDKLjMOo4K44DduqMzIMjqKIkMj48o4MvK5gLOpOH6KoqIgi5ig7JBAgEAWErJ20p3eq2t/y3fOvfe9epV0IOlEws/U6d/rqrffd8895/zPcl8BdapTnepUpzrVqU51qlOd6lSnO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OvxH8pzd6uKtOdapTnepUpzrVqU51qlOd6lSnOtWpTnWqU53qVKc61alOdapTnepUpzrVqU51qlOd6lSnOtWpTnWqU53qVKc61alOdapTneo0Efr/PMm3yIxL++4AAAAASUVORK5CYII=";
25
+
26
+ //@ts-nocheck
27
+ const formatHour = date => moment(date, 'YYYY-MM-DD HH:mm:ss').format('HH:mm');
28
+ const formatDay = date => moment(date).locale('id-ID').format('DD MMM');
29
+ const formatMonth = date => moment(date).locale('id-ID').format('MMM');
30
+ const formatYear = date => new Date(Date.parse(date)).toLocaleDateString('id-ID', {
31
+ year: 'numeric'
32
+ });
33
+ const handleXaxis = (date, period) => {
34
+ switch (period) {
35
+ case 'jam':
36
+ return formatHour(date);
37
+ case 'hari':
38
+ return formatDay(date);
39
+ case 'minggu':
40
+ return formatDay(date);
41
+ case 'bulan':
42
+ return formatMonth(date);
43
+ case 'tahun':
44
+ return formatYear(date);
45
+ default:
46
+ return formatDay(date);
47
+ }
48
+ };
49
+ const currency = ({
50
+ value,
51
+ type = 'Rp',
52
+ thousandSeparator = '.',
53
+ decimal = false,
54
+ convertMinus = false
55
+ }) => {
56
+ let formattedNumber;
57
+ if (decimal) {
58
+ const toFixedNum = parseFloat(value).toFixed(2);
59
+ const decimalSplit = toFixedNum ? toFixedNum.split('.') : ['0', '00'];
60
+ decimalSplit[0] = decimalSplit[0].toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandSeparator}`);
61
+ formattedNumber = decimalSplit.join(thousandSeparator === ',' ? '.' : ',');
62
+ } else {
63
+ formattedNumber = Math.round(value).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, `$1${thousandSeparator}`);
64
+ }
65
+ if (convertMinus && parseFloat(value) < 0) {
66
+ const numberWithoutMinus = formattedNumber.toString().replace('-', '');
67
+ return type.length > 0 ? `( ${type} ${numberWithoutMinus} )` : `( ${numberWithoutMinus} )`;
68
+ }
69
+ return type.length > 0 ? `${type} ${formattedNumber}` : formattedNumber;
70
+ };
71
+ const numSeparator = num => {
72
+ const toFixedNum = parseFloat(num).toFixed(2); // set two decimal places
73
+ const decimalSplit = toFixedNum.split('.');
74
+ let formatedNumber = decimalSplit[0].toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1.');
75
+ if (decimalSplit.length <= 2) {
76
+ const decimalNumber = decimalSplit[1];
77
+ if (decimalNumber) {
78
+ formatedNumber += `,${decimalNumber}`;
79
+ }
80
+ }
81
+ return formatedNumber;
82
+ };
83
+ const formatCurrency = (number, options) => new Intl.NumberFormat('id-Id', Object.assign({
84
+ style: 'currency',
85
+ currency: 'IDR'
86
+ }, options)).format(number);
87
+ const compactCurrency = number => formatCurrency(number, {
88
+ notation: 'compact',
89
+ compactDisplay: 'short'
90
+ }).replace('Rp', '').trim();
91
+ const roundUp = highestVal => {
92
+ let upper = 1;
93
+ for (let j = 0; j < Number.parseInt(highestVal, 10).toString().length; j += 1) {
94
+ upper += String(0);
95
+ }
96
+ if (highestVal === 0 || highestVal === Number.NEGATIVE_INFINITY) {
97
+ return 1;
98
+ }
99
+ if (highestVal <= 5) {
100
+ return 5;
101
+ }
102
+ if (Math.ceil(highestVal) % (upper / 10) !== 0) {
103
+ const newHighest = Math.ceil(highestVal / (upper * 0.2)) * (upper * 0.2);
104
+ return newHighest;
105
+ }
106
+ return highestVal;
107
+ };
108
+ const roundDown = lowestVal => {
109
+ let upper,
110
+ _lowestVal = 0;
111
+ if (lowestVal) {
112
+ if (parseFloat(lowestVal) < 0) {
113
+ upper = -1;
114
+ for (let z = 0; z < Math.abs(parseInt(lowestVal, 10)).toString().length; z += 1) {
115
+ upper += String(0);
116
+ }
117
+ if (Math.ceil(lowestVal) % (upper / 10) !== 0) {
118
+ const newLowest = Math.ceil(lowestVal / (upper * 0.2)) * (upper * 0.2);
119
+ _lowestVal = Math.ceil(newLowest);
120
+ } else {
121
+ _lowestVal = lowestVal;
122
+ }
123
+ }
124
+ return _lowestVal;
125
+ }
126
+ return _lowestVal;
127
+ };
128
+ function isValidDate(date) {
129
+ return date instanceof Date && !isNaN(date);
130
+ }
131
+
132
+ const tooltipLabel = (name, variants) => {
133
+ if (variants && variants.length > 0) {
134
+ return `${name} - ${variants && variants.join(', ')}`;
135
+ }
136
+ return name;
137
+ };
138
+ const ProductList = props => {
139
+ const {
140
+ variants = [],
141
+ name,
142
+ direction,
143
+ css
144
+ } = props;
145
+ return jsx(Tooltip$1, {
146
+ label: tooltipLabel(name, variants),
147
+ children: jsxs(Box, {
148
+ gap: 2,
149
+ css: Object.assign({
150
+ display: 'flex',
151
+ alignItems: 'center',
152
+ flexDirection: direction === 'column' ? 'column' : 'row',
153
+ gap: '4px',
154
+ maxWidth: '250px',
155
+ '@md': {
156
+ maxWidth: '124px',
157
+ flexDirection: direction === 'row' ? 'row' : 'column',
158
+ alignItems: 'flex-start'
159
+ }
160
+ }, css),
161
+ children: [jsx(Box, {
162
+ title: name && name,
163
+ css: {
164
+ maxWidth: '124px',
165
+ overflow: 'hidden',
166
+ whiteSpace: 'nowrap',
167
+ textOverflow: 'ellipsis',
168
+ fontSize: 14,
169
+ fontWeight: 600,
170
+ color: '$textSecondary'
171
+ },
172
+ children: name
173
+ }), variants && variants.length > 0 && jsxs(React__default.Fragment, {
174
+ children: [jsx(Flex, {
175
+ gap: 2,
176
+ children: variants.slice(0, 2).map(variant => jsx(Tag, {
177
+ css: {
178
+ height: 'auto',
179
+ padding: '4px 8px'
180
+ },
181
+ type: "varian",
182
+ children: variant
183
+ }, variant))
184
+ }), variants.length > 2 && jsx(Tag, {
185
+ css: {
186
+ height: 'auto',
187
+ padding: '4px 8px',
188
+ minWidth: 'unset',
189
+ justifyContent: 'flex-start',
190
+ mr: 'auto'
191
+ },
192
+ type: "varian",
193
+ children: `+${variants.length - 2}`
194
+ }, "index")]
195
+ })]
196
+ })
197
+ });
198
+ };
199
+
200
+ const {
201
+ colors: colors$4
202
+ } = foundations;
203
+ const ComparatorItem = props => {
204
+ const {
205
+ dataKey,
206
+ color,
207
+ onCloseClick,
208
+ disableClose,
209
+ variants
210
+ } = props;
211
+ return jsxs(Flex, {
212
+ id: "comparator-item",
213
+ children: [jsxs(Box, {
214
+ css: {
215
+ display: 'flex',
216
+ flexDirection: 'column',
217
+ '@sm': {
218
+ padding: '$spacing-02',
219
+ gap: 8,
220
+ backgroundColor: '$white',
221
+ boxShadow: '$small',
222
+ borderRadius: '$md'
223
+ },
224
+ '@md': {
225
+ padding: '$spacing-03 $spacing-04',
226
+ gap: '$compact',
227
+ backgroundColor: 'none',
228
+ boxShadow: 'none',
229
+ borderRadius: 'none'
230
+ }
231
+ },
232
+ children: [jsxs(Box, {
233
+ css: {
234
+ display: 'flex',
235
+ alignItems: 'center',
236
+ position: 'relative',
237
+ gap: '$spacing-08',
238
+ '@md': {
239
+ gap: '$spacing-10'
240
+ }
241
+ },
242
+ children: [jsxs(Box, {
243
+ css: {
244
+ display: 'flex',
245
+ alignItems: 'center',
246
+ height: 24
247
+ },
248
+ children: [jsx(Box, {
249
+ css: {
250
+ position: 'absolute',
251
+ left: 4,
252
+ backgroundColor: color,
253
+ width: 12,
254
+ height: 12,
255
+ borderRadius: '50%'
256
+ }
257
+ }), jsx(Box, {
258
+ css: {
259
+ width: 80,
260
+ height: 4,
261
+ backgroundColor: color
262
+ }
263
+ })]
264
+ }), jsx(Box, {
265
+ onClick: () => onCloseClick(),
266
+ css: {
267
+ cursor: 'pointer',
268
+ display: disableClose ? 'none' : 'block'
269
+ },
270
+ children: jsx(CloseOutline, {
271
+ color: colors$4.textSecondary,
272
+ size: 24
273
+ })
274
+ })]
275
+ }), jsx(ProductList, {
276
+ name: dataKey,
277
+ variants: variants,
278
+ direction: "column",
279
+ css: {
280
+ '& > div': {
281
+ fontWeight: 600
282
+ }
283
+ }
284
+ })]
285
+ }), jsx(Box, {
286
+ id: "separator-item",
287
+ css: {
288
+ height: '100%',
289
+ width: 1,
290
+ backgroundColor: '$bgBorder'
291
+ }
292
+ })]
293
+ });
294
+ };
295
+
296
+ const {
297
+ colors: colors$3
298
+ } = foundations;
299
+ const ComparatorController = ({
300
+ option,
301
+ onComparatorAdd,
302
+ onComparatorSearch,
303
+ placeholder
304
+ }) => {
305
+ const [toggle, setToggle] = useState(true);
306
+ const [selectedValue, setSelectedValue] = useState();
307
+ const ref = useRef(null);
308
+ const handleToggle = () => {
309
+ setToggle(!toggle);
310
+ };
311
+ const handleSelected = selected => {
312
+ onComparatorAdd(selected);
313
+ setSelectedValue(undefined);
314
+ setToggle(true);
315
+ };
316
+ const handleSearch = keyword => {
317
+ onComparatorSearch(keyword);
318
+ return keyword;
319
+ };
320
+ useEffect(() => {
321
+ function handleClickOutside(event) {
322
+ if (ref.current && !ref.current.contains(event.target) && !toggle) {
323
+ setToggle(!toggle);
324
+ }
325
+ }
326
+ document.addEventListener('mousedown', handleClickOutside);
327
+ return () => {
328
+ document.removeEventListener('mousedown', handleClickOutside);
329
+ };
330
+ }, [ref, toggle, selectedValue]);
331
+ return jsxs(React__default.Fragment, {
332
+ children: [jsx(Box, {
333
+ css: {
334
+ display: toggle ? 'flex' : 'none',
335
+ justifyContent: 'center',
336
+ alignItems: 'center',
337
+ '@sm': {
338
+ padding: 0
339
+ }
340
+ },
341
+ children: jsx(Button, {
342
+ buttonType: "ghost",
343
+ css: {
344
+ fontWeight: 600,
345
+ fontSize: 14,
346
+ '@sm': {
347
+ height: 60,
348
+ width: '100%',
349
+ backgroundColor: '$white',
350
+ boxShadow: '$small',
351
+ borderRadius: '$md'
352
+ },
353
+ '@md': {
354
+ height: 'auto',
355
+ width: 'auto',
356
+ backgroundColor: 'none',
357
+ boxShadow: 'none',
358
+ borderRadius: 'none'
359
+ }
360
+ },
361
+ leftIcon: jsx(PlusOutline, {
362
+ size: 24,
363
+ color: colors$3.primary500
364
+ }),
365
+ onClick: () => handleToggle(),
366
+ children: "Perbandingan"
367
+ })
368
+ }), jsx(Box, {
369
+ css: {
370
+ display: toggle ? 'none' : 'flex',
371
+ justifyContent: 'center',
372
+ alignItems: 'center',
373
+ padding: '$spacing-03 $spacing-04'
374
+ },
375
+ children: jsx("div", {
376
+ ref: ref,
377
+ children: jsx(InputSelect, {
378
+ showLeadingIcon: true,
379
+ search: true,
380
+ size: "sm",
381
+ placeholder: placeholder,
382
+ option: option,
383
+ onChange: x => handleSelected(x),
384
+ onSearch: y => handleSearch(y),
385
+ css: {
386
+ '& > div > div': {
387
+ maxHeight: '250px',
388
+ '&::-webkit-scrollbar': {
389
+ display: 'none'
390
+ }
391
+ }
392
+ }
393
+ }, String(toggle))
394
+ })
395
+ })]
396
+ });
397
+ };
398
+
399
+ const Comparator = props => {
400
+ const {
401
+ option,
402
+ onCloseClick,
403
+ onComparatorAdd,
404
+ legendData,
405
+ placeholder,
406
+ onComparatorSearch
407
+ } = props;
408
+ const [filteredOption, setFilteredOption] = useState(option);
409
+ const [isDisableClose, setIsDisableClose] = useState(false);
410
+ const visibleOptions = option.filter(opt => !opt.hide);
411
+ useEffect(() => {
412
+ setFilteredOption(legendData.filter(f => !option.some(l => {
413
+ if (typeof l.value === 'number') {
414
+ return +l.value === +f.value;
415
+ }
416
+ if (typeof l.value === 'string') {
417
+ return String(l.value) === String(f.value);
418
+ }
419
+ return false;
420
+ })));
421
+ if (option.length === 1) {
422
+ setIsDisableClose(true);
423
+ } else {
424
+ setIsDisableClose(false);
425
+ }
426
+ }, [option, legendData]);
427
+ const Container = styled(Flex, {
428
+ borderRadius: 8,
429
+ marginTop: '$spacing-02',
430
+ '@sm': {
431
+ display: 'grid',
432
+ gap: 8,
433
+ gridTemplateColumns: 'repeat(2,1fr)',
434
+ boxShadow: 'none',
435
+ backgroundColor: 'transparent'
436
+ },
437
+ '@md': {
438
+ display: 'flex',
439
+ flexWrap: 'wrap',
440
+ width: 'fit-content',
441
+ rowGap: '$compact',
442
+ boxShadow: '$small',
443
+ backgroundColor: '$white'
444
+ },
445
+ '& > #comparator-item:last-child > #separator-item': {
446
+ display: 'none'
447
+ }
448
+ });
449
+ return jsxs(Container, {
450
+ children: [visibleOptions.map(opt => jsx(ComparatorItem, {
451
+ dataKey: opt.dataKey,
452
+ color: opt.color,
453
+ onCloseClick: () => onCloseClick(opt),
454
+ variants: opt.variants,
455
+ disableClose: isDisableClose
456
+ }, opt.value)), option.length < COMPARISON_LIMIT && filteredOption.length > 0 && jsx(ComparatorController, {
457
+ option: filteredOption,
458
+ onComparatorAdd: d => onComparatorAdd(d),
459
+ onComparatorSearch: keyword => onComparatorSearch(keyword),
460
+ placeholder: placeholder
461
+ })]
462
+ });
463
+ };
464
+ Comparator.defaultProps = {
465
+ option: [{}]
466
+ };
467
+
468
+ const StyledDescription = styled('p', {
469
+ marginTop: '$spacing-03',
470
+ fontWeight: 400,
471
+ fontSize: 12,
472
+ color: '$textSecondary'
473
+ });
474
+ const TitleLegend = props => {
475
+ const {
476
+ title,
477
+ description,
478
+ legendData,
479
+ filteredData,
480
+ setFilteredData,
481
+ isComparator,
482
+ titleOnly
483
+ } = props;
484
+ return filteredData.length > 0 ? jsxs(Box, {
485
+ css: {
486
+ display: 'flex',
487
+ marginBottom: '$spacing-06',
488
+ '@sm': {
489
+ flexDirection: 'column',
490
+ gap: '$compact',
491
+ alignItems: 'start'
492
+ },
493
+ '@md': {
494
+ flexDirection: 'row',
495
+ justifyContent: 'space-between'
496
+ }
497
+ },
498
+ children: [jsxs(Box, {
499
+ css: {
500
+ marginBottom: '$spacing-03'
501
+ },
502
+ children: [jsx(Heading, {
503
+ heading: "sectionTitle",
504
+ css: {
505
+ lineHeight: '24px'
506
+ },
507
+ children: title
508
+ }), description && jsx(StyledDescription, {
509
+ children: description
510
+ })]
511
+ }), !titleOnly && !isComparator && jsx(Box, {
512
+ css: {
513
+ '@sm': {
514
+ display: 'grid',
515
+ gridTemplateColumns: legendData.length > 2 ? '1fr 1fr' : '1fr',
516
+ gap: legendData.length > 2 ? '$compact' : '4px'
517
+ },
518
+ '@md': {
519
+ display: 'flex',
520
+ flexWrap: 'nowrap',
521
+ gap: '$compact'
522
+ }
523
+ },
524
+ children: legendData.map(legend => jsxs(Box, {
525
+ css: {
526
+ display: 'flex',
527
+ alignItems: 'center',
528
+ justifyContent: 'start'
529
+ },
530
+ children: [legend.isHideable && jsx(InputCheckbox, {
531
+ id: legend.name,
532
+ checked: !filteredData.find(data => data.name === legend.name).hide,
533
+ onCheckedChange: status => setFilteredData(filteredData.map(data => data.name === legend.name ? Object.assign(Object.assign({}, data), {
534
+ hide: !status
535
+ }) : Object.assign({}, data)))
536
+ }), jsx(Box, {
537
+ css: {
538
+ backgroundColor: legend.color,
539
+ borderRadius: '50%',
540
+ display: 'inline-block',
541
+ margin: '0px 6px 0px 10px',
542
+ '@sm': {
543
+ height: legend.isHideable ? 4 : 10,
544
+ width: legend.isHideable ? 4 : 10
545
+ },
546
+ '@md': {
547
+ height: 6,
548
+ width: 6
549
+ }
550
+ }
551
+ }), jsx(Text, {
552
+ variant: "label",
553
+ children: legend.name
554
+ })]
555
+ }, legend.name))
556
+ })]
557
+ }) : jsx(Box, {});
558
+ };
559
+ TitleLegend.defaultProps = {
560
+ isComparator: undefined,
561
+ titleOnly: false
562
+ };
563
+
564
+ const StyledIconLeft = styled('div', {
565
+ margin: '5px 3px 5px 0px',
566
+ display: 'inline-flex',
567
+ verticalAlign: 'middle',
568
+ width: '8px',
569
+ height: '8px',
570
+ borderRadius: '50%'
571
+ });
572
+ const Tooltip = props => {
573
+ const {
574
+ hover,
575
+ payload,
576
+ active,
577
+ legendData,
578
+ xAxisKey,
579
+ chartTypeLabel,
580
+ customTooltipDate
581
+ } = props;
582
+ if (legendData.some(l => l.dataKey === 'novalue')) {
583
+ return jsx("div", {});
584
+ }
585
+ const formatValue = (legendDataKey, hoverKey, hoverValue) => {
586
+ let finalValue = '';
587
+ const selectedKey = legendDataKey.find(l => l.dataKey === hoverKey);
588
+ if (selectedKey === undefined) return finalValue;
589
+ const formattedValue = Number.isNaN(Number(hoverValue)) ? '0' : `${selectedKey.isCurrency ? currency({
590
+ value: hoverValue,
591
+ convertMinus: hoverValue < 0,
592
+ decimal: true
593
+ }) : numSeparator(hoverValue)}`;
594
+ finalValue = `${formattedValue} ${chartTypeLabel !== null && chartTypeLabel !== void 0 ? chartTypeLabel : selectedKey.name}`;
595
+ return finalValue;
596
+ };
597
+ if (active && hover) {
598
+ const visibleValue = legendData.filter(v => v.hide === false);
599
+ const mapValue = visibleValue.map(val => Object.assign(Object.assign({}, val), {
600
+ name: val.dataKey,
601
+ hoverValue: payload[0].payload[val.dataKey]
602
+ }));
603
+ const hoverDate = payload[0].payload[xAxisKey];
604
+ return jsxs(Box, {
605
+ css: {
606
+ backgroundColor: '$textContent',
607
+ color: '$white',
608
+ borderRadius: '$sm',
609
+ padding: '$spacing-03'
610
+ },
611
+ children: [payload && (customTooltipDate ? jsx(Paragraph, {
612
+ paragraph: "shortContentRegular",
613
+ children: isValidDate(hoverDate) ? customTooltipDate(hoverDate) : hoverDate
614
+ }) : jsx(Paragraph, {
615
+ paragraph: "shortContentRegular",
616
+ children: isValidDate(hoverDate) ? moment(hoverDate).locale('id-ID').format('DD MMMM YYYY') : hoverDate
617
+ })), mapValue.map((s, index) => jsxs(Flex, {
618
+ align: "center",
619
+ gap: 2,
620
+ children: [jsx(StyledIconLeft, {
621
+ css: {
622
+ backgroundColor: s.color
623
+ }
624
+ }), jsx(Paragraph, {
625
+ paragraph: "shortContentRegular",
626
+ children: formatValue(legendData, s.name, s.hoverValue)
627
+ }, s.name)]
628
+ }, `${s.name}_${index}`))]
629
+ });
630
+ }
631
+ return null;
632
+ };
633
+ Tooltip.defaultProps = {
634
+ hover: null,
635
+ payload: undefined,
636
+ active: undefined,
637
+ legendData: []
638
+ };
639
+
640
+ const {
641
+ colors: colors$2
642
+ } = foundations;
643
+ const Container = styled('div', {
644
+ '@sm': {
645
+ overflowY: 'hidden',
646
+ whiteSpace: 'nowrap',
647
+ overflowX: 'scroll',
648
+ scrollbarWidth: 0,
649
+ '&::-webkit-scrollbar': {
650
+ width: 0,
651
+ height: 0
652
+ }
653
+ },
654
+ '@md': {
655
+ overflowX: 'auto',
656
+ overflowY: 'auto',
657
+ whiteSpace: 'wrap'
658
+ }
659
+ });
660
+ const ErrorWrapper = styled('div', {
661
+ display: 'flex',
662
+ justifyContent: 'center',
663
+ alignItems: 'center',
664
+ height: '100%',
665
+ flexDirection: 'column',
666
+ variants: {
667
+ hidden: {
668
+ true: {
669
+ display: 'none'
670
+ }
671
+ }
672
+ }
673
+ });
674
+ const StyledContainer = styled('div', {
675
+ position: 'relative',
676
+ '@md': {
677
+ width: '100%',
678
+ height: 300
679
+ },
680
+ '& circle': {
681
+ r: 4
682
+ },
683
+ 'g.yAxis text': {
684
+ fontSize: '$label',
685
+ lineHeight: '$label',
686
+ fontWeight: '500',
687
+ fill: '$textSecondary'
688
+ },
689
+ 'g.xAxis text': {
690
+ fontSize: '$label',
691
+ lineHeight: '$label',
692
+ fontWeight: '500',
693
+ fill: '$textPrimary'
694
+ },
695
+ variants: {
696
+ hidden: {
697
+ true: {
698
+ '& > #responsive-container': {
699
+ display: 'none'
700
+ }
701
+ }
702
+ },
703
+ isEmpty: {
704
+ true: {
705
+ '@sm': {
706
+ width: 'auto',
707
+ height: 254,
708
+ display: 'flex',
709
+ justifyContent: 'center'
710
+ }
711
+ },
712
+ false: {
713
+ '@sm': {
714
+ width: 900,
715
+ height: 254,
716
+ display: 'inline-block',
717
+ justifyContent: 'unset'
718
+ }
719
+ }
720
+ }
721
+ }
722
+ });
723
+ const ContainerLoading = styled('div', {
724
+ display: 'flex',
725
+ justifyContent: 'center',
726
+ alignItems: 'center',
727
+ zIndex: '$docked',
728
+ position: 'absolute',
729
+ inset: 0,
730
+ top: 0,
731
+ bottom: 0,
732
+ left: 0,
733
+ right: 0,
734
+ backgroundColor: '$bgWhite',
735
+ opacity: 0.8,
736
+ userSelect: 'none',
737
+ variants: {
738
+ loading: {
739
+ false: {
740
+ display: 'none'
741
+ }
742
+ }
743
+ }
744
+ });
745
+ const COMPARISON_LIMIT = 5;
746
+ function LineChart(props) {
747
+ const {
748
+ title,
749
+ description,
750
+ data,
751
+ legendData,
752
+ xAxisKey,
753
+ isLoading,
754
+ period,
755
+ customXAxisFormat,
756
+ customYAxisFormat,
757
+ roundUpYAxis,
758
+ placeholder,
759
+ comparatorList,
760
+ chartTypeLabel,
761
+ onComparatorChange,
762
+ customTooltipDate
763
+ } = props;
764
+ const [isDividedByThousand, setIsDividedByThousand] = useState(false);
765
+ const [isComparator, setIsComparator] = useState(false);
766
+ const [hover, setHover] = useState(null);
767
+ const [filteredData, setFilteredData] = useState([]);
768
+ const [maxData, setMaxData] = useState(0);
769
+ useEffect(() => {
770
+ if (maxData > 0) {
771
+ setIsDividedByThousand(String(Math.round(maxData)).length > 10);
772
+ }
773
+ }, [maxData]);
774
+ useEffect(() => {
775
+ setFilteredData(legendData.map(value => Object.assign(Object.assign({}, value), {
776
+ hide: false,
777
+ isCurrency: !!value.isCurrency
778
+ })));
779
+ if (legendData.length === 0) {
780
+ setFilteredData([{
781
+ dataKey: 'novalue',
782
+ name: 'novalue',
783
+ color: colors$2.chartYellow,
784
+ hide: true
785
+ }]);
786
+ setIsComparator(false);
787
+ }
788
+ if (legendData.some(l => l.isComparator === true)) {
789
+ setIsComparator(true);
790
+ setFilteredData(legendData.map(value => Object.assign(Object.assign({}, value), {
791
+ hide: false
792
+ })).slice(0, COMPARISON_LIMIT));
793
+ }
794
+ }, [legendData]);
795
+ const handleActiveDot = e => {
796
+ const {
797
+ cx,
798
+ cy,
799
+ fill
800
+ } = e;
801
+ if (e.dataKey === hover) {
802
+ return jsx("circle", {
803
+ cx: cx,
804
+ cy: cy,
805
+ r: 10,
806
+ fill: colors$2.white,
807
+ stroke: fill,
808
+ strokeWidth: 3
809
+ });
810
+ }
811
+ return jsx("circle", {
812
+ cx: cx,
813
+ cy: cy,
814
+ r: 10,
815
+ fill: "#00000000",
816
+ stroke: "#00000000",
817
+ strokeWidth: 3
818
+ });
819
+ };
820
+ return jsxs(Fragment, {
821
+ children: [jsx(TitleLegend, {
822
+ title: title,
823
+ description: description,
824
+ legendData: legendData,
825
+ filteredData: filteredData,
826
+ setFilteredData: setFilteredData,
827
+ isComparator: isComparator,
828
+ isDividedByThousand: isDividedByThousand,
829
+ titleOnly: data.length === 0
830
+ }), jsx(Container, {
831
+ children: jsxs(StyledContainer, {
832
+ hidden: data.length < 1,
833
+ isEmpty: data.length < 1,
834
+ children: [jsx(ResponsiveContainer, {
835
+ id: "responsive-container",
836
+ children: jsxs(LineChart$1, {
837
+ data: legendData.length === 0 ? data.map(d => Object.assign(Object.assign({}, d), {
838
+ novalue: 0
839
+ })) : data,
840
+ margin: {
841
+ top: 20,
842
+ bottom: 5,
843
+ right: 20
844
+ },
845
+ children: [jsx(XAxis, {
846
+ dataKey: xAxisKey,
847
+ padding: {
848
+ left: 20
849
+ },
850
+ interval: "preserveEnd",
851
+ tickLine: false,
852
+ axisLine: false,
853
+ hide: data.length === 0,
854
+ dy: 10,
855
+ tickFormatter: dateValue => {
856
+ if (!isValidDate(dateValue)) return dateValue;
857
+ if (customXAxisFormat) {
858
+ return customXAxisFormat(dateValue);
859
+ }
860
+ if (period) {
861
+ return handleXaxis(dateValue, period);
862
+ }
863
+ return dateValue;
864
+ }
865
+ }), jsx(YAxis, {
866
+ textAnchor: "start",
867
+ tickLine: false,
868
+ axisLine: false,
869
+ dy: -10,
870
+ dx: -50,
871
+ type: "number",
872
+ tickCount: maxData === 0 ? 3 : 5,
873
+ allowDecimals: roundUpYAxis,
874
+ tickFormatter: val => {
875
+ if (customYAxisFormat) {
876
+ return customYAxisFormat(val);
877
+ }
878
+ return compactCurrency(val);
879
+ },
880
+ domain: [dataMin => dataMin < 0 ? roundDown(dataMin) : 0, dataMax => {
881
+ setMaxData(dataMax);
882
+ return roundUpYAxis ? roundUp(dataMax) : dataMax;
883
+ }]
884
+ }), jsx(CartesianGrid, {
885
+ vertical: false,
886
+ x: 0,
887
+ width: 9999
888
+ }), jsx(Tooltip$2, {
889
+ cursor: false,
890
+ content: jsx(Tooltip, {
891
+ hover: hover,
892
+ xAxisKey: xAxisKey,
893
+ chartTypeLabel: chartTypeLabel,
894
+ legendData: filteredData,
895
+ maxValue: maxData,
896
+ customTooltipDate: customTooltipDate
897
+ })
898
+ }), !isLoading && filteredData.map(legend => data.length === 1 ? jsx(Line, {
899
+ type: "monotone",
900
+ dot: false,
901
+ dataKey: legend.dataKey,
902
+ stroke: legend.color,
903
+ hide: legend.hide,
904
+ strokeWidth: 4,
905
+ onMouseOver: () => setHover(legend.dataKey),
906
+ activeDot: {
907
+ onMouseOver: (_, b) => {
908
+ const {
909
+ cx,
910
+ cy,
911
+ fill
912
+ } = b;
913
+ setHover(legend.dataKey);
914
+ return jsx("circle", {
915
+ cx: cx,
916
+ cy: cy,
917
+ r: 10,
918
+ fill: colors$2.white,
919
+ stroke: fill,
920
+ strokeWidth: 3
921
+ });
922
+ },
923
+ onMouseLeave: () => setHover(null)
924
+ }
925
+ }, legend.name) : jsx(Line, {
926
+ type: "monotone",
927
+ dot: false,
928
+ dataKey: legend.dataKey,
929
+ stroke: legend.color,
930
+ hide: legend.hide,
931
+ strokeWidth: 4,
932
+ onMouseOver: () => setHover(legend.dataKey),
933
+ activeDot: handleActiveDot
934
+ }, legend.name))]
935
+ })
936
+ }), jsxs(ErrorWrapper, {
937
+ hidden: data.length > 0,
938
+ children: [jsx(Image, {
939
+ src: img,
940
+ alt: "no-data-content"
941
+ }), jsx(Text, {
942
+ variant: "status",
943
+ children: "Tidak ada data yang dapat ditampilkan"
944
+ })]
945
+ }), jsx(ContainerLoading, {
946
+ loading: isLoading,
947
+ children: jsx(Text, {
948
+ variant: "caption",
949
+ children: "Loading .... "
950
+ })
951
+ })]
952
+ })
953
+ }), isComparator && comparatorList && jsx(Comparator, {
954
+ legendData: comparatorList,
955
+ placeholder: placeholder,
956
+ option: filteredData,
957
+ onCloseClick: x => onComparatorChange === null || onComparatorChange === void 0 ? void 0 : onComparatorChange({
958
+ type: 'DELETE',
959
+ payload: x
960
+ }),
961
+ onComparatorAdd: x => onComparatorChange === null || onComparatorChange === void 0 ? void 0 : onComparatorChange({
962
+ type: 'ADD',
963
+ payload: x
964
+ }),
965
+ onComparatorSearch: x => onComparatorChange === null || onComparatorChange === void 0 ? void 0 : onComparatorChange({
966
+ type: 'SEARCH',
967
+ payload: x
968
+ })
969
+ })]
970
+ });
971
+ }
972
+ LineChart.defaultProps = {
973
+ customXAxisFormat: undefined,
974
+ onComparatorChange: undefined,
975
+ comparatorList: [],
976
+ placeholder: 'Cari ...',
977
+ roundUpYAxis: true,
978
+ period: undefined
979
+ };
980
+
981
+ const {
982
+ colors: colors$1
983
+ } = foundations;
984
+ const renderLegend$1 = (formattedData, legend, subtitle, tickFormatter) => jsxs(Box, {
985
+ css: {
986
+ marginTop: '$spacing-09'
987
+ },
988
+ children: [subtitle && jsx(Flex, {
989
+ justify: "center",
990
+ children: jsx(Heading, {
991
+ css: {
992
+ marginBottom: '$spacing-06'
993
+ },
994
+ heading: "sectionTitle",
995
+ children: subtitle
996
+ })
997
+ }), formattedData.length > 0 && jsx(Flex, {
998
+ direction: "column",
999
+ gap: 5,
1000
+ children: formattedData.map((data, index) => {
1001
+ var _a, _b;
1002
+ return jsxs(Box, {
1003
+ children: [jsxs(Flex, {
1004
+ justify: "between",
1005
+ children: [jsxs(Flex, {
1006
+ align: "center",
1007
+ children: [jsx(Box, {
1008
+ css: {
1009
+ backgroundColor: data.color,
1010
+ borderRadius: '50%',
1011
+ height: 12,
1012
+ width: 12,
1013
+ display: 'inline-block',
1014
+ marginRight: '$spacing-03'
1015
+ }
1016
+ }), jsx(Box, {
1017
+ css: {
1018
+ width: 120
1019
+ },
1020
+ children: jsx(Text, {
1021
+ variant: "label",
1022
+ color: "secondary",
1023
+ children: data.name
1024
+ })
1025
+ })]
1026
+ }), legend.showTotal && jsx(Text, {
1027
+ variant: "label",
1028
+ color: "secondary",
1029
+ children: tickFormatter ? tickFormatter === null || tickFormatter === void 0 ? void 0 : tickFormatter((_a = formattedData[index]) === null || _a === void 0 ? void 0 : _a.total) : (_b = formattedData[index]) === null || _b === void 0 ? void 0 : _b.total
1030
+ })]
1031
+ }), jsx(Separator, {
1032
+ css: {
1033
+ marginTop: '$spacing-03'
1034
+ }
1035
+ })]
1036
+ }, index);
1037
+ })
1038
+ })]
1039
+ });
1040
+ const DEFAULT_DATA = [{
1041
+ name: 'none',
1042
+ total: 0,
1043
+ color: colors$1.chartGreen
1044
+ }];
1045
+ function BarChartComponent({
1046
+ css,
1047
+ data,
1048
+ legend,
1049
+ title,
1050
+ subtitle,
1051
+ tooltip,
1052
+ direction,
1053
+ tickFormatter,
1054
+ label,
1055
+ yAxis
1056
+ }) {
1057
+ var _a, _b;
1058
+ const isHorizontal = direction === 'horizontal';
1059
+ const MIN_HEIGHT = 350;
1060
+ const MIN_WIDTH = 500;
1061
+ const formattedData = data.length ? data : DEFAULT_DATA;
1062
+ const CustomTooltip = ({
1063
+ payload = {},
1064
+ active = false
1065
+ }) => {
1066
+ var _a;
1067
+ if (active) {
1068
+ const {
1069
+ total,
1070
+ name
1071
+ } = payload[0].payload;
1072
+ return jsxs(Box, {
1073
+ css: {
1074
+ backgroundColor: '$textContent',
1075
+ color: '$white',
1076
+ borderRadius: '$sm',
1077
+ padding: '$spacing-02',
1078
+ flexDirection: 'column'
1079
+ },
1080
+ children: [jsx(Text, {
1081
+ variant: "placeholder",
1082
+ color: "disable",
1083
+ css: {
1084
+ fontSize: 11
1085
+ },
1086
+ children: name
1087
+ }), jsx(Paragraph, {
1088
+ paragraph: "shortContentRegular",
1089
+ css: {
1090
+ color: '$white',
1091
+ fontSize: 12
1092
+ },
1093
+ children: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.label) ? (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.label) === null || _a === void 0 ? void 0 : _a.call(tooltip, total) : total
1094
+ })]
1095
+ });
1096
+ }
1097
+ return null;
1098
+ };
1099
+ return jsxs(Box, {
1100
+ children: [title && jsx(Heading, {
1101
+ heading: "sectionTitle",
1102
+ children: title
1103
+ }), jsx(Box, {
1104
+ css: Object.assign({
1105
+ width: MIN_WIDTH,
1106
+ height: MIN_HEIGHT,
1107
+ marginTop: '$spacing-07'
1108
+ }, css),
1109
+ children: jsx(ResponsiveContainer, {
1110
+ children: jsxs(BarChart, {
1111
+ width: MIN_WIDTH,
1112
+ height: MIN_HEIGHT,
1113
+ data: formattedData,
1114
+ layout: isHorizontal ? 'vertical' : 'horizontal',
1115
+ children: [jsx(CartesianGrid, {
1116
+ stroke: colors$1.gray150,
1117
+ vertical: isHorizontal,
1118
+ horizontal: !isHorizontal
1119
+ }), isHorizontal && jsx(XAxis, Object.assign({
1120
+ type: "number",
1121
+ stroke: colors$1.textSecondary,
1122
+ fontSize: 12,
1123
+ axisLine: false
1124
+ }, isHorizontal && {
1125
+ tickFormatter
1126
+ })), jsx(YAxis, Object.assign({
1127
+ axisLine: false,
1128
+ type: isHorizontal ? 'category' : 'number',
1129
+ dataKey: isHorizontal ? 'name' : 'total',
1130
+ width: isHorizontal ? 100 : 50,
1131
+ hide: !(yAxis === null || yAxis === void 0 ? void 0 : yAxis.show),
1132
+ stroke: colors$1.textSecondary,
1133
+ fontSize: 12
1134
+ }, !isHorizontal && {
1135
+ tickFormatter
1136
+ })), data.length > 0 && jsx(Tooltip$2, {
1137
+ wrapperStyle: {
1138
+ outline: 'none'
1139
+ },
1140
+ cursor: {
1141
+ fill: 'transparent'
1142
+ },
1143
+ content: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) ? (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) === null || _a === void 0 ? void 0 : _a.call(tooltip) : jsx(CustomTooltip, {})
1144
+ }), (legend === null || legend === void 0 ? void 0 : legend.show) && jsx(Legend, {
1145
+ content: renderLegend$1(formattedData, legend, subtitle, tickFormatter)
1146
+ }), jsxs(Bar, {
1147
+ dataKey: "total",
1148
+ barSize: 12,
1149
+ radius: 50,
1150
+ children: [formattedData.map(item => jsx(Cell, {
1151
+ fill: item.color || colors$1.chartGreen
1152
+ }, item.name)), (label === null || label === void 0 ? void 0 : label.show) && jsx(LabelList, {
1153
+ style: {
1154
+ marginLeft: '-8px'
1155
+ },
1156
+ dataKey: (label === null || label === void 0 ? void 0 : label.dataKey) || 'total',
1157
+ formatter: label === null || label === void 0 ? void 0 : label.formatter,
1158
+ position: (label === null || label === void 0 ? void 0 : label.position) || 'top',
1159
+ content: (_b = label === null || label === void 0 ? void 0 : label.render) === null || _b === void 0 ? void 0 : _b.call(label),
1160
+ fill: colors$1.textDisable,
1161
+ fontSize: 12
1162
+ })]
1163
+ })]
1164
+ })
1165
+ })
1166
+ })]
1167
+ });
1168
+ }
1169
+ BarChartComponent.defaultProps = {
1170
+ data: [],
1171
+ legend: {
1172
+ show: true,
1173
+ showTotal: true
1174
+ },
1175
+ yAxis: {
1176
+ show: true
1177
+ }
1178
+ };
1179
+
1180
+ const {
1181
+ colors
1182
+ } = foundations;
1183
+ const renderActiveShape = (props, avatar, acronym, validAvatar, activeRef) => {
1184
+ const {
1185
+ cx,
1186
+ cy,
1187
+ innerRadius,
1188
+ outerRadius,
1189
+ startAngle,
1190
+ endAngle,
1191
+ fill
1192
+ } = props;
1193
+ const IMG_WIDHT = 75;
1194
+ const IMG_HEIGHT = 75;
1195
+ return jsx(React__default.Fragment, {
1196
+ children: jsxs("g", {
1197
+ children: [jsx("clipPath", {
1198
+ id: "circleAvatar",
1199
+ children: jsx("circle", {
1200
+ cx: cx + 1,
1201
+ cy: cy,
1202
+ r: IMG_WIDHT / 2,
1203
+ fill: "#FFFFFF"
1204
+ })
1205
+ }), validAvatar ? jsx("image", {
1206
+ x: cx - IMG_WIDHT / 2,
1207
+ y: cy - IMG_HEIGHT / 2,
1208
+ width: IMG_WIDHT,
1209
+ height: IMG_HEIGHT,
1210
+ href: avatar,
1211
+ clipPath: "url(#circleAvatar)"
1212
+ }) : jsxs(React__default.Fragment, {
1213
+ children: [jsx("circle", {
1214
+ cx: cx,
1215
+ cy: cy,
1216
+ r: IMG_WIDHT / 2,
1217
+ fill: foundations.colors.bgBorder
1218
+ }), jsx("text", {
1219
+ x: cx,
1220
+ y: cy,
1221
+ textAnchor: "middle",
1222
+ alignmentBaseline: "middle",
1223
+ fontFamily: "main",
1224
+ fontWeight: "600",
1225
+ children: acronym
1226
+ })]
1227
+ }), jsx(Sector, {
1228
+ cx: cx,
1229
+ cy: cy,
1230
+ innerRadius: innerRadius,
1231
+ outerRadius: activeRef.current ? outerRadius + 12 : outerRadius,
1232
+ startAngle: startAngle,
1233
+ endAngle: endAngle,
1234
+ fill: fill,
1235
+ style: {
1236
+ outline: 'none'
1237
+ }
1238
+ })]
1239
+ })
1240
+ });
1241
+ };
1242
+ const renderLegend = (formattedData, legend, subtitle) => jsxs(Box, {
1243
+ children: [jsx(Flex, {
1244
+ css: {
1245
+ marginTop: '$spacing-05',
1246
+ height: 18
1247
+ },
1248
+ justify: "center",
1249
+ children: subtitle && jsx(Heading, {
1250
+ heading: "sectionTitle",
1251
+ children: subtitle
1252
+ })
1253
+ }), formattedData.length > 0 && jsx(Flex, {
1254
+ css: {
1255
+ marginTop: '$spacing-06'
1256
+ },
1257
+ direction: "column",
1258
+ gap: 5,
1259
+ children: formattedData === null || formattedData === void 0 ? void 0 : formattedData.map((data, index) => {
1260
+ var _a;
1261
+ return jsxs(Box, {
1262
+ children: [jsxs(Flex, {
1263
+ justify: "between",
1264
+ children: [jsxs(Flex, {
1265
+ align: "center",
1266
+ children: [jsx(Box, {
1267
+ css: {
1268
+ backgroundColor: data.color,
1269
+ borderRadius: '50%',
1270
+ height: 12,
1271
+ width: 12,
1272
+ display: 'inline-block',
1273
+ marginRight: '$spacing-03'
1274
+ }
1275
+ }), jsx(Box, {
1276
+ css: {
1277
+ width: 120
1278
+ },
1279
+ children: jsx(Text, {
1280
+ variant: "label",
1281
+ color: "secondary",
1282
+ children: data.name
1283
+ })
1284
+ })]
1285
+ }), (legend === null || legend === void 0 ? void 0 : legend.showTotal) && jsx(Text, {
1286
+ variant: "label",
1287
+ color: "secondary",
1288
+ children: (_a = formattedData[index]) === null || _a === void 0 ? void 0 : _a.total
1289
+ })]
1290
+ }), jsx(Separator, {
1291
+ css: {
1292
+ marginTop: '$spacing-03'
1293
+ }
1294
+ })]
1295
+ }, index);
1296
+ })
1297
+ })]
1298
+ });
1299
+ const PieChart = ({
1300
+ data,
1301
+ css,
1302
+ avatarURL,
1303
+ avatarAcronym,
1304
+ validAvatar,
1305
+ legend,
1306
+ isMobile,
1307
+ tooltip,
1308
+ title,
1309
+ subtitle,
1310
+ label,
1311
+ outerRadius,
1312
+ innerRadius
1313
+ }) => {
1314
+ var _a;
1315
+ const emptyData = [{
1316
+ id: '0',
1317
+ name: '',
1318
+ total: 1,
1319
+ color: foundations.colors.chartLightGray
1320
+ }];
1321
+ const dataChart = data.map(item => Object.assign(Object.assign({}, item), {
1322
+ total: Number(item.total)
1323
+ }));
1324
+ const activeRef = useRef();
1325
+ const formattedData = data.length > 0 ? dataChart : emptyData;
1326
+ const [activeIndex, setActiveIndex] = useState(0);
1327
+ const CONTAINER_HEIGHT = (legend === null || legend === void 0 ? void 0 : legend.position) === 'bottom' ? subtitle ? 420 : 380 : 230;
1328
+ const CONTAINER_WIDTH = isMobile ? 350 : 450;
1329
+ const CHART_HEIGHT = 150;
1330
+ const CHART_WIDTH = 450;
1331
+ const CustomTooltip = ({
1332
+ payload = {},
1333
+ active = false
1334
+ }) => {
1335
+ var _a;
1336
+ if (active) {
1337
+ const {
1338
+ total,
1339
+ name
1340
+ } = payload[0].payload;
1341
+ return jsxs(Box, {
1342
+ css: {
1343
+ backgroundColor: '$textContent',
1344
+ color: '$white',
1345
+ borderRadius: '$sm',
1346
+ padding: '$spacing-02',
1347
+ flexDirection: 'column'
1348
+ },
1349
+ children: [jsx(Text, {
1350
+ variant: "placeholder",
1351
+ color: "disable",
1352
+ css: {
1353
+ fontSize: 11
1354
+ },
1355
+ children: name
1356
+ }), jsx(Paragraph, {
1357
+ paragraph: "shortContentRegular",
1358
+ css: {
1359
+ color: '$white',
1360
+ fontSize: 12
1361
+ },
1362
+ children: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.label) ? (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.label) === null || _a === void 0 ? void 0 : _a.call(tooltip, total) : total
1363
+ })]
1364
+ });
1365
+ }
1366
+ return null;
1367
+ };
1368
+ return jsxs(Box, {
1369
+ children: [title && jsx(Heading, {
1370
+ heading: "sectionTitle",
1371
+ children: title
1372
+ }), jsx(Box, {
1373
+ css: Object.assign({
1374
+ position: 'relative',
1375
+ width: CONTAINER_WIDTH,
1376
+ height: CONTAINER_HEIGHT,
1377
+ marginTop: '$spacing-07'
1378
+ }, css),
1379
+ children: jsx(ResponsiveContainer, {
1380
+ width: "100%",
1381
+ height: "100%",
1382
+ children: jsxs(PieChart$1, {
1383
+ width: CHART_WIDTH,
1384
+ height: CHART_HEIGHT,
1385
+ children: [jsxs(Pie, Object.assign({
1386
+ activeIndex: activeIndex,
1387
+ activeShape: shape => renderActiveShape(shape, avatarURL, avatarAcronym, validAvatar, activeRef),
1388
+ data: formattedData,
1389
+ cx: "50%",
1390
+ cy: "50%",
1391
+ innerRadius: innerRadius,
1392
+ outerRadius: outerRadius,
1393
+ dataKey: "total",
1394
+ onMouseEnter: x => {
1395
+ setActiveIndex(formattedData.findIndex(y => y.name === x.name));
1396
+ activeRef.current = true;
1397
+ },
1398
+ onMouseLeave: () => activeRef.current = false,
1399
+ blendStroke: true
1400
+ }, (label === null || label === void 0 ? void 0 : label.show) && (label === null || label === void 0 ? void 0 : label.render) && {
1401
+ label: e => {
1402
+ var _a;
1403
+ return (_a = label === null || label === void 0 ? void 0 : label.render) === null || _a === void 0 ? void 0 : _a.call(label, e);
1404
+ },
1405
+ labelLine: false
1406
+ }, {
1407
+ children: [formattedData.map(item => jsx(Cell, {
1408
+ fill: item.color || colors.chartGreen
1409
+ }, item.name)), (label === null || label === void 0 ? void 0 : label.show) && !label.render && jsx(LabelList, {
1410
+ stroke: "0",
1411
+ fill: colors.textWhite,
1412
+ dataKey: (label === null || label === void 0 ? void 0 : label.dataKey) || 'total',
1413
+ formatter: label === null || label === void 0 ? void 0 : label.formatter,
1414
+ position: label === null || label === void 0 ? void 0 : label.position
1415
+ })]
1416
+ })), data.length > 0 && jsx(Tooltip$2, {
1417
+ wrapperStyle: {
1418
+ outline: 'none'
1419
+ },
1420
+ cursor: true,
1421
+ content: (tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) ? (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.render) === null || _a === void 0 ? void 0 : _a.call(tooltip) : jsx(CustomTooltip, {})
1422
+ }), Boolean(legend === null || legend === void 0 ? void 0 : legend.show) && jsx(Legend, Object.assign({
1423
+ height: (legend === null || legend === void 0 ? void 0 : legend.height) || 210
1424
+ }, (legend === null || legend === void 0 ? void 0 : legend.position) !== 'bottom' && {
1425
+ verticalAlign: 'middle',
1426
+ align: (legend === null || legend === void 0 ? void 0 : legend.position) || 'right',
1427
+ layout: 'vertical'
1428
+ }, {
1429
+ content: renderLegend(formattedData, legend, subtitle)
1430
+ }))]
1431
+ })
1432
+ })
1433
+ })]
1434
+ });
1435
+ };
1436
+ PieChart.defaultProps = {
1437
+ data: [],
1438
+ avatarURL: undefined,
1439
+ avatarAcronym: '',
1440
+ validAvatar: false,
1441
+ legend: {
1442
+ show: true,
1443
+ showTotal: true,
1444
+ data: [],
1445
+ position: 'right',
1446
+ height: 210
1447
+ },
1448
+ isMobile: false,
1449
+ outerRadius: 100,
1450
+ innerRadius: 70
1451
+ };
1452
+
1453
+ export { BarChartComponent as BarChart, LineChart, PieChart };