@timbal-ai/timbal-react 1.0.0 → 1.2.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 (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +55 -8
  3. package/dist/app.cjs +2369 -1189
  4. package/dist/app.d.cts +8 -4
  5. package/dist/app.d.ts +8 -4
  6. package/dist/app.esm.js +32 -7
  7. package/dist/{chart-artifact-DOkwSTjQ.d.cts → chart-artifact-E58ve76I.d.cts} +279 -12
  8. package/dist/{chart-artifact-CBo9x8Ch.d.ts → chart-artifact-_PEJgCpQ.d.ts} +279 -12
  9. package/dist/{chat-Bed4FQSl.d.cts → chat-ClmzWzCX.d.cts} +33 -4
  10. package/dist/{chat-Bed4FQSl.d.ts → chat-ClmzWzCX.d.ts} +33 -4
  11. package/dist/chat.cjs +1446 -776
  12. package/dist/chat.d.cts +1 -1
  13. package/dist/chat.d.ts +1 -1
  14. package/dist/chat.esm.js +3 -3
  15. package/dist/{chunk-YEFBANNF.esm.js → chunk-4VULP3CJ.esm.js} +242 -288
  16. package/dist/{chunk-RZ6QC6RG.esm.js → chunk-AGJKK6R7.esm.js} +2 -2
  17. package/dist/{chunk-FOD67Z6G.esm.js → chunk-BMXFXLVV.esm.js} +341 -12
  18. package/dist/chunk-FEYZUVBM.esm.js +52 -0
  19. package/dist/{chunk-C6IXFM4T.esm.js → chunk-MTYXREHK.esm.js} +4 -4
  20. package/dist/{chunk-AYHOVAMI.esm.js → chunk-NAMKO2MU.esm.js} +1 -1
  21. package/dist/{chunk-SNLXVG7H.esm.js → chunk-UY7AKWJL.esm.js} +1108 -656
  22. package/dist/{chunk-GLPOVYEA.esm.js → chunk-XDIY2WSL.esm.js} +669 -279
  23. package/dist/index.cjs +2967 -1824
  24. package/dist/index.d.cts +5 -5
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.esm.js +41 -11
  27. package/dist/pill-segmented-tabs-BsIOW1Lo.d.cts +528 -0
  28. package/dist/pill-segmented-tabs-BsIOW1Lo.d.ts +528 -0
  29. package/dist/studio.cjs +1685 -1015
  30. package/dist/studio.d.cts +2 -2
  31. package/dist/studio.d.ts +2 -2
  32. package/dist/studio.esm.js +5 -5
  33. package/dist/styles.css +24 -0
  34. package/dist/ui.cjs +387 -49
  35. package/dist/ui.d.cts +71 -491
  36. package/dist/ui.d.ts +71 -491
  37. package/dist/ui.esm.js +26 -6
  38. package/dist/{welcome-COOb05a5.d.cts → welcome-BFGRoNfK.d.cts} +1 -1
  39. package/dist/{welcome-DE08m9ca.d.ts → welcome-DXqsGTwH.d.ts} +1 -1
  40. package/package.json +7 -3
  41. package/vite/local-dev.d.ts +5 -1
  42. package/vite/local-dev.mjs +17 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  All notable changes to `@timbal-ai/timbal-react` are documented here.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## [1.2.0] — 2026-06-03
8
+
9
+ ### Changed
10
+
11
+ - **App-kit charts now run on [recharts](https://recharts.org)** (native shadcn chart layer). `LineAreaChart`, `PieChart`, `RadialChart`, and `RadarChart` keep the same public props but render via recharts under the shadcn `ChartContainer` / `ChartTooltipContent` / `ChartLegendContent` chrome — so tooltips, hover states, and animation match shadcn exactly across every chart kind. Series colors still flow from the theme `--chart-1..6` tokens.
12
+ - **Flush dashboard charts are tooltip-first** — `ChartPanel`, `MetricChartCard`, and cartesian `ChartArtifact` views use `layout="flush"` with **axes hidden by default**; category labels and formatted values appear in shadcn tooltips on hover. Fixes clipped axis ticks and edge-cropped bars/lines in card shells.
13
+ - **`LineAreaChart` margins and scales** — symmetric plot inset when axes are off; `no-gap` / zero bar gap only when category axes are explicitly shown; horizontal bars use band category scale (no misaligned Y ticks).
14
+ - **Linked Vite dev** — `timbalReactLocalDev()` always aliases `file:../timbal-react` installs to `src/` so gallery apps pick up source edits without rebuilding `dist/` first.
15
+ - Polish: in-card legends no longer clip outside the card; line/area charts use a thin crosshair cursor; tooltips animate in; radial/radar charts have hover tooltips.
16
+
17
+ ### Added
18
+
19
+ - **shadcn chart primitives exported from `/ui`**: `ChartContainer`, `ChartTooltip`, `ChartTooltipContent`, `ChartLegend`, `ChartLegendContent`, `ChartStyle`, `useChart`, and the `ChartConfig` type.
20
+ - **`ChartArtifact.showAxes`** — opt-in axis ticks on flush cartesian charts (default off).
21
+ - **`resolveChartMargin`**, **`resolveTooltipCategory`**, and related helpers exported from the charts entry for tests and custom wrappers.
22
+
23
+ ### Dependencies
24
+
25
+ - Adds **`recharts`** as a dependency and **`react-is`** as a peer dependency (`react-is` must match your React version).
26
+
27
+ ## [1.1.0] — 2026-06-03
28
+
29
+ ### Added
30
+
31
+ - **`DataTable` scales to real datasets** — three additive props (all backward-compatible):
32
+ - **`pageSize`** — built-in client-side pagination with a compact footer pager (row range + prev/next). Controlled via `pageIndex` / `onPageChange`, or uncontrolled with `defaultPageIndex`; out-of-range pages snap back after filtering.
33
+ - **`selectable`** + **`selectedKeys`** / **`defaultSelectedKeys`** / **`onSelectionChange`** — a leading checkbox column with header select-all (indeterminate state) for bulk actions (acknowledge/resolve/export). Toggling a checkbox never triggers `onRowClick`.
34
+ - **`loading`** (+ **`loadingRows`**) — shaped skeleton rows that preserve the header/columns so the table doesn't jump when data arrives.
35
+ - **Loading states across the data kit** — `MetricRow`, `MetricChartCard`, and `ChartPanel` accept **`loading`**, rendering skeleton tiles / plot-height skeletons. Every async dashboard gets a consistent pending state without re-inventing one.
36
+ - **`useLiveQuery` / `useInterval`** (root + `/app`) — poll an async source on an interval for live dashboards (alerts, metrics, logs). Handles loading vs. background `refreshing`, drops stale/post-unmount responses, pauses while the tab is hidden + refetches on focus, and exposes `lastUpdated` + a manual `refetch`. Pairs with `authFetch`.
37
+ - **`AppShell` owns the mobile nav** — `AppShell` manages the drawer open-state (`navOpen` / `defaultNavOpen` / `onNavOpenChange`), renders the mobile backdrop automatically, and provides **`useAppShellNav()`** + **`AppShellSidebarTrigger`** (an `md:hidden` hamburger). Wiring a responsive `StudioSidebar` drops from ~30 lines of `isMobile`/resize/backdrop boilerplate to passing `mobileOpen={nav.open}` / `onMobileOpenChange={nav.setOpen}`.
38
+ - **`StatusBadge` `tone="danger"`** — a destructive/red tone for critical severity, so error/critical states aren't forced onto the brand `primary` tone.
39
+
5
40
  ## [1.0.0] — 2026-06-02
6
41
 
7
42
  First stable release. The `@timbal-ai/timbal-react/ui` primitive layer, the control-surface contract, and the app-kit are now a settled public surface.
package/README.md CHANGED
@@ -35,9 +35,11 @@ bun add @timbal-ai/timbal-react
35
35
  **Peer dependencies:**
36
36
 
37
37
  ```bash
38
- npm install react react-dom @assistant-ui/react @timbal-ai/timbal-sdk
38
+ npm install react react-dom react-is @assistant-ui/react @timbal-ai/timbal-sdk
39
39
  ```
40
40
 
41
+ > The app-kit charts are built on [recharts](https://recharts.org) (installed automatically). `react-is` is a recharts peer and **must match your React version** — install it explicitly if your package manager doesn't hoist peers.
42
+
41
43
  ### Tailwind setup
42
44
 
43
45
  The package ships pre-built Tailwind class names **plus a complete light + dark token set** (`bg-background`, `text-foreground`, `bg-card`, `bg-bubble-user`, `from-elevated-from`, `bg-playground-from/via/to`, etc.). Your app CSS only needs three lines:
@@ -61,15 +63,53 @@ Every token has a CSS-variable indirection in `styles.css`. Override individual
61
63
  :root {
62
64
  --primary: oklch(0.5 0.12 265);
63
65
  --playground-from: oklch(0.95 0.04 265 / 0.6);
66
+ /* Chart series — override any to rebrand every dashboard chart at once */
67
+ --chart-1: var(--primary);
68
+ --chart-2: oklch(0.62 0.13 184);
64
69
  }
65
70
 
66
71
  .dark {
67
72
  --primary: oklch(0.72 0.14 265);
68
73
  --playground-from: oklch(0.27 0.04 265);
74
+ --chart-1: var(--primary);
69
75
  }
70
76
  ```
71
77
 
72
- Both light AND dark blocks must be defined for every overridden token — otherwise toggling dark mode produces an inconsistent UI. The library prints a one-time dev-only console warning when it detects a mismatch.
78
+ Both light AND dark blocks must define every overridden token — otherwise toggling dark mode produces an inconsistent UI. The library prints a one-time dev-only console warning when it detects a mismatch.
79
+
80
+ ### Charts (app kit + artifacts)
81
+
82
+ Dashboard and in-chat charts use the **native shadcn/recharts layer** — animated tooltips, hover crosshairs, and legends that match shadcn/ui out of the box.
83
+
84
+ | Import from | Components |
85
+ |-------------|------------|
86
+ | `@timbal-ai/timbal-react` or `/app` | `LineAreaChart`, `PieChart`, `RadialChart`, `RadarChart`, `Sparkline`, `ChartPanel`, `MetricChartCard` |
87
+ | `@timbal-ai/timbal-react/ui` | `ChartContainer`, `ChartTooltip`, `ChartTooltipContent`, `ChartLegend`, `ChartLegendContent`, `ChartConfig` |
88
+
89
+ **Dependencies:** `recharts` ships with the package. Install **`react-is`** alongside React (same major version) — it is a recharts peer and must match your React version.
90
+
91
+ **Flush dashboards (`ChartPanel`, `MetricChartCard`, cartesian artifacts):** charts default to **`layout="flush"`** — no axis tick labels; **hover tooltips** show the category (`xKey`) and formatted value(s). Opt back in with `showXAxis` / `showYAxis` on `LineAreaChart`, or `showAxes: true` on a `ChartArtifact`. Use `layout="default"` when you want visible axes without passing extra props.
92
+
93
+ **Rebrand:** override `--chart-1` … `--chart-6` in `:root` / `.dark` (series 1 defaults to `--primary`). Per-series overrides: `series[].color` on `LineAreaChart` or `colors` on pie/radial artifacts.
94
+
95
+ **`ChartArtifact` kinds:** `bar`, `horizontalBar`, `line`, `area`, `pie`, `donut`, `radial`, `radar` — see `ChartPanel` + the app-kit **Chart catalog** recipe (`examples/app-kit/src/recipes/chart-catalog.tsx`).
96
+
97
+ **Custom charts** (same pattern as shadcn docs):
98
+
99
+ ```tsx
100
+ import { Bar, BarChart, XAxis } from "recharts";
101
+ import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from "@timbal-ai/timbal-react/ui";
102
+
103
+ const config = { revenue: { label: "Revenue", color: "var(--chart-1)" } } satisfies ChartConfig;
104
+
105
+ <ChartContainer config={config} className="h-[240px] w-full">
106
+ <BarChart data={rows} accessibilityLayer>
107
+ <XAxis dataKey="month" hide />
108
+ <ChartTooltip content={<ChartTooltipContent />} />
109
+ <Bar dataKey="revenue" fill="var(--color-revenue)" radius={4} />
110
+ </BarChart>
111
+ </ChartContainer>
112
+ ```
73
113
 
74
114
  ### Programmatic theming (no hand-authored OKLCH)
75
115
 
@@ -1025,10 +1065,13 @@ The shell renders a rounded floating panel (bottom-right) and a **text-only** pi
1025
1065
  | `AppCopilotProvider` | Page context via `useAppCopilotContext` (not shown in UI) |
1026
1066
  | `AppChatPanel` | Full-height floating thread; dismiss via **X** in the corner |
1027
1067
  | `AppShell` `chat` | Floating overlay — `chatWidth`; optional `chatHeight` (default: stretch top–bottom) |
1028
- | `LineAreaChart` / `Sparkline` | Dependency-free charts (smooth area/line/bar, hover tooltip, responsive) |
1068
+ | `LineAreaChart` | Cartesian engine on **recharts** area/line/bar, stacked, horizontal bars, `layout` (`flush` hides axes; tooltips carry category + values), `showXAxis` / `showYAxis`, `monotone`/`linear`/`step`, shadcn tooltips (`dot`/`line`/`dashed`) |
1069
+ | `PieChart` / `RadialChart` / `RadarChart` | Pie & donut (center KPI), concentric progress rings, and spider charts — native shadcn/recharts charts |
1070
+ | `ChartContainer` / `ChartTooltip` / `ChartTooltipContent` / `ChartLegend` / `ChartLegendContent` (`/ui`) | shadcn chart primitives (recharts wrappers); colors flow from `ChartConfig` → `--color-*` |
1071
+ | `Sparkline` | Tiny inline trend for table cells and tiles |
1029
1072
  | `MetricRow` | Platform KPI strip in one card (overview metrics, no chart) |
1030
- | `MetricChartCard` | `MetricRow` + selectable flush chart (Analytics / Infrastructure) |
1031
- | `ChartPanel` `artifact` | Chrome around a `ChartArtifact` or any chart |
1073
+ | `MetricChartCard` | `MetricRow` + selectable **flush** chart (no axis ticks; hover for category + value) |
1074
+ | `ChartPanel` `artifact` | Title row + flush plot around a `ChartArtifact` (`chartType`: `bar`/`horizontalBar`/`line`/`area`/`pie`/`donut`/`radial`/`radar`; optional `showAxes`) |
1032
1075
  | `SettingsSection` / `FieldRow` / `DangerZone` / `FloatingUnsavedChangesBar` | Two-column settings page building blocks |
1033
1076
  | `IntegrationCard` / `ConnectionRow` / `PlanBadge` / `IntegrationsEmptyState` | Integration catalog + connected list |
1034
1077
  | `InfoCard` / `DescriptionList` / `ExpandableSection` / `ResourceCard` / `StatusDot` | Surfaces & detail views |
@@ -1127,7 +1170,7 @@ bun run build:watch # rebuild on every change
1127
1170
 
1128
1171
  ### Vite apps linked with `file:../timbal-react`
1129
1172
 
1130
- Without extra config, Vite pre-bundles a **cached** copy under `node_modules/.vite/deps` and your UI will look stuck on an old build.
1173
+ Without extra config, Vite pre-bundles a **cached** copy under `node_modules/.vite/deps` and your UI can look stuck on an old build.
1131
1174
 
1132
1175
  1. Add the local-dev plugin in `vite.config.ts`:
1133
1176
 
@@ -1139,12 +1182,16 @@ export default defineConfig({
1139
1182
  });
1140
1183
  ```
1141
1184
 
1142
- 2. Run dev with a watch build (from your app):
1185
+ For **`file:` / symlink** installs the plugin **aliases package entrypoints to `src/`** and watches both `src/` and `dist/`, so app-kit / blueprint dev reflects timbal-react edits without rebuilding `dist/` on every change.
1186
+
1187
+ 2. Run dev (from your app or repo root):
1143
1188
 
1144
1189
  ```bash
1190
+ bun run example:app # timbal-react root — builds dist in watch mode + Vite
1191
+ # or
1145
1192
  node ../timbal-react/scripts/dev-linked.mjs vite
1146
1193
  ```
1147
1194
 
1148
- Or use the `dev` script in `blueprint-ui-dashboard` / examples (already wired).
1195
+ Run `bun run build` in timbal-react before publishing or to verify the production bundle.
1149
1196
 
1150
1197
  One-time if you still see stale UI: `rm -rf node_modules/.vite` then restart dev.