@ammarkhalidfarooq/dashboard-package 0.4.46 → 0.4.48

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.cjs.js CHANGED
@@ -700,99 +700,6 @@ var Dashboard = function Dashboard(_ref) {
700
700
  });
701
701
  };
702
702
 
703
- var DisplayCard = function DisplayCard(_ref) {
704
- var title = _ref.title,
705
- value = _ref.value,
706
- subValue = _ref.subValue,
707
- Icon = _ref.icon,
708
- onClick = _ref.onClick,
709
- _ref$sx = _ref.sx,
710
- sx = _ref$sx === void 0 ? {} : _ref$sx,
711
- _ref$isActive = _ref.isActive,
712
- isActive = _ref$isActive === void 0 ? false : _ref$isActive;
713
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
714
- onClick: onClick,
715
- sx: _objectSpread2({
716
- height: "100px",
717
- borderRadius: "24px",
718
- display: "flex",
719
- justifyContent: "space-between",
720
- alignItems: "center",
721
- boxShadow: "rgba(0, 0, 0, 0.06) 0px 4px 15px 0px",
722
- // boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
723
- // padding: "16px 16px 16px 18px",
724
- py: "10px",
725
- px: "16px",
726
- cursor: "pointer",
727
- bgcolor: "#fff",
728
- border: isActive ? "1px solid rgb(99, 99, 230)" : "none",
729
- // border: "2px solid #f0f0f0",
730
- transition: "all 0.3s ease"
731
- }, sx),
732
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
733
- sx: {
734
- display: "flex",
735
- flexDirection: "column",
736
- gap: 0.5
737
- },
738
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
739
- sx: {
740
- fontWeight: "400",
741
- color: isActive ? "#c1c1f5" : "#a1a1a8",
742
- fontSize: "14px",
743
- lineHeight: "16px",
744
- textAlign: "left"
745
- },
746
- children: title
747
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
748
- sx: {
749
- lineHeight: "1.2",
750
- textAlign: "left",
751
- color: isActive ? "#6363e6" : "#000",
752
- fontSize: "20px",
753
- fontWeight: "700",
754
- mb: 0.5
755
- },
756
- children: statusValue(value)
757
- }), subValue && /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
758
- sx: {
759
- fontSize: "11px",
760
- color: typeof subValue === "string" && (subValue.includes("%") || subValue.includes("new") || subValue.includes("x")) && !subValue.includes("/") && !subValue.includes("pass-through") ? "#22C55E" : "rgba(0, 0, 0, 0.4)",
761
- fontWeight: "500",
762
- display: "flex",
763
- alignItems: "center",
764
- gap: 0.5
765
- },
766
- children: [typeof subValue === "string" && (subValue.includes("%") || subValue.includes("new") || subValue.includes("x")) && !subValue.includes("/") && !subValue.includes("pass-through") && /*#__PURE__*/jsxRuntime.jsx("span", {
767
- style: {
768
- fontSize: "14px"
769
- },
770
- children: "\u25B2"
771
- }), subValue]
772
- })]
773
- }), Icon && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
774
- sx: {
775
- width: "44px",
776
- height: "44px",
777
- borderRadius: "50%",
778
- backgroundColor: "#f7f7ff",
779
- display: "flex",
780
- alignItems: "center",
781
- justifyContent: "center",
782
- color: "rgb(99, 99, 230)"
783
- },
784
- children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
785
- sx: {
786
- fontSize: "20px"
787
- }
788
- })
789
- })]
790
- });
791
- };
792
- var statusValue = function statusValue(value) {
793
- return _typeof(value) === "object" && value !== null ? value.value !== undefined ? value.value : JSON.stringify(value) : value;
794
- };
795
-
796
703
  var OverallSection$2 = /*#__PURE__*/React.lazy(function () {
797
704
  return Promise.resolve().then(function () { return OverallSection$1; });
798
705
  });
@@ -6625,79 +6532,132 @@ var EmailTrendCard = function EmailTrendCard(_ref) {
6625
6532
  };
6626
6533
 
6627
6534
  var EmailSection = function EmailSection() {
6535
+ var _useState = React.useState("Total raised"),
6536
+ _useState2 = _slicedToArray(_useState, 2),
6537
+ activeMetric = _useState2[0],
6538
+ setActiveMetric = _useState2[1];
6628
6539
  var metricInfo = {
6629
6540
  "Total raised": {
6630
- value: "$48,920",
6541
+ value: "$".concat(formatNumber(48920)),
6631
6542
  subValue: "12% vs last month",
6632
- icon: iconsMaterial.PaidOutlined,
6633
- data: [3200, 4100, 2800, 5600, 4200, 6100, 7500]
6543
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
6544
+ data: [3200, 4100, 2800, 5600, 4200, 6100, 7500],
6545
+ money: true,
6546
+ error: false,
6547
+ warning: false
6634
6548
  },
6635
6549
  Donations: {
6636
6550
  value: "62",
6637
6551
  subValue: "12% vs last month",
6638
- icon: iconsMaterial.FavoriteOutlined,
6639
- data: [4, 8, 5, 12, 10, 11, 12]
6552
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.FavoriteOutlined, {}),
6553
+ data: [4, 8, 5, 12, 10, 11, 12],
6554
+ money: false,
6555
+ error: false,
6556
+ warning: false
6640
6557
  },
6641
6558
  "Conversion rate": {
6642
6559
  value: "3.2%",
6643
6560
  subValue: "12% vs last month",
6644
- icon: iconsMaterial.Adjust,
6645
- data: [2.8, 3.1, 2.9, 3.4, 3.2, 3.1, 3.2]
6561
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Adjust, {}),
6562
+ data: [2.8, 3.1, 2.9, 3.4, 3.2, 3.1, 3.2],
6563
+ money: false,
6564
+ error: false,
6565
+ warning: false
6646
6566
  },
