@flytedan/flytebot-design-system 0.24.0 → 0.25.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.d.cts CHANGED
@@ -1117,14 +1117,22 @@ interface StatTileProps extends React.HTMLAttributes<HTMLDivElement> {
1117
1117
  label: string;
1118
1118
  value?: React.ReactNode;
1119
1119
  sub?: React.ReactNode;
1120
- /** "+12.4%" or "-3.1%" — colour and arrow follow the sign. */
1120
+ /** "+12.4%" or "-3.1%" — the arrow direction always follows the sign (up for a
1121
+ * positive delta, down for a negative one). Colour follows the sign too, UNLESS
1122
+ * `invert` is set. */
1121
1123
  delta?: string;
1124
+ /** Set for a metric where a larger number is the bad outcome (an opt-out rate, an
1125
+ * error rate, a churn rate, ...) — flips which sign colours as good (ok) vs bad
1126
+ * (danger), without changing which way the arrow points. A rising opt-out rate is
1127
+ * still an up arrow (the number really did go up) but rendered in the danger
1128
+ * colour, not the ok one a plain increase would otherwise get. */
1129
+ invert?: boolean;
1122
1130
  loading?: boolean;
1123
1131
  /** Thin one-line variant for stat rows above tables. */
1124
1132
  compact?: boolean;
1125
1133
  className?: string;
1126
1134
  }
1127
- declare function StatTile({ label, value, sub, delta, loading, compact, className, ...rest }: StatTileProps): React.JSX.Element;
1135
+ declare function StatTile({ label, value, sub, delta, invert, loading, compact, className, ...rest }: StatTileProps): React.JSX.Element;
1128
1136
 
1129
1137
  declare function languageLabel(lang?: string): string;
1130
1138
  /** Tokenise source into [{t, c}] where c is a token class or null for plain text. */
package/dist/index.d.ts CHANGED
@@ -1117,14 +1117,22 @@ interface StatTileProps extends React.HTMLAttributes<HTMLDivElement> {
1117
1117
  label: string;
1118
1118
  value?: React.ReactNode;
1119
1119
  sub?: React.ReactNode;
1120
- /** "+12.4%" or "-3.1%" — colour and arrow follow the sign. */
1120
+ /** "+12.4%" or "-3.1%" — the arrow direction always follows the sign (up for a
1121
+ * positive delta, down for a negative one). Colour follows the sign too, UNLESS
1122
+ * `invert` is set. */
1121
1123
  delta?: string;
1124
+ /** Set for a metric where a larger number is the bad outcome (an opt-out rate, an
1125
+ * error rate, a churn rate, ...) — flips which sign colours as good (ok) vs bad
1126
+ * (danger), without changing which way the arrow points. A rising opt-out rate is
1127
+ * still an up arrow (the number really did go up) but rendered in the danger
1128
+ * colour, not the ok one a plain increase would otherwise get. */
1129
+ invert?: boolean;
1122
1130
  loading?: boolean;
1123
1131
  /** Thin one-line variant for stat rows above tables. */
1124
1132
  compact?: boolean;
1125
1133
  className?: string;
1126
1134
  }
1127
- declare function StatTile({ label, value, sub, delta, loading, compact, className, ...rest }: StatTileProps): React.JSX.Element;
1135
+ declare function StatTile({ label, value, sub, delta, invert, loading, compact, className, ...rest }: StatTileProps): React.JSX.Element;
1128
1136
 
1129
1137
  declare function languageLabel(lang?: string): string;
1130
1138
  /** Tokenise source into [{t, c}] where c is a token class or null for plain text. */
package/dist/index.js CHANGED
@@ -2890,12 +2890,14 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
2890
2890
 
2891
2891
  // src/components/data/StatTile.tsx
2892
2892
  import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
2893
- function StatTile({ label, value, sub, delta, loading = false, compact: compact3 = false, className = "", ...rest }) {
2893
+ function StatTile({ label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest }) {
2894
+ const isDecrease = delta?.startsWith("-") ?? false;
2895
+ const isGood = invert ? isDecrease : !isDecrease;
2894
2896
  return /* @__PURE__ */ jsxs36("div", { className: ["fd-stat", compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" "), ...rest, children: [
2895
2897
  loading ? /* @__PURE__ */ jsx42("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: compact3 ? 20 : 28, width: "62%" } }) : /* @__PURE__ */ jsxs36("span", { className: "fd-stat-top", children: [
2896
2898
  /* @__PURE__ */ jsx42("span", { className: "fd-stat-figure", children: value }),
2897
- delta ? /* @__PURE__ */ jsxs36("span", { className: delta.startsWith("-") ? "fd-stat-delta-down" : "fd-stat-delta-up", style: { fontWeight: 600, fontSize: "var(--body-sm-size)", flex: "none" }, children: [
2898
- /* @__PURE__ */ jsx42("i", { className: "ph ph-arrow-" + (delta.startsWith("-") ? "down" : "up") + "-right", "aria-hidden": "true" }),
2899
+ delta ? /* @__PURE__ */ jsxs36("span", { className: isGood ? "fd-stat-delta-up" : "fd-stat-delta-down", style: { fontWeight: 600, fontSize: "var(--body-sm-size)", flex: "none" }, children: [
2900
+ /* @__PURE__ */ jsx42("i", { className: "ph ph-arrow-" + (isDecrease ? "down" : "up") + "-right", "aria-hidden": "true" }),
2899
2901
  " ",
2900
2902
  delta
2901
2903
  ] }) : null