@ttoss/react-dashboard 0.3.3 → 0.3.5

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 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. período anterior")
525
- - **Negative status**: Displays a down arrow icon and the percentage value (e.g., "5.2% vs. período anterior")
526
- - **Neutral status**: Displays no arrow icon, only the percentage value (e.g., "0.0% vs. período anterior")
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
@@ -11,15 +11,15 @@ import { Divider as Divider2, Flex as Flex7 } from "@ttoss/ui";
11
11
 
12
12
  // src/DashboardGrid.tsx
13
13
  import "react-grid-layout/css/styles.css";
14
- import { Box as Box3, Flex as Flex4, Spinner } from "@ttoss/ui";
14
+ import { Box as Box3, Flex as Flex4, Global, Spinner } from "@ttoss/ui";
15
15
  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 as Text2 } from "@ttoss/ui";
19
+ import { Box as Box2, Flex as Flex2, Text } from "@ttoss/ui";
20
20
 
21
21
  // src/Cards/Wrapper.tsx
22
- import { Box, Flex, Text, TooltipIcon } from "@ttoss/ui";
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 "display.background.primary.default";
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.background.muted.disabled";
48
+ return "input.text.muted.default";
49
49
  }
50
50
  }, "getTitleColor");
51
51
  return /* @__PURE__ */React.createElement(Flex, {
@@ -53,36 +53,46 @@ 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: "4",
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(Text, {
68
+ }, /* @__PURE__ */React.createElement(Flex, {
68
69
  sx: {
69
- fontSize: "sm",
70
- fontWeight: "bold",
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
- icon: "ant-design:info-circle-outlined",
83
+ icon: "info",
78
84
  tooltip: {
79
- children: description
85
+ children: description,
86
+ sx: {
87
+ maxWidth: "300px"
88
+ }
80
89
  },
81
90
  sx: {
82
- marginLeft: "2",
83
- flexShrink: 0
91
+ fontSize: "sm",
92
+ color: getTitleColor(),
93
+ marginLeft: "2"
84
94
  }
85
- })), /* @__PURE__ */React.createElement(Flex, {
95
+ }))), /* @__PURE__ */React.createElement(Flex, {
86
96
  sx: {
87
97
  flexDirection: "column",
88
98
  flex: "auto",
@@ -124,7 +134,7 @@ var getValueColor = /* @__PURE__ */__name((color, variant) => {
124
134
  return "feedback.text.positive.default";
125
135
  }
126
136
  if (!color) {
127
- return "display.text.primary.default";
137
+ return "feedback.text.positive.default";
128
138
  }
129
139
  if (["green", "accent", "positive"].includes(color.toLowerCase())) {
130
140
  return "display.text.accent.default";
@@ -133,9 +143,18 @@ var getValueColor = /* @__PURE__ */__name((color, variant) => {
133
143
  }, "getValueColor");
134
144
  var getTrendColor = /* @__PURE__ */__name(trend => {
135
145
  const colors = {
136
- positive: "feedback.text.positive.default",
137
- negative: "feedback.text.negative.default",
138
- neutral: "display.text.primary.default"
146
+ positive: {
147
+ color: "#15803d",
148
+ backgroundColor: "feedback.background.positive.default"
149
+ },
150
+ negative: {
151
+ color: "feedback.text.negative.default",
152
+ backgroundColor: "feedback.background.negative.default"
153
+ },
154
+ neutral: {
155
+ color: "input.text.muted.default",
156
+ backgroundColor: "display.border.muted.default"
157
+ }
139
158
  };
140
159
  if (!trend) {
141
160
  return colors.neutral;
@@ -164,10 +183,10 @@ var BigNumber = /* @__PURE__ */__name(props => {
164
183
  flexDirection: "column",
165
184
  gap: "2"
166
185
  }
167
- }, /* @__PURE__ */React.createElement(Text2, {
186
+ }, /* @__PURE__ */React.createElement(Text, {
168
187
  sx: {
169
188
  color: valueColor,
170
- fontSize: "2xl",
189
+ fontSize: "1.65rem",
171
190
  fontWeight: "bold",
172
191
  lineHeight: "1.2"
173
192
  }
@@ -178,23 +197,31 @@ var BigNumber = /* @__PURE__ */__name(props => {
178
197
  }
179
198
  }, /* @__PURE__ */React.createElement(Box2, {
180
199
  sx: {
181
- color: getTrendColor(props.trend),
200
+ color: getTrendColor(props.trend).color,
201
+ backgroundColor: getTrendColor(props.trend).backgroundColor,
202
+ padding: "1",
203
+ fontSize: "xs",
204
+ fontWeight: "bold",
205
+ borderRadius: "sm",
182
206
  display: "flex",
183
207
  alignItems: "center"
184
208
  }
185
209
  }, props.trend.status === "positive" ? /* @__PURE__ */React.createElement(Icon, {
186
210
  icon: "mdi:arrow-up",
187
- width: 16
211
+ width: 12
188
212
  }) : props.trend.status === "negative" ? /* @__PURE__ */React.createElement(Icon, {
189
213
  icon: "mdi:arrow-down",
190
- width: 16
191
- }) : null), /* @__PURE__ */React.createElement(Text2, {
214
+ width: 12
215
+ }) : /* @__PURE__ */React.createElement(Icon, {
216
+ icon: "mdi:minus",
217
+ width: 12
218
+ }), props.trend.value.toFixed(1), "%", " "), /* @__PURE__ */React.createElement(Text, {
192
219
  sx: {
193
- color: getTrendColor(props.trend),
194
- fontSize: "sm",
220
+ color: "input.background.muted.disabled",
221
+ fontSize: "xs",
195
222
  fontWeight: "medium"
196
223
  }
197
- }, props.trend.value.toFixed(1), "%", " ", props.trend ? "vs. per\xEDodo anterior" : "")), props.additionalInfo && /* @__PURE__ */React.createElement(Text2, {
224
+ }, props.trend ? "vs. anterior" : "")), props.additionalInfo && /* @__PURE__ */React.createElement(Text, {
198
225
  sx: {
199
226
  color: getValueColor(props.color, props.variant),
200
227
  fontSize: "sm",
@@ -215,7 +242,7 @@ var BigNumber = /* @__PURE__ */__name(props => {
215
242
  }, /* @__PURE__ */React.createElement(Icon, {
216
243
  icon: props.status.icon,
217
244
  width: 16
218
- })), /* @__PURE__ */React.createElement(Text2, {
245
+ })), /* @__PURE__ */React.createElement(Text, {
219
246
  sx: {
220
247
  color: "feedback.text.positive.default",
221
248
  fontSize: "sm",
@@ -235,7 +262,7 @@ var DashboardCard = /* @__PURE__ */__name(props => {
235
262
  }, "DashboardCard");
236
263
 
237
264
  // src/DashboardSectionDivider.tsx
238
- import { Divider, Flex as Flex3, Text as Text3 } from "@ttoss/ui";
265
+ import { Divider, Flex as Flex3, Text as Text2 } from "@ttoss/ui";
239
266
  var DashboardSectionDivider = /* @__PURE__ */__name(({
240
267
  title
241
268
  }) => {
@@ -249,7 +276,7 @@ var DashboardSectionDivider = /* @__PURE__ */__name(({
249
276
  gap: "6",
250
277
  paddingTop: "6"
251
278
  }
252
- }, /* @__PURE__ */React.createElement(Text3, {
279
+ }, /* @__PURE__ */React.createElement(Text2, {
253
280
  sx: {
254
281
  color: "input.background.muted.disabled",
255
282
  fontSize: "md",
@@ -309,7 +336,13 @@ var DashboardGrid = /* @__PURE__ */__name(({
309
336
  width: "100%",
310
337
  height: "full"
311
338
  }
312
- }, loading ? /* @__PURE__ */React.createElement(Flex4, {
339
+ }, /* @__PURE__ */React.createElement(Global, {
340
+ styles: {
341
+ ".react-grid-item:has([data-tooltip-id]:hover)": {
342
+ zIndex: 1
343
+ }
344
+ }
345
+ }), loading ? /* @__PURE__ */React.createElement(Flex4, {
313
346
  sx: {
314
347
  width: "100%",
315
348
  height: "full",
@@ -321,7 +354,7 @@ var DashboardGrid = /* @__PURE__ */__name(({
321
354
  layouts,
322
355
  breakpoints,
323
356
  cols,
324
- rowHeight: 30,
357
+ rowHeight: 32,
325
358
  margin: [10, 10],
326
359
  containerPadding: [0, 0]
327
360
  }, selectedTemplate.grid.map(item => {
@@ -400,6 +433,7 @@ import { FormFieldDatePicker } from "@ttoss/forms";
400
433
  import { FormProvider, useForm } from "@ttoss/forms";
401
434
  import * as React3 from "react";
402
435
  var DateRangeFilter = /* @__PURE__ */__name(({
436
+ sx,
403
437
  label,
404
438
  value,
405
439
  presets,
@@ -440,7 +474,8 @@ var DateRangeFilter = /* @__PURE__ */__name(({
440
474
  return /* @__PURE__ */React3.createElement(FormProvider, formMethods, /* @__PURE__ */React3.createElement(FormFieldDatePicker, {
441
475
  name: "dateRange",
442
476
  label,
443
- presets
477
+ presets,
478
+ sx
444
479
  }));
445
480
  }, "DateRangeFilter");
446
481
 
@@ -579,6 +614,9 @@ var DashboardFilters = /* @__PURE__ */__name(() => {
579
614
  });
580
615
  case "date-range":
581
616
  return /* @__PURE__ */React6.createElement(DateRangeFilter, {
617
+ sx: {
618
+ minWidth: "auto"
619
+ },
582
620
  label: filter.label,
583
621
  key: filter.key,
584
622
  value: filter.value,
@@ -617,7 +655,9 @@ var DashboardContent = /* @__PURE__ */__name(({
617
655
  padding: "2",
618
656
  width: "100%"
619
657
  }
620
- }, /* @__PURE__ */React.createElement(DashboardHeader, null, headerChildren), /* @__PURE__ */React.createElement(Divider2, null), /* @__PURE__ */React.createElement(DashboardGrid, {
658
+ }, /* @__PURE__ */React.createElement(DashboardHeader, null, headerChildren), /* @__PURE__ */React.createElement(Divider2, {
659
+ color: "display.border.muted.default"
660
+ }), /* @__PURE__ */React.createElement(DashboardGrid, {
621
661
  loading,
622
662
  selectedTemplate
623
663
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-dashboard",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "ttoss dashboard module for React apps.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -29,8 +29,8 @@
29
29
  "@ttoss/components": "^2.12.6",
30
30
  "@ttoss/forms": "^0.40.1",
31
31
  "@ttoss/react-icons": "^0.5.7",
32
- "@ttoss/ui": "^6.5.1",
33
- "@ttoss/react-i18n": "^2.0.26"
32
+ "@ttoss/react-i18n": "^2.0.26",
33
+ "@ttoss/ui": "^6.5.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=16.8.0"