@majoo-ui/react 1.57.3 → 1.57.5

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.
@@ -587,7 +587,7 @@ export declare const SelectItem: import("@stitches/react/types/styled-component"
587
587
  backgroundColor: string;
588
588
  };
589
589
  }>>;
590
- export declare const SelectInputSearch: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
590
+ export declare const SelectInputSearch: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<HTMLInputElement | HTMLButtonElement>>;
591
591
  export declare type Option = {
592
592
  value: string;
593
593
  name: string;
@@ -709,5 +709,5 @@ interface InputSelectProps extends Omit<DownshiftProps<Option>, 'initialSelected
709
709
  */
710
710
  renderFooter?: () => React.ReactNode;
711
711
  }
712
- export declare function InputSelect({ option, onChange, value, placeholder, searchPlaceholder, embedSearch, size, disabled, search, iconColor, hideArrowicon, showLeadingIcon, placement, disabledOptions, textSelector, valueSelector, readOnly, isInvalid, noOptionIcon, fetchData, onSearch, isLoading, showTooltip, css, renderFooter, ...props }: InputSelectProps): JSX.Element;
712
+ declare const InputSelect: React.ForwardRefExoticComponent<InputSelectProps & React.RefAttributes<HTMLInputElement | HTMLButtonElement>>;
713
713
  export default InputSelect;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { LabelProps } from 'recharts';
2
3
  import { CSS } from '../../config/stitches.config';
3
4
  import './styles.css';
4
5
  interface PieChartData {
@@ -15,6 +16,13 @@ interface PieChartTooltip {
15
16
  label?: (number: any) => string;
16
17
  render?: () => JSX.Element;
17
18
  }
19
+ interface PieChartLabel {
20
+ show?: boolean;
21
+ dataKey?: string;
22
+ position?: LabelProps['position'];
23
+ formatter?: (string: any) => string;
24
+ render?: (any: any) => JSX.Element;
25
+ }
18
26
  interface PieChartProps {
19
27
  /**
20
28
  * Section title of the chart.
@@ -57,18 +65,20 @@ interface PieChartProps {
57
65
  */
58
66
  tooltip?: PieChartTooltip;
59
67
  /**
60
- * Show datasets percentage.
68
+ * Label config of chart.
61
69
  */
62
- showPercentage?: boolean;
70
+ label?: PieChartLabel;
63
71
  }
64
72
  declare const PieChartComponent: {
65
- ({ data, css, avatarURL, avatarAcronym, validAvatar, legend, isMobile, tooltip, showPercentage, title, subtitle, }: PieChartProps): JSX.Element;
73
+ ({ data, css, avatarURL, avatarAcronym, validAvatar, legend, isMobile, tooltip, title, subtitle, label, }: PieChartProps): JSX.Element;
66
74
  defaultProps: {
67
75
  data: never[];
68
76
  avatarURL: undefined;
69
77
  avatarAcronym: string;
70
78
  validAvatar: boolean;
71
79
  legend: {
80
+ show: boolean;
81
+ showTotal: boolean;
72
82
  data: never[];
73
83
  position: string;
74
84
  };
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, createContext, useContext, useEffect, useRef, useCallback, cloneElement, createElement as createElement$2, forwardRef, useLayoutEffect, useReducer, useMemo, memo } from 'react';
2
+ import React__default, { useState, createContext, useContext, useEffect, useRef, useCallback, cloneElement, forwardRef, createElement as createElement$2, useLayoutEffect, useReducer, useMemo, memo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { createStitches, styled as styled$1 } from '@stitches/react';
5
5
  import { foundations } from '@majoo-ui/core';
@@ -9125,7 +9125,7 @@ const SelectInputSearch = /*#__PURE__*/React.forwardRef((_a, forwardedRef) => {
9125
9125
  }, void 0)]
9126
9126
  }), void 0);
9127
9127
  });
