@quantumwake/terminal-ux-dashboard-components 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +44 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +45 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ function useCapabilities() {
|
|
|
38
38
|
canDelete: !!c.deleteDashboard,
|
|
39
39
|
canAnalyze: !!c.analyzeDataset,
|
|
40
40
|
canRefine: !!c.refineDashboard,
|
|
41
|
+
canNew: !!c.newDashboard,
|
|
41
42
|
canAddPanel: !!c.addPanel,
|
|
42
43
|
canEditPanels: !!c.removePanel
|
|
43
44
|
};
|
|
@@ -1625,7 +1626,7 @@ function DataExplorer({
|
|
|
1625
1626
|
onSelectState,
|
|
1626
1627
|
onRefreshStates
|
|
1627
1628
|
}) {
|
|
1628
|
-
const { theme, addPanel, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
|
|
1629
|
+
const { theme, newDashboard, addPanel, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
|
|
1629
1630
|
const caps = useCapabilities();
|
|
1630
1631
|
const [mode, setMode] = react.useState("dashboard");
|
|
1631
1632
|
const [fullscreen, setFullscreen] = react.useState(false);
|
|
@@ -1695,6 +1696,21 @@ function DataExplorer({
|
|
|
1695
1696
|
/* @__PURE__ */ jsxRuntime.jsx(ModeTab, { active: mode === "dashboard", onClick: () => setMode("dashboard"), icon: lucideReact.Sparkles, label: "Dashboard" }),
|
|
1696
1697
|
/* @__PURE__ */ jsxRuntime.jsx(ModeTab, { active: mode === "builder", onClick: () => setMode("builder"), icon: lucideReact.BarChart3, label: "Chart Builder" }),
|
|
1697
1698
|
/* @__PURE__ */ jsxRuntime.jsx(ModeTab, { active: mode === "sql", onClick: () => setMode("sql"), icon: lucideReact.Terminal, label: "SQL" }),
|
|
1699
|
+
caps.canNew && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1700
|
+
"button",
|
|
1701
|
+
{
|
|
1702
|
+
onClick: () => {
|
|
1703
|
+
newDashboard?.();
|
|
1704
|
+
setMode("builder");
|
|
1705
|
+
},
|
|
1706
|
+
title: "Start a new dashboard",
|
|
1707
|
+
className: "flex items-center gap-1 px-2 py-1 text-xs font-mono border border-midnight-border text-midnight-text-muted hover:bg-midnight-raised hover:text-midnight-accent transition-colors",
|
|
1708
|
+
children: [
|
|
1709
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-3.5 h-3.5" }),
|
|
1710
|
+
" New Dashboard"
|
|
1711
|
+
]
|
|
1712
|
+
}
|
|
1713
|
+
),
|
|
1698
1714
|
showPersistence && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 ml-auto", children: [
|
|
1699
1715
|
caps.canSave && showSaveInput && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1700
1716
|
"input",
|
|
@@ -1763,14 +1779,39 @@ function DataExplorer({
|
|
|
1763
1779
|
)
|
|
1764
1780
|
] }, d.id))
|
|
1765
1781
|
] }),
|
|
1766
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsxRuntime.jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1782
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsxRuntime.jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1783
|
+
ChartBuilder,
|
|
1784
|
+
{
|
|
1785
|
+
records,
|
|
1786
|
+
columns,
|
|
1787
|
+
stateId: activeStateId ?? void 0,
|
|
1788
|
+
onSave: addPanel ? (panel) => {
|
|
1789
|
+
addPanel(panel);
|
|
1790
|
+
setMode("dashboard");
|
|
1791
|
+
} : void 0
|
|
1792
|
+
}
|
|
1793
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1767
1794
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-auto", children: dashboard ? /* @__PURE__ */ jsxRuntime.jsx(DashboardRenderer, { dashboard, records, columns }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-4 text-midnight-text-muted", children: [
|
|
1768
1795
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "w-8 h-8" }),
|
|
1769
1796
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: caps.canAnalyze ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1770
1797
|
"Click ",
|
|
1771
1798
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Auto-Analyze" }),
|
|
1772
1799
|
" to generate an AI dashboard"
|
|
1773
|
-
] }) : "No dashboard to display" })
|
|
1800
|
+
] }) : caps.canNew ? "Start a new dashboard, then add charts from the Chart Builder" : "No dashboard to display" }),
|
|
1801
|
+
caps.canNew && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1802
|
+
"button",
|
|
1803
|
+
{
|
|
1804
|
+
onClick: () => {
|
|
1805
|
+
newDashboard?.();
|
|
1806
|
+
setMode("builder");
|
|
1807
|
+
},
|
|
1808
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-mono border border-midnight-accent text-midnight-accent hover:bg-midnight-accent/10 transition-colors",
|
|
1809
|
+
children: [
|
|
1810
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-4 h-4" }),
|
|
1811
|
+
" Create Dashboard"
|
|
1812
|
+
]
|
|
1813
|
+
}
|
|
1814
|
+
)
|
|
1774
1815
|
] }) }),
|
|
1775
1816
|
dashboard && caps.canRefine && refineDashboard && /* @__PURE__ */ jsxRuntime.jsx(ChatInput, { onSend: refineDashboard, loading: analyzing, theme })
|
|
1776
1817
|
] }) })
|