@flytedan/flytebot-design-system 0.84.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 +26 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +26 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +53 -1
package/dist/index.cjs
CHANGED
|
@@ -2235,40 +2235,21 @@ var import_react_dom3 = require("react-dom");
|
|
|
2235
2235
|
var React8 = __toESM(require("react"), 1);
|
|
2236
2236
|
var PANEL_EXIT_MS = 210;
|
|
2237
2237
|
function useClosingAnimation(open2, onClose, durationMs) {
|
|
2238
|
-
const [
|
|
2238
|
+
const [exiting, setExiting] = React8.useState(false);
|
|
2239
2239
|
const [wasOpen, setWasOpen] = React8.useState(open2);
|
|
2240
|
-
const timer = React8.useRef(null);
|
|
2241
|
-
const cancel = React8.useCallback(() => {
|
|
2242
|
-
if (timer.current !== null) clearTimeout(timer.current);
|
|
2243
|
-
timer.current = null;
|
|
2244
|
-
}, []);
|
|
2245
2240
|
if (open2 !== wasOpen) {
|
|
2246
2241
|
setWasOpen(open2);
|
|
2247
|
-
|
|
2242
|
+
setExiting(!open2);
|
|
2248
2243
|
}
|
|
2249
2244
|
React8.useEffect(() => {
|
|
2250
|
-
if (
|
|
2251
|
-
timer
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
}, durationMs);
|
|
2255
|
-
return cancel;
|
|
2256
|
-
}, [exit, durationMs, cancel]);
|
|
2257
|
-
React8.useEffect(() => {
|
|
2258
|
-
if (!open2 && exit === null) cancel();
|
|
2259
|
-
}, [open2, exit, cancel]);
|
|
2260
|
-
React8.useEffect(() => cancel, [cancel]);
|
|
2245
|
+
if (!exiting) return;
|
|
2246
|
+
const timer = setTimeout(() => setExiting(false), durationMs);
|
|
2247
|
+
return () => clearTimeout(timer);
|
|
2248
|
+
}, [exiting, durationMs]);
|
|
2261
2249
|
const close2 = React8.useCallback(() => {
|
|
2262
|
-
if (
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
timer.current = setTimeout(() => {
|
|
2266
|
-
timer.current = null;
|
|
2267
|
-
onClose();
|
|
2268
|
-
}, durationMs);
|
|
2269
|
-
}, [onClose, open2, durationMs, cancel]);
|
|
2270
|
-
const exiting = exit === "parent";
|
|
2271
|
-
return { closing: exit !== null, close: close2, rendered: open2 || exiting, exiting };
|
|
2250
|
+
if (onClose && open2) onClose();
|
|
2251
|
+
}, [onClose, open2]);
|
|
2252
|
+
return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
|
|
2272
2253
|
}
|
|
2273
2254
|
|
|
2274
2255
|
// src/kits/inertWhen.ts
|
|
@@ -6572,11 +6553,12 @@ function isZeroDelta(delta) {
|
|
|
6572
6553
|
return match !== null && parseFloat(match[0]) === 0;
|
|
6573
6554
|
}
|
|
6574
6555
|
function StatTile(props) {
|
|
6575
|
-
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;
|
|
6576
6557
|
const isDecrease = delta?.startsWith("-") ?? false;
|
|
6577
6558
|
const isZero = isZeroDelta(delta);
|
|
6578
6559
|
const isGood = invert ? isDecrease : !isDecrease;
|
|
6579
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;
|
|
6580
6562
|
const content = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
6581
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: [
|
|
6582
6564
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-figure", children: value }),
|
|
@@ -6587,12 +6569,25 @@ function StatTile(props) {
|
|
|
6587
6569
|
] }) : null
|
|
6588
6570
|
] }),
|
|
6589
6571
|
!loading && sub ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-stat-sub", children: sub }) : null,
|
|
6590
|
-
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.
|
|
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
|
+
] })
|
|
6591
6576
|
] });
|
|
6592
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);
|
|
6593
6580
|
if (rest.onPress) {
|
|
6594
6581
|
const { onPress, pressed, disabled = false, ...buttonRest } = rest;
|
|
6595
|
-
|
|
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
|
+
] });
|
|
6596
6591
|
}
|
|
6597
6592
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: classes(), ...rest, children: content });
|
|
6598
6593
|
}
|