9128
- function InputSelect(_a) {
9128
+ const InputSelect = /*#__PURE__*/forwardRef((_a, ref) => {
9129
9129
  var {
9130
9130
  option,
9131
9131
  onChange,
@@ -9206,7 +9206,7 @@ function InputSelect(_a) {
9206
9206
  setItem(generatedOption);
9207
9207
  setOptions(generatedOption);
9208
9208
  }, [option, disabledOptions, valueSelector, textSelector]);
9209
- const debouncedSearch = React.useRef(debounce(query => __awaiter(this, void 0, void 0, function* () {
9209
+ const debouncedSearch = React.useRef(debounce(query => __awaiter(void 0, void 0, void 0, function* () {
9210
9210
  setQuery(query);
9211
9211
  if (onSearch) onSearch(query);
9212
9212
  }), 1000)).current;
@@ -9292,6 +9292,7 @@ function InputSelect(_a) {
9292
9292
  }
9293
9293
  }, {
9294
9294
  children: jsx(SelectInputSearch, {
9295
+ ref: ref,
9295
9296
  showLeadingIcon: showLeadingIcon,
9296
9297
  showClearIcon: hideArrowicon,
9297
9298
  disabled: disabled,
@@ -9316,6 +9317,7 @@ function InputSelect(_a) {
9316
9317
  }), void 0) : jsx(Button$3, Object.assign({}, getToggleButtonProps({
9317
9318
  disabled: disabled || readOnly
9318
9319
  }), {
9320
+ ref: ref,
9319
9321
  disabled: disabled,
9320
9322
  size: size,
9321
9323
  readOnly: readOnly,
@@ -9474,7 +9476,7 @@ function InputSelect(_a) {
9474
9476
  }), void 0);
9475
9477
  }
9476
9478
  }), void 0);
9477
- }
9479
+ });
9478
9480
 
9479
9481
  var tryToString$3 = tryToString$5;
9480
9482
 
@@ -16365,44 +16367,29 @@ const MobileCalendarBox = ({
16365
16367
  children: [allowReset ? jsx(Button$4, Object.assign({
16366
16368
  buttonType: "ghost",
16367
16369
  size: "md",
16368
- css: {
16369
- width: '160px',
16370
- fontWeight: 600,
16371
- display: 'flex',
16372
- flex: 1
16373
- },
16374
16370
  onClick: onReset,
16375
16371
  disabled: disabled || !selected || selected.length <= 1,
16376
- type: "button"
16372
+ type: "button",
16373
+ block: true
16377
16374
  }, {
16378
16375
  children: "Reset"
16379
16376
  }), void 0) : jsx(Button$4, Object.assign({
16380
16377
  buttonType: "ghost",
16381
16378
  size: "md",
16382
- css: {
16383
- width: '160px',
16384
- fontWeight: 600,
16385
- display: 'flex',
16386
- flex: 1
16387
- },
16388
16379
  onClick: onCancel,
16389
16380
  disabled: disabled,
16390
- type: "button"
16381
+ type: "button",
16382
+ block: true
16391
16383
  }, {
16392
16384
  children: t('label.cancel', 'Batal', {
16393
16385
  ns: 'translation'
16394
16386
  })
16395
16387
  }), void 0), jsx(Button$4, Object.assign({
16396
16388
  size: "md",
16397
- css: {
16398
- width: '160px',
16399
- fontWeight: 600,
16400
- display: 'flex',
16401
- flex: 1
16402
- },
16403
16389
  onClick: onUpdate,
16404
16390
  disabled: disabled || !selected || selected.length <= 1,
16405
- type: "button"
16391
+ type: "button",
16392
+ block: true
16406
16393
  }, {
16407
16394
  children: t('label.process', 'Proses', {
16408
16395
  ns: 'translation'
@@ -16872,7 +16859,7 @@ function InputTimePicker({
16872
16859
  defaultValue: defaultValue,
16873
16860
  onChange: () => {},
16874
16861
  isPicker: true,
16875
- autocomplete: "false"
16862
+ autoComplete: "false"
16876
16863
  // tabIndex="-1"
16877
16864
  ,
16878
16865
  __self: this,
@@ -17584,7 +17571,7 @@ function InputDateRangePicker(props) {
17584
17571
  // eslint-disable-next-line @typescript-eslint/no-empty-function
17585
17572
  onChange: () => {},
17586
17573
  isPicker: true,
17587
- autocomplete: "false"
17574
+ autoComplete: "false"
17588
17575
  }, void 0)]
17589
17576
  }), void 0);
17590
17577
  }
@@ -17689,7 +17676,7 @@ function InputDatePicker({
17689
17676
  // eslint-disable-next-line @typescript-eslint/no-empty-function
17690
17677
  onChange: () => {},
17691
17678
  isPicker: true,
17692
- autocomplete: "false"
17679
+ autoComplete: "false"
17693
17680
  }, void 0)]
17694
17681
  }), void 0);
17695
17682
  } else {
@@ -47730,6 +47717,7 @@ function LoadingBar(props) {
47730
47717
  setProgress(0);
47731
47718
  }, 1000);
