@lightdash/cli 1.86.2 → 1.88.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.
@@ -39,8 +39,9 @@
39
39
  "lucide-react": "0.469.0",
40
40
  "react": "19.2.5",
41
41
  "react-dom": "19.2.5",
42
+ "react-is": "19.2.5",
42
43
  "react-resizable-panels": "4.10.0",
43
- "recharts": "2.15.3",
44
+ "recharts": "3.8.1",
44
45
  "tailwind-merge": "3.5.0",
45
46
  "tailwindcss-animate": "1.0.7"
46
47
  },
@@ -53,7 +54,7 @@
53
54
  "@vitejs/plugin-react": "6.0.1",
54
55
  "autoprefixer": "10.4.20",
55
56
  "oxc-parser": "0.128.0",
56
- "postcss": "8.5.18",
57
+ "postcss": "8.5.25",
57
58
  "tailwindcss": "3.4.17",
58
59
  "typescript": "7.0.2",
59
60
  "vite": "8.0.16"
@@ -575,6 +575,12 @@ const dateCol = getColumn(columns, 'order_date_month');
575
575
  <YAxis tickFormatter={(v) => formatNumber(v, 'axis')} />
576
576
  ```
577
577
 
578
+ #### Recharts 3 interactions and shapes
579
+
580
+ This template uses Recharts 3. Use item-level event handlers (for example, `<Bar onClick={...}>`) when you need the clicked row; they receive the rendered item, its index, and the native React event. Do not read `activePayload` from a chart-level event — Recharts 3 exposes `activeTooltipIndex` there instead.
581
+
582
+ Do not use the removed `activeIndex` prop to control highlighting; configure `<Tooltip>` with `defaultIndex`, `active`, `content`, or `cursor`. Do not generate `<Cell>` elements; use the parent graphical element's `shape` or `content` prop instead.
583
+
578
584
  **Self-check before declaring done:** grep the generated app for `<XAxis` and `<YAxis`. Every match must have a `tickFormatter` prop. If any axis is missing one, fix it before reporting the build complete — claiming "all axes formatted" without verifying is the most common way this lands broken.
579
585
 
580
586
  #### Chart value labels
@@ -944,9 +950,10 @@ Additional contextual options can be added when useful:
944
950
  Use the `DropdownMenu` component. The menu opens on click; each option triggers its respective action.
945
951
 
946
952
  ```tsx
947
- import { useState, useMemo, useRef } from 'react';
953
+ import { useState, useMemo } from 'react';
948
954
  import { createPortal } from 'react-dom';
949
955
  import { query, useLightdash, drillDown } from '@lightdash/query-sdk';
956
+ import { Bar, BarChart } from 'recharts';
950
957
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
951
958
  import { useGlobalFilters } from '@/lib/filters';
952
959
 
@@ -968,26 +975,23 @@ function RevenueChart() {
968
975
  const [menuState, setMenuState] = useState(null); // { row, x, y }
969
976
  const [drillState, setDrillState] = useState(null); // { query, title }
970
977
  const [underlyingState, setUnderlyingState] = useState(null); // { title, row, metric, promise }
971
- // Capture click position on pointerdown — this fires BEFORE Recharts'
972
- // onClick, so the coordinates are ready when the chart handler runs.
973
- // Recharts onClick does NOT expose the native MouseEvent.
974
- const lastClick = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
975
978
 
976
979
  return (
977
980
  <>
978
- <div onPointerDown={(e) => { lastClick.current = { x: e.clientX, y: e.clientY }; }}>
979
- <BarChart data={data} onClick={(e) => {
980
- if (e?.activePayload?.[0]) {
981
- setMenuState({
982
- row: e.activePayload[0].payload,
983
- x: lastClick.current.x,
984
- y: lastClick.current.y,
985
- });
986
- }
987
- }}>
988
- {/* ... bars, axes, etc. */}
981
+ <BarChart data={data}>
982
+ {/* ... axes, etc. */}
983
+ <Bar
984
+ dataKey="total_revenue"
985
+ onClick={(item, _index, event) => {
986
+ if (!item.payload) return;
987
+ setMenuState({
988
+ row: item.payload,
989
+ x: event.clientX,
990
+ y: event.clientY,
991
+ });
992
+ }}
993
+ />
989
994
  </BarChart>
990
- </div>
991
995
 
992
996
  {/* Portal the menu to document.body: any animated/transformed
993
997
  ancestor (fade-in cards, slide-in sections) becomes the
@@ -1227,6 +1231,6 @@ The action-menu example above shows typical `drillDown()` usage. For the full AP
1227
1231
  | Applying `.parameters()` at module scope for a UI-driven value | Value never updates when the control changes | Apply `.parameters()` in a `useMemo` keyed on the state value; keep the base query at module scope |
1228
1232
  | Building drill query inside render | Infinite re-fetching | Build in onClick handler, store in state |
1229
1233
  | Drilling by a dimension already in the source query | Pointless — same grouping | Pick a different, more granular dimension |
1230
- | Using `e.chartX`/`e.chartY` for menu position | Chart-relative coords — menu appears at wrong position | Recharts `onClick` has no native event; capture `clientX`/`clientY` from a wrapper `<div onPointerDown>` via `useRef` — pointerdown fires before onClick so the ref is ready (see action menu example) |
1234
+ | Using `e.chartX`/`e.chartY` for menu position | Chart-relative coords — menu appears at wrong position | Use `clientX`/`clientY` from the native React event passed to a Recharts 3 item-level handler (the third argument to `<Bar onClick>`) |
1231
1235
  | Action menu opens far below/right of the click | An animated/transformed ancestor (fade-in card, slide-in section) is the containing block for the `position: fixed` trigger — "fixed" coords resolve inside the card, not the viewport | `createPortal(<DropdownMenu …>, document.body)` around the menu block, exactly as in the action-menu example — never render the fixed trigger inside the component tree |
1232
1236
  | Combining a direction word with a contradictory sign in narrative copy (`down +12%`, `up -4%`) | Sign and verb disagree → reads as a self-contradiction, looks like a platform bug | Pick one convention per report and stick to it: either signed deltas with no direction word (`+12%`, `−4%`), or direction word with unsigned magnitude (`up 12%`, `down 4%`). Never mix. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "1.86.2",
3
+ "version": "1.88.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "unique-names-generator": "4.7.1",
42
42
  "uuid": "11.1.1",
43
43
  "yaml": "2.8.3",
44
- "@lightdash/common": "1.86.2",
45
- "@lightdash/warehouses": "1.86.2"
44
+ "@lightdash/common": "1.88.0",
45
+ "@lightdash/warehouses": "1.88.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/inquirer": "8.2.4",