@ammarkhalidfarooq/dashboard-package 0.6.1 → 0.6.2

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.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { Suspense, lazy, useMemo, useState, useRef, useEffect } from 'react';
2
- import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Stack } from '@mui/material';
2
+ import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, Stack, TableContainer, Table, TableHead, TableRow, TableCell, TableBody } from '@mui/material';
3
3
  import { MoreHoriz, TrendingUp, MoreVert, Check, InfoOutlined, Settings, Adjust, PaidOutlined, PeopleAltOutlined, FavoriteOutlined, PersonOutlined, IndeterminateCheckBoxOutlined, SearchOutlined, HighlightOff, NearMe, Email, NotInterested } from '@mui/icons-material';
4
4
  import { createTheme, useTheme } from '@mui/material/styles';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1148,6 +1148,72 @@ var ActiveCampaignsCard = function ActiveCampaignsCard(_ref) {
1148
1148
  });
1149
1149
  };
1150
1150
 
1151
+ var MetricCard$1 = function MetricCard(_ref) {
1152
+ var title = _ref.title,
1153
+ value = _ref.value,
1154
+ caption = _ref.caption,
1155
+ icon = _ref.icon,
1156
+ active = _ref.active,
1157
+ warning = _ref.warning,
1158
+ error = _ref.error,
1159
+ onClick = _ref.onClick;
1160
+ return /*#__PURE__*/jsxs(Box, {
1161
+ sx: {
1162
+ bgcolor: "#fff",
1163
+ border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
1164
+ borderRadius: "16px",
1165
+ p: {
1166
+ xs: 1.75,
1167
+ md: 2
1168
+ },
1169
+ paddingTop: "10px !important",
1170
+ paddingBottom: "10px !important",
1171
+ height: 92,
1172
+ boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
1173
+ },
1174
+ onClick: onClick,
1175
+ children: [/*#__PURE__*/jsxs(Stack, {
1176
+ direction: "row",
1177
+ justifyContent: "space-between",
1178
+ alignItems: "center",
1179
+ children: [/*#__PURE__*/jsx(Typography, {
1180
+ sx: {
1181
+ color: active ? "#818CF8" : "#999EAA",
1182
+ fontSize: 13,
1183
+ fontWeight: 500,
1184
+ letterSpacing: 0
1185
+ },
1186
+ children: title
1187
+ }), /*#__PURE__*/jsx(Avatar, {
1188
+ sx: {
1189
+ width: 30,
1190
+ height: 30,
1191
+ bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
1192
+ color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
1193
+ },
1194
+ children: icon
1195
+ })]
1196
+ }), /*#__PURE__*/jsx(Typography, {
1197
+ sx: {
1198
+ // mt: 0.3,
1199
+ fontSize: 22,
1200
+ fontWeight: 700,
1201
+ color: active ? "#4F46E5" : "#050509",
1202
+ lineHeight: 1.15
1203
+ },
1204
+ children: value
1205
+ }), /*#__PURE__*/jsx(Typography, {
1206
+ sx: {
1207
+ // mt: 1.05,
1208
+ fontSize: 12,
1209
+ fontWeight: 500,
1210
+ color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
1211
+ },
1212
+ children: caption
1213
+ })]
1214
+ });
1215
+ };
1216
+
1151
1217
  function formatNumber(num) {
1152
1218
  if (num >= 1000000000) {
1153
1219
  return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
@@ -1547,7 +1613,7 @@ var TrendPill = function TrendPill(_ref) {
1547
1613
  children: value
1548
1614
  });
1549
1615
  };
