@flytedan/flytebot-design-system 0.24.0 → 0.26.0

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 CHANGED
@@ -3129,12 +3129,21 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
3129
3129
 
3130
3130
  // src/components/data/StatTile.tsx
3131
3131
  var import_jsx_runtime42 = require("react/jsx-runtime");
3132
- function StatTile({ label, value, sub, delta, loading = false, compact: compact3 = false, className = "", ...rest }) {
3132
+ function isZeroDelta(delta) {
3133
+ if (!delta) return false;
3134
+ const match = delta.match(/[\d.]+/);
3135
+ return match !== null && parseFloat(match[0]) === 0;
3136
+ }
3137
+ function StatTile({ label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest }) {
3138
+ const isDecrease = delta?.startsWith("-") ?? false;
3139
+ const isZero = isZeroDelta(delta);
3140
+ const isGood = invert ? isDecrease : !isDecrease;
3141
+ const deltaToneClass = isZero ? "fd-stat-delta-neutral" : isGood ? "fd-stat-delta-up" : "fd-stat-delta-down";
3133
3142
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: ["fd-stat", compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" "), ...rest, children: [
3134
3143
  loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: compact3 ? 20 : 28, width: "62%" } }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "fd-stat-top", children: [
3135
3144
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "fd-stat-figure", children: value }),
3136
- delta ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: delta.startsWith("-") ? "fd-stat-delta-down" : "fd-stat-delta-up", style: { fontWeight: 600, fontSize: "var(--body-sm-size)", flex: "none" }, children: [
3137
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("i", { className: "ph ph-arrow-" + (delta.startsWith("-") ? "down" : "up") + "-right", "aria-hidden": "true" }),
3145
+ delta ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: deltaToneClass, style: { fontWeight: 600, fontSize: "var(--body-sm-size)", flex: "none" }, children: [
3146
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("i", { className: "ph ph-" + (isZero ? "minus" : "arrow-" + (isDecrease ? "down" : "up") + "-right"), "aria-hidden": "true" }),
3138
3147
  " ",
3139
3148
  delta
3140
3149
  ] }) : null