gridsmith-ui 0.31.0 → 0.32.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 (66) hide show
  1. package/CHANGELOG.md +64 -1
  2. package/dist/charts.d.ts +101 -30
  3. package/dist/charts.js +181 -106
  4. package/dist/charts.js.map +1 -1
  5. package/dist/chat.js +6 -6
  6. package/dist/{chunk-OWQ7M6R7.js → chunk-2724SJO2.js} +141 -24
  7. package/dist/chunk-2724SJO2.js.map +1 -0
  8. package/dist/{chunk-BKYWKMUN.js → chunk-DO6DLTFK.js} +11 -9
  9. package/dist/chunk-DO6DLTFK.js.map +1 -0
  10. package/dist/{chunk-GP2COVJC.js → chunk-H732QL56.js} +4 -4
  11. package/dist/{chunk-GP2COVJC.js.map → chunk-H732QL56.js.map} +1 -1
  12. package/dist/{chunk-XSQD3UGY.js → chunk-HCEHTJ5E.js} +17 -4
  13. package/dist/chunk-HCEHTJ5E.js.map +1 -0
  14. package/dist/{chunk-YFHTREH5.js → chunk-HUVZQOU4.js} +5 -5
  15. package/dist/{chunk-YFHTREH5.js.map → chunk-HUVZQOU4.js.map} +1 -1
  16. package/dist/{chunk-EKWXPSTI.js → chunk-JHZ22HQP.js} +75 -24
  17. package/dist/chunk-JHZ22HQP.js.map +1 -0
  18. package/dist/{chunk-3J67NISC.js → chunk-NGZJK57C.js} +15 -11
  19. package/dist/chunk-NGZJK57C.js.map +1 -0
  20. package/dist/{chunk-U7WBI4AV.js → chunk-OVHM55JF.js} +5 -5
  21. package/dist/{chunk-U7WBI4AV.js.map → chunk-OVHM55JF.js.map} +1 -1
  22. package/dist/{chunk-OFACAHRV.js → chunk-QY2RA2HO.js} +5 -5
  23. package/dist/{chunk-OFACAHRV.js.map → chunk-QY2RA2HO.js.map} +1 -1
  24. package/dist/{chunk-HUNEJIKV.js → chunk-R2IAK3J3.js} +3 -3
  25. package/dist/{chunk-HUNEJIKV.js.map → chunk-R2IAK3J3.js.map} +1 -1
  26. package/dist/{chunk-V73LHNRL.js → chunk-RS624TD5.js} +29 -10
  27. package/dist/chunk-RS624TD5.js.map +1 -0
  28. package/dist/{chunk-V2ARGHJN.js → chunk-SIEU4H3H.js} +9 -9
  29. package/dist/chunk-SIEU4H3H.js.map +1 -0
  30. package/dist/{chunk-DBHVJ7Z3.js → chunk-SS3C24IJ.js} +3 -2
  31. package/dist/chunk-SS3C24IJ.js.map +1 -0
  32. package/dist/{chunk-LE72KHIE.js → chunk-TMPPBXX3.js} +3 -3
  33. package/dist/{chunk-LE72KHIE.js.map → chunk-TMPPBXX3.js.map} +1 -1
  34. package/dist/{chunk-GT6M74IZ.js → chunk-WSKPESAX.js} +12 -10
  35. package/dist/chunk-WSKPESAX.js.map +1 -0
  36. package/dist/{chunk-2Q4HOGEI.js → chunk-XBVZIN26.js} +15 -5
  37. package/dist/chunk-XBVZIN26.js.map +1 -0
  38. package/dist/data-grid.js +10 -10
  39. package/dist/data-grid.js.map +1 -1
  40. package/dist/editor-mentions.js +2 -2
  41. package/dist/editor.js +4 -3
  42. package/dist/editor.js.map +1 -1
  43. package/dist/index.d.ts +53 -6
  44. package/dist/index.js +557 -232
  45. package/dist/index.js.map +1 -1
  46. package/dist/kanban.js +10 -9
  47. package/dist/kanban.js.map +1 -1
  48. package/dist/resizable.d.ts +11 -2
  49. package/dist/resizable.js +97 -22
  50. package/dist/resizable.js.map +1 -1
  51. package/dist/roots.css +2 -2
  52. package/dist/tokens.css +6 -6
  53. package/dist/virtualized.js +10 -9
  54. package/dist/virtualized.js.map +1 -1
  55. package/dist-static/tokens.css +6 -6
  56. package/package.json +1 -1
  57. package/dist/chunk-2Q4HOGEI.js.map +0 -1
  58. package/dist/chunk-3J67NISC.js.map +0 -1
  59. package/dist/chunk-BKYWKMUN.js.map +0 -1
  60. package/dist/chunk-DBHVJ7Z3.js.map +0 -1
  61. package/dist/chunk-EKWXPSTI.js.map +0 -1
  62. package/dist/chunk-GT6M74IZ.js.map +0 -1
  63. package/dist/chunk-OWQ7M6R7.js.map +0 -1
  64. package/dist/chunk-V2ARGHJN.js.map +0 -1
  65. package/dist/chunk-V73LHNRL.js.map +0 -1
  66. package/dist/chunk-XSQD3UGY.js.map +0 -1
package/dist/charts.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import { SegmentedControl, TITLE_TEXT, Skeleton } from './chunk-U7WBI4AV.js';
3
- import { useKeyboardScroll } from './chunk-GP2COVJC.js';
2
+ import { SegmentedControl, TITLE_TEXT, Skeleton } from './chunk-OVHM55JF.js';
3
+ import { useKeyboardScroll } from './chunk-H732QL56.js';
4
4
  import { useFormatLocale, useHydrated } from './chunk-LJYSVZMI.js';
5
- import './chunk-BKYWKMUN.js';
5
+ import './chunk-DO6DLTFK.js';
6
6
  import { formatLocale } from './chunk-7QLXYRPD.js';
7
- import './chunk-7RKC5C7G.js';
8
7
  import { FormChangeCtx } from './chunk-72SDAX54.js';
9
- import { elementType } from './chunk-2Q4HOGEI.js';
10
- import './chunk-HUNEJIKV.js';
11
- import { mergeRefs } from './chunk-XSQD3UGY.js';
8
+ import { elementType } from './chunk-XBVZIN26.js';
9
+ import './chunk-7RKC5C7G.js';
10
+ import './chunk-R2IAK3J3.js';
11
+ import { mergeRefs } from './chunk-HCEHTJ5E.js';
12
12
  import { warnOnce } from './chunk-53F7GVBQ.js';
13
- import { cn, FOCUS_INSET, GLASS_SURFACE } from './chunk-OWQ7M6R7.js';
13
+ import { cn, FOCUS_INSET, GLASS_SURFACE } from './chunk-2724SJO2.js';
14
14
  import { createContext, forwardRef, useContext, useRef, useState, useId, useMemo, useLayoutEffect, useEffect, useCallback, useSyncExternalStore, Children, isValidElement } from 'react';
15
15
  import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Bar, LineChart as LineChart$1, Line, AreaChart as AreaChart$1, Area, PieChart as PieChart$1, Pie, Cell, ComposedChart, ScatterChart as ScatterChart$1, ZAxis, Scatter, Symbols, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, RadialBarChart as RadialBarChart$1, RadialBar, FunnelChart as FunnelChart$1, Funnel, LabelList, Treemap, Sankey, Text, Legend, ReferenceArea, ReferenceLine, getNiceTickValues, Rectangle, usePlotArea, ZIndexLayer, DefaultZIndexes } from 'recharts';
