@sqlrooms/mosaic 0.29.0-rc.8 → 0.29.0-rc.9
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/README.md +84 -74
- package/dist/ai/agentIntent.d.ts +5 -0
- package/dist/ai/agentIntent.d.ts.map +1 -0
- package/dist/ai/agentIntent.js +8 -0
- package/dist/ai/agentIntent.js.map +1 -0
- package/dist/ai/block-document/constants.d.ts +9 -0
- package/dist/ai/block-document/constants.d.ts.map +1 -0
- package/dist/ai/block-document/constants.js +9 -0
- package/dist/ai/block-document/constants.js.map +1 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts +48 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.d.ts.map +1 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js +59 -0
- package/dist/ai/block-document/createAddMosaicDashboardBlockTool.js.map +1 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.d.ts +19 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.d.ts.map +1 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.js +37 -0
- package/dist/ai/block-document/createBlockDocumentChartTools.js.map +1 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts +32 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js +37 -0
- package/dist/ai/block-document/createBlockDocumentDataTableExplorerTool.js.map +1 -0
- package/dist/ai/constants.d.ts +3 -0
- package/dist/ai/constants.d.ts.map +1 -0
- package/dist/ai/constants.js +3 -0
- package/dist/ai/constants.js.map +1 -0
- package/dist/ai/createDataTableExplorerTool.d.ts +69 -0
- package/dist/ai/createDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/createDataTableExplorerTool.js +68 -0
- package/dist/ai/createDataTableExplorerTool.js.map +1 -0
- package/dist/ai/dashboard/constants.d.ts +6 -0
- package/dist/ai/dashboard/constants.d.ts.map +1 -0
- package/dist/ai/dashboard/constants.js +6 -0
- package/dist/ai/dashboard/constants.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAgentTool.d.ts +17 -0
- package/dist/ai/dashboard/createDashboardAgentTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAgentTool.js +205 -0
- package/dist/ai/dashboard/createDashboardAgentTool.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.d.ts +14 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.js +75 -0
- package/dist/ai/dashboard/createDashboardAiAdapter.js.map +1 -0
- package/dist/ai/dashboard/createDashboardAiTools.d.ts +26 -0
- package/dist/ai/dashboard/createDashboardAiTools.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardAiTools.js +40 -0
- package/dist/ai/dashboard/createDashboardAiTools.js.map +1 -0
- package/dist/ai/dashboard/createDashboardChartTools.d.ts +27 -0
- package/dist/ai/dashboard/createDashboardChartTools.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardChartTools.js +55 -0
- package/dist/ai/dashboard/createDashboardChartTools.js.map +1 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts +23 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js +29 -0
- package/dist/ai/dashboard/createDashboardDataTableExplorerTool.js.map +1 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts +28 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.d.ts.map +1 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.js +54 -0
- package/dist/ai/dashboard/createListDashboardPanelsTool.js.map +1 -0
- package/dist/ai/dashboard/dashboard-types.d.ts +59 -0
- package/dist/ai/dashboard/dashboard-types.d.ts.map +1 -0
- package/dist/ai/dashboard/dashboard-types.js +2 -0
- package/dist/ai/dashboard/dashboard-types.js.map +1 -0
- package/dist/ai/database-types.d.ts +12 -0
- package/dist/ai/database-types.d.ts.map +1 -0
- package/dist/ai/database-types.js +2 -0
- package/dist/ai/database-types.js.map +1 -0
- package/dist/ai/errors.d.ts +8 -0
- package/dist/ai/errors.d.ts.map +1 -0
- package/dist/ai/errors.js +11 -0
- package/dist/ai/errors.js.map +1 -0
- package/dist/ai/tool-helpers.d.ts +28 -29
- package/dist/ai/tool-helpers.d.ts.map +1 -1
- package/dist/ai/tool-helpers.js +38 -76
- package/dist/ai/tool-helpers.js.map +1 -1
- package/dist/ai/tool-schemas.d.ts +9 -4
- package/dist/ai/tool-schemas.d.ts.map +1 -1
- package/dist/ai/tool-schemas.js +12 -12
- package/dist/ai/tool-schemas.js.map +1 -1
- package/dist/ai/tool-types.d.ts +19 -1
- package/dist/ai/tool-types.d.ts.map +1 -1
- package/dist/ai/tool-types.js.map +1 -1
- package/dist/ai/types.d.ts +64 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/ai.d.ts +16 -2
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js +14 -5
- package/dist/ai.js.map +1 -1
- package/dist/charts/MosaicChart.js +1 -1
- package/dist/charts/MosaicChart.js.map +1 -1
- package/dist/charts/MosaicChartView.d.ts.map +1 -1
- package/dist/charts/MosaicChartView.js +1 -2
- package/dist/charts/MosaicChartView.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js +2 -1
- package/dist/charts/chart-settings/MosaicChartSpecViewerPanel.js.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.d.ts.map +1 -1
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js +4 -11
- package/dist/charts/chart-settings/MosaicChartTypeSelector.js.map +1 -1
- package/dist/charts/chart-types/base-types.d.ts +27 -23
- package/dist/charts/chart-types/base-types.d.ts.map +1 -1
- package/dist/charts/chart-types/base-types.js +3 -1
- package/dist/charts/chart-types/base-types.js.map +1 -1
- package/dist/charts/chart-types/box-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/definition.js +1 -0
- package/dist/charts/chart-types/box-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts +37 -3
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js +26 -6
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotClient.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js +2 -2
- package/dist/charts/chart-types/box-plot/renderer/BoxPlotPanelRenderer.js.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts +12 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js +13 -3
- package/dist/charts/chart-types/box-plot/renderer/useBoxPlotClient.js.map +1 -1
- package/dist/charts/chart-types/box-plot/tool.d.ts +20 -24
- package/dist/charts/chart-types/box-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/box-plot/tool.js +25 -33
- package/dist/charts/chart-types/box-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/box-plot/validation.d.ts +9 -0
- package/dist/charts/chart-types/box-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/box-plot/validation.js +32 -0
- package/dist/charts/chart-types/box-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/column-types.d.ts +8 -0
- package/dist/charts/chart-types/column-types.d.ts.map +1 -0
- package/dist/charts/chart-types/column-types.js +2 -0
- package/dist/charts/chart-types/column-types.js.map +1 -0
- package/dist/charts/chart-types/count-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/definition.js +1 -0
- package/dist/charts/chart-types/count-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/spec.js +1 -19
- package/dist/charts/chart-types/count-plot/spec.js.map +1 -1
- package/dist/charts/chart-types/count-plot/tool.d.ts +19 -24
- package/dist/charts/chart-types/count-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/count-plot/tool.js +25 -32
- package/dist/charts/chart-types/count-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/count-plot/validation.d.ts +8 -0
- package/dist/charts/chart-types/count-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/count-plot/validation.js +20 -0
- package/dist/charts/chart-types/count-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/createChartInstructions.d.ts +3 -0
- package/dist/charts/chart-types/createChartInstructions.d.ts.map +1 -0
- package/dist/charts/chart-types/createChartInstructions.js +12 -0
- package/dist/charts/chart-types/createChartInstructions.js.map +1 -0
- package/dist/charts/chart-types/createChartTools.d.ts +15 -9
- package/dist/charts/chart-types/createChartTools.d.ts.map +1 -1
- package/dist/charts/chart-types/createChartTools.js +16 -10
- package/dist/charts/chart-types/createChartTools.js.map +1 -1
- package/dist/charts/chart-types/custom-spec/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/custom-spec/definition.js +1 -0
- package/dist/charts/chart-types/custom-spec/definition.js.map +1 -1
- package/dist/charts/chart-types/errors.d.ts +10 -0
- package/dist/charts/chart-types/errors.d.ts.map +1 -1
- package/dist/charts/chart-types/errors.js +18 -0
- package/dist/charts/chart-types/errors.js.map +1 -1
- package/dist/charts/chart-types/heatmap/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/definition.js +1 -0
- package/dist/charts/chart-types/heatmap/definition.js.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/spec.js +1 -33
- package/dist/charts/chart-types/heatmap/spec.js.map +1 -1
- package/dist/charts/chart-types/heatmap/tool.d.ts +20 -24
- package/dist/charts/chart-types/heatmap/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/heatmap/tool.js +26 -36
- package/dist/charts/chart-types/heatmap/tool.js.map +1 -1
- package/dist/charts/chart-types/heatmap/validation.d.ts +9 -0
- package/dist/charts/chart-types/heatmap/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/heatmap/validation.js +34 -0
- package/dist/charts/chart-types/heatmap/validation.js.map +1 -0
- package/dist/charts/chart-types/histogram/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/definition.js +1 -0
- package/dist/charts/chart-types/histogram/definition.js.map +1 -1
- package/dist/charts/chart-types/histogram/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/spec.js +1 -21
- package/dist/charts/chart-types/histogram/spec.js.map +1 -1
- package/dist/charts/chart-types/histogram/tool.d.ts +37 -24
- package/dist/charts/chart-types/histogram/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/histogram/tool.js +38 -32
- package/dist/charts/chart-types/histogram/tool.js.map +1 -1
- package/dist/charts/chart-types/histogram/validation.d.ts +9 -0
- package/dist/charts/chart-types/histogram/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/histogram/validation.js +22 -0
- package/dist/charts/chart-types/histogram/validation.js.map +1 -0
- package/dist/charts/chart-types/index.d.ts +1 -7
- package/dist/charts/chart-types/index.d.ts.map +1 -1
- package/dist/charts/chart-types/index.js +2 -8
- package/dist/charts/chart-types/index.js.map +1 -1
- package/dist/charts/chart-types/line-chart/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/definition.js +1 -0
- package/dist/charts/chart-types/line-chart/definition.js.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/spec.js +5 -46
- package/dist/charts/chart-types/line-chart/spec.js.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.d.ts +26 -24
- package/dist/charts/chart-types/line-chart/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/line-chart/tool.js +26 -38
- package/dist/charts/chart-types/line-chart/tool.js.map +1 -1
- package/dist/charts/chart-types/line-chart/validation.d.ts +16 -0
- package/dist/charts/chart-types/line-chart/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/line-chart/validation.js +43 -0
- package/dist/charts/chart-types/line-chart/validation.js.map +1 -0
- package/dist/charts/chart-types/resolveChartTypes.d.ts +3 -0
- package/dist/charts/chart-types/resolveChartTypes.d.ts.map +1 -0
- package/dist/charts/chart-types/resolveChartTypes.js +8 -0
- package/dist/charts/chart-types/resolveChartTypes.js.map +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/definition.js +1 -0
- package/dist/charts/chart-types/scatter-plot/definition.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/spec.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/spec.js +1 -45
- package/dist/charts/chart-types/scatter-plot/spec.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/tool.d.ts +21 -24
- package/dist/charts/chart-types/scatter-plot/tool.d.ts.map +1 -1
- package/dist/charts/chart-types/scatter-plot/tool.js +28 -41
- package/dist/charts/chart-types/scatter-plot/tool.js.map +1 -1
- package/dist/charts/chart-types/scatter-plot/validation.d.ts +13 -0
- package/dist/charts/chart-types/scatter-plot/validation.d.ts.map +1 -0
- package/dist/charts/chart-types/scatter-plot/validation.js +52 -0
- package/dist/charts/chart-types/scatter-plot/validation.js.map +1 -0
- package/dist/charts/chart-types/tool-types.d.ts +43 -0
- package/dist/charts/chart-types/tool-types.d.ts.map +1 -0
- package/dist/charts/chart-types/tool-types.js +2 -0
- package/dist/charts/chart-types/tool-types.js.map +1 -0
- package/dist/charts/chart-types/utils.d.ts +3 -0
- package/dist/charts/chart-types/utils.d.ts.map +1 -0
- package/dist/charts/chart-types/utils.js +4 -0
- package/dist/charts/chart-types/utils.js.map +1 -0
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.d.ts.map +1 -1
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js +5 -3
- package/dist/charts/dashboard/MosaicDashboardChartRenderer.js.map +1 -1
- package/dist/charts/useChartDataPolicy.js +2 -2
- package/dist/charts/useChartDataPolicy.js.map +1 -1
- package/dist/components/AggregationSelector.d.ts.map +1 -1
- package/dist/components/AggregationSelector.js +1 -1
- package/dist/components/AggregationSelector.js.map +1 -1
- package/dist/components/ColorSelector.d.ts.map +1 -1
- package/dist/components/ColorSelector.js +1 -2
- package/dist/components/ColorSelector.js.map +1 -1
- package/dist/components/FieldSelectorInput.d.ts.map +1 -1
- package/dist/components/FieldSelectorInput.js +3 -3
- package/dist/components/FieldSelectorInput.js.map +1 -1
- package/dist/components/TemporalGranularitySelector.d.ts.map +1 -1
- package/dist/components/TemporalGranularitySelector.js +1 -1
- package/dist/components/TemporalGranularitySelector.js.map +1 -1
- package/dist/dashboard/MosaicDashboardCommands.d.ts +19 -0
- package/dist/dashboard/MosaicDashboardCommands.d.ts.map +1 -0
- package/dist/dashboard/MosaicDashboardCommands.js +226 -0
- package/dist/dashboard/MosaicDashboardCommands.js.map +1 -0
- package/dist/dashboard/dashboard-types.d.ts.map +1 -1
- package/dist/dashboard/dashboard-types.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.js +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanel.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.js +3 -3
- package/dist/dashboard/panel/MosaicDashboardPanelLayout.js.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanels.d.ts.map +1 -1
- package/dist/dashboard/panel/MosaicDashboardPanels.js +4 -2
- package/dist/dashboard/panel/MosaicDashboardPanels.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js +4 -4
- package/dist/dashboard/toolbar/MosaicDashboardDataTableSelector.js.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.d.ts.map +1 -1
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js +5 -3
- package/dist/dashboard/toolbar/MosaicDashboardToolbar.js.map +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.d.ts +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.d.ts.map +1 -1
- package/dist/dashboard/useSelectedOrFirstTable.js +10 -8
- package/dist/dashboard/useSelectedOrFirstTable.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerCategoryClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts +3 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerCountClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerCountClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.js +4 -4
- package/dist/data-table-explorer/DataTableExplorerHistogramClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts +3 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.js +3 -1
- package/dist/data-table-explorer/DataTableExplorerPageClient.js.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts +3 -2
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.d.ts.map +1 -1
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js +3 -3
- package/dist/data-table-explorer/DataTableExplorerUnsupportedSummaryClient.js.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js +7 -4
- package/dist/data-table-explorer/dashboard/MosaicDashboardDataTableExplorerPanelRenderer.js.map +1 -1
- package/dist/data-table-explorer/dataTableExplorerController.d.ts +58 -2
- package/dist/data-table-explorer/dataTableExplorerController.d.ts.map +1 -1
- package/dist/data-table-explorer/dataTableExplorerController.js +68 -8
- package/dist/data-table-explorer/dataTableExplorerController.js.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts +23 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.d.ts.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js +46 -13
- package/dist/data-table-explorer/hooks/useDataTableExplorerLifecycles.js.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts +17 -3
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.d.ts.map +1 -1
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js +9 -6
- package/dist/data-table-explorer/hooks/useDataTableExplorerQueryState.js.map +1 -1
- package/dist/data-table-explorer/types.d.ts +10 -0
- package/dist/data-table-explorer/types.d.ts.map +1 -1
- package/dist/data-table-explorer/types.js.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.d.ts.map +1 -1
- package/dist/data-table-explorer/useDataTableExplorer.js +10 -6
- package/dist/data-table-explorer/useDataTableExplorer.js.map +1 -1
- package/dist/data-table-explorer/utils.d.ts +64 -6
- package/dist/data-table-explorer/utils.d.ts.map +1 -1
- package/dist/data-table-explorer/utils.js +58 -0
- package/dist/data-table-explorer/utils.js.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.d.ts.map +1 -1
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js +2 -2
- package/dist/data-table-explorer/worksheet/DataTableBlockRenderer.js.map +1 -1
- package/dist/index.d.ts +49 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -25
- package/dist/index.js.map +1 -1
- package/dist/mosaicTableReference.d.ts +59 -0
- package/dist/mosaicTableReference.d.ts.map +1 -0
- package/dist/mosaicTableReference.js +68 -0
- package/dist/mosaicTableReference.js.map +1 -0
- package/dist/useVgPlotChartRender.d.ts.map +1 -1
- package/dist/useVgPlotChartRender.js +26 -1
- package/dist/useVgPlotChartRender.js.map +1 -1
- package/dist/utils/table-lookup.d.ts +7 -0
- package/dist/utils/table-lookup.d.ts.map +1 -0
- package/dist/utils/table-lookup.js +10 -0
- package/dist/utils/table-lookup.js.map +1 -0
- package/package.json +14 -14
- package/dist/ai/ai.d.ts +0 -108
- package/dist/ai/ai.d.ts.map +0 -1
- package/dist/ai/ai.js +0 -461
- package/dist/ai/ai.js.map +0 -1
- package/dist/ai/data-table-explorer-tool.d.ts +0 -40
- package/dist/ai/data-table-explorer-tool.d.ts.map +0 -1
- package/dist/ai/data-table-explorer-tool.js +0 -75
- package/dist/ai/data-table-explorer-tool.js.map +0 -1
- package/dist/ai/list-panels-tool.d.ts +0 -35
- package/dist/ai/list-panels-tool.d.ts.map +0 -1
- package/dist/ai/list-panels-tool.js +0 -66
- package/dist/ai/list-panels-tool.js.map +0 -1
- package/dist/ai/remove-panel-tool.d.ts +0 -31
- package/dist/ai/remove-panel-tool.d.ts.map +0 -1
- package/dist/ai/remove-panel-tool.js +0 -55
- package/dist/ai/remove-panel-tool.js.map +0 -1
- package/dist/ai/tool-validation.d.ts +0 -3
- package/dist/ai/tool-validation.d.ts.map +0 -1
- package/dist/ai/tool-validation.js +0 -11
- package/dist/ai/tool-validation.js.map +0 -1
- package/dist/components/Combobox.d.ts +0 -45
- package/dist/components/Combobox.d.ts.map +0 -1
- package/dist/components/Combobox.js +0 -58
- package/dist/components/Combobox.js.map +0 -1
- package/dist/components/useCombobox.d.ts +0 -23
- package/dist/components/useCombobox.d.ts.map +0 -1
- package/dist/components/useCombobox.js +0 -26
- package/dist/components/useCombobox.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { createOrUpdateDataTableExplorerPanel } from './tool-helpers';
|
|
4
|
-
import { DataTableExplorerPanelConfig } from '../dashboard/core-types';
|
|
5
|
-
export const DataTableExplorerToolParameters = z.object({
|
|
6
|
-
artifactId: z
|
|
7
|
-
.string()
|
|
8
|
-
.optional()
|
|
9
|
-
.describe('Optional dashboard artifact ID. Defaults to current dashboard.'),
|
|
10
|
-
tableName: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe('Optional table name. Use when no table is selected yet.'),
|
|
14
|
-
createArtifactIfMissing: z
|
|
15
|
-
.boolean()
|
|
16
|
-
.optional()
|
|
17
|
-
.default(true)
|
|
18
|
-
.describe('If true, create dashboard artifact if missing.'),
|
|
19
|
-
panelId: z
|
|
20
|
-
.string()
|
|
21
|
-
.optional()
|
|
22
|
-
.describe('Optional panel ID. If provided, updates the existing panel instead of creating new one.'),
|
|
23
|
-
title: z
|
|
24
|
-
.string()
|
|
25
|
-
.optional()
|
|
26
|
-
.default('Data Table Explorer')
|
|
27
|
-
.describe('Title for the Data Table Explorer panel.'),
|
|
28
|
-
config: DataTableExplorerPanelConfig,
|
|
29
|
-
reasoning: z
|
|
30
|
-
.string()
|
|
31
|
-
.describe('Brief rationale for creating the Data Table Explorer.'),
|
|
32
|
-
});
|
|
33
|
-
export function createDataTableExplorerTool(deps) {
|
|
34
|
-
return tool({
|
|
35
|
-
description: `Data Table Explorer: displays table schema and statistics for all columns (count, distinct values, min/max, etc.).
|
|
36
|
-
|
|
37
|
-
Use when: user asks to "profile the data", "show table statistics", "what's in this table", "summarize columns", "give me an overview of the data".
|
|
38
|
-
|
|
39
|
-
Useful for: quick data exploration, understanding data quality, finding missing values, identifying column types.
|
|
40
|
-
|
|
41
|
-
To UPDATE an existing Data Table Explorer: provide the panelId parameter. Otherwise creates new panel.`,
|
|
42
|
-
inputSchema: DataTableExplorerToolParameters,
|
|
43
|
-
execute: async (params) => {
|
|
44
|
-
try {
|
|
45
|
-
const artifactId = deps.resolveArtifact(params.artifactId, params.createArtifactIfMissing);
|
|
46
|
-
const { tableName } = deps.resolveTable(artifactId, params.tableName);
|
|
47
|
-
const result = createOrUpdateDataTableExplorerPanel(deps, {
|
|
48
|
-
panelId: params.panelId,
|
|
49
|
-
dashboardId: artifactId,
|
|
50
|
-
tableName,
|
|
51
|
-
title: params.title || 'Data Table Explorer',
|
|
52
|
-
config: params.config,
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
llmResult: {
|
|
56
|
-
success: true,
|
|
57
|
-
details: params.panelId
|
|
58
|
-
? `Updated Data Table Explorer "${result.title}".`
|
|
59
|
-
: `Created Data Table Explorer "${result.title}".`,
|
|
60
|
-
data: result,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
return {
|
|
66
|
-
llmResult: {
|
|
67
|
-
success: false,
|
|
68
|
-
errorMessage: error instanceof Error ? error.message : String(error),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=data-table-explorer-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-explorer-tool.js","sourceRoot":"","sources":["../../src/ai/data-table-explorer-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AACxB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,oCAAoC,EAAC,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAC,4BAA4B,EAAC,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,yDAAyD,CAAC;IACtE,uBAAuB,EAAE,CAAC;SACvB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yFAAyF,CAC1F;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,OAAO,CAAC,qBAAqB,CAAC;SAC9B,QAAQ,CAAC,0CAA0C,CAAC;IACvD,MAAM,EAAE,4BAA4B;IACpC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC,CAAC;AAMH,MAAM,UAAU,2BAA2B,CAAC,IAAuB;IACjE,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;;uGAMsF;QACnG,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CACrC,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,uBAAuB,CAC/B,CAAC;gBACF,MAAM,EAAC,SAAS,EAAC,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;gBAEpE,MAAM,MAAM,GAAG,oCAAoC,CAAC,IAAI,EAAE;oBACxD,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,WAAW,EAAE,UAAU;oBACvB,SAAS;oBACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,qBAAqB;oBAC5C,MAAM,EAAE,MAAM,CAAC,MAAM;iBACtB,CAAC,CAAC;gBAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,MAAM,CAAC,OAAO;4BACrB,CAAC,CAAC,gCAAgC,MAAM,CAAC,KAAK,IAAI;4BAClD,CAAC,CAAC,gCAAgC,MAAM,CAAC,KAAK,IAAI;wBACpD,IAAI,EAAE,MAAM;qBACb;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport type {DashboardToolDeps} from '../charts/chart-types/base-types';\nimport {createOrUpdateDataTableExplorerPanel} from './tool-helpers';\nimport {DataTableExplorerPanelConfig} from '../dashboard/core-types';\n\nexport const DataTableExplorerToolParameters = z.object({\n artifactId: z\n .string()\n .optional()\n .describe('Optional dashboard artifact ID. Defaults to current dashboard.'),\n tableName: z\n .string()\n .optional()\n .describe('Optional table name. Use when no table is selected yet.'),\n createArtifactIfMissing: z\n .boolean()\n .optional()\n .default(true)\n .describe('If true, create dashboard artifact if missing.'),\n panelId: z\n .string()\n .optional()\n .describe(\n 'Optional panel ID. If provided, updates the existing panel instead of creating new one.',\n ),\n title: z\n .string()\n .optional()\n .default('Data Table Explorer')\n .describe('Title for the Data Table Explorer panel.'),\n config: DataTableExplorerPanelConfig,\n reasoning: z\n .string()\n .describe('Brief rationale for creating the Data Table Explorer.'),\n});\n\nexport type DataTableExplorerToolParams = z.infer<\n typeof DataTableExplorerToolParameters\n>;\n\nexport function createDataTableExplorerTool(deps: DashboardToolDeps) {\n return tool({\n description: `Data Table Explorer: displays table schema and statistics for all columns (count, distinct values, min/max, etc.).\n\nUse when: user asks to \"profile the data\", \"show table statistics\", \"what's in this table\", \"summarize columns\", \"give me an overview of the data\".\n\nUseful for: quick data exploration, understanding data quality, finding missing values, identifying column types.\n\nTo UPDATE an existing Data Table Explorer: provide the panelId parameter. Otherwise creates new panel.`,\n inputSchema: DataTableExplorerToolParameters,\n execute: async (params) => {\n try {\n const artifactId = deps.resolveArtifact(\n params.artifactId,\n params.createArtifactIfMissing,\n );\n const {tableName} = deps.resolveTable(artifactId, params.tableName);\n\n const result = createOrUpdateDataTableExplorerPanel(deps, {\n panelId: params.panelId,\n dashboardId: artifactId,\n tableName,\n title: params.title || 'Data Table Explorer',\n config: params.config,\n });\n\n return {\n llmResult: {\n success: true,\n details: params.panelId\n ? `Updated Data Table Explorer \"${result.title}\".`\n : `Created Data Table Explorer \"${result.title}\".`,\n data: result,\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { DashboardToolDeps } from '../charts/chart-types/base-types';
|
|
3
|
-
export declare const ListPanelsToolParameters: z.ZodObject<{
|
|
4
|
-
artifactId: z.ZodOptional<z.ZodString>;
|
|
5
|
-
reasoning: z.ZodString;
|
|
6
|
-
}, z.core.$strip>;
|
|
7
|
-
export type ListPanelsToolParams = z.infer<typeof ListPanelsToolParameters>;
|
|
8
|
-
export declare function createListPanelsTool(deps: DashboardToolDeps): import("ai").Tool<{
|
|
9
|
-
reasoning: string;
|
|
10
|
-
artifactId?: string | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
llmResult: {
|
|
13
|
-
success: boolean;
|
|
14
|
-
errorMessage: string;
|
|
15
|
-
details?: undefined;
|
|
16
|
-
data?: undefined;
|
|
17
|
-
};
|
|
18
|
-
} | {
|
|
19
|
-
llmResult: {
|
|
20
|
-
success: boolean;
|
|
21
|
-
details: string;
|
|
22
|
-
data: {
|
|
23
|
-
artifactId: string;
|
|
24
|
-
panels: {
|
|
25
|
-
issue?: import("..").ChartRuntimeIssue | undefined;
|
|
26
|
-
id: any;
|
|
27
|
-
type: any;
|
|
28
|
-
title: any;
|
|
29
|
-
config: any;
|
|
30
|
-
}[];
|
|
31
|
-
};
|
|
32
|
-
errorMessage?: undefined;
|
|
33
|
-
};
|
|
34
|
-
}>;
|
|
35
|
-
//# sourceMappingURL=list-panels-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-panels-tool.d.ts","sourceRoot":"","sources":["../../src/ai/list-panels-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAExE,eAAO,MAAM,wBAAwB;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE5E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;GAwD3D"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export const ListPanelsToolParameters = z.object({
|
|
4
|
-
artifactId: z
|
|
5
|
-
.string()
|
|
6
|
-
.optional()
|
|
7
|
-
.describe('Optional dashboard artifact ID. Defaults to current dashboard.'),
|
|
8
|
-
reasoning: z
|
|
9
|
-
.string()
|
|
10
|
-
.describe('Brief rationale for listing dashboard panels.'),
|
|
11
|
-
});
|
|
12
|
-
export function createListPanelsTool(deps) {
|
|
13
|
-
return tool({
|
|
14
|
-
description: `List dashboard panels: returns all panels in the current dashboard with their IDs, types, titles, configurations, and any current runtime issue.
|
|
15
|
-
|
|
16
|
-
Use when: you need to discover panel IDs before updating or removing panels, or when user asks "what's on this dashboard".
|
|
17
|
-
|
|
18
|
-
Runtime issues are transient chart diagnostics such as too-much-data or sql-error. If a panel has an issue, use the panel ID to update it in place with a safer chart configuration.
|
|
19
|
-
|
|
20
|
-
Returns array of: {id, type, title, config, issue?} for each panel.`,
|
|
21
|
-
inputSchema: ListPanelsToolParameters,
|
|
22
|
-
execute: async (params) => {
|
|
23
|
-
try {
|
|
24
|
-
const artifactId = deps.resolveArtifact(params.artifactId);
|
|
25
|
-
const dashboard = deps.getDashboard(artifactId);
|
|
26
|
-
if (!dashboard) {
|
|
27
|
-
return {
|
|
28
|
-
llmResult: {
|
|
29
|
-
success: false,
|
|
30
|
-
errorMessage: `Dashboard "${artifactId}" not found.`,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const panels = dashboard.panels.map((panel) => {
|
|
35
|
-
const issue = deps.getPanelIssue?.(artifactId, panel.id);
|
|
36
|
-
return {
|
|
37
|
-
id: panel.id,
|
|
38
|
-
type: panel.type,
|
|
39
|
-
title: panel.title,
|
|
40
|
-
config: panel.config,
|
|
41
|
-
...(issue ? { issue } : {}),
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
llmResult: {
|
|
46
|
-
success: true,
|
|
47
|
-
details: `Found ${panels.length} panel(s) in dashboard.`,
|
|
48
|
-
data: {
|
|
49
|
-
artifactId,
|
|
50
|
-
panels,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
return {
|
|
57
|
-
llmResult: {
|
|
58
|
-
success: false,
|
|
59
|
-
errorMessage: error instanceof Error ? error.message : String(error),
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=list-panels-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-panels-tool.js","sourceRoot":"","sources":["../../src/ai/list-panels-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AACxB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CAAC,+CAA+C,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAM,UAAU,oBAAoB,CAAC,IAAuB;IAC1D,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;;;oEAMmD;QAChE,WAAW,EAAE,wBAAwB;QACrC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAE3D,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,OAAO;wBACL,SAAS,EAAE;4BACT,OAAO,EAAE,KAAK;4BACd,YAAY,EAAE,cAAc,UAAU,cAAc;yBACrD;qBACF,CAAC;gBACJ,CAAC;gBAED,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;oBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;oBACzD,OAAO;wBACL,EAAE,EAAE,KAAK,CAAC,EAAE;wBACZ,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC1B,CAAC;gBACJ,CAAC,CAAC,CAAC;gBAEH,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,SAAS,MAAM,CAAC,MAAM,yBAAyB;wBACxD,IAAI,EAAE;4BACJ,UAAU;4BACV,MAAM;yBACP;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport type {DashboardToolDeps} from '../charts/chart-types/base-types';\n\nexport const ListPanelsToolParameters = z.object({\n artifactId: z\n .string()\n .optional()\n .describe('Optional dashboard artifact ID. Defaults to current dashboard.'),\n reasoning: z\n .string()\n .describe('Brief rationale for listing dashboard panels.'),\n});\n\nexport type ListPanelsToolParams = z.infer<typeof ListPanelsToolParameters>;\n\nexport function createListPanelsTool(deps: DashboardToolDeps) {\n return tool({\n description: `List dashboard panels: returns all panels in the current dashboard with their IDs, types, titles, configurations, and any current runtime issue.\n\nUse when: you need to discover panel IDs before updating or removing panels, or when user asks \"what's on this dashboard\".\n\nRuntime issues are transient chart diagnostics such as too-much-data or sql-error. If a panel has an issue, use the panel ID to update it in place with a safer chart configuration.\n\nReturns array of: {id, type, title, config, issue?} for each panel.`,\n inputSchema: ListPanelsToolParameters,\n execute: async (params) => {\n try {\n const artifactId = deps.resolveArtifact(params.artifactId);\n\n const dashboard = deps.getDashboard(artifactId);\n if (!dashboard) {\n return {\n llmResult: {\n success: false,\n errorMessage: `Dashboard \"${artifactId}\" not found.`,\n },\n };\n }\n\n const panels = dashboard.panels.map((panel: any) => {\n const issue = deps.getPanelIssue?.(artifactId, panel.id);\n return {\n id: panel.id,\n type: panel.type,\n title: panel.title,\n config: panel.config,\n ...(issue ? {issue} : {}),\n };\n });\n\n return {\n llmResult: {\n success: true,\n details: `Found ${panels.length} panel(s) in dashboard.`,\n data: {\n artifactId,\n panels,\n },\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { DashboardToolDeps } from '../charts/chart-types/base-types';
|
|
3
|
-
export declare const RemovePanelToolParameters: z.ZodObject<{
|
|
4
|
-
artifactId: z.ZodOptional<z.ZodString>;
|
|
5
|
-
panelId: z.ZodString;
|
|
6
|
-
reasoning: z.ZodString;
|
|
7
|
-
}, z.core.$strip>;
|
|
8
|
-
export type RemovePanelToolParams = z.infer<typeof RemovePanelToolParameters>;
|
|
9
|
-
export declare function createRemovePanelTool(deps: DashboardToolDeps): import("ai").Tool<{
|
|
10
|
-
panelId: string;
|
|
11
|
-
reasoning: string;
|
|
12
|
-
artifactId?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
llmResult: {
|
|
15
|
-
success: boolean;
|
|
16
|
-
details: string;
|
|
17
|
-
data: {
|
|
18
|
-
artifactId: string;
|
|
19
|
-
panelId: string;
|
|
20
|
-
};
|
|
21
|
-
errorMessage?: undefined;
|
|
22
|
-
};
|
|
23
|
-
} | {
|
|
24
|
-
llmResult: {
|
|
25
|
-
success: boolean;
|
|
26
|
-
errorMessage: string;
|
|
27
|
-
details?: undefined;
|
|
28
|
-
data?: undefined;
|
|
29
|
-
};
|
|
30
|
-
}>;
|
|
31
|
-
//# sourceMappingURL=remove-panel-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-panel-tool.d.ts","sourceRoot":"","sources":["../../src/ai/remove-panel-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;iBAWpC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE9E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;GA+C5D"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { tool } from 'ai';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export const RemovePanelToolParameters = z.object({
|
|
4
|
-
artifactId: z
|
|
5
|
-
.string()
|
|
6
|
-
.optional()
|
|
7
|
-
.describe('Optional dashboard artifact ID. Defaults to current dashboard.'),
|
|
8
|
-
panelId: z
|
|
9
|
-
.string()
|
|
10
|
-
.describe('ID of the panel to remove. Use list_dashboard_panels to discover panel IDs.'),
|
|
11
|
-
reasoning: z.string().describe('Brief rationale for removing this panel.'),
|
|
12
|
-
});
|
|
13
|
-
export function createRemovePanelTool(deps) {
|
|
14
|
-
return tool({
|
|
15
|
-
description: `Remove dashboard panel: deletes a panel from the dashboard by its ID.
|
|
16
|
-
|
|
17
|
-
Use when: user asks to "remove", "delete", "get rid of" a specific panel.
|
|
18
|
-
|
|
19
|
-
Use list_dashboard_panels first to discover panel IDs.`,
|
|
20
|
-
inputSchema: RemovePanelToolParameters,
|
|
21
|
-
execute: async (params) => {
|
|
22
|
-
try {
|
|
23
|
-
const artifactId = deps.resolveArtifact(params.artifactId);
|
|
24
|
-
const dashboard = deps.getDashboard(artifactId);
|
|
25
|
-
if (!dashboard) {
|
|
26
|
-
throw new Error(`Dashboard "${artifactId}" not found.`);
|
|
27
|
-
}
|
|
28
|
-
const panelExists = dashboard.panels.some((panel) => panel.id === params.panelId);
|
|
29
|
-
if (!panelExists) {
|
|
30
|
-
throw new Error(`Panel "${params.panelId}" not found in dashboard "${artifactId}". Cannot remove.`);
|
|
31
|
-
}
|
|
32
|
-
deps.removePanel(artifactId, params.panelId);
|
|
33
|
-
return {
|
|
34
|
-
llmResult: {
|
|
35
|
-
success: true,
|
|
36
|
-
details: `Removed panel "${params.panelId}" from dashboard.`,
|
|
37
|
-
data: {
|
|
38
|
-
artifactId,
|
|
39
|
-
panelId: params.panelId,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
return {
|
|
46
|
-
llmResult: {
|
|
47
|
-
success: false,
|
|
48
|
-
errorMessage: error instanceof Error ? error.message : String(error),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=remove-panel-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-panel-tool.js","sourceRoot":"","sources":["../../src/ai/remove-panel-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAC;AACxB,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,CACP,6EAA6E,CAC9E;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;CAC3E,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,IAAI,CAAC;QACV,WAAW,EAAE;;;;uDAIsC;QACnD,WAAW,EAAE,yBAAyB;QACtC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CAAC,cAAc,UAAU,cAAc,CAAC,CAAC;gBAC1D,CAAC;gBACD,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CACvC,CAAC,KAAmB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CACrD,CAAC;gBACF,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,OAAO,6BAA6B,UAAU,mBAAmB,CACnF,CAAC;gBACJ,CAAC;gBAED,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBAE7C,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,kBAAkB,MAAM,CAAC,OAAO,mBAAmB;wBAC5D,IAAI,EAAE;4BACJ,UAAU;4BACV,OAAO,EAAE,MAAM,CAAC,OAAO;yBACxB;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,SAAS,EAAE;wBACT,OAAO,EAAE,KAAK;wBACd,YAAY,EACV,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBACzD;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {tool} from 'ai';\nimport {z} from 'zod';\nimport type {DashboardToolDeps} from '../charts/chart-types/base-types';\n\nexport const RemovePanelToolParameters = z.object({\n artifactId: z\n .string()\n .optional()\n .describe('Optional dashboard artifact ID. Defaults to current dashboard.'),\n panelId: z\n .string()\n .describe(\n 'ID of the panel to remove. Use list_dashboard_panels to discover panel IDs.',\n ),\n reasoning: z.string().describe('Brief rationale for removing this panel.'),\n});\n\nexport type RemovePanelToolParams = z.infer<typeof RemovePanelToolParameters>;\n\nexport function createRemovePanelTool(deps: DashboardToolDeps) {\n return tool({\n description: `Remove dashboard panel: deletes a panel from the dashboard by its ID.\n\nUse when: user asks to \"remove\", \"delete\", \"get rid of\" a specific panel.\n\nUse list_dashboard_panels first to discover panel IDs.`,\n inputSchema: RemovePanelToolParameters,\n execute: async (params) => {\n try {\n const artifactId = deps.resolveArtifact(params.artifactId);\n const dashboard = deps.getDashboard(artifactId);\n if (!dashboard) {\n throw new Error(`Dashboard \"${artifactId}\" not found.`);\n }\n const panelExists = dashboard.panels.some(\n (panel: {id: string}) => panel.id === params.panelId,\n );\n if (!panelExists) {\n throw new Error(\n `Panel \"${params.panelId}\" not found in dashboard \"${artifactId}\". Cannot remove.`,\n );\n }\n\n deps.removePanel(artifactId, params.panelId);\n\n return {\n llmResult: {\n success: true,\n details: `Removed panel \"${params.panelId}\" from dashboard.`,\n data: {\n artifactId,\n panelId: params.panelId,\n },\n },\n };\n } catch (error) {\n return {\n llmResult: {\n success: false,\n errorMessage:\n error instanceof Error ? error.message : String(error),\n },\n };\n }\n },\n });\n}\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ChartBuilderColumn } from '../charts/chart-types/base-types';
|
|
2
|
-
export declare function validateColumnExists(columnName: string, expectedTypes: string[] | undefined, columns: ChartBuilderColumn[], fieldKey: string): void;
|
|
3
|
-
//# sourceMappingURL=tool-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-validation.d.ts","sourceRoot":"","sources":["../../src/ai/tool-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAEzE,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,EACnC,OAAO,EAAE,kBAAkB,EAAE,EAC7B,QAAQ,EAAE,MAAM,GACf,IAAI,CAkBN"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function validateColumnExists(columnName, expectedTypes, columns, fieldKey) {
|
|
2
|
-
const column = columns.find((candidate) => candidate.name === columnName);
|
|
3
|
-
if (!column) {
|
|
4
|
-
throw new Error(`Unknown column "${columnName}" for field "${fieldKey}". Available columns: ${columns.map((c) => c.name).join(', ') || '(none)'}.`);
|
|
5
|
-
}
|
|
6
|
-
if (expectedTypes?.length &&
|
|
7
|
-
!expectedTypes.some((type) => type.toUpperCase() === column.type.toUpperCase())) {
|
|
8
|
-
throw new Error(`Column "${columnName}" has type ${column.type} but field "${fieldKey}" expects ${expectedTypes.join(', ')}.`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=tool-validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-validation.js","sourceRoot":"","sources":["../../src/ai/tool-validation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,aAAmC,EACnC,OAA6B,EAC7B,QAAgB;IAEhB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAC1E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,mBAAmB,UAAU,gBAAgB,QAAQ,yBAAyB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,GAAG,CACnI,CAAC;IACJ,CAAC;IAED,IACE,aAAa,EAAE,MAAM;QACrB,CAAC,aAAa,CAAC,IAAI,CACjB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAC3D,EACD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,cAAc,MAAM,CAAC,IAAI,eAAe,QAAQ,aAAa,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9G,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type {ChartBuilderColumn} from '../charts/chart-types/base-types';\n\nexport function validateColumnExists(\n columnName: string,\n expectedTypes: string[] | undefined,\n columns: ChartBuilderColumn[],\n fieldKey: string,\n): void {\n const column = columns.find((candidate) => candidate.name === columnName);\n if (!column) {\n throw new Error(\n `Unknown column \"${columnName}\" for field \"${fieldKey}\". Available columns: ${columns.map((c) => c.name).join(', ') || '(none)'}.`,\n );\n }\n\n if (\n expectedTypes?.length &&\n !expectedTypes.some(\n (type) => type.toUpperCase() === column.type.toUpperCase(),\n )\n ) {\n throw new Error(\n `Column \"${columnName}\" has type ${column.type} but field \"${fieldKey}\" expects ${expectedTypes.join(', ')}.`,\n );\n }\n}\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type FC, type PropsWithChildren } from 'react';
|
|
2
|
-
import { type UseComboboxOptions } from './useCombobox';
|
|
3
|
-
type ComboboxRootProps<T extends string = string> = PropsWithChildren<UseComboboxOptions<T> & {
|
|
4
|
-
currentValue?: string;
|
|
5
|
-
}>;
|
|
6
|
-
declare function ComboboxRoot<T extends string = string>({ value, onChange, currentValue, children, }: ComboboxRootProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
type ComboboxTriggerProps = {
|
|
8
|
-
className?: string;
|
|
9
|
-
ariaLabel?: string;
|
|
10
|
-
};
|
|
11
|
-
type ComboboxContentProps = {
|
|
12
|
-
searchable?: boolean;
|
|
13
|
-
searchPlaceholder?: string;
|
|
14
|
-
emptyMessage?: string;
|
|
15
|
-
};
|
|
16
|
-
type ComboboxItemProps = {
|
|
17
|
-
value: string;
|
|
18
|
-
isSelected?: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Compound component for Popover-based combobox selectors.
|
|
22
|
-
*
|
|
23
|
-
* Example usage:
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <Combobox value={value} onChange={onChange}>
|
|
26
|
-
* <Combobox.Trigger>
|
|
27
|
-
* <span>{selectedLabel}</span>
|
|
28
|
-
* </Combobox.Trigger>
|
|
29
|
-
* <Combobox.Content searchable searchPlaceholder="Search...">
|
|
30
|
-
* {options.map(opt => (
|
|
31
|
-
* <Combobox.Item key={opt.value} value={opt.value}>
|
|
32
|
-
* <span>{opt.label}</span>
|
|
33
|
-
* </Combobox.Item>
|
|
34
|
-
* ))}
|
|
35
|
-
* </Combobox.Content>
|
|
36
|
-
* </Combobox>
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare const Combobox: typeof ComboboxRoot & {
|
|
40
|
-
Trigger: FC<PropsWithChildren<ComboboxTriggerProps>>;
|
|
41
|
-
Content: FC<PropsWithChildren<ComboboxContentProps>>;
|
|
42
|
-
Item: FC<PropsWithChildren<ComboboxItemProps>>;
|
|
43
|
-
};
|
|
44
|
-
export {};
|
|
45
|
-
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../src/components/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAef,OAAO,EAAc,KAAK,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAoBnE,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,iBAAiB,CACnE,kBAAkB,CAAC,CAAC,CAAC,GAAG;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CAAC;AAEF,iBAAS,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAC/C,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CActB;AAED,KAAK,oBAAoB,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAyBF,KAAK,oBAAoB,GAAG;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAuBF,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAuBF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,QAAQ;;;;CAInB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, } from 'react';
|
|
3
|
-
import { Button, cn, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Popover, PopoverContent, PopoverTrigger, } from '@sqlrooms/ui';
|
|
4
|
-
import { Check, ChevronsUpDown } from 'lucide-react';
|
|
5
|
-
import { useCombobox } from './useCombobox';
|
|
6
|
-
const ComboboxContext = createContext(null);
|
|
7
|
-
function useComboboxContext() {
|
|
8
|
-
const context = useContext(ComboboxContext);
|
|
9
|
-
if (!context) {
|
|
10
|
-
throw new Error('Combobox compound components must be used within Combobox');
|
|
11
|
-
}
|
|
12
|
-
return context;
|
|
13
|
-
}
|
|
14
|
-
function ComboboxRoot({ value, onChange, currentValue, children, }) {
|
|
15
|
-
const { popoverProps, handleSelect, open } = useCombobox({ value, onChange });
|
|
16
|
-
return (_jsx(ComboboxContext.Provider, { value: {
|
|
17
|
-
open,
|
|
18
|
-
currentValue: currentValue ?? String(value),
|
|
19
|
-
handleSelect,
|
|
20
|
-
}, children: _jsx(Popover, { ...popoverProps, children: children }) }));
|
|
21
|
-
}
|
|
22
|
-
const ComboboxTrigger = ({ children, className, ariaLabel, }) => {
|
|
23
|
-
const { open } = useComboboxContext();
|
|
24
|
-
return (_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", role: "combobox", "aria-expanded": open, "aria-label": ariaLabel, className: cn('h-8 justify-between text-xs font-normal', className), children: [children, _jsx(ChevronsUpDown, { className: "ml-2 h-3.5 w-3.5 shrink-0 opacity-50" })] }) }));
|
|
25
|
-
};
|
|
26
|
-
const ComboboxContent = ({ children, searchable = false, searchPlaceholder = 'Search...', emptyMessage = 'No matching option.', }) => {
|
|
27
|
-
return (_jsx(PopoverContent, { className: "w-[--radix-popover-trigger-width] p-0 text-xs", children: _jsxs(Command, { children: [searchable && (_jsx(CommandInput, { placeholder: searchPlaceholder, className: "text-xs" })), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: emptyMessage }), _jsx(CommandGroup, { children: children })] })] }) }));
|
|
28
|
-
};
|
|
29
|
-
const ComboboxItem = ({ value, children, isSelected, }) => {
|
|
30
|
-
const { currentValue, handleSelect } = useComboboxContext();
|
|
31
|
-
const selected = isSelected ?? currentValue === value;
|
|
32
|
-
return (_jsxs(CommandItem, { value: value, onSelect: handleSelect, children: [_jsx(Check, { className: cn('h-3.5 w-3.5 shrink-0', selected ? 'opacity-100' : 'opacity-0') }), children] }));
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Compound component for Popover-based combobox selectors.
|
|
36
|
-
*
|
|
37
|
-
* Example usage:
|
|
38
|
-
* ```tsx
|
|
39
|
-
* <Combobox value={value} onChange={onChange}>
|
|
40
|
-
* <Combobox.Trigger>
|
|
41
|
-
* <span>{selectedLabel}</span>
|
|
42
|
-
* </Combobox.Trigger>
|
|
43
|
-
* <Combobox.Content searchable searchPlaceholder="Search...">
|
|
44
|
-
* {options.map(opt => (
|
|
45
|
-
* <Combobox.Item key={opt.value} value={opt.value}>
|
|
46
|
-
* <span>{opt.label}</span>
|
|
47
|
-
* </Combobox.Item>
|
|
48
|
-
* ))}
|
|
49
|
-
* </Combobox.Content>
|
|
50
|
-
* </Combobox>
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export const Combobox = Object.assign(ComboboxRoot, {
|
|
54
|
-
Trigger: ComboboxTrigger,
|
|
55
|
-
Content: ComboboxContent,
|
|
56
|
-
Item: ComboboxItem,
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=Combobox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","sourceRoot":"","sources":["../../src/components/Combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,aAAa,EACb,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EACL,MAAM,EACN,EAAE,EACF,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,WAAW,EAA0B,MAAM,eAAe,CAAC;AAQnE,MAAM,eAAe,GAAG,aAAa,CAA8B,IAAI,CAAC,CAAC;AAEzE,SAAS,kBAAkB;IACzB,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAQD,SAAS,YAAY,CAA4B,EAC/C,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,GACa;IACrB,MAAM,EAAC,YAAY,EAAE,YAAY,EAAE,IAAI,EAAC,GAAG,WAAW,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;IAE1E,OAAO,CACL,KAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE;YACL,IAAI;YACJ,YAAY,EAAE,YAAY,IAAI,MAAM,CAAC,KAAK,CAAC;YAC3C,YAAY;SACb,YAED,KAAC,OAAO,OAAK,YAAY,YAAG,QAAQ,GAAW,GACtB,CAC5B,CAAC;AACJ,CAAC;AAOD,MAAM,eAAe,GAAgD,CAAC,EACpE,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,EAAE;IACH,MAAM,EAAC,IAAI,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAEpC,OAAO,CACL,KAAC,cAAc,IAAC,OAAO,kBACrB,MAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,UAAU,mBACA,IAAI,gBACP,SAAS,EACrB,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,aAElE,QAAQ,EACT,KAAC,cAAc,IAAC,SAAS,EAAC,sCAAsC,GAAG,IAC5D,GACM,CAClB,CAAC;AACJ,CAAC,CAAC;AAQF,MAAM,eAAe,GAAgD,CAAC,EACpE,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,iBAAiB,GAAG,WAAW,EAC/B,YAAY,GAAG,qBAAqB,GACrC,EAAE,EAAE;IACH,OAAO,CACL,KAAC,cAAc,IAAC,SAAS,EAAC,+CAA+C,YACvE,MAAC,OAAO,eACL,UAAU,IAAI,CACb,KAAC,YAAY,IAAC,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAC,SAAS,GAAG,CACrE,EACD,MAAC,WAAW,eACV,KAAC,YAAY,cAAE,YAAY,GAAgB,EAC3C,KAAC,YAAY,cAAE,QAAQ,GAAgB,IAC3B,IACN,GACK,CAClB,CAAC;AACJ,CAAC,CAAC;AAOF,MAAM,YAAY,GAA6C,CAAC,EAC9D,KAAK,EACL,QAAQ,EACR,UAAU,GACX,EAAE,EAAE;IACH,MAAM,EAAC,YAAY,EAAE,YAAY,EAAC,GAAG,kBAAkB,EAAE,CAAC;IAC1D,MAAM,QAAQ,GAAG,UAAU,IAAI,YAAY,KAAK,KAAK,CAAC;IAEtD,OAAO,CACL,MAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,aAC/C,KAAC,KAAK,IACJ,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CACvC,GACD,EACD,QAAQ,IACG,CACf,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;IAClD,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC","sourcesContent":["import {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n} from 'react';\nimport {\n Button,\n cn,\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from '@sqlrooms/ui';\nimport {Check, ChevronsUpDown} from 'lucide-react';\nimport {useCombobox, type UseComboboxOptions} from './useCombobox';\n\ninterface ComboboxContextValue {\n open: boolean;\n currentValue: string;\n handleSelect: (value: string) => void;\n}\n\nconst ComboboxContext = createContext<ComboboxContextValue | null>(null);\n\nfunction useComboboxContext() {\n const context = useContext(ComboboxContext);\n if (!context) {\n throw new Error(\n 'Combobox compound components must be used within Combobox',\n );\n }\n return context;\n}\n\ntype ComboboxRootProps<T extends string = string> = PropsWithChildren<\n UseComboboxOptions<T> & {\n currentValue?: string;\n }\n>;\n\nfunction ComboboxRoot<T extends string = string>({\n value,\n onChange,\n currentValue,\n children,\n}: ComboboxRootProps<T>) {\n const {popoverProps, handleSelect, open} = useCombobox({value, onChange});\n\n return (\n <ComboboxContext.Provider\n value={{\n open,\n currentValue: currentValue ?? String(value),\n handleSelect,\n }}\n >\n <Popover {...popoverProps}>{children}</Popover>\n </ComboboxContext.Provider>\n );\n}\n\ntype ComboboxTriggerProps = {\n className?: string;\n ariaLabel?: string;\n};\n\nconst ComboboxTrigger: FC<PropsWithChildren<ComboboxTriggerProps>> = ({\n children,\n className,\n ariaLabel,\n}) => {\n const {open} = useComboboxContext();\n\n return (\n <PopoverTrigger asChild>\n <Button\n variant=\"outline\"\n role=\"combobox\"\n aria-expanded={open}\n aria-label={ariaLabel}\n className={cn('h-8 justify-between text-xs font-normal', className)}\n >\n {children}\n <ChevronsUpDown className=\"ml-2 h-3.5 w-3.5 shrink-0 opacity-50\" />\n </Button>\n </PopoverTrigger>\n );\n};\n\ntype ComboboxContentProps = {\n searchable?: boolean;\n searchPlaceholder?: string;\n emptyMessage?: string;\n};\n\nconst ComboboxContent: FC<PropsWithChildren<ComboboxContentProps>> = ({\n children,\n searchable = false,\n searchPlaceholder = 'Search...',\n emptyMessage = 'No matching option.',\n}) => {\n return (\n <PopoverContent className=\"w-[--radix-popover-trigger-width] p-0 text-xs\">\n <Command>\n {searchable && (\n <CommandInput placeholder={searchPlaceholder} className=\"text-xs\" />\n )}\n <CommandList>\n <CommandEmpty>{emptyMessage}</CommandEmpty>\n <CommandGroup>{children}</CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n );\n};\n\ntype ComboboxItemProps = {\n value: string;\n isSelected?: boolean;\n};\n\nconst ComboboxItem: FC<PropsWithChildren<ComboboxItemProps>> = ({\n value,\n children,\n isSelected,\n}) => {\n const {currentValue, handleSelect} = useComboboxContext();\n const selected = isSelected ?? currentValue === value;\n\n return (\n <CommandItem value={value} onSelect={handleSelect}>\n <Check\n className={cn(\n 'h-3.5 w-3.5 shrink-0',\n selected ? 'opacity-100' : 'opacity-0',\n )}\n />\n {children}\n </CommandItem>\n );\n};\n\n/**\n * Compound component for Popover-based combobox selectors.\n *\n * Example usage:\n * ```tsx\n * <Combobox value={value} onChange={onChange}>\n * <Combobox.Trigger>\n * <span>{selectedLabel}</span>\n * </Combobox.Trigger>\n * <Combobox.Content searchable searchPlaceholder=\"Search...\">\n * {options.map(opt => (\n * <Combobox.Item key={opt.value} value={opt.value}>\n * <span>{opt.label}</span>\n * </Combobox.Item>\n * ))}\n * </Combobox.Content>\n * </Combobox>\n * ```\n */\nexport const Combobox = Object.assign(ComboboxRoot, {\n Trigger: ComboboxTrigger,\n Content: ComboboxContent,\n Item: ComboboxItem,\n});\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface UseComboboxOptions<T extends string = string> {
|
|
2
|
-
value: T;
|
|
3
|
-
onChange: (value: T) => void;
|
|
4
|
-
}
|
|
5
|
-
export interface UseComboboxReturn {
|
|
6
|
-
open: boolean;
|
|
7
|
-
setOpen: (open: boolean) => void;
|
|
8
|
-
handleSelect: (value: string) => void;
|
|
9
|
-
popoverProps: {
|
|
10
|
-
open: boolean;
|
|
11
|
-
onOpenChange: (open: boolean) => void;
|
|
12
|
-
};
|
|
13
|
-
triggerProps: {
|
|
14
|
-
role: 'combobox';
|
|
15
|
-
'aria-expanded': boolean;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Shared combobox state and behavior for Popover-based selectors.
|
|
20
|
-
* Handles open/close state and selection with auto-close.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useCombobox<T extends string = string>(options: UseComboboxOptions<T>): UseComboboxReturn;
|
|
23
|
-
//# sourceMappingURL=useCombobox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCombobox.d.ts","sourceRoot":"","sources":["../../src/components/useCombobox.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC3D,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE;QACZ,IAAI,EAAE,OAAO,CAAC;QACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;KACvC,CAAC;IACF,YAAY,EAAE;QACZ,IAAI,EAAE,UAAU,CAAC;QACjB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACnD,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,iBAAiB,CAwBnB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Shared combobox state and behavior for Popover-based selectors.
|
|
4
|
-
* Handles open/close state and selection with auto-close.
|
|
5
|
-
*/
|
|
6
|
-
export function useCombobox(options) {
|
|
7
|
-
const [open, setOpen] = useState(false);
|
|
8
|
-
const handleSelect = useCallback((value) => {
|
|
9
|
-
options.onChange(value);
|
|
10
|
-
setOpen(false);
|
|
11
|
-
}, [options]);
|
|
12
|
-
return {
|
|
13
|
-
open,
|
|
14
|
-
setOpen,
|
|
15
|
-
handleSelect,
|
|
16
|
-
popoverProps: {
|
|
17
|
-
open,
|
|
18
|
-
onOpenChange: setOpen,
|
|
19
|
-
},
|
|
20
|
-
triggerProps: {
|
|
21
|
-
role: 'combobox',
|
|
22
|
-
'aria-expanded': open,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=useCombobox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCombobox.js","sourceRoot":"","sources":["../../src/components/useCombobox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAqB5C;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,OAA8B;IAE9B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,KAAa,EAAE,EAAE;QAChB,OAAO,CAAC,QAAQ,CAAC,KAAU,CAAC,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,OAAO;QACP,YAAY;QACZ,YAAY,EAAE;YACZ,IAAI;YACJ,YAAY,EAAE,OAAO;SACtB;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,UAAmB;YACzB,eAAe,EAAE,IAAI;SACtB;KACF,CAAC;AACJ,CAAC","sourcesContent":["import {useState, useCallback} from 'react';\n\nexport interface UseComboboxOptions<T extends string = string> {\n value: T;\n onChange: (value: T) => void;\n}\n\nexport interface UseComboboxReturn {\n open: boolean;\n setOpen: (open: boolean) => void;\n handleSelect: (value: string) => void;\n popoverProps: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n };\n triggerProps: {\n role: 'combobox';\n 'aria-expanded': boolean;\n };\n}\n\n/**\n * Shared combobox state and behavior for Popover-based selectors.\n * Handles open/close state and selection with auto-close.\n */\nexport function useCombobox<T extends string = string>(\n options: UseComboboxOptions<T>,\n): UseComboboxReturn {\n const [open, setOpen] = useState(false);\n\n const handleSelect = useCallback(\n (value: string) => {\n options.onChange(value as T);\n setOpen(false);\n },\n [options],\n );\n\n return {\n open,\n setOpen,\n handleSelect,\n popoverProps: {\n open,\n onOpenChange: setOpen,\n },\n triggerProps: {\n role: 'combobox' as const,\n 'aria-expanded': open,\n },\n };\n}\n"]}
|