@ammarkhalidfarooq/dashboard-package 0.3.23 → 0.3.25

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
@@ -254,7 +254,9 @@ var RevenueChart = function RevenueChart(_ref) {
254
254
  type = _ref$type === void 0 ? "area" : _ref$type,
255
255
  _ref$id = _ref.id,
256
256
  id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
257
- colors = _ref.colors;
257
+ colors = _ref.colors,
258
+ _ref$showLegend = _ref.showLegend,
259
+ showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend;
258
260
  var theme = useTheme();
259
261
  var isRadial = type === 'donut' || type === 'pie';
260
262
 
@@ -292,7 +294,7 @@ var RevenueChart = function RevenueChart(_ref) {
292
294
  enabled: true
293
295
  },
294
296
  legend: {
295
- show: true,
297
+ show: showLegend,
296
298
  position: 'bottom',
297
299
  horizontalAlign: 'center'
298
300
  },
@@ -342,10 +344,20 @@ var RevenueChart = function RevenueChart(_ref) {
342
344
  axisTicks: {
343
345
  show: false
344
346
  },
347
+ tickAmount: 7,
345
348
  labels: {
346
349
  style: {
347
350
  colors: '#A1A1A8',
348
351
  fontSize: '12px'
352
+ },
353
+ formatter: function formatter(val) {
354
+ if (!val || typeof val !== 'string') return val;
355
+ var date = new Date(val);
356
+ if (isNaN(date.getTime())) return val;
357
+ return date.toLocaleDateString('en-US', {
358
+ month: 'short',
359
+ day: 'numeric'
360
+ });
349
361
  }
350
362
  }
351
363
  },
@@ -371,7 +383,7 @@ var RevenueChart = function RevenueChart(_ref) {
371
383
  enabled: false
372
384
  },
373
385
  legend: {
374
- show: stacked || series && series.length > 1,
386
+ show: showLegend && (stacked || series && series.length > 1),
375
387
  position: 'top',
376
388
  horizontalAlign: 'left'
377
389
  },
@@ -537,33 +549,75 @@ var RenderChartCard = function RenderChartCard(_ref) {
537
549
  },
538
550
  children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
539
551
  })]
540
- }), /*#__PURE__*/jsxs(Box, {
552
+ }), /*#__PURE__*/jsx(Box, {
541
553
  sx: {
542
554
  display: "flex",
543
- gap: 1
555
+ gap: 1,
556
+ alignItems: "center"
544
557
  },
545
- children: [item.showSelector && /*#__PURE__*/jsx(MetricSelector, {
546
- metric: metric,
547
- onMetricChange: setMetric,
548
- options: ["Revenue", "Donations"]
549
- }), /*#__PURE__*/jsx(IconButton, {
558
+ children: item.hideControls ? /*#__PURE__*/jsx(Box, {
550
559
  sx: {
551
- border: "1px solid #E9E9EB",
552
- borderRadius: "8px",
553
- color: "#000",
554
- height: "40px",
555
- width: "40px",
556
- "&:hover": {
557
- borderColor: "primary.main",
558
- bgcolor: "rgba(99, 99, 230, 0.04)"
559
- }
560
+ display: "flex",
561
+ gap: 2,
562
+ alignItems: "center"
560
563
  },
561
- children: /*#__PURE__*/jsx(MoreHoriz, {
562
- sx: {
563
- fontSize: "1.2rem"
564
- }
564
+ children: [{
565
+ label: "Paid Ads",
566
+ color: "#6366F1"
567
+ }, {
568
+ label: "Organic",
569
+ color: "#10B981"
570
+ }, {
571
+ label: "Email",
572
+ color: "#06B6D4"
573
+ }].map(function (leg) {
574
+ return /*#__PURE__*/jsxs(Box, {
575
+ sx: {
576
+ display: "flex",
577
+ alignItems: "center",
578
+ gap: 0.5
579
+ },
580
+ children: [/*#__PURE__*/jsx(Box, {
581
+ sx: {
582
+ width: 8,
583
+ height: 8,
584
+ borderRadius: "50%",
585
+ bgcolor: leg.color
586
+ }
587
+ }), /*#__PURE__*/jsx(Typography, {
588
+ sx: {
589
+ fontSize: "12px",
590
+ color: "rgba(0,0,0,0.6)",
591
+ fontWeight: 500
592
+ },
593
+ children: leg.label
594
+ })]
595
+ }, leg.label);
565
596
  })
566
- })]
597
+ }) : /*#__PURE__*/jsxs(Fragment, {
598
+ children: [item.showSelector && /*#__PURE__*/jsx(MetricSelector, {
599
+ metric: metric,
600
+ onMetricChange: setMetric,
601
+ options: ["Revenue", "Donations"]
602
+ }), /*#__PURE__*/jsx(IconButton, {
603
+ sx: {
604
+ border: "1px solid #E9E9EB",
605
+ borderRadius: "8px",
606
+ color: "#000",
607
+ height: "40px",
608
+ width: "40px",
609
+ "&:hover": {
610
+ borderColor: "primary.main",
611
+ bgcolor: "rgba(99, 99, 230, 0.04)"
612
+ }
613
+ },
614
+ children: /*#__PURE__*/jsx(MoreHoriz, {
615
+ sx: {
616
+ fontSize: "1.2rem"
617
+ }
618
+ })
619
+ })]
620
+ })
567
621
  })]
568
622
  }), /*#__PURE__*/jsx(Box, {
569
623
  sx: {
@@ -579,7 +633,8 @@ var RenderChartCard = function RenderChartCard(_ref) {
579
633
  height: isPrimary ? 250 : 200,
580
634
  stacked: item.stacked,
581
635
  type: type || item.type || "area",
582
- colors: item.colors
636
+ colors: item.colors,
637
+ showLegend: !item.hideControls
583
638
  })
584
639
  }), item.footer && /*#__PURE__*/jsxs(Box, {
585
640
  sx: {
@@ -4884,7 +4939,8 @@ var OverallSection = function OverallSection(_ref) {
4884
4939
  series: series,
4885
4940
  categories: categories,
4886
4941
  stacked: true,
4887
- colors: ["#6366F1", "#10B981", "#06B6D4"]
4942
+ colors: ["#6366F1", "#10B981", "#06B6D4"],
4943
+ hideControls: true
4888
4944
  });
4889
4945
  }
4890
4946
  }