@hybridcore/ui 1.5.78 → 1.5.79

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.
@@ -1,101 +1,117 @@
1
- import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
- import { TrendingUp as w, TrendingDown as v, Remove as S } from "@mui/icons-material";
3
- import { useTheme as C, Card as z, Box as o, Stack as m, Typography as c, alpha as t } from "@mui/material";
4
- const V = ({
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { TrendingUp as C, TrendingDown as S, Remove as z } from "@mui/icons-material";
3
+ import { useTheme as j, Card as R, Stack as h, Box as o, Typography as s, alpha as t } from "@mui/material";
4
+ const W = ({
5
5
  label: g,
6
- value: h,
6
+ value: u,
7
7
  change: d,
8
- changeType: u = "percentage",
9
- trend: l,
10
- icon: n,
11
- iconPosition: s = "right",
8
+ changeType: m = "percentage",
9
+ trend: c,
10
+ icon: i,
11
+ iconPosition: n = "right",
12
12
  description: p,
13
13
  variant: b = "default",
14
- sx: x
14
+ sx: f
15
15
  }) => {
16
- const e = C(), f = () => l === "up" ? /* @__PURE__ */ r(w, { sx: { fontSize: 16 } }) : l === "down" ? /* @__PURE__ */ r(v, { sx: { fontSize: 16 } }) : /* @__PURE__ */ r(S, { sx: { fontSize: 16 } }), y = () => l === "up" ? {
17
- color: e.palette.success.main,
18
- bgcolor: t(e.palette.success.main, 0.1)
19
- } : l === "down" ? {
20
- color: e.palette.error.main,
21
- bgcolor: t(e.palette.error.main, 0.1)
16
+ const r = j(), x = () => c === "up" ? /* @__PURE__ */ e(C, { sx: { fontSize: 16 } }) : c === "down" ? /* @__PURE__ */ e(S, { sx: { fontSize: 16 } }) : /* @__PURE__ */ e(z, { sx: { fontSize: 16 } }), y = () => c === "up" ? {
17
+ color: r.palette.success.main,
18
+ bgcolor: t(r.palette.success.main, 0.1)
19
+ } : c === "down" ? {
20
+ color: r.palette.error.main,
21
+ bgcolor: t(r.palette.error.main, 0.1)
22
22
  } : {
23
- color: e.palette.text.secondary,
24
- bgcolor: e.palette.action.hover
25
- };
26
- return /* @__PURE__ */ i(
27
- z,
23
+ color: r.palette.text.secondary,
24
+ bgcolor: r.palette.action.hover
25
+ }, v = () => {
26
+ const l = {
27
+ p: 3,
28
+ borderRadius: 2,
29
+ boxShadow: 1,
30
+ transition: "all 0.3s",
31
+ "&:hover": { boxShadow: 3 },
32
+ border: 1
33
+ };
34
+ switch (b) {
35
+ case "primary":
36
+ return {
37
+ ...l,
38
+ bgcolor: t(r.palette.primary.main, 0.05),
39
+ borderColor: t(r.palette.primary.main, 0.2)
40
+ };
41
+ case "success":
42
+ return {
43
+ ...l,
44
+ bgcolor: t(r.palette.success.main, 0.05),
45
+ borderColor: t(r.palette.success.main, 0.2)
46
+ };
47
+ case "warning":
48
+ return {
49
+ ...l,
50
+ bgcolor: t(r.palette.warning.main, 0.05),
51
+ borderColor: t(r.palette.warning.main, 0.2)
52
+ };
53
+ case "danger":
54
+ return {
55
+ ...l,
56
+ bgcolor: t(r.palette.error.main, 0.05),
57
+ borderColor: t(r.palette.error.main, 0.2)
58
+ };
59
+ default:
60
+ return {
61
+ ...l,
62
+ bgcolor: "background.paper",
63
+ borderColor: "divider"
64
+ };
65
+ }
66
+ }, w = () => !i || !["top-left", "top-right", "bottom-left", "bottom-right"].includes(
67
+ n
68
+ ) ? null : /* @__PURE__ */ e(
69
+ o,
28
70
  {
29
71
  sx: {
30
- ...(() => {
31
- const a = {
32
- p: 3,
33
- borderRadius: 2,
34
- boxShadow: 1,
35
- transition: "all 0.3s",
36
- "&:hover": { boxShadow: 3 },
37
- border: 1
38
- };
39
- switch (b) {
40
- case "primary":
41
- return {
42
- ...a,
43
- bgcolor: t(e.palette.primary.main, 0.05),
44
- borderColor: t(e.palette.primary.main, 0.2)
45
- };
46
- case "success":
47
- return {
48
- ...a,
49
- bgcolor: t(e.palette.success.main, 0.05),
50
- borderColor: t(e.palette.success.main, 0.2)
51
- };
52
- case "warning":
53
- return {
54
- ...a,
55
- bgcolor: t(e.palette.warning.main, 0.05),
56
- borderColor: t(e.palette.warning.main, 0.2)
57
- };
58
- case "danger":
59
- return {
60
- ...a,
61
- bgcolor: t(e.palette.error.main, 0.05),
62
- borderColor: t(e.palette.error.main, 0.2)
63
- };
64
- default:
65
- return {
66
- ...a,
67
- bgcolor: "background.paper",
68
- borderColor: "divider"
69
- };
70
- }
71
- })(),
72
+ position: "absolute",
73
+ top: n.includes("top") ? 24 : void 0,
74
+ bottom: n.includes("bottom") ? 24 : void 0,
75
+ left: n.includes("left") ? 24 : void 0,
76
+ right: n.includes("right") ? 24 : void 0,
77
+ zIndex: 1
78
+ },
79
+ children: /* @__PURE__ */ e(
80
+ o,
81
+ {
82
+ sx: {
83
+ width: 48,
84
+ height: 48,
85
+ borderRadius: "50%",
86
+ bgcolor: "action.hover",
87
+ display: "flex",
88
+ alignItems: "center",
89
+ justifyContent: "center"
90
+ },
91
+ children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
92
+ }
93
+ )
94
+ }
95
+ );
96
+ return /* @__PURE__ */ a(
97
+ R,
98
+ {
99
+ sx: {
100
+ ...v(),
72
101
  position: "relative",
73
102
  overflow: "hidden",
74
- ...x
103
+ ...f
75
104
  },
76
105
  children: [
77
- n && s === "watermark" && /* @__PURE__ */ r(
78
- o,
79
- {
80
- sx: {
81
- position: "absolute",
82
- right: -20,
83
- bottom: -20,
84
- opacity: 0.05,
85
- transform: "rotate(-15deg)",
86
- pointerEvents: "none"
87
- },
88
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 120, color: "text.primary" } })
89
- }
90
- ),
91
- /* @__PURE__ */ i(
92
- m,
106
+ w(),
107
+ /* @__PURE__ */ a(
108
+ h,
93
109
  {
94
110
  direction: "row",
95
111
  justifyContent: "space-between",
96
112
  alignItems: "flex-start",
97
113
  children: [
98
- n && s === "left" && /* @__PURE__ */ r(o, { mr: 2, children: /* @__PURE__ */ r(
114
+ i && n === "left" && /* @__PURE__ */ e(o, { mr: 2, children: /* @__PURE__ */ e(
99
115
  o,
100
116
  {
101
117
  sx: {
@@ -107,23 +123,23 @@ const V = ({
107
123
  alignItems: "center",
108
124
  justifyContent: "center"
109
125
  },
110
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 24, color: "text.secondary" } })
126
+ children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
111
127
  }
112
128
  ) }),
113
- /* @__PURE__ */ i(o, { flex: 1, children: [
114
- /* @__PURE__ */ r(c, { variant: "subtitle2", color: "text.secondary", mb: 0.5, children: g }),
115
- /* @__PURE__ */ r(
116
- c,
129
+ /* @__PURE__ */ a(o, { flex: 1, children: [
130
+ /* @__PURE__ */ e(s, { variant: "subtitle2", color: "text.secondary", mb: 0.5, children: g }),
131
+ /* @__PURE__ */ e(
132
+ s,
117
133
  {
118
134
  variant: "h4",
119
135
  fontWeight: "bold",
120
136
  color: "text.primary",
121
137
  mb: 1,
122
- children: h
138
+ children: u
123
139
  }
124
140
  ),
125
- d !== void 0 && /* @__PURE__ */ i(m, { direction: "row", alignItems: "center", spacing: 1, children: [
126
- /* @__PURE__ */ i(
141
+ d !== void 0 && /* @__PURE__ */ a(h, { direction: "row", alignItems: "center", spacing: 1, children: [
142
+ /* @__PURE__ */ a(
127
143
  o,
128
144
  {
129
145
  sx: {
@@ -138,16 +154,16 @@ const V = ({
138
154
  ...y()
139
155
  },
140
156
  children: [
141
- f(),
157
+ x(),
142
158
  d,
143
- u === "percentage" ? "%" : ""
159
+ m === "percentage" ? "%" : ""
144
160
  ]
145
161
  }
146
162
  ),
147
- p && /* @__PURE__ */ r(c, { variant: "caption", color: "text.secondary", children: p })
163
+ p && /* @__PURE__ */ e(s, { variant: "caption", color: "text.secondary", children: p })
148
164
  ] })
149
165
  ] }),
150
- n && s === "right" && /* @__PURE__ */ r(o, { ml: 2, children: /* @__PURE__ */ r(
166
+ i && n === "right" && /* @__PURE__ */ e(o, { ml: 2, children: /* @__PURE__ */ e(
151
167
  o,
152
168
  {
153
169
  sx: {
@@ -159,7 +175,7 @@ const V = ({
159
175
  alignItems: "center",
160
176
  justifyContent: "center"
161
177
  },
162
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 24, color: "text.secondary" } })
178
+ children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
163
179
  }
164
180
  ) })
165
181
  ]
@@ -170,5 +186,5 @@ const V = ({
170
186
  );
171
187
  };
172
188
  export {
173
- V as MetricCard
189
+ W as MetricCard
174
190
  };
package/dist/main.d.ts CHANGED
@@ -672,7 +672,13 @@ export declare interface MetricCardProps {
672
672
  changeType?: MetricChangeType;
673
673
  trend?: MetricTrend;
674
674
  icon?: React.ElementType;
675
- iconPosition?: "left" | "right" | "watermark";
675
+ iconPosition?:
676
+ | "left"
677
+ | "right"
678
+ | "top-left"
679
+ | "top-right"
680
+ | "bottom-left"
681
+ | "bottom-right";
676
682
  description?: string;
677
683
  variant?: MetricVariant;
678
684
  sx?: SxProps<Theme_2>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.5.78",
4
+ "version": "1.5.79",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",