@ammarkhalidfarooq/dashboard-package 0.4.41 → 0.4.43

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
@@ -3736,8 +3736,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
3736
3736
  plotOptions: {
3737
3737
  bar: {
3738
3738
  horizontal: false,
3739
- columnWidth: "60%",
3740
- barGap: "10%",
3739
+ columnWidth: "70%",
3741
3740
  borderRadius: 4,
3742
3741
  dataLabels: {
3743
3742
  position: "top"
@@ -3745,7 +3744,7 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
3745
3744
  }
3746
3745
  },
3747
3746
  dataLabels: {
3748
- enabled: false,
3747
+ enabled: true,
3749
3748
  formatter: function formatter(val) {
3750
3749
  return "$".concat(formatNumber(val));
3751
3750
  },
@@ -3810,8 +3809,6 @@ var DonationTypeBarChart = function DonationTypeBarChart(_ref) {
3810
3809
  show: false
3811
3810
  },
3812
3811
  tooltip: {
3813
- shared: true,
3814
- intersect: false,
3815
3812
  y: {
3816
3813
  formatter: function formatter(val) {
3817
3814
  return "$".concat(formatNumber(val));
@@ -5150,6 +5147,70 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
5150
5147
  });
5151
5148
  };
5152
5149
 
5150
+ var MetricCard = function MetricCard(_ref) {
5151
+ var title = _ref.title,
5152
+ value = _ref.value,
5153
+ caption = _ref.caption,
5154
+ icon = _ref.icon,
5155
+ active = _ref.active,
5156
+ warning = _ref.warning,
5157
+ error = _ref.error,
5158
+ onClick = _ref.onClick;
5159
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
5160
+ sx: {
5161
+ bgcolor: "#fff",
5162
+ border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
5163
+ borderRadius: "16px",
5164
+ p: {
5165
+ xs: 1.75,
5166
+ md: 2
5167
+ },
5168
+ minHeight: 108,
5169
+ boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
5170
+ },
5171
+ onClick: onClick,
5172
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
5173
+ direction: "row",
5174
+ justifyContent: "space-between",
5175
+ alignItems: "center",
5176
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5177
+ sx: {
5178
+ color: active ? "#818CF8" : "#999EAA",
5179
+ fontSize: 13,
5180
+ fontWeight: 500,
5181
+ letterSpacing: 0
5182
+ },
5183
+ children: title
5184
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
5185
+ sx: {
5186
+ width: 42,
5187
+ height: 42,
5188
+ bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
5189
+ color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
5190
+ },
5191
+ children: icon
5192
+ })]
5193
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5194
+ sx: {
5195
+ mt: 0.3,
5196
+ fontSize: 22,
5197
+ fontWeight: 700,
5198
+ color: active ? "#4F46E5" : "#050509",
5199
+ lineHeight: 1.15
5200
+ },
5201
+ children: value
5202
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
5203
+ sx: {
5204
+ mt: 1.05,
5205
+ fontSize: 12,
5206
+ fontWeight: 500,
5207
+ color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
5208
+ },
5209
+ children: caption
5210
+ })]
5211
+ });
5212
+ };
5213
+
5153
5214
  var OverallSection = function OverallSection(_ref) {
5154
5215
  var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
5155
5216
  var _ref$apiData = _ref.apiData,
@@ -5212,37 +5273,55 @@ var OverallSection = function OverallSection(_ref) {
5212
5273
  value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
5213
5274
  subValue: "".concat(Number((_apiData$totalRaisedP = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev) !== null && _apiData$totalRaisedP !== void 0 ? _apiData$totalRaisedP : 0).toFixed(2), "% vs ").concat(dateName || "last month"),
5214
5275
  label: "Total Raised",
5215
- icon: iconsMaterial.PaidOutlined
5276
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5277
+ money: true,
5278
+ error: false,
5279
+ warning: false
5216
5280
  },
5217
5281
  "Net Raised": {
5218
5282
  value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
5219
5283
  subValue: "".concat(Number((_apiData$netRaisedPre = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedPrev) !== null && _apiData$netRaisedPre !== void 0 ? _apiData$netRaisedPre : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "previous period"),
5220
5284
  label: "Net Raised",
5221
- icon: iconsMaterial.FavoriteOutlined
5285
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.FavoriteOutlined, {}),
5286
+ money: true,
5287
+ error: false,
5288
+ warning: false
5222
5289
  },
5223
5290
  "Total Donors": {
5224
5291
  value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsCard) || "215",
5225
5292
  subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsPrev, " new") || "31 new",
