@flytedan/flytebot-design-system 0.77.0 → 0.78.1
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 +49 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +57 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +8 -0
package/dist/index.cjs
CHANGED
|
@@ -9599,6 +9599,7 @@ function CodeEditor({
|
|
|
9599
9599
|
const onChangeRef = React56.useRef(onChange);
|
|
9600
9600
|
onChangeRef.current = onChange;
|
|
9601
9601
|
const editableCompartment = React56.useRef(new import_state.Compartment()).current;
|
|
9602
|
+
const readOnlyCompartment = React56.useRef(new import_state.Compartment()).current;
|
|
9602
9603
|
const attributesCompartment = React56.useRef(new import_state.Compartment()).current;
|
|
9603
9604
|
const errorRef = React56.useRef(error);
|
|
9604
9605
|
errorRef.current = error;
|
|
@@ -9641,7 +9642,7 @@ function CodeEditor({
|
|
|
9641
9642
|
...import_commands.historyKeymap
|
|
9642
9643
|
]),
|
|
9643
9644
|
editableCompartment.of(import_view.EditorView.editable.of(!disabled)),
|
|
9644
|
-
import_state.EditorState.readOnly.of(readOnly),
|
|
9645
|
+
readOnlyCompartment.of(import_state.EditorState.readOnly.of(readOnly)),
|
|
9645
9646
|
updateListener,
|
|
9646
9647
|
attributesCompartment.of(import_view.EditorView.contentAttributes.of(contentAttributes()))
|
|
9647
9648
|
]
|
|
@@ -9668,6 +9669,11 @@ function CodeEditor({
|
|
|
9668
9669
|
if (!view) return;
|
|
9669
9670
|
view.dispatch({ effects: editableCompartment.reconfigure(import_view.EditorView.editable.of(!disabled)) });
|
|
9670
9671
|
}, [disabled, editableCompartment]);
|
|
9672
|
+
React56.useEffect(() => {
|
|
9673
|
+
const view = viewRef.current;
|
|
9674
|
+
if (!view) return;
|
|
9675
|
+
view.dispatch({ effects: readOnlyCompartment.reconfigure(import_state.EditorState.readOnly.of(readOnly)) });
|
|
9676
|
+
}, [readOnly, readOnlyCompartment]);
|
|
9671
9677
|
React56.useEffect(() => {
|
|
9672
9678
|
const view = viewRef.current;
|
|
9673
9679
|
if (!view) return;
|
|
@@ -14323,9 +14329,44 @@ function JsonView({ value }) {
|
|
|
14323
14329
|
}
|
|
14324
14330
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(CodeBlock, { code: text, language: "json", collapseAfter: 18 });
|
|
14325
14331
|
}
|
|
14326
|
-
function
|
|
14332
|
+
function DecisionFooter({ packet, decision, state }) {
|
|
14333
|
+
const [pending, setPending] = React76.useState(null);
|
|
14334
|
+
const [failure, setFailure] = React76.useState(null);
|
|
14335
|
+
const mounted = React76.useRef(true);
|
|
14336
|
+
React76.useEffect(() => {
|
|
14337
|
+
mounted.current = true;
|
|
14338
|
+
return () => {
|
|
14339
|
+
mounted.current = false;
|
|
14340
|
+
};
|
|
14341
|
+
}, []);
|
|
14342
|
+
const press = (action) => {
|
|
14343
|
+
if (pending) return;
|
|
14344
|
+
setPending(action);
|
|
14345
|
+
setFailure(null);
|
|
14346
|
+
decision.onDecide(action, packet).then(
|
|
14347
|
+
() => {
|
|
14348
|
+
if (mounted.current) setPending(null);
|
|
14349
|
+
},
|
|
14350
|
+
(e) => {
|
|
14351
|
+
if (!mounted.current) return;
|
|
14352
|
+
setPending(null);
|
|
14353
|
+
setFailure(e instanceof Error && e.message ? e.message : "That didn\u2019t go through.");
|
|
14354
|
+
}
|
|
14355
|
+
);
|
|
14356
|
+
};
|
|
14357
|
+
const error = failure !== null ? failure : state.error;
|
|
14358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
14359
|
+
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,
|
|
14360
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("footer", { className: "fdc-packet-foot fdc-packet-decision", children: [
|
|
14361
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Button, { variant: "secondary", size: "sm", loading: pending === "dismiss", disabled: pending === "confirm", onClick: () => press("dismiss"), children: decision.dismissLabel || "Dismiss" }),
|
|
14362
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Button, { variant: "primary", size: "sm", loading: pending === "confirm", disabled: pending === "dismiss", onClick: () => press("confirm"), children: decision.confirmLabel || "Confirm" })
|
|
14363
|
+
] })
|
|
14364
|
+
] });
|
|
14365
|
+
}
|
|
14366
|
+
function PacketCard({ packet, schema, render, onApply, applied, decision }) {
|
|
14327
14367
|
if (!packet) return null;
|
|
14328
14368
|
const s = schema || {};
|
|
14369
|
+
const state = decision ? decision.state(packet) : {};
|
|
14329
14370
|
const invalid = packet.valid === false;
|
|
14330
14371
|
const title = s.heading || packet.type;
|
|
14331
14372
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("section", { className: "fdc-packet" + (invalid ? " is-invalid" : ""), "aria-label": title, children: [
|
|
@@ -14333,13 +14374,14 @@ function PacketCard({ packet, schema, render, onApply, applied }) {
|
|
|
14333
14374
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-" + (s.icon || "package"), "aria-hidden": "true" }),
|
|
14334
14375
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-title", title: truncationTitle(title), children: title }),
|
|
14335
14376
|
packet.repaired ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge", children: "Repaired" }) : null,
|
|
14336
|
-
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null
|
|
14377
|
+
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "fdc-packet-badge is-danger", children: "Invalid" }) : null,
|
|
14378
|
+
decision && state.status ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Badge, { tone: state.status.tone, children: state.status.label }) : null
|
|
14337
14379
|
] }),
|
|
14338
14380
|
invalid ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "fdc-packet-alert", role: "alert", children: [
|
|
14339
14381
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-warning-circle", "aria-hidden": "true" }),
|
|
14340
14382
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { children: packet.error || "This result failed validation and can\u2019t be applied." })
|
|
14341
14383
|
] }) : /* @__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 }) }),
|
|
14342
|
-
!invalid && onApply && s.apply !== false ? /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("footer", { className: "fdc-packet-foot", children: [
|
|
14384
|
+
!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: [
|
|
14343
14385
|
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", {}),
|
|
14344
14386
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("button", { type: "button", className: "fd-btn fd-btn-primary fd-btn-sm", disabled: applied, onClick: () => onApply(packet), children: [
|
|
14345
14387
|
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("i", { className: "ph ph-" + (applied ? "check" : "arrow-square-in"), "aria-hidden": "true" }),
|
|
@@ -14421,6 +14463,7 @@ function MessageBody({ message: m, ctx }) {
|
|
|
14421
14463
|
schema: (ctx.packetSchemas || {})[m.packet.type],
|
|
14422
14464
|
render: (ctx.packetRenderers || {})[m.packet.type],
|
|
14423
14465
|
onApply: ctx.onApplyPacket,
|
|
14466
|
+
decision: (ctx.packetDecisions || {})[m.packet.type],
|
|
14424
14467
|
applied: ctx.appliedPackets && ctx.appliedPackets[m.id]
|
|
14425
14468
|
}
|
|
14426
14469
|
) : null,
|
|
@@ -15139,6 +15182,7 @@ function AgentChatPanel({
|
|
|
15139
15182
|
renderEmpty,
|
|
15140
15183
|
packetSchemas,
|
|
15141
15184
|
packetRenderers,
|
|
15185
|
+
packetDecisions,
|
|
15142
15186
|
onApplyPacket,
|
|
15143
15187
|
pendingTimeoutMs,
|
|
15144
15188
|
describeWaiting,
|
|
@@ -15228,6 +15272,7 @@ function AgentChatPanel({
|
|
|
15228
15272
|
showThinking,
|
|
15229
15273
|
packetSchemas,
|
|
15230
15274
|
packetRenderers,
|
|
15275
|
+
packetDecisions,
|
|
15231
15276
|
appliedPackets: applied,
|
|
15232
15277
|
narrow,
|
|
15233
15278
|
onOpenAttachment,
|