@rozaqi02/reusable-dashboard 1.0.0 → 1.0.1
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 +31 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,28 +16,32 @@ var cidikaWidgetConfig = {
|
|
|
16
16
|
label: "confirmedBookings",
|
|
17
17
|
icon: "TrendingUp",
|
|
18
18
|
valueKey: "bookingsConfirm",
|
|
19
|
-
format: "number"
|
|
19
|
+
format: "number",
|
|
20
|
+
accentColor: "blue"
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
id: "revenueConfirm",
|
|
23
24
|
label: "confirmedRevenue",
|
|
24
25
|
icon: "DollarSign",
|
|
25
26
|
valueKey: "revenueConfirm",
|
|
26
|
-
format: "currency"
|
|
27
|
+
format: "currency",
|
|
28
|
+
accentColor: "green"
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
31
|
id: "avgRevenue",
|
|
30
32
|
label: "avgRevenue",
|
|
31
33
|
icon: "Users",
|
|
32
34
|
valueKey: "avgRevenue",
|
|
33
|
-
format: "currency"
|
|
35
|
+
format: "currency",
|
|
36
|
+
accentColor: "violet"
|
|
34
37
|
},
|
|
35
38
|
{
|
|
36
39
|
id: "conversionRate",
|
|
37
40
|
label: "conversionRate",
|
|
38
41
|
icon: "PieChart",
|
|
39
42
|
valueKey: "conversionRate",
|
|
40
|
-
format: "percent"
|
|
43
|
+
format: "percent",
|
|
44
|
+
accentColor: "orange"
|
|
41
45
|
}
|
|
42
46
|
],
|
|
43
47
|
charts: [
|
|
@@ -163,28 +167,32 @@ var tokoSepatuWidgetConfig = {
|
|
|
163
167
|
label: "confirmedBookings",
|
|
164
168
|
icon: "TrendingUp",
|
|
165
169
|
valueKey: "bookingsConfirm",
|
|
166
|
-
format: "number"
|
|
170
|
+
format: "number",
|
|
171
|
+
accentColor: "sky"
|
|
167
172
|
},
|
|
168
173
|
{
|
|
169
174
|
id: "totalRevenue",
|
|
170
175
|
label: "confirmedRevenue",
|
|
171
176
|
icon: "DollarSign",
|
|
172
177
|
valueKey: "revenueConfirm",
|
|
173
|
-
format: "currency"
|
|
178
|
+
format: "currency",
|
|
179
|
+
accentColor: "green"
|
|
174
180
|
},
|
|
175
181
|
{
|
|
176
182
|
id: "avgOrderValue",
|
|
177
183
|
label: "avgRevenue",
|
|
178
184
|
icon: "BarChart3",
|
|
179
185
|
valueKey: "avgRevenue",
|
|
180
|
-
format: "currency"
|
|
186
|
+
format: "currency",
|
|
187
|
+
accentColor: "violet"
|
|
181
188
|
},
|
|
182
189
|
{
|
|
183
190
|
id: "totalProducts",
|
|
184
191
|
label: "totalProducts",
|
|
185
192
|
icon: "PieChart",
|
|
186
193
|
valueKey: "packages",
|
|
187
|
-
format: "number"
|
|
194
|
+
format: "number",
|
|
195
|
+
accentColor: "orange"
|
|
188
196
|
}
|
|
189
197
|
],
|
|
190
198
|
charts: [
|
|
@@ -1243,10 +1251,20 @@ function StatCard({
|
|
|
1243
1251
|
icon = "TrendingUp",
|
|
1244
1252
|
format = "number",
|
|
1245
1253
|
trend = null,
|
|
1254
|
+
accentColor = "blue",
|
|
1246
1255
|
className = ""
|
|
1247
1256
|
}) {
|
|
1248
1257
|
const formattedValue = renderValue(format, value);
|
|
1249
|
-
|
|
1258
|
+
const ACCENT = {
|
|
1259
|
+
blue: { bg: "bg-blue-50 dark:bg-blue-900/20", icon: "text-blue-600 dark:text-blue-400", bar: "bg-blue-500", border: "border-l-4 border-blue-400" },
|
|
1260
|
+
green: { bg: "bg-emerald-50 dark:bg-emerald-900/20", icon: "text-emerald-600 dark:text-emerald-400", bar: "bg-emerald-500", border: "border-l-4 border-emerald-400" },
|
|
1261
|
+
violet: { bg: "bg-violet-50 dark:bg-violet-900/20", icon: "text-violet-600 dark:text-violet-400", bar: "bg-violet-500", border: "border-l-4 border-violet-400" },
|
|
1262
|
+
orange: { bg: "bg-orange-50 dark:bg-orange-900/20", icon: "text-orange-600 dark:text-orange-400", bar: "bg-orange-500", border: "border-l-4 border-orange-400" },
|
|
1263
|
+
sky: { bg: "bg-sky-50 dark:bg-sky-900/20", icon: "text-sky-600 dark:text-sky-400", bar: "bg-sky-500", border: "border-l-4 border-sky-400" },
|
|
1264
|
+
rose: { bg: "bg-rose-50 dark:bg-rose-900/20", icon: "text-rose-600 dark:text-rose-400", bar: "bg-rose-500", border: "border-l-4 border-rose-400" }
|
|
1265
|
+
};
|
|
1266
|
+
const accent = ACCENT[accentColor] || ACCENT.blue;
|
|
1267
|
+
return /* @__PURE__ */ React7.createElement("div", { className: `card p-4 flex flex-col justify-between gap-3 ${accent.border} ${className}` }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React7.createElement("div", { className: "flex items-center gap-2 text-slate-500 dark:text-slate-400" }, /* @__PURE__ */ React7.createElement("div", { className: `w-8 h-8 rounded-xl flex items-center justify-center ${accent.bg} ${accent.icon} shrink-0` }, /* @__PURE__ */ React7.createElement(Icon, { name: icon, size: 16 })), /* @__PURE__ */ React7.createElement(Typography, { variant: "subheading" }, label)), trend ? /* @__PURE__ */ React7.createElement(
|
|
1250
1268
|
Icon,
|
|
1251
1269
|
{
|
|
1252
1270
|
name: trend === "up" ? "TrendingUp" : "TrendingDown",
|
|
@@ -1261,17 +1279,13 @@ function renderValue(format, value) {
|
|
|
1261
1279
|
return String(Number(value) || 0);
|
|
1262
1280
|
}
|
|
1263
1281
|
StatCard.propTypes = {
|
|
1264
|
-
/** Label deskriptif metrik. */
|
|
1265
1282
|
label: PropTypes7.string.isRequired,
|
|
1266
|
-
/** Nilai metrik. */
|
|
1267
1283
|
value: PropTypes7.oneOfType([PropTypes7.number, PropTypes7.string]),
|
|
1268
|
-
/** Nama ikon dari registry Lucide React. */
|
|
1269
1284
|
icon: PropTypes7.string,
|
|
1270
|
-
/** Format tampilan nilai. */
|
|
1271
1285
|
format: PropTypes7.oneOf(["number", "currency", "percent"]),
|
|
1272
|
-
/** Arah tren opsional. */
|
|
1273
1286
|
trend: PropTypes7.oneOf(["up", "down", null]),
|
|
1274
|
-
/**
|
|
1287
|
+
/** Warna aksen: blue | green | violet | orange | sky | rose */
|
|
1288
|
+
accentColor: PropTypes7.string,
|
|
1275
1289
|
className: PropTypes7.string
|
|
1276
1290
|
};
|
|
1277
1291
|
|
|
@@ -2077,7 +2091,8 @@ function ReusableDashboardView({
|
|
|
2077
2091
|
label: labels[widget.label] || widget.label,
|
|
2078
2092
|
value: data.stats[widget.valueKey],
|
|
2079
2093
|
icon: widget.icon,
|
|
2080
|
-
format: widget.format
|
|
2094
|
+
format: widget.format,
|
|
2095
|
+
accentColor: widget.accentColor
|
|
2081
2096
|
}
|
|
2082
2097
|
))), /* @__PURE__ */ React17.createElement("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-4" }, config.widgets.charts.map((widget) => /* @__PURE__ */ React17.createElement(
|
|
2083
2098
|
ChartCard,
|