@ammarkhalidfarooq/dashboard-package 0.6.106 → 0.6.107

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, useState, useRef, useEffect, useMemo } from 'react';
2
- import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, Stack, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Skeleton } from '@mui/material';
2
+ import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, Avatar, LinearProgress, Stack, Dialog, DialogTitle, DialogContent, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Skeleton } from '@mui/material';
3
3
  import { MoreHoriz, TrendingDown, TrendingUp, MoreVert, Check, InfoOutlined, Settings, PeopleAltOutlined, PaidOutlined, PersonOutlined, IndeterminateCheckBoxOutlined, FavoriteOutlined, SearchOutlined, HighlightOff, Email } from '@mui/icons-material';
4
4
  import { createTheme, useTheme } from '@mui/material/styles';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -7,6 +7,7 @@ import Grid$1 from '@mui/material/Grid';
7
7
  import Box$1 from '@mui/material/Box';
8
8
  import Typography$1 from '@mui/material/Typography';
9
9
  import ReactApexChart from 'react-apexcharts';
10
+ import CloseIcon from '@mui/icons-material/Close';
10
11
 
11
12
  var theme = createTheme({
12
13
  cssVariables: true,
@@ -7041,6 +7042,154 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7041
7042
  });
7042
7043
  };
7043
7044
 
