@ammarkhalidfarooq/dashboard-package 0.5.39 → 0.6.0
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/README.md +205 -1
- package/dist/ActiveCampaignsCard.cjs.js +266 -0
- package/dist/ActiveCampaignsCard.cjs.js.map +1 -0
- package/dist/ActiveCampaignsCard.es.js +264 -0
- package/dist/ActiveCampaignsCard.es.js.map +1 -0
- package/dist/RenderChartCard.cjs.js +669 -0
- package/dist/RenderChartCard.cjs.js.map +1 -0
- package/dist/RenderChartCard.es.js +667 -0
- package/dist/RenderChartCard.es.js.map +1 -0
- package/dist/index.cjs.js +578 -575
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +577 -576
- package/dist/index.es.js.map +1 -1
- package/package.json +10 -1
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactApexChart from 'react-apexcharts';
|
|
4
|
+
import { useTheme } from '@mui/material/styles';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import { MoreHoriz } from '@mui/icons-material';
|
|
7
|
+
|
|
8
|
+
function _arrayLikeToArray(r, a) {
|
|
9
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
function _arrayWithHoles(r) {
|
|
14
|
+
if (Array.isArray(r)) return r;
|
|
15
|
+
}
|
|
16
|
+
function _defineProperty(e, r, t) {
|
|
17
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
18
|
+
value: t,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
}) : e[r] = t, e;
|
|
23
|
+
}
|
|
24
|
+
function _iterableToArrayLimit(r, l) {
|
|
25
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
26
|
+
if (null != t) {
|
|
27
|
+
var e,
|
|
28
|
+
n,
|
|
29
|
+
i,
|
|
30
|
+
u,
|
|
31
|
+
a = [],
|
|
32
|
+
f = true,
|
|
33
|
+
o = false;
|
|
34
|
+
try {
|
|
35
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
36
|
+
} catch (r) {
|
|
37
|
+
o = true, n = r;
|
|
38
|
+
} finally {
|
|
39
|
+
try {
|
|
40
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
41
|
+
} finally {
|
|
42
|
+
if (o) throw n;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return a;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _nonIterableRest() {
|
|
49
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
50
|
+
}
|
|
51
|
+
function ownKeys(e, r) {
|
|
52
|
+
var t = Object.keys(e);
|
|
53
|
+
if (Object.getOwnPropertySymbols) {
|
|
54
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
55
|
+
r && (o = o.filter(function (r) {
|
|
56
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
57
|
+
})), t.push.apply(t, o);
|
|
58
|
+
}
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
function _objectSpread2(e) {
|
|
62
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
63
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
64
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
65
|
+
_defineProperty(e, r, t[r]);
|
|
66
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
67
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return e;
|
|
71
|
+
}
|
|
72
|
+
function _slicedToArray(r, e) {
|
|
73
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
74
|
+
}
|
|
75
|
+
function _toPrimitive(t, r) {
|
|
76
|
+
if ("object" != typeof t || !t) return t;
|
|
77
|
+
var e = t[Symbol.toPrimitive];
|
|
78
|
+
if (void 0 !== e) {
|
|
79
|
+
var i = e.call(t, r);
|
|
80
|
+
if ("object" != typeof i) return i;
|
|
81
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
82
|
+
}
|
|
83
|
+
return ("string" === r ? String : Number)(t);
|
|
84
|
+
}
|
|
85
|
+
function _toPropertyKey(t) {
|
|
86
|
+
var i = _toPrimitive(t, "string");
|
|
87
|
+
return "symbol" == typeof i ? i : i + "";
|
|
88
|
+
}
|
|
89
|
+
function _typeof(o) {
|
|
90
|
+
"@babel/helpers - typeof";
|
|
91
|
+
|
|
92
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
93
|
+
return typeof o;
|
|
94
|
+
} : function (o) {
|
|
95
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
96
|
+
}, _typeof(o);
|
|
97
|
+
}
|
|
98
|
+
function _unsupportedIterableToArray(r, a) {
|
|
99
|
+
if (r) {
|
|
100
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
101
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
102
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var RevenueChart = function RevenueChart(_ref) {
|
|
107
|
+
var metric = _ref.metric,
|
|
108
|
+
data = _ref.data,
|
|
109
|
+
series = _ref.series,
|
|
110
|
+
categories = _ref.categories,
|
|
111
|
+
_ref$height = _ref.height,
|
|
112
|
+
height = _ref$height === void 0 ? 350 : _ref$height,
|
|
113
|
+
_ref$stacked = _ref.stacked,
|
|
114
|
+
stacked = _ref$stacked === void 0 ? false : _ref$stacked,
|
|
115
|
+
_ref$type = _ref.type,
|
|
116
|
+
type = _ref$type === void 0 ? "area" : _ref$type,
|
|
117
|
+
_ref$id = _ref.id,
|
|
118
|
+
id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
|
|
119
|
+
colors = _ref.colors,
|
|
120
|
+
_ref$showLegend = _ref.showLegend,
|
|
121
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend;
|
|
122
|
+
var theme = useTheme();
|
|
123
|
+
var isRadial = type === 'donut' || type === 'pie';
|
|
124
|
+
|
|
125
|
+
// Base options common to all charts
|
|
126
|
+
var baseOptions = {
|
|
127
|
+
chart: {
|
|
128
|
+
id: id,
|
|
129
|
+
type: type,
|
|
130
|
+
toolbar: {
|
|
131
|
+
show: false
|
|
132
|
+
},
|
|
133
|
+
sparkline: {
|
|
134
|
+
enabled: false
|
|
135
|
+
},
|
|
136
|
+
animations: {
|
|
137
|
+
enabled: false
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
colors: colors || [theme.palette.primary.main, '#4B4BC2', '#7E7EE6', '#A3A3F0', '#C8C8FA'],
|
|
141
|
+
tooltip: {
|
|
142
|
+
theme: 'light',
|
|
143
|
+
y: {
|
|
144
|
+
formatter: function formatter(value) {
|
|
145
|
+
return (metric === null || metric === void 0 ? void 0 : metric.toLowerCase()) === 'revenue' ? "$".concat((value || 0).toLocaleString()) : value || 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var radialOptions = _objectSpread2(_objectSpread2({}, baseOptions), {}, {
|
|
151
|
+
labels: categories || [],
|
|
152
|
+
stroke: {
|
|
153
|
+
width: 0
|
|
154
|
+
},
|
|
155
|
+
dataLabels: {
|
|
156
|
+
enabled: true
|
|
157
|
+
},
|
|
158
|
+
legend: {
|
|
159
|
+
show: showLegend,
|
|
160
|
+
position: 'bottom',
|
|
161
|
+
horizontalAlign: 'center'
|
|
162
|
+
},
|
|
163
|
+
plotOptions: {
|
|
164
|
+
pie: {
|
|
165
|
+
donut: {
|
|
166
|
+
size: '70%',
|
|
167
|
+
labels: {
|
|
168
|
+
show: true,
|
|
169
|
+
total: {
|
|
170
|
+
show: true,
|
|
171
|
+
label: 'Total',
|
|
172
|
+
formatter: function formatter(w) {
|
|
173
|
+
var sum = w.globals.seriesTotals.reduce(function (a, b) {
|
|
174
|
+
return a + b;
|
|
175
|
+
}, 0);
|
|
176
|
+
return metric === 'Revenue' ? "$".concat(Math.round(sum).toLocaleString()) : Math.round(sum).toLocaleString();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
var linearOptions = _objectSpread2(_objectSpread2({}, baseOptions), {}, {
|
|
185
|
+
chart: _objectSpread2(_objectSpread2({}, baseOptions.chart), {}, {
|
|
186
|
+
stacked: stacked
|
|
187
|
+
}),
|
|
188
|
+
stroke: {
|
|
189
|
+
curve: 'smooth',
|
|
190
|
+
width: type === 'bar' ? 0 : 2
|
|
191
|
+
},
|
|
192
|
+
fill: {
|
|
193
|
+
type: type === 'line' ? 'solid' : 'gradient',
|
|
194
|
+
opacity: type === 'line' ? 0 : 1,
|
|
195
|
+
gradient: type === 'line' ? undefined : {
|
|
196
|
+
shadeIntensity: 1,
|
|
197
|
+
opacityFrom: 0.8,
|
|
198
|
+
opacityTo: 0.4,
|
|
199
|
+
stops: [0, 100]
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
xaxis: {
|
|
203
|
+
categories: categories || [],
|
|
204
|
+
axisBorder: {
|
|
205
|
+
show: false
|
|
206
|
+
},
|
|
207
|
+
axisTicks: {
|
|
208
|
+
show: false
|
|
209
|
+
},
|
|
210
|
+
tickAmount: 5,
|
|
211
|
+
labels: {
|
|
212
|
+
rotate: 0,
|
|
213
|
+
rotateAlways: false,
|
|
214
|
+
hideOverlappingLabels: true,
|
|
215
|
+
style: {
|
|
216
|
+
colors: '#A1A1A8',
|
|
217
|
+
fontSize: '12px'
|
|
218
|
+
},
|
|
219
|
+
formatter: function formatter(val) {
|
|
220
|
+
if (!val || typeof val !== 'string') return val;
|
|
221
|
+
var date = new Date(val);
|
|
222
|
+
if (isNaN(date.getTime())) return val;
|
|
223
|
+
return date.toLocaleDateString('en-US', {
|
|
224
|
+
month: 'short',
|
|
225
|
+
day: 'numeric'
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
yaxis: {
|
|
231
|
+
show: true,
|
|
232
|
+
labels: {
|
|
233
|
+
style: {
|
|
234
|
+
colors: '#A1A1A8',
|
|
235
|
+
fontSize: '12px'
|
|
236
|
+
},
|
|
237
|
+
formatter: function formatter(value) {
|
|
238
|
+
return (metric === null || metric === void 0 ? void 0 : metric.toLowerCase()) === 'revenue' ? "$".concat((value || 0).toLocaleString()) : value || 0;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
grid: {
|
|
243
|
+
show: true,
|
|
244
|
+
borderColor: '#f1f1f1',
|
|
245
|
+
strokeDashArray: 4,
|
|
246
|
+
position: 'back'
|
|
247
|
+
},
|
|
248
|
+
dataLabels: {
|
|
249
|
+
enabled: false
|
|
250
|
+
},
|
|
251
|
+
legend: {
|
|
252
|
+
show: showLegend && (stacked || series && series.length > 1),
|
|
253
|
+
position: 'top',
|
|
254
|
+
horizontalAlign: 'left'
|
|
255
|
+
},
|
|
256
|
+
plotOptions: {
|
|
257
|
+
bar: {
|
|
258
|
+
borderRadius: 4,
|
|
259
|
+
columnWidth: '60%'
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
var chartOptions = isRadial ? radialOptions : linearOptions;
|
|
264
|
+
|
|
265
|
+
// Ensure series is in the correct format for the chart type
|
|
266
|
+
var chartSeries = [];
|
|
267
|
+
if (isRadial) {
|
|
268
|
+
var _series$;
|
|
269
|
+
// For donut/pie, series must be a simple array of numbers
|
|
270
|
+
var processedData = Array.isArray(data) ? data.map(function (v) {
|
|
271
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
272
|
+
}) : [];
|
|
273
|
+
chartSeries = processedData.length > 0 ? processedData : (series === null || series === void 0 || (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.data) || [];
|
|
274
|
+
} else {
|
|
275
|
+
// For bar/line/area, series must be an array of objects [{ name: '', data: [] }]
|
|
276
|
+
var _processedData = Array.isArray(data) ? data.map(function (v) {
|
|
277
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
278
|
+
}) : [];
|
|
279
|
+
chartSeries = Array.isArray(series) ? series : [{
|
|
280
|
+
name: metric || "Value",
|
|
281
|
+
data: _processedData
|
|
282
|
+
}];
|
|
283
|
+
}
|
|
284
|
+
return /*#__PURE__*/jsx(ReactApexChart, {
|
|
285
|
+
options: chartOptions,
|
|
286
|
+
series: chartSeries,
|
|
287
|
+
type: type,
|
|
288
|
+
height: height,
|
|
289
|
+
width: "100%"
|
|
290
|
+
}, "".concat(id, "-").concat(type, "-").concat(chartSeries.length));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
var MetricSelector = function MetricSelector(_ref) {
|
|
294
|
+
var metric = _ref.metric,
|
|
295
|
+
onMetricChange = _ref.onMetricChange,
|
|
296
|
+
_ref$options = _ref.options,
|
|
297
|
+
options = _ref$options === void 0 ? ['Revenue', 'Donations'] : _ref$options,
|
|
298
|
+
_ref$label = _ref.label,
|
|
299
|
+
label = _ref$label === void 0 ? "Metric" : _ref$label;
|
|
300
|
+
var _React$useState = React.useState(null),
|
|
301
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
302
|
+
anchorEl = _React$useState2[0],
|
|
303
|
+
setAnchorEl = _React$useState2[1];
|
|
304
|
+
var open = Boolean(anchorEl);
|
|
305
|
+
var handleClick = function handleClick(event) {
|
|
306
|
+
setAnchorEl(event.currentTarget);
|
|
307
|
+
};
|
|
308
|
+
var handleClose = function handleClose(value) {
|
|
309
|
+
if (typeof value === 'string') {
|
|
310
|
+
onMetricChange(value);
|
|
311
|
+
}
|
|
312
|
+
setAnchorEl(null);
|
|
313
|
+
};
|
|
314
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
315
|
+
sx: {
|
|
316
|
+
display: 'flex',
|
|
317
|
+
gap: 1
|
|
318
|
+
},
|
|
319
|
+
children: [/*#__PURE__*/jsxs(Button, {
|
|
320
|
+
id: "metric-button",
|
|
321
|
+
"aria-controls": open ? 'metric-menu' : undefined,
|
|
322
|
+
"aria-haspopup": "true",
|
|
323
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
324
|
+
onClick: handleClick,
|
|
325
|
+
variant: "outlined",
|
|
326
|
+
sx: {
|
|
327
|
+
borderRadius: '8px',
|
|
328
|
+
borderColor: '#E9E9EB',
|
|
329
|
+
color: '#000',
|
|
330
|
+
textTransform: 'none',
|
|
331
|
+
fontWeight: 600,
|
|
332
|
+
px: 2,
|
|
333
|
+
height: '40px',
|
|
334
|
+
'&:hover': {
|
|
335
|
+
borderColor: 'primary.main',
|
|
336
|
+
bgcolor: 'rgba(99, 99, 230, 0.04)'
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
children: [label, ": ", metric]
|
|
340
|
+
}), /*#__PURE__*/jsx(Menu, {
|
|
341
|
+
id: "metric-menu",
|
|
342
|
+
anchorEl: anchorEl,
|
|
343
|
+
open: open,
|
|
344
|
+
onClose: function onClose() {
|
|
345
|
+
return handleClose();
|
|
346
|
+
},
|
|
347
|
+
MenuListProps: {
|
|
348
|
+
'aria-labelledby': 'metric-button'
|
|
349
|
+
},
|
|
350
|
+
PaperProps: {
|
|
351
|
+
sx: {
|
|
352
|
+
borderRadius: '8px',
|
|
353
|
+
mt: 1,
|
|
354
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)',
|
|
355
|
+
minWidth: '150px'
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
children: options.map(function (option) {
|
|
359
|
+
return /*#__PURE__*/jsx(MenuItem, {
|
|
360
|
+
onClick: function onClick() {
|
|
361
|
+
return handleClose(option);
|
|
362
|
+
},
|
|
363
|
+
sx: {
|
|
364
|
+
fontWeight: metric === option ? 700 : 400
|
|
365
|
+
},
|
|
366
|
+
children: option
|
|
367
|
+
}, option);
|
|
368
|
+
})
|
|
369
|
+
})]
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
var RenderChartCard = function RenderChartCard(_ref) {
|
|
374
|
+
var item = _ref.item,
|
|
375
|
+
index = _ref.index,
|
|
376
|
+
_ref$isPrimary = _ref.isPrimary,
|
|
377
|
+
isPrimary = _ref$isPrimary === void 0 ? false : _ref$isPrimary,
|
|
378
|
+
_ref$isPremium = _ref.isPremium,
|
|
379
|
+
isPremium = _ref$isPremium === void 0 ? false : _ref$isPremium,
|
|
380
|
+
metric = _ref.metric,
|
|
381
|
+
setMetric = _ref.setMetric,
|
|
382
|
+
_ref$md = _ref.md,
|
|
383
|
+
md = _ref$md === void 0 ? 4 : _ref$md,
|
|
384
|
+
_ref$type = _ref.type,
|
|
385
|
+
type = _ref$type === void 0 ? "area" : _ref$type;
|
|
386
|
+
return /*#__PURE__*/jsx(Grid, {
|
|
387
|
+
item: true,
|
|
388
|
+
xs: 12,
|
|
389
|
+
md: md,
|
|
390
|
+
sx: {
|
|
391
|
+
display: "flex",
|
|
392
|
+
paddingTop: "0px !important"
|
|
393
|
+
},
|
|
394
|
+
children: /*#__PURE__*/jsx(Card, {
|
|
395
|
+
sx: {
|
|
396
|
+
width: "100%",
|
|
397
|
+
display: "flex",
|
|
398
|
+
flexDirection: "column",
|
|
399
|
+
boxShadow: "0 4px 24px rgba(0,0,0,0.06)",
|
|
400
|
+
borderRadius: 4,
|
|
401
|
+
border: "1px solid #f0f0f0"
|
|
402
|
+
},
|
|
403
|
+
children: /*#__PURE__*/jsxs(CardContent, {
|
|
404
|
+
sx: {
|
|
405
|
+
p: item.exportMode ? 2 : 3,
|
|
406
|
+
flexGrow: 1,
|
|
407
|
+
display: "flex",
|
|
408
|
+
flexDirection: "column"
|
|
409
|
+
},
|
|
410
|
+
children: [/*#__PURE__*/jsxs(Box, {
|
|
411
|
+
sx: {
|
|
412
|
+
display: "flex",
|
|
413
|
+
justifyContent: "space-between",
|
|
414
|
+
alignItems: "flex-start",
|
|
415
|
+
mb: item.exportMode ? 2 : isPremium ? 3 : 2
|
|
416
|
+
},
|
|
417
|
+
children: [isPremium ? /*#__PURE__*/jsxs(Box, {
|
|
418
|
+
sx: {
|
|
419
|
+
textAlign: "left"
|
|
420
|
+
},
|
|
421
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
422
|
+
sx: {
|
|
423
|
+
color: "#000000",
|
|
424
|
+
fontWeight: 700,
|
|
425
|
+
fontSize: "18px",
|
|
426
|
+
mb: 0.2
|
|
427
|
+
},
|
|
428
|
+
children: item.label
|
|
429
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
430
|
+
variant: "caption",
|
|
431
|
+
sx: {
|
|
432
|
+
color: "rgba(0, 0, 0, 0.4)",
|
|
433
|
+
fontWeight: 400,
|
|
434
|
+
display: "block",
|
|
435
|
+
mb: 1.5
|
|
436
|
+
},
|
|
437
|
+
children: item.subtitle || "Last 30 days · daily aggregation"
|
|
438
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
439
|
+
sx: {
|
|
440
|
+
display: "flex",
|
|
441
|
+
alignItems: "center",
|
|
442
|
+
gap: 1.5
|
|
443
|
+
},
|
|
444
|
+
children: [item.value && /*#__PURE__*/jsx(Typography, {
|
|
445
|
+
sx: {
|
|
446
|
+
fontWeight: 700,
|
|
447
|
+
color: "#000000",
|
|
448
|
+
fontSize: "28px"
|
|
449
|
+
},
|
|
450
|
+
children: _typeof(item.value) === 'object' && item.value !== null ? item.value.value !== undefined ? item.value.value : JSON.stringify(item.value) : item.value
|
|
451
|
+
}), (item.trend || "18%") && /*#__PURE__*/jsxs(Box, {
|
|
452
|
+
sx: {
|
|
453
|
+
display: "flex",
|
|
454
|
+
alignItems: "center",
|
|
455
|
+
gap: 0.5,
|
|
456
|
+
bgcolor: "#8df3be9a",
|
|
457
|
+
color: "#054835ff",
|
|
458
|
+
px: 1,
|
|
459
|
+
py: 0.5,
|
|
460
|
+
borderRadius: "100px",
|
|
461
|
+
fontSize: "12px",
|
|
462
|
+
fontWeight: 600
|
|
463
|
+
},
|
|
464
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
465
|
+
children: "\u25B2"
|
|
466
|
+
}), item.trend || "18% vs last month"]
|
|
467
|
+
})]
|
|
468
|
+
})]
|
|
469
|
+
}) : /*#__PURE__*/jsxs(Box, {
|
|
470
|
+
sx: {
|
|
471
|
+
textAlign: "left"
|
|
472
|
+
},
|
|
473
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
474
|
+
variant: "subtitle2",
|
|
475
|
+
sx: {
|
|
476
|
+
color: "#000000",
|
|
477
|
+
fontWeight: 600,
|
|
478
|
+
textTransform: "uppercase",
|
|
479
|
+
letterSpacing: "0.5px",
|
|
480
|
+
mb: 0.5
|
|
481
|
+
},
|
|
482
|
+
children: item.label
|
|
483
|
+
}), item.value && /*#__PURE__*/jsx(Typography, {
|
|
484
|
+
variant: "subtitle2",
|
|
485
|
+
sx: {
|
|
486
|
+
fontWeight: 600,
|
|
487
|
+
color: "#000000",
|
|
488
|
+
mb: 0.5
|
|
489
|
+
},
|
|
490
|
+
children: _typeof(item.value) === 'object' && item.value !== null ? item.value.value !== undefined ? item.value.value : JSON.stringify(item.value) : item.value
|
|
491
|
+
}), item.subValue && /*#__PURE__*/jsx(Typography, {
|
|
492
|
+
variant: "subtitle2",
|
|
493
|
+
sx: {
|
|
494
|
+
color: "#000000",
|
|
495
|
+
fontWeight: 600
|
|
496
|
+
},
|
|
497
|
+
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
498
|
+
})]
|
|
499
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
500
|
+
sx: {
|
|
501
|
+
display: "flex",
|
|
502
|
+
gap: 1,
|
|
503
|
+
alignItems: "center"
|
|
504
|
+
},
|
|
505
|
+
children: item.hideControls ? item.series && /*#__PURE__*/jsx(Box, {
|
|
506
|
+
sx: {
|
|
507
|
+
display: item.exportMode ? "flex" : {
|
|
508
|
+
xs: "none",
|
|
509
|
+
sm: "flex"
|
|
510
|
+
},
|
|
511
|
+
gap: 2,
|
|
512
|
+
alignItems: "center"
|
|
513
|
+
},
|
|
514
|
+
children: [{
|
|
515
|
+
label: "Paid Ads",
|
|
516
|
+
color: "#6366F1"
|
|
517
|
+
}, {
|
|
518
|
+
label: "Organic",
|
|
519
|
+
color: "#10B981"
|
|
520
|
+
}, {
|
|
521
|
+
label: "Email",
|
|
522
|
+
color: "#06B6D4"
|
|
523
|
+
}].map(function (leg) {
|
|
524
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
525
|
+
sx: {
|
|
526
|
+
display: "flex",
|
|
527
|
+
alignItems: "center",
|
|
528
|
+
gap: 0.5
|
|
529
|
+
},
|
|
530
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
531
|
+
sx: {
|
|
532
|
+
width: 8,
|
|
533
|
+
height: 8,
|
|
534
|
+
borderRadius: "50%",
|
|
535
|
+
bgcolor: leg.color
|
|
536
|
+
}
|
|
537
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
538
|
+
sx: {
|
|
539
|
+
fontSize: "12px",
|
|
540
|
+
color: "rgba(0,0,0,0.6)",
|
|
541
|
+
fontWeight: 500
|
|
542
|
+
},
|
|
543
|
+
children: leg.label
|
|
544
|
+
})]
|
|
545
|
+
}, leg.label);
|
|
546
|
+
})
|
|
547
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
548
|
+
children: [item.showSelector && /*#__PURE__*/jsx(MetricSelector, {
|
|
549
|
+
metric: metric,
|
|
550
|
+
onMetricChange: setMetric,
|
|
551
|
+
options: ["Revenue", "Donations"]
|
|
552
|
+
}), /*#__PURE__*/jsx(IconButton, {
|
|
553
|
+
sx: {
|
|
554
|
+
border: "1px solid #E9E9EB",
|
|
555
|
+
borderRadius: "8px",
|
|
556
|
+
color: "#000",
|
|
557
|
+
height: "40px",
|
|
558
|
+
width: "40px",
|
|
559
|
+
"&:hover": {
|
|
560
|
+
borderColor: "primary.main",
|
|
561
|
+
bgcolor: "rgba(99, 99, 230, 0.04)"
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
children: /*#__PURE__*/jsx(MoreHoriz, {
|
|
565
|
+
sx: {
|
|
566
|
+
fontSize: "1.2rem"
|
|
567
|
+
}
|
|
568
|
+
})
|
|
569
|
+
})]
|
|
570
|
+
})
|
|
571
|
+
})]
|
|
572
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
573
|
+
sx: {
|
|
574
|
+
flexGrow: 1,
|
|
575
|
+
minHeight: isPrimary ? "250px" : "200px"
|
|
576
|
+
},
|
|
577
|
+
children: [/*#__PURE__*/jsx(RevenueChart, {
|
|
578
|
+
id: "".concat(item.label, "-").concat(index),
|
|
579
|
+
metric: item.label.includes("Rate") || item.label.includes("Performance") || item.label.includes("source") || item.label === "URL" ? "Percent" : item.stacked ? item.label.includes("Traffic") ? "Visitors" : "Donors" : metric,
|
|
580
|
+
data: item.data,
|
|
581
|
+
series: item.series,
|
|
582
|
+
categories: item.categories,
|
|
583
|
+
height: item.height || (isPrimary ? 250 : 200),
|
|
584
|
+
stacked: item.stacked,
|
|
585
|
+
type: type || item.type || "area",
|
|
586
|
+
colors: item.colors,
|
|
587
|
+
showLegend: !item.hideControls
|
|
588
|
+
}), item.hideControls && item.series && /*#__PURE__*/jsx(Box, {
|
|
589
|
+
sx: {
|
|
590
|
+
display: {
|
|
591
|
+
xs: "flex",
|
|
592
|
+
sm: "none"
|
|
593
|
+
},
|
|
594
|
+
justifyContent: "center",
|
|
595
|
+
gap: 2,
|
|
596
|
+
flexWrap: "wrap",
|
|
597
|
+
mt: 1.5
|
|
598
|
+
},
|
|
599
|
+
children: [{
|
|
600
|
+
label: "Paid Ads",
|
|
601
|
+
color: "#6366F1"
|
|
602
|
+
}, {
|
|
603
|
+
label: "Organic",
|
|
604
|
+
color: "#10B981"
|
|
605
|
+
}, {
|
|
606
|
+
label: "Email",
|
|
607
|
+
color: "#06B6D4"
|
|
608
|
+
}].map(function (leg) {
|
|
609
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
610
|
+
sx: {
|
|
611
|
+
display: "flex",
|
|
612
|
+
alignItems: "center",
|
|
613
|
+
gap: 0.5
|
|
614
|
+
},
|
|
615
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
616
|
+
sx: {
|
|
617
|
+
width: 8,
|
|
618
|
+
height: 8,
|
|
619
|
+
borderRadius: "50%",
|
|
620
|
+
bgcolor: leg.color
|
|
621
|
+
}
|
|
622
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
623
|
+
sx: {
|
|
624
|
+
fontSize: "11px",
|
|
625
|
+
color: "rgba(0,0,0,0.6)",
|
|
626
|
+
fontWeight: 500,
|
|
627
|
+
marginTop: {
|
|
628
|
+
xs: "1px",
|
|
629
|
+
sm: 0
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
children: leg.label
|
|
633
|
+
})]
|
|
634
|
+
}, leg.label);
|
|
635
|
+
})
|
|
636
|
+
})]
|
|
637
|
+
}), item.footer && /*#__PURE__*/jsxs(Box, {
|
|
638
|
+
sx: {
|
|
639
|
+
display: "flex",
|
|
640
|
+
justifyContent: "space-between",
|
|
641
|
+
mt: 2,
|
|
642
|
+
pt: 2,
|
|
643
|
+
borderTop: "1px solid #f0f0f0"
|
|
644
|
+
},
|
|
645
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
646
|
+
variant: "caption",
|
|
647
|
+
sx: {
|
|
648
|
+
color: "#606062",
|
|
649
|
+
fontWeight: 600
|
|
650
|
+
},
|
|
651
|
+
children: item.footer.left
|
|
652
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
653
|
+
variant: "caption",
|
|
654
|
+
sx: {
|
|
655
|
+
color: "#606062",
|
|
656
|
+
fontWeight: 600
|
|
657
|
+
},
|
|
658
|
+
children: item.footer.right
|
|
659
|
+
})]
|
|
660
|
+
})]
|
|
661
|
+
})
|
|
662
|
+
})
|
|
663
|
+
}, item.label + index);
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
export { RenderChartCard as default };
|
|
667
|
+
//# sourceMappingURL=RenderChartCard.es.js.map
|