1550
- var MetricCard$1 = function MetricCard(_ref2) {
1616
+ var MetricCard = function MetricCard(_ref2) {
1551
1617
  var title = _ref2.title,
1552
1618
  value = _ref2.value,
1553
1619
  trend = _ref2.trend,
@@ -1671,7 +1737,7 @@ var ReportKpiSection = function ReportKpiSection(_ref3) {
1671
1737
  gap: exportMode ? 1 : 2
1672
1738
  },
1673
1739
  children: metrics.map(function (m) {
1674
- return /*#__PURE__*/jsx(MetricCard$1, _objectSpread2(_objectSpread2({}, m), {}, {
1740
+ return /*#__PURE__*/jsx(MetricCard, _objectSpread2(_objectSpread2({}, m), {}, {
1675
1741
  exportMode: exportMode
1676
1742
  }), m.title);
1677
1743
  })
@@ -14433,72 +14499,6 @@ var html2canvas_esm = /*#__PURE__*/Object.freeze({
14433
14499
  default: html2canvas
14434
14500
  });
14435
14501
 
14436
- var MetricCard = function MetricCard(_ref) {
14437
- var title = _ref.title,
14438
- value = _ref.value,
14439
- caption = _ref.caption,
14440
- icon = _ref.icon,
14441
- active = _ref.active,
14442
- warning = _ref.warning,
14443
- error = _ref.error,
14444
- onClick = _ref.onClick;
14445
- return /*#__PURE__*/jsxs(Box, {
14446
- sx: {
14447
- bgcolor: "#fff",
14448
- border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
14449
- borderRadius: "16px",
14450
- p: {
14451
- xs: 1.75,
14452
- md: 2
14453
- },
14454
- paddingTop: "10px !important",
14455
- paddingBottom: "10px !important",
14456
- height: 92,
14457
- boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
14458
- },
14459
- onClick: onClick,
14460
- children: [/*#__PURE__*/jsxs(Stack, {
14461
- direction: "row",
14462
- justifyContent: "space-between",
14463
- alignItems: "center",
14464
- children: [/*#__PURE__*/jsx(Typography, {
14465
- sx: {
14466
- color: active ? "#818CF8" : "#999EAA",
14467
- fontSize: 13,
14468
- fontWeight: 500,
14469
- letterSpacing: 0
14470
- },
14471
- children: title
14472
- }), /*#__PURE__*/jsx(Avatar, {
14473
- sx: {
14474
- width: 30,
14475
- height: 30,
14476
- bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
14477
- color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
14478
- },
14479
- children: icon
14480
- })]
14481
- }), /*#__PURE__*/jsx(Typography, {
14482
- sx: {
14483
- // mt: 0.3,
14484
- fontSize: 22,
14485
- fontWeight: 700,
14486
- color: active ? "#4F46E5" : "#050509",
14487
- lineHeight: 1.15
14488
- },
14489
- children: value
14490
- }), /*#__PURE__*/jsx(Typography, {
14491
- sx: {
14492
- // mt: 1.05,
14493
- fontSize: 12,
14494
- fontWeight: 500,
14495
- color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
14496
- },
14497
- children: caption
14498
- })]
14499
- });
14500
- };
14501
-
14502
14502
  var OverallSection = function OverallSection(_ref) {
14503
14503
  var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$roasCard, _apiData$roasCardPrev, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13;
14504
14504
  var _ref$apiData = _ref.apiData,
@@ -14541,7 +14541,7 @@ var OverallSection = function OverallSection(_ref) {
14541
14541
  })) {
14542
14542
  charts.push({
14543
14543
  label: "Total Donors",
14544
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "215",
14544
+ value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "0",
14545
14545
  data: (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28],
14546
14546
  categories: categories
14547
14547
  });
@@ -14578,7 +14578,7 @@ var OverallSection = function OverallSection(_ref) {
14578
14578
  warning: false
14579
14579
  },
14580
14580
  "Total Donors": {
14581
- value: (apiData === null || apiData === void 0 || (_apiData$overviewStat7 = apiData.overviewStats) === null || _apiData$overviewStat7 === void 0 || (_apiData$overviewStat7 = _apiData$overviewStat7.overview) === null || _apiData$overviewStat7 === void 0 ? void 0 : _apiData$overviewStat7.totalDonations) || "215",
14581
+ value: (apiData === null || apiData === void 0 || (_apiData$overviewStat7 = apiData.overviewStats) === null || _apiData$overviewStat7 === void 0 || (_apiData$overviewStat7 = _apiData$overviewStat7.overview) === null || _apiData$overviewStat7 === void 0 ? void 0 : _apiData$overviewStat7.totalDonations) || "0",
14582
14582
  subValue: "".concat(Number((_apiData$overviewStat8 = apiData === null || apiData === void 0 || (_apiData$overviewStat9 = apiData.overviewStats) === null || _apiData$overviewStat9 === void 0 || (_apiData$overviewStat9 = _apiData$overviewStat9.overview.growthPercentage) === null || _apiData$overviewStat9 === void 0 ? void 0 : _apiData$overviewStat9.totalDonations) !== null && _apiData$overviewStat8 !== void 0 ? _apiData$overviewStat8 : 0).toFixed(2), "%") || "0 new",
14583
14583
  label: "Total Donors",
14584
14584
  icon: /*#__PURE__*/jsx(PeopleAltOutlined, {}),
@@ -14649,7 +14649,7 @@ var OverallSection = function OverallSection(_ref) {
14649
14649
  }
14650
14650
  console.log("DONOR MIX", donorMix);
14651
14651
  var renderCard = function renderCard(title) {
14652
- return /*#__PURE__*/jsx(MetricCard
14652
+ return /*#__PURE__*/jsx(MetricCard$1
14653
14653
  // key={title}
14654
14654
  , {
14655
14655
  title: title,
@@ -15111,7 +15111,7 @@ var PaidSection = function PaidSection() {
15111
15111
  }
15112
15112
  };
15113
15113
  var renderCard = function renderCard(title) {
15114
- return /*#__PURE__*/jsx(MetricCard
15114
+ return /*#__PURE__*/jsx(MetricCard$1
15115
15115
  // key={title}
15116
15116
  , {
15117
15117
  title: title,
@@ -15610,7 +15610,7 @@ var OrganicSection = function OrganicSection(_ref) {
15610
15610
  };
15611
15611
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.sourceBreakdown, hasOrganicOverview]);
15612
15612
  var renderCard = function renderCard(title) {
15613
- return /*#__PURE__*/jsx(MetricCard, {
15613
+ return /*#__PURE__*/jsx(MetricCard$1, {
15614
15614
  title: title,
15615
15615
  value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
15616
15616
  caption: metricInfo[title].subValue,
@@ -16299,7 +16299,7 @@ var EmailSection = function EmailSection(_ref) {
16299
16299
  });
16300
16300
  }, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByConversion, hasEmailOverview]);
16301
16301
  var renderCard = function renderCard(title) {
16302
- return /*#__PURE__*/jsx(MetricCard, {
16302
+ return /*#__PURE__*/jsx(MetricCard$1, {
16303
16303
  title: title,
16304
16304
  value: metricInfo[title].value,
16305
16305
  caption: metricInfo[title].subValue,
@@ -16482,5 +16482,5 @@ var EmailSection$1 = /*#__PURE__*/Object.freeze({
16482
16482
  default: EmailSection
16483
16483
  });
16484
16484
 
16485
- export { AbandonedDonationRecovery, ActiveCampaignsCard, Dashboard, DashboardReport, theme as DashboardTheme, DonorBehavior, MetricSelector, NewOverview, PerformanceSection, RecurringRevenueSection, RenderChartCard, RevenueChart, UTMPerformance, themeColors, themeTypography };
16485
+ export { AbandonedDonationRecovery, ActiveCampaignsCard, Dashboard, DashboardReport, theme as DashboardTheme, DonorBehavior, MetricCard$1 as MetricCard, MetricSelector, NewOverview, PerformanceSection, RecurringRevenueSection, RenderChartCard, RevenueChart, UTMPerformance, themeColors, themeTypography };
16486
16486
  //# sourceMappingURL=index.es.js.map