16
16
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -480,20 +480,26 @@ function percent(part, whole) {
480
480
  function referenceNote(r, format) {
481
481
  return isNumber(r.to) ? `${r.label}: ${format(r.value)} to ${format(r.to)}` : `${r.label}: ${format(r.value)}`;
482
482
  }
483
- var SUMMED = 3;
484
- function seriesSentence(label, points, over, f) {
483
+ var NAMED = 3;
484
+ var namesOrCount = (names, unit) => names.length <= NAMED ? listOf(names) : `${names.length} ${unit}`;
485
+ function leadSaid(points, over, f) {
485
486
  if (!points.length) return null;
486
- if (points.length === 1) return `${label}: ${f(points[0].value)} (${points[0].cat}).`;
487
+ if (points.length === 1) return `${f(points[0].value)} (${points[0].cat})`;
488
+ const same = (a, b) => f(a) === f(b);
487
489
  const high = points.reduce((a, b) => b.value > a.value ? b : a);
488
490
  const low = points.reduce((a, b) => b.value < a.value ? b : a);
489
- if (high.value === low.value) return over === "scale" ? `${label}: ${f(high.value)} throughout.` : `${label}: ${f(high.value)} for all ${points.length}.`;
490
- const extremes = `highest ${f(high.value)} (${high.cat}), lowest ${f(low.value)} (${low.cat})`;
491
- if (over === "names") return `${label}: ${extremes}.`;
491
+ if (same(high.value, low.value)) return over === "scale" ? `${f(high.value)} throughout` : `${f(high.value)} for each`;
492
+ const at = (v) => namesOrCount(points.filter((p) => same(p.value, v)).map((p) => p.cat), "categories");
493
+ if (over === "names") return `highest ${f(high.value)} (${at(high.value)}), lowest ${f(low.value)} (${at(low.value)})`;
492
494
  const first = points[0], end = points[points.length - 1];
493
495
  const steps = points.slice(1).map((p, i) => p.value - points[i].value);
494
496
  const up = steps.every((d) => d >= 0), down = steps.every((d) => d <= 0);
495
497
  const course = `${up ? "up from" : down ? "down from" : "from"} ${f(first.value)} (${first.cat}) to ${f(end.value)} (${end.cat})`;
496
- return up || down ? `${label}: ${course}.` : `${label}: ${course}, ${extremes}.`;
498
+ const top = Math.max(first.value, end.value), bottom = Math.min(first.value, end.value);
499
+ const above = same(high.value, top) ? 0 : high.value - top;
500
+ const below = same(low.value, bottom) ? 0 : bottom - low.value;
501
+ if (up || down || above <= 0 && below <= 0) return course;
502
+ return above >= below ? `${course}, highest ${f(high.value)} (${at(high.value)})` : `${course}, lowest ${f(low.value)} (${at(low.value)})`;
497
503
  }
498
504
  function cartesianAccess(o) {
499
505
  const { data, categoryKey, series, format } = o;
@@ -514,15 +520,26 @@ function cartesianAccess(o) {
514
520
  ...forecastNote ? [forecastNote] : []
515
521
  ];
516
522
  const names = series.map((s) => s.label);
523
+ const heading = o.valueHeading?.trim() ?? "";
524
+ const measure2 = series.length <= NAMED ? listOf(names) : (heading.match(/\p{L}/gu)?.length ?? 0) >= 3 ? heading : `${series.length} series`;
517
525
  const span = o.over === "scale" && cats.length > 1 ? ` from ${cats[0]} to ${cats[last]}` : cats.length === 1 ? ` for ${cats[0]}` : ` across ${cats.length} categories`;
518
- const sentences = [`${o.kind}: ${listOf(names)}${span}.`];
519
526
  const measured = forecastFrom > 0 ? forecastFrom : data.length;
520
- for (const s of series.slice(0, SUMMED)) {
521
- const points = data.slice(0, measured).map((row, i) => ({ cat: cats[i], value: numberOf(row[s.dataKey]) })).filter((p) => p.value !== null);
522
- const said = seriesSentence(s.label, points, o.over, (v) => format(v, s.dataKey));
523
- if (said) sentences.push(said);
524
- }
525
- if (series.length > SUMMED) sentences.push(`And ${series.length - SUMMED} more series.`);
527
+ const rowsMeasured = data.slice(0, measured);
528
+ const stack = o.totals === true ? series : o.totals ? series.filter((s) => o.totals.series.includes(s.dataKey)) : [];
529
+ const oneSign = rowsMeasured.every((row) => {
530
+ const values = stack.map((s) => numberOf(row[s.dataKey])).filter((v) => v !== null && v !== 0);
531
+ return values.every((v) => v > 0) || values.every((v) => v < 0);
532
+ });
533
+ const totals = stack.length > 1 && oneSign;
534
+ const lead = series.find((s) => rowsMeasured.some((row) => numberOf(row[s.dataKey]) !== null)) ?? series[0];
535
+ const points = !lead ? [] : rowsMeasured.map((row, i) => {
536
+ const values = (totals ? stack : [lead]).map((s) => numberOf(row[s.dataKey]));
537
+ return { cat: cats[i], value: values.every((v) => v === null) ? null : values.reduce((sum, v) => sum + (v ?? 0), 0) };
538
+ }).filter((p) => p.value !== null);
539
+ const said = lead ? leadSaid(points, o.over, (v) => format(v, totals ? void 0 : lead.dataKey)) : null;
540
+ const totalName = o.totals && o.totals !== true ? o.totals.name : "the total";
541
+ const leadName = series.length > 1 ? `${totals ? totalName : lead.label} ` : "";
542
+ const sentences = [`${o.kind} of ${measure2}${span}${said ? `: ${leadName}${said}` : ""}.`];
526
543
  for (const note of notes) sentences.push(`${note}.`);
527
544
  return {
528
545
  table: { columns: [o.categoryHeading || "Category", ...names], numeric: [false, ...series.map(() => true)], rows, notes },
@@ -563,7 +580,10 @@ function partsAccess(o) {
563
580
  const groups = new Set(items.map((p) => p.group)).size;
564
581
  if (grouped) description += ` in ${groups} ${groups === 1 ? "group" : "groups"}`;
565
582
  if (largest && smallest && items.length > 1) {
566
- description += o.kind === "radial" ? `: ${largest.name} the highest (${f(largest.value)}), ${smallest.name} the lowest (${f(smallest.value)}).` : `: ${largest.name} the largest (${f(largest.value)}, ${percent(largest.value, total)}), ${smallest.name} the smallest (${f(smallest.value)}, ${percent(smallest.value, total)}).`;
583
+ const alike = (v) => namesOrCount(items.filter((p) => f(p.value) === f(v)).map((p) => p.name), unit);
584
+ const ties = items.filter((p) => f(p.value) === f(largest.value)).length;
585
+ const share = (v) => o.kind === "radial" ? "" : ` (${percent(v, total)})`;
586
+ description += f(largest.value) === f(smallest.value) ? `: each ${f(largest.value)}${share(largest.value)}.` : o.kind === "radial" ? `: ${alike(largest.value)} the highest (${f(largest.value)}), ${alike(smallest.value)} the lowest (${f(smallest.value)}).` : ties > 1 ? `: ${alike(largest.value)} the largest, each ${f(largest.value)}${share(largest.value)}.` : `: ${largest.name} the largest (${f(largest.value)}, ${percent(largest.value, total)}).`;
567
587
  } else {
568
588
  description += ".";
569
589
  }
@@ -575,18 +595,14 @@ function partsAccess(o) {
575
595
  function pointsAccess(o) {
576
596
  const withZ = !!o.zHeading && o.series.some((s) => s.points.some((p) => numberOf(p.z) !== null));
577
597
  const rows = [];
578
- const xs = [];
579
- const ys = [];
580
598
  for (const s of o.series) {
581
599
  for (const p of s.points) {
582
600
  const x = numberOf(p.x), y = numberOf(p.y), z = numberOf(p.z);
583
601
  if (x === null || y === null) continue;
584
- xs.push(x);
585
- ys.push(y);
586
602
  rows.push([s.name, o.formatX(x), o.formatY(y), ...withZ ? [z !== null ? String(z) : "\u2013"] : []]);
587
603
  }
588
604
  }
589
- const range = (vs, fmt) => vs.length ? `from ${fmt(Math.min(...vs))} to ${fmt(Math.max(...vs))}` : "";
605
+ const inSeries = o.series.length > 1 ? ` in ${o.series.length} series` : "";
590
606
  return {
591
607
  table: {
592
608
  columns: ["Series", o.xHeading, o.yHeading, ...withZ ? [o.zHeading] : []],
@@ -594,7 +610,7 @@ function pointsAccess(o) {
594
610
  rows,
595
611
  notes: []
596
612
  },
597
- description: `Scatter chart of ${rows.length} ${rows.length === 1 ? "point" : "points"} in ${o.series.length} ${o.series.length === 1 ? "series" : "series"}${xs.length ? `: ${o.xHeading} ${range(xs, o.formatX)}, ${o.yHeading} ${range(ys, o.formatY)}` : ""}.`
613
+ description: `Scatter chart of ${o.yHeading} against ${o.xHeading}: ${rows.length} ${rows.length === 1 ? "point" : "points"}${inSeries}.`
598
614
  };
599
615
  }
600
616
  function flowAccess(o) {
@@ -653,15 +669,24 @@ function PlotNames({ children }) {
653
669
  const value = useMemo(() => ({ place, moves }), [place, moves]);
654
670
  return /* @__PURE__ */ jsx(PlotNamesContext.Provider, { value, children });
655
671
  }
672
+ var SEGMENT_GAP = 2;
656
673
  function markOf(index, marks) {
657
674
  return (index + Math.floor(index / CHART_COLOR_COUNT)) % marks;
658
675
  }
676
+ function repeatMark(index, marks) {
677
+ const round = Math.floor(index / CHART_COLOR_COUNT);
678
+ return round === 0 ? 0 : 1 + (round - 1) % (marks - 1);
679
+ }
680
+ function markFor(index, count, marks, patterns2) {
681
+ if (count < 2) return 0;
682
+ return patterns2 ? markOf(index, marks) : repeatMark(index, marks);
683
+ }
659
684
  var DASHES = [void 0, "6 3", "2 3", "8 3 2 3", "12 3 3 3", "1 4"];
660
- function seriesDash(index, count) {
661
- return count >= 2 ? DASHES[markOf(index, DASHES.length)] : void 0;
685
+ function seriesDash(index, count, patterns2 = false) {
686
+ return DASHES[markFor(index, count, DASHES.length, patterns2)];
662
687
  }
663
- function lineDashes(lines) {
664
- const marks = lines.map((line, i) => lines.length >= 2 ? markOf(i, DASHES.length) : line.dashed ? 1 : 0);
688
+ function lineDashes(lines, patterns2 = false) {
689
+ const marks = lines.map((line, i) => lines.length >= 2 ? markFor(i, lines.length, DASHES.length, patterns2) : line.dashed ? 1 : 0);
665
690
  const colour = (i) => i % CHART_COLOR_COUNT;
666
691
  const inColour = (i, k, ...but) => marks.some((m, j) => m === k && colour(j) === colour(i) && j !== i && !but.includes(j));
667
692
  lines.forEach((line, i) => {
@@ -686,12 +711,12 @@ function seriesSymbol(index, count) {
686
711
  return count >= 2 ? SYMBOLS[index % SYMBOLS.length] : "circle";
687
712
  }
688
713
  var PATTERNS = 5;
689
- function seriesPatternKind(index, count) {
690
- const mark = markOf(index, PATTERNS + 1);
691
- return count < 2 || mark === 0 ? void 0 : mark - 1;
714
+ function seriesPatternKind(index, count, patterns2 = false) {
715
+ const mark = markFor(index, count, PATTERNS + 1, patterns2);
716
+ return mark === 0 ? void 0 : mark - 1;
692
717
  }
693
- function seriesPattern(chartId, index, count) {
694
- if (seriesPatternKind(index, count) === void 0) return void 0;
718
+ function seriesPattern(chartId, index, count, patterns2 = false) {
719
+ if (seriesPatternKind(index, count, patterns2) === void 0) return void 0;
695
720
  return `${chartId.replace(/[^a-zA-Z0-9_-]/g, "")}-series-${index}`;
696
721
  }
697
722
  var aheadPattern = (id) => `${id}-ahead`;
@@ -786,13 +811,13 @@ function Pattern({ id, kind, fill, on }) {
786
811
  kind === 4 && /* @__PURE__ */ jsx("path", { d: "M3,0 v6", ...mark })
787
812
  ] });
788
813
  }
789
- function SeriesPatterns({ chartId, colors, surface, ahead = false }) {
814
+ function SeriesPatterns({ chartId, colors, surface, ahead = false, patterns: patterns2 = false }) {
790
815
  const ink = useResolvedToken("--ds-text-primary");
791
816
  const canvas = useResolvedToken("--ds-bg-canvas");
792
- if (colors.length < 2) return null;
817
+ if (!colors.some((_, i) => seriesPattern(chartId, i, colors.length, patterns2))) return null;
793
818
  return /* @__PURE__ */ jsx("defs", { children: colors.map((color, i) => {
794
- const id = seriesPattern(chartId, i, colors.length);
795
- const kind = seriesPatternKind(i, colors.length);
819
+ const id = seriesPattern(chartId, i, colors.length, patterns2);
820
+ const kind = seriesPatternKind(i, colors.length, patterns2);
796
821
  if (!id || kind === void 0) return null;
797
822
  const faint = ahead ? aheadFill(color, surface, canvas) : null;
798
823
  return [
@@ -830,7 +855,9 @@ function PlotName({ x = 0, y = 0, viewBox, value, id, order, place, ink }) {
830
855
  const line = { across: viewBox?.height === 0 && (viewBox?.width ?? 0) > 0, up: viewBox?.width === 0 && (viewBox?.height ?? 0) > 0 };
831
856
  const top = place !== "insideBottomRight";
832
857
  const flip = !!size && !!plot && (line.across && top && y + size.height > plot.y + plot.height + 0.5 || line.up && x - size.width < plot.x - 0.5);
833
- const placed = flip && line.across ? { x, y: (viewBox?.y ?? 0) - OFFSET, top: false, start: false } : flip && line.up ? { x: (viewBox?.x ?? 0) + OFFSET, y, top: false, start: true } : { x, y, top, start: place === "insideTopLeft" };
858
+ const band = (viewBox?.width ?? 0) > 0 && (viewBox?.height ?? 0) > 0;
859
+ const beside = band && !!size && (place === "insideTopRight" ? size.width + 2 * OFFSET > (viewBox?.width ?? 0) : place === "insideBottomRight" ? size.height + 2 * OFFSET > (viewBox?.height ?? 0) : false);
860
+ const placed = flip && line.across ? { x, y: (viewBox?.y ?? 0) - OFFSET, top: false, start: false } : flip && line.up ? { x: (viewBox?.x ?? 0) + OFFSET, y, top: false, start: true } : beside && place === "insideTopRight" ? { x: (viewBox?.x ?? 0) - OFFSET, y, top, start: false } : beside ? { x, y: (viewBox?.y ?? 0) - OFFSET, top: false, start: false } : { x, y, top, start: place === "insideTopLeft" };
834
861
  const inside = (from, length, edge, span) => from < edge ? edge - from : from + length > edge + span ? Math.max(edge - from, edge + span - (from + length)) : 0;
835
862
  const at = size && plot ? {
836
863
  ...placed,
@@ -1060,7 +1087,8 @@ var ChartWrapper = forwardRef(function ChartWrapper2({
1060
1087
  const rootRef = useRef(null);
1061
1088
  const [plotEl, setPlotEl] = useState(null);
1062
1089
  const [view, setView] = useState("chart");
1063
- const descriptionId = useId();
1090
+ const subtitleId = useId();
1091
+ const summaryId = useId();
1064
1092
  const [legend, setLegend] = useState(null);
1065
1093
  const [live, setLive] = useState(null);
1066
1094
  const frame = useMemo(() => ({ legend, live, formatValue, marks }), [legend, live, formatValue, marks]);
@@ -1079,8 +1107,10 @@ var ChartWrapper = forwardRef(function ChartWrapper2({
1079
1107
  const fill = container?.fillArea === true;
1080
1108
  const fixed = container?.height ?? fixedChartHeight(height);
1081
1109
  const plotStyle = fill ? { flex: "1 1 0%", minHeight: 0 } : plotBoxStyle(size, fixed);
1082
- const sentence = description?.trim() ? description : access?.description;
1083
- const describedBy = sentence ? { "aria-describedby": descriptionId } : {};
1110
+ const subtitle = description?.trim() || void 0;
1111
+ const summary = access?.description;
1112
+ const describers = [subtitle && subtitleId, summary && summaryId].filter(Boolean).join(" ");
1113
+ const describedBy = describers ? { "aria-describedby": describers } : {};
1084
1114
  const named = ariaLabel ? { role: "img", "aria-label": ariaLabel, ...describedBy } : container?.titleId ? { role: "img", "aria-labelledby": container.titleId, ...describedBy } : {};
1085
1115
  useEffect(() => {
1086
1116
  const root = rootRef.current;
@@ -1112,8 +1142,10 @@ var ChartWrapper = forwardRef(function ChartWrapper2({
1112
1142
  }
1113
1143
  ) }) : null;
1114
1144
  const actions = container?.actions && container.charts === 1 ? container.actions : null;
1115
- const sentenceShown = !fill || view === "table";
1116
- const sentenceLine = sentence ? /* @__PURE__ */ jsx("p", { id: descriptionId, "data-chart-description": "", className: sentenceShown ? "min-w-0 text-sm text-[var(--ds-text-secondary)]" : "sr-only", children: sentence }) : null;
1145
+ const sentenceShown = view === "table";
1146
+ const subtitleLine = subtitle ? /* @__PURE__ */ jsx("p", { id: subtitleId, "data-chart-subtitle": "", className: "min-w-0 text-sm text-[var(--ds-text-secondary)]", children: subtitle }) : null;
1147
+ const summaryLine = summary ? /* @__PURE__ */ jsx("p", { id: summaryId, "data-chart-description": "", className: sentenceShown ? "min-w-0 text-sm text-[var(--ds-text-secondary)]" : "sr-only", children: summary }) : null;
1148
+ const headText = subtitleLine || sentenceShown && summaryLine;
1117
1149
  return /* @__PURE__ */ jsxs(
1118
1150
  "div",
1119
1151
  {
@@ -1124,11 +1156,14 @@ var ChartWrapper = forwardRef(function ChartWrapper2({
1124
1156
  className: cn("relative flex w-full flex-col", fill && "h-full", className),
1125
1157
  style: { containerType: "inline-size", minInlineSize: "min(100%, 16rem)", ...fill ? {} : { flex: "1 0 auto" } },
1126
1158
  children: [
1127
- (sentenceLine && sentenceShown || switcher && !actions) && /* @__PURE__ */ jsxs("div", { "data-chart-head": "", className: "mb-ds-3 flex items-start justify-between gap-ds-3", children: [
1128
- sentenceShown && sentenceLine,
1159
+ (headText || switcher && !actions) && /* @__PURE__ */ jsxs("div", { "data-chart-head": "", className: "mb-ds-3 flex items-start justify-between gap-ds-3", children: [
1160
+ headText && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-ds-1", children: [
1161
+ subtitleLine,
1162
+ sentenceShown && summaryLine
1163
+ ] }),
1129
1164
  !actions && switcher && /* @__PURE__ */ jsx("div", { className: "ml-auto shrink-0", children: switcher })
1130
1165
  ] }),
1131
- !sentenceShown && sentenceLine,
1166
+ !sentenceShown && summaryLine,
1132
1167
  actions && switcher && createPortal(switcher, actions),
1133
1168
  view === "chart" || !access ? /* @__PURE__ */ jsxs(
1134
1169
  "div",
@@ -1430,21 +1465,36 @@ function anyStack(bars, stacked) {
1430
1465
  function barGroups(bars, stacked) {
1431
1466
  return Math.max(1, new Set(bars.map((bar, i) => barStackOf(bar, stacked) ?? `\0${i}`)).size);
1432
1467
  }
1468
+ function insetEnd(box, sideways, gap) {
1469
+ const size = Number(sideways ? box.width : box.height) || 0;
1470
+ const by = Math.sign(size) * Math.min(gap, Math.max(0, Math.abs(size) - 1));
1471
+ return sideways ? { width: size - by } : { y: (Number(box.y) || 0) + by, height: size - by };
1472
+ }
1473
+ function insetStart(box, sideways, gap) {
1474
+ const size = Number(sideways ? box.width : box.height) || 0;
1475
+ const by = Math.sign(size) * Math.min(gap, Math.max(0, Math.abs(size) - 1));
1476
+ return sideways ? { x: (Number(box.x) || 0) + by, width: size - by } : { height: size - by };
1477
+ }
1478
+ var edgeWidth = (stroke, width) => typeof stroke === "string" && stroke !== "" && stroke !== "none" ? Number(width) || 1 : 0;
1433
1479
  function barShape(bars, index, stacked, radius, horizontal = false, forecast) {
1434
1480
  const round = horizontal ? [0, radius, radius, 0] : [radius, radius, 0, 0];
1435
1481
  const square = [0, 0, 0, 0];
1436
1482
  const stack = barStackOf(bars[index], stacked);
1437
1483
  const above = stack == null ? [] : bars.filter((b, j) => j > index && barStackOf(b, stacked) === stack);
1484
+ const below = stack == null ? [] : bars.filter((b, j) => j < index && barStackOf(b, stacked) === stack);
1438
1485
  const Shape = (props) => {
1439
1486
  const p = props;
1440
1487
  const row = p.payload ?? {};
1441
- const down = Number(row[bars[index].dataKey]) < 0;
1442
- const onTop = above.every((b) => {
1443
- const value = Number(row[b.dataKey]);
1444
- return !(down ? value < 0 : value > 0);
1445
- });
1446
- const ahead = forecast && forecast.from >= 0 && (p.index ?? -1) >= forecast.from ? { ...forecast.fill ? { fill: forecast.fill } : { fillOpacity: AHEAD_STRENGTH }, stroke: forecast.edge, strokeWidth: 1.5, strokeDasharray: "3 2" } : {};
1447
- return /* @__PURE__ */ jsx(Rectangle, { ...withoutRowFields(props), ...ahead, radius: onTop ? round : square });
1488
+ const valueOf = (b) => Number(row[b.dataKey]);
1489
+ const down = valueOf(bars[index]) < 0;
1490
+ const onTop = above.every((b) => !(down ? valueOf(b) < 0 : valueOf(b) > 0));
1491
+ const meetsZero = down && below.every((b) => !(valueOf(b) < 0)) && [...below, ...above].some((b) => valueOf(b) > 0);
1492
+ const at = p.originalDataIndex ?? p.index ?? -1;
1493
+ const ahead = forecast && forecast.from >= 0 && at >= forecast.from ? { ...forecast.fill ? { fill: forecast.fill } : { fillOpacity: AHEAD_STRENGTH }, stroke: forecast.edge, strokeWidth: 1.5, strokeDasharray: "3 2" } : void 0;
1494
+ const gap = SEGMENT_GAP + (ahead ? ahead.strokeWidth : edgeWidth(p.stroke, p.strokeWidth));
1495
+ const far = onTop ? { ...p } : { ...p, ...insetEnd(p, horizontal, gap) };
1496
+ const inset = { ...onTop ? {} : insetEnd(p, horizontal, gap), ...meetsZero ? insetStart(far, horizontal, gap) : {} };
1497
+ return /* @__PURE__ */ jsx(Rectangle, { ...withoutRowFields(props), ...ahead, ...inset, radius: onTop ? round : square });
1448
1498
  };
1449
1499
  return Shape;
1450
1500
  }
@@ -1474,7 +1524,8 @@ var BarChart = markChart(forwardRef(function BarChart2({
1474
1524
  description,
1475
1525
  references,
1476
1526
  forecastFrom,
1477
- forecastLabel = "Forecast"
1527
+ forecastLabel = "Forecast",
1528
+ patterns: patterns2 = false
1478
1529
  }, ref) {
1479
1530
  const wrapperRef = useRef(null);
1480
1531
  const chartId = useId();
@@ -1524,14 +1575,14 @@ var BarChart = markChart(forwardRef(function BarChart2({
1524
1575
  const canvas = useResolvedToken("--ds-bg-canvas");
1525
1576
  const ink = useResolvedToken("--ds-text-secondary");
1526
1577
  const fills = bars.map((bar, i) => bar.soft ? softColors[i] : solidColors[i]);
1527
- const patterns2 = bars.map((_, i) => seriesPattern(chartId, i, bars.length));
1578
+ const fillPatterns = bars.map((_, i) => seriesPattern(chartId, i, bars.length, patterns2));
1528
1579
  const aheadBarFill = (fill, pattern) => {
1529
1580
  const faint = aheadFill(fill, surface, canvas);
1530
1581
  return faint && pattern ? `url(#${aheadPattern(pattern)})` : faint;
1531
1582
  };
1532
1583
  const marks = useMemo(
1533
- () => Object.fromEntries(bars.map((bar, i) => [bar.dataKey, { kind: "fill", color: bar.soft ? softColors[i] : solidColors[i], edge: solidColors[i], pattern: seriesPattern(chartId, i, bars.length) }])),
1534
- [bars, softColors, solidColors, chartId]
1584
+ () => Object.fromEntries(bars.map((bar, i) => [bar.dataKey, { kind: "fill", color: bar.soft ? softColors[i] : solidColors[i], edge: solidColors[i], pattern: seriesPattern(chartId, i, bars.length, patterns2) }])),
1585
+ [bars, softColors, solidColors, chartId, patterns2]
1535
1586
  );
1536
1587
  const forecastAt = forecastIndex(data ?? [], xAxisKey, forecastFrom);
1537
1588
  const access = useMemo(() => cartesianAccess({
@@ -1539,12 +1590,14 @@ var BarChart = markChart(forwardRef(function BarChart2({
1539
1590
  data: data ?? [],
1540
1591
  categoryKey: xAxisKey,
1541
1592
  categoryHeading: categoryTitle,
1593
+ valueHeading: valueTitle,
1542
1594
  series: bars.map((b) => ({ dataKey: b.dataKey, label: b.label ?? b.dataKey })),
1543
1595
  format: fullFormat,
1544
1596
  over: names ? "names" : "scale",
1597
+ totals: anyStack(bars, stacked) && barGroups(bars, stacked) === 1,
1545
1598
  references,
1546
1599
  forecast: forecastAt >= 0 ? { from: forecastAt, label: forecastLabel } : void 0
1547
- }), [data, xAxisKey, categoryTitle, bars, fullFormat, names, references, forecastAt, forecastLabel]);
1600
+ }), [data, xAxisKey, categoryTitle, valueTitle, bars, stacked, fullFormat, names, references, forecastAt, forecastLabel]);
1548
1601
  if (!data?.length) return null;
1549
1602
  return /* @__PURE__ */ jsx(
1550
1603
  ChartWrapper,
@@ -1573,7 +1626,7 @@ var BarChart = markChart(forwardRef(function BarChart2({
1573
1626
  margin: { top: 4 + (topTitle ? titleLine(measured.px) : 0), right: sideways || names ? 4 : xTicks.endMargin, bottom: 4, left: 4 },
1574
1627
  accessibilityLayer: true,
1575
1628
  children: [
1576
- /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: fills, surface, ahead: forecastAt >= 0 }),
1629
+ /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: fills, surface, ahead: forecastAt >= 0, patterns: patterns2 }),
1577
1630
  showGrid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: gridStroke, vertical: !sideways, horizontal: true }),
1578
1631
  sideways ? /* @__PURE__ */ jsxs(Fragment, { children: [
1579
1632
  /* @__PURE__ */ jsx(XAxis, { type: "number", ...axisStyle.tick, axisLine: false, tickLine: false, height: "auto", label: bottomLabel, tickFormatter: tickFormat }),
@@ -1617,10 +1670,10 @@ var BarChart = markChart(forwardRef(function BarChart2({
1617
1670
  {
1618
1671
  dataKey: bar.dataKey,
1619
1672
  name: bar.label ?? bar.dataKey,
1620
- fill: patterns2[i] ? `url(#${patterns2[i]})` : fills[i],
1673
+ fill: fillPatterns[i] ? `url(#${fillPatterns[i]})` : fills[i],
1621
1674
  stroke: bar.soft ? solidColors[i] : void 0,
1622
1675
  strokeWidth: bar.soft ? 1 : void 0,
1623
- shape: barShape(bars, i, stacked, radius, sideways, forecastAt >= 0 ? { from: forecastAt, edge: solidColors[i], fill: aheadBarFill(fills[i], patterns2[i]) } : void 0),
1676
+ shape: barShape(bars, i, stacked, radius, sideways, forecastAt >= 0 ? { from: forecastAt, edge: solidColors[i], fill: aheadBarFill(fills[i], fillPatterns[i]) } : void 0),
1624
1677
  stackId: barStackOf(bar, stacked),
1625
1678
  maxBarSize,
1626
1679
  isAnimationActive: isAnimated
@@ -1653,7 +1706,8 @@ var LineChart = markChart(forwardRef(function LineChart2({
1653
1706
  description,
1654
1707
  references,
1655
1708
  forecastFrom,
1656
- forecastLabel = "Forecast"
1709
+ forecastLabel = "Forecast",
1710
+ patterns: patterns2 = false
1657
1711
  }, ref) {
1658
1712
  const wrapperRef = useRef(null);
1659
1713
  const values = useMemo(() => [...seriesValues(data ?? [], lines.map((s) => s.dataKey), false), ...referenceValues(references)], [data, lines, references]);
@@ -1670,7 +1724,7 @@ var LineChart = markChart(forwardRef(function LineChart2({
1670
1724
  const axisLabelStyle = { fontSize: "var(--ds-font-size-xs)", fontFamily: "var(--ds-font-sans)", fill: axisStyle.tick.fill };
1671
1725
  const top = 4 + (yAxisLabel ? Math.ceil(measured.px * 1.5) + 4 : 0);
1672
1726
  const ink = useResolvedToken("--ds-text-secondary");
1673
- const dashes = useMemo(() => lineDashes(lines), [lines]);
1727
+ const dashes = useMemo(() => lineDashes(lines, patterns2), [lines, patterns2]);
1674
1728
  const marks = useMemo(
1675
1729
  () => Object.fromEntries(lines.map((l, i) => [l.dataKey, { kind: "line", color: colors[i], dash: dashes[i] }])),
1676
1730
  [lines, colors, dashes]
@@ -1682,12 +1736,13 @@ var LineChart = markChart(forwardRef(function LineChart2({
1682
1736
  data: data ?? [],
1683
1737
  categoryKey: xAxisKey,
1684
1738
  categoryHeading: xAxisLabel,
1739
+ valueHeading: yAxisLabel,
1685
1740
  series: lines.map((l) => ({ dataKey: l.dataKey, label: l.label ?? l.dataKey })),
1686
1741
  format: fullFormat,
1687
1742
  over: "scale",
1688
1743
  references,
1689
1744
  forecast: forecastAt >= 0 ? { from: forecastAt, label: forecastLabel } : void 0
1690
- }), [data, xAxisKey, xAxisLabel, lines, fullFormat, references, forecastAt, forecastLabel]);
1745
+ }), [data, xAxisKey, xAxisLabel, yAxisLabel, lines, fullFormat, references, forecastAt, forecastLabel]);
1691
1746
  if (!data?.length) return null;
1692
1747
  return /* @__PURE__ */ jsx(
1693
1748
  ChartWrapper,
@@ -1768,7 +1823,8 @@ var AreaChart = markChart(forwardRef(function AreaChart2({
1768
1823
  description,
1769
1824
  references,
1770
1825
  forecastFrom,
1771
- forecastLabel = "Forecast"
1826
+ forecastLabel = "Forecast",
1827
+ patterns: patterns2 = false
1772
1828
  }, ref) {
1773
1829
  const wrapperRef = useRef(null);
1774
1830
  const values = useMemo(() => [...seriesValues(data ?? [], areas.map((s) => s.dataKey), stacked), ...referenceValues(references)], [data, areas, stacked, references]);
@@ -1787,10 +1843,10 @@ var AreaChart = markChart(forwardRef(function AreaChart2({
1787
1843
  const axisLabelStyle = { fontSize: "var(--ds-font-size-xs)", fontFamily: "var(--ds-font-sans)", fill: axisStyle.tick.fill };
1788
1844
  const top = 4 + (yAxisLabel ? Math.ceil(measured.px * 1.5) + 4 : 0);
1789
1845
  const ink = useResolvedToken("--ds-text-secondary");
1790
- const dashes = areas.map((_, i) => seriesDash(i, areas.length));
1846
+ const dashes = areas.map((_, i) => seriesDash(i, areas.length, patterns2));
1791
1847
  const marks = useMemo(
1792
- () => Object.fromEntries(areas.map((a, i) => [a.dataKey, { kind: "line", color: solidColors[i], dash: seriesDash(i, areas.length) }])),
1793
- [areas, solidColors]
1848
+ () => Object.fromEntries(areas.map((a, i) => [a.dataKey, { kind: "line", color: solidColors[i], dash: seriesDash(i, areas.length, patterns2) }])),
1849
+ [areas, solidColors, patterns2]
1794
1850
  );
1795
1851
  const forecastAt = forecastIndex(data ?? [], xAxisKey, forecastFrom);
1796
1852
  const hatch = forecastHatchId(instanceId);
@@ -1799,12 +1855,14 @@ var AreaChart = markChart(forwardRef(function AreaChart2({
1799
1855
  data: data ?? [],
1800
1856
  categoryKey: xAxisKey,
1801
1857
  categoryHeading: xAxisLabel,
1858
+ valueHeading: yAxisLabel,
1802
1859
  series: areas.map((a) => ({ dataKey: a.dataKey, label: a.label ?? a.dataKey })),
1803
1860
  format: fullFormat,
1804
1861
  over: "scale",
1862
+ totals: stacked,
1805
1863
  references,
1806
1864
  forecast: forecastAt >= 0 ? { from: forecastAt, label: forecastLabel } : void 0
1807
- }), [data, xAxisKey, xAxisLabel, areas, fullFormat, references, forecastAt, forecastLabel]);
1865
+ }), [data, xAxisKey, xAxisLabel, yAxisLabel, areas, stacked, fullFormat, references, forecastAt, forecastLabel]);
1808
1866
  if (!data?.length) return null;
1809
1867
  return /* @__PURE__ */ jsx(
1810
1868
  ChartWrapper,
@@ -1878,25 +1936,29 @@ var PieChart = markChart(forwardRef(function PieChart2({
1878
1936
  animated,
1879
1937
  "aria-label": ariaLabel,
1880
1938
  className,
1881
- description
1939
+ description,
1940
+ patterns: patterns2 = false
1882
1941
  }, ref) {
1883
1942
  const colors = useChartColors(data.length, false);
1884
1943
  const chartId = useId();
1885
1944
  const surface = useResolvedToken("--ds-bg-surface");
1945
+ const canvas = useResolvedToken("--ds-bg-canvas");
1946
+ const ground = useMemo(() => groundColour(surface, canvas), [surface, canvas]);
1886
1947
  const locale = useFormatLocale();
1887
1948
  const format = useMemo(() => fullValueFormatter(void 0, locale), [locale]);
1888
1949
  const isAnimated = useChartAnimation(animated);
1889
1950
  const renderLabel = showLabels ? ({ percent: percent2 }) => `${((percent2 ?? 0) * 100).toFixed(0)}%` : false;
1890
1951
  const chartData = data.map((d) => ({ name: d.name, value: numberOf(d.value) ?? 0 }));
1952
+ const single = chartData.filter((d) => d.value > 0).length <= 1;
1891
1953
  const fills = data.map((_, i) => colors[i % colors.length]);
1892
1954
  const marks = useMemo(
1893
- () => Object.fromEntries(data.map((d, i) => [d.name, { kind: "fill", color: colors[i % colors.length], pattern: seriesPattern(chartId, i, data.length) }])),
1894
- [data, colors, chartId]
1955
+ () => Object.fromEntries(data.map((d, i) => [d.name, { kind: "fill", color: colors[i % colors.length], pattern: seriesPattern(chartId, i, data.length, patterns2) }])),
1956
+ [data, colors, chartId, patterns2]
1895
1957
  );
1896
1958
  const access = useMemo(() => partsAccess({ kind: "pie", items: data.map((d) => ({ name: d.name, value: d.value })), format }), [data, format]);
1897
1959
  if (!data?.length) return null;
1898
1960
  return /* @__PURE__ */ jsx(ChartWrapper, { ref, height, size: { model: "square" }, chart: "pie", className, "aria-label": ariaLabel, access, description, marks, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart$1, { accessibilityLayer: true, children: [
1899
- /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: fills, surface }),
1961
+ /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: fills, surface, patterns: patterns2 }),
1900
1962
  /* @__PURE__ */ jsx(
1901
1963
  Pie,
1902
1964
  {
@@ -1908,12 +1970,14 @@ var PieChart = markChart(forwardRef(function PieChart2({
1908
1970
  outerRadius: "75%",
1909
1971
  innerRadius: donut ? "55%" : 0,
1910
1972
  label: renderLabel,
1911
- labelLine: showLabels,
1973
+ labelLine: showLabels ? { strokeWidth: 1 } : false,
1912
1974
  isAnimationActive: isAnimated,
1975
+ stroke: single ? "none" : ground,
1976
+ strokeWidth: single ? 0 : SEGMENT_GAP,
1913
1977
  fontSize: "var(--ds-font-size-xs)",
1914
1978
  fontFamily: "var(--ds-font-sans)",
1915
1979
  children: data.map((_, i) => {
1916
- const pattern = seriesPattern(chartId, i, data.length);
1980
+ const pattern = seriesPattern(chartId, i, data.length, patterns2);
1917
1981
  return /* @__PURE__ */ jsx(Cell, { fill: pattern ? `url(#${pattern})` : fills[i] }, i);
1918
1982
  })
1919
1983
  }
@@ -1946,7 +2010,8 @@ var CompositeChart = markChart(forwardRef(function CompositeChart2({
1946
2010
  description,
1947
2011
  references,
1948
2012
  forecastFrom,
1949
- forecastLabel = "Forecast"
2013
+ forecastLabel = "Forecast",
2014
+ patterns: patterns2 = false
1950
2015
  }, ref) {
1951
2016
  const wrapperRef = useRef(null);
1952
2017
  const chartId = useId();
@@ -2011,28 +2076,31 @@ var CompositeChart = markChart(forwardRef(function CompositeChart2({
2011
2076
  const surface = useResolvedToken("--ds-bg-surface");
2012
2077
  const canvas = useResolvedToken("--ds-bg-canvas");
2013
2078
  const ink = useResolvedToken("--ds-text-secondary");
2014
- const patterns2 = bars.map((_, i) => seriesPattern(chartId, i, bars.length));
2079
+ const fillPatterns = bars.map((_, i) => seriesPattern(chartId, i, bars.length, patterns2));
2015
2080
  const aheadBarFill = (fill, pattern) => {
2016
2081
  const faint = aheadFill(fill, surface, canvas);
2017
2082
  return faint && pattern ? `url(#${aheadPattern(pattern)})` : faint;
2018
2083
  };
2019
- const dashes = useMemo(() => lineDashes(lines), [lines]);
2084
+ const dashes = useMemo(() => lineDashes(lines, patterns2), [lines, patterns2]);
2020
2085
  const marks = useMemo(() => Object.fromEntries([
2021
- ...bars.map((bar, i) => [bar.dataKey, { kind: "fill", color: barSoftColors[i], edge: barSolidColors[i], pattern: seriesPattern(chartId, i, bars.length) }]),
2086
+ ...bars.map((bar, i) => [bar.dataKey, { kind: "fill", color: barSoftColors[i], edge: barSolidColors[i], pattern: seriesPattern(chartId, i, bars.length, patterns2) }]),
2022
2087
  ...lines.map((line, i) => [line.dataKey, { kind: "line", color: lineColors[i], dash: dashes[i] }])
2023
- ]), [bars, lines, barSoftColors, barSolidColors, lineColors, chartId, dashes]);
2088
+ ]), [bars, lines, barSoftColors, barSolidColors, lineColors, chartId, dashes, patterns2]);
2024
2089
  const forecastAt = forecastIndex(data ?? [], xAxisKey, forecastFrom);
2025
2090
  const access = useMemo(() => cartesianAccess({
2026
2091
  kind: "Bar and line chart",
2027
2092
  data: data ?? [],
2028
2093
  categoryKey: xAxisKey,
2029
2094
  categoryHeading: xAxisLabel,
2095
+ valueHeading: yAxisLabel,
2030
2096
  series: [...bars, ...lines].map((s) => ({ dataKey: s.dataKey, label: s.label ?? s.dataKey })),
2031
2097
  format: fullFormat,
2032
2098
  over: names ? "names" : "scale",
2099
+ // bars that all stack into one column are summed up by their total, the lines left out of it (the fix pass of 25.33)
2100
+ totals: anyStack(bars, stacked) && barGroups(bars, stacked) === 1 ? { series: bars.map((bar) => bar.dataKey), name: "the bars' total" } : void 0,
2033
2101
  references,
2034
2102
  forecast: forecastAt >= 0 ? { from: forecastAt, label: forecastLabel } : void 0
2035
- }), [data, xAxisKey, xAxisLabel, bars, lines, fullFormat, names, references, forecastAt, forecastLabel]);
2103
+ }), [data, xAxisKey, xAxisLabel, yAxisLabel, bars, lines, stacked, fullFormat, names, references, forecastAt, forecastLabel]);
2036
2104
  if (!data?.length) return null;
2037
2105
  return /* @__PURE__ */ jsx(
2038
2106
  ChartWrapper,
@@ -2061,7 +2129,7 @@ var CompositeChart = markChart(forwardRef(function CompositeChart2({
2061
2129
  margin: { top, right: sideways || names ? 4 : xTicks.endMargin, bottom: 4, left: 4 },
2062
2130
  accessibilityLayer: true,
2063
2131
  children: [
2064
- /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: barSoftColors, surface, ahead: forecastAt >= 0 }),
2132
+ /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: barSoftColors, surface, ahead: forecastAt >= 0, patterns: patterns2 }),
2065
2133
  showGrid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: gridStroke, vertical: !sideways, horizontal: true }),
2066
2134
  sideways ? /* @__PURE__ */ jsxs(Fragment, { children: [
2067
2135
  /* @__PURE__ */ jsx(XAxis, { xAxisId: "left", type: "number", ...axisStyle.tick, axisLine: false, tickLine: false, height: "auto", label: bottomLabel, tickFormatter: tickFormat }),
@@ -2107,10 +2175,10 @@ var CompositeChart = markChart(forwardRef(function CompositeChart2({
2107
2175
  {
2108
2176
  dataKey: bar.dataKey,
2109
2177
  name: bar.label ?? bar.dataKey,
2110
- fill: patterns2[i] ? `url(#${patterns2[i]})` : barSoftColors[i],
2178
+ fill: fillPatterns[i] ? `url(#${fillPatterns[i]})` : barSoftColors[i],
2111
2179
  stroke: barSolidColors[i],
2112
2180
  strokeWidth: 1,
2113
- shape: barShape(bars, i, stacked, radius, sideways, forecastAt >= 0 ? { from: forecastAt, edge: barSolidColors[i], fill: aheadBarFill(barSoftColors[i], patterns2[i]) } : void 0),
2181
+ shape: barShape(bars, i, stacked, radius, sideways, forecastAt >= 0 ? { from: forecastAt, edge: barSolidColors[i], fill: aheadBarFill(barSoftColors[i], fillPatterns[i]) } : void 0),
2114
2182
  stackId: barStackOf(bar, stacked),
2115
2183
  maxBarSize,
2116
2184
  ...barAxis,
@@ -2272,7 +2340,8 @@ var RadarChart = markChart(forwardRef(function RadarChart2({
2272
2340
  valueFormat = "number",
2273
2341
  "aria-label": ariaLabel,
2274
2342
  className,
2275
- description
2343
+ description,
2344
+ patterns: patterns2 = false
2276
2345
  }, ref) {
2277
2346
  const solidColors = useChartColors(dataKeys.length, false);
2278
2347
  const softColors = useChartColors(dataKeys.length, true);
@@ -2282,10 +2351,10 @@ var RadarChart = markChart(forwardRef(function RadarChart2({
2282
2351
  const locale = useFormatLocale();
2283
2352
  const tickFormat = useMemo(() => axisTickFormatter(values, valueFormat, locale), [values, valueFormat, locale]);
2284
2353
  const fullFormat = useMemo(() => fullValueFormatter(valueFormat, locale), [valueFormat, locale]);
2285
- const dashes = dataKeys.map((_, i) => seriesDash(i, dataKeys.length));
2354
+ const dashes = dataKeys.map((_, i) => seriesDash(i, dataKeys.length, patterns2));
2286
2355
  const marks = useMemo(
2287
- () => Object.fromEntries(dataKeys.map((dk, i) => [dk.key, { kind: "line", color: solidColors[i], dash: seriesDash(i, dataKeys.length) }])),
2288
- [dataKeys, solidColors]
2356
+ () => Object.fromEntries(dataKeys.map((dk, i) => [dk.key, { kind: "line", color: solidColors[i], dash: seriesDash(i, dataKeys.length, patterns2) }])),
2357
+ [dataKeys, solidColors, patterns2]
2289
2358
  );
2290
2359
  const access = useMemo(() => cartesianAccess({
2291
2360
  kind: "Radar chart",
@@ -2342,7 +2411,8 @@ var RadialBarChart = markChart(forwardRef(function RadialBarChart2({
2342
2411
  animated,
2343
2412
  "aria-label": ariaLabel,
2344
2413
  className,
2345
- description
2414
+ description,
2415
+ patterns: patterns2 = false
2346
2416
  }, ref) {
2347
2417
  const colors = useChartColors(data.length, false);
2348
2418
  const chartId = useId();
@@ -2350,17 +2420,19 @@ var RadialBarChart = markChart(forwardRef(function RadialBarChart2({
2350
2420
  const locale = useFormatLocale();
2351
2421
  const format = useMemo(() => fullValueFormatter(void 0, locale), [locale]);
2352
2422
  const isAnimated = useChartAnimation(animated);
2353
- const chartData = data.map((d, i) => ({
2354
- name: d.name,
2355
- // a number written as text is drawn as the table and the sentence read it (Sprint 25.8.9)
2356
- value: numberOf(d.value) ?? 0,
2357
- ...d.max !== void 0 ? { max: d.max } : {},
2358
- // Sprint 25.8.9 item 4: each bar after the first fills with a pattern over its colour, as the legend shows it
2359
- fill: seriesPattern(chartId, i, data.length) ? `url(#${seriesPattern(chartId, i, data.length)})` : colors[i % colors.length]
2360
- }));
2423
+ const chartData = data.map((d, i) => {
2424
+ const pattern = seriesPattern(chartId, i, data.length, patterns2);
2425
+ return {
2426
+ name: d.name,
2427
+ // a number written as text is drawn as the table and the sentence read it (Sprint 25.8.9)
2428
+ value: numberOf(d.value) ?? 0,
2429
+ ...d.max !== void 0 ? { max: d.max } : {},
2430
+ fill: pattern ? `url(#${pattern})` : colors[i % colors.length]
2431
+ };
2432
+ });
2361
2433
  const marks = useMemo(
2362
- () => Object.fromEntries(data.map((d, i) => [d.name, { kind: "fill", color: colors[i % colors.length], pattern: seriesPattern(chartId, i, data.length) }])),
2363
- [data, colors, chartId]
2434
+ () => Object.fromEntries(data.map((d, i) => [d.name, { kind: "fill", color: colors[i % colors.length], pattern: seriesPattern(chartId, i, data.length, patterns2) }])),
2435
+ [data, colors, chartId, patterns2]
2364
2436
  );
2365
2437
  const access = useMemo(() => partsAccess({ kind: "radial", items: data.map((d) => ({ name: d.name, value: d.value, ...d.max !== void 0 ? { max: d.max } : {} })), format }), [data, format]);
2366
2438
  if (!data?.length) return null;
@@ -2376,7 +2448,7 @@ var RadialBarChart = markChart(forwardRef(function RadialBarChart2({
2376
2448
  endAngle,
2377
2449
  accessibilityLayer: true,
2378
2450
  children: [
2379
- /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: data.map((_, i) => colors[i % colors.length]), surface }),
2451
+ /* @__PURE__ */ jsx(SeriesPatterns, { chartId, colors: data.map((_, i) => colors[i % colors.length]), surface, patterns: patterns2 }),
2380
2452
  /* @__PURE__ */ jsx(
2381
2453
  RadialBar,
2382
2454
  {
@@ -2404,6 +2476,9 @@ var FunnelChart = markChart(forwardRef(function FunnelChart2({
2404
2476
  description
2405
2477
  }, ref) {
2406
2478
  const colors = useChartColors(data.length, false);
2479
+ const surface = useResolvedToken("--ds-bg-surface");
2480
+ const canvas = useResolvedToken("--ds-bg-canvas");
2481
+ const ground = useMemo(() => groundColour(surface, canvas), [surface, canvas]);
2407
2482
  const locale = useFormatLocale();
2408
2483
  const format = useMemo(() => fullValueFormatter(void 0, locale), [locale]);
2409
2484
  const access = useMemo(() => partsAccess({ kind: "funnel", items: data.map((d) => ({ name: d.name, value: d.value })), format }), [data, format]);
@@ -2415,7 +2490,7 @@ var FunnelChart = markChart(forwardRef(function FunnelChart2({
2415
2490
  }));
2416
2491
  if (!data?.length) return null;
2417
2492
  return /* @__PURE__ */ jsx(ChartWrapper, { ref, height, size: { model: "rows", units: data.length * STAGE_ROWS, axis: "16px" }, chart: "funnel", className, "aria-label": ariaLabel, access, description, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(FunnelChart$1, { accessibilityLayer: true, children: [
2418
- /* @__PURE__ */ jsx(Funnel, { dataKey: "value", data: chartData, isAnimationActive: isAnimated, children: showLabels && /* @__PURE__ */ jsx(
2493
+ /* @__PURE__ */ jsx(Funnel, { dataKey: "value", data: chartData, isAnimationActive: isAnimated, stroke: ground, strokeWidth: SEGMENT_GAP, children: showLabels && /* @__PURE__ */ jsx(
2419
2494
  LabelList,
2420
2495
  {
2421
2496
  dataKey: "name",