@flytedan/flytebot-design-system 0.76.0 → 0.78.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 +78 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +82 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +13 -1
package/dist/index.cjs
CHANGED
|
@@ -930,6 +930,7 @@ __export(index_exports, {
|
|
|
930
930
|
CHAT_UNAVAILABLE: () => CHAT_UNAVAILABLE,
|
|
931
931
|
COPIED_FEEDBACK_MS: () => COPIED_FEEDBACK_MS,
|
|
932
932
|
CORNER_STACK_INSET_PROPERTY: () => CORNER_STACK_INSET_PROPERTY,
|
|
933
|
+
CORNER_STACK_OFFSET_PROPERTY: () => CORNER_STACK_OFFSET_PROPERTY,
|
|
933
934
|
Calendar: () => Calendar,
|
|
934
935
|
Card: () => Card,
|
|
935
936
|
CardGrid: () => CardGrid,
|
|
@@ -1036,6 +1037,7 @@ __export(index_exports, {
|
|
|
1036
1037
|
RoadmapTimeline: () => RoadmapTimeline,
|
|
1037
1038
|
RunActions: () => RunActions,
|
|
1038
1039
|
RuntimeKit: () => RuntimeKit,
|
|
1040
|
+
SHEET_OPEN_ATTRIBUTE: () => SHEET_OPEN_ATTRIBUTE,
|
|
1039
1041
|
SaturationDistribution: () => SaturationDistribution,
|
|
1040
1042
|
ScoreMeter: () => ScoreMeter,
|
|
1041
1043
|
ScreenHead: () => ScreenHead,
|
|
@@ -1140,10 +1142,12 @@ __export(index_exports, {
|
|
|
1140
1142
|
useLayerZIndex: () => useLayerZIndex,
|
|
1141
1143
|
useOverlayLayout: () => useOverlayLayout,
|
|
1142
1144
|
usePopoverPosition: () => usePopoverPosition,
|
|
1145
|
+
usePublishCornerStackOffset: () => usePublishCornerStackOffset,
|
|
1143
1146
|
useResponsiveRail: () => useResponsiveRail,
|
|
1144
1147
|
useRuntimeMode: () => useRuntimeMode,
|
|
1145
1148
|
useServerTable: () => useServerTable,
|
|
1146
1149
|
useSessionContext: () => useSessionContext,
|
|
1150
|
+
useSheetOpenMark: () => useSheetOpenMark,
|
|
1147
1151
|
useStackedLayer: () => useStackedLayer,
|
|
1148
1152
|
useStagedFiles: () => useStagedFiles,
|
|
1149
1153
|
useToast: () => useToast,
|
|
@@ -2423,6 +2427,30 @@ function CornerStackPortal({ slot, children }) {
|
|
|
2423
2427
|
const element = useCornerStackSlot(slot);
|
|
2424
2428
|
return element ? (0, import_react_dom5.createPortal)(children, element) : null;
|
|
2425
2429
|
}
|
|
2430
|
+
var CORNER_STACK_OFFSET_PROPERTY = "--fd-corner-stack-offset";
|
|
2431
|
+
var SHEET_OPEN_ATTRIBUTE = "data-fd-sheet-open";
|
|
2432
|
+
function usePublishCornerStackOffset(ref, active) {
|
|
2433
|
+
useSlotEffect(() => {
|
|
2434
|
+
const el = ref.current;
|
|
2435
|
+
if (!active || !el) return;
|
|
2436
|
+
const root = document.documentElement;
|
|
2437
|
+
const publish = () => root.style.setProperty(CORNER_STACK_OFFSET_PROPERTY, `${el.getBoundingClientRect().width}px`);
|
|
2438
|
+
publish();
|
|
2439
|
+
const observer = typeof ResizeObserver === "function" ? new ResizeObserver(publish) : null;
|
|
2440
|
+
observer?.observe(el);
|
|
2441
|
+
return () => {
|
|
2442
|
+
observer?.disconnect();
|
|
2443
|
+
root.style.removeProperty(CORNER_STACK_OFFSET_PROPERTY);
|
|
2444
|
+
};
|
|
2445
|
+
}, [ref, active]);
|
|
2446
|
+
}
|
|
2447
|
+
function useSheetOpenMark(active) {
|
|
2448
|
+
useSlotEffect(() => {
|
|
2449
|
+
if (!active) return;
|
|
2450
|
+
document.documentElement.setAttribute(SHEET_OPEN_ATTRIBUTE, "");
|
|
2451
|
+
return () => document.documentElement.removeAttribute(SHEET_OPEN_ATTRIBUTE);
|
|
2452
|
+
}, [active]);
|
|
2453
|
+
}
|
|
2426
2454
|
|
|
2427
2455
|
// src/components/loading/ProgressBar.tsx
|
|
2428
2456
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -2819,6 +2847,8 @@ function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }
|
|
|
2819
2847
|
const { width, setWidth } = useResizableWidth(widthOptions);
|
|
2820
2848
|
const drag = React19.useRef(null);
|
|
2821
2849
|
const [resizing, setResizing] = React19.useState(false);
|
|
2850
|
+
const boxRef = React19.useRef(null);
|
|
2851
|
+
usePublishCornerStackOffset(boxRef, rendered);
|
|
2822
2852
|
if (!rendered) return null;
|
|
2823
2853
|
const onPointerDown = (e) => {
|
|
2824
2854
|
e.preventDefault();
|
|
@@ -2842,6 +2872,7 @@ function DockedSidePanel({ open: open2, children: childrenNow, ...widthOptions }
|
|
|
2842
2872
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2843
2873
|
"div",
|
|
2844
2874
|
{
|
|
2875
|
+
ref: boxRef,
|
|
2845
2876
|
className: ["fd-sidepanel", animateEnter ? "is-entering" : "", closing ? "is-closing" : "", resizing ? "is-resizing" : ""].filter(Boolean).join(" "),
|
|
2846
2877
|
"data-open": open2 ? "true" : "false",
|
|
2847
2878
|
style: { width },
|
|
@@ -2903,6 +2934,7 @@ function AppShell({
|
|
|
2903
2934
|
initialOpen: initialNavOpen,
|
|
2904
2935
|
onPersist: onNavOpenChange
|
|
2905
2936
|
});
|
|
2937
|
+
useSheetOpenMark(Boolean(sidePanel?.open) && rail.overlay);
|
|
2906
2938
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2907
2939
|
"div",
|
|
2908
2940
|
{
|
|
@@ -14291,9 +14323,44 @@ function JsonView({ value }) {
|
|
|
14291
14323
|
}
|
|
14292
14324
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CodeBlock, { code: text, language: "json", collapseAfter: 18 });
|
|
14293
14325
|
}
|
|
14294
|
-
function
|
|
14326
|
+
function DecisionFooter({ packet, decision, state }) {
|
|
14327
|
+
const [pending, setPending] = React76.useState(null);
|
|
14328
|
+
const [failure, setFailure] = React76.useState(null);
|
|
14329
|
+
const mounted = React76.useRef(true);
|
|
14330
|
+
React76.useEffect(() => {
|
|
14331
|
+
mounted.current = true;
|
|
14332
|
+
return () => {
|
|
14333
|
+
mounted.current = false;
|
|
14334
|
+
};
|
|
14335
|
+
}, []);
|
|
14336
|
+
const press = (action) => {
|
|
14337
|
+
if (pending) return;
|
|
14338
|
+
setPending(action);
|
|
14339
|
+
setFailure(null);
|
|
14340
|
+
decision.onDecide(action, packet).then(
|
|
14341
|
+
() => {
|
|
14342
|
+
if (mounted.current) setPending(null);
|
|
14343
|
+
},
|
|
14344
|
+
(e) => {
|
|
14345
|
+
if (!mounted.current) return;
|
|
14346
|
+
setPending(null);
|
|
14347
|
+
setFailure(e instanceof Error && e.message ? e.message : "That didn\u2019t go through.");
|
|
14348
|
+
}
|
|
14349
|
+
);
|
|
14350
|
+
};
|
|
14351
|
+
const error = failure !== null ? failure : state.error;
|
|
14352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
14353
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "fdc-packet-decision-msg", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Banner, { tone: "danger", title: error }) }) : null,
|
|
14354
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("footer", { className: "fdc-packet-foot fdc-packet-decision", children: [
|
|
14355
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Button, { variant: "secondary", size: "sm", loading: pending === "dismiss", disabled: pending === "confirm", onClick: () => press("dismiss"), children: decision.dismissLabel || "Dismiss" }),
|
|
14356
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Button, { variant: "primary", size: "sm", loading: pending === "confirm", disabled: pending === "dismiss", onClick: () => press("confirm"), children: decision.confirmLabel || "Confirm" })
|
|
14357
|
+
] })
|
|
14358
|
+
] });
|
|
14359
|
+
}
|
|
14360
|
+
function PacketCard({ packet, schema, render, onApply, applied, decision }) {
|
|
14295
14361
|
if (!packet) return null;
|
|
14296
14362
|
const s = schema || {};
|
|
14363
|
+
const state = decision ? decision.state(packet) : {};
|
|
14297
14364
|
const invalid = packet.valid === false;
|
|
14298
14365
|
const title = s.heading || packet.type;
|
|
14299
14366
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("section", { className: "fdc-packet" + (invalid ? " is-invalid" : ""), "aria-label": title, children: [
|
|
@@ -14301,13 +14368,14 @@ function PacketCard({ packet, schema, render, onApply, applied }) {
|
|
|
14301
14368
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-" + (s.icon || "package"), "aria-hidden": "true" }),
|
|
14302
14369
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-title", title: truncationTitle(title), children: title }),
|
|
14303
14370
|
packet.repaired ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge", children: "Repaired" }) : null,
|
|
14304
|
-
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null
|
|
14371
|
+
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null,
|
|
14372
|
+
decision && state.status ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Badge, { tone: state.status.tone, children: state.status.label }) : null
|
|
14305
14373
|
] }),
|
|
14306
14374
|
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "fdc-packet-alert", role: "alert", children: [
|
|
14307
14375
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-warning-circle", "aria-hidden": "true" }),
|
|
14308
14376
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { children: packet.error || "This result failed validation and can\u2019t be applied." })
|
|
14309
14377
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "fdc-packet-body", children: render ? render(packet) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(JsonView, { value: packet.payload }) }),
|
|
14310
|
-
!invalid && onApply && s.apply !== false ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("footer", { className: "fdc-packet-foot", children: [
|
|
14378
|
+
!invalid && decision ? state.outcome ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "fdc-packet-decision-msg", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Banner, { tone: state.outcome.tone === "success" ? "ok" : "danger", role: "status", title: state.outcome.message }) }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(DecisionFooter, { packet, decision, state }) : !invalid && onApply && s.apply !== false ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("footer", { className: "fdc-packet-foot", children: [
|
|
14311
14379
|
packet.repaired ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-note", children: "Corrected by the backend after a first attempt." }) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", {}),
|
|
14312
14380
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("button", { type: "button", className: "fd-btn fd-btn-primary fd-btn-sm", disabled: applied, onClick: () => onApply(packet), children: [
|
|
14313
14381
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-" + (applied ? "check" : "arrow-square-in"), "aria-hidden": "true" }),
|
|
@@ -14389,6 +14457,7 @@ function MessageBody({ message: m, ctx }) {
|
|
|
14389
14457
|
schema: (ctx.packetSchemas || {})[m.packet.type],
|
|
14390
14458
|
render: (ctx.packetRenderers || {})[m.packet.type],
|
|
14391
14459
|
onApply: ctx.onApplyPacket,
|
|
14460
|
+
decision: (ctx.packetDecisions || {})[m.packet.type],
|
|
14392
14461
|
applied: ctx.appliedPackets && ctx.appliedPackets[m.id]
|
|
14393
14462
|
}
|
|
14394
14463
|
) : null,
|
|
@@ -15107,6 +15176,7 @@ function AgentChatPanel({
|
|
|
15107
15176
|
renderEmpty,
|
|
15108
15177
|
packetSchemas,
|
|
15109
15178
|
packetRenderers,
|
|
15179
|
+
packetDecisions,
|
|
15110
15180
|
onApplyPacket,
|
|
15111
15181
|
pendingTimeoutMs,
|
|
15112
15182
|
describeWaiting,
|
|
@@ -15196,6 +15266,7 @@ function AgentChatPanel({
|
|
|
15196
15266
|
showThinking,
|
|
15197
15267
|
packetSchemas,
|
|
15198
15268
|
packetRenderers,
|
|
15269
|
+
packetDecisions,
|
|
15199
15270
|
appliedPackets: applied,
|
|
15200
15271
|
narrow,
|
|
15201
15272
|
onOpenAttachment,
|
|
@@ -16632,6 +16703,7 @@ function useDocumentTitle(routeTitle, appName) {
|
|
|
16632
16703
|
CHAT_UNAVAILABLE,
|
|
16633
16704
|
COPIED_FEEDBACK_MS,
|
|
16634
16705
|
CORNER_STACK_INSET_PROPERTY,
|
|
16706
|
+
CORNER_STACK_OFFSET_PROPERTY,
|
|
16635
16707
|
Calendar,
|
|
16636
16708
|
Card,
|
|
16637
16709
|
CardGrid,
|
|
@@ -16738,6 +16810,7 @@ function useDocumentTitle(routeTitle, appName) {
|
|
|
16738
16810
|
RoadmapTimeline,
|
|
16739
16811
|
RunActions,
|
|
16740
16812
|
RuntimeKit,
|
|
16813
|
+
SHEET_OPEN_ATTRIBUTE,
|
|
16741
16814
|
SaturationDistribution,
|
|
16742
16815
|
ScoreMeter,
|
|
16743
16816
|
ScreenHead,
|
|
@@ -16842,10 +16915,12 @@ function useDocumentTitle(routeTitle, appName) {
|
|
|
16842
16915
|
useLayerZIndex,
|
|
16843
16916
|
useOverlayLayout,
|
|
16844
16917
|
usePopoverPosition,
|
|
16918
|
+
usePublishCornerStackOffset,
|
|
16845
16919
|
useResponsiveRail,
|
|
16846
16920
|
useRuntimeMode,
|
|
16847
16921
|
useServerTable,
|
|
16848
16922
|
useSessionContext,
|
|
16923
|
+
useSheetOpenMark,
|
|
16849
16924
|
useStackedLayer,
|
|
16850
16925
|
useStagedFiles,
|
|
16851
16926
|
useToast,
|