dp-widgets-framework 1.5.2 → 1.5.4
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 +19 -14
- package/dist/index.js +19 -14
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -39279,7 +39279,7 @@ const createLoadingComponent$4 = (message = "Loading filter data...") => (jsxRun
|
|
|
39279
39279
|
const createInitialFilterState = (datasetId, filterData) => {
|
|
39280
39280
|
return {
|
|
39281
39281
|
column_values: filterData || [],
|
|
39282
|
-
|
|
39282
|
+
dashboard_id: datasetId || ""
|
|
39283
39283
|
};
|
|
39284
39284
|
};
|
|
39285
39285
|
const loadAgentState$4 = async (widgetBackendUrl, threadId, agentName) => {
|
|
@@ -39342,7 +39342,7 @@ const convertFilterStateToGroups = (filterState) => {
|
|
|
39342
39342
|
return [];
|
|
39343
39343
|
}
|
|
39344
39344
|
return filterState.column_values.map((filter) => ({
|
|
39345
|
-
id: `${filter.
|
|
39345
|
+
id: `${filter.column}`,
|
|
39346
39346
|
name: filter.column.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase()),
|
|
39347
39347
|
options: filter.values.map((value) => ({
|
|
39348
39348
|
id: value.toLowerCase().replace(/\s+/g, '-'),
|
|
@@ -39350,7 +39350,7 @@ const convertFilterStateToGroups = (filterState) => {
|
|
|
39350
39350
|
})),
|
|
39351
39351
|
}));
|
|
39352
39352
|
};
|
|
39353
|
-
function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout, filterState, onApplyFilters, }) {
|
|
39353
|
+
function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout, filterState, onApplyFilters, isEditing = false, }) {
|
|
39354
39354
|
const hasCalledRef = useRef(false);
|
|
39355
39355
|
const [expandedGroups, setExpandedGroups] = useState({});
|
|
39356
39356
|
const [selectedFilters, setSelectedFilters] = useState({});
|
|
@@ -39455,9 +39455,9 @@ function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appe
|
|
|
39455
39455
|
if (onFilterChange) {
|
|
39456
39456
|
onFilterChange({});
|
|
39457
39457
|
}
|
|
39458
|
-
}, className: "py-1.5 text-sm font-medium text-primary-600 hover:text-primary-800 hover:bg-primary-50 rounded-md transition-colors px-2", children: "Clear All Filters" })) : (jsxRuntimeExports.jsx("div", {})), jsxRuntimeExports.jsx(Button, { onClick: () => { onApplyFilters === null || onApplyFilters === void 0 ? void 0 : onApplyFilters(selectedFilters); }, className:
|
|
39458
|
+
}, className: "py-1.5 text-sm font-medium text-primary-600 hover:text-primary-800 hover:bg-primary-50 rounded-md transition-colors px-2", children: "Clear All Filters" })) : (jsxRuntimeExports.jsx("div", {})), jsxRuntimeExports.jsx(Button, { onClick: () => { onApplyFilters === null || onApplyFilters === void 0 ? void 0 : onApplyFilters(selectedFilters); }, disabled: isEditing, className: `${isEditing ? 'bg-gray-400 cursor-not-allowed' : 'bg-primary-600 hover:bg-primary-700'} text-white`, title: isEditing ? 'Save the layout first to apply filters' : '', children: "Apply Filters" })] }) })] }));
|
|
39459
39459
|
}
|
|
39460
|
-
function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, widgetBackendUrl, datasetId, onApplyFilters, }) {
|
|
39460
|
+
function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, widgetBackendUrl, datasetId, onApplyFilters, isEditing = false, }) {
|
|
39461
39461
|
var _a, _b, _c, _d, _e, _f;
|
|
39462
39462
|
const isFirstLoad = (_a = widget.config) === null || _a === void 0 ? void 0 : _a.isFirstLoad;
|
|
39463
39463
|
const widget_data = (_b = widget.widget_data) === null || _b === void 0 ? void 0 : _b.column_values;
|
|
@@ -39566,9 +39566,9 @@ function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, w
|
|
|
39566
39566
|
const filterGroups = convertFilterStateToGroups(filterState);
|
|
39567
39567
|
return (jsxRuntimeExports.jsx("div", { className: cn("flex flex-col h-full"), children: (filterState === null || filterState === void 0 ? void 0 : filterState.agent_message) &&
|
|
39568
39568
|
(!((_e = filterState.column_values) === null || _e === void 0 ? void 0 : _e.length))
|
|
39569
|
-
? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-4", children: jsxRuntimeExports.jsx("div", { className: "text-center max-w-md", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: filterState.agent_message }) }) })) : (jsxRuntimeExports.jsx(FiltersContent, { filterGroups: filterGroups, showHeader: showHeader, onFilterChange: onFilterChange, widget: widget, appendMessage: appendMessage, query: (_f = widget.config) === null || _f === void 0 ? void 0 : _f.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout, filterState: filterState, onApplyFilters: onApplyFilters })) }));
|
|
39569
|
+
? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-4", children: jsxRuntimeExports.jsx("div", { className: "text-center max-w-md", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: filterState.agent_message }) }) })) : (jsxRuntimeExports.jsx(FiltersContent, { filterGroups: filterGroups, showHeader: showHeader, onFilterChange: onFilterChange, widget: widget, appendMessage: appendMessage, query: (_f = widget.config) === null || _f === void 0 ? void 0 : _f.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout, filterState: filterState, onApplyFilters: onApplyFilters, isEditing: isEditing })) }));
|
|
39570
39570
|
}
|
|
39571
|
-
function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChange, widgetBackendUrl, onResetReady, datasetId, onApplyFilters, }) {
|
|
39571
|
+
function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChange, widgetBackendUrl, onResetReady, datasetId, onApplyFilters, isEditing = false, }) {
|
|
39572
39572
|
var _a;
|
|
39573
39573
|
const getRuntimeUrl = () => {
|
|
39574
39574
|
var _a;
|
|
@@ -39576,7 +39576,7 @@ function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChan
|
|
|
39576
39576
|
const agentName = ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || 'default-agent';
|
|
39577
39577
|
return `${baseUrl}/api/copilot/${agentName}`;
|
|
39578
39578
|
};
|
|
39579
|
-
return (jsxRuntimeExports.jsx(CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitFilters, { widget: widget, showHeader: showHeader, onFilterChange: onFilterChange, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId, onApplyFilters: onApplyFilters }) }));
|
|
39579
|
+
return (jsxRuntimeExports.jsx(CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitFilters, { widget: widget, showHeader: showHeader, onFilterChange: onFilterChange, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId, onApplyFilters: onApplyFilters, isEditing: isEditing }) }));
|
|
39580
39580
|
}
|
|
39581
39581
|
|
|
39582
39582
|
const CHART_REFRESH_TIMEOUT$3 = 3000;
|
|
@@ -40787,7 +40787,7 @@ function DatagridWidget({ widget, showHeader = true, widgetBackendUrl, onResetRe
|
|
|
40787
40787
|
return (jsxRuntimeExports.jsx(CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitDataGrid, { widget: widget, showHeader: showHeader, styles: styles, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId }) }));
|
|
40788
40788
|
}
|
|
40789
40789
|
|
|
40790
|
-
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, datasetId, onApplyFilters, }) {
|
|
40790
|
+
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, datasetId, pageId, onApplyFilters, isEditing = false, }) {
|
|
40791
40791
|
const handleConfigUpdate = (config) => {
|
|
40792
40792
|
if (onConfigUpdate) {
|
|
40793
40793
|
onConfigUpdate(widget.id, config);
|
|
@@ -40813,7 +40813,7 @@ function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBack
|
|
|
40813
40813
|
case "chatbot":
|
|
40814
40814
|
return jsxRuntimeExports.jsx(ChatbotWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId });
|
|
40815
40815
|
case "filters":
|
|
40816
|
-
return (jsxRuntimeExports.jsx(FiltersWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, datasetId:
|
|
40816
|
+
return (jsxRuntimeExports.jsx(FiltersWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, datasetId: pageId, onConfigUpdate: handleConfigUpdate, onApplyFilters: onApplyFilters, isEditing: isEditing }));
|
|
40817
40817
|
case "agent":
|
|
40818
40818
|
return widget.config.agentType === "Pie Chart Agent" ? (jsxRuntimeExports.jsx(PieChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Series Bar Chart Agent" ? (jsxRuntimeExports.jsx(SeriesBarChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Series Line Chart Agent" ? (jsxRuntimeExports.jsx(SeriesLineChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Data Grid Agent" ? (jsxRuntimeExports.jsx(DatagridWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : (jsxRuntimeExports.jsx(AgentWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId }));
|
|
40819
40819
|
default:
|
|
@@ -40957,7 +40957,7 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
|
|
|
40957
40957
|
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" }) })] })] })] }) }));
|
|
40958
40958
|
}
|
|
40959
40959
|
|
|
40960
|
-
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent" }) {
|
|
40960
|
+
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent", hasFiltersWidget = false }) {
|
|
40961
40961
|
var _a;
|
|
40962
40962
|
const [selectedWidgetType, setSelectedWidgetType] = useState(null);
|
|
40963
40963
|
const [query, setQuery] = useState('');
|
|
@@ -41176,7 +41176,12 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
41176
41176
|
// initialFocusRef={inputRef}
|
|
41177
41177
|
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) => {
|
|
41178
41178
|
const IconComponent = widget.icon;
|
|
41179
|
-
|
|
41179
|
+
const isFiltersDisabled = widget.type === 'filters' && hasFiltersWidget;
|
|
41180
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: () => !isFiltersDisabled && handleWidgetSelect(widget.type), disabled: isFiltersDisabled, className: `flex items-start gap-3 p-4 border border-slate-200 rounded-lg transition-colors text-left ${isFiltersDisabled
|
|
41181
|
+
? 'opacity-50 cursor-not-allowed bg-gray-100'
|
|
41182
|
+
: 'hover:bg-gray-50 cursor-pointer'}`, children: [jsxRuntimeExports.jsx("div", { className: `flex-shrink-0 p-2 rounded-md ${isFiltersDisabled ? 'bg-gray-200' : 'bg-primary-100'}`, children: jsxRuntimeExports.jsx(IconComponent, { className: `w-5 h-5 ${isFiltersDisabled ? 'text-gray-400' : 'text-primary-600'}` }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [jsxRuntimeExports.jsx("h3", { className: `font-medium text-sm ${isFiltersDisabled ? 'text-gray-400' : ''}`, children: widget.title }), jsxRuntimeExports.jsx("p", { className: `text-xs !mt-1 ${isFiltersDisabled ? 'text-gray-400' : 'text-gray-500'}`, children: isFiltersDisabled
|
|
41183
|
+
? 'Only one Filters Widget is allowed per dashboard'
|
|
41184
|
+
: widget.description })] })] }, widget.type));
|
|
41180
41185
|
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [(selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart') && (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 mb-4 mt-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: "Data Labels:" }), jsxRuntimeExports.jsxs(Select, { value: showLabels ? "yes" : "no", onValueChange: (value) => setShowLabels(value === "yes"), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Visible data labels?" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }), jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })] })] })] })), jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === 'chatbot'
|
|
41181
41186
|
? 'Chatbot widget will be configured with the default agent.'
|
|
41182
41187
|
: selectedWidgetType === 'text' ? "Customize the widget's appearance"
|
|
@@ -41702,11 +41707,11 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
41702
41707
|
return (jsxRuntimeExports.jsxs("div", { className: "w-full max-w-full p-4 bg-accent/5", children: [jsxRuntimeExports.jsx(AddWidgetDialog, { isOpen: openWidgetPallete, onClose: onCloseWidgetPallete || (() => { }), addWidgetFn: (widgetType, config) => {
|
|
41703
41708
|
addWidget(widgetType, config);
|
|
41704
41709
|
onCloseWidgetPallete && onCloseWidgetPallete();
|
|
41705
|
-
}, defaultAgentName: defaultAgentName }), jsxRuntimeExports.jsx(EditWidgetDialog, { editingWidget: editingWidget, setWidgets: setWidgets, initialText: editInitialQuery, isOpen: showEditModal, onClose: () => setShowEditModal(false), onSubmit: handleEditSubmit }), jsxRuntimeExports.jsx("div", { className: "min-h-full", onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, onClick: () => setSelectedWidget(null), children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsx(Loader2, { className: "h-8 w-8 animate-spin" }) })) : (jsxRuntimeExports.jsx(RGL, { className: "layout m-0 p-0 gap-2", layouts: { lg: getLayoutFromWidgets() }, breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480 }, cols: { lg: 12, md: 8, sm: 6, xs: 2 }, rowHeight: 60, isDraggable: isEditing, isResizable: isEditing, draggableHandle: ".drag-icon", onLayoutChange: handleLayoutChange, compactType: "vertical", containerPadding: [0, 0], margin: [16, 16], children: widgets.map((w) => {
|
|
41710
|
+
}, defaultAgentName: defaultAgentName, hasFiltersWidget: widgets.some(w => w.type === 'filters') }), jsxRuntimeExports.jsx(EditWidgetDialog, { editingWidget: editingWidget, setWidgets: setWidgets, initialText: editInitialQuery, isOpen: showEditModal, onClose: () => setShowEditModal(false), onSubmit: handleEditSubmit }), jsxRuntimeExports.jsx("div", { className: "min-h-full", onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, onClick: () => setSelectedWidget(null), children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsx(Loader2, { className: "h-8 w-8 animate-spin" }) })) : (jsxRuntimeExports.jsx(RGL, { className: "layout m-0 p-0 gap-2", layouts: { lg: getLayoutFromWidgets() }, breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480 }, cols: { lg: 12, md: 8, sm: 6, xs: 2 }, rowHeight: 60, isDraggable: isEditing, isResizable: isEditing, draggableHandle: ".drag-icon", onLayoutChange: handleLayoutChange, compactType: "vertical", containerPadding: [0, 0], margin: [16, 16], children: widgets.map((w) => {
|
|
41706
41711
|
var _a, _b;
|
|
41707
41712
|
return (jsxRuntimeExports.jsxs("div", { className: `${(w.type === "text" || w.type === "spacer") ? `${((_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-14' : 'pb-5'}`}`, children: [isEditing &&
|
|
41708
41713
|
jsxRuntimeExports.jsxs("div", { className: `flex items-center justify-end mb-4 relative ${(w.type === "text" || w.type === "spacer") ? "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" }), (w.type !== "spacer" && w.type !== "chatbot") && 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' || (w === null || w === void 0 ? void 0 : w.type) === 'spacer') ? `${isEditing ? 'px-4' : ''}` : "h-full"} w-full relative`, children: [(w === null || w === void 0 ? void 0 : w.type) === "chatbot" &&
|
|
41709
|
-
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w === null || w === void 0 ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w === null || w === void 0 ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), 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 === (w === null || w === void 0 ? void 0 : w.id) ? "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, onApplyFilters: onApplyFilters })] })] }, w.id));
|
|
41714
|
+
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w === null || w === void 0 ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w === null || w === void 0 ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), 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 === (w === null || w === void 0 ? void 0 : w.id) ? "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, pageId: pageId, onApplyFilters: onApplyFilters, isEditing: isEditing })] })] }, w.id));
|
|
41710
41715
|
}) })) })] }));
|
|
41711
41716
|
}
|
|
41712
41717
|
|
package/dist/index.js
CHANGED
|
@@ -39306,7 +39306,7 @@ const createLoadingComponent$4 = (message = "Loading filter data...") => (jsxRun
|
|
|
39306
39306
|
const createInitialFilterState = (datasetId, filterData) => {
|
|
39307
39307
|
return {
|
|
39308
39308
|
column_values: filterData || [],
|
|
39309
|
-
|
|
39309
|
+
dashboard_id: datasetId || ""
|
|
39310
39310
|
};
|
|
39311
39311
|
};
|
|
39312
39312
|
const loadAgentState$4 = async (widgetBackendUrl, threadId, agentName) => {
|
|
@@ -39369,7 +39369,7 @@ const convertFilterStateToGroups = (filterState) => {
|
|
|
39369
39369
|
return [];
|
|
39370
39370
|
}
|
|
39371
39371
|
return filterState.column_values.map((filter) => ({
|
|
39372
|
-
id: `${filter.
|
|
39372
|
+
id: `${filter.column}`,
|
|
39373
39373
|
name: filter.column.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase()),
|
|
39374
39374
|
options: filter.values.map((value) => ({
|
|
39375
39375
|
id: value.toLowerCase().replace(/\s+/g, '-'),
|
|
@@ -39377,7 +39377,7 @@ const convertFilterStateToGroups = (filterState) => {
|
|
|
39377
39377
|
})),
|
|
39378
39378
|
}));
|
|
39379
39379
|
};
|
|
39380
|
-
function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout, filterState, onApplyFilters, }) {
|
|
39380
|
+
function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout, filterState, onApplyFilters, isEditing = false, }) {
|
|
39381
39381
|
const hasCalledRef = React.useRef(false);
|
|
39382
39382
|
const [expandedGroups, setExpandedGroups] = React.useState({});
|
|
39383
39383
|
const [selectedFilters, setSelectedFilters] = React.useState({});
|
|
@@ -39482,9 +39482,9 @@ function FiltersContent({ filterGroups, showHeader, onFilterChange, widget, appe
|
|
|
39482
39482
|
if (onFilterChange) {
|
|
39483
39483
|
onFilterChange({});
|
|
39484
39484
|
}
|
|
39485
|
-
}, className: "py-1.5 text-sm font-medium text-primary-600 hover:text-primary-800 hover:bg-primary-50 rounded-md transition-colors px-2", children: "Clear All Filters" })) : (jsxRuntimeExports.jsx("div", {})), jsxRuntimeExports.jsx(Button, { onClick: () => { onApplyFilters === null || onApplyFilters === void 0 ? void 0 : onApplyFilters(selectedFilters); }, className:
|
|
39485
|
+
}, className: "py-1.5 text-sm font-medium text-primary-600 hover:text-primary-800 hover:bg-primary-50 rounded-md transition-colors px-2", children: "Clear All Filters" })) : (jsxRuntimeExports.jsx("div", {})), jsxRuntimeExports.jsx(Button, { onClick: () => { onApplyFilters === null || onApplyFilters === void 0 ? void 0 : onApplyFilters(selectedFilters); }, disabled: isEditing, className: `${isEditing ? 'bg-gray-400 cursor-not-allowed' : 'bg-primary-600 hover:bg-primary-700'} text-white`, title: isEditing ? 'Save the layout first to apply filters' : '', children: "Apply Filters" })] }) })] }));
|
|
39486
39486
|
}
|
|
39487
|
-
function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, widgetBackendUrl, datasetId, onApplyFilters, }) {
|
|
39487
|
+
function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, widgetBackendUrl, datasetId, onApplyFilters, isEditing = false, }) {
|
|
39488
39488
|
var _a, _b, _c, _d, _e, _f;
|
|
39489
39489
|
const isFirstLoad = (_a = widget.config) === null || _a === void 0 ? void 0 : _a.isFirstLoad;
|
|
39490
39490
|
const widget_data = (_b = widget.widget_data) === null || _b === void 0 ? void 0 : _b.column_values;
|
|
@@ -39593,9 +39593,9 @@ function CopilotKitFilters({ widget, showHeader, onFilterChange, onResetReady, w
|
|
|
39593
39593
|
const filterGroups = convertFilterStateToGroups(filterState);
|
|
39594
39594
|
return (jsxRuntimeExports.jsx("div", { className: cn("flex flex-col h-full"), children: (filterState === null || filterState === void 0 ? void 0 : filterState.agent_message) &&
|
|
39595
39595
|
(!((_e = filterState.column_values) === null || _e === void 0 ? void 0 : _e.length))
|
|
39596
|
-
? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-4", children: jsxRuntimeExports.jsx("div", { className: "text-center max-w-md", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: filterState.agent_message }) }) })) : (jsxRuntimeExports.jsx(FiltersContent, { filterGroups: filterGroups, showHeader: showHeader, onFilterChange: onFilterChange, widget: widget, appendMessage: appendMessage, query: (_f = widget.config) === null || _f === void 0 ? void 0 : _f.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout, filterState: filterState, onApplyFilters: onApplyFilters })) }));
|
|
39596
|
+
? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full p-4", children: jsxRuntimeExports.jsx("div", { className: "text-center max-w-md", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: filterState.agent_message }) }) })) : (jsxRuntimeExports.jsx(FiltersContent, { filterGroups: filterGroups, showHeader: showHeader, onFilterChange: onFilterChange, widget: widget, appendMessage: appendMessage, query: (_f = widget.config) === null || _f === void 0 ? void 0 : _f.query, isFirstLoad: isFirstLoad, widgetBackendUrl: widgetBackendUrl, widgetId: widget.id, startLoadingTimeout: startLoadingTimeout, clearLoadingTimeout: clearLoadingTimeout, filterState: filterState, onApplyFilters: onApplyFilters, isEditing: isEditing })) }));
|
|
39597
39597
|
}
|
|
39598
|
-
function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChange, widgetBackendUrl, onResetReady, datasetId, onApplyFilters, }) {
|
|
39598
|
+
function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChange, widgetBackendUrl, onResetReady, datasetId, onApplyFilters, isEditing = false, }) {
|
|
39599
39599
|
var _a;
|
|
39600
39600
|
const getRuntimeUrl = () => {
|
|
39601
39601
|
var _a;
|
|
@@ -39603,7 +39603,7 @@ function FiltersWidget({ widget, showHeader = true, onConfigUpdate, onFilterChan
|
|
|
39603
39603
|
const agentName = ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || 'default-agent';
|
|
39604
39604
|
return `${baseUrl}/api/copilot/${agentName}`;
|
|
39605
39605
|
};
|
|
39606
|
-
return (jsxRuntimeExports.jsx(reactCore.CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitFilters, { widget: widget, showHeader: showHeader, onFilterChange: onFilterChange, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId, onApplyFilters: onApplyFilters }) }));
|
|
39606
|
+
return (jsxRuntimeExports.jsx(reactCore.CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_a = widget.config) === null || _a === void 0 ? void 0 : _a.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitFilters, { widget: widget, showHeader: showHeader, onFilterChange: onFilterChange, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId, onApplyFilters: onApplyFilters, isEditing: isEditing }) }));
|
|
39607
39607
|
}
|
|
39608
39608
|
|
|
39609
39609
|
const CHART_REFRESH_TIMEOUT$3 = 3000;
|
|
@@ -40814,7 +40814,7 @@ function DatagridWidget({ widget, showHeader = true, widgetBackendUrl, onResetRe
|
|
|
40814
40814
|
return (jsxRuntimeExports.jsx(reactCore.CopilotKit, { runtimeUrl: getRuntimeUrl(), showDevConsole: false, agent: ((_b = widget.config) === null || _b === void 0 ? void 0 : _b.agentName) || "widget_assistant", children: jsxRuntimeExports.jsx(CopilotKitDataGrid, { widget: widget, showHeader: showHeader, styles: styles, onResetReady: onResetReady, widgetBackendUrl: widgetBackendUrl, datasetId: datasetId }) }));
|
|
40815
40815
|
}
|
|
40816
40816
|
|
|
40817
|
-
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, datasetId, onApplyFilters, }) {
|
|
40817
|
+
function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBackendUrl, onResetReady, widgetIds, datasetId, pageId, onApplyFilters, isEditing = false, }) {
|
|
40818
40818
|
const handleConfigUpdate = (config) => {
|
|
40819
40819
|
if (onConfigUpdate) {
|
|
40820
40820
|
onConfigUpdate(widget.id, config);
|
|
@@ -40840,7 +40840,7 @@ function WidgetRenderer({ widget, isTemplate = false, onConfigUpdate, widgetBack
|
|
|
40840
40840
|
case "chatbot":
|
|
40841
40841
|
return jsxRuntimeExports.jsx(ChatbotWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId });
|
|
40842
40842
|
case "filters":
|
|
40843
|
-
return (jsxRuntimeExports.jsx(FiltersWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, datasetId:
|
|
40843
|
+
return (jsxRuntimeExports.jsx(FiltersWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, datasetId: pageId, onConfigUpdate: handleConfigUpdate, onApplyFilters: onApplyFilters, isEditing: isEditing }));
|
|
40844
40844
|
case "agent":
|
|
40845
40845
|
return widget.config.agentType === "Pie Chart Agent" ? (jsxRuntimeExports.jsx(PieChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Series Bar Chart Agent" ? (jsxRuntimeExports.jsx(SeriesBarChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Series Line Chart Agent" ? (jsxRuntimeExports.jsx(SeriesLineChartWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : widget.config.agentType === "Data Grid Agent" ? (jsxRuntimeExports.jsx(DatagridWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId })) : (jsxRuntimeExports.jsx(AgentWidget, { widget: widget, showHeader: false, widgetBackendUrl: widgetBackendUrl, onResetReady: onResetReady, widgetIds: widgetIds, datasetId: datasetId }));
|
|
40846
40846
|
default:
|
|
@@ -40984,7 +40984,7 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
|
|
|
40984
40984
|
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" }) })] })] })] }) }));
|
|
40985
40985
|
}
|
|
40986
40986
|
|
|
40987
|
-
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent" }) {
|
|
40987
|
+
function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk-construction-project-agent", hasFiltersWidget = false }) {
|
|
40988
40988
|
var _a;
|
|
40989
40989
|
const [selectedWidgetType, setSelectedWidgetType] = React.useState(null);
|
|
40990
40990
|
const [query, setQuery] = React.useState('');
|
|
@@ -41203,7 +41203,12 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
41203
41203
|
// initialFocusRef={inputRef}
|
|
41204
41204
|
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) => {
|
|
41205
41205
|
const IconComponent = widget.icon;
|
|
41206
|
-
|
|
41206
|
+
const isFiltersDisabled = widget.type === 'filters' && hasFiltersWidget;
|
|
41207
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: () => !isFiltersDisabled && handleWidgetSelect(widget.type), disabled: isFiltersDisabled, className: `flex items-start gap-3 p-4 border border-slate-200 rounded-lg transition-colors text-left ${isFiltersDisabled
|
|
41208
|
+
? 'opacity-50 cursor-not-allowed bg-gray-100'
|
|
41209
|
+
: 'hover:bg-gray-50 cursor-pointer'}`, children: [jsxRuntimeExports.jsx("div", { className: `flex-shrink-0 p-2 rounded-md ${isFiltersDisabled ? 'bg-gray-200' : 'bg-primary-100'}`, children: jsxRuntimeExports.jsx(IconComponent, { className: `w-5 h-5 ${isFiltersDisabled ? 'text-gray-400' : 'text-primary-600'}` }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [jsxRuntimeExports.jsx("h3", { className: `font-medium text-sm ${isFiltersDisabled ? 'text-gray-400' : ''}`, children: widget.title }), jsxRuntimeExports.jsx("p", { className: `text-xs !mt-1 ${isFiltersDisabled ? 'text-gray-400' : 'text-gray-500'}`, children: isFiltersDisabled
|
|
41210
|
+
? 'Only one Filters Widget is allowed per dashboard'
|
|
41211
|
+
: widget.description })] })] }, widget.type));
|
|
41207
41212
|
}) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [(selectedWidgetType === 'bar-chart' || selectedWidgetType === 'series-bar-chart' || selectedWidgetType === 'series-line-chart' || selectedWidgetType === 'line-chart' || selectedWidgetType === 'pie-chart') && (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 mb-4 mt-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: "Data Labels:" }), jsxRuntimeExports.jsxs(Select, { value: showLabels ? "yes" : "no", onValueChange: (value) => setShowLabels(value === "yes"), children: [jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: jsxRuntimeExports.jsx(SelectValue, { placeholder: "Visible data labels?" }) }), jsxRuntimeExports.jsxs(SelectContent, { children: [jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }), jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })] })] })] })), jsxRuntimeExports.jsx("div", { className: "mb-2", children: jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === 'chatbot'
|
|
41208
41213
|
? 'Chatbot widget will be configured with the default agent.'
|
|
41209
41214
|
: selectedWidgetType === 'text' ? "Customize the widget's appearance"
|
|
@@ -41729,11 +41734,11 @@ function WidgetDashboard({ pageId, isEditing, selectedWidget = null, onWidgetSel
|
|
|
41729
41734
|
return (jsxRuntimeExports.jsxs("div", { className: "w-full max-w-full p-4 bg-accent/5", children: [jsxRuntimeExports.jsx(AddWidgetDialog, { isOpen: openWidgetPallete, onClose: onCloseWidgetPallete || (() => { }), addWidgetFn: (widgetType, config) => {
|
|
41730
41735
|
addWidget(widgetType, config);
|
|
41731
41736
|
onCloseWidgetPallete && onCloseWidgetPallete();
|
|
41732
|
-
}, defaultAgentName: defaultAgentName }), jsxRuntimeExports.jsx(EditWidgetDialog, { editingWidget: editingWidget, setWidgets: setWidgets, initialText: editInitialQuery, isOpen: showEditModal, onClose: () => setShowEditModal(false), onSubmit: handleEditSubmit }), jsxRuntimeExports.jsx("div", { className: "min-h-full", onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, onClick: () => setSelectedWidget(null), children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-8 w-8 animate-spin" }) })) : (jsxRuntimeExports.jsx(RGL, { className: "layout m-0 p-0 gap-2", layouts: { lg: getLayoutFromWidgets() }, breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480 }, cols: { lg: 12, md: 8, sm: 6, xs: 2 }, rowHeight: 60, isDraggable: isEditing, isResizable: isEditing, draggableHandle: ".drag-icon", onLayoutChange: handleLayoutChange, compactType: "vertical", containerPadding: [0, 0], margin: [16, 16], children: widgets.map((w) => {
|
|
41737
|
+
}, defaultAgentName: defaultAgentName, hasFiltersWidget: widgets.some(w => w.type === 'filters') }), jsxRuntimeExports.jsx(EditWidgetDialog, { editingWidget: editingWidget, setWidgets: setWidgets, initialText: editInitialQuery, isOpen: showEditModal, onClose: () => setShowEditModal(false), onSubmit: handleEditSubmit }), jsxRuntimeExports.jsx("div", { className: "min-h-full", onDragOver: (e) => e.preventDefault(), onDrop: handleDrop, onClick: () => setSelectedWidget(null), children: isLoading ? (jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-8 w-8 animate-spin" }) })) : (jsxRuntimeExports.jsx(RGL, { className: "layout m-0 p-0 gap-2", layouts: { lg: getLayoutFromWidgets() }, breakpoints: { lg: 1200, md: 996, sm: 768, xs: 480 }, cols: { lg: 12, md: 8, sm: 6, xs: 2 }, rowHeight: 60, isDraggable: isEditing, isResizable: isEditing, draggableHandle: ".drag-icon", onLayoutChange: handleLayoutChange, compactType: "vertical", containerPadding: [0, 0], margin: [16, 16], children: widgets.map((w) => {
|
|
41733
41738
|
var _a, _b;
|
|
41734
41739
|
return (jsxRuntimeExports.jsxs("div", { className: `${(w.type === "text" || w.type === "spacer") ? `${((_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-14' : 'pb-5'}`}`, children: [isEditing &&
|
|
41735
41740
|
jsxRuntimeExports.jsxs("div", { className: `flex items-center justify-end mb-4 relative ${(w.type === "text" || w.type === "spacer") ? "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" }), (w.type !== "spacer" && w.type !== "chatbot") && 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' || (w === null || w === void 0 ? void 0 : w.type) === 'spacer') ? `${isEditing ? 'px-4' : ''}` : "h-full"} w-full relative`, children: [(w === null || w === void 0 ? void 0 : w.type) === "chatbot" &&
|
|
41736
|
-
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w === null || w === void 0 ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w === null || w === void 0 ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), 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 === (w === null || w === void 0 ? void 0 : w.id) ? "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, onApplyFilters: onApplyFilters })] })] }, w.id));
|
|
41741
|
+
jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w === null || w === void 0 ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w === null || w === void 0 ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), 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 === (w === null || w === void 0 ? void 0 : w.id) ? "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, pageId: pageId, onApplyFilters: onApplyFilters, isEditing: isEditing })] })] }, w.id));
|
|
41737
41742
|
}) })) })] }));
|
|
41738
41743
|
}
|
|
41739
41744
|
|