47732
47719
  }
47720
+ return () => setProgress(0);
47733
47721
  }, [show, intervalTime]);
47734
47722
  useEffect(() => {
47735
47723
  if (progress === 100) {
@@ -50388,16 +50376,14 @@ function BarChartComponent({
50388
50376
  };
50389
50377
  return jsxs(Box, {
50390
50378
  children: [title && jsx(Heading, Object.assign({
50391
- css: {
50392
- marginBottom: '$spacing-07'
50393
- },
50394
50379
  heading: "sectionTitle"
50395
50380
  }, {
50396
50381
  children: title
50397
50382
  }), void 0), jsx(Box, Object.assign({
50398
50383
  css: Object.assign({
50399
50384
  width: MIN_WIDTH,
50400
- height: MIN_HEIGHT
50385
+ height: MIN_HEIGHT,
50386
+ marginTop: '$spacing-07'
50401
50387
  }, css)
50402
50388
  }, {
50403
50389
  children: jsx(ResponsiveContainer, {
@@ -50486,8 +50472,8 @@ const renderActiveShape = (props, avatar, acronym, validAvatar, activeRef) => {
50486
50472
  endAngle,
50487
50473
  fill
50488
50474
  } = props;
50489
- const IMG_WIDHT = 40;
50490
- const IMG_HEIGHT = 40;
50475
+ const IMG_WIDHT = 75;
50476
+ const IMG_HEIGHT = 75;
50491
50477
  return jsx(React__default.Fragment, {
50492
50478
  children: jsxs("g", {
50493
50479
  children: [jsx("clipPath", Object.assign({
@@ -50526,7 +50512,7 @@ const renderActiveShape = (props, avatar, acronym, validAvatar, activeRef) => {
50526
50512
  cx: cx,
50527
50513
  cy: cy,
50528
50514
  innerRadius: innerRadius,
50529
- outerRadius: activeRef.current ? outerRadius + 10 : outerRadius,
50515
+ outerRadius: activeRef.current ? outerRadius + 12 : outerRadius,
50530
50516
  startAngle: startAngle,
50531
50517
  endAngle: endAngle,
50532
50518
  fill: fill,
@@ -50540,7 +50526,7 @@ const renderActiveShape = (props, avatar, acronym, validAvatar, activeRef) => {
50540
50526
  const renderLegend = (formattedData, legend, subtitle) => jsxs(Box, {
50541
50527
  children: [subtitle && jsx(Flex$1, Object.assign({
50542
50528
  css: {
50543
- margin: '$spacing-06'
50529
+ marginTop: '$spacing-06'
50544
50530
  },
50545
50531
  justify: "center"
50546
50532
  }, {
@@ -50550,6 +50536,9 @@ const renderLegend = (formattedData, legend, subtitle) => jsxs(Box, {
50550
50536
  children: subtitle
50551
50537
  }), void 0)
50552
50538
  }), void 0), formattedData.length > 0 && jsx(Flex$1, Object.assign({
50539
+ css: {
50540
+ marginTop: '$spacing-06'
50541
+ },
50553
50542
  direction: "column",
50554
50543
  gap: 5
50555
50544
  }, {
@@ -50607,9 +50596,9 @@ const PieChartComponent = ({
50607
50596
  legend,
50608
50597
  isMobile,
50609
50598
  tooltip,
50610
- showPercentage,
50611
50599
  title,
50612
- subtitle
50600
+ subtitle,
50601
+ label
50613
50602
  }) => {
50614
50603
  var _a;
50615
50604
  const emptyData = [{
@@ -50624,7 +50613,7 @@ const PieChartComponent = ({
50624
50613
  const activeRef = useRef();
50625
50614
  const formattedData = data.length > 0 ? dataChart : emptyData;
50626
50615
  const [activeIndex, setActiveIndex] = useState(0);
50627
- const CONTAINER_HEIGHT = (legend === null || legend === void 0 ? void 0 : legend.position) === 'bottom' ? 350 : 180;
50616
+ const CONTAINER_HEIGHT = (legend === null || legend === void 0 ? void 0 : legend.position) === 'bottom' ? subtitle ? 420 : 380 : 230;
50628
50617
  const CONTAINER_WIDTH = isMobile ? 350 : 450;
50629
50618
  const CHART_HEIGHT = 150;
50630
50619
  const CHART_WIDTH = 450;
@@ -50668,34 +50657,8 @@ const PieChartComponent = ({
50668
50657
  }
50669
50658
  return null;
50670
50659
  };
50671
- const RADIAN = Math.PI / 180;
50672
- const renderCustomizedLabel = ({
50673
- cx,
50674
- cy,
50675
- midAngle,
50676
- innerRadius,
50677
- outerRadius,
50678
- percent,
50679
- index
50680
- }) => {
50681
- const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
50682
- const x = cx + radius * Math.cos(-midAngle * RADIAN);
50683
- const y = cy + radius * Math.sin(-midAngle * RADIAN);
50684
- return jsx("text", Object.assign({
50685
- x: x,
50686
- y: y,
50687
- fill: "white",
50688
- textAnchor: x > cx ? 'start' : 'end',
50689
- dominantBaseline: "central"
50690
- }, {
50691
- children: `${(percent * 100).toFixed(0)}%`
50692
- }), void 0);
50693
- };
50694
50660
  return jsxs(Box, {
50695
50661
  children: [title && jsx(Heading, Object.assign({
50696
- css: {
50697
- marginBottom: '$spacing-06'
50698
- },
50699
50662
  heading: "sectionTitle"
50700
50663
  }, {
50701
50664
  children: title
@@ -50703,7 +50666,8 @@ const PieChartComponent = ({
50703
50666
  css: Object.assign({
50704
50667
  position: 'relative',
50705
50668
  width: CONTAINER_WIDTH,
50706
- height: CONTAINER_HEIGHT
50669
+ height: CONTAINER_HEIGHT,
50670
+ marginTop: '$spacing-07'
50707
50671
  }, css)
50708
50672
  }, {
50709
50673
  children: jsx(ResponsiveContainer, Object.assign({
@@ -50714,27 +50678,36 @@ const PieChartComponent = ({
50714
50678
  width: CHART_WIDTH,
50715
50679
  height: CHART_HEIGHT
50716
50680
  }, {
50717
- children: [jsx(Pie, Object.assign({
50681
+ children: [jsxs(Pie, Object.assign({
50718
50682
  activeIndex: activeIndex,
50719
50683
  activeShape: shape => renderActiveShape(shape, avatarURL, avatarAcronym, validAvatar, activeRef),
50720
50684
  data: formattedData,
50721
50685
  cx: "50%",
50722
50686
  cy: "50%",
50723
- innerRadius: 50,
50724
- outerRadius: 80,
50687
+ innerRadius: 70,
50688
+ outerRadius: 100,
50725
50689
  dataKey: "total",
50726
50690
  onMouseEnter: x => {
50727
50691
  setActiveIndex(formattedData.findIndex(y => y.name === x.name));
50728
50692
  activeRef.current = true;
50729
50693
  },
50730
50694
  blendStroke: true
50731
- }, showPercentage && {
50732
- label: renderCustomizedLabel,
50695
+ }, (label === null || label === void 0 ? void 0 : label.show) && (label === null || label === void 0 ? void 0 : label.render) && {
50696
+ label: e => {
50697
+ var _a;
50698
+ return (_a = label === null || label === void 0 ? void 0 : label.render) === null || _a === void 0 ? void 0 : _a.call(label, e);
50699
+ },
50733
50700
  labelLine: false
50734
50701
  }, {
50735
- children: formattedData.map(item => jsx(Cell, {
50702
+ children: [formattedData.map(item => jsx(Cell, {
50736
50703
  fill: item.color || colors.chartGreen
50737
- }, item.name))
50704
+ }, item.name)), (label === null || label === void 0 ? void 0 : label.show) && !label.render && jsx(LabelList, {
50705
+ stroke: "0",
50706
+ fill: colors.textWhite,
50707
+ dataKey: (label === null || label === void 0 ? void 0 : label.dataKey) || 'total',
50708
+ formatter: label === null || label === void 0 ? void 0 : label.formatter,
50709
+ position: label === null || label === void 0 ? void 0 : label.position
50710
+ }, void 0)]
50738
50711
  }), void 0), data.length > 0 && jsx(Tooltip$2, {
50739
50712
  wrapperStyle: {
50740
50713
  outline: 'none'
@@ -50759,6 +50732,8 @@ PieChartComponent.defaultProps = {
50759
50732
  avatarAcronym: '',
50760
50733
  validAvatar: false,
50761
50734
  legend: {
50735
+ show: true,
50736
+ showTotal: true,
50762
50737
  data: [],
50763
50738
  position: 'right'
50764
50739
  },
package/index.umd.js CHANGED
@@ -9197,8 +9197,7 @@
9197
9197
  }, void 0)]
9198
9198
  }), void 0);
9199
9199
  });
9200
- function InputSelect(_a) {
9201
- var _this = this;
9200
+ var InputSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
9202
9201
  var option = _a.option,
9203
9202
  onChange = _a.onChange,
9204
9203
  value = _a.value,
@@ -9311,7 +9310,7 @@
9311
9310
  setOptions(generatedOption);
9312
9311
  }, [option, disabledOptions, valueSelector, textSelector]);
9313
9312
  var debouncedSearch = React__namespace.useRef(debounce__default["default"](function (query) {
9314
- return __awaiter(_this, void 0, void 0, function () {
9313
+ return __awaiter(void 0, void 0, void 0, function () {
9315
9314
  return __generator(this, function (_a) {
9316
9315
  setQuery(query);
9317
9316
  if (onSearch) onSearch(query);
@@ -9406,6 +9405,7 @@
9406
9405
  }
9407
9406
  }, {
9408
9407
  children: jsxRuntime.jsx(SelectInputSearch, {
9408
+ ref: ref,
9409
9409
  showLeadingIcon: showLeadingIcon,
9410
9410
  showClearIcon: hideArrowicon,
9411
9411
  disabled: disabled,
@@ -9430,6 +9430,7 @@
9430
9430
  }), void 0) : jsxRuntime.jsx(Button$3, __assign({}, getToggleButtonProps({
9431
9431
  disabled: disabled || readOnly
9432
9432
  }), {
9433
+ ref: ref,
9433
9434
  disabled: disabled,
9434
9435
  size: size,
9435
9436
  readOnly: readOnly,
@@ -9592,7 +9593,7 @@
9592
9593
  }), void 0);
9593
9594
  }
9594
9595
  }), void 0);
9595
- }
9596
+ });
9596
9597
 
9597
9598
  var tryToString$3 = tryToString$5;
9598
9599
 
@@ -16612,44 +16613,29 @@
16612
16613
  children: [allowReset ? jsxRuntime.jsx(Button$4, __assign({
16613
16614
  buttonType: "ghost",
16614
16615
  size: "md",
16615
- css: {
16616
- width: '160px',
16617
- fontWeight: 600,
16618
- display: 'flex',
16619
- flex: 1
16620
- },
16621
16616
  onClick: onReset,
16622
16617
  disabled: disabled || !selected || selected.length <= 1,
16623
- type: "button"
16618
+ type: "button",
16619
+ block: true
16624
16620
  }, {
16625
16621
  children: "Reset"
16626
16622
  }), void 0) : jsxRuntime.jsx(Button$4, __assign({
16627
16623
  buttonType: "ghost",
16628
16624
  size: "md",
16629
- css: {
16630
- width: '160px',
16631
- fontWeight: 600,
16632
- display: 'flex',
16633
- flex: 1
16634
- },
16635
16625
  onClick: onCancel,
16636
16626
  disabled: disabled,
16637
- type: "button"
16627
+ type: "button",
16628
+ block: true
16638
16629
  }, {
16639
16630
  children: t('label.cancel', 'Batal', {
16640
16631
  ns: 'translation'
16641
16632
  })
16642
16633
  }), void 0), jsxRuntime.jsx(Button$4, __assign({
16643
16634
  size: "md",
16644
- css: {
16645
- width: '160px',
16646
- fontWeight: 600,
16647
- display: 'flex',
16648
- flex: 1
16649
- },
16650
16635
  onClick: onUpdate,
16651
16636
  disabled: disabled || !selected || selected.length <= 1,
16652
- type: "button"
16637
+ type: "button",
16638
+ block: true
16653
16639
  }, {
16654
16640
  children: t('label.process', 'Proses', {
16655
16641
  ns: 'translation'
@@ -17121,7 +17107,7 @@
17121
17107
  defaultValue: defaultValue,
17122
17108
  onChange: () => {},
17123
17109
  isPicker: true,
17124
- autocomplete: "false"
17110
+ autoComplete: "false"
17125
17111
  // tabIndex="-1"
17126
17112
  ,
17127
17113
  __self: this,
@@ -17841,7 +17827,7 @@
17841
17827
  // eslint-disable-next-line @typescript-eslint/no-empty-function
17842
17828
  onChange: function () {},
17843
17829
  isPicker: true,
17844
- autocomplete: "false"
17830
+ autoComplete: "false"
17845
17831
  }, void 0)]
17846
17832
  }), void 0);
17847
17833
  }
@@ -17954,7 +17940,7 @@
17954
17940
  // eslint-disable-next-line @typescript-eslint/no-empty-function
17955
17941
  onChange: function () {},
17956
17942
  isPicker: true,
17957
- autocomplete: "false"
17943
+ autoComplete: "false"
17958
17944
  }, void 0)]
17959
17945
  }), void 0);
17960
17946
  } else {
@@ -48150,6 +48136,9 @@
48150
48136
  setProgress(0);
48151
48137
  }, 1000);
48152
48138
  }
48139
+ return function () {
48140
+ return setProgress(0);
48141
+ };
48153
48142
  }, [show, intervalTime]);
48154
48143
  React.useEffect(function () {
48155
48144
  if (progress === 100) {
@@ -50909,16 +50898,14 @@
50909
50898
  };
50910
50899
  return jsxRuntime.jsxs(Box, {
50911
50900
  children: [title && jsxRuntime.jsx(Heading, __assign({
50912
- css: {
50913
- marginBottom: '$spacing-07'
50914
- },
50915
50901
  heading: "sectionTitle"
50916
50902
  }, {
50917
50903
  children: title
50918
50904
  }), void 0), jsxRuntime.jsx(Box, __assign({
50919
50905
  css: __assign({
50920
50906
  width: MIN_WIDTH,
50921
- height: MIN_HEIGHT
50907
+ height: MIN_HEIGHT,
50908
+ marginTop: '$spacing-07'
50922
50909
  }, css)
50923
50910
  }, {
50924
50911
  children: jsxRuntime.jsx(recharts.ResponsiveContainer, {
@@ -51005,8 +50992,8 @@
51005
50992
  startAngle = props.startAngle,
51006
50993
  endAngle = props.endAngle,
51007
50994
  fill = props.fill;
51008
- var IMG_WIDHT = 40;
51009
- var IMG_HEIGHT = 40;
50995
+ var IMG_WIDHT = 75;
50996
+ var IMG_HEIGHT = 75;
51010
50997
  return jsxRuntime.jsx(React__default["default"].Fragment, {
51011
50998
  children: jsxRuntime.jsxs("g", {
51012
50999
  children: [jsxRuntime.jsx("clipPath", __assign({
@@ -51045,7 +51032,7 @@
51045
51032
  cx: cx,
51046
51033
  cy: cy,
51047
51034
  innerRadius: innerRadius,
51048
- outerRadius: activeRef.current ? outerRadius + 10 : outerRadius,
51035
+ outerRadius: activeRef.current ? outerRadius + 12 : outerRadius,
51049
51036
  startAngle: startAngle,
51050
51037
  endAngle: endAngle,
51051
51038
  fill: fill,
@@ -51060,7 +51047,7 @@
51060
51047
  return jsxRuntime.jsxs(Box, {
51061
51048
  children: [subtitle && jsxRuntime.jsx(Flex$1, __assign({
51062
51049
  css: {
51063
- margin: '$spacing-06'
51050
+ marginTop: '$spacing-06'
51064
51051
  },
51065
51052
  justify: "center"
51066
51053
  }, {
@@ -51070,6 +51057,9 @@
51070
51057
  children: subtitle
51071
51058
  }), void 0)
51072
51059
  }), void 0), formattedData.length > 0 && jsxRuntime.jsx(Flex$1, __assign({
51060
+ css: {
51061
+ marginTop: '$spacing-06'
51062
+ },
51073
51063
  direction: "column",
51074
51064
  gap: 5
51075
51065
  }, {
@@ -51129,9 +51119,9 @@
51129
51119
  legend = _a.legend,
51130
51120
  isMobile = _a.isMobile,
51131
51121
  tooltip = _a.tooltip,
51132
- showPercentage = _a.showPercentage,
51133
51122
  title = _a.title,
51134
- subtitle = _a.subtitle;
51123
+ subtitle = _a.subtitle,
51124
+ label = _a.label;
51135
51125
  var emptyData = [{
51136
51126
  id: '0',
51137
51127
  name: '',
@@ -51148,7 +51138,7 @@
51148
51138
  var _c = React.useState(0),
51149
51139
  activeIndex = _c[0],
51150
51140
  setActiveIndex = _c[1];
51151
- var CONTAINER_HEIGHT = (legend === null || legend === void 0 ? void 0 : legend.position) === 'bottom' ? 350 : 180;
51141
+ var CONTAINER_HEIGHT = (legend === null || legend === void 0 ? void 0 : legend.position) === 'bottom' ? subtitle ? 420 : 380 : 230;
51152
51142
  var CONTAINER_WIDTH = isMobile ? 350 : 450;
51153
51143
  var CHART_HEIGHT = 150;
51154
51144
  var CHART_WIDTH = 450;
@@ -51192,33 +51182,8 @@
51192
51182
  }
51193
51183
  return null;
51194
51184
  };
51195
- var RADIAN = Math.PI / 180;
51196
- var renderCustomizedLabel = function renderCustomizedLabel(_a) {
51197
- var cx = _a.cx,
51198
- cy = _a.cy,
51199
- midAngle = _a.midAngle,
51200
- innerRadius = _a.innerRadius,
51201
- outerRadius = _a.outerRadius,
51202
- percent = _a.percent;
51203
- _a.index;
51204
- var radius = innerRadius + (outerRadius - innerRadius) * 0.5;
51205
- var x = cx + radius * Math.cos(-midAngle * RADIAN);
51206
- var y = cy + radius * Math.sin(-midAngle * RADIAN);
51207
- return jsxRuntime.jsx("text", __assign({
51208
- x: x,
51209
- y: y,
51210
- fill: "white",
51211
- textAnchor: x > cx ? 'start' : 'end',
51212
- dominantBaseline: "central"
51213
- }, {
51214
- children: "".concat((percent * 100).toFixed(0), "%")
51215
- }), void 0);
51216
- };
51217
51185
  return jsxRuntime.jsxs(Box, {
51218
51186
  children: [title && jsxRuntime.jsx(Heading, __assign({
51219
- css: {
51220
- marginBottom: '$spacing-06'
51221
- },
51222
51187
  heading: "sectionTitle"
51223
51188
  }, {
51224
51189
  children: title
@@ -51226,7 +51191,8 @@
51226
51191
  css: __assign({
51227
51192
  position: 'relative',
51228
51193
  width: CONTAINER_WIDTH,
51229
- height: CONTAINER_HEIGHT
51194
+ height: CONTAINER_HEIGHT,
51195
+ marginTop: '$spacing-07'
51230
51196
  }, css)
51231
51197
  }, {
51232
51198
  children: jsxRuntime.jsx(recharts.ResponsiveContainer, __assign({
@@ -51237,7 +51203,7 @@
51237
51203
  width: CHART_WIDTH,
51238
51204
  height: CHART_HEIGHT
51239
51205
  }, {
51240
- children: [jsxRuntime.jsx(recharts.Pie, __assign({
51206
+ children: [jsxRuntime.jsxs(recharts.Pie, __assign({
51241
51207
  activeIndex: activeIndex,
51242
51208
  activeShape: function (shape) {
51243
51209
  return renderActiveShape(shape, avatarURL, avatarAcronym, validAvatar, activeRef);
@@ -51245,8 +51211,8 @@
51245
51211
  data: formattedData,
51246
51212
  cx: "50%",
51247
51213
  cy: "50%",
51248
- innerRadius: 50,
51249
- outerRadius: 80,
51214
+ innerRadius: 70,
51215
+ outerRadius: 100,
51250
51216
  dataKey: "total",
51251
51217
  onMouseEnter: function (x) {
51252
51218
  setActiveIndex(formattedData.findIndex(function (y) {
@@ -51255,15 +51221,24 @@
51255
51221
  activeRef.current = true;
51256
51222
  },
51257
51223
  blendStroke: true
51258
- }, showPercentage && {
51259
- label: renderCustomizedLabel,
51224
+ }, (label === null || label === void 0 ? void 0 : label.show) && (label === null || label === void 0 ? void 0 : label.render) && {
51225
+ label: function (e) {
51226
+ var _a;
51227
+ return (_a = label === null || label === void 0 ? void 0 : label.render) === null || _a === void 0 ? void 0 : _a.call(label, e);
51228
+ },
51260
51229
  labelLine: false
51261
51230
  }, {
51262
- children: formattedData.map(function (item) {
51231
+ children: [formattedData.map(function (item) {
51263
51232
  return jsxRuntime.jsx(recharts.Cell, {
51264
51233
  fill: item.color || colors.chartGreen
51265
51234
  }, item.name);
51266
- })
51235
+ }), (label === null || label === void 0 ? void 0 : label.show) && !label.render && jsxRuntime.jsx(recharts.LabelList, {
51236
+ stroke: "0",
51237
+ fill: colors.textWhite,
51238
+ dataKey: (label === null || label === void 0 ? void 0 : label.dataKey) || 'total',
51239
+ formatter: label === null || label === void 0 ? void 0 : label.formatter,
51240
+ position: label === null || label === void 0 ? void 0 : label.position
51241
+ }, void 0)]
51267
51242
  }), void 0), data.length > 0 && jsxRuntime.jsx(recharts.Tooltip, {
51268
51243
  wrapperStyle: {
51269
51244
  outline: 'none'
@@ -51288,6 +51263,8 @@
51288
51263
  avatarAcronym: '',
51289
51264
  validAvatar: false,
51290
51265
  legend: {
51266
+ show: true,
51267
+ showTotal: true,
51291
51268
  data: [],
51292
51269
  position: 'right'
51293
51270
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "1.57.3",
3
+ "version": "1.57.5",
4
4
  "dependencies": {
5
5
  "@majoo-ui/core": "^1.31.3",
6
6
  "@majoo-ui/helpers": "^1.30.5",