@altertable/data-app-react 0.76.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/index.js CHANGED
@@ -1,15 +1,20 @@
1
- import { $ as SearchField, $t as Button$1, A as LiveControl, B as isPlainKeyEvent, Bt as useViewTab, E as DataAppFrame, F as MenuSeparator, Ft as Tab, G as FilterActions, Gt as ChartTooltip$1, Ht as GradientScroll, I as MenuTrigger, It as TabList, J as dateTimeRangeVariable, Kt as TooltipSurface, Lt as TabPanel, M as MenuItem, Mt as DataAppProvider, N as MenuPopover, Ot as ShimmerText, P as MenuSection, Pt as AboutData, Q as SearchTypeahead, Rt as TabPanels, S as withWidgetBoundary, St as HelpPopover, T as DataValue, U as useDeclaredResult, Ut as Tooltip, V as createDataHooks, Vt as Sheet, W as VariableBar, Wt as TooltipProvider, Z as useAppVariables, Zt as AppIcon, _ as explorationMenuEvents, a as TextWidget$1, an as injectDataAppStyles, at as DateTimeRangePicker, b as useChartActions, bt as DateDisplay, c as DataTableEmptyRow, d as MetricWidget$1, en as PressButton, et as NumberFilterPicker, f as VisualizationWidget$1, ft as matchSearchText, g as ExplorationActionMenu, h as ExplorationActionControl, it as FilterBar, j as Menu, k as PresentStory, l as DataTableShare, lt as SelectionMark, n as createDataContext, nt as NumberRangeField, o as TableWidget$1, ot as Select, pt as searchItems, q as dateTimeRangePresets, r as chartBarFill, rn as useDateFormatting, rt as DimensionPicker, s as DataTable, st as ChoicePicker, t as SectionHeading, tn as classNames, tt as NumberField, u as DataTableTimestamp, ut as SearchMatch, v as getPrimaryExplorationAction, x as DataWidget, y as openExplorationMenu, zt as Tabs } from "../chunks/SectionHeading-DLVTKa91.js";
2
- import { createDataClient } from "@altertable/data-app/client";
1
+ import { $ as NumberRangeField, $t as Button$1, A as PresentStory, At as ShimmerText, Bt as useViewTab, D as DataAppFrame, E as Notice, F as MenuSection, Ft as Tab, Gt as ChartTooltip$1, H as createDataHooks, Ht as GradientScroll, I as MenuSeparator, It as TabList, J as ControlBar, K as useDeclaredResult, Kt as TooltipSurface, L as MenuTrigger, Lt as TabPanel, M as Menu, Mt as DataAppProvider, N as MenuItem, P as MenuPopover, Pt as AboutData, Q as NumberField, Rt as TabPanels, S as withWidgetBoundary, St as HelpPopover, T as DataValue, Ut as Tooltip, V as isPlainKeyEvent, Vt as Sheet, Wt as TooltipProvider, X as SearchField, Y as SearchTypeahead, Z as NumberFilterPicker, Zt as AppIcon, _ as explorationMenuEvents, a as TextWidget$1, an as injectDataAppStyles, b as useChartActions, bt as DateDisplay, c as DataTableEmptyRow, ct as dateTimeRangeFilter, d as MetricWidget$1, en as PressButton, et as DimensionPicker, f as VisualizationWidget$1, ft as matchSearchText, g as ExplorationActionMenu, h as ExplorationActionControl, it as ChoicePicker, j as LiveControl, l as DataTableShare, lt as dateTimeRangePresets, n as createDataContext, nt as DateTimeRangePicker, o as TableWidget$1, ot as SelectionMark, pt as searchItems, q as FilterActions, r as chartBarFill, rn as useDateFormatting, rt as Select, s as DataTable, st as SearchMatch, t as SectionHeading, tn as classNames, tt as FilterBar, u as DataTableTimestamp, ut as useAppFilters, v as getPrimaryExplorationAction, x as DataWidget, y as openExplorationMenu, zt as Tabs } from "../chunks/SectionHeading-BKvi7HVv.js";
3
2
  import { KEY_SEPARATOR, invariant, validateChoiceOptions } from "@altertable/data-app/internal";