5226
5293
  label: "Total Donors",
5227
- icon: iconsMaterial.PeopleAltOutlined
5294
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PeopleAltOutlined, {}),
5295
+ money: false,
5296
+ error: false,
5297
+ warning: false
5228
5298
  },
5229
5299
  "Avg donation": {
5230
5300
  value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
5231
5301
  subValue: "".concat(Number((_apiData$averageDonat2 = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat2 !== void 0 ? _apiData$averageDonat2 : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
5232
5302
  label: "Average Donation Amount",
5233
- icon: iconsMaterial.PaidOutlined
5303
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PaidOutlined, {}),
5304
+ money: true,
5305
+ error: false,
5306
+ warning: false
5234
5307
  },
5235
5308
  "ROAS": {
5236
5309
  value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
5237
5310
  subValue: "".concat(Number((_apiData$roasCardPrev = apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) !== null && _apiData$roasCardPrev !== void 0 ? _apiData$roasCardPrev : 0).toFixed(2), "x vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
5238
5311
  label: "ROAS",
5239
- icon: iconsMaterial.TrendingUp
5312
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.TrendingUp, {}),
5313
+ money: false,
5314
+ error: false,
5315
+ warning: false
5240
5316
  },
5241
5317
  "Conversion": {
5242
5318
  value: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionCard) || "1.7%",
5243
5319
  subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionSub) || "215 / 12.4K",
5244
5320
  label: "Conversion Rate",
5245
- icon: iconsMaterial.Adjust
5321
+ icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.Adjust, {}),
5322
+ money: false,
5323
+ error: false,
5324
+ warning: false
5246
5325
  }
5247
5326
  };
5248
5327
  var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
@@ -5251,22 +5330,39 @@ var OverallSection = function OverallSection(_ref) {
5251
5330
  var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
5252
5331
  var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
5253
5332
  var renderCard = function renderCard(title) {
5254
- return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5333
+ return /*#__PURE__*/jsxRuntime.jsx(MetricCard
5334
+ // key={title}
5335
+ , {
5255
5336
  title: title,
5256
- value: metricInfo[title].value,
5257
- subValue: metricInfo[title].subValue,
5337
+ value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
5338
+ caption: metricInfo[title].subValue,
5258
5339
  icon: metricInfo[title].icon,
5340
+ error: metricInfo[title].error,
5341
+ active: activeMetric === title,
5259
5342
  onClick: function onClick() {
5260
5343
  return setActiveMetric(title);
5261
5344
  },
5262
- isActive: activeMetric === title,
5263
- sx: {
5264
- // border:
5265
- // activeMetric === title
5266
- // ? "1px solid rgb(99, 99, 230)"
5267
- // : "2px solid #f0f0f0",
5268
- }
5269
- }, title);
5345
+ sx: metricInfo[title].error ? {
5346
+ border: "2px solid #ef4444",
5347
+ bgcolor: "#fffafa"
5348
+ } : {}
5349
+ })
5350
+ // <DisplayCard
5351
+ // key={title}
5352
+ // title={title}
5353
+ // value={metricInfo[title].value}
5354
+ // subValue={metricInfo[title].subValue}
5355
+ // icon={metricInfo[title].icon}
5356
+ // onClick={() => setActiveMetric(title)}
5357
+ // isActive={activeMetric === title}
5358
+ // sx={{
5359
+ // // border:
5360
+ // // activeMetric === title
5361
+ // // ? "1px solid rgb(99, 99, 230)"
5362
+ // // : "2px solid #f0f0f0",
5363
+ // }}
5364
+ // />
5365
+ ;
5270
5366
  };
5271
5367
  var extendedCharts = getExtendedCharts();
5272
5368
  var selectedInfo = metricInfo[activeMetric];