7045
+ var BORDER$1 = "1px solid #e0e0e0";
7046
+ var headerCellSx$1 = {
7047
+ fontWeight: 700,
7048
+ fontSize: "0.78rem",
7049
+ color: "#111",
7050
+ bgcolor: "#f3f3f3",
7051
+ borderBottom: BORDER$1,
7052
+ borderRight: BORDER$1,
7053
+ py: "12px",
7054
+ px: "16px",
7055
+ lineHeight: 1.4,
7056
+ textAlign: "left",
7057
+ "&:last-child": {
7058
+ borderRight: 0
7059
+ }
7060
+ };
7061
+ var cellSx$1 = {
7062
+ fontSize: "0.85rem",
7063
+ color: "#333",
7064
+ borderBottom: BORDER$1,
7065
+ borderRight: BORDER$1,
7066
+ py: "12px",
7067
+ px: "16px",
7068
+ verticalAlign: "middle",
7069
+ textAlign: "left",
7070
+ "&:last-child": {
7071
+ borderRight: 0
7072
+ }
7073
+ };
7074
+ var MOCK_ROWS = [{
7075
+ date: "Jun 1, 2026",
7076
+ campaignName: "Ramadan 2024 - Global Feed",
7077
+ raised: "$4,520.00"
7078
+ }, {
7079
+ date: "Jun 2, 2026",
7080
+ campaignName: "Water for Life - East Africa",
7081
+ raised: "$1,280.00"
7082
+ }, {
7083
+ date: "Jun 3, 2026",
7084
+ campaignName: "Orphan Care - Palestine",
7085
+ raised: "$2,850.00"
7086
+ }, {
7087
+ date: "Jun 4, 2026",
7088
+ campaignName: "Emergency Relief - Yemen",
7089
+ raised: "$1,540.00"
7090
+ }, {
7091
+ date: "Jun 5, 2026",
7092
+ campaignName: "Education Fund - Syria",
7093
+ raised: "$980.00"
7094
+ }, {
7095
+ date: "Jun 6, 2026",
7096
+ campaignName: "Medical Aid - Gaza",
7097
+ raised: "$3,120.00"
7098
+ }, {
7099
+ date: "Jun 7, 2026",
7100
+ campaignName: "Food Security - Sudan",
7101
+ raised: "$760.00"
7102
+ }];
7103
+ var OverallDetailModal = function OverallDetailModal(_ref) {
7104
+ var open = _ref.open,
7105
+ title = _ref.title,
7106
+ onClose = _ref.onClose;
7107
+ return /*#__PURE__*/jsxs(Dialog, {
7108
+ open: open,
7109
+ onClose: onClose,
7110
+ maxWidth: "md",
7111
+ fullWidth: true,
7112
+ children: [/*#__PURE__*/jsxs(DialogTitle, {
7113
+ sx: {
7114
+ display: "flex",
7115
+ alignItems: "center",
7116
+ justifyContent: "space-between",
7117
+ pr: 1,
7118
+ pb: 1
7119
+ },
7120
+ children: [/*#__PURE__*/jsxs(Box, {
7121
+ children: [/*#__PURE__*/jsx(Typography, {
7122
+ sx: {
7123
+ fontWeight: 700,
7124
+ fontSize: "18px",
7125
+ color: "#000"
7126
+ },
7127
+ children: title
7128
+ }), /*#__PURE__*/jsx(Typography, {
7129
+ sx: {
7130
+ fontSize: "13px",
7131
+ color: "rgba(0, 0, 0, 0.45)",
7132
+ mt: 0.25
7133
+ },
7134
+ children: "Campaign breakdown"
7135
+ })]
7136
+ }), /*#__PURE__*/jsx(IconButton, {
7137
+ "aria-label": "Close",
7138
+ onClick: onClose,
7139
+ size: "small",
7140
+ children: /*#__PURE__*/jsx(CloseIcon, {})
7141
+ })]
7142
+ }), /*#__PURE__*/jsx(DialogContent, {
7143
+ sx: {
7144
+ pt: 0
7145
+ },
7146
+ children: /*#__PURE__*/jsx(TableContainer, {
7147
+ sx: {
7148
+ border: BORDER$1,
7149
+ borderRadius: "12px",
7150
+ overflow: "hidden"
7151
+ },
7152
+ children: /*#__PURE__*/jsxs(Table, {
7153
+ children: [/*#__PURE__*/jsx(TableHead, {
7154
+ children: /*#__PURE__*/jsxs(TableRow, {
7155
+ children: [/*#__PURE__*/jsx(TableCell, {
7156
+ sx: headerCellSx$1,
7157
+ children: "Date"
7158
+ }), /*#__PURE__*/jsx(TableCell, {
7159
+ sx: headerCellSx$1,
7160
+ children: "Campaign Name"
7161
+ }), /*#__PURE__*/jsx(TableCell, {
7162
+ sx: _objectSpread2(_objectSpread2({}, headerCellSx$1), {}, {
7163
+ textAlign: "right"
7164
+ }),
7165
+ children: "Raised"
7166
+ })]
7167
+ })
7168
+ }), /*#__PURE__*/jsx(TableBody, {
7169
+ children: MOCK_ROWS.map(function (row) {
7170
+ return /*#__PURE__*/jsxs(TableRow, {
7171
+ children: [/*#__PURE__*/jsx(TableCell, {
7172
+ sx: cellSx$1,
7173
+ children: row.date
7174
+ }), /*#__PURE__*/jsx(TableCell, {
7175
+ sx: cellSx$1,
7176
+ children: row.campaignName
7177
+ }), /*#__PURE__*/jsx(TableCell, {
7178
+ sx: _objectSpread2(_objectSpread2({}, cellSx$1), {}, {
7179
+ textAlign: "right",
7180
+ fontWeight: 600
7181
+ }),
7182
+ children: row.raised
7183
+ })]
7184
+ }, "".concat(row.date, "-").concat(row.campaignName));
7185
+ })
7186
+ })]
7187
+ })
7188
+ })
7189
+ })]
7190
+ });
7191
+ };
7192
+
7044
7193
  var CARD_SX = {
7045
7194
  maxHeight: 280
7046
7195
  };
@@ -7088,7 +7237,30 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7088
7237
  _ref.dateName;
7089
7238
  var _ref$numberOfDays = _ref.numberOfDays,
