@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.d.cts
CHANGED
|
@@ -377,7 +377,7 @@ interface DrawerProps {
|
|
|
377
377
|
open?: boolean;
|
|
378
378
|
title?: React.ReactNode;
|
|
379
379
|
onClose?: () => void;
|
|
380
|
-
/** Plain content, or a render function receiving `close` — call it to
|
|
380
|
+
/** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
|
|
381
381
|
footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
|
|
382
382
|
/** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
|
|
383
383
|
* full viewport height. For content that already has its own header and close control (a chat panel).
|
|
@@ -403,7 +403,7 @@ interface ModalProps {
|
|
|
403
403
|
title?: React.ReactNode;
|
|
404
404
|
description?: React.ReactNode;
|
|
405
405
|
onClose?: () => void;
|
|
406
|
-
/** Plain content, or a render function receiving `close` — call it to
|
|
406
|
+
/** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
|
|
407
407
|
footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
|
|
408
408
|
/** 760px — for tables and side-by-side comparisons. */
|
|
409
409
|
wide?: boolean;
|
|
@@ -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
|
@@ -377,7 +377,7 @@ interface DrawerProps {
|
|
|
377
377
|
open?: boolean;
|
|
378
378
|
title?: React.ReactNode;
|
|
379
379
|
onClose?: () => void;
|
|
380
|
-
/** Plain content, or a render function receiving `close` — call it to
|
|
380
|
+
/** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
|
|
381
381
|
footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
|
|
382
382
|
/** The drawer's content owns the whole panel: no header bar and no body padding, and the panel is the
|
|
383
383
|
* full viewport height. For content that already has its own header and close control (a chat panel).
|
|
@@ -403,7 +403,7 @@ interface ModalProps {
|
|
|
403
403
|
title?: React.ReactNode;
|
|
404
404
|
description?: React.ReactNode;
|
|
405
405
|
onClose?: () => void;
|
|
406
|
-
/** Plain content, or a render function receiving `close` — call it to
|
|
406
|
+
/** Plain content, or a render function receiving `close` — call it to ask the app to close (it calls `onClose` at once; the exit animation plays when the app sets `open` false). */
|
|
407
407
|
footer?: React.ReactNode | ((close: () => void) => React.ReactNode);
|
|
408
408
|
/** 760px — for tables and side-by-side comparisons. */
|
|
409
409
|
wide?: boolean;
|
|
@@ -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
|
@@ -1054,40 +1054,21 @@ import { createPortal as createPortal2 } from "react-dom";
|
|
|
1054
1054
|
import * as React8 from "react";
|
|
1055
1055
|
var PANEL_EXIT_MS = 210;
|
|
1056
1056
|
function useClosingAnimation(open2, onClose, durationMs) {
|
|
1057
|
-
const [
|
|
1057
|
+
const [exiting, setExiting] = React8.useState(false);
|
|
1058
1058
|
const [wasOpen, setWasOpen] = React8.useState(open2);
|
|
1059
|
-
const timer = React8.useRef(null);
|
|
1060
|
-
const cancel = React8.useCallback(() => {
|
|
1061
|
-
if (timer.current !== null) clearTimeout(timer.current);
|
|
1062
|
-
timer.current = null;
|
|
1063
|
-
}, []);
|
|
1064
1059
|
if (open2 !== wasOpen) {
|
|
1065
1060
|
setWasOpen(open2);
|
|
1066
|
-
|
|
1061
|
+
setExiting(!open2);
|
|
1067
1062
|
}
|
|
1068
1063
|
React8.useEffect(() => {
|
|
1069
|
-
if (
|
|
1070
|
-
timer
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}, durationMs);
|
|
1074
|
-
return cancel;
|
|
1075
|
-
}, [exit, durationMs, cancel]);
|
|
1076
|
-
React8.useEffect(() => {
|
|
1077
|
-
if (!open2 && exit === null) cancel();
|
|
1078
|
-
}, [open2, exit, cancel]);
|
|
1079
|
-
React8.useEffect(() => cancel, [cancel]);
|
|
1064
|
+
if (!exiting) return;
|
|
1065
|
+
const timer = setTimeout(() => setExiting(false), durationMs);
|
|
1066
|
+
return () => clearTimeout(timer);
|
|
1067
|
+
}, [exiting, durationMs]);
|
|
1080
1068
|
const close2 = React8.useCallback(() => {
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
timer.current = setTimeout(() => {
|
|
1085
|
-
timer.current = null;
|
|
1086
|
-
onClose();
|
|
1087
|
-
}, durationMs);
|
|
1088
|
-
}, [onClose, open2, durationMs, cancel]);
|
|
1089
|
-
const exiting = exit === "parent";
|
|
1090
|
-
return { closing: exit !== null, close: close2, rendered: open2 || exiting, exiting };
|
|
1069
|
+
if (onClose && open2) onClose();
|
|
1070
|
+
}, [onClose, open2]);
|
|
1071
|
+
return { closing: exiting, close: close2, rendered: open2 || exiting, exiting };
|
|
1091
1072
|
}
|
|
1092
1073
|
|
|
1093
1074
|
// src/kits/inertWhen.ts
|
|
@@ -5391,11 +5372,12 @@ function isZeroDelta(delta) {
|
|
|
5391
5372
|
return match !== null && parseFloat(match[0]) === 0;
|
|
5392
5373
|
}
|
|
5393
5374
|
function StatTile(props) {
|
|
5394
|
-
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;
|
|
5395
5376
|
const isDecrease = delta?.startsWith("-") ?? false;
|
|
5396
5377
|
const isZero = isZeroDelta(delta);
|
|
5397
5378
|
const isGood = invert ? isDecrease : !isDecrease;
|
|
5398
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;
|
|
5399
5381
|
const content = /* @__PURE__ */ jsxs46(Fragment9, { children: [
|
|
5400
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: [
|
|
5401
5383
|
/* @__PURE__ */ jsx56("span", { className: "fd-stat-figure", children: value }),
|
|
@@ -5406,12 +5388,25 @@ function StatTile(props) {
|
|
|
5406
5388
|
] }) : null
|
|
5407
5389
|
] }),
|
|
5408
5390
|
!loading && sub ? /* @__PURE__ */ jsx56("span", { className: "fd-stat-sub", children: sub }) : null,
|
|
5409
|
-
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
|
+
] })
|
|
5410
5395
|
] });
|
|
5411
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);
|
|
5412
5399
|
if (rest.onPress) {
|
|
5413
5400
|
const { onPress, pressed, disabled = false, ...buttonRest } = rest;
|
|
5414
|
-
|
|
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
|
+
] });
|
|
5415
5410
|
}
|
|
5416
5411
|
return /* @__PURE__ */ jsx56("div", { className: classes(), ...rest, children: content });
|
|
5417
5412
|
}
|