dp-widgets-framework 1.2.0 → 1.2.2
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.esm.js +25 -38
- package/dist/index.js +25 -38
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1584,7 +1584,7 @@ const alertVariants = cva("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7
|
|
|
1584
1584
|
variants: {
|
|
1585
1585
|
variant: {
|
|
1586
1586
|
default: "bg-background text-foreground",
|
|
1587
|
-
destructive: "border-destructive/50 text-destructive
|
|
1587
|
+
destructive: "border-destructive/50 text-destructive [&>svg]:text-destructive",
|
|
1588
1588
|
},
|
|
1589
1589
|
},
|
|
1590
1590
|
defaultVariants: {
|
|
@@ -2100,20 +2100,6 @@ function shuffleColors(colors, count) {
|
|
|
2100
2100
|
}
|
|
2101
2101
|
return shuffled.slice(0, count);
|
|
2102
2102
|
}
|
|
2103
|
-
function shuffleColorsWithPriority(colors, count, priorityColors = []) {
|
|
2104
|
-
const available = [...colors];
|
|
2105
|
-
priorityColors.forEach(c => {
|
|
2106
|
-
const idx = available.indexOf(c);
|
|
2107
|
-
if (idx > -1)
|
|
2108
|
-
available.splice(idx, 1);
|
|
2109
|
-
});
|
|
2110
|
-
for (let i = available.length - 1; i > 0; i--) {
|
|
2111
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
2112
|
-
[available[i], available[j]] = [available[j], available[i]];
|
|
2113
|
-
}
|
|
2114
|
-
const finalColors = [...priorityColors, ...available];
|
|
2115
|
-
return finalColors.slice(0, count);
|
|
2116
|
-
}
|
|
2117
2103
|
function getBorderRadiusValue(value) {
|
|
2118
2104
|
switch (value) {
|
|
2119
2105
|
case "none":
|
|
@@ -15403,16 +15389,16 @@ function DataGrid({ title, data, className }) {
|
|
|
15403
15389
|
const renderGroupedTable = () => {
|
|
15404
15390
|
if (!(grouping === null || grouping === void 0 ? void 0 : grouping.sections))
|
|
15405
15391
|
return null;
|
|
15406
|
-
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200
|
|
15392
|
+
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200", children: [jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50 w-8" }), columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index)))] }) }), jsxRuntimeExports.jsx("tbody", { children: grouping.sections.map((section, sectionIndex) => {
|
|
15407
15393
|
const isExpanded = expandedGroups.has(section.group_value);
|
|
15408
|
-
return (jsxRuntimeExports.jsxs(React__default.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50
|
|
15409
|
-
? "bg-white
|
|
15410
|
-
: "bg-gray-50
|
|
15394
|
+
return (jsxRuntimeExports.jsxs(React__default.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), jsxRuntimeExports.jsx("td", { colSpan: columns.length, className: "px-4 py-3 text-sm font-semibold text-blue-900", children: jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: jsxRuntimeExports.jsxs("span", { children: [section.title, ": ", section.group_value, " (", section.row_count, " row", section.row_count !== 1 ? "s" : "", ")"] }) }) })] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15395
|
+
? "bg-white"
|
|
15396
|
+
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3" }), row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
|
|
15411
15397
|
}) })] }));
|
|
15412
15398
|
};
|
|
15413
|
-
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200
|
|
15414
|
-
? "bg-white
|
|
15415
|
-
: "bg-gray-50
|
|
15399
|
+
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200", children: columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15400
|
+
? "bg-white"
|
|
15401
|
+
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex))) }, rowIndex))) })] }));
|
|
15416
15402
|
const getTotalRowCount = () => {
|
|
15417
15403
|
if (grouped && (grouping === null || grouping === void 0 ? void 0 : grouping.sections)) {
|
|
15418
15404
|
return grouping.sections.reduce((total, section) => total + section.row_count, 0);
|
|
@@ -15421,7 +15407,7 @@ function DataGrid({ title, data, className }) {
|
|
|
15421
15407
|
};
|
|
15422
15408
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
15423
15409
|
color: "#0F172A"
|
|
15424
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500
|
|
15410
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping ? (jsxRuntimeExports.jsxs("span", { children: ["Showing ", getTotalRowCount(), " row", getTotalRowCount() !== 1 ? "s" : "", " in ", grouping.total_groups, " group", grouping.total_groups !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) : (jsxRuntimeExports.jsxs("span", { children: ["Showing ", rows.length, " row", rows.length !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) })] }));
|
|
15425
15411
|
}
|
|
15426
15412
|
|
|
15427
15413
|
function ok$1() {}
|
|
@@ -36079,7 +36065,7 @@ function SummaryWidget({ title, data, metadata, className }) {
|
|
|
36079
36065
|
}
|
|
36080
36066
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
36081
36067
|
color: "#0F172A"
|
|
36082
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto space-y-4", children: jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none", children: jsxRuntimeExports.jsx(Markdown, { className: "text-gray-800
|
|
36068
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto space-y-4", children: jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none", children: jsxRuntimeExports.jsx(Markdown, { className: "text-gray-800", children: data.content }) }) })] }));
|
|
36083
36069
|
}
|
|
36084
36070
|
|
|
36085
36071
|
const CHART_REFRESH_TIMEOUT = 3000;
|
|
@@ -36420,13 +36406,14 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36420
36406
|
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36421
36407
|
}
|
|
36422
36408
|
function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36423
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
36409
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
36424
36410
|
const hasCalledRef = useRef(false);
|
|
36425
36411
|
const labels = ((_b = (_a = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _c === void 0 ? void 0 : _c.pie_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36426
|
-
const
|
|
36427
|
-
((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.
|
|
36428
|
-
|
|
36429
|
-
const
|
|
36412
|
+
const colors = ((_g = (_f = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.colors) || ((_k = (_j = (_h = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _h === void 0 ? void 0 : _h.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.colors) || [];
|
|
36413
|
+
const values = ((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.values) || ((_q = (_p = (_o = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _o === void 0 ? void 0 : _o.pie_chart_data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.values) || [];
|
|
36414
|
+
((_s = (_r = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.percentages) || ((_v = (_u = (_t = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _t === void 0 ? void 0 : _t.pie_chart_data) === null || _u === void 0 ? void 0 : _u.data) === null || _v === void 0 ? void 0 : _v.percentages) || [];
|
|
36415
|
+
const chartTitle = ((_w = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _w === void 0 ? void 0 : _w.title) || ((_y = (_x = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _x === void 0 ? void 0 : _x.pie_chart_data) === null || _y === void 0 ? void 0 : _y.title) || "";
|
|
36416
|
+
const units = ((_z = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _z === void 0 ? void 0 : _z.units) || ((_1 = (_0 = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _0 === void 0 ? void 0 : _0.pie_chart_data) === null || _1 === void 0 ? void 0 : _1.units) || "";
|
|
36430
36417
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36431
36418
|
const handleRefresh = async () => {
|
|
36432
36419
|
if (query) {
|
|
@@ -36456,7 +36443,7 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36456
36443
|
}
|
|
36457
36444
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36458
36445
|
const backgroundColors = useMemo(() => {
|
|
36459
|
-
return
|
|
36446
|
+
return shuffleColors(DEFAULT_COLORS, labels.length);
|
|
36460
36447
|
}, [labels.length]);
|
|
36461
36448
|
if (isEmpty) {
|
|
36462
36449
|
return createLoadingComponent();
|
|
@@ -36467,7 +36454,7 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36467
36454
|
{
|
|
36468
36455
|
label: chartTitle || "Data",
|
|
36469
36456
|
data: values,
|
|
36470
|
-
backgroundColor: labels.map((_, index) => backgroundColors[index % backgroundColors.length]),
|
|
36457
|
+
backgroundColor: colors || labels.map((_, index) => backgroundColors[index % backgroundColors.length]),
|
|
36471
36458
|
borderWidth: 0,
|
|
36472
36459
|
},
|
|
36473
36460
|
],
|
|
@@ -36891,7 +36878,7 @@ function Modal({ isOpen, onClose, title, children, size = 'md', initialFocusRef,
|
|
|
36891
36878
|
lg: 'max-w-lg',
|
|
36892
36879
|
xl: 'max-w-xl',
|
|
36893
36880
|
};
|
|
36894
|
-
return (jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", "aria-labelledby": "modal-title", role: "dialog", "aria-modal": "true", children: jsxRuntimeExports.jsxs("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: [jsxRuntimeExports.jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity", "aria-hidden": "true", onClick: onClose }), jsxRuntimeExports.jsx("div", { ref: modalRef, className: clsx$1(`relative transform ${noOverflowHidden ? "" : "overflow-hidden"} rounded-lg bg-white
|
|
36881
|
+
return (jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", "aria-labelledby": "modal-title", role: "dialog", "aria-modal": "true", children: jsxRuntimeExports.jsxs("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: [jsxRuntimeExports.jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity", "aria-hidden": "true", onClick: onClose }), jsxRuntimeExports.jsx("div", { ref: modalRef, className: clsx$1(`relative transform ${noOverflowHidden ? "" : "overflow-hidden"} rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full`, sizeClasses[size]), children: jsxRuntimeExports.jsxs("div", { className: `bg-white px-4 pb-4 pt-5 ${noOverflowHidden ? "rounded-lg" : ""} sm:p-6 sm:pb-4`, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between mb-4", children: [jsxRuntimeExports.jsx("h3", { id: "modal-title", className: "text-lg font-semibold text-gray-900", children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: "p-1 text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Close modal", children: jsxRuntimeExports.jsx(X, { className: "w-5 h-5" }) })] }), jsxRuntimeExports.jsx("div", { children: children })] }) })] }) }));
|
|
36895
36882
|
}
|
|
36896
36883
|
|
|
36897
36884
|
function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onClose, onSubmit }) {
|
|
@@ -36950,10 +36937,10 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
|
|
|
36950
36937
|
console.log(editingWidget, "==> editingWidget");
|
|
36951
36938
|
return (jsxRuntimeExports.jsx(Modal, { isOpen: isOpen, onClose: onClose, title: "Edit Widget", size: "lg",
|
|
36952
36939
|
// initialFocusRef={inputRef}
|
|
36953
|
-
noOverflowHidden: true, children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: "text-gray-700
|
|
36940
|
+
noOverflowHidden: true, children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: "text-gray-700", children: "Customize the widget\u2019s appearance" }), jsxRuntimeExports.jsx("div", { className: "pt-7", children: (editingWidget === null || editingWidget === void 0 ? void 0 : editingWidget.type) === "text" ?
|
|
36954
36941
|
jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-5", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Display text:" }), jsxRuntimeExports.jsx(Input, { value: displayText, onChange: (e) => setDisplayText(e.target.value), className: "h-8" })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Block type:" }), jsxRuntimeExports.jsxs(Select, { value: blockType, onValueChange: (value) => setBlockType(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }), jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }), jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }), jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Align:" }), jsxRuntimeExports.jsxs(Select, { value: alignment, onValueChange: (value) => setAlignment(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }), jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }), jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Divider:" }), jsxRuntimeExports.jsxs(Select, { value: divider, onValueChange: (value) => setDivider(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }), jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })] })] })] }), jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2", children: "Submit" }) })] })
|
|
36955
36942
|
:
|
|
36956
|
-
jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }), jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2
|
|
36943
|
+
jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }), jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2", value: query, onChange: (e) => { var _a; return setQuery((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value); } })] }), jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-3", children: jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2", children: "Submit" }) })] }) })] }) }));
|
|
36957
36944
|
}
|
|
36958
36945
|
|
|
36959
36946
|
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent" }) {
|
|
@@ -37136,10 +37123,10 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
37136
37123
|
return null;
|
|
37137
37124
|
return (jsxRuntimeExports.jsx(Modal, { isOpen: isOpen, onClose: onClose, title: showConfigStep ? `Configure ${(_a = widgetOptions.find(w => w.type === selectedWidgetType)) === null || _a === void 0 ? void 0 : _a.title}` : 'Add Widget', size: "lg",
|
|
37138
37125
|
// initialFocusRef={inputRef}
|
|
37139
|
-
noOverflowHidden: true, children: jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { className: "pt-4", children: !showConfigStep ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-4", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700
|
|
37126
|
+
noOverflowHidden: true, children: jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { className: "pt-4", children: !showConfigStep ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-4", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: "Choose a widget to add to your dashboard:" }) }), jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3 max-h-[400px] overflow-y-auto", children: widgetOptions.map((widget) => {
|
|
37140
37127
|
const IconComponent = widget.icon;
|
|
37141
|
-
return (jsxRuntimeExports.jsxs("button", { onClick: () => handleWidgetSelect(widget.type), className: "flex items-start gap-3 p-4 border border-slate-200 rounded-lg hover:bg-gray-50
|
|
37142
|
-
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700
|
|
37128
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: () => handleWidgetSelect(widget.type), className: "flex items-start gap-3 p-4 border border-slate-200 rounded-lg hover:bg-gray-50 transition-colors text-left", children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 p-2 bg-primary-100 rounded-md", children: jsxRuntimeExports.jsx(IconComponent, { className: "w-5 h-5 text-primary-600" }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [jsxRuntimeExports.jsx("h3", { className: "font-medium text-sm", children: widget.title }), jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 !mt-1", children: widget.description })] })] }, widget.type));
|
|
37129
|
+
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === 'chatbot'
|
|
37143
37130
|
? 'Chatbot widget will be configured with the default agent.'
|
|
37144
37131
|
: 'Enter a query for your chart widget:' }) }), (selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart' || selectedWidgetType === 'data-grid' || selectedWidgetType === 'summary') && (jsxRuntimeExports.jsx("div", { className: "mb-6", children: jsxRuntimeExports.jsx(Textarea, { value: query, onChange: (e) => setQuery(e.target.value), placeholder: "e.g., List out the product types by its count and render it on bar chart", className: "w-full h-24 resize-none" }) })), jsxRuntimeExports.jsxs("div", { className: "flex gap-3 justify-end", children: [jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: () => setShowConfigStep(false), children: "Back" }), jsxRuntimeExports.jsx(Button, { onClick: handleConfigSubmit, disabled: (selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart' || selectedWidgetType === 'data-grid' || selectedWidgetType === 'summary') && !query.trim(), children: "Add Widget" })] })] })) }) }) }));
|
|
37145
37132
|
}
|
|
@@ -37667,7 +37654,7 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
37667
37654
|
var _a, _b;
|
|
37668
37655
|
return (jsxRuntimeExports.jsxs("div", { className: `${w.type === "text" ? `${((_b = (_a = w === null || w === void 0 ? void 0 : w.config) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? 'shadow-lg rounded-xl border border-primary-300' : 'flex items-center'}` : `shadow-lg rounded-xl border border-primary-300 p-4 ${isEditing ? 'pb-20' : 'pb-14'}`} overflow-hidden`, children: [isEditing &&
|
|
37669
37656
|
jsxRuntimeExports.jsxs("div", { className: `flex items-center justify-end mb-4 relative ${w.type === "text" ? "pl-4 pr-4 pt-4" : ""}`, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center drag-icon cursor-grab absolute left-1/2 -translate-x-1/2", children: [jsxRuntimeExports.jsx(GripHorizontal, { className: "" }), jsxRuntimeExports.jsx(GripHorizontal, { className: "-ml-[3px]" }), jsxRuntimeExports.jsx(GripHorizontal, { className: "-ml-[3px]" })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 cursor-pointer justify-end", children: [jsxRuntimeExports.jsx(Trash2, { onClick: () => removeWidget(w.id), className: "w-5 h-5 text-red-700" }), jsxRuntimeExports.jsx(Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })] })] }), jsxRuntimeExports.jsxs("div", { className: `${(w === null || w === void 0 ? void 0 : w.type) === 'text' ? `${isEditing ? 'px-4' : ''}` : "h-full"} w-full relative`, children: [(w === null || w === void 0 ? void 0 : w.type) === "chatbot" &&
|
|
37670
|
-
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm
|
|
37657
|
+
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm w-fit bg-primary-700 text-white cursor-pointer shadow-md transition-all", children: jsxRuntimeExports.jsx(MessageCircleX, { className: "w-5 h-5" }) }), jsxRuntimeExports.jsx("span", { className: `absolute top-[56px] right-[16px] z-50 w-max py-1 text-xs px-2 rounded-sm text-white bg-gray-950 ${visibleClearButton ? "block" : "hidden"}`, children: "Clear Chat" })] }), jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl: widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter(widget => widget.type !== 'chatbot').map(widget => widget.id), datasetId: datasetId })] })] }, w.id));
|
|
37671
37658
|
}) })) })] }));
|
|
37672
37659
|
}
|
|
37673
37660
|
|
package/dist/index.js
CHANGED
|
@@ -1611,7 +1611,7 @@ const alertVariants = classVarianceAuthority.cva("relative w-full rounded-lg bor
|
|
|
1611
1611
|
variants: {
|
|
1612
1612
|
variant: {
|
|
1613
1613
|
default: "bg-background text-foreground",
|
|
1614
|
-
destructive: "border-destructive/50 text-destructive
|
|
1614
|
+
destructive: "border-destructive/50 text-destructive [&>svg]:text-destructive",
|
|
1615
1615
|
},
|
|
1616
1616
|
},
|
|
1617
1617
|
defaultVariants: {
|
|
@@ -2127,20 +2127,6 @@ function shuffleColors(colors, count) {
|
|
|
2127
2127
|
}
|
|
2128
2128
|
return shuffled.slice(0, count);
|
|
2129
2129
|
}
|
|
2130
|
-
function shuffleColorsWithPriority(colors, count, priorityColors = []) {
|
|
2131
|
-
const available = [...colors];
|
|
2132
|
-
priorityColors.forEach(c => {
|
|
2133
|
-
const idx = available.indexOf(c);
|
|
2134
|
-
if (idx > -1)
|
|
2135
|
-
available.splice(idx, 1);
|
|
2136
|
-
});
|
|
2137
|
-
for (let i = available.length - 1; i > 0; i--) {
|
|
2138
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
2139
|
-
[available[i], available[j]] = [available[j], available[i]];
|
|
2140
|
-
}
|
|
2141
|
-
const finalColors = [...priorityColors, ...available];
|
|
2142
|
-
return finalColors.slice(0, count);
|
|
2143
|
-
}
|
|
2144
2130
|
function getBorderRadiusValue(value) {
|
|
2145
2131
|
switch (value) {
|
|
2146
2132
|
case "none":
|
|
@@ -15430,16 +15416,16 @@ function DataGrid({ title, data, className }) {
|
|
|
15430
15416
|
const renderGroupedTable = () => {
|
|
15431
15417
|
if (!(grouping === null || grouping === void 0 ? void 0 : grouping.sections))
|
|
15432
15418
|
return null;
|
|
15433
|
-
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200
|
|
15419
|
+
return (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsxs("tr", { className: "border-b border-gray-200", children: [jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50 w-8" }), columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index)))] }) }), jsxRuntimeExports.jsx("tbody", { children: grouping.sections.map((section, sectionIndex) => {
|
|
15434
15420
|
const isExpanded = expandedGroups.has(section.group_value);
|
|
15435
|
-
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50
|
|
15436
|
-
? "bg-white
|
|
15437
|
-
: "bg-gray-50
|
|
15421
|
+
return (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsxs("tr", { className: "bg-blue-50 border-b border-gray-200", children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3", children: section.collapsible && (jsxRuntimeExports.jsx("button", { onClick: () => toggleGroup(section.group_value), className: "flex items-center justify-center w-6 h-6 hover:bg-blue-100 rounded transition-colors", "aria-label": isExpanded ? "Collapse group" : "Expand group", children: isExpanded ? (jsxRuntimeExports.jsx(lucideReact.ChevronDown, { className: "w-4 h-4 text-blue-600" })) : (jsxRuntimeExports.jsx(lucideReact.ChevronRight, { className: "w-4 h-4 text-blue-600" })) })) }), jsxRuntimeExports.jsx("td", { colSpan: columns.length, className: "px-4 py-3 text-sm font-semibold text-blue-900", children: jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: jsxRuntimeExports.jsxs("span", { children: [section.title, ": ", section.group_value, " (", section.row_count, " row", section.row_count !== 1 ? "s" : "", ")"] }) }) })] }), (!section.collapsible || isExpanded) && section.rows.map((row, rowIndex) => (jsxRuntimeExports.jsxs("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15422
|
+
? "bg-white"
|
|
15423
|
+
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: [jsxRuntimeExports.jsx("td", { className: "px-4 py-3" }), row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex)))] }, `${sectionIndex}-${rowIndex}`)))] }, `section-${sectionIndex}`));
|
|
15438
15424
|
}) })] }));
|
|
15439
15425
|
};
|
|
15440
|
-
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200
|
|
15441
|
-
? "bg-white
|
|
15442
|
-
: "bg-gray-50
|
|
15426
|
+
const renderRegularTable = () => (jsxRuntimeExports.jsxs("table", { className: "w-full border-collapse", children: [jsxRuntimeExports.jsx("thead", { children: jsxRuntimeExports.jsx("tr", { className: "border-b border-gray-200", children: columns.map((column, index) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-sm font-medium text-gray-900 bg-gray-50", children: column }, index))) }) }), jsxRuntimeExports.jsx("tbody", { children: rows.map((row, rowIndex) => (jsxRuntimeExports.jsx("tr", { className: `border-b border-gray-200 ${rowIndex % 2 === 0
|
|
15427
|
+
? "bg-white"
|
|
15428
|
+
: "bg-gray-50"} hover:bg-gray-100 transition-colors`, children: row.map((cell, cellIndex) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 text-sm text-gray-900", children: cell !== null && cell !== undefined ? String(cell) : "—" }, cellIndex))) }, rowIndex))) })] }));
|
|
15443
15429
|
const getTotalRowCount = () => {
|
|
15444
15430
|
if (grouped && (grouping === null || grouping === void 0 ? void 0 : grouping.sections)) {
|
|
15445
15431
|
return grouping.sections.reduce((total, section) => total + section.row_count, 0);
|
|
@@ -15448,7 +15434,7 @@ function DataGrid({ title, data, className }) {
|
|
|
15448
15434
|
};
|
|
15449
15435
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
15450
15436
|
color: "#0F172A"
|
|
15451
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500
|
|
15437
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: jsxRuntimeExports.jsx("div", { className: "min-w-full", children: grouped && grouping ? renderGroupedTable() : renderRegularTable() }) }), jsxRuntimeExports.jsx("div", { className: "pt-2 text-xs text-gray-500", children: grouped && grouping ? (jsxRuntimeExports.jsxs("span", { children: ["Showing ", getTotalRowCount(), " row", getTotalRowCount() !== 1 ? "s" : "", " in ", grouping.total_groups, " group", grouping.total_groups !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) : (jsxRuntimeExports.jsxs("span", { children: ["Showing ", rows.length, " row", rows.length !== 1 ? "s" : "", " \u00D7 ", columns.length, " column", columns.length !== 1 ? "s" : ""] })) })] }));
|
|
15452
15438
|
}
|
|
15453
15439
|
|
|
15454
15440
|
function ok$1() {}
|
|
@@ -36106,7 +36092,7 @@ function SummaryWidget({ title, data, metadata, className }) {
|
|
|
36106
36092
|
}
|
|
36107
36093
|
return (jsxRuntimeExports.jsxs("div", { className: `h-full flex flex-col ${className || ""}`, children: [title && (jsxRuntimeExports.jsx("div", { className: "pb-4", children: jsxRuntimeExports.jsx("h3", { className: "text-lg font-bold", style: {
|
|
36108
36094
|
color: "#0F172A"
|
|
36109
|
-
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto space-y-4", children: jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none", children: jsxRuntimeExports.jsx(Markdown, { className: "text-gray-800
|
|
36095
|
+
}, children: title }) })), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto space-y-4", children: jsxRuntimeExports.jsx("div", { className: "prose prose-sm max-w-none", children: jsxRuntimeExports.jsx(Markdown, { className: "text-gray-800", children: data.content }) }) })] }));
|
|
36110
36096
|
}
|
|
36111
36097
|
|
|
36112
36098
|
const CHART_REFRESH_TIMEOUT = 3000;
|
|
@@ -36447,13 +36433,14 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36447
36433
|
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36448
36434
|
}
|
|
36449
36435
|
function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36450
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
36436
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
36451
36437
|
const hasCalledRef = React.useRef(false);
|
|
36452
36438
|
const labels = ((_b = (_a = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _c === void 0 ? void 0 : _c.pie_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36453
|
-
const
|
|
36454
|
-
((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.
|
|
36455
|
-
|
|
36456
|
-
const
|
|
36439
|
+
const colors = ((_g = (_f = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.colors) || ((_k = (_j = (_h = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _h === void 0 ? void 0 : _h.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.colors) || [];
|
|
36440
|
+
const values = ((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.values) || ((_q = (_p = (_o = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _o === void 0 ? void 0 : _o.pie_chart_data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.values) || [];
|
|
36441
|
+
((_s = (_r = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.percentages) || ((_v = (_u = (_t = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _t === void 0 ? void 0 : _t.pie_chart_data) === null || _u === void 0 ? void 0 : _u.data) === null || _v === void 0 ? void 0 : _v.percentages) || [];
|
|
36442
|
+
const chartTitle = ((_w = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _w === void 0 ? void 0 : _w.title) || ((_y = (_x = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _x === void 0 ? void 0 : _x.pie_chart_data) === null || _y === void 0 ? void 0 : _y.title) || "";
|
|
36443
|
+
const units = ((_z = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _z === void 0 ? void 0 : _z.units) || ((_1 = (_0 = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _0 === void 0 ? void 0 : _0.pie_chart_data) === null || _1 === void 0 ? void 0 : _1.units) || "";
|
|
36457
36444
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36458
36445
|
const handleRefresh = async () => {
|
|
36459
36446
|
if (query) {
|
|
@@ -36483,7 +36470,7 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36483
36470
|
}
|
|
36484
36471
|
}, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
|
|
36485
36472
|
const backgroundColors = React.useMemo(() => {
|
|
36486
|
-
return
|
|
36473
|
+
return shuffleColors(DEFAULT_COLORS, labels.length);
|
|
36487
36474
|
}, [labels.length]);
|
|
36488
36475
|
if (isEmpty) {
|
|
36489
36476
|
return createLoadingComponent();
|
|
@@ -36494,7 +36481,7 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36494
36481
|
{
|
|
36495
36482
|
label: chartTitle || "Data",
|
|
36496
36483
|
data: values,
|
|
36497
|
-
backgroundColor: labels.map((_, index) => backgroundColors[index % backgroundColors.length]),
|
|
36484
|
+
backgroundColor: colors || labels.map((_, index) => backgroundColors[index % backgroundColors.length]),
|
|
36498
36485
|
borderWidth: 0,
|
|
36499
36486
|
},
|
|
36500
36487
|
],
|
|
@@ -36918,7 +36905,7 @@ function Modal({ isOpen, onClose, title, children, size = 'md', initialFocusRef,
|
|
|
36918
36905
|
lg: 'max-w-lg',
|
|
36919
36906
|
xl: 'max-w-xl',
|
|
36920
36907
|
};
|
|
36921
|
-
return (jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", "aria-labelledby": "modal-title", role: "dialog", "aria-modal": "true", children: jsxRuntimeExports.jsxs("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: [jsxRuntimeExports.jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity", "aria-hidden": "true", onClick: onClose }), jsxRuntimeExports.jsx("div", { ref: modalRef, className: clsx(`relative transform ${noOverflowHidden ? "" : "overflow-hidden"} rounded-lg bg-white
|
|
36908
|
+
return (jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", "aria-labelledby": "modal-title", role: "dialog", "aria-modal": "true", children: jsxRuntimeExports.jsxs("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: [jsxRuntimeExports.jsx("div", { className: "fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity", "aria-hidden": "true", onClick: onClose }), jsxRuntimeExports.jsx("div", { ref: modalRef, className: clsx(`relative transform ${noOverflowHidden ? "" : "overflow-hidden"} rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full`, sizeClasses[size]), children: jsxRuntimeExports.jsxs("div", { className: `bg-white px-4 pb-4 pt-5 ${noOverflowHidden ? "rounded-lg" : ""} sm:p-6 sm:pb-4`, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between mb-4", children: [jsxRuntimeExports.jsx("h3", { id: "modal-title", className: "text-lg font-semibold text-gray-900", children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, className: "p-1 text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Close modal", children: jsxRuntimeExports.jsx(lucideReact.X, { className: "w-5 h-5" }) })] }), jsxRuntimeExports.jsx("div", { children: children })] }) })] }) }));
|
|
36922
36909
|
}
|
|
36923
36910
|
|
|
36924
36911
|
function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onClose, onSubmit }) {
|
|
@@ -36977,10 +36964,10 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
|
|
|
36977
36964
|
console.log(editingWidget, "==> editingWidget");
|
|
36978
36965
|
return (jsxRuntimeExports.jsx(Modal, { isOpen: isOpen, onClose: onClose, title: "Edit Widget", size: "lg",
|
|
36979
36966
|
// initialFocusRef={inputRef}
|
|
36980
|
-
noOverflowHidden: true, children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: "text-gray-700
|
|
36967
|
+
noOverflowHidden: true, children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsx("p", { className: "text-gray-700", children: "Customize the widget\u2019s appearance" }), jsxRuntimeExports.jsx("div", { className: "pt-7", children: (editingWidget === null || editingWidget === void 0 ? void 0 : editingWidget.type) === "text" ?
|
|
36981
36968
|
jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-5", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Display text:" }), jsxRuntimeExports.jsx(Input, { value: displayText, onChange: (e) => setDisplayText(e.target.value), className: "h-8" })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Block type:" }), jsxRuntimeExports.jsxs(Select, { value: blockType, onValueChange: (value) => setBlockType(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }), jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }), jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }), jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Align:" }), jsxRuntimeExports.jsxs(Select, { value: alignment, onValueChange: (value) => setAlignment(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }), jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }), jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }), jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })] })] })] }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Divider:" }), jsxRuntimeExports.jsxs(Select, { value: divider, onValueChange: (value) => setDivider(value), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }), jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })] })] })] }), jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2", children: "Submit" }) })] })
|
|
36982
36969
|
:
|
|
36983
|
-
jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }), jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2
|
|
36970
|
+
jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }), jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2", value: query, onChange: (e) => { var _a; return setQuery((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value); } })] }), jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-3", children: jsxRuntimeExports.jsx("button", { onClick: handleSubmit, className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2", children: "Submit" }) })] }) })] }) }));
|
|
36984
36971
|
}
|
|
36985
36972
|
|
|
36986
36973
|
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent" }) {
|
|
@@ -37163,10 +37150,10 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
37163
37150
|
return null;
|
|
37164
37151
|
return (jsxRuntimeExports.jsx(Modal, { isOpen: isOpen, onClose: onClose, title: showConfigStep ? `Configure ${(_a = widgetOptions.find(w => w.type === selectedWidgetType)) === null || _a === void 0 ? void 0 : _a.title}` : 'Add Widget', size: "lg",
|
|
37165
37152
|
// initialFocusRef={inputRef}
|
|
37166
|
-
noOverflowHidden: true, children: jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { className: "pt-4", children: !showConfigStep ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-4", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700
|
|
37153
|
+
noOverflowHidden: true, children: jsxRuntimeExports.jsx("div", { children: jsxRuntimeExports.jsx("div", { className: "pt-4", children: !showConfigStep ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-4", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: "Choose a widget to add to your dashboard:" }) }), jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3 max-h-[400px] overflow-y-auto", children: widgetOptions.map((widget) => {
|
|
37167
37154
|
const IconComponent = widget.icon;
|
|
37168
|
-
return (jsxRuntimeExports.jsxs("button", { onClick: () => handleWidgetSelect(widget.type), className: "flex items-start gap-3 p-4 border border-slate-200 rounded-lg hover:bg-gray-50
|
|
37169
|
-
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700
|
|
37155
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: () => handleWidgetSelect(widget.type), className: "flex items-start gap-3 p-4 border border-slate-200 rounded-lg hover:bg-gray-50 transition-colors text-left", children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 p-2 bg-primary-100 rounded-md", children: jsxRuntimeExports.jsx(IconComponent, { className: "w-5 h-5 text-primary-600" }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [jsxRuntimeExports.jsx("h3", { className: "font-medium text-sm", children: widget.title }), jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500 !mt-1", children: widget.description })] })] }, widget.type));
|
|
37156
|
+
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === 'chatbot'
|
|
37170
37157
|
? 'Chatbot widget will be configured with the default agent.'
|
|
37171
37158
|
: 'Enter a query for your chart widget:' }) }), (selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart' || selectedWidgetType === 'data-grid' || selectedWidgetType === 'summary') && (jsxRuntimeExports.jsx("div", { className: "mb-6", children: jsxRuntimeExports.jsx(Textarea, { value: query, onChange: (e) => setQuery(e.target.value), placeholder: "e.g., List out the product types by its count and render it on bar chart", className: "w-full h-24 resize-none" }) })), jsxRuntimeExports.jsxs("div", { className: "flex gap-3 justify-end", children: [jsxRuntimeExports.jsx(Button, { variant: "outline", onClick: () => setShowConfigStep(false), children: "Back" }), jsxRuntimeExports.jsx(Button, { onClick: handleConfigSubmit, disabled: (selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart' || selectedWidgetType === 'data-grid' || selectedWidgetType === 'summary') && !query.trim(), children: "Add Widget" })] })] })) }) }) }));
|
|
37172
37159
|
}
|
|
@@ -37694,7 +37681,7 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
37694
37681
|
var _a, _b;
|
|
37695
37682
|
return (jsxRuntimeExports.jsxs("div", { className: `${w.type === "text" ? `${((_b = (_a = w === null || w === void 0 ? void 0 : w.config) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? 'shadow-lg rounded-xl border border-primary-300' : 'flex items-center'}` : `shadow-lg rounded-xl border border-primary-300 p-4 ${isEditing ? 'pb-20' : 'pb-14'}`} overflow-hidden`, children: [isEditing &&
|
|
37696
37683
|
jsxRuntimeExports.jsxs("div", { className: `flex items-center justify-end mb-4 relative ${w.type === "text" ? "pl-4 pr-4 pt-4" : ""}`, children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center drag-icon cursor-grab absolute left-1/2 -translate-x-1/2", children: [jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "" }), jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "-ml-[3px]" }), jsxRuntimeExports.jsx(lucideReact.GripHorizontal, { className: "-ml-[3px]" })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 cursor-pointer justify-end", children: [jsxRuntimeExports.jsx(lucideReact.Trash2, { onClick: () => removeWidget(w.id), className: "w-5 h-5 text-red-700" }), jsxRuntimeExports.jsx(lucideReact.Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })] })] }), jsxRuntimeExports.jsxs("div", { className: `${(w === null || w === void 0 ? void 0 : w.type) === 'text' ? `${isEditing ? 'px-4' : ''}` : "h-full"} w-full relative`, children: [(w === null || w === void 0 ? void 0 : w.type) === "chatbot" &&
|
|
37697
|
-
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm
|
|
37684
|
+
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w.id), onMouseOver: () => setVisibleClearButton(true), onMouseLeave: () => setVisibleClearButton(false), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm w-fit bg-primary-700 text-white cursor-pointer shadow-md transition-all", children: jsxRuntimeExports.jsx(lucideReact.MessageCircleX, { className: "w-5 h-5" }) }), jsxRuntimeExports.jsx("span", { className: `absolute top-[56px] right-[16px] z-50 w-max py-1 text-xs px-2 rounded-sm text-white bg-gray-950 ${visibleClearButton ? "block" : "hidden"}`, children: "Clear Chat" })] }), jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl: widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter(widget => widget.type !== 'chatbot').map(widget => widget.id), datasetId: datasetId })] })] }, w.id));
|
|
37698
37685
|
}) })) })] }));
|
|
37699
37686
|
}
|
|
37700
37687
|
|