7090
7239
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7240
+ var _useState = useState(null),
7241
+ _useState2 = _slicedToArray(_useState, 2),
7242
+ modalTitle = _useState2[0],
7243
+ setModalTitle = _useState2[1];
7091
7244
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7245
+ var openDetailModal = function openDetailModal(title) {
7246
+ if (!exportMode) {
7247
+ setModalTitle(title);
7248
+ }
7249
+ };
7250
+ var closeDetailModal = function closeDetailModal() {
7251
+ return setModalTitle(null);
7252
+ };
7253
+ var withCardClick = function withCardClick(title, card) {
7254
+ return exportMode ? card : /*#__PURE__*/jsx(Box, {
7255
+ onClick: function onClick() {
7256
+ return openDetailModal(title);
7257
+ },
7258
+ sx: {
7259
+ height: "100%"
7260
+ },
7261
+ children: card
7262
+ });
7263
+ };
7092
7264
  var _donorMix$newDonors = donorMix.newDonors,
7093
7265
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
7094
7266
  _donorMix$returningDo = donorMix.returningDonors,
@@ -7151,12 +7323,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7151
7323
  sx: {
7152
7324
  paddingTop: "0px !important"
7153
7325
  },
7154
- children: /*#__PURE__*/jsx(ActiveCampaignsCard, {
7326
+ children: withCardClick("Active Campaigns", /*#__PURE__*/jsx(ActiveCampaignsCard, {
7155
7327
  title: "Active Campaigns",
7156
7328
  subtitle: "Live fundraisers ranked by velocity",
7157
7329
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7158
7330
  rows: activeCampaignsRows
7159
- })
7331
+ }))
7160
7332
  }), /*#__PURE__*/jsx(Grid, {
7161
7333
  item: true,
7162
7334
  xs: 12,
@@ -7169,7 +7341,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7169
7341
  md: 0
7170
7342
  }
7171
7343
  },
7172
- children: /*#__PURE__*/jsx(DonorMixCard, {
7344
+ children: withCardClick("Donor Mix", /*#__PURE__*/jsx(DonorMixCard, {
7173
7345
  title: "Donor Mix",
7174
7346
  subtitle: "Acquisition vs retention",
7175
7347
  series: [newDonors, returningDonors],
@@ -7191,29 +7363,29 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7191
7363
  sx: {
7192
7364
  width: "100%"
7193
7365
  }
7194
- })
7366
+ }))
7195
7367
  })]
7196
7368
  });
7197
7369
  var middleCards = /*#__PURE__*/jsxs(Fragment, {
7198
- children: [/*#__PURE__*/jsx(DonationTypeBarChart, {
7370
+ children: [withCardClick("Donation Type", /*#__PURE__*/jsx(DonationTypeBarChart, {
7199
7371
  sx: CARD_SX,
7200
7372
  donationTypeData: donationTypeData
7201
- }), /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7373
+ })), withCardClick("Paid Donor Geography", /*#__PURE__*/jsx(PaidDonorGeographyCard, {
7202
7374
  sx: CARD_SX,
7203
7375
  donorGeographyData: donorGeographyData
7204
- }), /*#__PURE__*/jsx(RefundsChargebacksCard, {
7376
+ })), withCardClick("Refunds & Chargebacks", /*#__PURE__*/jsx(RefundsChargebacksCard, {
7205
7377
  sx: CARD_SX,
7206
7378
  refundsChargebacksData: refundsChargebacksData,
7207
7379
  numberOfDays: numberOfDays
7208
- }), /*#__PURE__*/jsx(TrafficSourceCard, {
7380
+ })), withCardClick("Traffic Source", /*#__PURE__*/jsx(TrafficSourceCard, {
7209
7381
  sx: CARD_SX,
7210
7382
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7211
7383
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7212
7384
  numberOfDays: numberOfDays
7213
- })]
7385
+ }))]
7214
7386
  });
