@ttoss/react-dashboard 0.3.5 → 0.3.7

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 +19 -12
  2. package/package.json +5 -5
package/dist/esm/index.js CHANGED
@@ -159,16 +159,30 @@ var getTrendColor = /* @__PURE__ */__name(trend => {
159
159
  if (!trend) {
160
160
  return colors.neutral;
161
161
  }
162
- const isGoodTrend = trend.type === "higher" && trend.status === "positive" || trend.type === "lower" && trend.status === "negative";
162
+ const isGoodTrend = trend.status === "positive";
163
163
  if (isGoodTrend) {
164
164
  return colors.positive;
165
165
  }
166
- const isBadTrend = trend.type === "higher" && trend.status === "negative" || trend.type === "lower" && trend.status === "positive";
166
+ const isBadTrend = trend.status === "negative";
167
167
  if (isBadTrend) {
168
168
  return colors.negative;
169
169
  }
170
170
  return colors.neutral;
171
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");
172
186
  var BigNumber = /* @__PURE__ */__name(props => {
173
187
  const total = props.data.meta?.total ?? props.data.api?.total ?? void 0;
174
188
  const formattedValue = formatNumber(total, props.numberType, props.numberDecimalPlaces);
@@ -190,7 +204,7 @@ var BigNumber = /* @__PURE__ */__name(props => {
190
204
  fontWeight: "bold",
191
205
  lineHeight: "1.2"
192
206
  }
193
- }, formattedValue), props.trend && /* @__PURE__ */React.createElement(Flex2, {
207
+ }, formattedValue), typeof props.trend?.value === "number" && /* @__PURE__ */React.createElement(Flex2, {
194
208
  sx: {
195
209
  alignItems: "center",
196
210
  gap: "1"
@@ -206,15 +220,8 @@ var BigNumber = /* @__PURE__ */__name(props => {
206
220
  display: "flex",
207
221
  alignItems: "center"
208
222
  }
209
- }, props.trend.status === "positive" ? /* @__PURE__ */React.createElement(Icon, {
210
- icon: "mdi:arrow-up",
211
- width: 12
212
- }) : props.trend.status === "negative" ? /* @__PURE__ */React.createElement(Icon, {
213
- icon: "mdi:arrow-down",
214
- width: 12
215
- }) : /* @__PURE__ */React.createElement(Icon, {
216
- icon: "mdi:minus",
217
- width: 12
223
+ }, /* @__PURE__ */React.createElement(TrendIcon, {
224
+ trend: props.trend
218
225
  }), props.trend.value.toFixed(1), "%", " "), /* @__PURE__ */React.createElement(Text, {
219
226
  sx: {
220
227
  color: "input.background.muted.disabled",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-dashboard",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "ttoss dashboard module for React apps.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -26,11 +26,11 @@
26
26
  "dependencies": {
27
27
  "react-day-picker": "^9.13.0",
28
28
  "react-grid-layout": "^1.5.2",
29
- "@ttoss/components": "^2.12.6",
30
- "@ttoss/forms": "^0.40.1",
31
- "@ttoss/react-icons": "^0.5.7",
29
+ "@ttoss/components": "^2.12.7",
30
+ "@ttoss/forms": "^0.40.2",
32
31
  "@ttoss/react-i18n": "^2.0.26",
33
- "@ttoss/ui": "^6.5.1"
32
+ "@ttoss/ui": "^6.5.1",
33
+ "@ttoss/react-icons": "^0.5.7"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=16.8.0"