impaktapps-design 0.2.87 → 0.2.89-alpha.400

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.
@@ -10461,46 +10461,32 @@ const ToolTip = ({
10461
10461
  left: left2,
10462
10462
  tooltipData
10463
10463
  }) => {
10464
- const {
10465
- TooltipInPortal
10466
- } = useTooltipInPortal({
10464
+ useTooltipInPortal({
10467
10465
  detectBounds: true,
10468
10466
  scroll: true
10469
10467
  });
10470
- return /* @__PURE__ */ jsx(TooltipInPortal, {
10468
+ return /* @__PURE__ */ jsx(Tooltip$1, {
10471
10469
  top: top2,
10472
10470
  left: left2,
10471
+ style: style2 == null ? void 0 : style2.tooltipStyle,
10473
10472
  children: /* @__PURE__ */ jsxs("div", {
10474
10473
  style: {
10475
- minWidth: 60,
10476
- textAlign: "center",
10477
- background: "black",
10478
- padding: "10px",
10479
- boxShadow: "2px 2px 5px black",
10480
- color: "#6c5efb",
10481
- backgroundColor: "black",
10482
- ...style2 == null ? void 0 : style2.tooltipStyle,
10483
- margin: "-20px"
10474
+ display: "flex",
10475
+ alignItems: "center"
10484
10476
  },
10485
10477
  children: [/* @__PURE__ */ jsx("div", {
10486
10478
  style: {
10487
- padding: "4px 10px",
10488
- color: (style2 == null ? void 0 : style2.tooltipbackground) || "white",
10489
- borderRadius: "5px",
10490
- fontWeight: 700
10491
- },
10492
- children: tooltipData[0]
10479
+ width: "12px",
10480
+ height: "12px",
10481
+ marginRight: "8px"
10482
+ }
10493
10483
  }), /* @__PURE__ */ jsx("div", {
10494
- style: {
10495
- padding: "4px 10px",
10496
- borderRadius: "5px",
10497
- marginTop: "10px",
10498
- fontWeight: 700
10499
- },
10500
- children: tooltipData[1]
10484
+ children: /* @__PURE__ */ jsx("strong", {
10485
+ children: `${tooltipData[0]}: ${tooltipData[1]}`
10486
+ })
10501
10487
  })]
10502
10488
  })
10503
- }, Math.random());
10489
+ });
10504
10490
  };
10505
10491
  var _excluded$F = ["flexDirection", "alignItems", "margin", "display", "children"];
10506
10492
  function _extends$B() {
@@ -11409,7 +11395,7 @@ const Product1 = [
11409
11395
  }
11410
11396
  ];
11411
11397
  const finalDataProvider = (type2, value, theme) => {
11412
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
11398
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t5, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
11413
11399
  switch (type2) {
11414
11400
  case "BarGraph":
11415
11401
  case "StackBarGraph":
@@ -11485,7 +11471,7 @@ const finalDataProvider = (type2, value, theme) => {
11485
11471
  case "PieGraph":
11486
11472
  return {
11487
11473
  main: {
11488
- data: ((_h = value == null ? void 0 : value.main) == null ? void 0 : _h.data) || [{ branch: "Kotak", value: 500 }, { branch: "SBI", value: 700 }, { branch: "HDFC", value: 900 }],
11474
+ data: ((_h = value == null ? void 0 : value.main) == null ? void 0 : _h.data) && value.main.data.length > 0 ? (_i = value == null ? void 0 : value.main) == null ? void 0 : _i.data : [{ label: "Kotak", value: 500 }, { label: "SBI", value: 700 }, { label: "HDFC", value: 900 }],
11489
11475
  header: "Pie Graph",
11490
11476
  bottomLabel: "Name of Employe",
11491
11477
  leftLabel: "Value",
@@ -11499,7 +11485,7 @@ const finalDataProvider = (type2, value, theme) => {
11499
11485
  legendTitle: "Our Assests",
11500
11486
  direction: "row",
11501
11487
  align: "right",
11502
- ...(_i = value == null ? void 0 : value.main) == null ? void 0 : _i.legend
11488
+ ...(_j = value == null ? void 0 : value.main) == null ? void 0 : _j.legend
11503
11489
  }
11504
11490
  },
11505
11491
  style: {
@@ -11509,7 +11495,7 @@ const finalDataProvider = (type2, value, theme) => {
11509
11495
  height: "310",
11510
11496
  borderRadius: "20px",
11511
11497
  padding: "10px 0 2px 0",
11512
- ...(_j = value == null ? void 0 : value.style) == null ? void 0 : _j.containerStyle
11498
+ ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.containerStyle
11513
11499
  },
11514
11500
  headerStyle: {
11515
11501
  fontWeight: 500,
@@ -11520,17 +11506,21 @@ const finalDataProvider = (type2, value, theme) => {
11520
11506
  width: "100%",
11521
11507
  fontSize: "18px",
11522
11508
  color: theme.palette.text.primary,
11523
- ...(_k = value == null ? void 0 : value.style) == null ? void 0 : _k.headerStyle
11509
+ ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.headerStyle
11524
11510
  },
11525
11511
  tooltipStyle: {
11526
- ...(_l = value == null ? void 0 : value.style) == null ? void 0 : _l.tooltipStyle
11512
+ minWidth: 80,
11513
+ height: 20,
11514
+ backgroundColor: "lightgrey",
11515
+ color: "black",
11516
+ ...(_m = value == null ? void 0 : value.style) == null ? void 0 : _m.tooltipStyle
11527
11517
  },
11528
11518
  labelStyle: {
11529
11519
  labelColor: theme.palette.text.primary,
11530
11520
  labelOffset: 45,
11531
11521
  leftLabelMargin: "70",
11532
11522
  topLabelMargin: "-40",
11533
- ...(_m = value == null ? void 0 : value.style) == null ? void 0 : _m.labelStyle
11523
+ ...(_n = value == null ? void 0 : value.style) == null ? void 0 : _n.labelStyle
11534
11524
  },
11535
11525
  legendStyle: {
11536
11526
  legend: {
@@ -11543,14 +11533,14 @@ const finalDataProvider = (type2, value, theme) => {
11543
11533
  border: "1px solid rgba(255, 255, 255, 0.3)",
11544
11534
  borderRadius: " 8px",
11545
11535
  margin: "5px 5px",
11546
- ...(_o = (_n = value == null ? void 0 : value.style) == null ? void 0 : _n.legendStyle) == null ? void 0 : _o.legend
11536
+ ...(_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.legendStyle) == null ? void 0 : _p.legend
11547
11537
  },
11548
11538
  legendTitle: {
11549
11539
  fontWeight: 500,
11550
11540
  marginBottom: "5px",
11551
11541
  fontFamily: "roboto",
11552
11542
  fontSize: "10px",
11553
- ...(_q = (_p = value == null ? void 0 : value.style) == null ? void 0 : _p.legendStyle) == null ? void 0 : _q.legendTitle
11543
+ ...(_r = (_q = value == null ? void 0 : value.style) == null ? void 0 : _q.legendStyle) == null ? void 0 : _r.legendTitle
11554
11544
  }
11555
11545
  },
11556
11546
  pieStyle: {
@@ -11559,14 +11549,14 @@ const finalDataProvider = (type2, value, theme) => {
11559
11549
  innerRadius: 60,
11560
11550
  cornerRadius: 2,
11561
11551
  padAngle: 6e-3,
11562
- ...(_r = value == null ? void 0 : value.style) == null ? void 0 : _r.pieStyle
11552
+ ...(_s = value == null ? void 0 : value.style) == null ? void 0 : _s.pieStyle
11563
11553
  }
11564
11554
  }
11565
11555
  };
11566
11556
  case "LineGraph":
11567
11557
  return {
11568
11558
  main: {
11569
- data: ((_s = value == null ? void 0 : value.main) == null ? void 0 : _s.data) || Product1,
11559
+ data: ((_t5 = value == null ? void 0 : value.main) == null ? void 0 : _t5.data) || Product1,
11570
11560
  header: "Line Graph Dynamic",
11571
11561
  bottomLabel: "Name of Employe",
11572
11562
  leftLabel: "Value",
@@ -11584,7 +11574,7 @@ const finalDataProvider = (type2, value, theme) => {
11584
11574
  direction: "row",
11585
11575
  align: "right",
11586
11576
  colorRectWidth: 20,
11587
- ...(_t5 = value == null ? void 0 : value.main) == null ? void 0 : _t5.legend
11577
+ ...(_u = value == null ? void 0 : value.main) == null ? void 0 : _u.legend
11588
11578
  }
11589
11579
  },
11590
11580
  style: {
@@ -11594,7 +11584,7 @@ const finalDataProvider = (type2, value, theme) => {
11594
11584
  height: "300",
11595
11585
  borderRadius: "20px",
11596
11586
  padding: "10px 0 2px 0",
11597
- ...(_u = value == null ? void 0 : value.style) == null ? void 0 : _u.containerStyle
11587
+ ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.containerStyle
11598
11588
  },
11599
11589
  headerStyle: {
11600
11590
  fontWeight: 500,
@@ -11605,35 +11595,35 @@ const finalDataProvider = (type2, value, theme) => {
11605
11595
  width: "100%",
11606
11596
  fontSize: "18px",
11607
11597
  color: theme.palette.text.primary,
11608
- ...(_v = value == null ? void 0 : value.style) == null ? void 0 : _v.headerStyle
11598
+ ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.headerStyle
11609
11599
  },
11610
11600
  labelStyle: {
11611
11601
  labelColor: theme.palette.text.primary,
11612
11602
  bottomLabelOffset: 20,
11613
11603
  leftLabelOffset: 50,
11614
11604
  leftLabelMargin: 80,
11615
- ...(_w = value == null ? void 0 : value.style) == null ? void 0 : _w.labelStyle
11605
+ ...(_x = value == null ? void 0 : value.style) == null ? void 0 : _x.labelStyle
11616
11606
  },
11617
11607
  lineStyle: {
11618
11608
  colorRange: theme.chartColours.lineChartColours || ["#3f51b5", "rgba(200,0,31,0.9)", "rgba(25,200,205,0.6)"],
11619
11609
  lineAreaColor: "none",
11620
11610
  lineAreaOpacity: 0.2,
11621
- ...(_x = value == null ? void 0 : value.style) == null ? void 0 : _x.lineStyle
11611
+ ...(_y = value == null ? void 0 : value.style) == null ? void 0 : _y.lineStyle
11622
11612
  }
11623
11613
  }
11624
11614
  };
11625
11615
  case "HorizontalBarGraph":
11626
11616
  return {
11627
11617
  main: {
11628
- data: ((_y = value == null ? void 0 : value.main) == null ? void 0 : _y.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
11618
+ data: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) || [{ y: "Anant Sharma", x: 60 }, { y: "Pankaj Chauhan", x: 60 }, { y: "satendra Raghav", x: 150 }, { y: "Vivek Pahadi", x: 80 }, { y: "Siddarth verma", x: 100 }],
11629
11619
  header: " ",
11630
11620
  bottomLabel: "Name of Employe",
11631
11621
  leftLabel: "Value",
11632
11622
  axisLeft: true,
11633
11623
  axisBottom: true,
11634
11624
  hideBottomTicks: false,
11635
- hideLeftTicks: ((_z = value == null ? void 0 : value.main) == null ? void 0 : _z.data) ? true : false,
11636
- hideLeftAxisLine: ((_A = value == null ? void 0 : value.main) == null ? void 0 : _A.data) ? true : false,
11625
+ hideLeftTicks: ((_A = value == null ? void 0 : value.main) == null ? void 0 : _A.data) ? true : false,
11626
+ hideLeftAxisLine: ((_B = value == null ? void 0 : value.main) == null ? void 0 : _B.data) ? true : false,
11637
11627
  hideBottomAxisLine: false,
11638
11628
  bottomAxisWidth: "10px",
11639
11629
  ...value.main
@@ -11645,7 +11635,7 @@ const finalDataProvider = (type2, value, theme) => {
11645
11635
  height: "300",
11646
11636
  borderRadius: "20px",
11647
11637
  padding: "10px 0 2px 0",
11648
- ...(_B = value == null ? void 0 : value.style) == null ? void 0 : _B.containerStyle
11638
+ ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.containerStyle
11649
11639
  },
11650
11640
  headerStyle: {
11651
11641
  fontWeight: 500,
@@ -11656,12 +11646,12 @@ const finalDataProvider = (type2, value, theme) => {
11656
11646
  width: "100%",
11657
11647
  fontSize: "18px",
11658
11648
  color: theme.palette.text.primary,
11659
- ...(_C = value == null ? void 0 : value.style) == null ? void 0 : _C.headerStyle
11649
+ ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.headerStyle
11660
11650
  },
11661
11651
  tooltipStyle: {
11662
11652
  padding: "6px",
11663
11653
  borderRadius: "2px",
11664
- ...(_D = value == null ? void 0 : value.style) == null ? void 0 : _D.tooltipStyle
11654
+ ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.tooltipStyle
11665
11655
  },
11666
11656
  labelStyle: {
11667
11657
  margin: { top: 10, left: 110, right: 40, bottom: 40 },
@@ -11672,11 +11662,11 @@ const finalDataProvider = (type2, value, theme) => {
11672
11662
  tickColor: theme.palette.text.primary,
11673
11663
  rightAxisWidth: "0.3px",
11674
11664
  fontSize: "10px",
11675
- ...(_E = value == null ? void 0 : value.style) == null ? void 0 : _E.labelStyle
11665
+ ...(_F = value == null ? void 0 : value.style) == null ? void 0 : _F.labelStyle
11676
11666
  },
11677
11667
  barStyle: {
11678
11668
  color: "#6c5efb",
11679
- ...(_F = value == null ? void 0 : value.style) == null ? void 0 : _F.barStyle
11669
+ ...(_G = value == null ? void 0 : value.style) == null ? void 0 : _G.barStyle
11680
11670
  }
11681
11671
  }
11682
11672
  };
@@ -11720,14 +11710,22 @@ const DrawPieGraph = ({
11720
11710
  parentWidth,
11721
11711
  parentHeight
11722
11712
  }) => {
11723
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
11713
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
11714
+ const [active2, setActive] = useState(null);
11724
11715
  const letters = (_a = value == null ? void 0 : value.main) == null ? void 0 : _a.data;
11725
- const arr = ((_b = value == null ? void 0 : value.main) == null ? void 0 : _b.xAxisValue) && ((_c = value == null ? void 0 : value.main) == null ? void 0 : _c.yAxisValue) ? [(_d = value == null ? void 0 : value.main) == null ? void 0 : _d.xAxisValue, (_e = value == null ? void 0 : value.main) == null ? void 0 : _e.yAxisValue] : Object.keys(letters[0]);
11726
- const frequency = (d2) => d2[arr[1]];
11727
- const getLetterFrequencyColor = createOrdinalScale$1({
11728
- domain: letters.map((l2) => l2[arr[0]]),
11729
- range: (_g = (_f = value == null ? void 0 : value.style) == null ? void 0 : _f.pieStyle) == null ? void 0 : _g.colorRange
11730
- });
11716
+ const keys2 = Object.keys(letters[0]);
11717
+ const arr = ((_b = value == null ? void 0 : value.main) == null ? void 0 : _b.xAxisValue) && ((_c = value == null ? void 0 : value.main) == null ? void 0 : _c.yAxisValue) ? [(_d = value == null ? void 0 : value.main) == null ? void 0 : _d.xAxisValue, (_e = value == null ? void 0 : value.main) == null ? void 0 : _e.yAxisValue] : keys2;
11718
+ const labelKeyIndex = keys2.indexOf("label");
11719
+ const valueKeyIndex = labelKeyIndex === 0 ? 1 : 0;
11720
+ const frequency = (d2) => d2[arr[valueKeyIndex]];
11721
+ const getLetterFrequencyColor = (letter, index2) => {
11722
+ var _a2, _b2;
11723
+ return createOrdinalScale$1({
11724
+ domain: letters.map((l2) => l2[arr[index2]]),
11725
+ range: (_b2 = (_a2 = value == null ? void 0 : value.style) == null ? void 0 : _a2.pieStyle) == null ? void 0 : _b2.colorRange
11726
+ })(letter);
11727
+ };
11728
+ const dataKeyArray = letters.map((data) => data.label);
11731
11729
  const {
11732
11730
  tooltipData,
11733
11731
  tooltipLeft,
@@ -11751,8 +11749,9 @@ const DrawPieGraph = ({
11751
11749
  const top2 = centerY + 20;
11752
11750
  const pieSortValues = (a2, b10) => a2 - b10;
11753
11751
  return /* @__PURE__ */ jsxs(Fragment, {
11754
- children: [((_h = value == null ? void 0 : value.main) == null ? void 0 : _h.legendAvailable) && /* @__PURE__ */ jsx(Legend, {
11755
- value
11752
+ children: [((_f = value == null ? void 0 : value.main) == null ? void 0 : _f.legendAvailable) && /* @__PURE__ */ jsx(Legend, {
11753
+ value,
11754
+ dataKeyArray
11756
11755
  }), /* @__PURE__ */ jsx("svg", {
11757
11756
  width: parentWidth,
11758
11757
  height: parentHeight,
@@ -11764,20 +11763,26 @@ const DrawPieGraph = ({
11764
11763
  data: letters,
11765
11764
  pieSortValues,
11766
11765
  pieValue: frequency,
11767
- outerRadius: (_j = (_i = value == null ? void 0 : value.style) == null ? void 0 : _i.pieStyle) == null ? void 0 : _j.outerRadius,
11768
- innerRadius: (_l = (_k = value == null ? void 0 : value.style) == null ? void 0 : _k.pieStyle) == null ? void 0 : _l.innerRadius,
11769
- cornerRadius: (_n = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.pieStyle) == null ? void 0 : _n.cornerRadius,
11770
- padAngle: (_p = (_o = value == null ? void 0 : value.style) == null ? void 0 : _o.pieStyle) == null ? void 0 : _p.padAngle,
11766
+ outerRadius: (_h = (_g = value == null ? void 0 : value.style) == null ? void 0 : _g.pieStyle) == null ? void 0 : _h.outerRadius,
11767
+ innerRadius: (_j = (_i = value == null ? void 0 : value.style) == null ? void 0 : _i.pieStyle) == null ? void 0 : _j.innerRadius,
11768
+ cornerRadius: (_l = (_k = value == null ? void 0 : value.style) == null ? void 0 : _k.pieStyle) == null ? void 0 : _l.cornerRadius,
11769
+ padAngle: (_n = (_m = value == null ? void 0 : value.style) == null ? void 0 : _m.pieStyle) == null ? void 0 : _n.padAngle,
11771
11770
  children: (pie2) => {
11772
11771
  return pie2.arcs.map((arc2, index2) => {
11773
11772
  var _a2, _b2, _c2, _d2;
11774
- const letter = ((_b2 = (_a2 = value == null ? void 0 : value.style) == null ? void 0 : _a2.pieStyle) == null ? void 0 : _b2.showPieLabel) ? arc2.data[arr[0]] : arc2.data[arr[1]];
11773
+ console.log("arc.data", arc2.data);
11774
+ const indexParam = ((_b2 = (_a2 = value == null ? void 0 : value.style) == null ? void 0 : _a2.pieStyle) == null ? void 0 : _b2.showPieLabel) ? labelKeyIndex : valueKeyIndex;
11775
+ const letter = arc2.data[arr[indexParam]];
11776
+ console.log("arc.data[arr[indexParam]]", arc2.data[arr[indexParam]]);
11775
11777
  const [centriodX, centriodY] = pie2.path.centroid(arc2);
11776
11778
  const arcPath = pie2.path(arc2);
11777
- const arcFill = getLetterFrequencyColor(letter);
11779
+ const arcFill = getLetterFrequencyColor(letter, indexParam);
11778
11780
  return /* @__PURE__ */ jsxs("g", {
11779
11781
  onMouseOut: hideTooltip,
11780
11782
  onMouseOver: (e3) => handleMouse(e3, arc2.data),
11783
+ onMouseEnter: (e3) => {
11784
+ setActive(arc2.data);
11785
+ },
11781
11786
  className: "pieTooltipHolder",
11782
11787
  children: [/* @__PURE__ */ jsx("path", {
11783
11788
  d: arcPath,