7215
7387
  var bottomCards = /*#__PURE__*/jsxs(Fragment, {
7216
- children: [/*#__PURE__*/jsx(MetricSparklineCard, {
7388
+ children: [withCardClick("Order Bump", /*#__PURE__*/jsx(MetricSparklineCard, {
7217
7389
  title: "Order Bump",
7218
7390
  subtitle: "Revenue trend - last ".concat(daysLabel),
7219
7391
  value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
@@ -7238,7 +7410,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7238
7410
  }],
7239
7411
  sx: CARD_SX,
7240
7412
  bottomSection: true
7241
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7413
+ })), withCardClick("Upsell", /*#__PURE__*/jsx(MetricDonutCard, {
7242
7414
  title: "Upsell",
7243
7415
  subtitle: "Acceptance & raised",
7244
7416
  acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
@@ -7247,7 +7419,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7247
7419
  raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7248
7420
  raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
7249
7421
  sx: CARD_SX
7250
- }), /*#__PURE__*/jsx(MetricDonutCard, {
7422
+ })), withCardClick("Downsell", /*#__PURE__*/jsx(MetricDonutCard, {
7251
7423
  title: "Downsell",
7252
7424
  subtitle: "Acceptance & raised",
7253
7425
  acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
@@ -7256,7 +7428,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7256
7428
  raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7257
7429
  raisedTrend: "".concat((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0).toFixed(1), "%"),
7258
7430
  sx: CARD_SX
7259
- }), /*#__PURE__*/jsx(MetricSparklineCard, {
7431
+ })), withCardClick("Referrals", /*#__PURE__*/jsx(MetricSparklineCard, {
7260
7432
  title: "Referrals",
7261
7433
  subtitle: "Revenue trend - last ".concat(daysLabel),
7262
7434
  value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
@@ -7280,19 +7452,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7280
7452
  }],
7281
7453
  sx: CARD_SX,
7282
7454
  bottomSection: true
7283
- })]
7284
- });
7285
- if (section === "campaigns") return /*#__PURE__*/jsx(Box, {
7286
- children: campaignsRow
7287
- });
7288
- if (section === "middle") return /*#__PURE__*/jsx(Box, {
7289
- sx: fourColGridSx$1(exportMode),
7290
- children: middleCards
7455
+ }))]
7291
7456
  });
7292
- if (section === "bottom") return /*#__PURE__*/jsx(Box, {
7293
- sx: fourColGridSx$1(exportMode),
7294
- children: bottomCards
7457
+ var detailModal = /*#__PURE__*/jsx(OverallDetailModal, {
7458
+ open: Boolean(modalTitle),
7459
+ title: modalTitle || "",
7460
+ onClose: closeDetailModal
7295
7461
  });
7462
+ if (section === "campaigns") {
7463
+ return /*#__PURE__*/jsxs(Box, {
7464
+ children: [campaignsRow, detailModal]
7465
+ });
7466
+ }
7467
+ if (section === "middle") {
7468
+ return /*#__PURE__*/jsxs(Box, {
7469
+ children: [/*#__PURE__*/jsx(Box, {
7470
+ sx: fourColGridSx$1(exportMode),
7471
+ children: middleCards
7472
+ }), detailModal]
7473
+ });
7474
+ }
7475
+ if (section === "bottom") {
7476
+ return /*#__PURE__*/jsxs(Box, {
7477
+ children: [/*#__PURE__*/jsx(Box, {
7478
+ sx: fourColGridSx$1(exportMode),
7479
+ children: bottomCards
7480
+ }), detailModal]
7481
+ });
7482
+ }
7296
7483
  return /*#__PURE__*/jsxs(Box, {
7297
7484
  children: [campaignsRow, /*#__PURE__*/jsx(Box, {
7298
7485
  sx: fourColGridSx$1(exportMode),
@@ -7300,7 +7487,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7300
7487
  }), /*#__PURE__*/jsx(Box, {
7301
7488
  sx: fourColGridSx$1(exportMode),
7302
7489
  children: bottomCards
7303
- })]
7490
+ }), detailModal]
7304
7491
  });
7305
7492
  };
7306
7493