@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.
Files changed (72) hide show
  1. package/CLAUDE.md +3 -0
  2. package/dist/cli/commands/docs.js +231 -10
  3. package/dist/cli/commands/docs.js.map +1 -1
  4. package/dist/cli/commands/plugin/add/add.js +398 -0
  5. package/dist/cli/commands/plugin/add/add.js.map +1 -0
  6. package/dist/cli/commands/plugin/add/plan.js +216 -0
  7. package/dist/cli/commands/plugin/add/plan.js.map +1 -0
  8. package/dist/cli/commands/plugin/add/resolve.js +45 -0
  9. package/dist/cli/commands/plugin/add/resolve.js.map +1 -0
  10. package/dist/cli/commands/plugin/index.js +4 -1
  11. package/dist/cli/commands/plugin/index.js.map +1 -1
  12. package/dist/cli/commands/registry/add.js +3 -2
  13. package/dist/cli/commands/registry/add.js.map +1 -1
  14. package/dist/cli/commands/registry/config-plan.js +1 -1
  15. package/dist/cli/commands/registry/config-plan.js.map +1 -1
  16. package/dist/cli/commands/registry/config-writer.js +77 -9
  17. package/dist/cli/commands/registry/config-writer.js.map +1 -1
  18. package/dist/cli/commands/registry/env-writer.js +1 -1
  19. package/dist/cli/commands/registry/env-writer.js.map +1 -1
  20. package/dist/cli/commands/registry/server-register.js +62 -26
  21. package/dist/cli/commands/registry/server-register.js.map +1 -1
  22. package/dist/cli/commands/registry/workspace-picker.js +1 -1
  23. package/dist/cli/deploy-config.js.map +1 -1
  24. package/dist/cli/index.js +1 -1
  25. package/dist/react/beta.d.ts +3 -1
  26. package/dist/react/beta.js +3 -1
  27. package/dist/react/charts/base.d.ts +1 -1
  28. package/dist/react/charts/base.d.ts.map +1 -1
  29. package/dist/react/charts/base.js +5 -3
  30. package/dist/react/charts/base.js.map +1 -1
  31. package/dist/react/charts/constants.js +13 -1
  32. package/dist/react/charts/constants.js.map +1 -1
  33. package/dist/react/charts/create-chart.js +1 -1
  34. package/dist/react/charts/create-chart.js.map +1 -1
  35. package/dist/react/charts/index.d.ts +1 -1
  36. package/dist/react/charts/types.d.ts +17 -8
  37. package/dist/react/charts/types.d.ts.map +1 -1
  38. package/dist/react/charts/types.js.map +1 -1
  39. package/dist/react/charts/wrapper.d.ts +1 -1
  40. package/dist/react/charts/wrapper.d.ts.map +1 -1
  41. package/dist/react/charts/wrapper.js +12 -5
  42. package/dist/react/charts/wrapper.js.map +1 -1
  43. package/dist/react/design-page.d.ts +33 -0
  44. package/dist/react/design-page.d.ts.map +1 -0
  45. package/dist/react/design-page.js +173 -0
  46. package/dist/react/design-page.js.map +1 -0
  47. package/dist/react/hooks/use-design-ready.d.ts +19 -0
  48. package/dist/react/hooks/use-design-ready.d.ts.map +1 -0
  49. package/dist/react/hooks/use-design-ready.js +33 -0
  50. package/dist/react/hooks/use-design-ready.js.map +1 -0
  51. package/dist/react/index.d.ts +2 -2
  52. package/dist/react/table/data-table.d.ts +6 -0
  53. package/dist/react/table/data-table.d.ts.map +1 -1
  54. package/dist/react/table/data-table.js +6 -0
  55. package/dist/react/table/data-table.js.map +1 -1
  56. package/dist/shared/src/plugin.d.ts.map +1 -1
  57. package/docs/api/appkit/Variable.design.md +6 -0
  58. package/docs/api/appkit-ui/data/AreaChart.md +25 -25
  59. package/docs/api/appkit-ui/data/BarChart.md +23 -23
  60. package/docs/api/appkit-ui/data/DataTable.md +2 -0
  61. package/docs/api/appkit-ui/data/DonutChart.md +24 -24
  62. package/docs/api/appkit-ui/data/HeatmapChart.md +25 -25
  63. package/docs/api/appkit-ui/data/LineChart.md +24 -24
  64. package/docs/api/appkit-ui/data/PieChart.md +24 -24
  65. package/docs/api/appkit-ui/data/RadarChart.md +22 -22
  66. package/docs/api/appkit-ui/data/ScatterChart.md +22 -22
  67. package/docs/api/appkit.md +1 -0
  68. package/docs/plugins/analytics.md +9 -1
  69. package/docs/plugins/design.md +233 -0
  70. package/llms.txt +3 -0
  71. package/package.json +1 -1
  72. package/sbom.cdx.json +1 -1
@@ -0,0 +1,173 @@
1
+ import { Skeleton } from "./ui/skeleton.js";
2
+ import { useDesignReady } from "./hooks/use-design-ready.js";
3
+ import { Component, useLayoutEffect, useRef } from "react";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/react/design-page.tsx
7
+ /** `?theme=dark|light`, else the system setting, applied before the first paint. */
8
+ function useDesignTheme() {
9
+ useLayoutEffect(() => {
10
+ const param = new URLSearchParams(location.search).get("theme");
11
+ const media = window.matchMedia?.("(prefers-color-scheme: dark)");
12
+ const apply = () => document.documentElement.classList.toggle("dark", param ? param === "dark" : !!media?.matches);
13
+ apply();
14
+ if (param || !media) return;
15
+ media.addEventListener("change", apply);
16
+ return () => media.removeEventListener("change", apply);
17
+ }, []);
18
+ }
19
+ function capture(root) {
20
+ return {
21
+ nodes: Array.from(root.childNodes).map((n) => n.cloneNode(true)),
22
+ pixels: Array.from(root.querySelectorAll("canvas")).map((c) => {
23
+ const copy = document.createElement("canvas");
24
+ copy.width = c.width;
25
+ copy.height = c.height;
26
+ if (c.width && c.height) copy.getContext("2d")?.drawImage(c, 0, 0);
27
+ return copy;
28
+ })
29
+ };
30
+ }
31
+ function restore(holder, frame) {
32
+ if (!holder) return;
33
+ holder.replaceChildren(...frame.nodes.map((n) => n.cloneNode(true)));
34
+ holder.querySelectorAll("canvas").forEach((c, i) => {
35
+ const px = frame.pixels[i];
36
+ if (!px?.width || !px.height) return;
37
+ c.width = px.width;
38
+ c.height = px.height;
39
+ c.getContext("2d")?.drawImage(px, 0, 0);
40
+ });
41
+ }
42
+ function HoldReady() {
43
+ useDesignReady(false);
44
+ return null;
45
+ }
46
+ var LastGoodFrame = class extends Component {
47
+ state = {
48
+ error: null,
49
+ resetKey: this.props.resetKey
50
+ };
51
+ static getDerivedStateFromError(error) {
52
+ return { error };
53
+ }
54
+ static getDerivedStateFromProps(props, state) {
55
+ return props.resetKey === state.resetKey ? null : {
56
+ error: null,
57
+ resetKey: props.resetKey
58
+ };
59
+ }
60
+ componentDidCatch(error) {
61
+ this.props.onError?.(error);
62
+ }
63
+ render() {
64
+ const { error } = this.state;
65
+ if (!error) return this.props.children;
66
+ const frame = this.props.frame.current;
67
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(HoldReady, {}), frame ? /* @__PURE__ */ jsx("div", {
68
+ "data-design-last-good": "",
69
+ style: { display: "contents" },
70
+ ref: (el) => restore(el, frame)
71
+ }) : /* @__PURE__ */ jsx("div", {
72
+ "data-design-error": "",
73
+ style: { display: "contents" },
74
+ children: this.props.errorFallback(error)
75
+ })] });
76
+ }
77
+ };
78
+ const defaultErrorFallback = (error) => /* @__PURE__ */ jsxs("pre", {
79
+ className: "text-destructive p-4 whitespace-pre-wrap",
80
+ children: ["Design page failed to render: ", error.message]
81
+ });
82
+ /**
83
+ * The shell the `design()` plugin renders every `/design` page in: the app's
84
+ * theme from the first paint, and the last good frame instead of a broken one.
85
+ */
86
+ function DesignPage({ children, onError, resetKey, errorFallback = defaultErrorFallback }) {
87
+ useDesignTheme();
88
+ const root = useRef(null);
89
+ const frame = useRef(null);
90
+ useLayoutEffect(() => {
91
+ const el = root.current;
92
+ if (!el) return;
93
+ const keep = () => {
94
+ if (!el.querySelector("[data-design-last-good], [data-design-error]")) frame.current = capture(el);
95
+ };
96
+ if (el.childNodes.length > 0) keep();
97
+ let pending = false;
98
+ const observer = new MutationObserver(() => {
99
+ if (pending) return;
100
+ pending = true;
101
+ requestAnimationFrame(() => {
102
+ pending = false;
103
+ keep();
104
+ });
105
+ });
106
+ observer.observe(el, {
107
+ subtree: true,
108
+ childList: true,
109
+ characterData: true,
110
+ attributes: true
111
+ });
112
+ return () => observer.disconnect();
113
+ }, []);
114
+ return /* @__PURE__ */ jsx("div", {
115
+ ref: root,
116
+ "data-design-page": "",
117
+ className: "bg-background text-foreground min-h-screen",
118
+ children: /* @__PURE__ */ jsx(LastGoodFrame, {
119
+ frame,
120
+ resetKey,
121
+ onError,
122
+ errorFallback,
123
+ children
124
+ })
125
+ });
126
+ }
127
+ /** Skeleton the `design()` plugin shows for a component a streaming draft hasn't defined yet. */
128
+ function DraftPlaceholder({ kind = "generic" }) {
129
+ if (kind === "chart") return /* @__PURE__ */ jsx("div", {
130
+ "data-draft-placeholder": "chart",
131
+ className: "flex h-56 items-end gap-2 p-4",
132
+ children: [
133
+ 40,
134
+ 65,
135
+ 50,
136
+ 80,
137
+ 60,
138
+ 90,
139
+ 70
140
+ ].map((h) => /* @__PURE__ */ jsx(Skeleton, {
141
+ className: "flex-1",
142
+ style: { height: `${h}%` }
143
+ }, h))
144
+ });
145
+ if (kind === "table") return /* @__PURE__ */ jsxs("div", {
146
+ "data-draft-placeholder": "table",
147
+ className: "space-y-2 p-4",
148
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-6 w-full" }), [
149
+ 0,
150
+ 1,
151
+ 2,
152
+ 3
153
+ ].map((r) => /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full opacity-70" }, r))]
154
+ });
155
+ if (kind === "card") return /* @__PURE__ */ jsxs("div", {
156
+ "data-draft-placeholder": "card",
157
+ className: "space-y-3 rounded-xl border p-4",
158
+ children: [
159
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/3" }),
160
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-1/2" }),
161
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-2/3" })
162
+ ]
163
+ });
164
+ return /* @__PURE__ */ jsxs("div", {
165
+ "data-draft-placeholder": "generic",
166
+ className: "space-y-2 p-2",
167
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" })]
168
+ });
169
+ }
170
+
171
+ //#endregion
172
+ export { DesignPage, DraftPlaceholder };
173
+ //# sourceMappingURL=design-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-page.js","names":[],"sources":["../../src/react/design-page.tsx"],"sourcesContent":["import { Component, type ReactNode, useLayoutEffect, useRef } from \"react\";\n\nimport { useDesignReady } from \"./hooks/use-design-ready\";\nimport { Skeleton } from \"./ui/skeleton\";\n\n/** `?theme=dark|light`, else the system setting, applied before the first paint. */\nfunction useDesignTheme() {\n useLayoutEffect(() => {\n const param = new URLSearchParams(location.search).get(\"theme\");\n const media = window.matchMedia?.(\"(prefers-color-scheme: dark)\");\n const apply = () =>\n document.documentElement.classList.toggle(\n \"dark\",\n param ? param === \"dark\" : !!media?.matches,\n );\n apply();\n if (param || !media) return;\n media.addEventListener(\"change\", apply);\n return () => media.removeEventListener(\"change\", apply);\n }, []);\n}\n\n/** The last good frame: the page's DOM, with chart canvases as pixels. */\ninterface Frame {\n nodes: Node[];\n pixels: HTMLCanvasElement[];\n}\n\nfunction capture(root: HTMLElement): Frame {\n return {\n nodes: Array.from(root.childNodes).map((n) => n.cloneNode(true)),\n pixels: Array.from(root.querySelectorAll(\"canvas\")).map((c) => {\n const copy = document.createElement(\"canvas\");\n copy.width = c.width;\n copy.height = c.height;\n // A canvas not laid out yet (0x0) can't be drawn from.\n if (c.width && c.height) copy.getContext(\"2d\")?.drawImage(c, 0, 0);\n return copy;\n }),\n };\n}\n\nfunction restore(holder: HTMLElement | null, frame: Frame) {\n if (!holder) return;\n holder.replaceChildren(...frame.nodes.map((n) => n.cloneNode(true)));\n holder.querySelectorAll(\"canvas\").forEach((c, i) => {\n const px = frame.pixels[i];\n if (!px?.width || !px.height) return;\n c.width = px.width;\n c.height = px.height;\n c.getContext(\"2d\")?.drawImage(px, 0, 0);\n });\n}\n\nfunction HoldReady() {\n useDesignReady(false);\n return null;\n}\n\ninterface LastGoodFrameProps {\n children: ReactNode;\n frame: { current: Frame | null };\n resetKey: unknown;\n onError?: (error: Error) => void;\n errorFallback: (error: Error) => ReactNode;\n}\n\n/** On a render error, shows the last good frame (or `errorFallback`) and holds readiness back. */\ninterface LastGoodFrameState {\n error: Error | null;\n resetKey: unknown;\n}\n\nclass LastGoodFrame extends Component<LastGoodFrameProps, LastGoodFrameState> {\n state: LastGoodFrameState = { error: null, resetKey: this.props.resetKey };\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n // A new resetKey retries: render the children again.\n static getDerivedStateFromProps(\n props: LastGoodFrameProps,\n state: LastGoodFrameState,\n ): Partial<LastGoodFrameState> | null {\n return props.resetKey === state.resetKey\n ? null\n : { error: null, resetKey: props.resetKey };\n }\n componentDidCatch(error: Error) {\n this.props.onError?.(error);\n }\n render() {\n const { error } = this.state;\n if (!error) return this.props.children;\n const frame = this.props.frame.current;\n return (\n <>\n <HoldReady />\n {frame ? (\n <div\n data-design-last-good=\"\"\n style={{ display: \"contents\" }}\n ref={(el) => restore(el, frame)}\n />\n ) : (\n <div data-design-error=\"\" style={{ display: \"contents\" }}>\n {this.props.errorFallback(error)}\n </div>\n )}\n </>\n );\n }\n}\n\nconst defaultErrorFallback = (error: Error) => (\n <pre className=\"text-destructive p-4 whitespace-pre-wrap\">\n Design page failed to render: {error.message}\n </pre>\n);\n\nexport interface DesignPageProps {\n children: ReactNode;\n /** Called with each render error the page hits. */\n onError?: (error: Error) => void;\n /** Changing it retries rendering after an error (e.g. after a hot update). */\n resetKey?: unknown;\n /** Shown for an error before anything rendered. Defaults to the message. */\n errorFallback?: (error: Error) => ReactNode;\n}\n\n/**\n * The shell the `design()` plugin renders every `/design` page in: the app's\n * theme from the first paint, and the last good frame instead of a broken one.\n */\nexport function DesignPage({\n children,\n onError,\n resetKey,\n errorFallback = defaultErrorFallback,\n}: DesignPageProps) {\n useDesignTheme();\n const root = useRef<HTMLDivElement>(null);\n const frame = useRef<Frame | null>(null);\n // Hot updates re-render the page without this component: copy every frame.\n useLayoutEffect(() => {\n const el = root.current;\n if (!el) return;\n // Only what the page rendered, not an error or a restored copy.\n const keep = () => {\n if (!el.querySelector(\"[data-design-last-good], [data-design-error]\")) {\n frame.current = capture(el);\n }\n };\n // The first frame is already in place: no mutation reports it.\n if (el.childNodes.length > 0) keep();\n let pending = false;\n const observer = new MutationObserver(() => {\n if (pending) return;\n pending = true;\n requestAnimationFrame(() => {\n pending = false;\n keep();\n });\n });\n observer.observe(el, {\n subtree: true,\n childList: true,\n characterData: true,\n attributes: true,\n });\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={root}\n data-design-page=\"\"\n className=\"bg-background text-foreground min-h-screen\"\n >\n <LastGoodFrame\n frame={frame}\n resetKey={resetKey}\n onError={onError}\n errorFallback={errorFallback}\n >\n {children}\n </LastGoodFrame>\n </div>\n );\n}\n\nexport type DraftPlaceholderKind = \"chart\" | \"table\" | \"card\" | \"generic\";\n\n/** Skeleton the `design()` plugin shows for a component a streaming draft hasn't defined yet. */\nexport function DraftPlaceholder({\n kind = \"generic\",\n}: {\n kind?: DraftPlaceholderKind;\n}) {\n if (kind === \"chart\") {\n return (\n <div\n data-draft-placeholder=\"chart\"\n className=\"flex h-56 items-end gap-2 p-4\"\n >\n {[40, 65, 50, 80, 60, 90, 70].map((h) => (\n <Skeleton key={h} className=\"flex-1\" style={{ height: `${h}%` }} />\n ))}\n </div>\n );\n }\n if (kind === \"table\") {\n return (\n <div data-draft-placeholder=\"table\" className=\"space-y-2 p-4\">\n <Skeleton className=\"h-6 w-full\" />\n {[0, 1, 2, 3].map((r) => (\n <Skeleton key={r} className=\"h-4 w-full opacity-70\" />\n ))}\n </div>\n );\n }\n if (kind === \"card\") {\n return (\n <div\n data-draft-placeholder=\"card\"\n className=\"space-y-3 rounded-xl border p-4\"\n >\n <Skeleton className=\"h-4 w-1/3\" />\n <Skeleton className=\"h-8 w-1/2\" />\n <Skeleton className=\"h-3 w-2/3\" />\n </div>\n );\n }\n return (\n <div data-draft-placeholder=\"generic\" className=\"space-y-2 p-2\">\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-1/2\" />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAMA,SAAS,iBAAiB;AACxB,uBAAsB;EACpB,MAAM,QAAQ,IAAI,gBAAgB,SAAS,OAAO,CA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AU;YAEV,oBAAC;GACQ;GACG;GACD;GACM;GAEd;IACa;GACZ;;;AAOV,SAAgB,iBAAiB,EAC/B,OAAO,aAGN;AACD,KAAI,SAAS,QACX,QACE,oBAAC;EACC,0BAAuB;EACvB,WAAU;YAET;GAAC;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAG,CAAC,KAAK,MACjC,oBAAC;GAAiB,WAAU;GAAS,OAAO,EAAE,QAAQ,GAAG,EAAE,IAAI;KAAhD,EAAoD,CACnE;GACE;AAGV,KAAI,SAAS,QACX,QACE,qBAAC;EAAI,0BAAuB;EAAQ,WAAU;aAC5C,oBAAC,YAAS,WAAU,eAAe,EAClC;GAAC;GAAG;GAAG;GAAG;GAAE,CAAC,KAAK,MACjB,oBAAC,YAAiB,WAAU,2BAAb,EAAuC,CACtD;GACE;AAGV,KAAI,SAAS,OACX,QACE,qBAAC;EACC,0BAAuB;EACvB,WAAU;;GAEV,oBAAC,YAAS,WAAU,cAAc;GAClC,oBAAC,YAAS,WAAU,cAAc;GAClC,oBAAC,YAAS,WAAU,cAAc;;GAC9B;AAGV,QACE,qBAAC;EAAI,0BAAuB;EAAU,WAAU;aAC9C,oBAAC,YAAS,WAAU,cAAc,EAClC,oBAAC,YAAS,WAAU,cAAc;GAC9B"}
@@ -0,0 +1,19 @@
1
+ //#region src/react/hooks/use-design-ready.d.ts
2
+ /**
3
+ * Holds back a page's readiness (`/design/__status`, `appkit:design-ready`,
4
+ * `appkit:app-ready`) while `ready` is `false`, for content the page can't
5
+ * detect on its own. Does nothing without the `design()` plugin's dev scripts.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * function TripsChart() {
10
+ * const { data, loading } = useAnalyticsQuery("trips_per_day", {});
11
+ * useDesignReady(!loading && data != null);
12
+ * return <LineChart data={data ?? []} />;
13
+ * }
14
+ * ```
15
+ */
16
+ declare function useDesignReady(ready?: boolean): void;
17
+ //#endregion
18
+ export { useDesignReady };
19
+ //# sourceMappingURL=use-design-ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-design-ready.d.ts","names":[],"sources":["../../../src/react/hooks/use-design-ready.ts"],"mappings":";;AAsBA;;;;;;;;;;;;;iBAAgB,cAAA,CAAe,KAAA"}
@@ -0,0 +1,33 @@
1
+ import { useLayoutEffect } from "react";
2
+
3
+ //#region src/react/hooks/use-design-ready.ts
4
+ /**
5
+ * Holds back a page's readiness (`/design/__status`, `appkit:design-ready`,
6
+ * `appkit:app-ready`) while `ready` is `false`, for content the page can't
7
+ * detect on its own. Does nothing without the `design()` plugin's dev scripts.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function TripsChart() {
12
+ * const { data, loading } = useAnalyticsQuery("trips_per_day", {});
13
+ * useDesignReady(!loading && data != null);
14
+ * return <LineChart data={data ?? []} />;
15
+ * }
16
+ * ```
17
+ */
18
+ function useDesignReady(ready = true) {
19
+ useLayoutEffect(() => {
20
+ if (ready) return;
21
+ const host = window.__appkitDesign;
22
+ if (!host) return;
23
+ host.blockers++;
24
+ return () => {
25
+ host.blockers--;
26
+ host.changed?.();
27
+ };
28
+ }, [ready]);
29
+ }
30
+
31
+ //#endregion
32
+ export { useDesignReady };
33
+ //# sourceMappingURL=use-design-ready.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-design-ready.js","names":[],"sources":["../../../src/react/hooks/use-design-ready.ts"],"sourcesContent":["import { useLayoutEffect } from \"react\";\n\n/** CONTRACT: same key and shape as `window.__appkitDesign` in the design plugin's vite-plugin.ts. */\ninterface DesignHost {\n blockers: number;\n changed?: () => void;\n}\n\n/**\n * Holds back a page's readiness (`/design/__status`, `appkit:design-ready`,\n * `appkit:app-ready`) while `ready` is `false`, for content the page can't\n * detect on its own. Does nothing without the `design()` plugin's dev scripts.\n *\n * @example\n * ```tsx\n * function TripsChart() {\n * const { data, loading } = useAnalyticsQuery(\"trips_per_day\", {});\n * useDesignReady(!loading && data != null);\n * return <LineChart data={data ?? []} />;\n * }\n * ```\n */\nexport function useDesignReady(ready = true): void {\n useLayoutEffect(() => {\n if (ready) return;\n const host = (window as { __appkitDesign?: DesignHost }).__appkitDesign;\n if (!host) return;\n host.blockers++;\n return () => {\n host.blockers--;\n host.changed?.();\n };\n }, [ready]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,SAAgB,eAAe,QAAQ,MAAY;AACjD,uBAAsB;AACpB,MAAI,MAAO;EACX,MAAM,OAAQ,OAA2C;AACzD,MAAI,CAAC,KAAM;AACX,OAAK;AACL,eAAa;AACX,QAAK;AACL,QAAK,WAAW;;IAEjB,CAAC,MAAM,CAAC"}
@@ -4,7 +4,7 @@ import { MetricViewColumnDisplay } from "../shared/src/metric-metadata.js";
4
4
  import { DATE_FIELD_PATTERNS, METADATA_DATE_PATTERNS, NAME_FIELD_PATTERNS } from "../js/constants.js";
5
5
  import { formatLabel } from "../js/format/index.js";
6
6
  import { AnalyticsFormat, GrainsForSelectedTimeDims, InferDimensionKeys, InferMeasureKeys, InferMetricRow, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, InferTimeDimensionKeys, InferTimeGrains, MetricKey, MetricRegistry, PickMetricRow, PluginRegistry, QueryRegistry, ServingAlias, ServingEndpointRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseMetricViewOptions, UseMetricViewResult, WarehouseState, WarehouseStatus } from "./hooks/types.js";
7
- 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 "./charts/types.js";
7
+ 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 "./charts/types.js";
8
8
  import { AreaChart } from "./charts/area/index.js";
9
9
  import { BarChart } from "./charts/bar/index.js";
10
10
  import { HeatmapChart } from "./charts/heatmap/index.js";
@@ -111,4 +111,4 @@ import "./ui/index.js";
111
111
  import { Variant, VariantProps } from "./ui-variants/variant.js";
112
112
  import { Variants, VariantsProps } from "./ui-variants/variants.js";
113
113
  import "./ui-variants/index.js";
114
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgentChatEvent, AggregatedResourceStatus, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartInference, ChartType, ChartUITokens, ChartValueFormatter, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, GrainsForSelectedTimeDims, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferDimensionKeys, InferMeasureKeys, InferMetricRow, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, InferTimeDimensionKeys, InferTimeGrains, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, LoadingSkeleton, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MetricFilter, MetricFilterOperatorName, MetricKey, MetricOrderBy, MetricOrderDirection, MetricPredicate, MetricRegistry, MetricViewColumnDisplay, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PickMetricRow, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResourceKindRenderer, ResourceSeverity, ResourceStatus, ResourceStatusFilter, ResourceStatusIndicator, ResourceStatusIndicatorProps, ResourceStatusProvider, ResourceStatusProviderProps, ResourceStatusToasterOptions, ResourceWaitingPlaceholder, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServingAlias, ServingEndpointRegistry, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAgentChatOptions, UseAgentChatResult, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, UseMetricViewOptions, UseMetricViewResult, UseServingInvokeOptions, UseServingInvokeResult, UseServingStreamOptions, UseServingStreamResult, Variant, VariantProps, Variants, VariantsProps, WarehouseState, WarehouseStatus, applySelectionEmphasis, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useChartUITokens, useFormField, useGenieChat, useIsMobile, useMetricView, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useResourceStatus, useResourceStatusPublisher, useResourceStatusToaster, useServingInvoke, useServingStream, useSidebar, useThemeColors };
114
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgentChatEvent, AggregatedResourceStatus, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartClickDatum, ChartColorPalette, ChartData, ChartDataInput, ChartInference, ChartRow, ChartType, ChartUITokens, ChartValueFormatter, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, GrainsForSelectedTimeDims, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferDimensionKeys, InferMeasureKeys, InferMetricRow, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, InferTimeDimensionKeys, InferTimeGrains, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, LoadingSkeleton, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MetricFilter, MetricFilterOperatorName, MetricKey, MetricOrderBy, MetricOrderDirection, MetricPredicate, MetricRegistry, MetricViewColumnDisplay, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PickMetricRow, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResourceKindRenderer, ResourceSeverity, ResourceStatus, ResourceStatusFilter, ResourceStatusIndicator, ResourceStatusIndicatorProps, ResourceStatusProvider, ResourceStatusProviderProps, ResourceStatusToasterOptions, ResourceWaitingPlaceholder, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServingAlias, ServingEndpointRegistry, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAgentChatOptions, UseAgentChatResult, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, UseMetricViewOptions, UseMetricViewResult, UseServingInvokeOptions, UseServingInvokeResult, UseServingStreamOptions, UseServingStreamResult, Variant, VariantProps, Variants, VariantsProps, WarehouseState, WarehouseStatus, applySelectionEmphasis, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useChartUITokens, useFormField, useGenieChat, useIsMobile, useMetricView, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useResourceStatus, useResourceStatusPublisher, useResourceStatusToaster, useServingInvoke, useServingStream, useSidebar, useThemeColors };
@@ -14,6 +14,12 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
14
14
  * - Responsive design
15
15
  * - Supports opinionated mode (auto columns) and full-control mode (`children(table)`)
16
16
  *
17
+ * In opinionated mode the columns are the keys of the first row that match `/^[a-zA-Z_][a-zA-Z0-9_]*$/` (other
18
+ * keys are dropped), headed by the key in Title Case. Every cell whose value parses as a number, numeric strings
19
+ * included, is right-aligned and formatted: a key containing `cost`, `price`, `spend`, `revenue` or `usd` shows as
20
+ * USD, and any other value of 1000 or more is abbreviated (10021 shows as 10K). For ids, zip codes or years, render
21
+ * a `Table` from `useAnalyticsQuery` rows instead.
22
+ *
17
23
  * @param props - Props for the DataTable component
18
24
  * @param props.queryKey - The query key to fetch the data
19
25
  * @param props.parameters - The parameters to pass to the query. Required - use `{}` if none.
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.d.ts","names":[],"sources":["../../../src/react/table/data-table.tsx"],"mappings":";;;;;;;AAuEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"data-table.d.ts","names":[],"sources":["../../../src/react/table/data-table.tsx"],"mappings":";;;;;;;AA6EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -22,6 +22,12 @@ import { flexRender } from "@tanstack/react-table";
22
22
  * - Responsive design
23
23
  * - Supports opinionated mode (auto columns) and full-control mode (`children(table)`)
24
24
  *
25
+ * In opinionated mode the columns are the keys of the first row that match `/^[a-zA-Z_][a-zA-Z0-9_]*$/` (other
26
+ * keys are dropped), headed by the key in Title Case. Every cell whose value parses as a number, numeric strings
27
+ * included, is right-aligned and formatted: a key containing `cost`, `price`, `spend`, `revenue` or `usd` shows as
28
+ * USD, and any other value of 1000 or more is abbreviated (10021 shows as 10K). For ids, zip codes or years, render
29
+ * a `Table` from `useAnalyticsQuery` rows instead.
30
+ *
25
31
  * @param props - Props for the DataTable component
26
32
  * @param props.queryKey - The query key to fetch the data
27
33
  * @param props.parameters - The parameters to pass to the query. Required - use `{}` if none.
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.js","names":["Table"],"sources":["../../../src/react/table/data-table.tsx"],"sourcesContent":["import { flexRender } from \"@tanstack/react-table\";\nimport { ChevronDown } from \"lucide-react\";\n\nimport { formatFieldLabel } from \"../lib/format\";\nimport { Button } from \"../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"../ui/dropdown-menu\";\nimport { Input } from \"../ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../ui/select\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"../ui/table\";\nimport { TableWrapper } from \"./table-wrapper\";\nimport type { DataTableLabels, DataTableProps } from \"./types\";\n\n/**\n * Production-ready data table with automatic data fetching and state management\n *\n * Features:\n * - Automatic column generation from data structure\n * - Integrated with useAnalyticsQuery for data fetching\n * - Built-in loading, error, and empty states\n * - Dynamic filtering, sorting and pagination\n * - Column visibility controls\n * - Responsive design\n * - Supports opinionated mode (auto columns) and full-control mode (`children(table)`)\n *\n * @param props - Props for the DataTable component\n * @param props.queryKey - The query key to fetch the data\n * @param props.parameters - The parameters to pass to the query. Required - use `{}` if none.\n * @param props.filterColumn - The column to filter by\n * @param props.filterPlaceholder - The placeholder for the filter input\n * @param props.children - Optional children for full control mode\n * @returns - The rendered data table component\n *\n * @example\n * // Opinionated mode\n * <DataTable\n * queryKey=\"users-list\"\n * parameters={{ status: \"active\" }}\n * filterColumn=\"email\"\n * filterPlaceholder=\"Filter by email...\"\n * />\n * @example\n * // full control mode\n * <DataTable queryKey=\"users-list\" parameters={{ status: \"active\" }}>\n * {(table) => (\n * <div>\n * <h2>Custom Table UI</h2>\n * {table.getRowModel().rows.map(row => (\n * <div key={row.id}>{row.original.name}</div>\n * ))}\n * </div>\n * )}\n * </DataTable>\n */\nexport function DataTable(props: DataTableProps) {\n const {\n parameters,\n queryKey,\n filterColumn,\n filterPlaceholder,\n transform,\n labels,\n ariaLabel,\n testId,\n className,\n enableRowSelection,\n onRowSelectionChange,\n children,\n pageSize = 10,\n pageSizeOptions = [10, 25, 50, 100],\n } = props;\n\n const defaultLabels: Required<DataTableLabels> = {\n columnsButton: \"Columns\",\n noResults: \"No results found.\",\n rowsFound: `\\${count} row(s) found`,\n previousButton: \"Previous\",\n nextButton: \"Next\",\n rowsPerPage: \"Rows per page\",\n showing: `Showing \\${from} to \\${to} of \\${total}`,\n };\n\n const finalLabels = { ...defaultLabels, ...labels };\n\n return (\n <TableWrapper\n queryKey={queryKey}\n parameters={parameters}\n ariaLabel={ariaLabel}\n testId={testId}\n className={className}\n transformer={transform}\n enableRowSelection={enableRowSelection}\n onRowSelectionChange={onRowSelectionChange}\n pageSize={pageSize}\n >\n {(table) => {\n if (children) {\n return children(table);\n }\n\n const data = table.options.data;\n\n const defaultFilterColumn =\n filterColumn ||\n (data && data.length > 0\n ? Object.keys(data[0] as Record<string, any>).find(\n (key) =>\n typeof (data[0] as Record<string, any>)[key] === \"string\",\n )\n : null);\n\n const totalRows = table.getFilteredRowModel().rows.length;\n const currentPage = table.getState().pagination.pageIndex + 1;\n const currentPageSize = table.getState().pagination.pageSize;\n const fromRow =\n totalRows === 0 ? 0 : (currentPage - 1) * currentPageSize + 1;\n const toRow = Math.min(currentPage * currentPageSize, totalRows);\n\n return (\n <div className=\"w-full\">\n <div className=\"flex items-center py-4 gap-2\">\n {defaultFilterColumn && (\n <Input\n placeholder={\n filterPlaceholder ||\n `Filter by ${formatFieldLabel(defaultFilterColumn)}...`\n }\n value={\n (table\n .getColumn(defaultFilterColumn)\n ?.getFilterValue() as string) ?? \"\"\n }\n onChange={(event) =>\n table\n .getColumn(defaultFilterColumn)\n ?.setFilterValue(event.target.value)\n }\n className=\"max-w-sm\"\n />\n )}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"ml-auto\">\n {finalLabels.columnsButton}{\" \"}\n <ChevronDown className=\"ml-2 h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {table\n .getAllColumns()\n .filter((column) => column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) =>\n column.toggleVisibility(!!value)\n }\n >\n {formatFieldLabel(column.id)}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <div className=\"overflow-hidden rounded-md border border-border\">\n <div className=\"max-h-[600px] overflow-y-auto\">\n <Table>\n <TableHeader className=\"sticky top-0 bg-background z-10\">\n {table.getHeaderGroups().map((headerGroup) => (\n <TableRow key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const isSelectColumn = header.column.id === \"select\";\n return (\n <TableHead\n key={header.id}\n style={{\n width: header.getSize(),\n position: \"relative\",\n }}\n className={\n isSelectColumn ? \"w-[40px] p-0\" : undefined\n }\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n </TableHead>\n );\n })}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {table.getRowModel().rows?.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow\n key={row.id}\n data-state={row.getIsSelected() && \"selected\"}\n >\n {row.getVisibleCells().map((cell) => {\n const isSelectColumn = cell.column.id === \"select\";\n return (\n <TableCell\n key={cell.id}\n style={{\n width: cell.column.getSize(),\n }}\n className={\n isSelectColumn ? \"w-[40px] p-0\" : undefined\n }\n >\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )}\n </TableCell>\n );\n })}\n </TableRow>\n ))\n ) : (\n <TableRow>\n <TableCell\n colSpan={table.getAllColumns().length}\n className=\"h-24 text-center\"\n >\n {finalLabels.noResults}\n </TableCell>\n </TableRow>\n )}\n </TableBody>\n </Table>\n </div>\n </div>\n {/* On mobile, flex-col-reverse places pagination buttons above the info row for easier thumb access */}\n <div className=\"flex flex-col-reverse sm:flex-row items-start sm:items-center justify-between gap-3 py-4\">\n <div className=\"flex flex-wrap items-center gap-3 sm:gap-6\">\n <div className=\"text-foreground text-sm\">\n {totalRows > 0\n ? finalLabels.showing\n .replace(`\\${from}`, fromRow.toString())\n .replace(`\\${to}`, toRow.toString())\n .replace(`\\${total}`, totalRows.toString())\n : finalLabels.noResults}\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-foreground\">\n {finalLabels.rowsPerPage}\n </span>\n <Select\n value={currentPageSize.toString()}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-[70px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions.map((size) => (\n <SelectItem key={size} value={size.toString()}>\n {size}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div className=\"space-x-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n {finalLabels.previousButton}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\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EF,oBAAC,sBACC,oBAAC;QACC,SAAS,MAAM,eAAe,CAAC;QAC/B,WAAU;kBAET,YAAY;SACH,GACH,GAEH,IACN;QACJ;OACF;KAEN,qBAAC;MAAI,WAAU;iBACb,qBAAC;OAAI,WAAU;kBACb,oBAAC;QAAI,WAAU;kBACZ,YAAY,IACT,YAAY,QACT,QAAQ,YAAY,QAAQ,UAAU,CAAC,CACvC,QAAQ,UAAU,MAAM,UAAU,CAAC,CACnC,QAAQ,aAAa,UAAU,UAAU,CAAC,GAC7C,YAAY;SACZ,EACN,qBAAC;QAAI,WAAU;mBACb,oBAAC;SAAK,WAAU;mBACb,YAAY;UACR,EACP,qBAAC;SACC,OAAO,gBAAgB,UAAU;SACjC,gBAAgB,UAAU;AACxB,gBAAM,YAAY,OAAO,MAAM,CAAC;;oBAGlC,oBAAC;UAAc,WAAU;oBACvB,oBAAC,gBAAc;WACD,EAChB,oBAAC,2BACE,gBAAgB,KAAK,SACpB,oBAAC;UAAsB,OAAO,KAAK,UAAU;oBAC1C;YADc,KAEJ,CACb,GACY;UACT;SACL;QACF,EACN,qBAAC;OAAI,WAAU;kBACb,oBAAC;QACC,SAAQ;QACR,MAAK;QACL,eAAe,MAAM,cAAc;QACnC,UAAU,CAAC,MAAM,oBAAoB;kBAEpC,YAAY;SACN,EACT,oBAAC;QACC,SAAQ;QACR,MAAK;QACL,eAAe,MAAM,UAAU;QAC/B,UAAU,CAAC,MAAM,gBAAgB;kBAEhC,YAAY;SACN;QACL;OACF;;KACF;;GAGG"}
1
+ {"version":3,"file":"data-table.js","names":["Table"],"sources":["../../../src/react/table/data-table.tsx"],"sourcesContent":["import { flexRender } from \"@tanstack/react-table\";\nimport { ChevronDown } from \"lucide-react\";\n\nimport { formatFieldLabel } from \"../lib/format\";\nimport { Button } from \"../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"../ui/dropdown-menu\";\nimport { Input } from \"../ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../ui/select\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"../ui/table\";\nimport { TableWrapper } from \"./table-wrapper\";\nimport type { DataTableLabels, DataTableProps } from \"./types\";\n\n/**\n * Production-ready data table with automatic data fetching and state management\n *\n * Features:\n * - Automatic column generation from data structure\n * - Integrated with useAnalyticsQuery for data fetching\n * - Built-in loading, error, and empty states\n * - Dynamic filtering, sorting and pagination\n * - Column visibility controls\n * - Responsive design\n * - Supports opinionated mode (auto columns) and full-control mode (`children(table)`)\n *\n * In opinionated mode the columns are the keys of the first row that match `/^[a-zA-Z_][a-zA-Z0-9_]*$/` (other\n * keys are dropped), headed by the key in Title Case. Every cell whose value parses as a number, numeric strings\n * included, is right-aligned and formatted: a key containing `cost`, `price`, `spend`, `revenue` or `usd` shows as\n * USD, and any other value of 1000 or more is abbreviated (10021 shows as 10K). For ids, zip codes or years, render\n * a `Table` from `useAnalyticsQuery` rows instead.\n *\n * @param props - Props for the DataTable component\n * @param props.queryKey - The query key to fetch the data\n * @param props.parameters - The parameters to pass to the query. Required - use `{}` if none.\n * @param props.filterColumn - The column to filter by\n * @param props.filterPlaceholder - The placeholder for the filter input\n * @param props.children - Optional children for full control mode\n * @returns - The rendered data table component\n *\n * @example\n * // Opinionated mode\n * <DataTable\n * queryKey=\"users-list\"\n * parameters={{ status: \"active\" }}\n * filterColumn=\"email\"\n * filterPlaceholder=\"Filter by email...\"\n * />\n * @example\n * // full control mode\n * <DataTable queryKey=\"users-list\" parameters={{ status: \"active\" }}>\n * {(table) => (\n * <div>\n * <h2>Custom Table UI</h2>\n * {table.getRowModel().rows.map(row => (\n * <div key={row.id}>{row.original.name}</div>\n * ))}\n * </div>\n * )}\n * </DataTable>\n */\nexport function DataTable(props: DataTableProps) {\n const {\n parameters,\n queryKey,\n filterColumn,\n filterPlaceholder,\n transform,\n labels,\n ariaLabel,\n testId,\n className,\n enableRowSelection,\n onRowSelectionChange,\n children,\n pageSize = 10,\n pageSizeOptions = [10, 25, 50, 100],\n } = props;\n\n const defaultLabels: Required<DataTableLabels> = {\n columnsButton: \"Columns\",\n noResults: \"No results found.\",\n rowsFound: `\\${count} row(s) found`,\n previousButton: \"Previous\",\n nextButton: \"Next\",\n rowsPerPage: \"Rows per page\",\n showing: `Showing \\${from} to \\${to} of \\${total}`,\n };\n\n const finalLabels = { ...defaultLabels, ...labels };\n\n return (\n <TableWrapper\n queryKey={queryKey}\n parameters={parameters}\n ariaLabel={ariaLabel}\n testId={testId}\n className={className}\n transformer={transform}\n enableRowSelection={enableRowSelection}\n onRowSelectionChange={onRowSelectionChange}\n pageSize={pageSize}\n >\n {(table) => {\n if (children) {\n return children(table);\n }\n\n const data = table.options.data;\n\n const defaultFilterColumn =\n filterColumn ||\n (data && data.length > 0\n ? Object.keys(data[0] as Record<string, any>).find(\n (key) =>\n typeof (data[0] as Record<string, any>)[key] === \"string\",\n )\n : null);\n\n const totalRows = table.getFilteredRowModel().rows.length;\n const currentPage = table.getState().pagination.pageIndex + 1;\n const currentPageSize = table.getState().pagination.pageSize;\n const fromRow =\n totalRows === 0 ? 0 : (currentPage - 1) * currentPageSize + 1;\n const toRow = Math.min(currentPage * currentPageSize, totalRows);\n\n return (\n <div className=\"w-full\">\n <div className=\"flex items-center py-4 gap-2\">\n {defaultFilterColumn && (\n <Input\n placeholder={\n filterPlaceholder ||\n `Filter by ${formatFieldLabel(defaultFilterColumn)}...`\n }\n value={\n (table\n .getColumn(defaultFilterColumn)\n ?.getFilterValue() as string) ?? \"\"\n }\n onChange={(event) =>\n table\n .getColumn(defaultFilterColumn)\n ?.setFilterValue(event.target.value)\n }\n className=\"max-w-sm\"\n />\n )}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"ml-auto\">\n {finalLabels.columnsButton}{\" \"}\n <ChevronDown className=\"ml-2 h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {table\n .getAllColumns()\n .filter((column) => column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) =>\n column.toggleVisibility(!!value)\n }\n >\n {formatFieldLabel(column.id)}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <div className=\"overflow-hidden rounded-md border border-border\">\n <div className=\"max-h-[600px] overflow-y-auto\">\n <Table>\n <TableHeader className=\"sticky top-0 bg-background z-10\">\n {table.getHeaderGroups().map((headerGroup) => (\n <TableRow key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const isSelectColumn = header.column.id === \"select\";\n return (\n <TableHead\n key={header.id}\n style={{\n width: header.getSize(),\n position: \"relative\",\n }}\n className={\n isSelectColumn ? \"w-[40px] p-0\" : undefined\n }\n >\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n </TableHead>\n );\n })}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {table.getRowModel().rows?.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow\n key={row.id}\n data-state={row.getIsSelected() && \"selected\"}\n >\n {row.getVisibleCells().map((cell) => {\n const isSelectColumn = cell.column.id === \"select\";\n return (\n <TableCell\n key={cell.id}\n style={{\n width: cell.column.getSize(),\n }}\n className={\n isSelectColumn ? \"w-[40px] p-0\" : undefined\n }\n >\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )}\n </TableCell>\n );\n })}\n </TableRow>\n ))\n ) : (\n <TableRow>\n <TableCell\n colSpan={table.getAllColumns().length}\n className=\"h-24 text-center\"\n >\n {finalLabels.noResults}\n </TableCell>\n </TableRow>\n )}\n </TableBody>\n </Table>\n </div>\n </div>\n {/* On mobile, flex-col-reverse places pagination buttons above the info row for easier thumb access */}\n <div className=\"flex flex-col-reverse sm:flex-row items-start sm:items-center justify-between gap-3 py-4\">\n <div className=\"flex flex-wrap items-center gap-3 sm:gap-6\">\n <div className=\"text-foreground text-sm\">\n {totalRows > 0\n ? finalLabels.showing\n .replace(`\\${from}`, fromRow.toString())\n .replace(`\\${to}`, toRow.toString())\n .replace(`\\${total}`, totalRows.toString())\n : finalLabels.noResults}\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-foreground\">\n {finalLabels.rowsPerPage}\n </span>\n <Select\n value={currentPageSize.toString()}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"w-[70px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions.map((size) => (\n <SelectItem key={size} value={size.toString()}>\n {size}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n <div className=\"space-x-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n {finalLabels.previousButton}\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n {finalLabels.nextButton}\n </Button>\n </div>\n </div>\n </div>\n );\n }}\n </TableWrapper>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,SAAgB,UAAU,OAAuB;CAC/C,MAAM,EACJ,YACA,UACA,cACA,mBACA,WACA,QACA,WACA,QACA,WACA,oBACA,sBACA,UACA,WAAW,IACX,kBAAkB;EAAC;EAAI;EAAI;EAAI;EAAI,KACjC;CAYJ,MAAM,cAAc;EATlB,eAAe;EACf,WAAW;EACX,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,aAAa;EACb,SAAS;EAG6B,GAAG;EAAQ;AAEnD,QACE,oBAAC;EACW;EACE;EACD;EACH;EACG;EACX,aAAa;EACO;EACE;EACZ;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AC;;oBAGlC,oBAAC;UAAc,WAAU;oBACvB,oBAAC,gBAAc;WACD,EAChB,oBAAC,2BACE,gBAAgB,KAAK,SACpB,oBAAC;UAAsB,OAAO,KAAK,UAAU;oBAC1C;YADc,KAEJ,CACb,GACY;UACT;SACL;QACF,EACN,qBAAC;OAAI,WAAU;kBACb,oBAAC;QACC,SAAQ;QACR,MAAK;QACL,eAAe,MAAM,cAAc;QACnC,UAAU,CAAC,MAAM,oBAAoB;kBAEpC,YAAY;SACN,EACT,oBAAC;QACC,SAAQ;QACR,MAAK;QACL,eAAe,MAAM,UAAU;QAC/B,UAAU,CAAC,MAAM,gBAAgB;kBAEhC,YAAY;SACN;QACL;OACF;;KACF;;GAGG"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../../shared/src/plugin.ts"],"mappings":";;;;;;;KAgVY,iBAAA,GAAoB,MAAA;;KAGpB,eAAA,GAAkB,MAAA,SAAe,iBAAA;;KAGjC,mBAAA,GAAsB,MAAA,SAAe,MAAA"}
1
+ {"version":3,"file":"plugin.d.ts","names":[],"sources":["../../../../shared/src/plugin.ts"],"mappings":";;;;;;;KAmVY,iBAAA,GAAoB,MAAA;;KAGpB,eAAA,GAAkB,MAAA,SAAe,iBAAA;;KAGjC,mBAAA,GAAsB,MAAA,SAAe,MAAA"}
@@ -0,0 +1,6 @@
1
+ # Variable: design
2
+
3
+ ```ts
4
+ const design: ToPlugin<typeof DesignPlugin, DesignConfig | undefined, "design">;
5
+
6
+ ```
@@ -46,31 +46,31 @@ Supports both query mode (queryKey + parameters) and data mode (static data).
46
46
 
47
47
  ### Props[​](#props "Direct link to Props")
48
48
 
49
- | Prop | Type | Required | Default | Description |
50
- | ---------------- | --------------------------------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
- | `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
52
- | `parameters` | `Record<string, unknown>` | | - | Query parameters passed to the analytics endpoint |
53
- | `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json\_array": Use JSON format (smaller payloads, simpler) - "arrow\_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
54
- | `transformer` | `(<T>(data: T) => T)` | | - | Transform raw data before rendering |
55
- | `data` | `ChartData` | | - | Arrow Table or JSON array |
56
- | `title` | `string` | | - | Chart title |
57
- | `showLegend` | `boolean` | | - | Show legend |
58
- | `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
59
- | `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) |
60
- | `height` | `number` | | `300` | Chart height in pixels |
61
- | `className` | `string` | | - | Additional CSS classes |
62
- | `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
63
- | `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
64
- | `ariaLabel` | `string` | | - | Accessibility label for screen readers |
65
- | `testId` | `string` | | - | Test ID for automated testing |
66
- | `options` | `Record<string, unknown>` | | - | Additional ECharts options to merge |
67
- | `valueFormatter` | `ChartValueFormatter` | | - | Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
68
- | `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to \<canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
69
- | `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
70
- | `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation |
71
- | `showSymbol` | `boolean` | | `false` | Show data point symbols |
72
- | `smooth` | `boolean` | | `true` | Smooth line curves |
73
- | `stacked` | `boolean` | | `false` | Stack areas |
49
+ | Prop | Type | Required | Default | Description |
50
+ | ---------------- | --------------------------------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
+ | `queryKey` | `string` | | - | Analytics query key registered with analytics plugin |
52
+ | `parameters` | `Record<string, unknown>` | | - | Query parameters passed to the analytics endpoint |
53
+ | `format` | `"auto" \| "json_array" \| "arrow_stream" \| "json" \| "arrow"` | | `"auto"` | Data format to use - "json\_array": Use JSON format (smaller payloads, simpler) - "arrow\_stream": Use Arrow format (faster for large datasets) - "auto": Automatically select based on expected data size |
54
+ | `transformer` | `(<T>(data: T) => T)` | | - | Transform raw data before rendering |
55
+ | `data` | `ChartDataInput` | | - | Arrow Table or an array of row objects (interfaces and `as const` arrays too). |
56
+ | `title` | `string` | | - | Chart title |
57
+ | `showLegend` | `boolean` | | - | Show legend |
58
+ | `colorPalette` | `"categorical" \| "sequential" \| "diverging"` | | - | Color palette to use. Auto-selected based on chart type if not specified. - "categorical": Distinct colors for different categories (bar, pie, line) - "sequential": Gradient for magnitude/intensity (heatmap) - "diverging": Two-tone for positive/negative values |
59
+ | `colors` | `string[]` | | - | Custom colors for series (overrides colorPalette) as hex, `rgb()` or `hsl()` strings, since ECharts draws on a canvas and cannot resolve `var()` or parse `oklch()` (those draw gray); without it, series colors are the CSS variables `--chart-cat-1` to `--chart-cat-8` on `:root` (`--chart-seq-*` and `--chart-div-*` for the sequential and diverging palettes), held to the same formats. |
60
+ | `height` | `number` | | - | Chart height in pixels. Defaults to filling its parent (see `chartSizeStyle`). |
61
+ | `className` | `string` | | - | Additional CSS classes |
62
+ | `xKey` | `string` | | - | X-axis field key. Auto-detected from schema if not provided. |
63
+ | `yKey` | `string \| string[]` | | - | Y-axis field key(s). Auto-detected from schema if not provided. |
64
+ | `ariaLabel` | `string` | | - | Accessibility label for screen readers |
65
+ | `testId` | `string` | | - | Test ID for automated testing |
66
+ | `options` | `Record<string, unknown>` | | - | Additional ECharts options to merge |
67
+ | `valueFormatter` | `ChartValueFormatter` | | - | `(value: string \| number, field: string) =&gt; string`. Formats measure values in the chart's built-in value axes, tooltips, and value labels. `field` is the corresponding `yKey`, so one formatter can select a different format for each series. |
68
+ | `onDataClick` | `((datum: ChartClickDatum) => void)` | | - | Pointer-only: charts render to \<canvas>, so this does not fire for keyboard users. Provide a keyboard-accessible equivalent (e.g. a table row action) for the same action. |
69
+ | `selected` | `string \| string[]` | | - | Controlled selection by category name. Matching data element(s) render at full prominence while the rest are dimmed. Drive it from your own state to reflect a cross-filter or selection. Categorical charts (bar, pie/donut) show emphasis; other chart types ignore it. |
70
+ | `orientation` | `"horizontal" \| "vertical"` | | `"vertical"` | Chart orientation |
71
+ | `showSymbol` | `boolean` | | `false` | Show data point symbols |
72
+ | `smooth` | `boolean` | | `true` | Smooth line curves |
73
+ | `stacked` | `boolean` | | `false` | Stack areas |
74
74
 
75
75
  ### Usage[​](#usage "Direct link to Usage")
76
76