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