@ttoss/react-dashboard 0.3.2 → 0.3.4
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 +3 -3
- package/dist/esm/index.js +59 -33
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -521,9 +521,9 @@ type TrendIndicator = {
|
|
|
521
521
|
|
|
522
522
|
**Behavior:**
|
|
523
523
|
|
|
524
|
-
- **Positive status**: Displays an up arrow icon and the percentage value (e.g., "10.5% vs.
|
|
525
|
-
- **Negative status**: Displays a down arrow icon and the percentage value (e.g., "5.2% vs.
|
|
526
|
-
- **Neutral status**: Displays no arrow icon, only the percentage value (e.g., "0.0% vs.
|
|
524
|
+
- **Positive status**: Displays an up arrow icon and the percentage value (e.g., "10.5% vs. anterior")
|
|
525
|
+
- **Negative status**: Displays a down arrow icon and the percentage value (e.g., "5.2% vs. anterior")
|
|
526
|
+
- **Neutral status**: Displays no arrow icon, only the percentage value (e.g., "0.0% vs. anterior")
|
|
527
527
|
- The value is always formatted to 1 decimal place followed by "%"
|
|
528
528
|
- Note: Positive values do not include a "+" sign prefix
|
|
529
529
|
|
package/dist/esm/index.js
CHANGED
|
@@ -16,10 +16,10 @@ import { Responsive, WidthProvider } from "react-grid-layout";
|
|
|
16
16
|
|
|
17
17
|
// src/Cards/BigNumber.tsx
|
|
18
18
|
import { Icon } from "@ttoss/react-icons";
|
|
19
|
-
import { Box as Box2, Flex as Flex2, Text
|
|
19
|
+
import { Box as Box2, Flex as Flex2, Text } from "@ttoss/ui";
|
|
20
20
|
|
|
21
21
|
// src/Cards/Wrapper.tsx
|
|
22
|
-
import { Box, Flex,
|
|
22
|
+
import { Box, Flex, Heading, TooltipIcon } from "@ttoss/ui";
|
|
23
23
|
var CardWrapper = /* @__PURE__ */__name(({
|
|
24
24
|
title,
|
|
25
25
|
children,
|
|
@@ -34,7 +34,7 @@ var CardWrapper = /* @__PURE__ */__name(({
|
|
|
34
34
|
return "feedback.background.positive.default";
|
|
35
35
|
case "default":
|
|
36
36
|
default:
|
|
37
|
-
return "
|
|
37
|
+
return "#f9fafb";
|
|
38
38
|
}
|
|
39
39
|
}, "getBackgroundColor");
|
|
40
40
|
const getTitleColor = /* @__PURE__ */__name(() => {
|
|
@@ -45,7 +45,7 @@ var CardWrapper = /* @__PURE__ */__name(({
|
|
|
45
45
|
return "feedback.text.positive.default";
|
|
46
46
|
case "default":
|
|
47
47
|
default:
|
|
48
|
-
return "input.
|
|
48
|
+
return "input.text.muted.default";
|
|
49
49
|
}
|
|
50
50
|
}, "getTitleColor");
|
|
51
51
|
return /* @__PURE__ */React.createElement(Flex, {
|
|
@@ -53,25 +53,31 @@ var CardWrapper = /* @__PURE__ */__name(({
|
|
|
53
53
|
flexDirection: "column",
|
|
54
54
|
gap: "3",
|
|
55
55
|
backgroundColor: getBackgroundColor(),
|
|
56
|
+
border: "md",
|
|
57
|
+
borderColor: "display.border.muted.default",
|
|
56
58
|
borderRadius: "lg",
|
|
57
|
-
padding: "
|
|
59
|
+
padding: "6",
|
|
58
60
|
width: "100%",
|
|
59
|
-
height: "100%"
|
|
60
|
-
boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)"
|
|
61
|
+
height: "100%"
|
|
61
62
|
}
|
|
62
63
|
}, /* @__PURE__ */React.createElement(Box, {
|
|
63
64
|
sx: {
|
|
64
65
|
alignItems: "center",
|
|
65
66
|
gap: "2"
|
|
66
67
|
}
|
|
67
|
-
}, /* @__PURE__ */React.createElement(
|
|
68
|
+
}, /* @__PURE__ */React.createElement(Flex, {
|
|
68
69
|
sx: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
color: getTitleColor(),
|
|
72
|
-
flex: 1,
|
|
73
|
-
minWidth: 0
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "flex-start"
|
|
74
72
|
}
|
|
73
|
+
}, /* @__PURE__ */React.createElement(Heading, {
|
|
74
|
+
as: "h6",
|
|
75
|
+
sx: {
|
|
76
|
+
textTransform: "uppercase",
|
|
77
|
+
color: getTitleColor(),
|
|
78
|
+
textWrapStyle: "pretty"
|
|
79
|
+
},
|
|
80
|
+
title
|
|
75
81
|
}, title), description && /* @__PURE__ */React.createElement(TooltipIcon, {
|
|
76
82
|
variant: "info",
|
|
77
83
|
icon: "ant-design:info-circle-outlined",
|
|
@@ -79,10 +85,11 @@ var CardWrapper = /* @__PURE__ */__name(({
|
|
|
79
85
|
children: description
|
|
80
86
|
},
|
|
81
87
|
sx: {
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
fontSize: "sm",
|
|
89
|
+
color: getTitleColor(),
|
|
90
|
+
marginLeft: "2"
|
|
84
91
|
}
|
|
85
|
-
})), /* @__PURE__ */React.createElement(Flex, {
|
|
92
|
+
}))), /* @__PURE__ */React.createElement(Flex, {
|
|
86
93
|
sx: {
|
|
87
94
|
flexDirection: "column",
|
|
88
95
|
flex: "auto",
|
|
@@ -124,7 +131,7 @@ var getValueColor = /* @__PURE__ */__name((color, variant) => {
|
|
|
124
131
|
return "feedback.text.positive.default";
|
|
125
132
|
}
|
|
126
133
|
if (!color) {
|
|
127
|
-
return "
|
|
134
|
+
return "feedback.text.positive.default";
|
|
128
135
|
}
|
|
129
136
|
if (["green", "accent", "positive"].includes(color.toLowerCase())) {
|
|
130
137
|
return "display.text.accent.default";
|
|
@@ -133,9 +140,18 @@ var getValueColor = /* @__PURE__ */__name((color, variant) => {
|
|
|
133
140
|
}, "getValueColor");
|
|
134
141
|
var getTrendColor = /* @__PURE__ */__name(trend => {
|
|
135
142
|
const colors = {
|
|
136
|
-
positive:
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
positive: {
|
|
144
|
+
color: "#15803d",
|
|
145
|
+
backgroundColor: "feedback.background.positive.default"
|
|
146
|
+
},
|
|
147
|
+
negative: {
|
|
148
|
+
color: "feedback.text.negative.default",
|
|
149
|
+
backgroundColor: "feedback.background.negative.default"
|
|
150
|
+
},
|
|
151
|
+
neutral: {
|
|
152
|
+
color: "input.text.muted.default",
|
|
153
|
+
backgroundColor: "display.border.muted.default"
|
|
154
|
+
}
|
|
139
155
|
};
|
|
140
156
|
if (!trend) {
|
|
141
157
|
return colors.neutral;
|
|
@@ -164,10 +180,10 @@ var BigNumber = /* @__PURE__ */__name(props => {
|
|
|
164
180
|
flexDirection: "column",
|
|
165
181
|
gap: "2"
|
|
166
182
|
}
|
|
167
|
-
}, /* @__PURE__ */React.createElement(
|
|
183
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
168
184
|
sx: {
|
|
169
185
|
color: valueColor,
|
|
170
|
-
fontSize: "
|
|
186
|
+
fontSize: "1.65rem",
|
|
171
187
|
fontWeight: "bold",
|
|
172
188
|
lineHeight: "1.2"
|
|
173
189
|
}
|
|
@@ -178,23 +194,31 @@ var BigNumber = /* @__PURE__ */__name(props => {
|
|
|
178
194
|
}
|
|
179
195
|
}, /* @__PURE__ */React.createElement(Box2, {
|
|
180
196
|
sx: {
|
|
181
|
-
color: getTrendColor(props.trend),
|
|
197
|
+
color: getTrendColor(props.trend).color,
|
|
198
|
+
backgroundColor: getTrendColor(props.trend).backgroundColor,
|
|
199
|
+
padding: "1",
|
|
200
|
+
fontSize: "2xs",
|
|
201
|
+
fontWeight: "bold",
|
|
202
|
+
borderRadius: "sm",
|
|
182
203
|
display: "flex",
|
|
183
204
|
alignItems: "center"
|
|
184
205
|
}
|
|
185
206
|
}, props.trend.status === "positive" ? /* @__PURE__ */React.createElement(Icon, {
|
|
186
207
|
icon: "mdi:arrow-up",
|
|
187
|
-
width:
|
|
208
|
+
width: 10
|
|
188
209
|
}) : props.trend.status === "negative" ? /* @__PURE__ */React.createElement(Icon, {
|
|
189
210
|
icon: "mdi:arrow-down",
|
|
190
|
-
width:
|
|
191
|
-
}) :
|
|
211
|
+
width: 10
|
|
212
|
+
}) : /* @__PURE__ */React.createElement(Icon, {
|
|
213
|
+
icon: "mdi:minus",
|
|
214
|
+
width: 10
|
|
215
|
+
}), props.trend.value.toFixed(1), "%", " "), /* @__PURE__ */React.createElement(Text, {
|
|
192
216
|
sx: {
|
|
193
|
-
color:
|
|
194
|
-
fontSize: "
|
|
217
|
+
color: "input.background.muted.disabled",
|
|
218
|
+
fontSize: "2xs",
|
|
195
219
|
fontWeight: "medium"
|
|
196
220
|
}
|
|
197
|
-
}, props.trend
|
|
221
|
+
}, props.trend ? "vs. anterior" : "")), props.additionalInfo && /* @__PURE__ */React.createElement(Text, {
|
|
198
222
|
sx: {
|
|
199
223
|
color: getValueColor(props.color, props.variant),
|
|
200
224
|
fontSize: "sm",
|
|
@@ -215,7 +239,7 @@ var BigNumber = /* @__PURE__ */__name(props => {
|
|
|
215
239
|
}, /* @__PURE__ */React.createElement(Icon, {
|
|
216
240
|
icon: props.status.icon,
|
|
217
241
|
width: 16
|
|
218
|
-
})), /* @__PURE__ */React.createElement(
|
|
242
|
+
})), /* @__PURE__ */React.createElement(Text, {
|
|
219
243
|
sx: {
|
|
220
244
|
color: "feedback.text.positive.default",
|
|
221
245
|
fontSize: "sm",
|
|
@@ -235,7 +259,7 @@ var DashboardCard = /* @__PURE__ */__name(props => {
|
|
|
235
259
|
}, "DashboardCard");
|
|
236
260
|
|
|
237
261
|
// src/DashboardSectionDivider.tsx
|
|
238
|
-
import { Divider, Flex as Flex3, Text as
|
|
262
|
+
import { Divider, Flex as Flex3, Text as Text2 } from "@ttoss/ui";
|
|
239
263
|
var DashboardSectionDivider = /* @__PURE__ */__name(({
|
|
240
264
|
title
|
|
241
265
|
}) => {
|
|
@@ -249,7 +273,7 @@ var DashboardSectionDivider = /* @__PURE__ */__name(({
|
|
|
249
273
|
gap: "6",
|
|
250
274
|
paddingTop: "6"
|
|
251
275
|
}
|
|
252
|
-
}, /* @__PURE__ */React.createElement(
|
|
276
|
+
}, /* @__PURE__ */React.createElement(Text2, {
|
|
253
277
|
sx: {
|
|
254
278
|
color: "input.background.muted.disabled",
|
|
255
279
|
fontSize: "md",
|
|
@@ -617,7 +641,9 @@ var DashboardContent = /* @__PURE__ */__name(({
|
|
|
617
641
|
padding: "2",
|
|
618
642
|
width: "100%"
|
|
619
643
|
}
|
|
620
|
-
}, /* @__PURE__ */React.createElement(DashboardHeader, null, headerChildren), /* @__PURE__ */React.createElement(Divider2,
|
|
644
|
+
}, /* @__PURE__ */React.createElement(DashboardHeader, null, headerChildren), /* @__PURE__ */React.createElement(Divider2, {
|
|
645
|
+
color: "display.border.muted.default"
|
|
646
|
+
}), /* @__PURE__ */React.createElement(DashboardGrid, {
|
|
621
647
|
loading,
|
|
622
648
|
selectedTemplate
|
|
623
649
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-dashboard",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "ttoss dashboard module for React apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"react-day-picker": "^9.13.0",
|
|
28
28
|
"react-grid-layout": "^1.5.2",
|
|
29
29
|
"@ttoss/components": "^2.12.6",
|
|
30
|
+
"@ttoss/forms": "^0.40.1",
|
|
30
31
|
"@ttoss/react-i18n": "^2.0.26",
|
|
31
|
-
"@ttoss/forms": "^0.40.0",
|
|
32
32
|
"@ttoss/ui": "^6.5.1",
|
|
33
33
|
"@ttoss/react-icons": "^0.5.7"
|
|
34
34
|
},
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"jest": "^30.2.0",
|
|
42
42
|
"react": "^19.2.3",
|
|
43
43
|
"tsup": "^8.5.1",
|
|
44
|
-
"@ttoss/
|
|
45
|
-
"@ttoss/
|
|
44
|
+
"@ttoss/config": "^1.35.12",
|
|
45
|
+
"@ttoss/test-utils": "^4.0.3"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"React",
|