@quantumwake/terminal-ux-dashboard-components 0.1.1 → 0.1.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.d.cts CHANGED
@@ -11,6 +11,13 @@ interface SavedDashboard {
11
11
  name: string;
12
12
  [key: string]: unknown;
13
13
  }
14
+ interface PanelInput {
15
+ title: string;
16
+ type: string;
17
+ config: Record<string, unknown>;
18
+ width: number;
19
+ height: number;
20
+ }
14
21
  interface DashboardCapabilities {
15
22
  runQuery: (sql: string, stateId?: string) => Promise<QueryResult>;
16
23
  saveDashboard?: (name?: string) => Promise<void> | void;
@@ -20,6 +27,7 @@ interface DashboardCapabilities {
20
27
  deleteDashboard?: (id: string) => Promise<void> | void;
21
28
  analyzeDataset?: () => Promise<void> | void;
22
29
  refineDashboard?: (prompt: string) => Promise<void> | void;
30
+ addPanel?: (panel: PanelInput) => void;
23
31
  removePanel?: (panelId: string) => void;
24
32
  }
25
33
  interface DashboardContextValue extends DashboardCapabilities {
@@ -40,6 +48,7 @@ declare function useCapabilities(): {
40
48
  canDelete: boolean;
41
49
  canAnalyze: boolean;
42
50
  canRefine: boolean;
51
+ canAddPanel: boolean;
43
52
  canEditPanels: boolean;
44
53
  };
45
54
 
@@ -474,4 +483,4 @@ interface DataExplorerProps {
474
483
  }
475
484
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
476
485
 
477
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
486
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PanelInput, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,13 @@ interface SavedDashboard {
11
11
  name: string;
12
12
  [key: string]: unknown;
13
13
  }
14
+ interface PanelInput {
15
+ title: string;
16
+ type: string;
17
+ config: Record<string, unknown>;
18
+ width: number;
19
+ height: number;
20
+ }
14
21
  interface DashboardCapabilities {
15
22
  runQuery: (sql: string, stateId?: string) => Promise<QueryResult>;
16
23
  saveDashboard?: (name?: string) => Promise<void> | void;
@@ -20,6 +27,7 @@ interface DashboardCapabilities {
20
27
  deleteDashboard?: (id: string) => Promise<void> | void;
21
28
  analyzeDataset?: () => Promise<void> | void;
22
29
  refineDashboard?: (prompt: string) => Promise<void> | void;
30
+ addPanel?: (panel: PanelInput) => void;
23
31
  removePanel?: (panelId: string) => void;
24
32
  }
25
33
  interface DashboardContextValue extends DashboardCapabilities {
@@ -40,6 +48,7 @@ declare function useCapabilities(): {
40
48
  canDelete: boolean;
41
49
  canAnalyze: boolean;
42
50
  canRefine: boolean;
51
+ canAddPanel: boolean;
43
52
  canEditPanels: boolean;
44
53
  };
45
54
 
@@ -474,4 +483,4 @@ interface DataExplorerProps {
474
483
  }
475
484
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
476
485
 
477
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
486
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, type PanelInput, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ function useCapabilities() {
32
32
  canDelete: !!c.deleteDashboard,
33
33
  canAnalyze: !!c.analyzeDataset,
34
34
  canRefine: !!c.refineDashboard,
35
+ canAddPanel: !!c.addPanel,
35
36
  canEditPanels: !!c.removePanel
36
37
  };
37
38
  }
@@ -1618,7 +1619,7 @@ function DataExplorer({
1618
1619
  onSelectState,
1619
1620
  onRefreshStates
1620
1621
  }) {
1621
- const { theme, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
1622
+ const { theme, addPanel, saveDashboard, listDashboards, searchDashboards, loadDashboard, deleteDashboard, analyzeDataset, refineDashboard } = useDashboard();
1622
1623
  const caps = useCapabilities();
1623
1624
  const [mode, setMode] = useState("dashboard");
1624
1625
  const [fullscreen, setFullscreen] = useState(false);
@@ -1756,7 +1757,7 @@ function DataExplorer({
1756
1757
  )
1757
1758
  ] }, d.id))
1758
1759
  ] }),
1759
- /* @__PURE__ */ jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsx(ChartBuilder, { records, columns, stateId: activeStateId ?? void 0 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1760
+ /* @__PURE__ */ jsx("div", { className: `border ${theme.border} bg-midnight-surface flex-1 flex flex-col min-h-0`, children: mode === "sql" ? /* @__PURE__ */ jsx(SqlConsole, { columns, stateId: activeStateId ?? void 0 }) : mode === "builder" ? /* @__PURE__ */ jsx(ChartBuilder, { records, columns, stateId: activeStateId ?? void 0, onSave: addPanel }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1760
1761
  /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-auto", children: dashboard ? /* @__PURE__ */ jsx(DashboardRenderer, { dashboard, records, columns }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-4 text-midnight-text-muted", children: [
1761
1762
  /* @__PURE__ */ jsx(Sparkles, { className: "w-8 h-8" }),
1762
1763
  /* @__PURE__ */ jsx("p", { className: "text-sm", children: caps.canAnalyze ? /* @__PURE__ */ jsxs(Fragment, { children: [