6647
6567
  CTR: {
6648
6568
  value: "8.1%",
6649
6569
  subValue: "12% vs last month",
6650
- icon: iconsMaterial.NotInterested,
6651
- data: [7.2, 8.4, 7.8, 8.9, 8.1, 8.0, 8.1]
6570
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.NotInterested, {}),
6571
+ data: [7.2, 8.4, 7.8, 8.9, 8.1, 8.0, 8.1],
6572
+ money: false,
6573
+ error: false,
6574
+ warning: false
6652
6575
  },
6653
6576
  "Revenue per email": {
6654
- value: "$2.45",
6577
+ value: "$".concat(formatNumber(2.45)),
6655
6578
  subValue: "12% vs last month",
6656
- icon: iconsMaterial.IndeterminateCheckBoxOutlined,
6657
- data: [2.1, 2.5, 2.3, 2.8, 2.4, 2.4, 2.45]
6579
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.IndeterminateCheckBoxOutlined, {}),
6580
+ data: [2.1, 2.5, 2.3, 2.8, 2.4, 2.4, 2.45],
6581
+ money: true,
6582
+ error: false,
6583
+ warning: false
6658
6584
  },
6659
6585
  "Open rate": {
6660
6586
  value: "42.3%",
6661
6587
  subValue: "12% vs last month",
6662
- icon: iconsMaterial.Email,
6663
- data: [38, 44, 40, 46, 42, 41, 42.3]
6588
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Email, {}),
6589
+ data: [38, 44, 40, 46, 42, 41, 42.3],
6590
+ money: false,
6591
+ error: false,
6592
+ warning: false
6664
6593
  },
6665
6594
  Clicks: {
6666
6595
  value: "1,612",
6667
6596
  subValue: "12% vs last month",
6668
- icon: iconsMaterial.NearMe,
6669
- data: [210, 240, 220, 280, 250, 245, 245]
6597
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.NearMe, {}),
6598
+ data: [210, 240, 220, 280, 250, 245, 245],
6599
+ money: false,
6600
+ error: false,
6601
+ warning: false
6670
6602
  },
6671
6603
  "Unique Clicks": {
6672
- value: "1,148",
6604
+ value: "".concat(formatNumber(1148)),
6673
6605
  subValue: "12% vs last month",
6674
- icon: iconsMaterial.NearMe,
6675
- data: [150, 180, 160, 210, 190, 185, 185]
6606
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.NearMe, {}),
6607
+ data: [150, 180, 160, 210, 190, 185, 185],
6608
+ money: false,
6609
+ error: false,
6610
+ warning: false
6676
6611
  },
6677
6612
  "Bounce rate": {
6678
6613
  value: "1.8%",
6679
6614
  subValue: "12% vs last month",
6680
- icon: iconsMaterial.HighlightOff,
6681
- data: [2.1, 1.9, 1.8, 1.7, 1.8, 1.8, 1.8]
6615
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.HighlightOff, {}),
6616
+ data: [2.1, 1.9, 1.8, 1.7, 1.8, 1.8, 1.8],
6617
+ money: false,
6618
+ error: false,
6619
+ warning: false
6682
6620
  },
6683
6621
  "Revenue per Click": {
6684
- value: "$30.35",
6622
+ value: "$".concat(formatNumber(30.35)),
6685
6623
  subValue: "12% vs last month",
6686
- icon: iconsMaterial.HighlightOff,
6687
- data: [28, 32, 29, 34, 30, 30, 30.35]
6624
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.HighlightOff, {}),
6625
+ data: [28, 32, 29, 34, 30, 30, 30.35],
6626
+ money: true,
6627
+ error: false,
6628
+ warning: false
6688
6629
  }
6689
6630
  };
6690
6631
  var renderCard = function renderCard(title) {
6691
- return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
6632
+ return /*#__PURE__*/jsxRuntime.jsx(MetricCard
6633
+ // key={title}
6634
+ , {
6692
6635
  title: title,
6693
- value: metricInfo[title].value,
6694
- subValue: metricInfo[title].subValue,
6695
- icon: metricInfo[title].icon
6696
- // onClick={() => setActiveMetric(title)}
6697
- // isActive={activeMetric === title}
6698
- ,
6699
- sx: {}
6700
- }, title);
6636
+ value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
6637
+ caption: metricInfo[title].subValue,
6638
+ icon: metricInfo[title].icon,
6639
+ error: metricInfo[title].error,
6640
+ active: activeMetric === title,
6641
+ onClick: function onClick() {
6642
+ return setActiveMetric(title);
6643
+ },
6644
+ sx: metricInfo[title].error ? {
6645
+ border: "2px solid #ef4444",
6646
+ bgcolor: "#fffafa"
6647
+ } : {}
6648
+ })
6649
+ // <DisplayCard
6650
+ // key={title}
6651
+ // title={title}
6652
+ // value={metricInfo[title].value}
6653
+ // subValue={metricInfo[title].subValue}
6654
+ // icon={metricInfo[title].icon}
6655
+ // // onClick={() => setActiveMetric(title)}
6656
+ // // isActive={activeMetric === title}
6657
+ // sx={{
6658
+ // }}
6659
+ // />
6660
+ ;
6701
6661
  };
6702
6662
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
6703
6663
  children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {