@bonnard/react 0.1.1

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +161 -0
  3. package/dist/bonnard-chart.d.ts +21 -0
  4. package/dist/bonnard-chart.d.ts.map +1 -0
  5. package/dist/charts/area-chart.d.ts +3 -0
  6. package/dist/charts/area-chart.d.ts.map +1 -0
  7. package/dist/charts/bar-chart.d.ts +3 -0
  8. package/dist/charts/bar-chart.d.ts.map +1 -0
  9. package/dist/charts/big-value.d.ts +3 -0
  10. package/dist/charts/big-value.d.ts.map +1 -0
  11. package/dist/charts/data-table.d.ts +3 -0
  12. package/dist/charts/data-table.d.ts.map +1 -0
  13. package/dist/charts/index.d.ts +7 -0
  14. package/dist/charts/index.d.ts.map +1 -0
  15. package/dist/charts/line-chart.d.ts +3 -0
  16. package/dist/charts/line-chart.d.ts.map +1 -0
  17. package/dist/charts/pie-chart.d.ts +3 -0
  18. package/dist/charts/pie-chart.d.ts.map +1 -0
  19. package/dist/context.d.ts +10 -0
  20. package/dist/context.d.ts.map +1 -0
  21. package/dist/dashboard/dashboard-viewer.d.ts +11 -0
  22. package/dist/dashboard/dashboard-viewer.d.ts.map +1 -0
  23. package/dist/dashboard/dashboard.d.ts +8 -0
  24. package/dist/dashboard/dashboard.d.ts.map +1 -0
  25. package/dist/dashboard/index.d.ts +6 -0
  26. package/dist/dashboard/index.d.ts.map +1 -0
  27. package/dist/dashboard/inputs/date-range-input.d.ts +10 -0
  28. package/dist/dashboard/inputs/date-range-input.d.ts.map +1 -0
  29. package/dist/dashboard/inputs/dropdown-input.d.ts +11 -0
  30. package/dist/dashboard/inputs/dropdown-input.d.ts.map +1 -0
  31. package/dist/dashboard/parser.d.ts +9 -0
  32. package/dist/dashboard/parser.d.ts.map +1 -0
  33. package/dist/dashboard/query-load.d.ts +13 -0
  34. package/dist/dashboard/query-load.d.ts.map +1 -0
  35. package/dist/dashboard.d.ts +8 -0
  36. package/dist/dashboard.d.ts.map +1 -0
  37. package/dist/dashboard.js +935 -0
  38. package/dist/data-table-DQKxzbS3.js +985 -0
  39. package/dist/hooks/use-dashboard.d.ts +8 -0
  40. package/dist/hooks/use-dashboard.d.ts.map +1 -0
  41. package/dist/hooks/use-query.d.ts +13 -0
  42. package/dist/hooks/use-query.d.ts.map +1 -0
  43. package/dist/index.d.ts +18 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +142 -0
  46. package/dist/lib/apply-inputs.d.ts +19 -0
  47. package/dist/lib/apply-inputs.d.ts.map +1 -0
  48. package/dist/lib/build-series.d.ts +33 -0
  49. package/dist/lib/build-series.d.ts.map +1 -0
  50. package/dist/lib/date-presets.d.ts +11 -0
  51. package/dist/lib/date-presets.d.ts.map +1 -0
  52. package/dist/lib/echarts-series.d.ts +22 -0
  53. package/dist/lib/echarts-series.d.ts.map +1 -0
  54. package/dist/lib/format-value.d.ts +16 -0
  55. package/dist/lib/format-value.d.ts.map +1 -0
  56. package/dist/lib/types.d.ts +104 -0
  57. package/dist/lib/types.d.ts.map +1 -0
  58. package/dist/provider.d.ts +12 -0
  59. package/dist/provider.d.ts.map +1 -0
  60. package/dist/styles/bonnard.css +68 -0
  61. package/dist/theme/chart-theme.d.ts +76 -0
  62. package/dist/theme/chart-theme.d.ts.map +1 -0
  63. package/dist/theme/use-chart-theme.d.ts +39 -0
  64. package/dist/theme/use-chart-theme.d.ts.map +1 -0
  65. package/package.json +55 -0
@@ -0,0 +1,8 @@
1
+ import type { DashboardResult } from '@bonnard/sdk';
2
+ export interface UseDashboardResult {
3
+ dashboard: DashboardResult['dashboard'] | undefined;
4
+ loading: boolean;
5
+ error: string | undefined;
6
+ }
7
+ export declare function useDashboard(slug: string): UseDashboardResult;
8
+ //# sourceMappingURL=use-dashboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-dashboard.d.ts","sourceRoot":"","sources":["../../src/hooks/use-dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CA8B7D"}
@@ -0,0 +1,13 @@
1
+ import type { QueryOptions } from '@bonnard/sdk';
2
+ export interface UseBonnardQueryOptions {
3
+ query: QueryOptions;
4
+ skip?: boolean;
5
+ }
6
+ export interface UseBonnardQueryResult<T = Record<string, unknown>> {
7
+ data: T[] | undefined;
8
+ loading: boolean;
9
+ error: string | undefined;
10
+ refetch: () => void;
11
+ }
12
+ export declare function useBonnardQuery<T = Record<string, unknown>>(options: UseBonnardQueryOptions): UseBonnardQueryResult<T>;
13
+ //# sourceMappingURL=use-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../../src/hooks/use-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAG9D,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChE,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CAAC,CAAC,CAAC,CAsC1B"}
@@ -0,0 +1,18 @@
1
+ export { BonnardProvider } from './provider';
2
+ export type { BonnardProviderProps } from './provider';
3
+ export { useBonnard } from './context';
4
+ export type { BonnardContextValue } from './context';
5
+ export { BarChart } from './charts/bar-chart';
6
+ export { LineChart } from './charts/line-chart';
7
+ export { AreaChart } from './charts/area-chart';
8
+ export { PieChart } from './charts/pie-chart';
9
+ export { BigValue } from './charts/big-value';
10
+ export { DataTable } from './charts/data-table';
11
+ export { BonnardChart } from './bonnard-chart';
12
+ export type { BonnardChartSpec } from './bonnard-chart';
13
+ export { useBonnardQuery } from './hooks/use-query';
14
+ export type { UseBonnardQueryOptions, UseBonnardQueryResult } from './hooks/use-query';
15
+ export { PALETTES, CHART_COLORS } from './theme/chart-theme';
16
+ export type { PaletteName } from './theme/chart-theme';
17
+ export type { BarChartProps, AxisChartProps, PieChartProps, BigValueProps, DataTableProps, BaseChartProps, SeriesType, } from './lib/types';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGvF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,YAAY,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,UAAU,GACX,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,142 @@
1
+ import { a as BarChart, c as PALETTES, i as LineChart, l as BonnardContext, n as PieChart, o as BigValue, r as AreaChart, s as CHART_COLORS, t as DataTable, u as useBonnard } from "./data-table-DQKxzbS3.js";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createClient } from "@bonnard/sdk";
5
+
6
+ //#region src/provider.tsx
7
+ function BonnardProvider({ children, config, darkMode = "auto", palette, chartHeight = 320 }) {
8
+ const client = useMemo(() => createClient(config), [config]);
9
+ const [systemDark, setSystemDark] = useState(false);
10
+ useEffect(() => {
11
+ if (darkMode !== "auto") return;
12
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
13
+ setSystemDark(mq.matches);
14
+ const handler = (e) => setSystemDark(e.matches);
15
+ mq.addEventListener("change", handler);
16
+ return () => mq.removeEventListener("change", handler);
17
+ }, [darkMode]);
18
+ const isDark = darkMode === "auto" ? systemDark : darkMode;
19
+ const resolvedPalette = useMemo(() => {
20
+ if (!palette) return CHART_COLORS;
21
+ if (Array.isArray(palette)) return palette;
22
+ return PALETTES[palette] ?? CHART_COLORS;
23
+ }, [palette]);
24
+ const value = useMemo(() => ({
25
+ client,
26
+ isDark,
27
+ chartHeight,
28
+ palette: resolvedPalette
29
+ }), [
30
+ client,
31
+ isDark,
32
+ chartHeight,
33
+ resolvedPalette
34
+ ]);
35
+ return /* @__PURE__ */ jsx(BonnardContext.Provider, {
36
+ value,
37
+ children: /* @__PURE__ */ jsx("div", {
38
+ className: isDark ? "bonnard-dark" : "bonnard-light",
39
+ children
40
+ })
41
+ });
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/bonnard-chart.tsx
46
+ function BonnardChart({ spec }) {
47
+ const { chartType, data, title } = spec;
48
+ switch (chartType) {
49
+ case "bar": return /* @__PURE__ */ jsx(BarChart, {
50
+ data,
51
+ x: spec.x,
52
+ y: spec.y,
53
+ title,
54
+ horizontal: spec.horizontal,
55
+ series: spec.series,
56
+ type: spec.type,
57
+ yFmt: spec.yFmt
58
+ });
59
+ case "line": return /* @__PURE__ */ jsx(LineChart, {
60
+ data,
61
+ x: spec.x,
62
+ y: spec.y,
63
+ title,
64
+ series: spec.series,
65
+ type: spec.type,
66
+ yFmt: spec.yFmt
67
+ });
68
+ case "area": return /* @__PURE__ */ jsx(AreaChart, {
69
+ data,
70
+ x: spec.x,
71
+ y: spec.y,
72
+ title,
73
+ series: spec.series,
74
+ type: spec.type,
75
+ yFmt: spec.yFmt
76
+ });
77
+ case "pie": return /* @__PURE__ */ jsx(PieChart, {
78
+ data,
79
+ name: spec.name,
80
+ value: spec.value,
81
+ title
82
+ });
83
+ case "big_value": return /* @__PURE__ */ jsx(BigValue, {
84
+ data,
85
+ value: spec.value,
86
+ title,
87
+ fmt: spec.fmt
88
+ });
89
+ case "table": return /* @__PURE__ */ jsx(DataTable, {
90
+ data,
91
+ columns: spec.columns,
92
+ fmt: spec.fmt,
93
+ rows: spec.rows
94
+ });
95
+ default: return null;
96
+ }
97
+ }
98
+
99
+ //#endregion
100
+ //#region src/hooks/use-query.ts
101
+ function useBonnardQuery(options) {
102
+ const { client } = useBonnard();
103
+ const [data, setData] = useState(void 0);
104
+ const [loading, setLoading] = useState(!options.skip);
105
+ const [error, setError] = useState(void 0);
106
+ const serialized = JSON.stringify(options.query);
107
+ const versionRef = useRef(0);
108
+ const execute = useCallback(async () => {
109
+ versionRef.current += 1;
110
+ const version = versionRef.current;
111
+ setLoading(true);
112
+ setError(void 0);
113
+ try {
114
+ const result = await client.query(options.query);
115
+ if (version === versionRef.current) {
116
+ setData(result.data);
117
+ setLoading(false);
118
+ }
119
+ } catch (err) {
120
+ if (version === versionRef.current) {
121
+ setError(err instanceof Error ? err.message : "Query failed");
122
+ setLoading(false);
123
+ }
124
+ }
125
+ }, [client, serialized]);
126
+ useEffect(() => {
127
+ if (options.skip) {
128
+ setLoading(false);
129
+ return;
130
+ }
131
+ execute();
132
+ }, [execute, options.skip]);
133
+ return {
134
+ data,
135
+ loading,
136
+ error,
137
+ refetch: execute
138
+ };
139
+ }
140
+
141
+ //#endregion
142
+ export { AreaChart, BarChart, BigValue, BonnardChart, BonnardProvider, CHART_COLORS, DataTable, LineChart, PALETTES, PieChart, useBonnard, useBonnardQuery };
@@ -0,0 +1,19 @@
1
+ import type { QueryOptions } from '@bonnard/sdk';
2
+ import type { ComponentTag, DateRangePreset } from './types';
3
+ export interface DateRangeInputState {
4
+ preset: DateRangePreset;
5
+ range: [string, string];
6
+ }
7
+ export type InputsState = Record<string, DateRangeInputState | string | null>;
8
+ /**
9
+ * Apply all active inputs to a single query's options.
10
+ *
11
+ * - DateRange: overrides timeDimension.dateRange on targeted queries
12
+ * - Dropdown: adds/replaces a filter on the specified dimension
13
+ */
14
+ export declare function applyInputsToQuery(queryName: string, baseOptions: QueryOptions, inputTags: ComponentTag[], inputsState: InputsState): QueryOptions;
15
+ /**
16
+ * Build the initial inputsState from input tags (using their defaults).
17
+ */
18
+ export declare function buildInitialInputsState(inputs: ComponentTag[]): InputsState;
19
+ //# sourceMappingURL=apply-inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-inputs.d.ts","sourceRoot":"","sources":["../../src/lib/apply-inputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,YAAY,EACzB,SAAS,EAAE,YAAY,EAAE,EACzB,WAAW,EAAE,WAAW,GACvB,YAAY,CAmBd;AA6ED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,CAkB3E"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Pure data transformation: splits flat query results into multi-series datasets.
3
+ *
4
+ * Four cases:
5
+ * | y columns | series prop | Result |
6
+ * |-----------|-------------|-------------------------------|
7
+ * | Single | None | 1 dataset (current behavior) |
8
+ * | Single | Set | N datasets (per series value) |
9
+ * | Multiple | None | N datasets (per y column) |
10
+ * | Multiple | Set | N*M datasets |
11
+ */
12
+ export interface SeriesDataset {
13
+ /** Legend label */
14
+ name: string;
15
+ /** One value per x-axis label (null for missing combinations) */
16
+ values: (number | null)[];
17
+ }
18
+ export interface BuildSeriesResult {
19
+ /** Ordered x-axis labels */
20
+ labels: string[];
21
+ /** One dataset per series */
22
+ datasets: SeriesDataset[];
23
+ }
24
+ /**
25
+ * Build multi-series datasets from flat query data.
26
+ *
27
+ * @param data - Flat array of row objects from query
28
+ * @param x - Column name for x-axis
29
+ * @param y - Column name(s) for y-axis, comma-separated for multiple
30
+ * @param series - Optional column name to split data into separate series
31
+ */
32
+ export declare function buildSeries(data: Record<string, unknown>[], x: string, y: string, series?: string): BuildSeriesResult;
33
+ //# sourceMappingURL=build-series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-series.d.ts","sourceRoot":"","sources":["../../src/lib/build-series.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,CAAC,EAAE,MAAM,GACd,iBAAiB,CAmEnB"}
@@ -0,0 +1,11 @@
1
+ import type { DateRangePreset } from './types';
2
+ /** Resolve a preset key to a concrete [start, end] date range */
3
+ export declare function getPresetRange(preset: DateRangePreset): [string, string];
4
+ /** Get the display label for a preset */
5
+ export declare function getPresetLabel(preset: DateRangePreset): string;
6
+ /** Ordered array of preset options for UI rendering */
7
+ export declare const PRESET_OPTIONS: {
8
+ key: DateRangePreset;
9
+ label: string;
10
+ }[];
11
+ //# sourceMappingURL=date-presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-presets.d.ts","sourceRoot":"","sources":["../../src/lib/date-presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAgG/C,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxE;AAED,yCAAyC;AACzC,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAE9D;AAED,uDAAuD;AACvD,eAAO,MAAM,cAAc,EAAE;IAAE,GAAG,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAUnE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Converts BuildSeriesResult into ECharts series[] + legend config.
3
+ */
4
+ import type { BuildSeriesResult } from './build-series';
5
+ import type { SeriesType } from './types';
6
+ type ChartKind = 'bar' | 'line' | 'line-area';
7
+ interface EChartsSeriesConfig {
8
+ series: Record<string, unknown>[];
9
+ showLegend: boolean;
10
+ }
11
+ /**
12
+ * Convert BuildSeriesResult to ECharts series and legend config.
13
+ *
14
+ * @param result - Output from buildSeries()
15
+ * @param chartKind - 'bar', 'line', or 'line-area'
16
+ * @param seriesType - 'stacked', 'grouped', or undefined
17
+ * @param horizontal - For bar charts: swap axes
18
+ * @param rawLabels - When provided, converts data to [label, value] pairs (for time axis)
19
+ */
20
+ export declare function toEChartsSeries(result: BuildSeriesResult, chartKind: ChartKind, seriesType?: SeriesType, horizontal?: boolean, rawLabels?: string[]): EChartsSeriesConfig;
21
+ export {};
22
+ //# sourceMappingURL=echarts-series.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echarts-series.d.ts","sourceRoot":"","sources":["../../src/lib/echarts-series.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,CAAC;AAE9C,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,SAAS,EACpB,UAAU,CAAC,EAAE,UAAU,EACvB,UAAU,CAAC,EAAE,OAAO,EACpB,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,mBAAmB,CAqDrB"}
@@ -0,0 +1,16 @@
1
+ /** Resolve a preset name to an Excel format code, or pass through raw codes */
2
+ export declare function parsePreset(name: string): string;
3
+ /** Detect whether an Excel format code is a date pattern */
4
+ export declare function isDatePattern(pattern: string): boolean;
5
+ /** Format a value with a preset name or raw Excel format code */
6
+ export declare function applyFormat(value: unknown, fmt: string): string;
7
+ /** Auto-detect value type and format with sensible defaults */
8
+ export declare function autoFormat(value: unknown): string;
9
+ /**
10
+ * Parse a fmt prop string like "revenue:eur2,date:shortdate" into a column→format map.
11
+ * Splits on commas only when followed by a column name and colon (to avoid breaking
12
+ * Excel format codes that contain commas like `#,##0`).
13
+ * A single format without a colon (e.g. `fmt="eur2"`) is returned under the empty key.
14
+ */
15
+ export declare function parseFmtProp(fmt: string): Map<string, string>;
16
+ //# sourceMappingURL=format-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-value.d.ts","sourceRoot":"","sources":["../../src/lib/format-value.ts"],"names":[],"mappings":"AAuBA,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAItD;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkB/D;AAED,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkBjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB7D"}
@@ -0,0 +1,104 @@
1
+ import type { QueryOptions } from '@bonnard/sdk';
2
+ /** Dashboard record from the database */
3
+ export interface Dashboard {
4
+ id: string;
5
+ clerk_org_id: string;
6
+ slug: string;
7
+ title: string;
8
+ description: string | null;
9
+ content: string;
10
+ version: number;
11
+ created_by: string | null;
12
+ updated_by: string | null;
13
+ created_at: string;
14
+ updated_at: string;
15
+ }
16
+ /** Dashboard list item (subset for listing) */
17
+ export interface DashboardSummary {
18
+ slug: string;
19
+ title: string;
20
+ description: string | null;
21
+ updated_at: string;
22
+ }
23
+ /** Parsed frontmatter from dashboard markdown */
24
+ export interface DashboardFrontmatter {
25
+ title: string;
26
+ description?: string;
27
+ }
28
+ /** A named query extracted from a query code fence */
29
+ export interface DashboardQuery {
30
+ name: string;
31
+ options: QueryOptions;
32
+ }
33
+ /** Component types supported in v1 */
34
+ export type ComponentType = 'BigValue' | 'LineChart' | 'BarChart' | 'AreaChart' | 'DataTable' | 'PieChart' | 'DateRange' | 'Dropdown';
35
+ /** A parsed component tag from the markdown */
36
+ export interface ComponentTag {
37
+ type: ComponentType;
38
+ props: Record<string, string>;
39
+ }
40
+ /** A section of the parsed dashboard — HTML content, a component, or a grid layout */
41
+ export type DashboardSection = {
42
+ kind: 'html';
43
+ content: string;
44
+ } | {
45
+ kind: 'component';
46
+ component: ComponentTag;
47
+ } | {
48
+ kind: 'grid';
49
+ props: Record<string, string>;
50
+ children: DashboardSection[];
51
+ };
52
+ /** Full output of parseDashboard() */
53
+ export interface ParsedDashboard {
54
+ frontmatter: DashboardFrontmatter;
55
+ queries: Map<string, QueryOptions>;
56
+ inputs: ComponentTag[];
57
+ sections: DashboardSection[];
58
+ }
59
+ /** Date range preset keys */
60
+ export type DateRangePreset = 'last-7-days' | 'last-30-days' | 'last-3-months' | 'last-6-months' | 'last-12-months' | 'month-to-date' | 'year-to-date' | 'last-year' | 'all-time';
61
+ /** Props shared by all chart components */
62
+ export interface BaseChartProps {
63
+ data: Record<string, unknown>[];
64
+ title?: string;
65
+ }
66
+ /** Props for BigValue component */
67
+ export interface BigValueProps extends BaseChartProps {
68
+ value: string;
69
+ /** Format preset or Excel format code (e.g. "eur2", "$#,##0.00") */
70
+ fmt?: string;
71
+ }
72
+ /** Display mode for multi-series charts */
73
+ export type SeriesType = 'stacked' | 'grouped' | 'stacked100';
74
+ /** Props for axis-based charts (Line, Bar, Area) */
75
+ export interface AxisChartProps extends BaseChartProps {
76
+ x: string;
77
+ y: string;
78
+ /** Column to split data into separate series */
79
+ series?: string;
80
+ /** Display mode for multi-series (default: stacked for bar, none for line/area) */
81
+ type?: SeriesType;
82
+ /** Format preset or Excel code for y-axis tooltip values (e.g. "eur2", "0.0%") */
83
+ yFmt?: string;
84
+ }
85
+ /** Props for BarChart (extends axis with optional horizontal) */
86
+ export interface BarChartProps extends AxisChartProps {
87
+ horizontal?: boolean;
88
+ }
89
+ /** Props for PieChart */
90
+ export interface PieChartProps extends BaseChartProps {
91
+ name: string;
92
+ value: string;
93
+ }
94
+ /** Props for DataTable */
95
+ export interface DataTableProps extends BaseChartProps {
96
+ columns?: string[];
97
+ /** Column format map: "col:preset,col2:preset" or raw Excel codes */
98
+ fmt?: string;
99
+ /** Rows per page. Default 10. Use "all" to disable pagination. */
100
+ rows?: number | 'all';
101
+ /** The limit used in the query (from API). Used to detect truncated results. */
102
+ queryLimit?: number | null;
103
+ }
104
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,yCAAyC;AACzC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3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OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACtB,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { type BonnardConfig } from '@bonnard/sdk';
3
+ import { type PaletteName } from './theme/chart-theme';
4
+ export interface BonnardProviderProps {
5
+ children: React.ReactNode;
6
+ config: BonnardConfig;
7
+ darkMode?: boolean | 'auto';
8
+ palette?: PaletteName | string[];
9
+ chartHeight?: number;
10
+ }
11
+ export declare function BonnardProvider({ children, config, darkMode, palette, chartHeight, }: BonnardProviderProps): import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,QAAiB,EACjB,OAAO,EACP,WAAiB,GAClB,EAAE,oBAAoB,2CAkCtB"}
@@ -0,0 +1,68 @@
1
+ /* @bonnard/react — default theme tokens */
2
+
3
+ .bonnard-light,
4
+ :root {
5
+ --bon-bg: #ffffff;
6
+ --bon-bg-muted: #f9fafb;
7
+ --bon-bg-card: #ffffff;
8
+ --bon-border: #e5e7eb;
9
+ --bon-border-error: #fecaca;
10
+ --bon-text: #111827;
11
+ --bon-text-muted: #6b7280;
12
+ --bon-text-title: #374151;
13
+ --bon-text-label: #6b7280;
14
+ --bon-text-error: #b91c1c;
15
+ --bon-text-warn: #a16207;
16
+ --bon-bg-error: #fef2f2;
17
+ --bon-bg-warn: #fefce8;
18
+ --bon-border-warn: #fde68a;
19
+ --bon-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
20
+ --bon-radius: 8px;
21
+ --bon-chart-height: 320px;
22
+ --bon-tooltip-bg: #ffffff;
23
+ --bon-tooltip-border: #e5e7eb;
24
+ --bon-tooltip-text: #374151;
25
+ --bon-tooltip-shadow: 0 2px 8px rgba(59, 130, 246, 0.05);
26
+ --bon-grid-line: #f3f4f6;
27
+ --bon-legend-text: #6b7280;
28
+ --bon-table-header-bg: rgba(107, 114, 128, 0.05);
29
+ --bon-table-hover: rgba(107, 114, 128, 0.04);
30
+ --bon-input-bg: #ffffff;
31
+ --bon-input-border: #d1d5db;
32
+ --bon-spinner-color: #6b7280;
33
+ }
34
+
35
+ .bonnard-dark {
36
+ --bon-bg: #111827;
37
+ --bon-bg-muted: #1f2937;
38
+ --bon-bg-card: #1f2937;
39
+ --bon-border: #374151;
40
+ --bon-border-error: #7f1d1d;
41
+ --bon-text: #f9fafb;
42
+ --bon-text-muted: #9ca3af;
43
+ --bon-text-title: #e5e7eb;
44
+ --bon-text-label: #9ca3af;
45
+ --bon-text-error: #fca5a5;
46
+ --bon-text-warn: #fcd34d;
47
+ --bon-bg-error: rgba(127, 29, 29, 0.2);
48
+ --bon-bg-warn: rgba(161, 98, 7, 0.15);
49
+ --bon-border-warn: #92400e;
50
+ --bon-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
51
+ --bon-radius: 8px;
52
+ --bon-chart-height: 320px;
53
+ --bon-tooltip-bg: #1f2937;
54
+ --bon-tooltip-border: #374151;
55
+ --bon-tooltip-text: #e5e7eb;
56
+ --bon-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
57
+ --bon-grid-line: #374151;
58
+ --bon-legend-text: #9ca3af;
59
+ --bon-table-header-bg: rgba(156, 163, 175, 0.08);
60
+ --bon-table-hover: rgba(156, 163, 175, 0.05);
61
+ --bon-input-bg: #1f2937;
62
+ --bon-input-border: #4b5563;
63
+ --bon-spinner-color: #9ca3af;
64
+ }
65
+
66
+ @keyframes bonnard-spin {
67
+ to { transform: rotate(360deg); }
68
+ }
@@ -0,0 +1,76 @@
1
+ /** Named color palettes for charts */
2
+ export declare const PALETTES: {
3
+ readonly default: readonly ["#2563eb", "#dc2626", "#16a34a", "#ca8a04", "#9333ea", "#ec4899", "#0891b2", "#ea580c"];
4
+ readonly tableau: readonly ["#4e79a7", "#f28e2c", "#e15759", "#76b7b2", "#59a14f", "#edc949", "#af7aa1", "#ff9da7", "#9c755f", "#bab0ab"];
5
+ readonly observable: readonly ["#4269d0", "#efb118", "#ff725c", "#6cc5b0", "#3ca951", "#ff8ab7", "#a463f2", "#97bbf5", "#9c6b4e", "#9498a0"];
6
+ readonly metabase: readonly ["#509EE3", "#88BF4D", "#A989C5", "#EF8C8C", "#F9D45C", "#F2A86F", "#98D9D9", "#7172AD"];
7
+ };
8
+ export type PaletteName = keyof typeof PALETTES;
9
+ export declare const CHART_COLORS: readonly string[];
10
+ /** Mode-aware theme values */
11
+ export interface ChartThemeColors {
12
+ text: {
13
+ label: string;
14
+ title: string;
15
+ muted: string;
16
+ };
17
+ tooltip: {
18
+ backgroundColor: string;
19
+ borderColor: string;
20
+ textColor: string;
21
+ shadow: string;
22
+ };
23
+ gridLine: string;
24
+ legendText: string;
25
+ }
26
+ export declare function getChartTheme(isDark: boolean): ChartThemeColors;
27
+ /** Build tooltip config for the current theme */
28
+ export declare function buildTooltip(theme: ChartThemeColors): {
29
+ backgroundColor: string;
30
+ borderColor: string;
31
+ borderWidth: number;
32
+ textStyle: {
33
+ color: string;
34
+ fontSize: number;
35
+ };
36
+ extraCssText: string;
37
+ appendToBody: boolean;
38
+ position(point: number[], _params: unknown, _dom: HTMLElement, _rect: unknown, size: {
39
+ contentSize: number[];
40
+ viewSize: number[];
41
+ }): number[];
42
+ };
43
+ /** Build legend config for the current theme */
44
+ export declare function buildLegend(theme: ChartThemeColors): {
45
+ type: "scroll";
46
+ orient: "horizontal";
47
+ bottom: number;
48
+ left: "center";
49
+ textStyle: {
50
+ color: string;
51
+ fontSize: number;
52
+ };
53
+ pageTextStyle: {
54
+ color: string;
55
+ };
56
+ itemWidth: number;
57
+ itemHeight: number;
58
+ };
59
+ export declare const DEFAULT_CHART_HEIGHT = 320;
60
+ /** Check if x-axis labels are ISO dates — if so, use ECharts time axis */
61
+ export declare function isTimeAxis(rawLabels: string[]): boolean;
62
+ /** Determine axis label rotation based on longest label length */
63
+ export declare function labelRotation(labels: string[]): number;
64
+ /** Grid bottom padding based on rotation */
65
+ export declare function gridBottom(rotation: number): number;
66
+ /** Format a number for display (compact notation for large values) */
67
+ export declare function formatValue(val: unknown): string;
68
+ /** ECharts tooltip valueFormatter — uses explicit format or compact fallback */
69
+ export declare function tooltipFormatter(yFmt?: string): ((val: number) => string);
70
+ /** Format axis label — detects ISO dates and formats them nicely */
71
+ export declare function formatAxisLabel(val: string): string;
72
+ /** ECharts y-axis formatter — compact numbers */
73
+ export declare function axisValueFormatter(val: number): string;
74
+ /** Convert snake_case or camelCase field names to Title Case */
75
+ export declare function formatColumnHeader(col: string): string;
76
+ //# sourceMappingURL=chart-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-theme.d.ts","sourceRoot":"","sources":["../../src/theme/chart-theme.ts"],"names":[],"mappings":"AAKA,sCAAsC;AACtC,eAAO,MAAM,QAAQ;;;;;CAuBX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAC;AAG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M,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,CAKzE;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBnD;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKtD"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Returns mode-aware chart theme values.
3
+ * Reads isDark from BonnardProvider context.
4
+ */
5
+ export declare function useChartTheme(): {
6
+ isDark: boolean;
7
+ theme: import("./chart-theme").ChartThemeColors;
8
+ tooltip: {
9
+ backgroundColor: string;
10
+ borderColor: string;
11
+ borderWidth: number;
12
+ textStyle: {
13
+ color: string;
14
+ fontSize: number;
15
+ };
16
+ extraCssText: string;
17
+ appendToBody: boolean;
18
+ position(point: number[], _params: unknown, _dom: HTMLElement, _rect: unknown, size: {
19
+ contentSize: number[];
20
+ viewSize: number[];
21
+ }): number[];
22
+ };
23
+ legend: {
24
+ type: "scroll";
25
+ orient: "horizontal";
26
+ bottom: number;
27
+ left: "center";
28
+ textStyle: {
29
+ color: string;
30
+ fontSize: number;
31
+ };
32
+ pageTextStyle: {
33
+ color: string;
34
+ };
35
+ itemWidth: number;
36
+ itemHeight: number;
37
+ };
38
+ };
39
+ //# sourceMappingURL=use-chart-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-chart-theme.d.ts","sourceRoot":"","sources":["../../src/theme/use-chart-theme.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B"}