@ammarkhalidfarooq/dashboard-package 0.6.0 → 0.6.2
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 +53 -1
- package/dist/MetricCard.cjs.js +73 -0
- package/dist/MetricCard.cjs.js.map +1 -0
- package/dist/MetricCard.es.js +71 -0
- package/dist/MetricCard.es.js.map +1 -0
- package/dist/index.cjs.js +76 -75
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +77 -77
- package/dist/index.es.js.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -225,6 +225,58 @@ export default App;
|
|
|
225
225
|
}
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
### MetricCard (tree-shakeable)
|
|
229
|
+
|
|
230
|
+
A compact KPI card with icon, value, and caption — used for selectable overview metrics.
|
|
231
|
+
|
|
232
|
+
```jsx
|
|
233
|
+
import MetricCard from "@ammarkhalidfarooq/dashboard-package/MetricCard";
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Or import from the main entry:
|
|
237
|
+
|
|
238
|
+
```jsx
|
|
239
|
+
import { MetricCard } from "@ammarkhalidfarooq/dashboard-package";
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Example:**
|
|
243
|
+
|
|
244
|
+
```jsx
|
|
245
|
+
import { useState } from "react";
|
|
246
|
+
import { PaidOutlined as DollarIcon } from "@mui/icons-material";
|
|
247
|
+
import MetricCard from "@ammarkhalidfarooq/dashboard-package/MetricCard";
|
|
248
|
+
|
|
249
|
+
const App = () => {
|
|
250
|
+
const [active, setActive] = useState("Total Raised");
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<MetricCard
|
|
254
|
+
title="Total Raised"
|
|
255
|
+
value="$124,500"
|
|
256
|
+
caption="12.4% vs last month"
|
|
257
|
+
icon={<DollarIcon />}
|
|
258
|
+
active={active === "Total Raised"}
|
|
259
|
+
onClick={() => setActive("Total Raised")}
|
|
260
|
+
/>
|
|
261
|
+
);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export default App;
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Props:**
|
|
268
|
+
|
|
269
|
+
| Prop | Type | Default | Description |
|
|
270
|
+
|------|------|---------|-------------|
|
|
271
|
+
| `title` | `string` | — | Card label |
|
|
272
|
+
| `value` | `string` | — | Main metric value |
|
|
273
|
+
| `caption` | `string` | — | Subtitle / trend text below the value |
|
|
274
|
+
| `icon` | `ReactNode` | — | Icon shown in the top-right avatar |
|
|
275
|
+
| `active` | `boolean` | `false` | Highlights the card as selected |
|
|
276
|
+
| `warning` | `boolean` | `false` | Warning border and icon styling |
|
|
277
|
+
| `error` | `boolean` | `false` | Error border and caption styling |
|
|
278
|
+
| `onClick` | `function` | — | Click handler (e.g. select metric) |
|
|
279
|
+
|
|
228
280
|
## Development
|
|
229
281
|
|
|
230
282
|
To preview the component locally:
|
|
@@ -239,4 +291,4 @@ To build the package:
|
|
|
239
291
|
npm run build
|
|
240
292
|
```
|
|
241
293
|
|
|
242
|
-
The build outputs ESM and CommonJS bundles in the `dist` folder, including separate `RenderChartCard` and `
|
|
294
|
+
The build outputs ESM and CommonJS bundles in the `dist` folder, including separate `RenderChartCard`, `ActiveCampaignsCard`, and `MetricCard` bundles for tree-shaking.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var material = require('@mui/material');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
var MetricCard = function MetricCard(_ref) {
|
|
7
|
+
var title = _ref.title,
|
|
8
|
+
value = _ref.value,
|
|
9
|
+
caption = _ref.caption,
|
|
10
|
+
icon = _ref.icon,
|
|
11
|
+
active = _ref.active,
|
|
12
|
+
warning = _ref.warning,
|
|
13
|
+
error = _ref.error,
|
|
14
|
+
onClick = _ref.onClick;
|
|
15
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
16
|
+
sx: {
|
|
17
|
+
bgcolor: "#fff",
|
|
18
|
+
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
19
|
+
borderRadius: "16px",
|
|
20
|
+
p: {
|
|
21
|
+
xs: 1.75,
|
|
22
|
+
md: 2
|
|
23
|
+
},
|
|
24
|
+
paddingTop: "10px !important",
|
|
25
|
+
paddingBottom: "10px !important",
|
|
26
|
+
height: 92,
|
|
27
|
+
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
28
|
+
},
|
|
29
|
+
onClick: onClick,
|
|
30
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
|
|
31
|
+
direction: "row",
|
|
32
|
+
justifyContent: "space-between",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
35
|
+
sx: {
|
|
36
|
+
color: active ? "#818CF8" : "#999EAA",
|
|
37
|
+
fontSize: 13,
|
|
38
|
+
fontWeight: 500,
|
|
39
|
+
letterSpacing: 0
|
|
40
|
+
},
|
|
41
|
+
children: title
|
|
42
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
|
|
43
|
+
sx: {
|
|
44
|
+
width: 30,
|
|
45
|
+
height: 30,
|
|
46
|
+
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
47
|
+
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
48
|
+
},
|
|
49
|
+
children: icon
|
|
50
|
+
})]
|
|
51
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
52
|
+
sx: {
|
|
53
|
+
// mt: 0.3,
|
|
54
|
+
fontSize: 22,
|
|
55
|
+
fontWeight: 700,
|
|
56
|
+
color: active ? "#4F46E5" : "#050509",
|
|
57
|
+
lineHeight: 1.15
|
|
58
|
+
},
|
|
59
|
+
children: value
|
|
60
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
61
|
+
sx: {
|
|
62
|
+
// mt: 1.05,
|
|
63
|
+
fontSize: 12,
|
|
64
|
+
fontWeight: 500,
|
|
65
|
+
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
66
|
+
},
|
|
67
|
+
children: caption
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
module.exports = MetricCard;
|
|
73
|
+
//# sourceMappingURL=MetricCard.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricCard.cjs.js","sources":["../src/components/advanced/MetricCard/index.jsx"],"sourcesContent":["import { Avatar, Box, Stack, Typography } from \"@mui/material\";\r\n\r\n\r\nconst MetricCard = ({\r\n title,\r\n value,\r\n caption,\r\n icon,\r\n active,\r\n warning,\r\n error,\r\n onClick\r\n}) => (\r\n <Box\r\n sx={{\r\n bgcolor: \"#fff\",\r\n border: `1.5px solid ${active ? \"#4F46E5\" : warning ? \"#F3B33D\" : error ? \"#ef4444\" : \"#F1F1F5\"}`,\r\n borderRadius: \"16px\",\r\n p: { xs: 1.75, md: 2 },\r\n paddingTop: \"10px !important\", paddingBottom: \"10px !important\",\r\n height: 92,\r\n boxShadow: \"0 14px 30px rgba(21, 26, 45, 0.06)\",\r\n }}\r\n onClick={onClick}\r\n >\r\n <Stack\r\n direction=\"row\"\r\n justifyContent=\"space-between\"\r\n alignItems=\"center\"\r\n >\r\n <Typography\r\n sx={{\r\n color: active ? \"#818CF8\" : \"#999EAA\",\r\n fontSize: 13,\r\n fontWeight: 500,\r\n letterSpacing: 0,\r\n }}\r\n >\r\n {title}\r\n </Typography>\r\n <Avatar\r\n sx={{\r\n width: 30,\r\n height: 30,\r\n bgcolor: warning ? \"#FFF3CF\" : error ? \"#fee2e2\" : \"#EEF2FF\",\r\n color: warning ? \"#B45309\" : error ? \"#ef4444\" : \"#4F46E5\",\r\n }}\r\n >\r\n {icon}\r\n </Avatar>\r\n </Stack>\r\n <Typography\r\n sx={{\r\n // mt: 0.3,\r\n fontSize: 22,\r\n fontWeight: 700,\r\n color: active ? \"#4F46E5\" : \"#050509\",\r\n lineHeight: 1.15,\r\n }}\r\n >\r\n {value}\r\n </Typography>\r\n <Typography\r\n sx={{\r\n // mt: 1.05,\r\n fontSize: 12,\r\n fontWeight: 500,\r\n color: caption.includes(\"failed\")\r\n ? \"#4F46E5\"\r\n : error\r\n ? \"#ef4444\"\r\n : \"#0B8F61\",\r\n }}\r\n >\r\n {caption}\r\n </Typography>\r\n </Box>\r\n);\r\n\r\nexport default MetricCard;\r\n"],"names":["MetricCard","_ref","title","value","caption","icon","active","warning","error","onClick","_jsxs","Box","sx","bgcolor","border","concat","borderRadius","p","xs","md","paddingTop","paddingBottom","height","boxShadow","children","Stack","direction","justifyContent","alignItems","_jsx","Typography","color","fontSize","fontWeight","letterSpacing","Avatar","width","lineHeight","includes"],"mappings":";;;;;AAGA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAAA;AAAA,EAAA,IACdC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,KAAK,GAAAP,IAAA,CAALO,KAAK;IACLC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;EAAA,oBAEPC,eAAA,CAACC,YAAG,EAAA;AACFC,IAAAA,EAAE,EAAE;AACFC,MAAAA,OAAO,EAAE,MAAM;AACfC,MAAAA,MAAM,iBAAAC,MAAA,CAAiBT,MAAM,GAAG,SAAS,GAAGC,OAAO,GAAG,SAAS,GAAGC,KAAK,GAAG,SAAS,GAAG,SAAS,CAAE;AAC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S,GAAG,SAAS;AACrC+B,QAAAA,UAAU,EAAE;OACZ;AAAAb,MAAAA,QAAA,EAEDrB;AAAK,KACI,CAAC,eACb0B,cAAA,CAACC,mBAAU,EAAA;AACTlB,MAAAA,EAAE,EAAE;AACF;AACAoB,QAAAA,QAAQ,EAAE,EAAE;AACZC,QAAAA,UAAU,EAAE,GAAG;AACfF,QAAAA,KAAK,EAAE3B,OAAO,CAACkC,QAAQ,CAAC,QAAQ,CAAC,GAC7B,SAAS,GACT9B,KAAK,GACH,SAAS,GACT;OACN;AAAAgB,MAAAA,QAAA,EAEDpB;AAAO,KACE,CAAC;AAAA,GACV,CAAC;AAAA;;;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Box, Stack, Typography, Avatar } from '@mui/material';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var MetricCard = function MetricCard(_ref) {
|
|
5
|
+
var title = _ref.title,
|
|
6
|
+
value = _ref.value,
|
|
7
|
+
caption = _ref.caption,
|
|
8
|
+
icon = _ref.icon,
|
|
9
|
+
active = _ref.active,
|
|
10
|
+
warning = _ref.warning,
|
|
11
|
+
error = _ref.error,
|
|
12
|
+
onClick = _ref.onClick;
|
|
13
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
14
|
+
sx: {
|
|
15
|
+
bgcolor: "#fff",
|
|
16
|
+
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
17
|
+
borderRadius: "16px",
|
|
18
|
+
p: {
|
|
19
|
+
xs: 1.75,
|
|
20
|
+
md: 2
|
|
21
|
+
},
|
|
22
|
+
paddingTop: "10px !important",
|
|
23
|
+
paddingBottom: "10px !important",
|
|
24
|
+
height: 92,
|
|
25
|
+
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
26
|
+
},
|
|
27
|
+
onClick: onClick,
|
|
28
|
+
children: [/*#__PURE__*/jsxs(Stack, {
|
|
29
|
+
direction: "row",
|
|
30
|
+
justifyContent: "space-between",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
33
|
+
sx: {
|
|
34
|
+
color: active ? "#818CF8" : "#999EAA",
|
|
35
|
+
fontSize: 13,
|
|
36
|
+
fontWeight: 500,
|
|
37
|
+
letterSpacing: 0
|
|
38
|
+
},
|
|
39
|
+
children: title
|
|
40
|
+
}), /*#__PURE__*/jsx(Avatar, {
|
|
41
|
+
sx: {
|
|
42
|
+
width: 30,
|
|
43
|
+
height: 30,
|
|
44
|
+
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
45
|
+
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
46
|
+
},
|
|
47
|
+
children: icon
|
|
48
|
+
})]
|
|
49
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
50
|
+
sx: {
|
|
51
|
+
// mt: 0.3,
|
|
52
|
+
fontSize: 22,
|
|
53
|
+
fontWeight: 700,
|
|
54
|
+
color: active ? "#4F46E5" : "#050509",
|
|
55
|
+
lineHeight: 1.15
|
|
56
|
+
},
|
|
57
|
+
children: value
|
|
58
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
59
|
+
sx: {
|
|
60
|
+
// mt: 1.05,
|
|
61
|
+
fontSize: 12,
|
|
62
|
+
fontWeight: 500,
|
|
63
|
+
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
64
|
+
},
|
|
65
|
+
children: caption
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { MetricCard as default };
|
|
71
|
+
//# sourceMappingURL=MetricCard.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricCard.es.js","sources":["../src/components/advanced/MetricCard/index.jsx"],"sourcesContent":["import { Avatar, Box, Stack, Typography } from \"@mui/material\";\r\n\r\n\r\nconst MetricCard = ({\r\n title,\r\n value,\r\n caption,\r\n icon,\r\n active,\r\n warning,\r\n error,\r\n onClick\r\n}) => (\r\n <Box\r\n sx={{\r\n bgcolor: \"#fff\",\r\n border: `1.5px solid ${active ? \"#4F46E5\" : warning ? \"#F3B33D\" : error ? \"#ef4444\" : \"#F1F1F5\"}`,\r\n borderRadius: \"16px\",\r\n p: { xs: 1.75, md: 2 },\r\n paddingTop: \"10px !important\", paddingBottom: \"10px !important\",\r\n height: 92,\r\n boxShadow: \"0 14px 30px rgba(21, 26, 45, 0.06)\",\r\n }}\r\n onClick={onClick}\r\n >\r\n <Stack\r\n direction=\"row\"\r\n justifyContent=\"space-between\"\r\n alignItems=\"center\"\r\n >\r\n <Typography\r\n sx={{\r\n color: active ? \"#818CF8\" : \"#999EAA\",\r\n fontSize: 13,\r\n fontWeight: 500,\r\n letterSpacing: 0,\r\n }}\r\n >\r\n {title}\r\n </Typography>\r\n <Avatar\r\n sx={{\r\n width: 30,\r\n height: 30,\r\n bgcolor: warning ? \"#FFF3CF\" : error ? \"#fee2e2\" : \"#EEF2FF\",\r\n color: warning ? \"#B45309\" : error ? \"#ef4444\" : \"#4F46E5\",\r\n }}\r\n >\r\n {icon}\r\n </Avatar>\r\n </Stack>\r\n <Typography\r\n sx={{\r\n // mt: 0.3,\r\n fontSize: 22,\r\n fontWeight: 700,\r\n color: active ? \"#4F46E5\" : \"#050509\",\r\n lineHeight: 1.15,\r\n }}\r\n >\r\n {value}\r\n </Typography>\r\n <Typography\r\n sx={{\r\n // mt: 1.05,\r\n fontSize: 12,\r\n fontWeight: 500,\r\n color: caption.includes(\"failed\")\r\n ? \"#4F46E5\"\r\n : error\r\n ? \"#ef4444\"\r\n : \"#0B8F61\",\r\n }}\r\n >\r\n {caption}\r\n </Typography>\r\n </Box>\r\n);\r\n\r\nexport default MetricCard;\r\n"],"names":["MetricCard","_ref","title","value","caption","icon","active","warning","error","onClick","_jsxs","Box","sx","bgcolor","border","concat","borderRadius","p","xs","md","paddingTop","paddingBottom","height","boxShadow","children","Stack","direction","justifyContent","alignItems","_jsx","Typography","color","fontSize","fontWeight","letterSpacing","Avatar","width","lineHeight","includes"],"mappings":";;;AAGA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAAA;AAAA,EAAA,IACdC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IACJC,MAAM,GAAAL,IAAA,CAANK,MAAM;IACNC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,KAAK,GAAAP,IAAA,CAALO,KAAK;IACLC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;EAAA,oBAEPC,IAAA,CAACC,GAAG,EAAA;AACFC,IAAAA,EAAE,EAAE;AACFC,MAAAA,OAAO,EAAE,MAAM;AACfC,MAAAA,MAAM,iBAAAC,MAAA,CAAiBT,MAAM,GAAG,SAAS,GAAGC,OAAO,GAAG,SAAS,GAAGC,KAAK,GAAG,SAAS,GAAG,SAAS,CAAE;AACjGQ,MAAAA,YAAY,EAAE,MAAM;AACpBC,MAAAA,CAAC,EAAE;AAAEC,QAAAA,EAAE,EAAE,IAAI;AAAEC,QAAAA,EAAE,EAAE;OAAG;AACtBC,MAAAA,UAAU,EAAE,iBAAiB;AAAEC,MAAAA,aAAa,EAAE,iBAAiB;AAC/DC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,SAAS,EAAE;KACX;AACFd,IAAAA,OAAO,EAAEA,OAAQ;IAAAe,QAAA,EAAA,cAEjBd,IAAA,CAACe,KAAK,EAAA;AACJC,MAAAA,SAAS,EAAC,KAAK;AACfC,MAAAA,cAAc,EAAC,eAAe;AAC9BC,MAAAA,UAAU,EAAC,QAAQ;MAAAJ,QAAA,EAAA,cAEnBK,GAAA,CAACC,UAAU,EAAA;A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ref) {
|
|
|
1150
1150
|
});
|
|
1151
1151
|
};
|
|
1152
1152
|
|
|
1153
|
+
var MetricCard$1 = function MetricCard(_ref) {
|
|
1154
|
+
var title = _ref.title,
|
|
1155
|
+
value = _ref.value,
|
|
1156
|
+
caption = _ref.caption,
|
|
1157
|
+
icon = _ref.icon,
|
|
1158
|
+
active = _ref.active,
|
|
1159
|
+
warning = _ref.warning,
|
|
1160
|
+
error = _ref.error,
|
|
1161
|
+
onClick = _ref.onClick;
|
|
1162
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
1163
|
+
sx: {
|
|
1164
|
+
bgcolor: "#fff",
|
|
1165
|
+
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
1166
|
+
borderRadius: "16px",
|
|
1167
|
+
p: {
|
|
1168
|
+
xs: 1.75,
|
|
1169
|
+
md: 2
|
|
1170
|
+
},
|
|
1171
|
+
paddingTop: "10px !important",
|
|
1172
|
+
paddingBottom: "10px !important",
|
|
1173
|
+
height: 92,
|
|
1174
|
+
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
1175
|
+
},
|
|
1176
|
+
onClick: onClick,
|
|
1177
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
|
|
1178
|
+
direction: "row",
|
|
1179
|
+
justifyContent: "space-between",
|
|
1180
|
+
alignItems: "center",
|
|
1181
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1182
|
+
sx: {
|
|
1183
|
+
color: active ? "#818CF8" : "#999EAA",
|
|
1184
|
+
fontSize: 13,
|
|
1185
|
+
fontWeight: 500,
|
|
1186
|
+
letterSpacing: 0
|
|
1187
|
+
},
|
|
1188
|
+
children: title
|
|
1189
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
|
|
1190
|
+
sx: {
|
|
1191
|
+
width: 30,
|
|
1192
|
+
height: 30,
|
|
1193
|
+
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
1194
|
+
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
1195
|
+
},
|
|
1196
|
+
children: icon
|
|
1197
|
+
})]
|
|
1198
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1199
|
+
sx: {
|
|
1200
|
+
// mt: 0.3,
|
|
1201
|
+
fontSize: 22,
|
|
1202
|
+
fontWeight: 700,
|
|
1203
|
+
color: active ? "#4F46E5" : "#050509",
|
|
1204
|
+
lineHeight: 1.15
|
|
1205
|
+
},
|
|
1206
|
+
children: value
|
|
1207
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
1208
|
+
sx: {
|
|
1209
|
+
// mt: 1.05,
|
|
1210
|
+
fontSize: 12,
|
|
1211
|
+
fontWeight: 500,
|
|
1212
|
+
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
1213
|
+
},
|
|
1214
|
+
children: caption
|
|
1215
|
+
})]
|
|
1216
|
+
});
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1153
1219
|
function formatNumber(num) {
|
|
1154
1220
|
if (num >= 1000000000) {
|
|
1155
1221
|
return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
|
|
@@ -1549,7 +1615,7 @@ var TrendPill = function TrendPill(_ref) {
|
|
|
1549
1615
|
children: value
|
|
1550
1616
|
});
|
|
1551
1617
|
};
|
|
1552
|
-
var MetricCard
|
|
1618
|
+
var MetricCard = function MetricCard(_ref2) {
|
|
1553
1619
|
var title = _ref2.title,
|
|
1554
1620
|
value = _ref2.value,
|
|
1555
1621
|
trend = _ref2.trend,
|
|
@@ -1673,7 +1739,7 @@ var ReportKpiSection = function ReportKpiSection(_ref3) {
|
|
|
1673
1739
|
gap: exportMode ? 1 : 2
|
|
1674
1740
|
},
|
|
1675
1741
|
children: metrics.map(function (m) {
|
|
1676
|
-
return /*#__PURE__*/jsxRuntime.jsx(MetricCard
|
|
1742
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard, _objectSpread2(_objectSpread2({}, m), {}, {
|
|
1677
1743
|
exportMode: exportMode
|
|
1678
1744
|
}), m.title);
|
|
1679
1745
|
})
|
|
@@ -4146,7 +4212,7 @@ var fourColGridSx = function fourColGridSx(exportMode) {
|
|
|
4146
4212
|
gridTemplateColumns: exportMode ? "repeat(4, 1fr)" : {
|
|
4147
4213
|
xs: "1fr",
|
|
4148
4214
|
sm: "repeat(2, 1fr)",
|
|
4149
|
-
md: "repeat(
|
|
4215
|
+
md: "repeat(2, 1fr)",
|
|
4150
4216
|
xl: "repeat(4, 1fr)"
|
|
4151
4217
|
},
|
|
4152
4218
|
gap: GRID_GAP,
|
|
@@ -14435,72 +14501,6 @@ var html2canvas_esm = /*#__PURE__*/Object.freeze({
|
|
|
14435
14501
|
default: html2canvas
|
|
14436
14502
|
});
|
|
14437
14503
|
|
|
14438
|
-
var MetricCard = function MetricCard(_ref) {
|
|
14439
|
-
var title = _ref.title,
|
|
14440
|
-
value = _ref.value,
|
|
14441
|
-
caption = _ref.caption,
|
|
14442
|
-
icon = _ref.icon,
|
|
14443
|
-
active = _ref.active,
|
|
14444
|
-
warning = _ref.warning,
|
|
14445
|
-
error = _ref.error,
|
|
14446
|
-
onClick = _ref.onClick;
|
|
14447
|
-
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
14448
|
-
sx: {
|
|
14449
|
-
bgcolor: "#fff",
|
|
14450
|
-
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
14451
|
-
borderRadius: "16px",
|
|
14452
|
-
p: {
|
|
14453
|
-
xs: 1.75,
|
|
14454
|
-
md: 2
|
|
14455
|
-
},
|
|
14456
|
-
paddingTop: "10px !important",
|
|
14457
|
-
paddingBottom: "10px !important",
|
|
14458
|
-
height: 92,
|
|
14459
|
-
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
14460
|
-
},
|
|
14461
|
-
onClick: onClick,
|
|
14462
|
-
children: [/*#__PURE__*/jsxRuntime.jsxs(material.Stack, {
|
|
14463
|
-
direction: "row",
|
|
14464
|
-
justifyContent: "space-between",
|
|
14465
|
-
alignItems: "center",
|
|
14466
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
14467
|
-
sx: {
|
|
14468
|
-
color: active ? "#818CF8" : "#999EAA",
|
|
14469
|
-
fontSize: 13,
|
|
14470
|
-
fontWeight: 500,
|
|
14471
|
-
letterSpacing: 0
|
|
14472
|
-
},
|
|
14473
|
-
children: title
|
|
14474
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Avatar, {
|
|
14475
|
-
sx: {
|
|
14476
|
-
width: 30,
|
|
14477
|
-
height: 30,
|
|
14478
|
-
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
14479
|
-
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
14480
|
-
},
|
|
14481
|
-
children: icon
|
|
14482
|
-
})]
|
|
14483
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
14484
|
-
sx: {
|
|
14485
|
-
// mt: 0.3,
|
|
14486
|
-
fontSize: 22,
|
|
14487
|
-
fontWeight: 700,
|
|
14488
|
-
color: active ? "#4F46E5" : "#050509",
|
|
14489
|
-
lineHeight: 1.15
|
|
14490
|
-
},
|
|
14491
|
-
children: value
|
|
14492
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
14493
|
-
sx: {
|
|
14494
|
-
// mt: 1.05,
|
|
14495
|
-
fontSize: 12,
|
|
14496
|
-
fontWeight: 500,
|
|
14497
|
-
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
14498
|
-
},
|
|
14499
|
-
children: caption
|
|
14500
|
-
})]
|
|
14501
|
-
});
|
|
14502
|
-
};
|
|
14503
|
-
|
|
14504
14504
|
var OverallSection = function OverallSection(_ref) {
|
|
14505
14505
|
var _apiData$overviewStat, _apiData$overviewStat2, _apiData$overviewStat3, _apiData$overviewStat4, _apiData$overviewStat5, _apiData$overviewStat6, _apiData$overviewStat7, _apiData$overviewStat8, _apiData$overviewStat9, _apiData$overviewStat0, _apiData$overviewStat1, _apiData$overviewStat10, _apiData$roasCard, _apiData$roasCardPrev, _apiData$overviewStat11, _apiData$overviewStat12, _apiData$overviewStat13;
|
|
14506
14506
|
var _ref$apiData = _ref.apiData,
|
|
@@ -14543,7 +14543,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
14543
14543
|
})) {
|
|
14544
14544
|
charts.push({
|
|
14545
14545
|
label: "Total Donors",
|
|
14546
|
-
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "
|
|
14546
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "0",
|
|
14547
14547
|
data: (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28],
|
|
14548
14548
|
categories: categories
|
|
14549
14549
|
});
|
|
@@ -14580,7 +14580,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
14580
14580
|
warning: false
|
|
14581
14581
|
},
|
|
14582
14582
|
"Total Donors": {
|
|
14583
|
-
value: (apiData === null || apiData === void 0 || (_apiData$overviewStat7 = apiData.overviewStats) === null || _apiData$overviewStat7 === void 0 || (_apiData$overviewStat7 = _apiData$overviewStat7.overview) === null || _apiData$overviewStat7 === void 0 ? void 0 : _apiData$overviewStat7.totalDonations) || "
|
|
14583
|
+
value: (apiData === null || apiData === void 0 || (_apiData$overviewStat7 = apiData.overviewStats) === null || _apiData$overviewStat7 === void 0 || (_apiData$overviewStat7 = _apiData$overviewStat7.overview) === null || _apiData$overviewStat7 === void 0 ? void 0 : _apiData$overviewStat7.totalDonations) || "0",
|
|
14584
14584
|
subValue: "".concat(Number((_apiData$overviewStat8 = apiData === null || apiData === void 0 || (_apiData$overviewStat9 = apiData.overviewStats) === null || _apiData$overviewStat9 === void 0 || (_apiData$overviewStat9 = _apiData$overviewStat9.overview.growthPercentage) === null || _apiData$overviewStat9 === void 0 ? void 0 : _apiData$overviewStat9.totalDonations) !== null && _apiData$overviewStat8 !== void 0 ? _apiData$overviewStat8 : 0).toFixed(2), "%") || "0 new",
|
|
14585
14585
|
label: "Total Donors",
|
|
14586
14586
|
icon: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.PeopleAltOutlined, {}),
|
|
@@ -14651,7 +14651,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
14651
14651
|
}
|
|
14652
14652
|
console.log("DONOR MIX", donorMix);
|
|
14653
14653
|
var renderCard = function renderCard(title) {
|
|
14654
|
-
return /*#__PURE__*/jsxRuntime.jsx(MetricCard
|
|
14654
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1
|
|
14655
14655
|
// key={title}
|
|
14656
14656
|
, {
|
|
14657
14657
|
title: title,
|
|
@@ -15113,7 +15113,7 @@ var PaidSection = function PaidSection() {
|
|
|
15113
15113
|
}
|
|
15114
15114
|
};
|
|
15115
15115
|
var renderCard = function renderCard(title) {
|
|
15116
|
-
return /*#__PURE__*/jsxRuntime.jsx(MetricCard
|
|
15116
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1
|
|
15117
15117
|
// key={title}
|
|
15118
15118
|
, {
|
|
15119
15119
|
title: title,
|
|
@@ -15612,7 +15612,7 @@ var OrganicSection = function OrganicSection(_ref) {
|
|
|
15612
15612
|
};
|
|
15613
15613
|
}, [apiData === null || apiData === void 0 ? void 0 : apiData.sourceBreakdown, hasOrganicOverview]);
|
|
15614
15614
|
var renderCard = function renderCard(title) {
|
|
15615
|
-
return /*#__PURE__*/jsxRuntime.jsx(MetricCard, {
|
|
15615
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1, {
|
|
15616
15616
|
title: title,
|
|
15617
15617
|
value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
|
|
15618
15618
|
caption: metricInfo[title].subValue,
|
|
@@ -16301,7 +16301,7 @@ var EmailSection = function EmailSection(_ref) {
|
|
|
16301
16301
|
});
|
|
16302
16302
|
}, [apiData === null || apiData === void 0 ? void 0 : apiData.topCampaignsByConversion, hasEmailOverview]);
|
|
16303
16303
|
var renderCard = function renderCard(title) {
|
|
16304
|
-
return /*#__PURE__*/jsxRuntime.jsx(MetricCard, {
|
|
16304
|
+
return /*#__PURE__*/jsxRuntime.jsx(MetricCard$1, {
|
|
16305
16305
|
title: title,
|
|
16306
16306
|
value: metricInfo[title].value,
|
|
16307
16307
|
caption: metricInfo[title].subValue,
|
|
@@ -16490,6 +16490,7 @@ exports.Dashboard = Dashboard;
|
|
|
16490
16490
|
exports.DashboardReport = DashboardReport;
|
|
16491
16491
|
exports.DashboardTheme = theme;
|
|
16492
16492
|
exports.DonorBehavior = DonorBehavior;
|
|
16493
|
+
exports.MetricCard = MetricCard$1;
|
|
16493
16494
|
exports.MetricSelector = MetricSelector;
|
|
16494
16495
|
exports.NewOverview = NewOverview;
|
|
16495
16496
|
exports.PerformanceSection = PerformanceSection;
|