@apteva/apteva-kit 0.1.106 → 0.1.108
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -3
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1854,9 +1854,10 @@ var trendIcons = {
|
|
|
1854
1854
|
flat: { symbol: "\u2192", color: "text-neutral-400" }
|
|
1855
1855
|
};
|
|
1856
1856
|
function Kpi({ widget, onAction }) {
|
|
1857
|
-
const { label = "", value = "", change, trend } = widget.props || {};
|
|
1857
|
+
const { title, label = "", value = "", change, trend } = widget.props || {};
|
|
1858
1858
|
const trendInfo = trend ? trendIcons[trend] : null;
|
|
1859
1859
|
return /* @__PURE__ */ jsxs7("div", { className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 p-5", children: [
|
|
1860
|
+
title && /* @__PURE__ */ jsx9("h3", { className: "!text-base font-semibold !text-neutral-900 dark:!text-white mb-3", children: title }),
|
|
1860
1861
|
/* @__PURE__ */ jsx9("div", { className: "!text-sm font-medium !text-neutral-500 dark:!text-neutral-400 mb-1", children: label }),
|
|
1861
1862
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-end gap-2", children: [
|
|
1862
1863
|
/* @__PURE__ */ jsx9("div", { className: "!text-2xl font-bold !text-neutral-900 dark:!text-white", children: value }),
|
|
@@ -3971,6 +3972,30 @@ ${widgetContext}` : widgetContext;
|
|
|
3971
3972
|
}
|
|
3972
3973
|
};
|
|
3973
3974
|
const defaultPlaceholder = mode === "chat" ? "Type a message..." : "Enter your command...";
|
|
3975
|
+
const handleWidgetAction = useCallback2((action) => {
|
|
3976
|
+
onAction?.(action);
|
|
3977
|
+
if (action.type === "submit" && action.payload?.formData) {
|
|
3978
|
+
const formData = action.payload.formData;
|
|
3979
|
+
const lines = [];
|
|
3980
|
+
for (const [key, value] of Object.entries(formData)) {
|
|
3981
|
+
if (Array.isArray(value) && value.length > 0 && value[0] instanceof File) {
|
|
3982
|
+
const fileNames = value.map((f) => f.name).join(", ");
|
|
3983
|
+
lines.push(`${key}: ${fileNames}`);
|
|
3984
|
+
} else if (value !== "" && value !== false && value != null) {
|
|
3985
|
+
lines.push(`${key}: ${value}`);
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
if (lines.length > 0 && handleSendMessageRef.current) {
|
|
3989
|
+
const files = [];
|
|
3990
|
+
for (const value of Object.values(formData)) {
|
|
3991
|
+
if (Array.isArray(value) && value.length > 0 && value[0] instanceof File) {
|
|
3992
|
+
files.push(...value);
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
handleSendMessageRef.current(lines.join("\n"), files.length > 0 ? files : void 0);
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}, [onAction]);
|
|
3974
3999
|
const handleSendMessage = async (text, files, isSystem) => {
|
|
3975
4000
|
const hasFiles = files && files.length > 0;
|
|
3976
4001
|
const attachments = hasFiles ? files.map((f) => ({
|
|
@@ -4473,12 +4498,12 @@ ${planToExecute}`;
|
|
|
4473
4498
|
] })
|
|
4474
4499
|
] }) }),
|
|
4475
4500
|
mode === "chat" && /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
4476
|
-
persistentWidgetList.length > 0 && /* @__PURE__ */ jsx26(PersistentWidgetPanel, { widgets: persistentWidgetList, onAction }),
|
|
4501
|
+
persistentWidgetList.length > 0 && /* @__PURE__ */ jsx26(PersistentWidgetPanel, { widgets: persistentWidgetList, onAction: handleWidgetAction }),
|
|
4477
4502
|
/* @__PURE__ */ jsx26(
|
|
4478
4503
|
MessageList,
|
|
4479
4504
|
{
|
|
4480
4505
|
messages,
|
|
4481
|
-
onAction,
|
|
4506
|
+
onAction: handleWidgetAction,
|
|
4482
4507
|
welcomeTitle,
|
|
4483
4508
|
welcomeSubtitle,
|
|
4484
4509
|
welcomeIcon,
|