@flytedan/flytebot-design-system 0.85.0 → 0.86.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
@@ -6553,11 +6553,12 @@ function isZeroDelta(delta) {
6553
6553
  return match !== null && parseFloat(match[0]) === 0;
6554
6554
  }
6555
6555
  function StatTile(props) {
6556
- const { label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest } = props;
6556
+ const { label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", info, ...rest } = props;
6557
6557
  const isDecrease = delta?.startsWith("-") ?? false;
6558
6558
  const isZero = isZeroDelta(delta);
6559
6559
  const isGood = invert ? isDecrease : !isDecrease;
6560
6560
  const deltaToneClass = isZero ? "fd-stat-delta-neutral" : isGood ? "fd-stat-delta-up" : "fd-stat-delta-down";
6561
+ const infoButton = info && !loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Tooltip, { label: info, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(IconButton, { icon: "info", label: "About " + label, variant: "ghost", size: "sm" }) }) : null;
6561
6562
  const content = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
6562
6563
  loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: compact3 ? 20 : 28, width: "62%" } }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "fd-stat-top", children: [
6563
6564
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-figure", children: value }),
@@ -6568,12 +6569,25 @@ function StatTile(props) {
6568
6569
  ] }) : null
6569
6570
  ] }),
6570
6571
  !loading && sub ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-sub", children: sub }) : null,
6571
- loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 10, width: "40%", marginTop: 8 } }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-label", style: { display: "block" }, children: label })
6572
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 10, width: "40%", marginTop: 8 } }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "fd-stat-label", style: { display: "block" }, children: [
6573
+ label,
6574
+ rest.onPress ? null : infoButton
6575
+ ] })
6572
6576
  ] });
6573
6577
  const classes = (...extra) => ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" ");
6578
+ const wrapped = Boolean(rest.onPress && infoButton);
6579
+ const tileClasses = (...extra) => wrapped ? ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : ""].filter(Boolean).join(" ") : classes(...extra);
6574
6580
  if (rest.onPress) {
6575
6581
  const { onPress, pressed, disabled = false, ...buttonRest } = rest;
6576
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: classes("fd-stat-pressable"), "aria-pressed": pressed, disabled: disabled || loading, onClick: onPress, ...buttonRest, children: content });
6582
+ const button = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: tileClasses("fd-stat-pressable"), "aria-pressed": pressed, disabled: disabled || loading, onClick: onPress, ...buttonRest, children: content });
6583
+ if (!infoButton) return button;
6584
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: ["fd-stat-info-wrap", compact3 ? "is-compact" : "", className].filter(Boolean).join(" "), children: [
6585
+ button,
6586
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "fd-stat-info-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "fd-stat-label", children: [
6587
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-label-ghost", "aria-hidden": "true", children: label }),
6588
+ infoButton
6589
+ ] }) })
6590
+ ] });
6577
6591
  }
6578
6592
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: classes(), ...rest, children: content });
6579
6593
  }