4
- import { Children, Fragment, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
+ import { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
4
  import { Label, Radio as Radio$1, RadioGroup as RadioGroup$1 } from "react-aria-components";
6
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
6
  import { formatDate, formatDateTime, formatMetric, formatNumber, formatPercent, parseDateTime } from "@altertable/data-app/format";
8
- import { Area, AreaChart as AreaChart$1, Bar, BarChart as BarChart$1, Brush, CartesianGrid, Cell, ComposedChart as ComposedChart$1, DefaultTooltipContent, Dot, ErrorBar, Label as Label$1, LabelList, Legend, Line, LineChart as LineChart$1, ReferenceArea, ReferenceDot, ReferenceLine, Scatter, Tooltip as Tooltip$1, XAxis, YAxis, ZAxis, useActiveTooltipLabel, useIsTooltipActive, usePlotArea, useXAxisScale, useYAxisTicks } from "recharts";
7
+ import { Area, AreaChart as AreaChart$1, Bar, BarChart as BarChart$1, Brush, CartesianGrid, Cell, ComposedChart as ComposedChart$1, DefaultTooltipContent, Dot, ErrorBar, Label as Label$1, LabelList, Legend, Line, LineChart as LineChart$1, Rectangle, ReferenceArea, ReferenceDot, ReferenceLine, Scatter, Tooltip as Tooltip$1, XAxis, YAxis, ZAxis, useActiveTooltipLabel, useCartesianChartLayout, useIsTooltipActive, useMargin, useOffset, usePlotArea, useXAxisScale, useYAxisTicks } from "recharts";
9
8
  //#region src/ui/StaticDataApp.tsx
10
9
  /** Setup and static screens; fetched data uses the declared-view DataApp. */
11
- function DataApp(props) {
12
- return /* @__PURE__ */ jsx(DataAppFrame, { ...props });
10
+ function DataApp({ csvExport, ...props }) {
11
+ return /* @__PURE__ */ jsx(DataAppFrame, {
12
+ ...props,
13
+ csvExport: csvExport && {
14
+ loading: false,
15
+ value: csvExport
16
+ }
17
+ });
13
18
  }
14
19
  //#endregion
15
20
  //#region src/ui/GettingStarted.tsx
@@ -17,17 +22,14 @@ const connectionContext = createDataContext({})({
17
22
  description: "Connection setup",
18
23
  glossary: {}
19
24
  });
20
- const { defineDataView } = /* @__PURE__ */ createDataHooks(/* @__PURE__ */ createDataClient());
21
- const connectionView = defineDataView({
22
- dataContext: connectionContext,
23
- operation: "connection",
24
- describeInput: () => "the connection",
25
- isEmpty: () => false,
26
- emptyFallback: { title: "No connection" }
27
- });
28
25
  /** Query-backed connection state and next steps for a newly created app. Mount within
29
- * `DataAppProvider` and register `connection: connectionCheck(app.queries)` on the server. */
30
- function GettingStarted({ dataContext }) {
26
+ * `DataAppProvider` and supply the app's registered connection operation. */
27
+ function GettingStarted({ dataContext, client }) {
28
+ const connectionView = useMemo(() => createDataHooks(client).defineView({
29
+ dataContext: connectionContext,
30
+ operation: "connection",
31
+ describeInput: () => "the connection"
32
+ }), [client]);
31
33
  const connection = useDeclaredResult(connectionView);
32
34
  const state = connection.view.kind === "error" || connection.view.kind === "stale-error" ? "error" : connection.refreshing || !connection.snapshot ? "checking" : "connected";
33
35
  return /* @__PURE__ */ jsxs(DataApp, {
@@ -177,6 +179,12 @@ function Checkbox({ label, description, checked, value, onChange, disabled, clas
177
179
  }
178
180
  //#endregion
179
181
  //#region src/ui/chart-data.ts
182
+ /** Match Recharts data keys, including nested paths and literal dotted keys. */
183
+ function chartField(row, key) {
184
+ if (row == null || typeof row !== "object") return void 0;
185
+ if (key in row) return row[key];
186
+ return String(key).replace(/\[(\d+)\]/g, ".$1").split(".").reduce((value, part) => value != null && typeof value === "object" ? value[part] : void 0, row);
187
+ }
180
188
  function validateChartIds(kind, items) {
181
189
  const ids = /* @__PURE__ */ new Set();
182
190
  for (const item of items) {
@@ -197,6 +205,36 @@ function validateScatterChartItems(items) {
197
205
  for (const item of items) invariant(Number.isFinite(item.x) && Number.isFinite(item.y), `scatter chart "${item.id}" requires finite values for x and y.`);
198
206
  }
199
207
  //#endregion
208
+ //#region src/ui/chart-interaction.tsx
209
+ function chartAxisKey(axis, id) {
210
+ return `${axis}:${typeof id}:${id}`;
211
+ }
212
+ const ChartInteractionContext = createContext(null);
213
+ const ChartRegistrationContext = createContext(null);
214
+ function isChartSeriesActive(interaction, seriesId) {
215
+ return !interaction?.isPointerInspection || interaction.seriesCount === 1 || interaction.activeSeriesId === seriesId;
216
+ }
217
+ function useChartSeries(id) {
218
+ const generatedId = useId();
219
+ const interaction = useContext(ChartInteractionContext);
220
+ const registration = useContext(ChartRegistrationContext);
221
+ const seriesId = id ?? generatedId;
222
+ const registerSeries = registration?.registerSeries;
223
+ useEffect(() => registerSeries?.(seriesId), [registerSeries, seriesId]);
224
+ return {
225
+ id: seriesId,
226
+ active: isChartSeriesActive(interaction, seriesId)
227
+ };
228
+ }
229
+ function ChartSeries({ id, children }) {
230
+ const registration = useContext(ChartRegistrationContext);
231
+ return /* @__PURE__ */ jsx("g", {
232
+ onPointerOver: () => registration?.setHoveredSeriesId(id),
233
+ onPointerDown: () => registration?.setHoveredSeriesId(id),
234
+ children
235
+ });
236
+ }
237
+ //#endregion
200
238
  //#region src/ui/time-interval.ts
201
239
  /*!
202
240
  * TypeScript port of d3-time 3.1.0 (ISC), https://github.com/d3/d3-time/tree/v3.1.0
@@ -890,11 +928,6 @@ function useDateAxisBar(id = 0) {
890
928
  function useDateAxisLabel(id = 0) {
891
929
  return useContext(ChartDateAxesContext)?.formatters.get(id);
892
930
  }
893
- function field(row, key) {
894
- if (row == null || typeof row !== "object") return void 0;
895
- if (key in row) return row[key];
896
- return String(key).replace(/\[(\d+)\]/g, ".$1").split(".").reduce((value, part) => value != null && typeof value === "object" ? value[part] : void 0, row);
897
- }
898
931
  const xAxisDefaults = {
899
932
  interval: "preserveStartEnd",
900
933
  stroke: "var(--atbl-muted)",
@@ -945,7 +978,8 @@ function LinkedTimeCursor({ times, axisId }) {
945
978
  /**
946
979
  * Infers temporal input from ISO dates, zoned ISO timestamps, and Date values.
947
980
  * Use scale="utc" for epoch milliseconds or type="category" for date-like categories.
948
- * Explicit tick formatters and tick lists retain authored axis behavior.
981
+ * Explicit tick formatters and tick lists retain authored axis behavior while
982
+ * date-like values still receive readable tooltip labels.
949
983
  */
950
984
  function ChartXAxis(props) {
951
985
  const context = useContext(ChartDateAxesContext);
@@ -954,31 +988,34 @@ function ChartXAxis(props) {
954
988
  const { dataKey, ...axisProps } = props;
955
989
  const numeric = props.scale === "utc";
956
990
  const enabled = numeric || props.type == null && props.scale == null && props.tickFormatter == null && props.ticks == null;
957
- const model = useMemo(() => {
958
- if (!enabled || !data?.length || dataKey == null) return null;
959
- return timeModel(data.map((row) => typeof dataKey === "function" ? dataKey(row) : field(row, dataKey)), numeric);
960
- }, [
961
- data,
962
- dataKey,
963
- enabled,
964
- numeric
965
- ]);
966
- const cursorModel = useMemo(() => {
967
- if (!data?.length || dataKey == null || props.type === "category") return null;
968
- if (props.scale !== "utc" && props.scale !== "time") return null;
969
- return timeModel(data.map((row) => typeof dataKey === "function" ? dataKey(row) : field(row, dataKey)), props.scale === "utc" || props.scale === "time");
991
+ const dateLabelModel = useMemo(() => {
992
+ if (!data?.length || dataKey == null) return null;
993
+ if (props.type === "category" && props.scale !== "utc") return null;
994
+ if (props.type === "number" && props.scale !== "utc" && props.scale !== "time") return null;
995
+ return timeModel(data.map((row) => typeof dataKey === "function" ? dataKey(row) : chartField(row, dataKey)), props.scale === "utc" || props.scale === "time");
970
996
  }, [
971
997
  data,
972
998
  dataKey,
973
999
  props.type,
974
1000
  props.scale
975
1001
  ]);
1002
+ const model = enabled ? dateLabelModel : null;
1003
+ const cursorModel = props.type !== "category" && (props.scale === "utc" || props.scale === "time") ? dateLabelModel : null;
976
1004
  const register = context?.register;
977
1005
  const id = props.xAxisId ?? 0;
978
- useEffect(() => model ? register?.(id, model.tooltip) : void 0, [
1006
+ const registerCategoryAxis = useContext(ChartRegistrationContext)?.registerCategoryAxis;
1007
+ useLayoutEffect(() => {
1008
+ if (dataKey == null) return;
1009
+ return registerCategoryAxis?.("x", id, dataKey);
1010
+ }, [
1011
+ registerCategoryAxis,
1012
+ id,
1013
+ dataKey
1014
+ ]);
1015
+ useEffect(() => dateLabelModel ? register?.(id, dateLabelModel.tooltip) : void 0, [
979
1016
  register,
980
1017
  id,
981
- model
1018
+ dateLabelModel
982
1019
  ]);
983
1020
  if (!model || dataKey == null) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(XAxis, {
984
1021
  ...xAxisDefaults,
@@ -1017,36 +1054,67 @@ function ChartXAxis(props) {
1017
1054
  } : xAxisDefaults.tick,
1018
1055
  ...axisProps,
1019
1056
  type: "number",
1020
- dataKey: (row) => chartTimestamp(typeof dataKey === "function" ? dataKey(row) : field(row, dataKey), numeric)
1057
+ dataKey: (row) => chartTimestamp(typeof dataKey === "function" ? dataKey(row) : chartField(row, dataKey), numeric)
1021
1058
  }), /* @__PURE__ */ jsx(LinkedTimeCursor, {
1022
1059
  times: model.times,
1023
1060
  axisId: id
1024
1061
  })] });
1025
1062
  }
1026
1063
  //#endregion
1027
- //#region src/ui/chart-interaction.tsx
1028
- const ChartInteractionContext = createContext(null);
1029
- function isChartSeriesActive(interaction, seriesId) {
1030
- return !interaction?.isPointerInspection || interaction.seriesCount === 1 || interaction.activeSeriesId === seriesId;
1064
+ //#region src/ui/chart-legend-interaction.tsx
1065
+ function chartLegendSeriesKey(id, dataKey) {
1066
+ if (typeof id === "string" || typeof id === "number") return [
1067
+ "series",
1068
+ typeof id,
1069
+ id
1070
+ ].join(KEY_SEPARATOR);
1071
+ if (typeof dataKey === "string" || typeof dataKey === "number") return [
1072
+ "data",
1073
+ typeof dataKey,
1074
+ dataKey
1075
+ ].join(KEY_SEPARATOR);
1076
+ return null;
1031
1077
  }
1032
- function useChartSeries(id) {
1033
- const generatedId = useId();
1034
- const interaction = useContext(ChartInteractionContext);
1035
- const seriesId = id ?? generatedId;
1036
- const registerSeries = interaction?.registerSeries;
1037
- useEffect(() => registerSeries?.(seriesId), [registerSeries, seriesId]);
1078
+ function reconcileLegendFocus(focused, keys) {
1079
+ if (!focused) return null;
1080
+ const available = new Set(keys);
1081
+ const next = new Set([...focused].filter((key) => available.has(key)));
1082
+ if (next.size === 0 || next.size === available.size) return null;
1083
+ return next.size === focused.size ? focused : next;
1084
+ }
1085
+ function toggleLegendFocus(focused, key, keys) {
1086
+ const current = reconcileLegendFocus(focused, keys);
1087
+ if (!current) return /* @__PURE__ */ new Set([key]);
1088
+ const next = new Set(current);
1089
+ if (next.has(key)) next.delete(key);
1090
+ else next.add(key);
1091
+ return next.size === 0 || next.size === new Set(keys).size ? null : next;
1092
+ }
1093
+ const ChartLegendInteractionContext = createContext(null);
1094
+ function useChartLegendSeries(id, dataKey) {
1095
+ const interaction = useContext(ChartLegendInteractionContext);
1096
+ const key = chartLegendSeriesKey(id, dataKey);
1038
1097
  return {
1039
- id: seriesId,
1040
- active: isChartSeriesActive(interaction, seriesId)
1098
+ inspectingLegend: !!interaction?.suppressPlotInspection,
1099
+ hidden: !!(key && interaction?.focusedKeys && !interaction.focusedKeys.has(key)),
1100
+ dimmed: !!(key && interaction?.hoveredKey && (!interaction.focusedKeys || interaction.focusedKeys.has(interaction.hoveredKey)) && interaction.hoveredKey !== key)
1041
1101
  };
1042
1102
  }
1043
- function ChartSeries({ id, children }) {
1044
- const interaction = useContext(ChartInteractionContext);
1045
- return /* @__PURE__ */ jsx("g", {
1046
- onPointerOver: () => interaction?.setHoveredSeriesId(id),
1047
- onPointerDown: () => interaction?.setHoveredSeriesId(id),
1048
- children
1049
- });
1103
+ function useChartLegendFocus(ids) {
1104
+ const [hoveredId, setHoveredId] = useState(null);
1105
+ const [storedFocusedIds, setStoredFocusedIds] = useState(null);
1106
+ const focusedIds = reconcileLegendFocus(storedFocusedIds, ids);
1107
+ function toggle(id) {
1108
+ setStoredFocusedIds((current) => toggleLegendFocus(current, id, ids));
1109
+ }
1110
+ return {
1111
+ hoveredId,
1112
+ setHoveredId,
1113
+ focusedIds,
1114
+ toggle,
1115
+ visible: (id) => !focusedIds || focusedIds.has(id),
1116
+ opacity: (id) => focusedIds && !focusedIds.has(id) ? 0 : hoveredId && (!focusedIds || focusedIds.has(hoveredId)) && hoveredId !== id ? .2 : 1
1117
+ };
1050
1118
  }
1051
1119
  //#endregion
1052
1120
  //#region src/ui/chart-value-format.ts
@@ -1098,7 +1166,7 @@ function ChartLegendRoot({ children, layout = "horizontal", align = "start", max
1098
1166
  const container = containerRef.current;
1099
1167
  if (!container) return;
1100
1168
  function measure() {
1101
- const list = containerRef.current?.firstElementChild;
1169
+ const list = containerRef.current?.querySelector(".altertable-chart-legend");
1102
1170
  if (list) setColumns(getComputedStyle(list).gridTemplateColumns.split(" ").length);
1103
1171
  }
1104
1172
  const observer = new ResizeObserver(measure);
@@ -1242,17 +1310,19 @@ function ChartDot({ active = false, stroke = seriesColor, fill = active ? stroke
1242
1310
  }
1243
1311
  function NearestChartDot({ seriesId, cx, cy, stroke }) {
1244
1312
  const interaction = useContext(ChartInteractionContext);
1245
- const registerPoint = interaction?.registerPoint;
1313
+ const registerPoint = useContext(ChartRegistrationContext)?.registerPoint;
1314
+ const legend = useChartLegendSeries(seriesId, void 0);
1246
1315
  useLayoutEffect(() => {
1247
- if (cx == null || cy == null) return;
1316
+ if (legend.hidden || cx == null || cy == null) return;
1248
1317
  return registerPoint?.(seriesId, cx, cy);
1249
1318
  }, [
1250
1319
  registerPoint,
1251
1320
  seriesId,
1252
1321
  cx,
1253
- cy
1322
+ cy,
1323
+ legend.hidden
1254
1324
  ]);
1255
- return isChartSeriesActive(interaction, seriesId) ? /* @__PURE__ */ jsx(ChartDot, {
1325
+ return !legend.hidden && isChartSeriesActive(interaction, seriesId) ? /* @__PURE__ */ jsx(ChartDot, {
1256
1326
  cx,
1257
1327
  cy,
1258
1328
  stroke,
@@ -1260,10 +1330,97 @@ function NearestChartDot({ seriesId, cx, cy, stroke }) {
1260
1330
  style: { pointerEvents: "none" }
1261
1331
  }) : null;
1262
1332
  }
1333
+ /** Recharts does not export its bar-shape dispatcher; keep this adapter isolated. */
1334
+ function renderBarShape(option, props) {
1335
+ if (isValidElement(option)) return cloneElement(option, {
1336
+ ...props,
1337
+ ...option.props
1338
+ });
1339
+ if (option === Rectangle) return /* @__PURE__ */ jsx(Rectangle, { ...props });
1340
+ if (typeof option === "function") return option(props, props.index);
1341
+ if (option && typeof option === "object") return /* @__PURE__ */ jsx(Rectangle, {
1342
+ ...props,
1343
+ ...option
1344
+ });
1345
+ return /* @__PURE__ */ jsx(Rectangle, { ...props });
1346
+ }
1347
+ function InspectedBarVisual({ seriesId, shape, activeShape, dimmed, ...props }) {
1348
+ const interaction = useContext(ChartInteractionContext);
1349
+ const selected = interaction?.isPointerInspection && interaction.activeBar?.seriesId === seriesId && interaction.activeBar.index === props.originalDataIndex;
1350
+ const renderedProps = {
1351
+ ...props,
1352
+ isActive: Boolean(selected || props.isActive),
1353
+ opacity: dimmed ? void 0 : selected ? .75 : props.opacity
1354
+ };
1355
+ const rendered = renderBarShape(selected && activeShape && activeShape !== true ? activeShape : shape, renderedProps);
1356
+ return dimmed ? /* @__PURE__ */ jsx("g", {
1357
+ opacity: .2,
1358
+ children: rendered
1359
+ }) : rendered;
1360
+ }
1263
1361
  /** Shared series defaults; native props override every authored choice. */
1362
+ function InspectedBarShape({ seriesId, shape, activeShape, dimmed, ...props }) {
1363
+ const registerBar = useContext(ChartRegistrationContext)?.registerBar;
1364
+ const { x, y, width, height, originalDataIndex, value, payload } = props;
1365
+ const reading = Array.isArray(value) ? value[1] - value[0] : value;
1366
+ useLayoutEffect(() => {
1367
+ if (reading === 0 || width <= 0 || height <= 0) return;
1368
+ return registerBar?.({
1369
+ seriesId,
1370
+ index: originalDataIndex,
1371
+ x,
1372
+ y,
1373
+ width,
1374
+ height,
1375
+ payload
1376
+ });
1377
+ }, [
1378
+ registerBar,
1379
+ seriesId,
1380
+ originalDataIndex,
1381
+ x,
1382
+ y,
1383
+ width,
1384
+ height,
1385
+ reading,
1386
+ payload
1387
+ ]);
1388
+ return /* @__PURE__ */ jsx(InspectedBarVisual, {
1389
+ ...props,
1390
+ seriesId,
1391
+ shape,
1392
+ activeShape,
1393
+ dimmed
1394
+ });
1395
+ }
1264
1396
  function ChartBar(props) {
1265
1397
  useDateAxisBar(props.xAxisId);
1266
1398
  const series = useChartSeries(props.id);
1399
+ const legend = useChartLegendSeries(series.id, props.dataKey);
1400
+ const interaction = useContext(ChartLegendInteractionContext);
1401
+ const layout = useCartesianChartLayout();
1402
+ const registerBarAxis = interaction?.registerBarAxis;
1403
+ const key = chartLegendSeriesKey(series.id, props.dataKey);
1404
+ const axisId = layout === "vertical" ? props.xAxisId ?? 0 : props.yAxisId ?? 0;
1405
+ const inspectStack = props.stackId != null;
1406
+ const inspectedShape = useCallback((shapeProps) => /* @__PURE__ */ jsx(InspectedBarShape, {
1407
+ ...shapeProps,
1408
+ seriesId: series.id,
1409
+ shape: props.shape,
1410
+ activeShape: props.activeBar,
1411
+ dimmed: legend.dimmed
1412
+ }), [
1413
+ series.id,
1414
+ props.shape,
1415
+ props.activeBar,
1416
+ legend.dimmed
1417
+ ]);
1418
+ useLayoutEffect(() => key && !props.hide ? registerBarAxis?.(key, axisId) : void 0, [
1419
+ registerBarAxis,
1420
+ key,
1421
+ axisId,
1422
+ props.hide
1423
+ ]);
1267
1424
  return /* @__PURE__ */ jsx(ChartSeries, {
1268
1425
  id: series.id,
1269
1426
  children: /* @__PURE__ */ jsx(Bar, {
@@ -1275,10 +1432,17 @@ function ChartBar(props) {
1275
1432
  0
1276
1433
  ] : 0,
1277
1434
  maxBarSize: 30,
1278
- activeBar: series.active ? { opacity: .75 } : false,
1279
1435
  isAnimationActive: false,
1280
1436
  ...props,
1281
- id: series.id
1437
+ activeBar: inspectStack ? false : props.activeBar ?? (series.active ? { opacity: .75 } : false),
1438
+ shape: inspectStack ? inspectedShape : props.shape,
1439
+ id: series.id,
1440
+ hide: legend.hidden || props.hide,
1441
+ opacity: legend.hidden ? 0 : legend.dimmed ? .2 : props.opacity,
1442
+ style: {
1443
+ ...props.style,
1444
+ pointerEvents: legend.hidden ? "none" : props.style?.pointerEvents
1445
+ }
1282
1446
  })
1283
1447
  });
1284
1448
  }
@@ -1286,6 +1450,7 @@ function ChartBar(props) {
1286
1450
  * activeDot independently controls the hovered point. Native dot props and renderers remain available. */
1287
1451
  function ChartLine({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1288
1452
  const series = useChartSeries(props.id);
1453
+ const legend = useChartLegendSeries(series.id, props.dataKey);
1289
1454
  return /* @__PURE__ */ jsx(ChartSeries, {
1290
1455
  id: series.id,
1291
1456
  children: /* @__PURE__ */ jsx(Line, {
@@ -1294,12 +1459,12 @@ function ChartLine({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1294
1459
  strokeWidth: 2,
1295
1460
  strokeLinecap: "round",
1296
1461
  strokeLinejoin: "round",
1297
- dot: dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(ChartDot, {
1462
+ dot: legend.hidden ? false : dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(ChartDot, {
1298
1463
  cx,
1299
1464
  cy,
1300
1465
  stroke
1301
1466
  }) : dot,
1302
- activeDot: activeDot === void 0 || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(NearestChartDot, {
1467
+ activeDot: legend.hidden || legend.inspectingLegend ? false : activeDot === void 0 || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(NearestChartDot, {
1303
1468
  seriesId: series.id,
1304
1469
  cx,
1305
1470
  cy,
@@ -1307,13 +1472,20 @@ function ChartLine({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1307
1472
  }) : activeDot,
1308
1473
  isAnimationActive: false,
1309
1474
  ...props,
1310
- id: series.id
1475
+ id: series.id,
1476
+ hide: legend.hidden || props.hide,
1477
+ opacity: legend.hidden ? 0 : legend.dimmed ? .2 : props.opacity,
1478
+ style: {
1479
+ ...props.style,
1480
+ pointerEvents: legend.hidden ? "none" : props.style?.pointerEvents
1481
+ }
1311
1482
  })
1312
1483
  });
1313
1484
  }
1314
1485
  /** Filled series with the same sample-dot and activeDot options as ChartLine. */
1315
1486
  function ChartArea({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1316
1487
  const series = useChartSeries(props.id);
1488
+ const legend = useChartLegendSeries(series.id, props.dataKey);
1317
1489
  return /* @__PURE__ */ jsx(ChartSeries, {
1318
1490
  id: series.id,
1319
1491
  children: /* @__PURE__ */ jsx(Area, {
@@ -1325,12 +1497,12 @@ function ChartArea({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1325
1497
  strokeLinejoin: "round",
1326
1498
  fill: stroke,
1327
1499
  fillOpacity: .14,
1328
- dot: dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(ChartDot, {
1500
+ dot: legend.hidden ? false : dot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(ChartDot, {
1329
1501
  cx,
1330
1502
  cy,
1331
1503
  stroke
1332
1504
  }) : dot,
1333
- activeDot: activeDot === void 0 || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(NearestChartDot, {
1505
+ activeDot: legend.hidden || legend.inspectingLegend ? false : activeDot === void 0 || activeDot === true ? ({ cx, cy }) => /* @__PURE__ */ jsx(NearestChartDot, {
1334
1506
  seriesId: series.id,
1335
1507
  cx,
1336
1508
  cy,
@@ -1338,23 +1510,46 @@ function ChartArea({ stroke = seriesColor, dot = false, activeDot, ...props }) {
1338
1510
  }) : activeDot,
1339
1511
  isAnimationActive: false,
1340
1512
  ...props,
1341
- id: series.id
1513
+ id: series.id,
1514
+ hide: legend.hidden || props.hide,
1515
+ opacity: legend.hidden ? 0 : legend.dimmed ? .2 : props.opacity,
1516
+ style: {
1517
+ ...props.style,
1518
+ pointerEvents: legend.hidden ? "none" : props.style?.pointerEvents
1519
+ }
1342
1520
  })
1343
1521
  });
1344
1522
  }
1345
1523
  function ChartScatter(props) {
1346
1524
  const series = useChartSeries(props.id);
1525
+ const legend = useChartLegendSeries(series.id, props.dataKey);
1347
1526
  return /* @__PURE__ */ jsx(ChartSeries, {
1348
1527
  id: series.id,
1349
1528
  children: /* @__PURE__ */ jsx(Scatter, {
1350
1529
  fill: seriesColor,
1351
1530
  isAnimationActive: false,
1352
1531
  ...props,
1353
- id: series.id
1532
+ id: series.id,
1533
+ hide: legend.hidden || props.hide,
1534
+ opacity: legend.hidden ? 0 : legend.dimmed ? .2 : props.opacity,
1535
+ style: {
1536
+ ...props.style,
1537
+ pointerEvents: legend.hidden ? "none" : props.style?.pointerEvents
1538
+ }
1354
1539
  })
1355
1540
  });
1356
1541
  }
1357
1542
  function ChartYAxis(props) {
1543
+ const registerCategoryAxis = useContext(ChartRegistrationContext)?.registerCategoryAxis;
1544
+ const id = props.yAxisId ?? 0;
1545
+ useLayoutEffect(() => {
1546
+ if (props.dataKey == null) return;
1547
+ return registerCategoryAxis?.("y", id, props.dataKey);
1548
+ }, [
1549
+ registerCategoryAxis,
1550
+ id,
1551
+ props.dataKey
1552
+ ]);
1358
1553
  const format = useContext(ChartValueFormat);
1359
1554
  const formatter = axisValueFormatter((useYAxisTicks(props.yAxisId) ?? []).map((tick) => tick.value).filter((value) => typeof value === "number"), format);
1360
1555
  return /* @__PURE__ */ jsx(YAxis, {
@@ -1368,11 +1563,21 @@ function ChartYAxis(props) {
1368
1563
  });
1369
1564
  }
1370
1565
  function ChartGrid(props) {
1371
- return /* @__PURE__ */ jsx(CartesianGrid, {
1566
+ const vertical = useCartesianChartLayout() === "vertical";
1567
+ const showZero = vertical ? props.vertical === true : props.horizontal === void 0 || props.horizontal === true;
1568
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CartesianGrid, {
1372
1569
  stroke: "var(--atbl-border)",
1373
1570
  vertical: false,
1374
1571
  ...props
1375
- });
1572
+ }), showZero && /* @__PURE__ */ jsx(ReferenceLine, {
1573
+ ...vertical ? { x: 0 } : { y: 0 },
1574
+ xAxisId: props.xAxisId,
1575
+ yAxisId: props.yAxisId,
1576
+ ifOverflow: "discard",
1577
+ stroke: props.stroke ?? "var(--atbl-muted)",
1578
+ strokeOpacity: props.strokeOpacity ?? .55,
1579
+ strokeWidth: props.strokeWidth ?? 1.5
1580
+ })] });
1376
1581
  }
1377
1582
  function ChartTooltipContent(props) {
1378
1583
  const valueFormat = useContext(ChartValueFormat);
@@ -1436,37 +1641,112 @@ function ChartTooltipContent(props) {
1436
1641
  })
1437
1642
  });
1438
1643
  }
1644
+ function MeasuredTooltipContent({ children, onMeasure }) {
1645
+ const ref = useRef(null);
1646
+ useLayoutEffect(() => {
1647
+ const element = ref.current;
1648
+ if (!element) return;
1649
+ const target = element;
1650
+ function measure() {
1651
+ onMeasure(target.offsetWidth, target.offsetHeight);
1652
+ }
1653
+ measure();
1654
+ if (typeof ResizeObserver === "undefined") return;
1655
+ const observer = new ResizeObserver(measure);
1656
+ observer.observe(element);
1657
+ return () => observer.disconnect();
1658
+ }, [onMeasure]);
1659
+ return /* @__PURE__ */ jsx("span", {
1660
+ ref,
1661
+ style: { display: "block" },
1662
+ children
1663
+ });
1664
+ }
1665
+ function barTooltipPosition(bar, plot, size) {
1666
+ const gap = 10;
1667
+ const right = bar.x + bar.width + gap;
1668
+ const left = bar.x - size.width - gap;
1669
+ const plotRight = plot.x + plot.width;
1670
+ const x = right + size.width <= plotRight ? right : left >= plot.x ? left : Math.max(plot.x, Math.min(right, plotRight - size.width));
1671
+ const edgeInset = Math.min(8, Math.max(0, (plot.height - size.height) / 2));
1672
+ return {
1673
+ x,
1674
+ y: Math.max(plot.y + edgeInset, Math.min(bar.y + bar.height / 2 - size.height / 2, plot.y + plot.height - size.height - edgeInset))
1675
+ };
1676
+ }
1439
1677
  /** Uses the same surface as single-series inspection; Recharts owns interaction. */
1440
1678
  function ChartTooltip(props) {
1441
1679
  const dateLabel = useDateAxisLabel(props.axisId);
1442
1680
  const interaction = useContext(ChartInteractionContext);
1681
+ const legendInteraction = useContext(ChartLegendInteractionContext);
1682
+ const plot = usePlotArea();
1683
+ const [tooltipSize, setTooltipSize] = useState({
1684
+ width: 0,
1685
+ height: 0
1686
+ });
1687
+ const measureTooltip = useCallback((width, height) => {
1688
+ setTooltipSize((current) => current.width === width && current.height === height ? current : {
1689
+ width,
1690
+ height
1691
+ });
1692
+ }, []);
1693
+ const { content: authoredContent, ...tooltipProps } = props;
1694
+ const activeBar = interaction?.isPointerInspection ? interaction.activeBar : null;
1695
+ const position = activeBar && plot && tooltipSize.width && tooltipSize.height ? barTooltipPosition(activeBar, plot, tooltipSize) : interaction?.isPointerInspection && interaction.activePoint ? { y: interaction.activePoint.y } : void 0;
1443
1696
  return /* @__PURE__ */ jsx(Tooltip$1, {
1444
1697
  labelFormatter: dateLabel,
1445
- content: (content) => /* @__PURE__ */ jsx(ChartTooltipContent, {
1446
- ...content,
1447
- payload: interaction?.isPointerInspection && interaction.seriesCount !== 1 && props.shared !== true ? content.payload.filter((entry) => entry.graphicalItemId === interaction.activeSeriesId) : content.payload
1448
- }),
1449
- position: interaction?.isPointerInspection && interaction.activePoint ? { y: interaction.activePoint.y } : void 0,
1698
+ position,
1450
1699
  cursor: false,
1451
1700
  isAnimationActive: false,
1452
- ...props
1701
+ ...tooltipProps,
1702
+ filterNull: activeBar ? false : props.filterNull,
1703
+ content: (content) => {
1704
+ if (legendInteraction?.suppressPlotInspection) return null;
1705
+ const selectedRow = activeBar?.payload;
1706
+ const payload = (interaction?.isPointerInspection && interaction.seriesCount !== 1 && props.shared !== true ? content.payload.filter((entry) => entry.graphicalItemId === interaction.activeSeriesId) : content.payload).filter((entry) => {
1707
+ if (!legendInteraction?.focusedKeys) return true;
1708
+ const key = chartLegendSeriesKey(entry.graphicalItemId, entry.dataKey);
1709
+ return key == null || legendInteraction.focusedKeys.has(key);
1710
+ });
1711
+ const selectedPayload = selectedRow == null ? payload : payload.map((entry) => {
1712
+ const key = entry.dataKey;
1713
+ const value = typeof key === "function" ? key(selectedRow) : key == null ? entry.value : chartField(selectedRow, key);
1714
+ return {
1715
+ ...entry,
1716
+ payload: selectedRow,
1717
+ value
1718
+ };
1719
+ });
1720
+ const categoryKey = interaction?.getCategoryDataKey(props.axisId ?? 0);
1721
+ const label = selectedRow == null || categoryKey == null ? content.label : typeof categoryKey === "function" ? categoryKey(selectedRow) : chartField(selectedRow, categoryKey);
1722
+ const filtered = {
1723
+ ...content,
1724
+ payload: selectedPayload,
1725
+ label
1726
+ };
1727
+ const rendered = typeof authoredContent === "function" ? authoredContent(filtered) : isValidElement(authoredContent) ? cloneElement(authoredContent, filtered) : /* @__PURE__ */ jsx(ChartTooltipContent, { ...filtered });
1728
+ return /* @__PURE__ */ jsx(MeasuredTooltipContent, {
1729
+ onMeasure: measureTooltip,
1730
+ children: rendered
1731
+ });
1732
+ }
1453
1733
  });
1454
1734
  }
1455
1735
  //#endregion
1456
1736
  //#region src/ui/use-chart-scroll-to-end.ts
1457
1737
  /** Keep the latest supplied samples visible when the displayed items change. */
1458
- function useChartScrollToEnd(items) {
1738
+ function useChartScrollToEnd(items, enabled = true) {
1459
1739
  const scrollport = useRef(null);
1460
1740
  useLayoutEffect(() => {
1461
1741
  const element = scrollport.current;
1462
- if (element) element.scrollLeft = element.scrollWidth - element.clientWidth;
1463
- }, [items]);
1742
+ if (element && enabled) element.scrollLeft = element.scrollWidth - element.clientWidth;
1743
+ }, [items, enabled]);
1464
1744
  return scrollport;
1465
1745
  }
1466
1746
  //#endregion
1467
1747
  //#region src/ui/TrendChart.tsx
1468
1748
  /** Ordered, equally spaced samples; negative values share an explicit zero baseline. */
1469
- function TrendChart({ items, unit, ariaLabel, formatValue = formatNumber, kind, itemActions, cursorGroup, horizontalGrid = false }) {
1749
+ function TrendChart({ items, unit, ariaLabel, formatValue = formatNumber, kind, itemActions, cursorGroup, horizontalGrid = true }) {
1470
1750
  validateValueChartItems(kind, items);
1471
1751
  const Plot = kind === "area" ? AreaChart$1 : LineChart$1;
1472
1752
  const chartActions = useChartActions();
@@ -1750,7 +2030,7 @@ function AreaChart(props) {
1750
2030
  * Include Other to represent the whole. Zero values remain in the legend; all-zero
1751
2031
  * data shows an empty circle. Colors follow item order. Compose inside VisualizationWidget;
1752
2032
  * hover/touch tooltips coordinate slice and legend emphasis without caller state. */
1753
- function PieChart({ items, unit, ariaLabel, showLegend = true, formatValue = (value) => new Intl.NumberFormat().format(value), itemActions }) {
2033
+ function PieChart({ items, unit, ariaLabel, showLegend = true, formatValue = formatNumber, itemActions }) {
1754
2034
  validateValueChartItems("pie", items);
1755
2035
  const chartActions = useChartActions();
1756
2036
  const [previewId, setPreviewId] = useState(null);
@@ -2092,29 +2372,55 @@ function timeTickIndices(items, width) {
2092
2372
  for (let tick = 0; tick < count; tick++) indices.add(start + tick * stride);
2093
2373
  return indices;
2094
2374
  }
2375
+ function PlotBoundsObserver({ overlayRef }) {
2376
+ const plot = usePlotArea();
2377
+ const left = plot?.x;
2378
+ const width = plot?.width;
2379
+ useLayoutEffect(() => {
2380
+ if (left === void 0 || width === void 0 || !Number.isFinite(left) || !Number.isFinite(width) || !overlayRef.current) return;
2381
+ const overlay = overlayRef.current;
2382
+ overlay.style.marginLeft = `${left}px`;
2383
+ overlay.style.width = `${width}px`;
2384
+ return () => {
2385
+ overlay.style.marginLeft = "";
2386
+ overlay.style.width = "";
2387
+ };
2388
+ }, [
2389
+ overlayRef,
2390
+ left,
2391
+ width
2392
+ ]);
2393
+ return null;
2394
+ }
2095
2395
  /** Nonnegative category values. Compose inside VisualizationWidget for a titled panel.
2096
2396
  * Owns hover/touch tooltips; no selection state or keyboard navigation. */
2097
- function BarChart({ items, unit, ariaLabel, formatValue = formatNumber, itemActions, cursorGroup, horizontalGrid = false }) {
2397
+ function BarChart({ items, unit, ariaLabel, formatValue: authoredFormatValue, itemActions, cursorGroup, horizontalGrid = true, showYAxis = false, scrollToEnd = true, valueFormat }) {
2398
+ const formatValue = authoredFormatValue ?? (valueFormat ? (value) => formatMetric(value, valueFormat) : formatNumber);
2399
+ const axisLabelSpace = showYAxis ? 10 : 0;
2098
2400
  validateValueChartItems("bar", items);
2099
2401
  const chartActions = useChartActions();
2100
2402
  const cursor = useLinkedChartCursor(cursorGroup);
2101
2403
  const linkedItem = items.find((item) => item.time === cursor.time && cursor.time != null);
2102
2404
  const [activeId, setActiveId] = useState();
2103
2405
  const [viewportWidth, setViewportWidth] = useState(0);
2104
- const scrollport = useChartScrollToEnd(items);
2105
2406
  const plotRef = useRef(null);
2106
2407
  const canvasRef = useRef(null);
2408
+ const itemOverlayRef = useRef(null);
2107
2409
  const menuTriggers = useRef(/* @__PURE__ */ new Map());
2108
- const maximum = items.reduce((max, item) => Math.max(max, item.value), 1);
2109
- const compactTimeAxis = items.length > 0 && items.every((item, index) => typeof item.time === "number" && Number.isFinite(item.time) && (index === 0 || item.time > items[index - 1].time)) && !itemActions;
2110
- const minimumSlotWidth = compactTimeAxis ? 3.5 : 45;
2410
+ const maximum = items.reduce((max, item) => Math.max(max, item.value), 0) || 1;
2411
+ const hasTimeAxis = items.length > 0 && items.every((item, index) => typeof item.time === "number" && Number.isFinite(item.time) && (index === 0 || item.time > items[index - 1].time));
2412
+ const scrollport = useChartScrollToEnd(items, scrollToEnd);
2413
+ const compactTimeAxis = hasTimeAxis && !itemActions;
2414
+ const minimumSlotWidth = compactTimeAxis ? 3.5 : 120;
2111
2415
  const plotWidth = Math.max(viewportWidth, items.length * minimumSlotWidth);
2112
2416
  const ticks = compactTimeAxis ? timeTickIndices(items, plotWidth) : null;
2113
2417
  useLayoutEffect(() => {
2114
2418
  const element = scrollport.current;
2115
2419
  if (!element) return;
2116
2420
  function updateWidth() {
2117
- setViewportWidth(Math.floor(element.getBoundingClientRect().width));
2421
+ const style = getComputedStyle(element);
2422
+ const padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);
2423
+ setViewportWidth(Math.floor(element.getBoundingClientRect().width - padding));
2118
2424
  }
2119
2425
  updateWidth();
2120
2426
  const observer = new ResizeObserver(updateWidth);
@@ -2143,59 +2449,64 @@ function BarChart({ items, unit, ariaLabel, formatValue = formatNumber, itemActi
2143
2449
  className: "altertable-chart-canvas",
2144
2450
  "aria-hidden": "true",
2145
2451
  ref: canvasRef,
2146
- children: /* @__PURE__ */ jsxs(BarChart$1, {
2147
- data: items.map((item) => ({
2148
- ...item,
2149
- plotValue: item.value / maximum
2150
- })),
2151
- responsive: true,
2152
- width: "100%",
2153
- height: 220,
2154
- margin: {
2155
- top: 0,
2156
- right: 0,
2157
- bottom: 0,
2158
- left: 0
2159
- },
2160
- accessibilityLayer: false,
2161
- tabIndex: -1,
2162
- barCategoryGap: "24%",
2163
- children: [
2164
- /* @__PURE__ */ jsx(ChartXAxis, {
2165
- hide: true,
2166
- dataKey: "id",
2167
- scale: "band"
2168
- }),
2169
- /* @__PURE__ */ jsx(ChartYAxis, {
2170
- hide: true,
2171
- domain: [0, 1],
2172
- allowDataOverflow: true
2173
- }),
2174
- horizontalGrid && /* @__PURE__ */ jsx(ChartGrid, {}),
2175
- /* @__PURE__ */ jsx(ChartBar, {
2176
- dataKey: "plotValue",
2177
- minPointSize: (value) => (value ?? 0) > 0 ? 7 : 0,
2178
- background: linkedItem ? ({ index, x, y, width, height }) => /* @__PURE__ */ jsx("g", { children: items[index]?.id === linkedItem.id && /* @__PURE__ */ jsx("rect", {
2179
- x,
2180
- y,
2181
- width,
2182
- height,
2183
- fill: "var(--atbl-muted)",
2184
- fillOpacity: .14,
2185
- pointerEvents: "none",
2186
- "aria-hidden": "true",
2187
- "data-atbl-internal-linked-cursor": "true"
2188
- }) }) : false,
2189
- children: items.map((item) => /* @__PURE__ */ jsx(Cell, {
2190
- fill: chartBarFill,
2191
- opacity: activeId === item.id ? .75 : 1,
2192
- "data-atbl-internal-bar-id": item.id
2193
- }, item.id))
2194
- })
2195
- ]
2452
+ children: /* @__PURE__ */ jsx(ChartValueFormat.Provider, {
2453
+ value: valueFormat,
2454
+ children: /* @__PURE__ */ jsxs(BarChart$1, {
2455
+ data: showYAxis ? items : items.map((item) => ({
2456
+ ...item,
2457
+ plotValue: item.value / maximum
2458
+ })),
2459
+ responsive: true,
2460
+ width: "100%",
2461
+ height: 220 + axisLabelSpace,
2462
+ margin: {
2463
+ top: 0,
2464
+ right: 0,
2465
+ bottom: axisLabelSpace,
2466
+ left: 0
2467
+ },
2468
+ accessibilityLayer: false,
2469
+ tabIndex: -1,
2470
+ barCategoryGap: "24%",
2471
+ children: [
2472
+ showYAxis && /* @__PURE__ */ jsx(PlotBoundsObserver, { overlayRef: itemOverlayRef }),
2473
+ /* @__PURE__ */ jsx(ChartXAxis, {
2474
+ hide: true,
2475
+ dataKey: "id",
2476
+ scale: "band"
2477
+ }),
2478
+ showYAxis ? /* @__PURE__ */ jsx(ChartYAxis, { domain: [0, "auto"] }) : /* @__PURE__ */ jsx(ChartYAxis, {
2479
+ hide: true,
2480
+ domain: [0, 1],
2481
+ allowDataOverflow: true
2482
+ }),
2483
+ horizontalGrid && /* @__PURE__ */ jsx(ChartGrid, {}),
2484
+ /* @__PURE__ */ jsx(ChartBar, {
2485
+ dataKey: showYAxis ? "value" : "plotValue",
2486
+ minPointSize: (value) => (value ?? 0) > 0 ? 7 : 0,
2487
+ background: linkedItem ? ({ index, x, y, width, height }) => /* @__PURE__ */ jsx("g", { children: items[index]?.id === linkedItem.id && /* @__PURE__ */ jsx("rect", {
2488
+ x,
2489
+ y,
2490
+ width,
2491
+ height,
2492
+ fill: "var(--atbl-muted)",
2493
+ fillOpacity: .14,
2494
+ pointerEvents: "none",
2495
+ "aria-hidden": "true",
2496
+ "data-atbl-internal-linked-cursor": "true"
2497
+ }) }) : false,
2498
+ children: items.map((item) => /* @__PURE__ */ jsx(Cell, {
2499
+ fill: chartBarFill,
2500
+ opacity: activeId === item.id ? .75 : 1,
2501
+ "data-atbl-internal-bar-id": item.id
2502
+ }, item.id))
2503
+ })
2504
+ ]
2505
+ })
2196
2506
  })
2197
2507
  }), /* @__PURE__ */ jsx("div", {
2198
2508
  className: "altertable-selectable-bars-items",
2509
+ ref: itemOverlayRef,
2199
2510
  children: items.map((item, index) => {
2200
2511
  const actions = chartActions.actions(itemActions?.(item) ?? [], item.label, `${formatValue(item.value)} ${unit}`);
2201
2512
  const action = getPrimaryExplorationAction(actions);
@@ -2308,9 +2619,9 @@ function RadioGroup({ label, className, children, ...props }) {
2308
2619
  }
2309
2620
  function Radio({ className, children, ...props }) {
2310
2621
  return /* @__PURE__ */ jsx(Radio$1, {
2622
+ "data-atbl-focus": "ring",
2311
2623
  ...props,
2312
2624
  "data-atbl-control": "action",
2313
- "data-atbl-focus": "ring",
2314
2625
  className: classNames("altertable-radio", className),
2315
2626
  children: (state) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
2316
2627
  className: "altertable-radio-mark",
@@ -2330,6 +2641,7 @@ function SegmentedControl({ options, className, ...props }) {
2330
2641
  children: options.map((option) => /* @__PURE__ */ jsx(Radio, {
2331
2642
  value: option.id,
2332
2643
  "data-atbl-internal-surface": "option",
2644
+ "data-atbl-focus": "inset",
2333
2645
  children: option.label
2334
2646
  }, option.id))
2335
2647
  })
@@ -2378,17 +2690,9 @@ function createLegendItemKeys() {
2378
2690
  const keys = payload.map((entry) => {
2379
2691
  const source = entry.payload;
2380
2692
  const id = source && typeof source === "object" && "id" in source ? source.id : void 0;
2381
- if (typeof id === "string" || typeof id === "number") return [
2382
- "series",
2383
- typeof id,
2384
- id
2385
- ].join(KEY_SEPARATOR);
2386
2693
  const key = entry.dataKey;
2387
- if (typeof key === "string" || typeof key === "number") return [
2388
- "data",
2389
- typeof key,
2390
- key
2391
- ].join(KEY_SEPARATOR);
2694
+ const seriesKey = chartLegendSeriesKey(id, key);
2695
+ if (seriesKey) return seriesKey;
2392
2696
  return ["object", identity(typeof key === "function" ? key : entry)].join(KEY_SEPARATOR);
2393
2697
  });
2394
2698
  const counts = /* @__PURE__ */ new Map();
@@ -2405,9 +2709,15 @@ function createLegendItemKeys() {
2405
2709
  });
2406
2710
  };
2407
2711
  }
2408
- function LegendContent({ payload = [], maxVisibleItems, formatter, layout, align, labelStyle, iconType, iconSize = 8, inactiveColor = "var(--atbl-muted)", position, verticalAlign, onClick, onMouseEnter, onMouseLeave, "aria-label": ariaLabel }) {
2712
+ function LegendContent({ payload = [], maxVisibleItems, formatter, layout, align, labelStyle, iconType, iconSize = 8, inactiveColor = "var(--atbl-muted)", position, verticalAlign, onClick, onMouseEnter, onMouseLeave, interactive = true, "aria-label": ariaLabel }) {
2409
2713
  const [getItemKeys] = useState(createLegendItemKeys);
2714
+ const interaction = useContext(ChartLegendInteractionContext);
2410
2715
  const itemKeys = getItemKeys(payload);
2716
+ const selectableKeys = itemKeys.filter((_, index) => payload[index]?.type !== "none");
2717
+ useLayoutEffect(() => {
2718
+ interaction?.reconcile(selectableKeys);
2719
+ });
2720
+ const canInteract = interactive && !onClick && interaction && (payload.filter((entry) => entry.type !== "none").length > 1 || interaction.focusedKeys !== null);
2411
2721
  if (!payload.some((entry) => entry.type !== "none")) return null;
2412
2722
  const vertical = layout === "vertical" || layout === "auto" && (position === "left" || position === "right");
2413
2723
  return /* @__PURE__ */ jsx(ChartLegend, {
@@ -2435,14 +2745,32 @@ function LegendContent({ payload = [], maxVisibleItems, formatter, layout, align
2435
2745
  })] });
2436
2746
  return /* @__PURE__ */ jsx(ChartLegend.Item, {
2437
2747
  inactive: entry.inactive,
2438
- onMouseEnter: onMouseEnter ? (event) => onMouseEnter(entry, index, event) : void 0,
2439
- onMouseLeave: onMouseLeave ? (event) => onMouseLeave(entry, index, event) : void 0,
2440
- children: onClick ? /* @__PURE__ */ jsx("button", {
2748
+ "data-legend-muted": canInteract && interaction.hoveredKey && (!interaction.focusedKeys || interaction.focusedKeys.has(interaction.hoveredKey)) && interaction.hoveredKey !== itemKeys[index] ? true : void 0,
2749
+ "data-legend-excluded": canInteract && interaction.focusedKeys && !interaction.focusedKeys.has(itemKeys[index]) ? true : void 0,
2750
+ onMouseEnter: (event) => {
2751
+ if (canInteract) interaction.hover(itemKeys[index]);
2752
+ onMouseEnter?.(entry, index, event);
2753
+ },
2754
+ onMouseLeave: (event) => {
2755
+ if (canInteract) interaction.hover(null);
2756
+ onMouseLeave?.(entry, index, event);
2757
+ },
2758
+ children: canInteract || onClick ? /* @__PURE__ */ jsx("button", {
2441
2759
  type: "button",
2442
2760
  "data-atbl-control": "action",
2443
2761
  "data-atbl-focus": "ring",
2444
2762
  className: "altertable-chart-legend-action",
2445
- onClick: (event) => onClick(entry, index, event),
2763
+ "aria-pressed": canInteract ? !!interaction.focusedKeys?.has(itemKeys[index]) : void 0,
2764
+ onFocus: () => {
2765
+ if (canInteract) interaction.hover(itemKeys[index]);
2766
+ },
2767
+ onBlur: () => {
2768
+ if (canInteract) interaction.hover(null);
2769
+ },
2770
+ onClick: (event) => {
2771
+ if (canInteract) interaction.toggle(itemKeys[index], selectableKeys);
2772
+ onClick?.(entry, index, event);
2773
+ },
2446
2774
  children: content
2447
2775
  }) : content
2448
2776
  }, itemKeys[index]);
@@ -2450,13 +2778,15 @@ function LegendContent({ payload = [], maxVisibleItems, formatter, layout, align
2450
2778
  });
2451
2779
  }
2452
2780
  /** Opt in inside ComposedChart to derive the shared legend from its displayed series.
2453
- * Give native series unique IDs when they share a data key.
2454
2781
  * Native positioning, sorting, formatters, callbacks, and custom content remain available. */
2455
- function ComposedChartLegend({ maxVisibleItems, ...props }) {
2782
+ function ComposedChartLegend({ maxVisibleItems, interactive = true, ...props }) {
2456
2783
  return /* @__PURE__ */ jsx(Legend, {
2457
2784
  iconSize: 8,
2458
2785
  inactiveColor: "var(--atbl-muted)",
2459
- content: /* @__PURE__ */ jsx(LegendContent, { maxVisibleItems }),
2786
+ content: /* @__PURE__ */ jsx(LegendContent, {
2787
+ maxVisibleItems,
2788
+ interactive
2789
+ }),
2460
2790
  ...props
2461
2791
  });
2462
2792
  }
@@ -2475,9 +2805,163 @@ function findNearestSeriesId(hoveredSeriesId, points, position) {
2475
2805
  }
2476
2806
  return selected;
2477
2807
  }
2808
+ function findNearestBar(bars, position, layout) {
2809
+ if (!position) return null;
2810
+ let nearest = null;
2811
+ let categoryDistance = Infinity;
2812
+ let valueDistance = Infinity;
2813
+ for (const bar of bars.values()) {
2814
+ const category = layout === "horizontal" ? Math.abs(position.x - (bar.x + bar.width / 2)) : Math.abs(position.y - (bar.y + bar.height / 2));
2815
+ const value = layout === "horizontal" ? Math.max(bar.y - position.y, 0, position.y - bar.y - bar.height) : Math.max(bar.x - position.x, 0, position.x - bar.x - bar.width);
2816
+ if (category < categoryDistance || category === categoryDistance && value < valueDistance) {
2817
+ nearest = bar;
2818
+ categoryDistance = category;
2819
+ valueDistance = value;
2820
+ }
2821
+ }
2822
+ return nearest;
2823
+ }
2824
+ function barCloserThanPoints(bar, points, position) {
2825
+ if (!bar || !position) return false;
2826
+ const dx = Math.max(bar.x - position.x, 0, position.x - bar.x - bar.width);
2827
+ const dy = Math.max(bar.y - position.y, 0, position.y - bar.y - bar.height);
2828
+ const barDistance = Math.hypot(dx, dy);
2829
+ let pointDistance = Infinity;
2830
+ for (const point of points.values()) pointDistance = Math.min(pointDistance, Math.hypot(point.x - position.x, point.y - position.y));
2831
+ return barDistance <= pointDistance;
2832
+ }
2833
+ function categoryDataKey(children, layout, axisId) {
2834
+ for (const child of Children.toArray(children)) {
2835
+ if (!isValidElement(child)) continue;
2836
+ if (child.type === Fragment) {
2837
+ const nested = categoryDataKey(child.props.children, layout, axisId);
2838
+ if (nested != null) return nested;
2839
+ }
2840
+ if (child.type !== (layout === "horizontal" ? ChartXAxis : ChartYAxis) && child.type !== (layout === "horizontal" ? XAxis : YAxis)) continue;
2841
+ if (((layout === "horizontal" ? child.props.xAxisId : child.props.yAxisId) ?? 0) !== axisId) continue;
2842
+ const key = child.props.dataKey;
2843
+ if (typeof key === "string" || typeof key === "number" || typeof key === "function") return key;
2844
+ }
2845
+ }
2478
2846
  function hasAuthoredGrid(children) {
2479
2847
  return Children.toArray(children).some((child) => isValidElement(child) && (child.type === ChartGrid || child.type === CartesianGrid || child.type === Fragment && hasAuthoredGrid(child.props.children)));
2480
2848
  }
2849
+ function countNativeSeriesKeys(children, counts = /* @__PURE__ */ new Map()) {
2850
+ Children.forEach(children, (child) => {
2851
+ if (!isValidElement(child)) return;
2852
+ if (child.type === Fragment) countNativeSeriesKeys(child.props.children, counts);
2853
+ else if (child.type === Line || child.type === Bar || child.type === Area || child.type === Scatter) {
2854
+ const props = child.props;
2855
+ const key = chartLegendSeriesKey(props.id, props.dataKey);
2856
+ if (key) counts.set(key, (counts.get(key) ?? 0) + 1);
2857
+ }
2858
+ });
2859
+ return counts;
2860
+ }
2861
+ function nativeSeriesId(props, child, index, path, keyCounts) {
2862
+ if (props.id != null) return props.id;
2863
+ const key = chartLegendSeriesKey(void 0, props.dataKey);
2864
+ return !key || (keyCounts.get(key) ?? 0) > 1 ? `atbl-native-${path}-${child.key ?? index}` : void 0;
2865
+ }
2866
+ function applyNativeLegendInteraction(children, focusedKeys, hoveredKey, suppressPlotInspection, valueAxis, visibleBarAxisIds, fullAxisSpace, yAxisSideCounts, keyCounts, path = "root") {
2867
+ return Children.map(children, (child, index) => {
2868
+ if (!isValidElement(child)) return child;
2869
+ if (child.type === Fragment) {
2870
+ const props = child.props;
2871
+ return cloneElement(child, { children: applyNativeLegendInteraction(props.children, focusedKeys, hoveredKey, suppressPlotInspection, valueAxis, visibleBarAxisIds, fullAxisSpace, yAxisSideCounts, keyCounts, `${path}-${child.key ?? index}`) });
2872
+ }
2873
+ if (child.type === ChartXAxis || child.type === XAxis) {
2874
+ const axis = child;
2875
+ if (valueAxis === "y") return cloneElement(axis, { includeHidden: axis.props.includeHidden ?? true });
2876
+ if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null) return child;
2877
+ return cloneElement(axis, { domain: visibleBarAxisIds.has(axis.props.xAxisId ?? 0) ? [0, "auto"] : ["auto", "auto"] });
2878
+ }
2879
+ if (child.type === ChartYAxis || child.type === YAxis) {
2880
+ const axis = child;
2881
+ if (valueAxis === "x") return cloneElement(axis, { includeHidden: axis.props.includeHidden ?? true });
2882
+ if (!focusedKeys || axis.props.domain != null || axis.props.ticks != null) return child;
2883
+ const side = axis.props.orientation ?? "left";
2884
+ const reservedWidth = (axis.props.width === "auto" || child.type === ChartYAxis && axis.props.width == null) && yAxisSideCounts[side] === 1 ? fullAxisSpace?.[side] : void 0;
2885
+ return cloneElement(axis, {
2886
+ domain: visibleBarAxisIds.has(axis.props.yAxisId ?? 0) ? [0, "auto"] : ["auto", "auto"],
2887
+ ...reservedWidth != null && { width: reservedWidth }
2888
+ });
2889
+ }
2890
+ if (child.type !== Line && child.type !== Bar && child.type !== Area && child.type !== Scatter) return child;
2891
+ const series = child;
2892
+ const id = nativeSeriesId(series.props, child, index, path, keyCounts);
2893
+ const key = chartLegendSeriesKey(id, series.props.dataKey);
2894
+ const excluded = !!(focusedKeys && !focusedKeys.has(key));
2895
+ return cloneElement(series, {
2896
+ id,
2897
+ hide: excluded || series.props.hide,
2898
+ opacity: excluded ? 0 : hoveredKey && (!focusedKeys || focusedKeys.has(hoveredKey)) && hoveredKey !== key ? .2 : series.props.opacity,
2899
+ style: {
2900
+ ...series.props.style,
2901
+ pointerEvents: excluded ? "none" : series.props.style?.pointerEvents
2902
+ },
2903
+ ...excluded && (child.type === Line || child.type === Area) ? {
2904
+ dot: false,
2905
+ activeDot: false
2906
+ } : {},
2907
+ ...suppressPlotInspection && (child.type === Line || child.type === Area) ? { activeDot: false } : {}
2908
+ });
2909
+ });
2910
+ }
2911
+ function collectVisibleNativeBarAxisIds(children, focusedKeys, valueAxis, keyCounts, path = "root", ids = /* @__PURE__ */ new Set()) {
2912
+ Children.forEach(children, (child, index) => {
2913
+ if (!isValidElement(child)) return;
2914
+ if (child.type === Fragment) collectVisibleNativeBarAxisIds(child.props.children, focusedKeys, valueAxis, keyCounts, `${path}-${child.key ?? index}`, ids);
2915
+ else if (child.type === Bar) {
2916
+ const props = child.props;
2917
+ const key = chartLegendSeriesKey(nativeSeriesId(props, child, index, path, keyCounts), props.dataKey);
2918
+ if (!props.hide && (!focusedKeys || focusedKeys.has(key))) ids.add(valueAxis === "x" ? props.xAxisId ?? 0 : props.yAxisId ?? 0);
2919
+ }
2920
+ });
2921
+ return ids;
2922
+ }
2923
+ function inspectAxisLayout(children, layout = {
2924
+ left: 0,
2925
+ right: 0,
2926
+ autoYAxis: false,
2927
+ interactiveLegend: false
2928
+ }) {
2929
+ Children.forEach(children, (child) => {
2930
+ if (!isValidElement(child)) return;
2931
+ if (child.type === Fragment) inspectAxisLayout(child.props.children, layout);
2932
+ else if (child.type === ChartYAxis || child.type === YAxis) {
2933
+ const props = child.props;
2934
+ if (!props.hide && !props.mirror) {
2935
+ layout[props.orientation ?? "left"]++;
2936
+ if (props.width === "auto" || child.type === ChartYAxis && props.width == null) layout.autoYAxis = true;
2937
+ }
2938
+ } else if (child.type === ComposedChartLegend || child.type === Legend) {
2939
+ const props = child.props;
2940
+ if (child.type === ComposedChartLegend && props.interactive !== false) layout.interactiveLegend = true;
2941
+ const side = props.position === "left" || props.position === "right" ? props.position : props.layout === "vertical" && (props.align === "left" || props.align === "right") ? props.align : null;
2942
+ if (side) layout[side]++;
2943
+ }
2944
+ });
2945
+ return layout;
2946
+ }
2947
+ function PlotOffsets({ onChange }) {
2948
+ const offset = useOffset();
2949
+ const margin = useMargin();
2950
+ const left = offset?.left;
2951
+ const right = offset?.right;
2952
+ const marginLeft = margin?.left ?? 5;
2953
+ const marginRight = margin?.right ?? 5;
2954
+ useLayoutEffect(() => {
2955
+ if (left != null && right != null) onChange(left - marginLeft, right - marginRight);
2956
+ }, [
2957
+ left,
2958
+ right,
2959
+ marginLeft,
2960
+ marginRight,
2961
+ onChange
2962
+ ]);
2963
+ return null;
2964
+ }
2481
2965
  /** Compose Cartesian series inside VisualizationWidget. Defaults to responsive
2482
2966
  * full width and 300px height. Children retain native Recharts props and behavior,
2483
2967
  * including stacking, numeric/time axes, missing values, tooltips, and keyboard
@@ -2485,15 +2969,41 @@ function hasAuthoredGrid(children) {
2485
2969
  * for stacks. Preserve missing measures as null and choose connectNulls deliberately.
2486
2970
  * Use public chart tokens for series colors. Dataset bindings own
2487
2971
  * loading, empty results, evidence, and CSV; this primitive owns only the plot. */
2488
- function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizontalGrid = false, children, width = "100%", height = 300, responsive = true, className, ...props }) {
2972
+ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizontalGrid = true, children, width = "100%", height = 300, responsive = true, layout = "horizontal", className, ...props }) {
2489
2973
  const cursor = useLinkedChartCursor(cursorGroup);
2490
2974
  const [mouseHover, setMouseHover] = useState(false);
2491
2975
  const [hasPointerFocus, setHasPointerFocus] = useState(false);
2492
2976
  const [isPointerInspection, setIsPointerInspection] = useState(false);
2493
2977
  const [hoveredSeriesId, setHoveredSeriesId] = useState(null);
2494
2978
  const [pointerPosition, setPointerPosition] = useState(null);
2979
+ const [nearestBar, setNearestBar] = useState(null);
2495
2980
  const latestPointerPosition = useRef(null);
2496
2981
  const [points, setPoints] = useState(() => /* @__PURE__ */ new Map());
2982
+ const bars = useRef(/* @__PURE__ */ new Map());
2983
+ const barRefreshFrame = useRef(null);
2984
+ const refreshNearestBar = useCallback(() => {
2985
+ if (barRefreshFrame.current != null || !latestPointerPosition.current) return;
2986
+ barRefreshFrame.current = requestAnimationFrame(() => {
2987
+ barRefreshFrame.current = null;
2988
+ const selected = findNearestBar(bars.current, latestPointerPosition.current, layout);
2989
+ setNearestBar(selected);
2990
+ setPointerPosition(latestPointerPosition.current);
2991
+ });
2992
+ }, [layout]);
2993
+ useEffect(() => () => {
2994
+ if (barRefreshFrame.current != null) cancelAnimationFrame(barRefreshFrame.current);
2995
+ }, []);
2996
+ const registerBar = useCallback((bar) => {
2997
+ const key = `${bar.seriesId}:${bar.index}`;
2998
+ bars.current.set(key, bar);
2999
+ refreshNearestBar();
3000
+ return () => {
3001
+ if (bars.current.get(key) === bar) {
3002
+ bars.current.delete(key);
3003
+ refreshNearestBar();
3004
+ }
3005
+ };
3006
+ }, [refreshNearestBar]);
2497
3007
  const registerPoint = useCallback((id, x, y) => {
2498
3008
  setPoints((current) => new Map(current).set(id, {
2499
3009
  x,
@@ -2505,6 +3015,17 @@ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizont
2505
3015
  return next;
2506
3016
  });
2507
3017
  }, []);
3018
+ const [categoryAxisKeys, setCategoryAxisKeys] = useState(() => /* @__PURE__ */ new Map());
3019
+ const registerCategoryAxis = useCallback((axis, id, dataKey) => {
3020
+ const key = chartAxisKey(axis, id);
3021
+ setCategoryAxisKeys((current) => current.get(key) === dataKey ? current : new Map(current).set(key, dataKey));
3022
+ return () => setCategoryAxisKeys((current) => {
3023
+ if (current.get(key) !== dataKey) return current;
3024
+ const next = new Map(current);
3025
+ next.delete(key);
3026
+ return next;
3027
+ });
3028
+ }, []);
2508
3029
  useEffect(() => {
2509
3030
  setPointerPosition(latestPointerPosition.current);
2510
3031
  }, [points]);
@@ -2515,10 +3036,12 @@ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizont
2515
3036
  resetPointerInspection();
2516
3037
  return false;
2517
3038
  }
3039
+ setSuppressPlotInspection(false);
2518
3040
  setIsPointerInspection(true);
2519
- if (hoveredSeriesId != null && !points.has(hoveredSeriesId)) {
3041
+ if (bars.current.size === 0 && hoveredSeriesId != null && !points.has(hoveredSeriesId)) {
2520
3042
  latestPointerPosition.current = null;
2521
3043
  setPointerPosition(null);
3044
+ setNearestBar(null);
2522
3045
  return true;
2523
3046
  }
2524
3047
  const matrix = svg.getScreenCTM();
@@ -2529,7 +3052,12 @@ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizont
2529
3052
  y: point.y
2530
3053
  };
2531
3054
  latestPointerPosition.current = nextPosition;
2532
- setPointerPosition((current) => findNearestSeriesId(hoveredSeriesId, points, current) === findNearestSeriesId(hoveredSeriesId, points, nextPosition) ? current : nextPosition);
3055
+ const selected = findNearestBar(bars.current, nextPosition, layout);
3056
+ setNearestBar(selected);
3057
+ setPointerPosition((current) => {
3058
+ const currentBar = findNearestBar(bars.current, current, layout);
3059
+ return (barCloserThanPoints(currentBar, points, current) ? currentBar : findNearestSeriesId(hoveredSeriesId, points, current)) === (barCloserThanPoints(selected, points, nextPosition) ? selected : findNearestSeriesId(hoveredSeriesId, points, nextPosition)) ? current : nextPosition;
3060
+ });
2533
3061
  return true;
2534
3062
  }
2535
3063
  function resetPointerInspection() {
@@ -2539,8 +3067,10 @@ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizont
2539
3067
  setHoveredSeriesId(null);
2540
3068
  latestPointerPosition.current = null;
2541
3069
  setPointerPosition(null);
3070
+ setNearestBar(null);
2542
3071
  }
2543
- const activeSeriesId = findNearestSeriesId(hoveredSeriesId, points, pointerPosition);
3072
+ const activeBar = barCloserThanPoints(nearestBar, points, pointerPosition) ? nearestBar : null;
3073
+ const activeSeriesId = activeBar?.seriesId ?? findNearestSeriesId(hoveredSeriesId, points, pointerPosition);
2544
3074
  const [seriesIds, setSeriesIds] = useState(() => /* @__PURE__ */ new Set());
2545
3075
  const registerSeries = useCallback((id) => {
2546
3076
  setSeriesIds((current) => new Set(current).add(id));
@@ -2552,56 +3082,128 @@ function ComposedChartRoot({ data, ariaLabel, valueFormat, cursorGroup, horizont
2552
3082
  });
2553
3083
  };
2554
3084
  }, []);
3085
+ const [legendHoveredKey, setLegendHoveredKey] = useState(null);
3086
+ const [suppressPlotInspection, setSuppressPlotInspection] = useState(false);
3087
+ const [focusedLegendKeys, setFocusedLegendKeys] = useState(null);
3088
+ const [barAxisByKey, setBarAxisByKey] = useState(() => /* @__PURE__ */ new Map());
3089
+ const registerBarAxis = useCallback((key, axisId) => {
3090
+ setBarAxisByKey((current) => {
3091
+ if (current.get(key) === axisId) return current;
3092
+ return new Map(current).set(key, axisId);
3093
+ });
3094
+ return () => setBarAxisByKey((current) => {
3095
+ if (current.get(key) !== axisId) return current;
3096
+ const next = new Map(current);
3097
+ next.delete(key);
3098
+ return next;
3099
+ });
3100
+ }, []);
3101
+ const valueAxis = layout === "vertical" ? "x" : "y";
3102
+ const [fullAxisSpace, setFullAxisSpace] = useState(null);
3103
+ const trackPlotOffsets = useCallback((left, right) => {
3104
+ if (focusedLegendKeys) return;
3105
+ setFullAxisSpace((current) => current?.left === left && current.right === right ? current : {
3106
+ left,
3107
+ right
3108
+ });
3109
+ }, [focusedLegendKeys]);
3110
+ const axisLayout = inspectAxisLayout(children);
3111
+ const nativeKeyCounts = countNativeSeriesKeys(children);
3112
+ const visibleBarAxisIds = collectVisibleNativeBarAxisIds(children, focusedLegendKeys, valueAxis, nativeKeyCounts);
3113
+ for (const [key, axisId] of barAxisByKey) if (!focusedLegendKeys || focusedLegendKeys.has(key)) visibleBarAxisIds.add(axisId);
3114
+ const reconcileLegendKeys = useCallback((keys) => {
3115
+ setFocusedLegendKeys((current) => reconcileLegendFocus(current, keys));
3116
+ }, []);
3117
+ const toggleLegendKey = useCallback((key, keys) => {
3118
+ setSuppressPlotInspection(true);
3119
+ setFocusedLegendKeys((current) => toggleLegendFocus(current, key, keys));
3120
+ }, []);
3121
+ const registration = useMemo(() => ({
3122
+ registerPoint,
3123
+ registerBar,
3124
+ registerSeries,
3125
+ registerCategoryAxis,
3126
+ setHoveredSeriesId
3127
+ }), [
3128
+ registerPoint,
3129
+ registerBar,
3130
+ registerSeries,
3131
+ registerCategoryAxis
3132
+ ]);
2555
3133
  return /* @__PURE__ */ jsx(ChartCursorChartContext.Provider, {
2556
3134
  value: {
2557
3135
  cursor,
2558
3136
  mouseHover
2559
3137
  },
2560
- children: /* @__PURE__ */ jsx(ChartInteractionContext.Provider, {
3138
+ children: /* @__PURE__ */ jsx(ChartLegendInteractionContext.Provider, {
2561
3139
  value: {
2562
- isPointerInspection,
2563
- activeSeriesId,
2564
- activePoint: activeSeriesId == null ? void 0 : points.get(activeSeriesId),
2565
- registerPoint,
2566
- setHoveredSeriesId,
2567
- seriesCount: seriesIds.size,
2568
- registerSeries
2569
- },
2570
- children: /* @__PURE__ */ jsx("section", {
2571
- className: classNames("altertable-composed-chart", className),
2572
- "aria-label": ariaLabel,
2573
- "data-atbl-internal-pointer-focus": hasPointerFocus || void 0,
2574
- onPointerDownCapture: (event) => {
2575
- setHasPointerFocus(trackPointer(event));
3140
+ hoveredKey: legendHoveredKey,
3141
+ focusedKeys: focusedLegendKeys,
3142
+ suppressPlotInspection,
3143
+ hover: (key) => {
3144
+ setLegendHoveredKey(key);
3145
+ if (key) setSuppressPlotInspection(true);
2576
3146
  },
2577
- onPointerOverCapture: trackPointer,
2578
- onPointerMoveCapture: trackPointer,
2579
- onPointerLeave: (event) => {
2580
- if (event.pointerType !== "touch") resetPointerInspection();
2581
- },
2582
- onKeyDownCapture: () => {
2583
- setHasPointerFocus(false);
2584
- resetPointerInspection();
3147
+ toggle: toggleLegendKey,
3148
+ reconcile: reconcileLegendKeys,
3149
+ registerBarAxis
3150
+ },
3151
+ children: /* @__PURE__ */ jsx(ChartInteractionContext.Provider, {
3152
+ value: {
3153
+ isPointerInspection,
3154
+ activeSeriesId,
3155
+ activePoint: activeSeriesId == null ? void 0 : points.get(activeSeriesId),
3156
+ activeBar,
3157
+ getCategoryDataKey: (axisId) => categoryAxisKeys.get(chartAxisKey(layout === "horizontal" ? "x" : "y", axisId)) ?? categoryDataKey(children, layout, axisId),
3158
+ seriesCount: seriesIds.size
2585
3159
  },
2586
- onBlurCapture: (event) => {
2587
- if (!event.currentTarget.contains(event.relatedTarget)) {
3160
+ children: /* @__PURE__ */ jsx("section", {
3161
+ className: classNames("altertable-composed-chart", className),
3162
+ "aria-label": ariaLabel,
3163
+ "data-atbl-internal-pointer-focus": hasPointerFocus || void 0,
3164
+ onPointerDownCapture: (event) => {
3165
+ setHasPointerFocus(trackPointer(event));
3166
+ },
3167
+ onPointerOverCapture: trackPointer,
3168
+ onPointerMoveCapture: trackPointer,
3169
+ onPointerLeave: (event) => {
3170
+ if (event.pointerType !== "touch") resetPointerInspection();
3171
+ },
3172
+ onKeyDownCapture: () => {
2588
3173
  setHasPointerFocus(false);
2589
3174
  resetPointerInspection();
2590
- }
2591
- },
2592
- children: /* @__PURE__ */ jsx(ChartValueFormat.Provider, {
2593
- value: valueFormat,
2594
- children: /* @__PURE__ */ jsx(ChartDateAxes, {
2595
- data,
2596
- children: /* @__PURE__ */ jsxs(ComposedChart$1, {
2597
- "data-atbl-focus": "inset",
2598
- ...props,
3175
+ },
3176
+ onFocusCapture: (event) => {
3177
+ if (event.currentTarget.querySelector("svg[role=\"application\"]")?.contains(event.target)) setSuppressPlotInspection(false);
3178
+ },
3179
+ onBlurCapture: (event) => {
3180
+ if (!event.currentTarget.contains(event.relatedTarget)) {
3181
+ setHasPointerFocus(false);
3182
+ resetPointerInspection();
3183
+ }
3184
+ },
3185
+ children: /* @__PURE__ */ jsx(ChartValueFormat.Provider, {
3186
+ value: valueFormat,
3187
+ children: /* @__PURE__ */ jsx(ChartDateAxes, {
2599
3188
  data,
2600
- width,
2601
- height,
2602
- responsive,
2603
- "aria-label": ariaLabel,
2604
- children: [horizontalGrid && !hasAuthoredGrid(children) && /* @__PURE__ */ jsx(ChartGrid, {}), children]
3189
+ children: /* @__PURE__ */ jsx(ChartRegistrationContext.Provider, {
3190
+ value: registration,
3191
+ children: /* @__PURE__ */ jsxs(ComposedChart$1, {
3192
+ "data-atbl-focus": "inset",
3193
+ ...props,
3194
+ data,
3195
+ width,
3196
+ height,
3197
+ responsive,
3198
+ layout,
3199
+ "aria-label": ariaLabel,
3200
+ children: [
3201
+ valueAxis === "y" && axisLayout.autoYAxis && axisLayout.interactiveLegend && /* @__PURE__ */ jsx(PlotOffsets, { onChange: trackPlotOffsets }),
3202
+ horizontalGrid && !hasAuthoredGrid(children) && /* @__PURE__ */ jsx(ChartGrid, {}),
3203
+ applyNativeLegendInteraction(children, focusedLegendKeys, legendHoveredKey, suppressPlotInspection, valueAxis, visibleBarAxisIds, fullAxisSpace, axisLayout, nativeKeyCounts)
3204
+ ]
3205
+ })
3206
+ })
2605
3207
  })
2606
3208
  })
2607
3209
  })
@@ -2695,7 +3297,8 @@ function createFunnelModel(steps, series, chartId) {
2695
3297
  }
2696
3298
  /** Conversion columns with previous-step drop-off, normalized to each series' first step.
2697
3299
  * Owns series highlighting and portion-specific inspection; compose inside VisualizationWidget. */
2698
- function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue = formatNumber, horizontalGrid = true }) {
3300
+ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue = formatNumber, horizontalGrid = true, interactiveLegend = true }) {
3301
+ const legendFocus = useChartLegendFocus(series.map((item) => item.id));
2699
3302
  const chartId = useSvgId();
2700
3303
  const [highlighted, setHighlighted] = useState(null);
2701
3304
  const clearTimer = useRef(null);
@@ -2733,13 +3336,36 @@ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue =
2733
3336
  layout: "single-row",
2734
3337
  children: populations.map((item) => /* @__PURE__ */ jsxs(ChartLegend.Item, {
2735
3338
  className: "altertable-funnel-summary-item",
2736
- children: [/* @__PURE__ */ jsxs("span", {
3339
+ "data-legend-muted": interactiveLegend && legendFocus.hoveredId && (!legendFocus.focusedIds || legendFocus.focusedIds.has(legendFocus.hoveredId)) && legendFocus.hoveredId !== item.id || void 0,
3340
+ "data-legend-excluded": interactiveLegend && !legendFocus.visible(item.id) || void 0,
3341
+ children: [interactiveLegend && populations.length > 1 ? /* @__PURE__ */ jsxs("button", {
3342
+ type: "button",
3343
+ "data-atbl-control": "action",
3344
+ "data-atbl-focus": "ring",
3345
+ className: "altertable-chart-legend-action altertable-funnel-legend-button",
3346
+ "aria-pressed": !!legendFocus.focusedIds?.has(item.id),
3347
+ onPointerEnter: () => legendFocus.setHoveredId(item.id),
3348
+ onPointerLeave: () => legendFocus.setHoveredId(null),
3349
+ onFocus: () => legendFocus.setHoveredId(item.id),
3350
+ onBlur: () => legendFocus.setHoveredId(null),
3351
+ onClick: () => legendFocus.toggle(item.id),
3352
+ children: [/* @__PURE__ */ jsxs("span", {
3353
+ className: "altertable-funnel-series-label",
3354
+ children: [/* @__PURE__ */ jsx(ChartLegend.Marker, {
3355
+ kind: "square",
3356
+ color: item.color
3357
+ }), /* @__PURE__ */ jsx(ChartLegend.Label, { children: item.label })]
3358
+ }), /* @__PURE__ */ jsx("strong", {
3359
+ className: "altertable-funnel-series-value",
3360
+ children: formatPercent(rows.at(-1)?.readings.get(item.id)?.conversion ?? null)
3361
+ })]
3362
+ }) : /* @__PURE__ */ jsxs("span", {
2737
3363
  className: "altertable-funnel-series-label",
2738
3364
  children: [/* @__PURE__ */ jsx(ChartLegend.Marker, {
2739
3365
  kind: "square",
2740
3366
  color: item.color
2741
3367
  }), /* @__PURE__ */ jsx(ChartLegend.Label, { children: item.label })]
2742
- }), /* @__PURE__ */ jsx("strong", {
3368
+ }), (!interactiveLegend || populations.length <= 1) && /* @__PURE__ */ jsx("strong", {
2743
3369
  className: "altertable-funnel-series-value",
2744
3370
  children: formatPercent(rows.at(-1)?.readings.get(item.id)?.conversion ?? null)
2745
3371
  })]
@@ -2760,6 +3386,7 @@ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue =
2760
3386
  children: /* @__PURE__ */ jsxs(ComposedChart, {
2761
3387
  data: rows,
2762
3388
  ariaLabel: `${ariaLabel} plot`,
3389
+ horizontalGrid,
2763
3390
  height: 300,
2764
3391
  barCategoryGap: "4%",
2765
3392
  barGap: 1,
@@ -2806,7 +3433,8 @@ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue =
2806
3433
  maxBarSize: void 0,
2807
3434
  activeBar: false,
2808
3435
  minPointSize: 0,
2809
- opacity: !highlighted || highlighted.id === item.id ? 1 : .2,
3436
+ style: { pointerEvents: interactiveLegend && !legendFocus.visible(item.id) ? "none" : void 0 },
3437
+ opacity: interactiveLegend ? legendFocus.opacity(item.id) * (!highlighted || highlighted.id === item.id ? 1 : .2) : !highlighted || highlighted.id === item.id ? 1 : .2,
2810
3438
  onMouseEnter: (bar) => highlight(item.id, true, bar.payload.index),
2811
3439
  onMouseLeave: scheduleClear,
2812
3440
  onClick: (bar) => highlight(item.id, true, bar.payload.index)
@@ -2815,7 +3443,8 @@ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue =
2815
3443
  name: `${item.label} drop-off`,
2816
3444
  stackId: item.id,
2817
3445
  fill: `url(#${item.hatchId})`,
2818
- opacity: !highlighted || highlighted.id === item.id ? 1 : .2,
3446
+ style: { pointerEvents: interactiveLegend && !legendFocus.visible(item.id) ? "none" : void 0 },
3447
+ opacity: interactiveLegend ? legendFocus.opacity(item.id) * (!highlighted || highlighted.id === item.id ? 1 : .2) : !highlighted || highlighted.id === item.id ? 1 : .2,
2819
3448
  onMouseEnter: (bar) => highlight(item.id, false, bar.payload.index),
2820
3449
  onMouseLeave: scheduleClear,
2821
3450
  onClick: (bar) => highlight(item.id, false, bar.payload.index),
@@ -2826,7 +3455,7 @@ function FunnelChart({ steps, series, unit, ariaLabel, className, formatValue =
2826
3455
  /* @__PURE__ */ jsx(ComposedChart.Tooltip, { content: ({ active, activeIndex }) => {
2827
3456
  const row = activeIndex == null ? void 0 : rows[Number(activeIndex)];
2828
3457
  if (!active || !row) return null;
2829
- const tooltipItems = [...row.readings.values()].filter((value) => !highlighted || highlighted.step !== row.index || value.population.id === highlighted.id).flatMap((value) => {
3458
+ const tooltipItems = [...row.readings.values()].filter((value) => (!interactiveLegend || legendFocus.visible(value.population.id)) && (!highlighted || highlighted.step !== row.index || value.population.id === highlighted.id)).flatMap((value) => {
2830
3459
  const item = value.population;
2831
3460
  return (highlighted?.step === row.index ? [highlighted.conversion] : [true, false]).map((conversion) => {
2832
3461
  const key = [item.id, conversion ? "conversion" : "drop-off"].join(KEY_SEPARATOR);
@@ -2943,7 +3572,8 @@ function createRetentionModel(series, unit, formatValue) {
2943
3572
  }
2944
3573
  /** Query-defined retention curves with count inspection and dotted incomplete periods.
2945
3574
  * Rates are not recomputed from counts. Compose inside VisualizationWidget. */
2946
- function RetentionChart({ series, unit, ariaLabel, className, formatValue = formatNumber, horizontalGrid = true }) {
3575
+ function RetentionChart({ series, unit, ariaLabel, className, formatValue = formatNumber, horizontalGrid = true, interactiveLegend = true }) {
3576
+ const legendFocus = useChartLegendFocus(series.map((item) => item.id));
2947
3577
  const { rows, rowsByOffset, cohorts } = createRetentionModel(series, unit, formatValue);
2948
3578
  return /* @__PURE__ */ jsx("section", {
2949
3579
  className: classNames("altertable-retention-chart", className),
@@ -2952,6 +3582,7 @@ function RetentionChart({ series, unit, ariaLabel, className, formatValue = form
2952
3582
  /* @__PURE__ */ jsxs(ComposedChart, {
2953
3583
  data: rows,
2954
3584
  ariaLabel: `${ariaLabel} plot`,
3585
+ horizontalGrid,
2955
3586
  children: [
2956
3587
  horizontalGrid && /* @__PURE__ */ jsx(ComposedChart.CartesianGrid, {}),
2957
3588
  /* @__PURE__ */ jsx(ComposedChart.XAxis, {
@@ -2970,11 +3601,15 @@ function RetentionChart({ series, unit, ariaLabel, className, formatValue = form
2970
3601
  dataKey: (row) => row.readings.get(item.id)?.completePercent ?? null,
2971
3602
  name: item.label,
2972
3603
  stroke: item.color,
3604
+ opacity: interactiveLegend ? legendFocus.opacity(item.id) : 1,
3605
+ style: { pointerEvents: interactiveLegend && !legendFocus.visible(item.id) ? "none" : void 0 },
2973
3606
  connectNulls: false
2974
3607
  }), /* @__PURE__ */ jsx(ComposedChart.Line, {
2975
3608
  dataKey: (row) => row.readings.get(item.id)?.incompletePercent ?? null,
2976
3609
  name: item.label,
2977
3610
  stroke: item.color,
3611
+ opacity: interactiveLegend ? legendFocus.opacity(item.id) : 1,
3612
+ style: { pointerEvents: interactiveLegend && !legendFocus.visible(item.id) ? "none" : void 0 },
2978
3613
  strokeDasharray: "3 3",
2979
3614
  dot: false,
2980
3615
  activeDot: false,
@@ -2990,7 +3625,7 @@ function RetentionChart({ series, unit, ariaLabel, className, formatValue = form
2990
3625
  role: "tooltip",
2991
3626
  children: [/* @__PURE__ */ jsx("strong", { children: row.label }), cohorts.map((item) => {
2992
3627
  const reading = row.readings.get(item.id);
2993
- if (!reading) return null;
3628
+ if (!reading || interactiveLegend && !legendFocus.visible(item.id)) return null;
2994
3629
  return /* @__PURE__ */ jsxs("span", { children: [
2995
3630
  item.label,
2996
3631
  ": ",
@@ -3004,10 +3639,29 @@ function RetentionChart({ series, unit, ariaLabel, className, formatValue = form
3004
3639
  }),
3005
3640
  /* @__PURE__ */ jsx(ChartLegend, {
3006
3641
  "aria-label": `${ariaLabel} cohorts`,
3007
- children: cohorts.map((item) => /* @__PURE__ */ jsxs(ChartLegend.Item, { children: [/* @__PURE__ */ jsx(ChartLegend.Marker, {
3008
- kind: "square",
3009
- color: item.color
3010
- }), /* @__PURE__ */ jsx(ChartLegend.Label, { children: item.label })] }, item.id))
3642
+ children: cohorts.map((item) => /* @__PURE__ */ jsx(ChartLegend.Item, {
3643
+ "data-legend-muted": interactiveLegend && legendFocus.hoveredId && (!legendFocus.focusedIds || legendFocus.focusedIds.has(legendFocus.hoveredId)) && legendFocus.hoveredId !== item.id || void 0,
3644
+ "data-legend-excluded": interactiveLegend && !legendFocus.visible(item.id) || void 0,
3645
+ children: interactiveLegend && cohorts.length > 1 ? /* @__PURE__ */ jsxs("button", {
3646
+ type: "button",
3647
+ "data-atbl-control": "action",
3648
+ "data-atbl-focus": "ring",
3649
+ className: "altertable-chart-legend-action",
3650
+ "aria-pressed": !!legendFocus.focusedIds?.has(item.id),
3651
+ onPointerEnter: () => legendFocus.setHoveredId(item.id),
3652
+ onPointerLeave: () => legendFocus.setHoveredId(null),
3653
+ onFocus: () => legendFocus.setHoveredId(item.id),
3654
+ onBlur: () => legendFocus.setHoveredId(null),
3655
+ onClick: () => legendFocus.toggle(item.id),
3656
+ children: [/* @__PURE__ */ jsx(ChartLegend.Marker, {
3657
+ kind: "square",
3658
+ color: item.color
3659
+ }), /* @__PURE__ */ jsx(ChartLegend.Label, { children: item.label })]
3660
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ChartLegend.Marker, {
3661
+ kind: "square",
3662
+ color: item.color
3663
+ }), /* @__PURE__ */ jsx(ChartLegend.Label, { children: item.label })] })
3664
+ }, item.id))
3011
3665
  }),
3012
3666
  /* @__PURE__ */ jsx("ul", {
3013
3667
  className: "altertable-sr-only",
@@ -3348,6 +4002,6 @@ const VisualizationWidget = withWidgetBoundary(VisualizationWidget$1);
3348
4002
  const TableWidget = withWidgetBoundary(TableWidget$1);
3349
4003
  const MetricWidget = withWidgetBoundary(MetricWidget$1);
3350
4004
  //#endregion
3351
- export { AboutData, AppIcon, AreaChart, BarChart, ChartLegend, Checkbox, CheckboxGroup, ChoicePicker, ComposedChart, DataApp, DataAppProvider, DataTable, DataTableEmptyRow, DataTableShare, DataTableTimestamp, DataValue, DataWidget, DateDisplay, DateTimeRangePicker, DimensionPicker, ExplorationActionControl, FilterActions, FilterBar, FunnelChart, GettingStarted, GlossaryDefinition, GlossaryExplanation, GradientScroll, HelpPopover, JourneyChart, LineChart, LiveControl, Menu, PressButton as MenuButton, MenuItem, MenuPopover, MenuSection, MenuSeparator, MenuTrigger, MetricWidget, NumberField, NumberFilterPicker, NumberRangeField, PieChart, PresentStory, Radio, RadioGroup, RetentionChart, ScatterChart, SearchField, SearchMatch, SearchTypeahead, SectionHeading, SegmentedControl, Select, Sheet, ShimmerText, Tab, TabList, TabPanel, TabPanels, TableWidget, Tabs, TextWidget, Tooltip, TooltipProvider, VariableBar, VisualizationWidget, dateTimeRangePresets, dateTimeRangeVariable, injectDataAppStyles, isPlainKeyEvent, matchSearchText, searchItems, useAppVariables, useChartCursorGroup, useDateFormatting, useSvgId, useViewTab };
4005
+ export { AboutData, AppIcon, AreaChart, BarChart, ChartLegend, Checkbox, CheckboxGroup, ChoicePicker, ComposedChart, ControlBar, DataApp, DataAppProvider, DataTable, DataTableEmptyRow, DataTableShare, DataTableTimestamp, DataValue, DataWidget, DateDisplay, DateTimeRangePicker, DimensionPicker, ExplorationActionControl, FilterActions, FilterBar, FunnelChart, GettingStarted, GlossaryDefinition, GlossaryExplanation, GradientScroll, HelpPopover, JourneyChart, LineChart, LiveControl, Menu, PressButton as MenuButton, MenuItem, MenuPopover, MenuSection, MenuSeparator, MenuTrigger, MetricWidget, Notice, NumberField, NumberFilterPicker, NumberRangeField, PieChart, PresentStory, Radio, RadioGroup, RetentionChart, ScatterChart, SearchField, SearchMatch, SearchTypeahead, SectionHeading, SegmentedControl, Select, Sheet, ShimmerText, Tab, TabList, TabPanel, TabPanels, TableWidget, Tabs, TextWidget, Tooltip, TooltipProvider, VisualizationWidget, dateTimeRangeFilter, dateTimeRangePresets, injectDataAppStyles, isPlainKeyEvent, matchSearchText, searchItems, useAppFilters, useChartCursorGroup, useDateFormatting, useSvgId, useViewTab };
3352
4006
 
3353
4007
  //# sourceMappingURL=index.js.map