@databricks/appkit-ui 0.92.0 → 0.94.0
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/CLAUDE.md +3 -0
- package/dist/cli/commands/docs.js +231 -10
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/plugin/add/add.js +398 -0
- package/dist/cli/commands/plugin/add/add.js.map +1 -0
- package/dist/cli/commands/plugin/add/plan.js +216 -0
- package/dist/cli/commands/plugin/add/plan.js.map +1 -0
- package/dist/cli/commands/plugin/add/resolve.js +45 -0
- package/dist/cli/commands/plugin/add/resolve.js.map +1 -0
- package/dist/cli/commands/plugin/index.js +4 -1
- package/dist/cli/commands/plugin/index.js.map +1 -1
- package/dist/cli/commands/registry/add.js +3 -2
- package/dist/cli/commands/registry/add.js.map +1 -1
- package/dist/cli/commands/registry/config-plan.js +1 -1
- package/dist/cli/commands/registry/config-plan.js.map +1 -1
- package/dist/cli/commands/registry/config-writer.js +77 -9
- package/dist/cli/commands/registry/config-writer.js.map +1 -1
- package/dist/cli/commands/registry/env-writer.js +1 -1
- package/dist/cli/commands/registry/env-writer.js.map +1 -1
- package/dist/cli/commands/registry/server-register.js +62 -26
- package/dist/cli/commands/registry/server-register.js.map +1 -1
- package/dist/cli/commands/registry/workspace-picker.js +1 -1
- package/dist/cli/deploy-config.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/react/beta.d.ts +3 -1
- package/dist/react/beta.js +3 -1
- package/dist/react/charts/base.d.ts +1 -1
- package/dist/react/charts/base.d.ts.map +1 -1
- package/dist/react/charts/base.js +5 -3
- package/dist/react/charts/base.js.map +1 -1
- package/dist/react/charts/constants.js +13 -1
- package/dist/react/charts/constants.js.map +1 -1
- package/dist/react/charts/create-chart.js +1 -1
- package/dist/react/charts/create-chart.js.map +1 -1
- package/dist/react/charts/index.d.ts +1 -1
- package/dist/react/charts/types.d.ts +17 -8
- package/dist/react/charts/types.d.ts.map +1 -1
- package/dist/react/charts/types.js.map +1 -1
- package/dist/react/charts/wrapper.d.ts +1 -1
- package/dist/react/charts/wrapper.d.ts.map +1 -1
- package/dist/react/charts/wrapper.js +12 -5
- package/dist/react/charts/wrapper.js.map +1 -1
- package/dist/react/design-page.d.ts +33 -0
- package/dist/react/design-page.d.ts.map +1 -0
- package/dist/react/design-page.js +173 -0
- package/dist/react/design-page.js.map +1 -0
- package/dist/react/hooks/use-design-ready.d.ts +19 -0
- package/dist/react/hooks/use-design-ready.d.ts.map +1 -0
- package/dist/react/hooks/use-design-ready.js +33 -0
- package/dist/react/hooks/use-design-ready.js.map +1 -0
- package/dist/react/index.d.ts +2 -2
- package/dist/react/table/data-table.d.ts +6 -0
- package/dist/react/table/data-table.d.ts.map +1 -1
- package/dist/react/table/data-table.js +6 -0
- package/dist/react/table/data-table.js.map +1 -1
- package/dist/shared/src/plugin.d.ts.map +1 -1
- package/docs/api/appkit/Variable.design.md +6 -0
- package/docs/api/appkit-ui/data/AreaChart.md +25 -25
- package/docs/api/appkit-ui/data/BarChart.md +23 -23
- package/docs/api/appkit-ui/data/DataTable.md +2 -0
- package/docs/api/appkit-ui/data/DonutChart.md +24 -24
- package/docs/api/appkit-ui/data/HeatmapChart.md +25 -25
- package/docs/api/appkit-ui/data/LineChart.md +24 -24
- package/docs/api/appkit-ui/data/PieChart.md +24 -24
- package/docs/api/appkit-ui/data/RadarChart.md +22 -22
- package/docs/api/appkit-ui/data/ScatterChart.md +22 -22
- package/docs/api/appkit.md +1 -0
- package/docs/plugins/analytics.md +9 -1
- package/docs/plugins/design.md +233 -0
- package/llms.txt +3 -0
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { chartSizeStyle } from "./constants.js";
|
|
1
2
|
import { mapToDatum } from "./utils.js";
|
|
2
3
|
import { normalizeChartData, normalizeHeatmapData } from "./normalize.js";
|
|
3
4
|
import { applySelectionEmphasis, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption } from "./options.js";
|
|
@@ -42,7 +43,7 @@ function getDefaultPalette(chartType) {
|
|
|
42
43
|
* Base chart component that handles both Arrow and JSON data.
|
|
43
44
|
* Renders using ECharts for consistent output across both formats.
|
|
44
45
|
*/
|
|
45
|
-
function BaseChart({ data, chartType, xKey, yKey, orientation, height
|
|
46
|
+
function BaseChart({ data, chartType, xKey, yKey, orientation, height, title, showLegend = true, colorPalette, colors: customColors, showSymbol = false, smooth = true, stacked = false, symbolSize = 8, showArea = true, innerRadius = 0, showLabels = true, labelPosition = "outside", yAxisKey, min, max, options: customOptions, valueFormatter, className, onDataClick, selected }) {
|
|
46
47
|
const themeColors = useThemeColors(colorPalette ?? getDefaultPalette(chartType));
|
|
47
48
|
const colors = customColors ?? themeColors;
|
|
48
49
|
const ui = useChartUITokens();
|
|
@@ -147,14 +148,15 @@ function BaseChart({ data, chartType, xKey, yKey, orientation, height = 300, tit
|
|
|
147
148
|
if (result && typeof result.then === "function") result.catch(() => {});
|
|
148
149
|
} } : void 0, [interactive]);
|
|
149
150
|
if (!option) return /* @__PURE__ */ jsx("div", {
|
|
150
|
-
className: "flex items-center justify-center
|
|
151
|
+
className: "flex items-center justify-center text-muted-foreground",
|
|
152
|
+
style: chartSizeStyle(height),
|
|
151
153
|
children: "No data"
|
|
152
154
|
});
|
|
153
155
|
return /* @__PURE__ */ jsx(ReactEChartsCore, {
|
|
154
156
|
ref: chartRefCallback,
|
|
155
157
|
echarts,
|
|
156
158
|
option,
|
|
157
|
-
style:
|
|
159
|
+
style: chartSizeStyle(height),
|
|
158
160
|
className,
|
|
159
161
|
opts: { renderer: "canvas" },
|
|
160
162
|
notMerge: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":[],"sources":["../../../src/react/charts/base.tsx"],"sourcesContent":["// Type-only import: erased at compile time, does not pull the full echarts\n// bundle in. The `ECharts` type is used for the stored ECharts instance ref.\nimport type { ECharts } from \"echarts\";\n// Import the ESM core build, not `echarts-for-react/lib/core` (CJS). The package\n// has no `exports` map, so `/lib/core` resolves to the literal CommonJS file\n// whose default export is `module.exports`; under ESM default-import interop a\n// consumer's bundler hands back the whole `{ default, __esModule }` object rather\n// than the component, so `<ReactEChartsCore/>` renders an object and React throws\n// \"Element type is invalid\". `esm/core` is real ESM with a true `export default`.\nimport ReactEChartsCore from \"echarts-for-react/esm/core\";\nimport {\n BarChart,\n HeatmapChart,\n LineChart,\n PieChart,\n RadarChart,\n ScatterChart,\n} from \"echarts/charts\";\nimport {\n GridComponent,\n LegendComponent,\n TitleComponent,\n TooltipComponent,\n VisualMapComponent,\n} from \"echarts/components\";\nimport * as echarts from \"echarts/core\";\nimport { LegacyGridContainLabel } from \"echarts/features\";\nimport { CanvasRenderer } from \"echarts/renderers\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { normalizeChartData, normalizeHeatmapData } from \"./normalize\";\nimport {\n applySelectionEmphasis,\n buildCartesianOption,\n buildHeatmapOption,\n buildHorizontalBarOption,\n buildPieOption,\n buildRadarOption,\n type OptionBuilderContext,\n} from \"./options\";\nimport { useChartUITokens, useThemeColors } from \"./theme\";\nimport type {\n ChartBaseProps,\n ChartClickDatum,\n ChartColorPalette,\n ChartData,\n ChartType,\n ChartValueFormatter,\n Orientation,\n} from \"./types\";\nimport { mapToDatum } from \"./utils\";\n\n// ============================================================================\n// ECharts Registration (modular imports for tree-shaking)\n// ============================================================================\n// Only the chart types and components used by the option builders in\n// `options.ts` are registered. Importing from `echarts/core` instead of the\n// full `echarts` entry keeps unused chart types (graph, sankey, gauge, ...)\n// out of consumer bundles.\n//\n// If you add a new chart type or use a new ECharts feature (e.g. dataZoom,\n// toolbox, markLine), register it here. Consumers passing custom `options`\n// that need extra features can register them in their own app via\n// `import { use } from \"echarts/core\"`.\n//\n// Note: tooltip-driven axisPointer is bundled with `TooltipComponent`, so no\n// explicit AxisPointerComponent registration is needed.\n//\n// This `use()` call must stay co-located in the same module as `BaseChart`:\n// `package.json#sideEffects` declares JS modules side-effect free, so moving\n// registration to a separate import-for-side-effect module would let bundlers\n// drop it during tree-shaking.\necharts.use([\n // Series types used by the option builders\n LineChart, // line + area charts (area = line with areaStyle)\n BarChart, // bar + horizontal bar charts\n PieChart, // pie + donut charts\n ScatterChart,\n HeatmapChart,\n RadarChart,\n // Components referenced by built options\n TitleComponent, // `title`\n TooltipComponent, // `tooltip`\n LegendComponent, // `legend`\n GridComponent, // `grid` / `xAxis` / `yAxis`\n VisualMapComponent, // `visualMap` (heatmap color scale)\n // Features\n LegacyGridContainLabel, // `grid.containLabel` (cartesian option builder)\n // Renderer (BaseChart always renders with `renderer: \"canvas\"`)\n CanvasRenderer,\n]);\n\n// ============================================================================\n// Palette Selection\n// ============================================================================\n\n/**\n * Determines the appropriate color palette for a chart type.\n * - Heatmaps use sequential (low → high intensity)\n * - All other charts use categorical (distinct categories)\n */\nfunction getDefaultPalette(chartType: ChartType): ChartColorPalette {\n switch (chartType) {\n case \"heatmap\":\n return \"sequential\";\n default:\n return \"categorical\";\n }\n}\n\n// ============================================================================\n// Component Props\n// ============================================================================\n\nexport interface BaseChartProps {\n /** Chart data (Arrow Table or JSON array) - format is auto-detected */\n data: ChartData;\n /** Chart type */\n chartType: ChartType;\n /** X-axis field key (auto-detected from schema if not provided) */\n xKey?: string;\n /** Y-axis field key(s) (auto-detected from schema if not provided) */\n yKey?: string | string[];\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Chart height in pixels @default 300 */\n height?: number;\n /** Chart title */\n title?: string;\n /** Show legend @default true */\n showLegend?: boolean;\n /**\n * Color palette to use. Auto-selected based on chart type if not specified.\n * - \"categorical\": Distinct colors for different categories (bar, pie, line)\n * - \"sequential\": Gradient for magnitude (heatmap)\n * - \"diverging\": Two-tone for positive/negative (correlation)\n */\n colorPalette?: ChartColorPalette;\n /** Custom colors (overrides colorPalette) */\n colors?: string[];\n /** Show data point symbols (line/area charts) @default false */\n showSymbol?: boolean;\n /** Smooth line curves (line/area charts) @default true */\n smooth?: boolean;\n /** Stack series @default false */\n stacked?: boolean;\n /** Symbol size for scatter charts @default 8 */\n symbolSize?: number;\n /** Show area fill for radar charts @default true */\n showArea?: boolean;\n /** Inner radius for pie/donut (0-100) @default 0 */\n innerRadius?: number;\n /** Show labels on pie/donut slices @default true */\n showLabels?: boolean;\n /** Label position for pie/donut @default \"outside\" */\n labelPosition?: \"outside\" | \"inside\" | \"center\";\n /** Y-axis field key for heatmap (the row dimension) */\n yAxisKey?: string;\n /** Min value for heatmap color scale */\n min?: number;\n /** Max value for heatmap color scale */\n max?: number;\n /**\n * Additional ECharts options to merge.\n *\n * Only the built-in feature set is registered by this package, so options\n * referencing extra ECharts features (`dataZoom`, `toolbox`, `markLine`,\n * `markArea`, `graphic`, `dataset`, top-level `axisPointer`, ...) require\n * registering them in your app via `import { use } from \"echarts/core\"`.\n * This only works when your `echarts` resolves to the same module\n * instance/version as this package's (the registry is a singleton;\n * duplicate echarts copies won't share registrations).\n */\n options?: Record<string, unknown>;\n /** Formats measure values. See {@link ChartBaseProps.valueFormatter}. */\n valueFormatter?: ChartValueFormatter;\n /** Additional CSS classes */\n className?: string;\n /**\n * Fired when a data element (bar, slice, point) is clicked. Fire-and-forget:\n * the return value is ignored (async handlers are fine — the chart never awaits).\n * The handler receives a normalized {@link ChartClickDatum}.\n *\n * Pointer-only: charts render to <canvas>, so this does not fire for keyboard\n * users. Provide a keyboard-accessible equivalent (e.g. a table row action) for\n * the same action.\n */\n onDataClick?: (datum: ChartClickDatum) => void;\n /** Controlled selection by category name. See {@link ChartBaseProps.selected}. */\n selected?: string | string[];\n}\n\n// ============================================================================\n// Base Chart Component\n// ============================================================================\n\n/**\n * Base chart component that handles both Arrow and JSON data.\n * Renders using ECharts for consistent output across both formats.\n */\nexport function BaseChart({\n data,\n chartType,\n xKey,\n yKey,\n orientation,\n height = 300,\n title,\n showLegend = true,\n colorPalette,\n colors: customColors,\n showSymbol = false,\n smooth = true,\n stacked = false,\n symbolSize = 8,\n showArea = true,\n innerRadius = 0,\n showLabels = true,\n labelPosition = \"outside\",\n yAxisKey,\n min,\n max,\n options: customOptions,\n valueFormatter,\n className,\n onDataClick,\n selected,\n}: BaseChartProps) {\n // Determine the appropriate color palette based on chart type\n const resolvedPalette = colorPalette ?? getDefaultPalette(chartType);\n const themeColors = useThemeColors(resolvedPalette);\n const colors = customColors ?? themeColors;\n\n const ui = useChartUITokens();\n\n // Handler presence enables line interaction and gates events. Tracking the\n // boolean keeps inline handler identities from rebuilding chart options.\n const interactive = !!onDataClick;\n\n // Keep the latest handler in a ref so `onEvents` can call the current\n // `onDataClick` without listing it as a dependency (see `onEvents` below).\n const onDataClickRef = useRef(onDataClick);\n onDataClickRef.current = onDataClick;\n\n // Store ECharts instance directly to avoid stale ref issues on unmount\n const echartsInstanceRef = useRef<ECharts | null>(null);\n\n // Callback ref pattern: captures the ECharts instance when ReactECharts mounts\n // This ensures we always have a stable reference to the actual instance\n const chartRefCallback = useCallback((node: ReactEChartsCore | null) => {\n // Dispose previous instance if component is being replaced\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n\n // Store the new instance\n if (node) {\n echartsInstanceRef.current = node.getEchartsInstance();\n } else {\n // Component unmounting - dispose the stored instance\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n echartsInstanceRef.current = null;\n }\n }, []);\n\n // Memoize data normalization\n const normalized = useMemo(\n () =>\n chartType === \"heatmap\"\n ? normalizeHeatmapData(data, xKey, yAxisKey, yKey)\n : normalizeChartData(data, xKey, yKey, orientation),\n [data, xKey, yKey, yAxisKey, orientation, chartType],\n );\n\n // Memoize option building\n const option = useMemo(() => {\n const { xData, yFields, xField, chartType: detectedChartType } = normalized;\n\n if (xData.length === 0) return null;\n\n // Determine chart mode first (needed to handle yDataMap)\n const isHeatmap = chartType === \"heatmap\";\n\n // Heatmaps use heatmapData instead of yDataMap\n // For other charts, yDataMap is required\n const yDataMap = \"yDataMap\" in normalized ? normalized.yDataMap : {};\n\n const baseCtx: OptionBuilderContext = {\n xData,\n yDataMap,\n yFields,\n colors,\n title,\n showLegend,\n xField,\n ui,\n valueFormatter,\n };\n const isPie = chartType === \"pie\" || chartType === \"donut\";\n const isRadar = chartType === \"radar\";\n const isHorizontal =\n !isPie &&\n !isRadar &&\n !isHeatmap &&\n (orientation === \"horizontal\" ||\n (detectedChartType === \"categorical\" &&\n !orientation &&\n chartType === \"bar\"));\n const isTimeSeries =\n detectedChartType === \"timeseries\" &&\n !isHorizontal &&\n !isRadar &&\n !isHeatmap;\n\n // Build option based on chart type\n let opt: Record<string, unknown>;\n\n if (isHeatmap && \"yAxisData\" in normalized && \"heatmapData\" in normalized) {\n const heatmapNorm = normalized as {\n yAxisData: (string | number)[];\n heatmapData: [number, number, number][];\n min: number;\n max: number;\n } & typeof normalized;\n opt = buildHeatmapOption({\n ...baseCtx,\n yAxisData: heatmapNorm.yAxisData,\n heatmapData: heatmapNorm.heatmapData,\n min: min ?? heatmapNorm.min,\n max: max ?? heatmapNorm.max,\n showLabels,\n });\n } else if (isRadar) {\n opt = buildRadarOption(baseCtx, showArea);\n } else if (isPie) {\n opt = buildPieOption(\n baseCtx,\n chartType as \"pie\" | \"donut\",\n innerRadius,\n showLabels,\n labelPosition,\n );\n } else if (isHorizontal) {\n opt = buildHorizontalBarOption(baseCtx, stacked);\n } else {\n opt = buildCartesianOption({\n ...baseCtx,\n chartType,\n isTimeSeries,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n interactive,\n });\n }\n\n // Apply selection after custom options; empty selection is a no-op.\n const merged = customOptions ? { ...opt, ...customOptions } : opt;\n return applySelectionEmphasis(merged, selected);\n }, [\n normalized,\n colors,\n ui,\n title,\n showLegend,\n chartType,\n orientation,\n innerRadius,\n showLabels,\n labelPosition,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n showArea,\n min,\n max,\n customOptions,\n valueFormatter,\n selected,\n interactive,\n ]);\n\n // Heatmap data uses axis indexes; preserve labels for click results instead\n // of exposing those raw positions.\n const axisLabels = useMemo(\n () => ({\n xLabels: normalized.xData,\n yLabels:\n \"yAxisData\" in normalized\n ? (normalized.yAxisData as (string | number)[])\n : undefined,\n }),\n [normalized],\n );\n\n // `onEvents` must not re-subscribe when the data changes (e.g. each SSE tick).\n const axisLabelsRef = useRef(axisLabels);\n axisLabelsRef.current = axisLabels;\n\n // Memoize by handler presence because echarts-for-react re-subscribes whenever\n // `onEvents` changes, while callers commonly pass a new inline callback on\n // every render. This also avoids churn during frequently changing data such\n // as SSE ticks.\n const onEvents = useMemo(\n () =>\n interactive\n ? {\n click: (params: unknown, instance: ECharts) => {\n const result = onDataClickRef.current?.(\n mapToDatum(params, axisLabelsRef.current, instance),\n ) as void | Promise<void>;\n if (\n result &&\n typeof (result as Promise<void>).then === \"function\"\n ) {\n (result as Promise<void>).catch(() => {});\n }\n },\n }\n : undefined,\n [interactive],\n );\n\n if (!option) {\n return (\n <div className=\"flex items-center justify-center h-full text-muted-foreground\">\n No data\n </div>\n );\n }\n\n return (\n <ReactEChartsCore\n ref={chartRefCallback}\n echarts={echarts}\n option={option}\n style={{ height }}\n className={className}\n opts={{ renderer: \"canvas\" }}\n notMerge={false}\n lazyUpdate={true}\n onEvents={onEvents}\n />\n );\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"base.js","names":[],"sources":["../../../src/react/charts/base.tsx"],"sourcesContent":["// Type-only import: erased at compile time, does not pull the full echarts\n// bundle in. The `ECharts` type is used for the stored ECharts instance ref.\nimport type { ECharts } from \"echarts\";\n// Import the ESM core build, not `echarts-for-react/lib/core` (CJS). The package\n// has no `exports` map, so `/lib/core` resolves to the literal CommonJS file\n// whose default export is `module.exports`; under ESM default-import interop a\n// consumer's bundler hands back the whole `{ default, __esModule }` object rather\n// than the component, so `<ReactEChartsCore/>` renders an object and React throws\n// \"Element type is invalid\". `esm/core` is real ESM with a true `export default`.\nimport ReactEChartsCore from \"echarts-for-react/esm/core\";\nimport {\n BarChart,\n HeatmapChart,\n LineChart,\n PieChart,\n RadarChart,\n ScatterChart,\n} from \"echarts/charts\";\nimport {\n GridComponent,\n LegendComponent,\n TitleComponent,\n TooltipComponent,\n VisualMapComponent,\n} from \"echarts/components\";\nimport * as echarts from \"echarts/core\";\nimport { LegacyGridContainLabel } from \"echarts/features\";\nimport { CanvasRenderer } from \"echarts/renderers\";\nimport { useCallback, useMemo, useRef } from \"react\";\n\nimport { chartSizeStyle } from \"./constants\";\nimport { normalizeChartData, normalizeHeatmapData } from \"./normalize\";\nimport {\n applySelectionEmphasis,\n buildCartesianOption,\n buildHeatmapOption,\n buildHorizontalBarOption,\n buildPieOption,\n buildRadarOption,\n type OptionBuilderContext,\n} from \"./options\";\nimport { useChartUITokens, useThemeColors } from \"./theme\";\nimport type {\n ChartBaseProps,\n ChartClickDatum,\n ChartColorPalette,\n ChartData,\n ChartType,\n ChartValueFormatter,\n Orientation,\n} from \"./types\";\nimport { mapToDatum } from \"./utils\";\n\n// ============================================================================\n// ECharts Registration (modular imports for tree-shaking)\n// ============================================================================\n// Only the chart types and components used by the option builders in\n// `options.ts` are registered. Importing from `echarts/core` instead of the\n// full `echarts` entry keeps unused chart types (graph, sankey, gauge, ...)\n// out of consumer bundles.\n//\n// If you add a new chart type or use a new ECharts feature (e.g. dataZoom,\n// toolbox, markLine), register it here. Consumers passing custom `options`\n// that need extra features can register them in their own app via\n// `import { use } from \"echarts/core\"`.\n//\n// Note: tooltip-driven axisPointer is bundled with `TooltipComponent`, so no\n// explicit AxisPointerComponent registration is needed.\n//\n// This `use()` call must stay co-located in the same module as `BaseChart`:\n// `package.json#sideEffects` declares JS modules side-effect free, so moving\n// registration to a separate import-for-side-effect module would let bundlers\n// drop it during tree-shaking.\necharts.use([\n // Series types used by the option builders\n LineChart, // line + area charts (area = line with areaStyle)\n BarChart, // bar + horizontal bar charts\n PieChart, // pie + donut charts\n ScatterChart,\n HeatmapChart,\n RadarChart,\n // Components referenced by built options\n TitleComponent, // `title`\n TooltipComponent, // `tooltip`\n LegendComponent, // `legend`\n GridComponent, // `grid` / `xAxis` / `yAxis`\n VisualMapComponent, // `visualMap` (heatmap color scale)\n // Features\n LegacyGridContainLabel, // `grid.containLabel` (cartesian option builder)\n // Renderer (BaseChart always renders with `renderer: \"canvas\"`)\n CanvasRenderer,\n]);\n\n// ============================================================================\n// Palette Selection\n// ============================================================================\n\n/**\n * Determines the appropriate color palette for a chart type.\n * - Heatmaps use sequential (low → high intensity)\n * - All other charts use categorical (distinct categories)\n */\nfunction getDefaultPalette(chartType: ChartType): ChartColorPalette {\n switch (chartType) {\n case \"heatmap\":\n return \"sequential\";\n default:\n return \"categorical\";\n }\n}\n\n// ============================================================================\n// Component Props\n// ============================================================================\n\nexport interface BaseChartProps {\n /** Chart data (Arrow Table or JSON array) - format is auto-detected */\n data: ChartData;\n /** Chart type */\n chartType: ChartType;\n /** X-axis field key (auto-detected from schema if not provided) */\n xKey?: string;\n /** Y-axis field key(s) (auto-detected from schema if not provided) */\n yKey?: string | string[];\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). */\n height?: number;\n /** Chart title */\n title?: string;\n /** Show legend @default true */\n showLegend?: boolean;\n /**\n * Color palette to use. Auto-selected based on chart type if not specified.\n * - \"categorical\": Distinct colors for different categories (bar, pie, line)\n * - \"sequential\": Gradient for magnitude (heatmap)\n * - \"diverging\": Two-tone for positive/negative (correlation)\n */\n colorPalette?: ChartColorPalette;\n /** Custom colors (overrides colorPalette) */\n colors?: string[];\n /** Show data point symbols (line/area charts) @default false */\n showSymbol?: boolean;\n /** Smooth line curves (line/area charts) @default true */\n smooth?: boolean;\n /** Stack series @default false */\n stacked?: boolean;\n /** Symbol size for scatter charts @default 8 */\n symbolSize?: number;\n /** Show area fill for radar charts @default true */\n showArea?: boolean;\n /** Inner radius for pie/donut (0-100) @default 0 */\n innerRadius?: number;\n /** Show labels on pie/donut slices @default true */\n showLabels?: boolean;\n /** Label position for pie/donut @default \"outside\" */\n labelPosition?: \"outside\" | \"inside\" | \"center\";\n /** Y-axis field key for heatmap (the row dimension) */\n yAxisKey?: string;\n /** Min value for heatmap color scale */\n min?: number;\n /** Max value for heatmap color scale */\n max?: number;\n /**\n * Additional ECharts options to merge.\n *\n * Only the built-in feature set is registered by this package, so options\n * referencing extra ECharts features (`dataZoom`, `toolbox`, `markLine`,\n * `markArea`, `graphic`, `dataset`, top-level `axisPointer`, ...) require\n * registering them in your app via `import { use } from \"echarts/core\"`.\n * This only works when your `echarts` resolves to the same module\n * instance/version as this package's (the registry is a singleton;\n * duplicate echarts copies won't share registrations).\n */\n options?: Record<string, unknown>;\n /** Formats measure values. See {@link ChartBaseProps.valueFormatter}. */\n valueFormatter?: ChartValueFormatter;\n /** Additional CSS classes */\n className?: string;\n /**\n * Fired when a data element (bar, slice, point) is clicked. Fire-and-forget:\n * the return value is ignored (async handlers are fine — the chart never awaits).\n * The handler receives a normalized {@link ChartClickDatum}.\n *\n * Pointer-only: charts render to <canvas>, so this does not fire for keyboard\n * users. Provide a keyboard-accessible equivalent (e.g. a table row action) for\n * the same action.\n */\n onDataClick?: (datum: ChartClickDatum) => void;\n /** Controlled selection by category name. See {@link ChartBaseProps.selected}. */\n selected?: string | string[];\n}\n\n// ============================================================================\n// Base Chart Component\n// ============================================================================\n\n/**\n * Base chart component that handles both Arrow and JSON data.\n * Renders using ECharts for consistent output across both formats.\n */\nexport function BaseChart({\n data,\n chartType,\n xKey,\n yKey,\n orientation,\n height,\n title,\n showLegend = true,\n colorPalette,\n colors: customColors,\n showSymbol = false,\n smooth = true,\n stacked = false,\n symbolSize = 8,\n showArea = true,\n innerRadius = 0,\n showLabels = true,\n labelPosition = \"outside\",\n yAxisKey,\n min,\n max,\n options: customOptions,\n valueFormatter,\n className,\n onDataClick,\n selected,\n}: BaseChartProps) {\n // Determine the appropriate color palette based on chart type\n const resolvedPalette = colorPalette ?? getDefaultPalette(chartType);\n const themeColors = useThemeColors(resolvedPalette);\n const colors = customColors ?? themeColors;\n\n const ui = useChartUITokens();\n\n // Handler presence enables line interaction and gates events. Tracking the\n // boolean keeps inline handler identities from rebuilding chart options.\n const interactive = !!onDataClick;\n\n // Keep the latest handler in a ref so `onEvents` can call the current\n // `onDataClick` without listing it as a dependency (see `onEvents` below).\n const onDataClickRef = useRef(onDataClick);\n onDataClickRef.current = onDataClick;\n\n // Store ECharts instance directly to avoid stale ref issues on unmount\n const echartsInstanceRef = useRef<ECharts | null>(null);\n\n // Callback ref pattern: captures the ECharts instance when ReactECharts mounts\n // This ensures we always have a stable reference to the actual instance\n const chartRefCallback = useCallback((node: ReactEChartsCore | null) => {\n // Dispose previous instance if component is being replaced\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n\n // Store the new instance\n if (node) {\n echartsInstanceRef.current = node.getEchartsInstance();\n } else {\n // Component unmounting - dispose the stored instance\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n echartsInstanceRef.current = null;\n }\n }, []);\n\n // Memoize data normalization\n const normalized = useMemo(\n () =>\n chartType === \"heatmap\"\n ? normalizeHeatmapData(data, xKey, yAxisKey, yKey)\n : normalizeChartData(data, xKey, yKey, orientation),\n [data, xKey, yKey, yAxisKey, orientation, chartType],\n );\n\n // Memoize option building\n const option = useMemo(() => {\n const { xData, yFields, xField, chartType: detectedChartType } = normalized;\n\n if (xData.length === 0) return null;\n\n // Determine chart mode first (needed to handle yDataMap)\n const isHeatmap = chartType === \"heatmap\";\n\n // Heatmaps use heatmapData instead of yDataMap\n // For other charts, yDataMap is required\n const yDataMap = \"yDataMap\" in normalized ? normalized.yDataMap : {};\n\n const baseCtx: OptionBuilderContext = {\n xData,\n yDataMap,\n yFields,\n colors,\n title,\n showLegend,\n xField,\n ui,\n valueFormatter,\n };\n const isPie = chartType === \"pie\" || chartType === \"donut\";\n const isRadar = chartType === \"radar\";\n const isHorizontal =\n !isPie &&\n !isRadar &&\n !isHeatmap &&\n (orientation === \"horizontal\" ||\n (detectedChartType === \"categorical\" &&\n !orientation &&\n chartType === \"bar\"));\n const isTimeSeries =\n detectedChartType === \"timeseries\" &&\n !isHorizontal &&\n !isRadar &&\n !isHeatmap;\n\n // Build option based on chart type\n let opt: Record<string, unknown>;\n\n if (isHeatmap && \"yAxisData\" in normalized && \"heatmapData\" in normalized) {\n const heatmapNorm = normalized as {\n yAxisData: (string | number)[];\n heatmapData: [number, number, number][];\n min: number;\n max: number;\n } & typeof normalized;\n opt = buildHeatmapOption({\n ...baseCtx,\n yAxisData: heatmapNorm.yAxisData,\n heatmapData: heatmapNorm.heatmapData,\n min: min ?? heatmapNorm.min,\n max: max ?? heatmapNorm.max,\n showLabels,\n });\n } else if (isRadar) {\n opt = buildRadarOption(baseCtx, showArea);\n } else if (isPie) {\n opt = buildPieOption(\n baseCtx,\n chartType as \"pie\" | \"donut\",\n innerRadius,\n showLabels,\n labelPosition,\n );\n } else if (isHorizontal) {\n opt = buildHorizontalBarOption(baseCtx, stacked);\n } else {\n opt = buildCartesianOption({\n ...baseCtx,\n chartType,\n isTimeSeries,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n interactive,\n });\n }\n\n // Apply selection after custom options; empty selection is a no-op.\n const merged = customOptions ? { ...opt, ...customOptions } : opt;\n return applySelectionEmphasis(merged, selected);\n }, [\n normalized,\n colors,\n ui,\n title,\n showLegend,\n chartType,\n orientation,\n innerRadius,\n showLabels,\n labelPosition,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n showArea,\n min,\n max,\n customOptions,\n valueFormatter,\n selected,\n interactive,\n ]);\n\n // Heatmap data uses axis indexes; preserve labels for click results instead\n // of exposing those raw positions.\n const axisLabels = useMemo(\n () => ({\n xLabels: normalized.xData,\n yLabels:\n \"yAxisData\" in normalized\n ? (normalized.yAxisData as (string | number)[])\n : undefined,\n }),\n [normalized],\n );\n\n // `onEvents` must not re-subscribe when the data changes (e.g. each SSE tick).\n const axisLabelsRef = useRef(axisLabels);\n axisLabelsRef.current = axisLabels;\n\n // Memoize by handler presence because echarts-for-react re-subscribes whenever\n // `onEvents` changes, while callers commonly pass a new inline callback on\n // every render. This also avoids churn during frequently changing data such\n // as SSE ticks.\n const onEvents = useMemo(\n () =>\n interactive\n ? {\n click: (params: unknown, instance: ECharts) => {\n const result = onDataClickRef.current?.(\n mapToDatum(params, axisLabelsRef.current, instance),\n ) as void | Promise<void>;\n if (\n result &&\n typeof (result as Promise<void>).then === \"function\"\n ) {\n (result as Promise<void>).catch(() => {});\n }\n },\n }\n : undefined,\n [interactive],\n );\n\n if (!option) {\n return (\n <div\n className=\"flex items-center justify-center text-muted-foreground\"\n style={chartSizeStyle(height)}\n >\n No data\n </div>\n );\n }\n\n return (\n <ReactEChartsCore\n ref={chartRefCallback}\n echarts={echarts}\n option={option}\n style={chartSizeStyle(height)}\n className={className}\n opts={{ renderer: \"canvas\" }}\n notMerge={false}\n lazyUpdate={true}\n onEvents={onEvents}\n />\n );\n}\n"],"mappings":"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"}
|
|
@@ -92,7 +92,19 @@ const FALLBACK_UI_TOKENS = {
|
|
|
92
92
|
grid: "hsla(240, 5%, 90%, 1)",
|
|
93
93
|
tooltipBg: "hsla(0, 0%, 100%, 1)"
|
|
94
94
|
};
|
|
95
|
+
/** Smallest height a chart takes when it fills its parent (no `height` prop). */
|
|
96
|
+
const CHART_MIN_HEIGHT = 160;
|
|
97
|
+
/**
|
|
98
|
+
* A chart's box: exactly `height` pixels, or its parent's height, at least
|
|
99
|
+
* {@link CHART_MIN_HEIGHT} when that comes from its content.
|
|
100
|
+
*/
|
|
101
|
+
function chartSizeStyle(height) {
|
|
102
|
+
return height !== void 0 ? { height } : {
|
|
103
|
+
height: "100%",
|
|
104
|
+
minHeight: CHART_MIN_HEIGHT
|
|
105
|
+
};
|
|
106
|
+
}
|
|
95
107
|
|
|
96
108
|
//#endregion
|
|
97
|
-
export { CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, CHART_UI_VARS, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, FALLBACK_UI_TOKENS };
|
|
109
|
+
export { CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, CHART_UI_VARS, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, FALLBACK_UI_TOKENS, chartSizeStyle };
|
|
98
110
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/react/charts/constants.ts"],"sourcesContent":["// ============================================================================\n// Shared Constants for Chart Components\n// ============================================================================\n\nimport type { ChartUITokens } from \"./types\";\n\n// Re-export field patterns from shared constants\nexport {\n DATE_FIELD_PATTERNS,\n METADATA_DATE_PATTERNS,\n NAME_FIELD_PATTERNS,\n} from \"@/js/constants\";\n\n// ============================================================================\n// Chart Color Palettes\n// ============================================================================\n\n/** CSS variable names for categorical chart colors (distinct categories) */\nexport const CHART_COLOR_VARS_CATEGORICAL = [\n \"--chart-cat-1\",\n \"--chart-cat-2\",\n \"--chart-cat-3\",\n \"--chart-cat-4\",\n \"--chart-cat-5\",\n \"--chart-cat-6\",\n \"--chart-cat-7\",\n \"--chart-cat-8\",\n] as const;\n\n/** CSS variable names for sequential chart colors (low → high) */\nexport const CHART_COLOR_VARS_SEQUENTIAL = [\n \"--chart-seq-1\",\n \"--chart-seq-2\",\n \"--chart-seq-3\",\n \"--chart-seq-4\",\n \"--chart-seq-5\",\n \"--chart-seq-6\",\n \"--chart-seq-7\",\n \"--chart-seq-8\",\n] as const;\n\n/** CSS variable names for diverging chart colors (negative ↔ positive) */\nexport const CHART_COLOR_VARS_DIVERGING = [\n \"--chart-div-1\",\n \"--chart-div-2\",\n \"--chart-div-3\",\n \"--chart-div-4\",\n \"--chart-div-5\",\n \"--chart-div-6\",\n \"--chart-div-7\",\n \"--chart-div-8\",\n] as const;\n\n/** Legacy: CSS variable names for chart colors (aliases to categorical) */\nexport const CHART_COLOR_VARS = [\n \"--chart-1\",\n \"--chart-2\",\n \"--chart-3\",\n \"--chart-4\",\n \"--chart-5\",\n \"--chart-6\",\n \"--chart-7\",\n \"--chart-8\",\n] as const;\n\n// ============================================================================\n// Fallback Colors (when CSS variables unavailable)\n// ============================================================================\n\n/** Fallback categorical colors */\nexport const FALLBACK_COLORS_CATEGORICAL = [\n \"hsla(221, 83%, 53%, 1)\", // Blue\n \"hsla(160, 60%, 45%, 1)\", // Teal\n \"hsla(291, 47%, 51%, 1)\", // Purple\n \"hsla(35, 92%, 55%, 1)\", // Amber\n \"hsla(349, 72%, 52%, 1)\", // Rose\n \"hsla(189, 75%, 42%, 1)\", // Cyan\n \"hsla(271, 55%, 60%, 1)\", // Lavender\n \"hsla(142, 55%, 45%, 1)\", // Emerald\n];\n\n/** Fallback sequential colors (light → dark blue) */\nexport const FALLBACK_COLORS_SEQUENTIAL = [\n \"hsla(221, 70%, 94%, 1)\",\n \"hsla(221, 72%, 85%, 1)\",\n \"hsla(221, 74%, 74%, 1)\",\n \"hsla(221, 76%, 63%, 1)\",\n \"hsla(221, 78%, 52%, 1)\",\n \"hsla(221, 80%, 42%, 1)\",\n \"hsla(221, 82%, 32%, 1)\",\n \"hsla(221, 84%, 24%, 1)\",\n];\n\n/** Fallback diverging colors (blue → red) */\nexport const FALLBACK_COLORS_DIVERGING = [\n \"hsla(221, 80%, 35%, 1)\", // Strong negative\n \"hsla(221, 70%, 50%, 1)\",\n \"hsla(221, 55%, 65%, 1)\",\n \"hsla(221, 35%, 82%, 1)\", // Weak negative\n \"hsla(10, 35%, 82%, 1)\", // Weak positive\n \"hsla(10, 60%, 65%, 1)\",\n \"hsla(10, 72%, 50%, 1)\",\n \"hsla(10, 80%, 40%, 1)\", // Strong positive\n];\n\n// ============================================================================\n// Chart UI tokens (axis text, titles, grid lines)\n// ============================================================================\n\n/** CSS variable names for the chart UI tokens (read at runtime like the palettes) */\nexport const CHART_UI_VARS: Record<keyof ChartUITokens, string> = {\n axisLabel: \"--chart-axis-label\",\n axisTitle: \"--chart-axis-title\",\n grid: \"--chart-grid\",\n tooltipBg: \"--chart-tooltip-bg\",\n};\n\n/** Fallback chart UI tokens (light values). */\nexport const FALLBACK_UI_TOKENS: ChartUITokens = {\n axisLabel: \"hsla(240, 4%, 46%, 1)\", // ≈ --muted-foreground\n axisTitle: \"hsla(240, 6%, 10%, 1)\", // ≈ --foreground\n grid: \"hsla(240, 5%, 90%, 1)\", // ≈ --border\n tooltipBg: \"hsla(0, 0%, 100%, 1)\", // ≈ --popover\n};\n"],"mappings":";;;;AAkBA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAOD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAOD,MAAa,gBAAqD;CAChE,WAAW;CACX,WAAW;CACX,MAAM;CACN,WAAW;CACZ;;AAGD,MAAa,qBAAoC;CAC/C,WAAW;CACX,WAAW;CACX,MAAM;CACN,WAAW;CACZ"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/react/charts/constants.ts"],"sourcesContent":["// ============================================================================\n// Shared Constants for Chart Components\n// ============================================================================\n\nimport type { ChartUITokens } from \"./types\";\n\n// Re-export field patterns from shared constants\nexport {\n DATE_FIELD_PATTERNS,\n METADATA_DATE_PATTERNS,\n NAME_FIELD_PATTERNS,\n} from \"@/js/constants\";\n\n// ============================================================================\n// Chart Color Palettes\n// ============================================================================\n\n/** CSS variable names for categorical chart colors (distinct categories) */\nexport const CHART_COLOR_VARS_CATEGORICAL = [\n \"--chart-cat-1\",\n \"--chart-cat-2\",\n \"--chart-cat-3\",\n \"--chart-cat-4\",\n \"--chart-cat-5\",\n \"--chart-cat-6\",\n \"--chart-cat-7\",\n \"--chart-cat-8\",\n] as const;\n\n/** CSS variable names for sequential chart colors (low → high) */\nexport const CHART_COLOR_VARS_SEQUENTIAL = [\n \"--chart-seq-1\",\n \"--chart-seq-2\",\n \"--chart-seq-3\",\n \"--chart-seq-4\",\n \"--chart-seq-5\",\n \"--chart-seq-6\",\n \"--chart-seq-7\",\n \"--chart-seq-8\",\n] as const;\n\n/** CSS variable names for diverging chart colors (negative ↔ positive) */\nexport const CHART_COLOR_VARS_DIVERGING = [\n \"--chart-div-1\",\n \"--chart-div-2\",\n \"--chart-div-3\",\n \"--chart-div-4\",\n \"--chart-div-5\",\n \"--chart-div-6\",\n \"--chart-div-7\",\n \"--chart-div-8\",\n] as const;\n\n/** Legacy: CSS variable names for chart colors (aliases to categorical) */\nexport const CHART_COLOR_VARS = [\n \"--chart-1\",\n \"--chart-2\",\n \"--chart-3\",\n \"--chart-4\",\n \"--chart-5\",\n \"--chart-6\",\n \"--chart-7\",\n \"--chart-8\",\n] as const;\n\n// ============================================================================\n// Fallback Colors (when CSS variables unavailable)\n// ============================================================================\n\n/** Fallback categorical colors */\nexport const FALLBACK_COLORS_CATEGORICAL = [\n \"hsla(221, 83%, 53%, 1)\", // Blue\n \"hsla(160, 60%, 45%, 1)\", // Teal\n \"hsla(291, 47%, 51%, 1)\", // Purple\n \"hsla(35, 92%, 55%, 1)\", // Amber\n \"hsla(349, 72%, 52%, 1)\", // Rose\n \"hsla(189, 75%, 42%, 1)\", // Cyan\n \"hsla(271, 55%, 60%, 1)\", // Lavender\n \"hsla(142, 55%, 45%, 1)\", // Emerald\n];\n\n/** Fallback sequential colors (light → dark blue) */\nexport const FALLBACK_COLORS_SEQUENTIAL = [\n \"hsla(221, 70%, 94%, 1)\",\n \"hsla(221, 72%, 85%, 1)\",\n \"hsla(221, 74%, 74%, 1)\",\n \"hsla(221, 76%, 63%, 1)\",\n \"hsla(221, 78%, 52%, 1)\",\n \"hsla(221, 80%, 42%, 1)\",\n \"hsla(221, 82%, 32%, 1)\",\n \"hsla(221, 84%, 24%, 1)\",\n];\n\n/** Fallback diverging colors (blue → red) */\nexport const FALLBACK_COLORS_DIVERGING = [\n \"hsla(221, 80%, 35%, 1)\", // Strong negative\n \"hsla(221, 70%, 50%, 1)\",\n \"hsla(221, 55%, 65%, 1)\",\n \"hsla(221, 35%, 82%, 1)\", // Weak negative\n \"hsla(10, 35%, 82%, 1)\", // Weak positive\n \"hsla(10, 60%, 65%, 1)\",\n \"hsla(10, 72%, 50%, 1)\",\n \"hsla(10, 80%, 40%, 1)\", // Strong positive\n];\n\n// ============================================================================\n// Chart UI tokens (axis text, titles, grid lines)\n// ============================================================================\n\n/** CSS variable names for the chart UI tokens (read at runtime like the palettes) */\nexport const CHART_UI_VARS: Record<keyof ChartUITokens, string> = {\n axisLabel: \"--chart-axis-label\",\n axisTitle: \"--chart-axis-title\",\n grid: \"--chart-grid\",\n tooltipBg: \"--chart-tooltip-bg\",\n};\n\n/** Fallback chart UI tokens (light values). */\nexport const FALLBACK_UI_TOKENS: ChartUITokens = {\n axisLabel: \"hsla(240, 4%, 46%, 1)\", // ≈ --muted-foreground\n axisTitle: \"hsla(240, 6%, 10%, 1)\", // ≈ --foreground\n grid: \"hsla(240, 5%, 90%, 1)\", // ≈ --border\n tooltipBg: \"hsla(0, 0%, 100%, 1)\", // ≈ --popover\n};\n\n/** Smallest height a chart takes when it fills its parent (no `height` prop). */\nexport const CHART_MIN_HEIGHT = 160;\n\n/**\n * A chart's box: exactly `height` pixels, or its parent's height, at least\n * {@link CHART_MIN_HEIGHT} when that comes from its content.\n */\nexport function chartSizeStyle(height?: number): {\n height: number | string;\n minHeight?: number;\n} {\n return height !== undefined\n ? { height }\n : { height: \"100%\", minHeight: CHART_MIN_HEIGHT };\n}\n"],"mappings":";;;;AAkBA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAOD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAOD,MAAa,gBAAqD;CAChE,WAAW;CACX,WAAW;CACX,MAAM;CACN,WAAW;CACZ;;AAGD,MAAa,qBAAoC;CAC/C,WAAW;CACX,WAAW;CACX,MAAM;CACN,WAAW;CACZ;;AAGD,MAAa,mBAAmB;;;;;AAMhC,SAAgB,eAAe,QAG7B;AACA,QAAO,WAAW,SACd,EAAE,QAAQ,GACV;EAAE,QAAQ;EAAQ,WAAW;EAAkB"}
|
|
@@ -19,7 +19,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
19
19
|
*/
|
|
20
20
|
function createChart(chartType, displayName) {
|
|
21
21
|
const Component = (props) => {
|
|
22
|
-
const { queryKey, parameters, format, transformer, data, height
|
|
22
|
+
const { queryKey, parameters, format, transformer, data, height, className, ariaLabel, testId, ...chartProps } = props;
|
|
23
23
|
return /* @__PURE__ */ jsx(ChartWrapper, {
|
|
24
24
|
...data !== void 0 ? {
|
|
25
25
|
data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-chart.js","names":[],"sources":["../../../src/react/charts/create-chart.tsx"],"sourcesContent":["import { BaseChart } from \"./base\";\nimport type { ChartType, UnifiedChartProps } from \"./types\";\nimport { ChartWrapper } from \"./wrapper\";\n\n/**\n * Factory function to create chart components.\n * Eliminates boilerplate by generating components with the same pattern.\n *\n * @param chartType - The ECharts chart type\n * @param displayName - Component display name for React DevTools\n * @returns A typed chart component\n *\n * @example\n * ```tsx\n * export const BarChart = createChart<BarChartProps>(\"bar\", \"BarChart\");\n * export const LineChart = createChart<LineChartProps>(\"line\", \"LineChart\");\n * ```\n */\nexport function createChart<TProps extends UnifiedChartProps>(\n chartType: ChartType,\n displayName: string,\n) {\n const Component = (props: TProps) => {\n const {\n // Query props\n queryKey,\n parameters,\n format,\n transformer,\n // Data props\n data,\n // Common props\n height
|
|
1
|
+
{"version":3,"file":"create-chart.js","names":[],"sources":["../../../src/react/charts/create-chart.tsx"],"sourcesContent":["import { BaseChart } from \"./base\";\nimport type { ChartData, ChartType, UnifiedChartProps } from \"./types\";\nimport { ChartWrapper } from \"./wrapper\";\n\n/**\n * Factory function to create chart components.\n * Eliminates boilerplate by generating components with the same pattern.\n *\n * @param chartType - The ECharts chart type\n * @param displayName - Component display name for React DevTools\n * @returns A typed chart component\n *\n * @example\n * ```tsx\n * export const BarChart = createChart<BarChartProps>(\"bar\", \"BarChart\");\n * export const LineChart = createChart<LineChartProps>(\"line\", \"LineChart\");\n * ```\n */\nexport function createChart<TProps extends UnifiedChartProps>(\n chartType: ChartType,\n displayName: string,\n) {\n const Component = (props: TProps) => {\n const {\n // Query props\n queryKey,\n parameters,\n format,\n transformer,\n // Data props\n data,\n // Common props\n height,\n className,\n ariaLabel,\n testId,\n // All remaining props pass through to BaseChart\n ...chartProps\n } = props as TProps & {\n queryKey?: string;\n parameters?: Record<string, unknown>;\n format?: string;\n transformer?: unknown;\n data?: unknown;\n height?: number;\n className?: string;\n ariaLabel?: string;\n testId?: string;\n };\n\n const wrapperProps =\n data !== undefined\n ? // ChartDataInput also admits interface-typed and readonly rows; at\n // runtime they're the same plain objects the chart reads.\n { data: data as ChartData, height, className, ariaLabel, testId }\n : {\n queryKey: queryKey as string,\n parameters,\n format,\n transformer,\n height,\n className,\n ariaLabel,\n testId: testId ?? `${chartType}-chart-${queryKey}`,\n };\n\n return (\n <ChartWrapper {...wrapperProps}>\n {(chartData) => (\n <BaseChart\n data={chartData}\n chartType={chartType}\n height={height}\n className={className}\n {...chartProps}\n />\n )}\n </ChartWrapper>\n );\n };\n\n Component.displayName = displayName;\n return Component;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YACd,WACA,aACA;CACA,MAAM,aAAa,UAAkB;EACnC,MAAM,EAEJ,UACA,YACA,QACA,aAEA,MAEA,QACA,WACA,WACA,QAEA,GAAG,eACD;AA4BJ,SACE,oBAAC;GAAa,GAhBd,SAAS,SAGL;IAAQ;IAAmB;IAAQ;IAAW;IAAW;IAAQ,GACjE;IACY;IACV;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ,UAAU,GAAG,UAAU,SAAS;IACzC;cAID,cACA,oBAAC;IACC,MAAM;IACK;IACH;IACG;IACX,GAAI;KACJ;IAES;;AAInB,WAAU,cAAc;AACxB,QAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATE_FIELD_PATTERNS, METADATA_DATE_PATTERNS, NAME_FIELD_PATTERNS } from "../../js/constants.js";
|
|
2
2
|
import { formatLabel } from "../../js/format/index.js";
|
|
3
|
-
import { AreaChartProps, AreaChartSpecificProps, BarChartProps, BarChartSpecificProps, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartType, ChartUITokens, ChartValueFormatter, DataFormat, DataProps, DonutChartProps, HeatmapChartProps, HeatmapChartSpecificProps, LineChartProps, LineChartSpecificProps, NormalizedChartData, NormalizedChartDataBase, Orientation, PieChartProps, PieChartSpecificProps, QueryProps, RadarChartProps, RadarChartSpecificProps, ScatterChartProps, ScatterChartSpecificProps, UnifiedChartProps, isArrowTable, isDataProps, isQueryProps } from "./types.js";
|
|
3
|
+
import { AreaChartProps, AreaChartSpecificProps, BarChartProps, BarChartSpecificProps, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartDataInput, ChartRow, ChartType, ChartUITokens, ChartValueFormatter, DataFormat, DataProps, DonutChartProps, HeatmapChartProps, HeatmapChartSpecificProps, LineChartProps, LineChartSpecificProps, NormalizedChartData, NormalizedChartDataBase, Orientation, PieChartProps, PieChartSpecificProps, QueryProps, RadarChartProps, RadarChartSpecificProps, ScatterChartProps, ScatterChartSpecificProps, UnifiedChartProps, isArrowTable, isDataProps, isQueryProps } from "./types.js";
|
|
4
4
|
import { AreaChart } from "./area/index.js";
|
|
5
5
|
import { BarChart } from "./bar/index.js";
|
|
6
6
|
import { HeatmapChart } from "./heatmap/index.js";
|
|
@@ -16,6 +16,10 @@ type Orientation = "vertical" | "horizontal";
|
|
|
16
16
|
type ChartType = "bar" | "line" | "area" | "pie" | "donut" | "scatter" | "radar" | "heatmap";
|
|
17
17
|
/** Data that can be passed to unified charts */
|
|
18
18
|
type ChartData = Table | Record<string, unknown>[];
|
|
19
|
+
/** One row of chart data (indexable, to type plain data modules). */
|
|
20
|
+
type ChartRow = Record<string, unknown>;
|
|
21
|
+
/** A chart's `data`: an Arrow Table, or rows (interfaces and `as const` arrays too). */
|
|
22
|
+
type ChartDataInput = Table | readonly object[];
|
|
19
23
|
/** Formats a measure value for chart axes, tooltips, and value labels. */
|
|
20
24
|
type ChartValueFormatter = (value: string | number, field: string) => string;
|
|
21
25
|
/** Color palette types for different visualization needs */
|
|
@@ -44,9 +48,14 @@ interface ChartBaseProps {
|
|
|
44
48
|
* - "diverging": Two-tone for positive/negative values
|
|
45
49
|
*/
|
|
46
50
|
colorPalette?: ChartColorPalette;
|
|
47
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a
|
|
53
|
+
* canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS
|
|
54
|
+
* variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the
|
|
55
|
+
* sequential and diverging palettes), held to the same formats.
|
|
56
|
+
*/
|
|
48
57
|
colors?: string[];
|
|
49
|
-
/** Chart height in pixels
|
|
58
|
+
/** Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). */
|
|
50
59
|
height?: number;
|
|
51
60
|
/** Additional CSS classes */
|
|
52
61
|
className?: string;
|
|
@@ -61,9 +70,9 @@ interface ChartBaseProps {
|
|
|
61
70
|
/** Additional ECharts options to merge */
|
|
62
71
|
options?: Record<string, unknown>;
|
|
63
72
|
/**
|
|
64
|
-
* Formats measure values in the chart's built-in value
|
|
65
|
-
* value labels. `field` is the corresponding `yKey`, so one formatter can
|
|
66
|
-
*
|
|
73
|
+
* `(value: string | number, field: string) => string`. Formats measure values in the chart's built-in value
|
|
74
|
+
* axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different
|
|
75
|
+
* format for each series.
|
|
67
76
|
*
|
|
68
77
|
* For charts with multiple series on one value axis, axis ticks use the
|
|
69
78
|
* first `yKey`; each tooltip uses its own series field.
|
|
@@ -132,8 +141,8 @@ interface QueryProps extends ChartBaseProps {
|
|
|
132
141
|
}
|
|
133
142
|
/** Props for direct data injection */
|
|
134
143
|
interface DataProps extends ChartBaseProps {
|
|
135
|
-
/** Arrow Table or
|
|
136
|
-
data:
|
|
144
|
+
/** Arrow Table or an array of row objects (interfaces and `as const` arrays too). */
|
|
145
|
+
data: ChartDataInput;
|
|
137
146
|
queryKey?: never;
|
|
138
147
|
parameters?: never;
|
|
139
148
|
format?: never;
|
|
@@ -227,5 +236,5 @@ declare function isQueryProps(props: UnifiedChartProps): props is QueryProps;
|
|
|
227
236
|
/** Type guard to check if props are data-based */
|
|
228
237
|
declare function isDataProps(props: UnifiedChartProps): props is DataProps;
|
|
229
238
|
//#endregion
|
|
230
|
-
export { AreaChartProps, AreaChartSpecificProps, BarChartProps, BarChartSpecificProps, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartType, ChartUITokens, ChartValueFormatter, DataFormat, DataProps, DonutChartProps, HeatmapChartProps, HeatmapChartSpecificProps, LineChartProps, LineChartSpecificProps, NormalizedChartData, NormalizedChartDataBase, Orientation, PieChartProps, PieChartSpecificProps, QueryProps, RadarChartProps, RadarChartSpecificProps, ScatterChartProps, ScatterChartSpecificProps, UnifiedChartProps, isArrowTable, isDataProps, isQueryProps };
|
|
239
|
+
export { AreaChartProps, AreaChartSpecificProps, BarChartProps, BarChartSpecificProps, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartDataInput, ChartRow, ChartType, ChartUITokens, ChartValueFormatter, DataFormat, DataProps, DonutChartProps, HeatmapChartProps, HeatmapChartSpecificProps, LineChartProps, LineChartSpecificProps, NormalizedChartData, NormalizedChartDataBase, Orientation, PieChartProps, PieChartSpecificProps, QueryProps, RadarChartProps, RadarChartSpecificProps, ScatterChartProps, ScatterChartSpecificProps, UnifiedChartProps, isArrowTable, isDataProps, isQueryProps };
|
|
231
240
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/react/charts/types.ts"],"mappings":";;;;;AAcA;;;;;AAUA;KAVY,UAAA;;KAUA,WAAA;;KAGA,SAAA;AAWZ;AAAA,KAAY,SAAA,GAAY,KAAA,GAAQ,MAAA;;KAGpB,mBAAA,IACV,KAAA,mBACA,KAAA;;KAQU,iBAAA;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/react/charts/types.ts"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/react/charts/types.ts"],"sourcesContent":["import type { Table } from \"apache-arrow\";\n\n// ============================================================================\n// Data Format Types\n// ============================================================================\n\n/**\n * Supported data formats for analytics queries.\n *\n * \"json\" and \"arrow\" are legacy aliases kept for backwards compatibility\n * with appkit-ui < 0.33.0 — safe to remove once no consumer is on a\n * pre-0.33.0 version. resolveFormat() normalizes them to their canonical\n * equivalents before any downstream code reads the value.\n */\nexport type DataFormat =\n | \"json_array\"\n | \"arrow_stream\"\n | \"auto\"\n /** @deprecated Use \"json_array\". Safe to remove once no consumer is on appkit-ui < 0.33.0. */\n | \"json\"\n /** @deprecated Use \"arrow_stream\". Safe to remove once no consumer is on appkit-ui < 0.33.0. */\n | \"arrow\";\n\n/** Chart orientation */\nexport type Orientation = \"vertical\" | \"horizontal\";\n\n/** Supported chart types */\nexport type ChartType =\n | \"bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\"\n | \"scatter\"\n | \"radar\"\n | \"heatmap\";\n\n/** Data that can be passed to unified charts */\nexport type ChartData = Table | Record<string, unknown>[];\n\n/** Formats a measure value for chart axes, tooltips, and value labels. */\nexport type ChartValueFormatter = (\n value: string | number,\n field: string,\n) => string;\n\n// ============================================================================\n// Base Props (shared by all charts)\n// ============================================================================\n\n/** Color palette types for different visualization needs */\nexport type ChartColorPalette = \"categorical\" | \"sequential\" | \"diverging\";\n\n/** Resolved colors for the chart UI — axis text, titles, grid lines, and tooltip. */\nexport interface ChartUITokens {\n /** Axis tick labels (≈ `--muted-foreground`) */\n axisLabel: string;\n /** Axis names, legend, title, and visualMap text (≈ `--foreground`) */\n axisTitle: string;\n /** Axis, tick, and split (grid) lines (≈ `--border`) */\n grid: string;\n /** Tooltip popover background (≈ `--popover`) */\n tooltipBg: string;\n}\n\n/** Common visual and behavior props for all charts */\nexport interface ChartBaseProps {\n /** Chart title */\n title?: string;\n /** Show legend */\n showLegend?: boolean;\n /**\n * Color palette to use. Auto-selected based on chart type if not specified.\n * - \"categorical\": Distinct colors for different categories (bar, pie, line)\n * - \"sequential\": Gradient for magnitude/intensity (heatmap)\n * - \"diverging\": Two-tone for positive/negative values\n */\n colorPalette?: ChartColorPalette;\n /** Custom colors for series (overrides colorPalette) */\n colors?: string[];\n /** Chart height in pixels @default 300 */\n height?: number;\n /** Additional CSS classes */\n className?: string;\n\n /** X-axis field key. Auto-detected from schema if not provided. */\n xKey?: string;\n /** Y-axis field key(s). Auto-detected from schema if not provided. */\n yKey?: string | string[];\n\n /** Accessibility label for screen readers */\n ariaLabel?: string;\n /** Test ID for automated testing */\n testId?: string;\n\n /** Additional ECharts options to merge */\n options?: Record<string, unknown>;\n\n /**\n * Formats measure values in the chart's built-in value axes, tooltips, and\n * value labels. `field` is the corresponding `yKey`, so one formatter can\n * select a different format for each series.\n *\n * For charts with multiple series on one value axis, axis ticks use the\n * first `yKey`; each tooltip uses its own series field.\n */\n valueFormatter?: ChartValueFormatter;\n\n /**\n * Pointer-only: charts render to <canvas>, so this does not fire for keyboard\n * users. Provide a keyboard-accessible equivalent (e.g. a table row action) for\n * the same action.\n */\n onDataClick?: (datum: ChartClickDatum) => void;\n\n /**\n * Controlled selection by category name. Matching data element(s) render at full\n * prominence while the rest are dimmed. Drive it from your own state to reflect a\n * cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis;\n * other chart types ignore it.\n */\n selected?: string | string[];\n}\n\n// ============================================================================\n// Interaction / Click Events\n// ============================================================================\n\n/**\n * A normalized description of a clicked chart element.\n *\n * In the common cross-filter case, {@link ChartClickDatum.name} carries the\n * dimension value of the clicked element.\n */\nexport interface ChartClickDatum {\n /** Category label of the clicked element — the dimension value in the common cross-filter case. */\n name: string;\n /**\n * The datum's scalar value:\n * - bar / pie — the datum itself.\n * - time-series / scatter — the y-component of the `[x, y]` point (see\n * {@link ChartClickDatum.x} / {@link ChartClickDatum.y}).\n * - heatmap — the cell value (the third entry of ECharts'\n * `[xIndex, yIndex, value]` triple), *not* an axis index.\n * - radar — `null`; the item holds one value per indicator, so there is no\n * single scalar to report. Read the vector from {@link ChartClickDatum.raw}.\n *\n * `null` whenever there is no scalar value to surface.\n */\n value: number | string | null;\n x?: number | string;\n y?: number | string;\n seriesName?: string;\n dataIndex: number;\n seriesIndex: number;\n // Untouched ECharts event params.\n raw: unknown;\n}\n\n// ============================================================================\n// Query-based Props (chart fetches data)\n// ============================================================================\n\n/** Props for query-based data fetching */\nexport interface QueryProps extends ChartBaseProps {\n /** Analytics query key registered with analytics plugin */\n queryKey: string;\n /** Query parameters passed to the analytics endpoint */\n parameters?: Record<string, unknown>;\n /**\n * Data format to use\n * - \"json_array\": Use JSON format (smaller payloads, simpler)\n * - \"arrow_stream\": Use Arrow format (faster for large datasets)\n * - \"auto\": Automatically select based on expected data size\n * @default \"auto\"\n */\n format?: DataFormat;\n /** Transform raw data before rendering */\n transformer?: <T>(data: T) => T;\n // Discriminator: cannot use direct data with query\n data?: never;\n}\n\n// ============================================================================\n// Data-based Props (chart receives data externally)\n// ============================================================================\n\n/** Props for direct data injection */\nexport interface DataProps extends ChartBaseProps {\n /** Arrow Table or JSON array */\n data: ChartData;\n\n // Discriminator: cannot use query props with direct data\n queryKey?: never;\n parameters?: never;\n format?: never;\n transformer?: never;\n}\n\n// ============================================================================\n// Union Types for Each Chart\n// ============================================================================\n\n/** Base union type - either query-based or data-based */\nexport type UnifiedChartProps = QueryProps | DataProps;\n\n// ============================================================================\n// Chart-Specific Props\n// ============================================================================\n\n/** Props specific to bar charts */\nexport interface BarChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Stack bars */\n stacked?: boolean;\n}\n\n/** Props specific to line charts */\nexport interface LineChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Show data point symbols @default false */\n showSymbol?: boolean;\n /** Smooth line curves @default true */\n smooth?: boolean;\n}\n\n/** Props specific to area charts */\nexport interface AreaChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Show data point symbols @default false */\n showSymbol?: boolean;\n /** Smooth line curves @default true */\n smooth?: boolean;\n /** Stack areas @default false */\n stacked?: boolean;\n}\n\n/** Props specific to scatter charts */\nexport interface ScatterChartSpecificProps {\n /** Symbol size @default 8 */\n symbolSize?: number;\n}\n\n/** Props specific to pie/donut charts */\nexport interface PieChartSpecificProps {\n /** Inner radius for donut charts (0-100%) @default 0 */\n innerRadius?: number;\n /** Show labels on slices @default true */\n showLabels?: boolean;\n /** Label position @default \"outside\" */\n labelPosition?: \"outside\" | \"inside\" | \"center\";\n}\n\n/** Props specific to radar charts */\nexport interface RadarChartSpecificProps {\n /** Show area fill @default true */\n showArea?: boolean;\n}\n\n/** Props specific to heatmap charts */\nexport interface HeatmapChartSpecificProps {\n /**\n * Field key for the Y-axis categories.\n * For heatmaps, data should have: xKey (column), yAxisKey (row), and yKey (value).\n */\n yAxisKey?: string;\n /** Min value for color scale (auto-detected if not provided) */\n min?: number;\n /** Max value for color scale (auto-detected if not provided) */\n max?: number;\n /** Show value labels on cells @default false */\n showLabels?: boolean;\n}\n\n// ============================================================================\n// Complete Chart Props (union + specific)\n// ============================================================================\n\nexport type BarChartProps = (QueryProps | DataProps) & BarChartSpecificProps;\nexport type LineChartProps = (QueryProps | DataProps) & LineChartSpecificProps;\nexport type AreaChartProps = (QueryProps | DataProps) & AreaChartSpecificProps;\nexport type ScatterChartProps = (QueryProps | DataProps) &\n ScatterChartSpecificProps;\nexport type PieChartProps = (QueryProps | DataProps) & PieChartSpecificProps;\nexport type DonutChartProps = (QueryProps | DataProps) & PieChartSpecificProps;\nexport type RadarChartProps = (QueryProps | DataProps) &\n RadarChartSpecificProps;\nexport type HeatmapChartProps = (QueryProps | DataProps) &\n HeatmapChartSpecificProps;\n\n// ============================================================================\n// Internal Types\n// ============================================================================\n\n/** Base normalized data shared by all chart types */\nexport interface NormalizedChartDataBase {\n xData: (string | number)[];\n xField: string;\n yFields: string[];\n chartType: \"timeseries\" | \"categorical\";\n}\n\n/** Normalized chart data for rendering (standard charts) */\nexport interface NormalizedChartData extends NormalizedChartDataBase {\n yDataMap: Record<string, (string | number)[]>;\n}\n\n/** Type guard to check if data is an Arrow Table */\nexport function isArrowTable(data: ChartData): data is Table {\n return (\n data !== null &&\n typeof data === \"object\" &&\n \"schema\" in data &&\n \"numRows\" in data &&\n typeof (data as Table).getChild === \"function\"\n );\n}\n\n/** Type guard to check if props are query-based */\nexport function isQueryProps(props: UnifiedChartProps): props is QueryProps {\n return (\n \"queryKey\" in props &&\n typeof props.queryKey === \"string\" &&\n props.queryKey.length > 0\n );\n}\n\n/** Type guard to check if props are data-based */\nexport function isDataProps(props: UnifiedChartProps): props is DataProps {\n return \"data\" in props && props.data != null;\n}\n"],"mappings":";;AAuTA,SAAgB,aAAa,MAAgC;AAC3D,QACE,SAAS,QACT,OAAO,SAAS,YAChB,YAAY,QACZ,aAAa,QACb,OAAQ,KAAe,aAAa;;;AAKxC,SAAgB,aAAa,OAA+C;AAC1E,QACE,cAAc,SACd,OAAO,MAAM,aAAa,YAC1B,MAAM,SAAS,SAAS;;;AAK5B,SAAgB,YAAY,OAA8C;AACxE,QAAO,UAAU,SAAS,MAAM,QAAQ"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/react/charts/types.ts"],"sourcesContent":["import type { Table } from \"apache-arrow\";\n\n// ============================================================================\n// Data Format Types\n// ============================================================================\n\n/**\n * Supported data formats for analytics queries.\n *\n * \"json\" and \"arrow\" are legacy aliases kept for backwards compatibility\n * with appkit-ui < 0.33.0 — safe to remove once no consumer is on a\n * pre-0.33.0 version. resolveFormat() normalizes them to their canonical\n * equivalents before any downstream code reads the value.\n */\nexport type DataFormat =\n | \"json_array\"\n | \"arrow_stream\"\n | \"auto\"\n /** @deprecated Use \"json_array\". Safe to remove once no consumer is on appkit-ui < 0.33.0. */\n | \"json\"\n /** @deprecated Use \"arrow_stream\". Safe to remove once no consumer is on appkit-ui < 0.33.0. */\n | \"arrow\";\n\n/** Chart orientation */\nexport type Orientation = \"vertical\" | \"horizontal\";\n\n/** Supported chart types */\nexport type ChartType =\n | \"bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\"\n | \"scatter\"\n | \"radar\"\n | \"heatmap\";\n\n/** Data that can be passed to unified charts */\nexport type ChartData = Table | Record<string, unknown>[];\n\n/** One row of chart data (indexable, to type plain data modules). */\nexport type ChartRow = Record<string, unknown>;\n\n/** A chart's `data`: an Arrow Table, or rows (interfaces and `as const` arrays too). */\nexport type ChartDataInput = Table | readonly object[];\n\n/** Formats a measure value for chart axes, tooltips, and value labels. */\nexport type ChartValueFormatter = (\n value: string | number,\n field: string,\n) => string;\n\n// ============================================================================\n// Base Props (shared by all charts)\n// ============================================================================\n\n/** Color palette types for different visualization needs */\nexport type ChartColorPalette = \"categorical\" | \"sequential\" | \"diverging\";\n\n/** Resolved colors for the chart UI — axis text, titles, grid lines, and tooltip. */\nexport interface ChartUITokens {\n /** Axis tick labels (≈ `--muted-foreground`) */\n axisLabel: string;\n /** Axis names, legend, title, and visualMap text (≈ `--foreground`) */\n axisTitle: string;\n /** Axis, tick, and split (grid) lines (≈ `--border`) */\n grid: string;\n /** Tooltip popover background (≈ `--popover`) */\n tooltipBg: string;\n}\n\n/** Common visual and behavior props for all charts */\nexport interface ChartBaseProps {\n /** Chart title */\n title?: string;\n /** Show legend */\n showLegend?: boolean;\n /**\n * Color palette to use. Auto-selected based on chart type if not specified.\n * - \"categorical\": Distinct colors for different categories (bar, pie, line)\n * - \"sequential\": Gradient for magnitude/intensity (heatmap)\n * - \"diverging\": Two-tone for positive/negative values\n */\n colorPalette?: ChartColorPalette;\n /**\n * Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a\n * canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS\n * variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the\n * sequential and diverging palettes), held to the same formats.\n */\n colors?: string[];\n /** Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). */\n height?: number;\n /** Additional CSS classes */\n className?: string;\n\n /** X-axis field key. Auto-detected from schema if not provided. */\n xKey?: string;\n /** Y-axis field key(s). Auto-detected from schema if not provided. */\n yKey?: string | string[];\n\n /** Accessibility label for screen readers */\n ariaLabel?: string;\n /** Test ID for automated testing */\n testId?: string;\n\n /** Additional ECharts options to merge */\n options?: Record<string, unknown>;\n\n /**\n * `(value: string | number, field: string) => string`. Formats measure values in the chart's built-in value\n * axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different\n * format for each series.\n *\n * For charts with multiple series on one value axis, axis ticks use the\n * first `yKey`; each tooltip uses its own series field.\n */\n valueFormatter?: ChartValueFormatter;\n\n /**\n * Pointer-only: charts render to <canvas>, so this does not fire for keyboard\n * users. Provide a keyboard-accessible equivalent (e.g. a table row action) for\n * the same action.\n */\n onDataClick?: (datum: ChartClickDatum) => void;\n\n /**\n * Controlled selection by category name. Matching data element(s) render at full\n * prominence while the rest are dimmed. Drive it from your own state to reflect a\n * cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis;\n * other chart types ignore it.\n */\n selected?: string | string[];\n}\n\n// ============================================================================\n// Interaction / Click Events\n// ============================================================================\n\n/**\n * A normalized description of a clicked chart element.\n *\n * In the common cross-filter case, {@link ChartClickDatum.name} carries the\n * dimension value of the clicked element.\n */\nexport interface ChartClickDatum {\n /** Category label of the clicked element — the dimension value in the common cross-filter case. */\n name: string;\n /**\n * The datum's scalar value:\n * - bar / pie — the datum itself.\n * - time-series / scatter — the y-component of the `[x, y]` point (see\n * {@link ChartClickDatum.x} / {@link ChartClickDatum.y}).\n * - heatmap — the cell value (the third entry of ECharts'\n * `[xIndex, yIndex, value]` triple), *not* an axis index.\n * - radar — `null`; the item holds one value per indicator, so there is no\n * single scalar to report. Read the vector from {@link ChartClickDatum.raw}.\n *\n * `null` whenever there is no scalar value to surface.\n */\n value: number | string | null;\n x?: number | string;\n y?: number | string;\n seriesName?: string;\n dataIndex: number;\n seriesIndex: number;\n // Untouched ECharts event params.\n raw: unknown;\n}\n\n// ============================================================================\n// Query-based Props (chart fetches data)\n// ============================================================================\n\n/** Props for query-based data fetching */\nexport interface QueryProps extends ChartBaseProps {\n /** Analytics query key registered with analytics plugin */\n queryKey: string;\n /** Query parameters passed to the analytics endpoint */\n parameters?: Record<string, unknown>;\n /**\n * Data format to use\n * - \"json_array\": Use JSON format (smaller payloads, simpler)\n * - \"arrow_stream\": Use Arrow format (faster for large datasets)\n * - \"auto\": Automatically select based on expected data size\n * @default \"auto\"\n */\n format?: DataFormat;\n /** Transform raw data before rendering */\n transformer?: <T>(data: T) => T;\n // Discriminator: cannot use direct data with query\n data?: never;\n}\n\n// ============================================================================\n// Data-based Props (chart receives data externally)\n// ============================================================================\n\n/** Props for direct data injection */\nexport interface DataProps extends ChartBaseProps {\n /** Arrow Table or an array of row objects (interfaces and `as const` arrays too). */\n data: ChartDataInput;\n\n // Discriminator: cannot use query props with direct data\n queryKey?: never;\n parameters?: never;\n format?: never;\n transformer?: never;\n}\n\n// ============================================================================\n// Union Types for Each Chart\n// ============================================================================\n\n/** Base union type - either query-based or data-based */\nexport type UnifiedChartProps = QueryProps | DataProps;\n\n// ============================================================================\n// Chart-Specific Props\n// ============================================================================\n\n/** Props specific to bar charts */\nexport interface BarChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Stack bars */\n stacked?: boolean;\n}\n\n/** Props specific to line charts */\nexport interface LineChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Show data point symbols @default false */\n showSymbol?: boolean;\n /** Smooth line curves @default true */\n smooth?: boolean;\n}\n\n/** Props specific to area charts */\nexport interface AreaChartSpecificProps {\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Show data point symbols @default false */\n showSymbol?: boolean;\n /** Smooth line curves @default true */\n smooth?: boolean;\n /** Stack areas @default false */\n stacked?: boolean;\n}\n\n/** Props specific to scatter charts */\nexport interface ScatterChartSpecificProps {\n /** Symbol size @default 8 */\n symbolSize?: number;\n}\n\n/** Props specific to pie/donut charts */\nexport interface PieChartSpecificProps {\n /** Inner radius for donut charts (0-100%) @default 0 */\n innerRadius?: number;\n /** Show labels on slices @default true */\n showLabels?: boolean;\n /** Label position @default \"outside\" */\n labelPosition?: \"outside\" | \"inside\" | \"center\";\n}\n\n/** Props specific to radar charts */\nexport interface RadarChartSpecificProps {\n /** Show area fill @default true */\n showArea?: boolean;\n}\n\n/** Props specific to heatmap charts */\nexport interface HeatmapChartSpecificProps {\n /**\n * Field key for the Y-axis categories.\n * For heatmaps, data should have: xKey (column), yAxisKey (row), and yKey (value).\n */\n yAxisKey?: string;\n /** Min value for color scale (auto-detected if not provided) */\n min?: number;\n /** Max value for color scale (auto-detected if not provided) */\n max?: number;\n /** Show value labels on cells @default false */\n showLabels?: boolean;\n}\n\n// ============================================================================\n// Complete Chart Props (union + specific)\n// ============================================================================\n\nexport type BarChartProps = (QueryProps | DataProps) & BarChartSpecificProps;\nexport type LineChartProps = (QueryProps | DataProps) & LineChartSpecificProps;\nexport type AreaChartProps = (QueryProps | DataProps) & AreaChartSpecificProps;\nexport type ScatterChartProps = (QueryProps | DataProps) &\n ScatterChartSpecificProps;\nexport type PieChartProps = (QueryProps | DataProps) & PieChartSpecificProps;\nexport type DonutChartProps = (QueryProps | DataProps) & PieChartSpecificProps;\nexport type RadarChartProps = (QueryProps | DataProps) &\n RadarChartSpecificProps;\nexport type HeatmapChartProps = (QueryProps | DataProps) &\n HeatmapChartSpecificProps;\n\n// ============================================================================\n// Internal Types\n// ============================================================================\n\n/** Base normalized data shared by all chart types */\nexport interface NormalizedChartDataBase {\n xData: (string | number)[];\n xField: string;\n yFields: string[];\n chartType: \"timeseries\" | \"categorical\";\n}\n\n/** Normalized chart data for rendering (standard charts) */\nexport interface NormalizedChartData extends NormalizedChartDataBase {\n yDataMap: Record<string, (string | number)[]>;\n}\n\n/** Type guard to check if data is an Arrow Table */\nexport function isArrowTable(data: ChartData): data is Table {\n return (\n data !== null &&\n typeof data === \"object\" &&\n \"schema\" in data &&\n \"numRows\" in data &&\n typeof (data as Table).getChild === \"function\"\n );\n}\n\n/** Type guard to check if props are query-based */\nexport function isQueryProps(props: UnifiedChartProps): props is QueryProps {\n return (\n \"queryKey\" in props &&\n typeof props.queryKey === \"string\" &&\n props.queryKey.length > 0\n );\n}\n\n/** Type guard to check if props are data-based */\nexport function isDataProps(props: UnifiedChartProps): props is DataProps {\n return \"data\" in props && props.data != null;\n}\n"],"mappings":";;AAkUA,SAAgB,aAAa,MAAgC;AAC3D,QACE,SAAS,QACT,OAAO,SAAS,YAChB,YAAY,QACZ,aAAa,QACb,OAAQ,KAAe,aAAa;;;AAKxC,SAAgB,aAAa,OAA+C;AAC1E,QACE,cAAc,SACd,OAAO,MAAM,aAAa,YAC1B,MAAM,SAAS,SAAS;;;AAK5B,SAAgB,YAAY,OAA8C;AACxE,QAAO,UAAU,SAAS,MAAM,QAAQ"}
|
|
@@ -25,7 +25,7 @@ interface ChartWrapperDataProps {
|
|
|
25
25
|
transformer?: never;
|
|
26
26
|
}
|
|
27
27
|
interface CommonProps {
|
|
28
|
-
/** Chart height in pixels */
|
|
28
|
+
/** Chart height in pixels. By default the chart fills its parent's height (at least 160px). */
|
|
29
29
|
height?: number;
|
|
30
30
|
/** Additional CSS classes */
|
|
31
31
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","names":[],"sources":["../../../src/react/charts/wrapper.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","names":[],"sources":["../../../src/react/charts/wrapper.tsx"],"mappings":";;;;;UAiCU,sBAAA;;EAER,QAAA;EAFQ;EAIR,UAAA,GAAa,MAAA;EAJiB;EAM9B,MAAA,GAAS,UAAA;EAAA;EAET,WAAA,OAAkB,IAAA,EAAM,CAAA,KAAM,CAAA;EAAA;EAE9B,IAAA;AAAA;AAAA,UAGQ,qBAAA;EATR;EAWA,IAAA,EAAM,SAAA;EATN;EAWA,QAAA;EACA,UAAA;EACA,MAAA;EACA,WAAA;AAAA;AAAA,UAGQ,WAAA;EAbR;EAeA,MAAA;EAfI;EAiBJ,SAAA;EAd6B;EAgB7B,SAAA;EAde;EAgBf,MAAA;EAhBM;EAkBN,QAAA,GAAW,IAAA,EAAM,SAAA,KAAc,SAAA;AAAA;AAAA,KAGrB,iBAAA,GAAoB,WAAA,IAC7B,sBAAA,GAAyB,qBAAA;;;;AAjBf;;;;;;;;;;;;;;AAgBb;;;;;iBAwHgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { chartSizeStyle } from "./constants.js";
|
|
1
2
|
import { isArrowTable } from "./types.js";
|
|
2
3
|
import { useChartData } from "../hooks/use-chart-data.js";
|
|
3
4
|
import { ChartErrorBoundary } from "./chart-error-boundary.js";
|
|
@@ -20,15 +21,21 @@ function QueryModeContent({ queryKey, parameters, format, transformer, height, c
|
|
|
20
21
|
format,
|
|
21
22
|
transformer
|
|
22
23
|
});
|
|
23
|
-
if (isWarehouseWaiting(loading, data, warehouseStatus)) return /* @__PURE__ */ jsx(
|
|
24
|
-
|
|
24
|
+
if (isWarehouseWaiting(loading, data, warehouseStatus)) return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
style: chartSizeStyle(height),
|
|
26
|
+
children: /* @__PURE__ */ jsx(ResourceWaitingPlaceholder, { height: "100%" })
|
|
27
|
+
});
|
|
28
|
+
if (loading) return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
style: chartSizeStyle(height),
|
|
30
|
+
children: /* @__PURE__ */ jsx(LoadingSkeleton, { height: "100%" })
|
|
31
|
+
});
|
|
25
32
|
if (error) return /* @__PURE__ */ jsx(ErrorState, { error });
|
|
26
33
|
if (isEmpty || !data) return /* @__PURE__ */ jsx(EmptyState, {});
|
|
27
34
|
return /* @__PURE__ */ jsx(ChartErrorBoundary, {
|
|
28
35
|
fallback: /* @__PURE__ */ jsx(ErrorState, { error: "Failed to render chart" }),
|
|
29
36
|
children: /* @__PURE__ */ jsx("div", {
|
|
30
37
|
className,
|
|
31
|
-
style:
|
|
38
|
+
style: chartSizeStyle(height),
|
|
32
39
|
"aria-label": ariaLabel,
|
|
33
40
|
"data-testid": testId,
|
|
34
41
|
role: "img",
|
|
@@ -42,7 +49,7 @@ function DataModeContent({ data, height, className, ariaLabel, testId, children
|
|
|
42
49
|
fallback: /* @__PURE__ */ jsx(ErrorState, { error: "Failed to render chart" }),
|
|
43
50
|
children: /* @__PURE__ */ jsx("div", {
|
|
44
51
|
className,
|
|
45
|
-
style:
|
|
52
|
+
style: chartSizeStyle(height),
|
|
46
53
|
"aria-label": ariaLabel,
|
|
47
54
|
"data-testid": testId,
|
|
48
55
|
role: "img",
|
|
@@ -73,7 +80,7 @@ function DataModeContent({ data, height, className, ariaLabel, testId, children
|
|
|
73
80
|
* ```
|
|
74
81
|
*/
|
|
75
82
|
function ChartWrapper(props) {
|
|
76
|
-
const { height
|
|
83
|
+
const { height, className, ariaLabel, testId, children } = props;
|
|
77
84
|
if ("data" in props && props.data !== void 0) return /* @__PURE__ */ jsx(DataModeContent, {
|
|
78
85
|
data: props.data,
|
|
79
86
|
height,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.js","names":[],"sources":["../../../src/react/charts/wrapper.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type { WarehouseStatus } from \"../hooks/types\";\nimport { useChartData } from \"../hooks/use-chart-data\";\nimport { ChartErrorBoundary } from \"./chart-error-boundary\";\nimport { EmptyState } from \"./empty\";\nimport { ErrorState } from \"./error\";\nimport { LoadingSkeleton, ResourceWaitingPlaceholder } from \"./loading\";\nimport type { ChartData, DataFormat } from \"./types\";\nimport { isArrowTable } from \"./types\";\n\nconst WAREHOUSE_ERROR_STATES = new Set([\"DELETED\", \"DELETING\"]);\n\nfunction isWarehouseWaiting(\n loading: boolean,\n data: ChartData | null,\n warehouseStatus: WarehouseStatus | null,\n): boolean {\n if (!loading || data || !warehouseStatus) return false;\n if (\n warehouseStatus.state === \"RUNNING\" ||\n WAREHOUSE_ERROR_STATES.has(warehouseStatus.state)\n ) {\n return false;\n }\n return true;\n}\n\n// ============================================================================\n// Props Types\n// ============================================================================\n\ninterface ChartWrapperQueryProps {\n /** Analytics query key */\n queryKey: string;\n /** Query parameters */\n parameters?: Record<string, unknown>;\n /** Data format preference */\n format?: DataFormat;\n /** Transform data after fetching */\n transformer?: <T>(data: T) => T;\n /** Direct data - not used in query mode */\n data?: never;\n}\n\ninterface ChartWrapperDataProps {\n /** Direct data (Arrow Table or JSON array) */\n data: ChartData;\n /** Not used in data mode */\n queryKey?: never;\n parameters?: never;\n format?: never;\n transformer?: never;\n}\n\ninterface CommonProps {\n /** Chart height in pixels */\n height?: number;\n /** Additional CSS classes */\n className?: string;\n /** Accessibility label */\n ariaLabel?: string;\n /** Test ID for automated testing */\n testId?: string;\n /** Render function receiving the chart data */\n children: (data: ChartData) => ReactNode;\n}\n\nexport type ChartWrapperProps = CommonProps &\n (ChartWrapperQueryProps | ChartWrapperDataProps);\n\n// ============================================================================\n// Query Mode Content\n// ============================================================================\n\nfunction QueryModeContent({\n queryKey,\n parameters,\n format,\n transformer,\n height,\n className,\n ariaLabel,\n testId,\n children,\n}: CommonProps & ChartWrapperQueryProps) {\n const { data, loading, error, isEmpty, warehouseStatus } = useChartData({\n queryKey,\n parameters,\n format,\n transformer,\n });\n\n if (isWarehouseWaiting(loading, data, warehouseStatus)) {\n return <
|
|
1
|
+
{"version":3,"file":"wrapper.js","names":[],"sources":["../../../src/react/charts/wrapper.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type { WarehouseStatus } from \"../hooks/types\";\nimport { useChartData } from \"../hooks/use-chart-data\";\nimport { ChartErrorBoundary } from \"./chart-error-boundary\";\nimport { chartSizeStyle } from \"./constants\";\nimport { EmptyState } from \"./empty\";\nimport { ErrorState } from \"./error\";\nimport { LoadingSkeleton, ResourceWaitingPlaceholder } from \"./loading\";\nimport type { ChartData, DataFormat } from \"./types\";\nimport { isArrowTable } from \"./types\";\n\nconst WAREHOUSE_ERROR_STATES = new Set([\"DELETED\", \"DELETING\"]);\n\nfunction isWarehouseWaiting(\n loading: boolean,\n data: ChartData | null,\n warehouseStatus: WarehouseStatus | null,\n): boolean {\n if (!loading || data || !warehouseStatus) return false;\n if (\n warehouseStatus.state === \"RUNNING\" ||\n WAREHOUSE_ERROR_STATES.has(warehouseStatus.state)\n ) {\n return false;\n }\n return true;\n}\n\n// ============================================================================\n// Props Types\n// ============================================================================\n\ninterface ChartWrapperQueryProps {\n /** Analytics query key */\n queryKey: string;\n /** Query parameters */\n parameters?: Record<string, unknown>;\n /** Data format preference */\n format?: DataFormat;\n /** Transform data after fetching */\n transformer?: <T>(data: T) => T;\n /** Direct data - not used in query mode */\n data?: never;\n}\n\ninterface ChartWrapperDataProps {\n /** Direct data (Arrow Table or JSON array) */\n data: ChartData;\n /** Not used in data mode */\n queryKey?: never;\n parameters?: never;\n format?: never;\n transformer?: never;\n}\n\ninterface CommonProps {\n /** Chart height in pixels. By default the chart fills its parent's height (at least 160px). */\n height?: number;\n /** Additional CSS classes */\n className?: string;\n /** Accessibility label */\n ariaLabel?: string;\n /** Test ID for automated testing */\n testId?: string;\n /** Render function receiving the chart data */\n children: (data: ChartData) => ReactNode;\n}\n\nexport type ChartWrapperProps = CommonProps &\n (ChartWrapperQueryProps | ChartWrapperDataProps);\n\n// ============================================================================\n// Query Mode Content\n// ============================================================================\n\nfunction QueryModeContent({\n queryKey,\n parameters,\n format,\n transformer,\n height,\n className,\n ariaLabel,\n testId,\n children,\n}: CommonProps & ChartWrapperQueryProps) {\n const { data, loading, error, isEmpty, warehouseStatus } = useChartData({\n queryKey,\n parameters,\n format,\n transformer,\n });\n\n if (isWarehouseWaiting(loading, data, warehouseStatus)) {\n return (\n <div style={chartSizeStyle(height)}>\n <ResourceWaitingPlaceholder height=\"100%\" />\n </div>\n );\n }\n if (loading) {\n return (\n <div style={chartSizeStyle(height)}>\n <LoadingSkeleton height=\"100%\" />\n </div>\n );\n }\n if (error) return <ErrorState error={error} />;\n if (isEmpty || !data) return <EmptyState />;\n\n return (\n <ChartErrorBoundary\n fallback={<ErrorState error=\"Failed to render chart\" />}\n >\n <div\n className={className}\n style={chartSizeStyle(height)}\n aria-label={ariaLabel}\n data-testid={testId}\n role=\"img\"\n >\n {children(data)}\n </div>\n </ChartErrorBoundary>\n );\n}\n\n// ============================================================================\n// Data Mode Content\n// ============================================================================\n\nfunction DataModeContent({\n data,\n height,\n className,\n ariaLabel,\n testId,\n children,\n}: CommonProps & ChartWrapperDataProps) {\n const isEmpty = isArrowTable(data)\n ? data.numRows === 0\n : !Array.isArray(data) || data.length === 0;\n\n if (isEmpty) return <EmptyState />;\n\n return (\n <ChartErrorBoundary\n fallback={<ErrorState error=\"Failed to render chart\" />}\n >\n <div\n className={className}\n style={chartSizeStyle(height)}\n aria-label={ariaLabel}\n data-testid={testId}\n role=\"img\"\n >\n {children(data)}\n </div>\n </ChartErrorBoundary>\n );\n}\n\n// ============================================================================\n// Main Wrapper Component\n// ============================================================================\n\n/**\n * Wrapper component for charts.\n * Handles data fetching (query mode) or direct data injection (data mode).\n *\n * @example Query mode - fetches data from analytics endpoint\n * ```tsx\n * <ChartWrapper\n * queryKey=\"spend_data\"\n * parameters={{ limit: 100 }}\n * format=\"auto\"\n * >\n * {(data) => <MyChart data={data} />}\n * </ChartWrapper>\n * ```\n *\n * @example Data mode - uses provided data directly\n * ```tsx\n * <ChartWrapper data={myArrowTable}>\n * {(data) => <MyChart data={data} />}\n * </ChartWrapper>\n * ```\n */\nexport function ChartWrapper(props: ChartWrapperProps) {\n const { height, className, ariaLabel, testId, children } = props;\n\n // Data mode: use provided data directly\n if (\"data\" in props && props.data !== undefined) {\n return (\n <DataModeContent\n data={props.data}\n height={height}\n className={className}\n ariaLabel={ariaLabel}\n testId={testId}\n >\n {children}\n </DataModeContent>\n );\n }\n\n // Query mode: fetch data from analytics endpoint\n if (\"queryKey\" in props && props.queryKey !== undefined) {\n return (\n <QueryModeContent\n queryKey={props.queryKey}\n parameters={props.parameters}\n format={props.format}\n transformer={props.transformer}\n height={height}\n className={className}\n ariaLabel={ariaLabel}\n testId={testId}\n >\n {children}\n </QueryModeContent>\n );\n }\n\n // Should never reach here due to TypeScript, but safety fallback\n return <ErrorState error=\"Chart requires either 'queryKey' or 'data' prop\" />;\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,yBAAyB,IAAI,IAAI,CAAC,WAAW,WAAW,CAAC;AAE/D,SAAS,mBACP,SACA,MACA,iBACS;AACT,KAAI,CAAC,WAAW,QAAQ,CAAC,gBAAiB,QAAO;AACjD,KACE,gBAAgB,UAAU,aAC1B,uBAAuB,IAAI,gBAAgB,MAAM,CAEjD,QAAO;AAET,QAAO;;AAkDT,SAAS,iBAAiB,EACxB,UACA,YACA,QACA,aACA,QACA,WACA,WACA,QACA,YACuC;CACvC,MAAM,EAAE,MAAM,SAAS,OAAO,SAAS,oBAAoB,aAAa;EACtE;EACA;EACA;EACA;EACD,CAAC;AAEF,KAAI,mBAAmB,SAAS,MAAM,gBAAgB,CACpD,QACE,oBAAC;EAAI,OAAO,eAAe,OAAO;YAChC,oBAAC,8BAA2B,QAAO,SAAS;GACxC;AAGV,KAAI,QACF,QACE,oBAAC;EAAI,OAAO,eAAe,OAAO;YAChC,oBAAC,mBAAgB,QAAO,SAAS;GAC7B;AAGV,KAAI,MAAO,QAAO,oBAAC,cAAkB,QAAS;AAC9C,KAAI,WAAW,CAAC,KAAM,QAAO,oBAAC,eAAa;AAE3C,QACE,oBAAC;EACC,UAAU,oBAAC,cAAW,OAAM,2BAA2B;YAEvD,oBAAC;GACY;GACX,OAAO,eAAe,OAAO;GAC7B,cAAY;GACZ,eAAa;GACb,MAAK;aAEJ,SAAS,KAAK;IACX;GACa;;AAQzB,SAAS,gBAAgB,EACvB,MACA,QACA,WACA,WACA,QACA,YACsC;AAKtC,KAJgB,aAAa,KAAK,GAC9B,KAAK,YAAY,IACjB,CAAC,MAAM,QAAQ,KAAK,IAAI,KAAK,WAAW,EAE/B,QAAO,oBAAC,eAAa;AAElC,QACE,oBAAC;EACC,UAAU,oBAAC,cAAW,OAAM,2BAA2B;YAEvD,oBAAC;GACY;GACX,OAAO,eAAe,OAAO;GAC7B,cAAY;GACZ,eAAa;GACb,MAAK;aAEJ,SAAS,KAAK;IACX;GACa;;;;;;;;;;;;;;;;;;;;;;;;AA8BzB,SAAgB,aAAa,OAA0B;CACrD,MAAM,EAAE,QAAQ,WAAW,WAAW,QAAQ,aAAa;AAG3D,KAAI,UAAU,SAAS,MAAM,SAAS,OACpC,QACE,oBAAC;EACC,MAAM,MAAM;EACJ;EACG;EACA;EACH;EAEP;GACe;AAKtB,KAAI,cAAc,SAAS,MAAM,aAAa,OAC5C,QACE,oBAAC;EACC,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd,aAAa,MAAM;EACX;EACG;EACA;EACH;EAEP;GACgB;AAKvB,QAAO,oBAAC,cAAW,OAAM,oDAAoD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/design-page.d.ts
|
|
5
|
+
interface DesignPageProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Called with each render error the page hits. */
|
|
8
|
+
onError?: (error: Error) => void;
|
|
9
|
+
/** Changing it retries rendering after an error (e.g. after a hot update). */
|
|
10
|
+
resetKey?: unknown;
|
|
11
|
+
/** Shown for an error before anything rendered. Defaults to the message. */
|
|
12
|
+
errorFallback?: (error: Error) => ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The shell the `design()` plugin renders every `/design` page in: the app's
|
|
16
|
+
* theme from the first paint, and the last good frame instead of a broken one.
|
|
17
|
+
*/
|
|
18
|
+
declare function DesignPage({
|
|
19
|
+
children,
|
|
20
|
+
onError,
|
|
21
|
+
resetKey,
|
|
22
|
+
errorFallback
|
|
23
|
+
}: DesignPageProps): react_jsx_runtime0.JSX.Element;
|
|
24
|
+
type DraftPlaceholderKind = "chart" | "table" | "card" | "generic";
|
|
25
|
+
/** Skeleton the `design()` plugin shows for a component a streaming draft hasn't defined yet. */
|
|
26
|
+
declare function DraftPlaceholder({
|
|
27
|
+
kind
|
|
28
|
+
}: {
|
|
29
|
+
kind?: DraftPlaceholderKind;
|
|
30
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DesignPage, DesignPageProps, DraftPlaceholder, DraftPlaceholderKind };
|
|
33
|
+
//# sourceMappingURL=design-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-page.d.ts","names":[],"sources":["../../src/react/design-page.tsx"],"mappings":";;;;UAuHiB,eAAA;EACf,QAAA,EAAU,SAAA;;EAEV,OAAA,IAAW,KAAA,EAAO,KAAA;EAHY;EAK9B,QAAA;EAJU;EAMV,aAAA,IAAiB,KAAA,EAAO,KAAA,KAAU,SAAA;AAAA;;;;;iBAOpB,UAAA,CAAA;EACd,QAAA;EACA,OAAA;EACA,QAAA;EACA;AAAA,GACC,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAmDN,oBAAA;;iBAGI,gBAAA,CAAA;EACd;AAAA;EAEA,IAAA,GAAO,oBAAA;AAAA,IACR,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|