@ttoss/react-dashboard 0.3.4 → 0.3.6

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.
Files changed (2) hide show
  1. package/dist/esm/index.js +40 -19
  2. package/package.json +3 -3
package/dist/esm/index.js CHANGED
@@ -11,7 +11,7 @@ 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
@@ -80,9 +80,12 @@ var CardWrapper = /* @__PURE__ */__name(({
80
80
  title
81
81
  }, title), description && /* @__PURE__ */React.createElement(TooltipIcon, {
82
82
  variant: "info",
83
- icon: "ant-design:info-circle-outlined",
83
+ icon: "info",
84
84
  tooltip: {
85
- children: description
85
+ children: description,
86
+ sx: {
87
+ maxWidth: "300px"
88
+ }
86
89
  },
87
90
  sx: {
88
91
  fontSize: "sm",
@@ -156,16 +159,30 @@ var getTrendColor = /* @__PURE__ */__name(trend => {
156
159
  if (!trend) {
157
160
  return colors.neutral;
158
161
  }
159
- const isGoodTrend = trend.type === "higher" && trend.status === "positive" || trend.type === "lower" && trend.status === "negative";
162
+ const isGoodTrend = trend.status === "positive";
160
163
  if (isGoodTrend) {
161
164
  return colors.positive;
162
165
  }
163
- const isBadTrend = trend.type === "higher" && trend.status === "negative" || trend.type === "lower" && trend.status === "positive";
166
+ const isBadTrend = trend.status === "negative";
164
167
  if (isBadTrend) {
165
168
  return colors.negative;
166
169
  }
167
170
  return colors.neutral;
168
171
  }, "getTrendColor");
172
+ var TrendIcon = /* @__PURE__ */__name(({
173
+ trend
174
+ }) => {
175
+ let icon = "mdi:minus";
176
+ if (trend.type === "higher" && trend.status === "positive" || trend.type === "lower" && trend.status === "negative") {
177
+ icon = "mdi:arrow-up";
178
+ } else if (trend.type === "higher" && trend.status === "negative" || trend.type === "lower" && trend.status === "positive") {
179
+ icon = "mdi:arrow-down";
180
+ }
181
+ return /* @__PURE__ */React.createElement(Icon, {
182
+ icon,
183
+ width: 12
184
+ });
185
+ }, "TrendIcon");
169
186
  var BigNumber = /* @__PURE__ */__name(props => {
170
187
  const total = props.data.meta?.total ?? props.data.api?.total ?? void 0;
171
188
  const formattedValue = formatNumber(total, props.numberType, props.numberDecimalPlaces);
@@ -197,25 +214,18 @@ var BigNumber = /* @__PURE__ */__name(props => {
197
214
  color: getTrendColor(props.trend).color,
198
215
  backgroundColor: getTrendColor(props.trend).backgroundColor,
199
216
  padding: "1",
200
- fontSize: "2xs",
217
+ fontSize: "xs",
201
218
  fontWeight: "bold",
202
219
  borderRadius: "sm",
203
220
  display: "flex",
204
221
  alignItems: "center"
205
222
  }
206
- }, props.trend.status === "positive" ? /* @__PURE__ */React.createElement(Icon, {
207
- icon: "mdi:arrow-up",
208
- width: 10
209
- }) : props.trend.status === "negative" ? /* @__PURE__ */React.createElement(Icon, {
210
- icon: "mdi:arrow-down",
211
- width: 10
212
- }) : /* @__PURE__ */React.createElement(Icon, {
213
- icon: "mdi:minus",
214
- width: 10
223
+ }, /* @__PURE__ */React.createElement(TrendIcon, {
224
+ trend: props.trend
215
225
  }), props.trend.value.toFixed(1), "%", " "), /* @__PURE__ */React.createElement(Text, {
216
226
  sx: {
217
227
  color: "input.background.muted.disabled",
218
- fontSize: "2xs",
228
+ fontSize: "xs",
219
229
  fontWeight: "medium"
220
230
  }
221
231
  }, props.trend ? "vs. anterior" : "")), props.additionalInfo && /* @__PURE__ */React.createElement(Text, {
@@ -333,7 +343,13 @@ var DashboardGrid = /* @__PURE__ */__name(({
333
343
  width: "100%",
334
344
  height: "full"
335
345
  }
336
- }, loading ? /* @__PURE__ */React.createElement(Flex4, {
346
+ }, /* @__PURE__ */React.createElement(Global, {
347
+ styles: {
348
+ ".react-grid-item:has([data-tooltip-id]:hover)": {
349
+ zIndex: 1
350
+ }
351
+ }
352
+ }), loading ? /* @__PURE__ */React.createElement(Flex4, {
337
353
  sx: {
338
354
  width: "100%",
339
355
  height: "full",
@@ -345,7 +361,7 @@ var DashboardGrid = /* @__PURE__ */__name(({
345
361
  layouts,
346
362
  breakpoints,
347
363
  cols,
348
- rowHeight: 30,
364
+ rowHeight: 32,
349
365
  margin: [10, 10],
350
366
  containerPadding: [0, 0]
351
367
  }, selectedTemplate.grid.map(item => {
@@ -424,6 +440,7 @@ import { FormFieldDatePicker } from "@ttoss/forms";
424
440
  import { FormProvider, useForm } from "@ttoss/forms";
425
441
  import * as React3 from "react";
426
442
  var DateRangeFilter = /* @__PURE__ */__name(({
443
+ sx,
427
444
  label,
428
445
  value,
429
446
  presets,
@@ -464,7 +481,8 @@ var DateRangeFilter = /* @__PURE__ */__name(({
464
481
  return /* @__PURE__ */React3.createElement(FormProvider, formMethods, /* @__PURE__ */React3.createElement(FormFieldDatePicker, {
465
482
  name: "dateRange",
466
483
  label,
467
- presets
484
+ presets,
485
+ sx
468
486
  }));
469
487
  }, "DateRangeFilter");
470
488
 
@@ -603,6 +621,9 @@ var DashboardFilters = /* @__PURE__ */__name(() => {
603
621
  });
604
622
  case "date-range":
605
623
  return /* @__PURE__ */React6.createElement(DateRangeFilter, {
624
+ sx: {
625
+ minWidth: "auto"
626
+ },
606
627
  label: filter.label,
607
628
  key: filter.key,
608
629
  value: filter.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-dashboard",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "ttoss dashboard module for React apps.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -27,10 +27,10 @@
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/react-icons": "^0.5.7",
30
31
  "@ttoss/forms": "^0.40.1",
31
- "@ttoss/react-i18n": "^2.0.26",
32
32
  "@ttoss/ui": "^6.5.1",
33
- "@ttoss/react-icons": "^0.5.7"
33
+ "@ttoss/react-i18n": "^2.0.26"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=16.8.0"