@hybridcore/ui 1.5.77 → 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,97 +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
- className: 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,
28
- {
29
- sx: { ...(() => {
30
- const a = {
31
- p: 3,
32
- borderRadius: 2,
33
- boxShadow: 1,
34
- transition: "all 0.3s",
35
- "&:hover": { boxShadow: 3 },
36
- border: 1
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)
37
52
  };
38
- switch (b) {
39
- case "primary":
40
- return {
41
- ...a,
42
- bgcolor: t(e.palette.primary.main, 0.05),
43
- borderColor: t(e.palette.primary.main, 0.2)
44
- };
45
- case "success":
46
- return {
47
- ...a,
48
- bgcolor: t(e.palette.success.main, 0.05),
49
- borderColor: t(e.palette.success.main, 0.2)
50
- };
51
- case "warning":
52
- return {
53
- ...a,
54
- bgcolor: t(e.palette.warning.main, 0.05),
55
- borderColor: t(e.palette.warning.main, 0.2)
56
- };
57
- case "danger":
58
- return {
59
- ...a,
60
- bgcolor: t(e.palette.error.main, 0.05),
61
- borderColor: t(e.palette.error.main, 0.2)
62
- };
63
- default:
64
- return {
65
- ...a,
66
- bgcolor: "background.paper",
67
- borderColor: "divider"
68
- };
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,
70
+ {
71
+ sx: {
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" } })
69
92
  }
70
- })(), position: "relative", overflow: "hidden" },
71
- className: x,
93
+ )
94
+ }
95
+ );
96
+ return /* @__PURE__ */ a(
97
+ R,
98
+ {
99
+ sx: {
100
+ ...v(),
101
+ position: "relative",
102
+ overflow: "hidden",
103
+ ...f
104
+ },
72
105
  children: [
73
- n && s === "watermark" && /* @__PURE__ */ r(
74
- o,
75
- {
76
- sx: {
77
- position: "absolute",
78
- right: -20,
79
- bottom: -20,
80
- opacity: 0.05,
81
- transform: "rotate(-15deg)",
82
- pointerEvents: "none"
83
- },
84
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 120, color: "text.primary" } })
85
- }
86
- ),
87
- /* @__PURE__ */ i(
88
- m,
106
+ w(),
107
+ /* @__PURE__ */ a(
108
+ h,
89
109
  {
90
110
  direction: "row",
91
111
  justifyContent: "space-between",
92
112
  alignItems: "flex-start",
93
113
  children: [
94
- n && s === "left" && /* @__PURE__ */ r(o, { mr: 2, children: /* @__PURE__ */ r(
114
+ i && n === "left" && /* @__PURE__ */ e(o, { mr: 2, children: /* @__PURE__ */ e(
95
115
  o,
96
116
  {
97
117
  sx: {
@@ -103,23 +123,23 @@ const V = ({
103
123
  alignItems: "center",
104
124
  justifyContent: "center"
105
125
  },
106
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 24, color: "text.secondary" } })
126
+ children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
107
127
  }
108
128
  ) }),
109
- /* @__PURE__ */ i(o, { flex: 1, children: [
110
- /* @__PURE__ */ r(c, { variant: "subtitle2", color: "text.secondary", mb: 0.5, children: g }),
111
- /* @__PURE__ */ r(
112
- 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,
113
133
  {
114
134
  variant: "h4",
115
135
  fontWeight: "bold",
116
136
  color: "text.primary",
117
137
  mb: 1,
118
- children: h
138
+ children: u
119
139
  }
120
140
  ),
121
- d !== void 0 && /* @__PURE__ */ i(m, { direction: "row", alignItems: "center", spacing: 1, children: [
122
- /* @__PURE__ */ i(
141
+ d !== void 0 && /* @__PURE__ */ a(h, { direction: "row", alignItems: "center", spacing: 1, children: [
142
+ /* @__PURE__ */ a(
123
143
  o,
124
144
  {
125
145
  sx: {
@@ -134,16 +154,16 @@ const V = ({
134
154
  ...y()
135
155
  },
136
156
  children: [
137
- f(),
157
+ x(),
138
158
  d,
139
- u === "percentage" ? "%" : ""
159
+ m === "percentage" ? "%" : ""
140
160
  ]
141
161
  }
142
162
  ),
143
- p && /* @__PURE__ */ r(c, { variant: "caption", color: "text.secondary", children: p })
163
+ p && /* @__PURE__ */ e(s, { variant: "caption", color: "text.secondary", children: p })
144
164
  ] })
145
165
  ] }),
146
- n && s === "right" && /* @__PURE__ */ r(o, { ml: 2, children: /* @__PURE__ */ r(
166
+ i && n === "right" && /* @__PURE__ */ e(o, { ml: 2, children: /* @__PURE__ */ e(
147
167
  o,
148
168
  {
149
169
  sx: {
@@ -155,7 +175,7 @@ const V = ({
155
175
  alignItems: "center",
156
176
  justifyContent: "center"
157
177
  },
158
- children: /* @__PURE__ */ r(n, { sx: { fontSize: 24, color: "text.secondary" } })
178
+ children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
159
179
  }
160
180
  ) })
161
181
  ]
@@ -166,5 +186,5 @@ const V = ({
166
186
  );
167
187
  };
168
188
  export {
169
- V as MetricCard
189
+ W as MetricCard
170
190
  };
package/dist/main.d.ts CHANGED
@@ -663,7 +663,7 @@ export declare namespace Map_2 {
663
663
  }
664
664
  }
665
665
 
666
- export declare const MetricCard: ({ label, value, change, changeType, trend, icon: Icon, iconPosition, description, variant, className, }: MetricCardProps) => JSX_2.Element;
666
+ export declare const MetricCard: ({ label, value, change, changeType, trend, icon: Icon, iconPosition, description, variant, sx, }: MetricCardProps) => JSX_2.Element;
667
667
 
668
668
  export declare interface MetricCardProps {
669
669
  label: string;
@@ -672,10 +672,16 @@ 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
- className?: string;
684
+ sx?: SxProps<Theme_2>;
679
685
  }
680
686
 
681
687
  export declare type MetricChangeType = "percentage" | "absolute";
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.77",
4
+ "version": "1.5.79",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",