@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 +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +39 -0
package/dist/index.d.cts
CHANGED
|
@@ -1648,6 +1648,9 @@ interface StatTileBaseProps {
|
|
|
1648
1648
|
/** Thin one-line variant for stat rows above tables. */
|
|
1649
1649
|
compact?: boolean;
|
|
1650
1650
|
className?: string;
|
|
1651
|
+
/** Explains the figure. An info button sits right after the label; hovering or focusing it
|
|
1652
|
+
* shows this in a Tooltip. The tile's own accessible name stays the label. */
|
|
1653
|
+
info?: React.ReactNode;
|
|
1651
1654
|
}
|
|
1652
1655
|
/** Display mode: a `div`, exactly as before. `pressed` and `disabled` mean nothing without `onPress`. */
|
|
1653
1656
|
interface StatTileDisplayProps extends StatTileBaseProps, React.HTMLAttributes<HTMLDivElement> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1648,6 +1648,9 @@ interface StatTileBaseProps {
|
|
|
1648
1648
|
/** Thin one-line variant for stat rows above tables. */
|
|
1649
1649
|
compact?: boolean;
|
|
1650
1650
|
className?: string;
|
|
1651
|
+
/** Explains the figure. An info button sits right after the label; hovering or focusing it
|
|
1652
|
+
* shows this in a Tooltip. The tile's own accessible name stays the label. */
|
|
1653
|
+
info?: React.ReactNode;
|
|
1651
1654
|
}
|
|
1652
1655
|
/** Display mode: a `div`, exactly as before. `pressed` and `disabled` mean nothing without `onPress`. */
|
|
1653
1656
|
interface StatTileDisplayProps extends StatTileBaseProps, React.HTMLAttributes<HTMLDivElement> {
|
package/dist/index.js
CHANGED
|
@@ -5372,11 +5372,12 @@ function isZeroDelta(delta) {
|
|
|
5372
5372
|
return match !== null && parseFloat(match[0]) === 0;
|
|
5373
5373
|
}
|
|
5374
5374
|
function StatTile(props) {
|
|
5375
|
-
const { label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", ...rest } = props;
|
|
5375
|
+
const { label, value, sub, delta, invert = false, loading = false, compact: compact3 = false, className = "", info, ...rest } = props;
|
|
5376
5376
|
const isDecrease = delta?.startsWith("-") ?? false;
|
|
5377
5377
|
const isZero = isZeroDelta(delta);
|
|
5378
5378
|
const isGood = invert ? isDecrease : !isDecrease;
|
|
5379
5379
|
const deltaToneClass = isZero ? "fd-stat-delta-neutral" : isGood ? "fd-stat-delta-up" : "fd-stat-delta-down";
|
|
5380
|
+
const infoButton = info && !loading ? /* @__PURE__ */ jsx56(Tooltip, { label: info, children: /* @__PURE__ */ jsx56(IconButton, { icon: "info", label: "About " + label, variant: "ghost", size: "sm" }) }) : null;
|
|
5380
5381
|
const content = /* @__PURE__ */ jsxs46(Fragment9, { children: [
|
|
5381
5382
|
loading ? /* @__PURE__ */ jsx56("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: compact3 ? 20 : 28, width: "62%" } }) : /* @__PURE__ */ jsxs46("span", { className: "fd-stat-top", children: [
|
|
5382
5383
|
/* @__PURE__ */ jsx56("span", { className: "fd-stat-figure", children: value }),
|
|
@@ -5387,12 +5388,25 @@ function StatTile(props) {
|
|
|
5387
5388
|
] }) : null
|
|
5388
5389
|
] }),
|
|
5389
5390
|
!loading && sub ? /* @__PURE__ */ jsx56("span", { className: "fd-stat-sub", children: sub }) : null,
|
|
5390
|
-
loading ? /* @__PURE__ */ jsx56("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 10, width: "40%", marginTop: 8 } }) : /* @__PURE__ */
|
|
5391
|
+
loading ? /* @__PURE__ */ jsx56("span", { className: "fd-skel fd-skel-text", style: { display: "block", height: 10, width: "40%", marginTop: 8 } }) : /* @__PURE__ */ jsxs46("span", { className: "fd-stat-label", style: { display: "block" }, children: [
|
|
5392
|
+
label,
|
|
5393
|
+
rest.onPress ? null : infoButton
|
|
5394
|
+
] })
|
|
5391
5395
|
] });
|
|
5392
5396
|
const classes = (...extra) => ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : "", className].filter(Boolean).join(" ");
|
|
5397
|
+
const wrapped = Boolean(rest.onPress && infoButton);
|
|
5398
|
+
const tileClasses = (...extra) => wrapped ? ["fd-stat", ...extra, compact3 ? "fd-stat-compact" : ""].filter(Boolean).join(" ") : classes(...extra);
|
|
5393
5399
|
if (rest.onPress) {
|
|
5394
5400
|
const { onPress, pressed, disabled = false, ...buttonRest } = rest;
|
|
5395
|
-
|
|
5401
|
+
const button = /* @__PURE__ */ jsx56("button", { type: "button", className: tileClasses("fd-stat-pressable"), "aria-pressed": pressed, disabled: disabled || loading, onClick: onPress, ...buttonRest, children: content });
|
|
5402
|
+
if (!infoButton) return button;
|
|
5403
|
+
return /* @__PURE__ */ jsxs46("div", { className: ["fd-stat-info-wrap", compact3 ? "is-compact" : "", className].filter(Boolean).join(" "), children: [
|
|
5404
|
+
button,
|
|
5405
|
+
/* @__PURE__ */ jsx56("div", { className: "fd-stat-info-overlay", children: /* @__PURE__ */ jsxs46("span", { className: "fd-stat-label", children: [
|
|
5406
|
+
/* @__PURE__ */ jsx56("span", { className: "fd-stat-label-ghost", "aria-hidden": "true", children: label }),
|
|
5407
|
+
infoButton
|
|
5408
|
+
] }) })
|
|
5409
|
+
] });
|
|
5396
5410
|
}
|
|
5397
5411
|
return /* @__PURE__ */ jsx56("div", { className: classes(), ...rest, children: content });
|
|
5398
5412
|
}
|