@automattic/charts 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/TOKENS.md +51 -12
  3. package/dist/index.cjs +292 -200
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +7 -1
  6. package/dist/index.d.cts +223 -127
  7. package/dist/index.d.ts +223 -127
  8. package/dist/index.js +291 -199
  9. package/dist/index.js.map +1 -1
  10. package/package.json +8 -8
  11. package/src/charts/bar-chart/bar-chart.tsx +36 -10
  12. package/src/charts/bar-chart/test/bar-chart-pointer-events.test.tsx +67 -0
  13. package/src/charts/bar-chart/test/bar-chart.test.tsx +79 -0
  14. package/src/charts/bar-list-chart/bar-list-chart.tsx +40 -2
  15. package/src/charts/bar-list-chart/test/bar-list-chart.test.tsx +38 -0
  16. package/src/charts/line-chart/line-chart.tsx +16 -1
  17. package/src/charts/line-chart/test/line-chart.test.tsx +47 -0
  18. package/src/charts/sparkline/sparkline.tsx +9 -3
  19. package/src/charts/sparkline/types.ts +1 -1
  20. package/src/components/tooltip/accessible-tooltip.tsx +32 -2
  21. package/src/components/tooltip/test/accessible-tooltip.test.tsx +68 -0
  22. package/src/hooks/test/use-xychart-theme-provider-override.test.tsx +4 -4
  23. package/src/hooks/test/use-xychart-theme-style-reads.test.tsx +17 -10
  24. package/src/hooks/test/use-xychart-theme.test.tsx +50 -5
  25. package/src/hooks/use-xychart-theme.ts +14 -20
  26. package/src/providers/chart-context/global-charts-provider.tsx +44 -33
  27. package/src/providers/chart-context/private/series-palette.ts +45 -0
  28. package/src/providers/chart-context/private/theme-override-vars.ts +46 -2
  29. package/src/providers/chart-context/private/with-catalog-pointers.ts +45 -2
  30. package/src/providers/chart-context/test/sparse-theme.test.ts +16 -2
  31. package/src/providers/chart-context/test/theme-override-vars.test.ts +65 -0
  32. package/src/providers/chart-context/test/use-global-charts-theme.test.tsx +8 -1
  33. package/src/providers/chart-context/test/with-catalog-pointers.test.ts +57 -0
  34. package/src/providers/chart-context/themes.ts +8 -3
  35. package/src/styles/chart-scope.scss +52 -24
  36. package/src/styles/test/chart-scope.test.ts +22 -9
  37. package/src/types.ts +148 -31
  38. package/src/utils/get-styles.ts +7 -1
package/dist/index.css CHANGED
@@ -1,11 +1,17 @@
1
1
  :where(.a8c-charts-scope) {
2
+ --a8c-charts-color-series-1: var(--a8c-charts-color-series-1-theme, var(--wp-admin-theme-color, var(--wpds-color-foreground-interactive-brand, var(--wp-admin-theme-color, #3858e9))));
3
+ --a8c-charts-color-series-2: var(--a8c-charts-color-series-2-theme);
4
+ --a8c-charts-color-series-3: var(--a8c-charts-color-series-3-theme);
5
+ --a8c-charts-color-series-4: var(--a8c-charts-color-series-4-theme);
6
+ --a8c-charts-color-series-5: var(--a8c-charts-color-series-5-theme);
2
7
  --a8c-charts-color-grid: var(--a8c-charts-color-grid-theme, var(--wpds-color-stroke-surface-neutral, #dbdbdb));
3
8
  --a8c-charts-color-axis: var(--a8c-charts-color-axis-theme, var(--wpds-color-stroke-surface-neutral, #dbdbdb));
4
9
  --a8c-charts-color-tick: var(--a8c-charts-color-tick-theme, var(--wpds-color-stroke-surface-neutral, #dbdbdb));
5
10
  --a8c-charts-color-label: var(--wpds-color-foreground-content-neutral, #1e1e1e);
6
11
  --a8c-charts-color-label-secondary: var(--wpds-color-foreground-content-neutral-weak, #707070);
7
12
  --a8c-charts-color-label-inverse: var(--wpds-color-foreground-interactive-neutral-strong, #f0f0f0);
8
- --a8c-charts-color-label-on-fill: #fff;
13
+ --a8c-charts-color-label-on-fill: var(--a8c-charts-color-label-on-fill-theme, #fff);
14
+ --a8c-charts-color-label-background: var(--a8c-charts-color-label-background-theme, transparent);
9
15
  --a8c-charts-color-label-axis: var(--a8c-charts-color-label-axis-theme, var(--a8c-charts-color-label));
10
16
  --a8c-charts-color-annotation: var(--wpds-color-foreground-content-neutral, #1e1e1e);
11
17
  --a8c-charts-color-trend-up: var(--wpds-color-foreground-content-success-weak, #008030);
package/dist/index.d.cts CHANGED
@@ -7,7 +7,6 @@ import { EventHandlerParams, EventHandlerParams as EventHandlerParams$1, GlyphPr
7
7
  import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
8
8
  import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
9
9
  import { PieProvidedProps } from "@visx/shape";
10
-
11
10
  //#region src/types.d.ts
12
11
  type ValueOf<T> = T[keyof T];
13
12
  type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
@@ -60,15 +59,28 @@ type GoogleDataTableCell = {
60
59
  type GoogleDataTableRow = GoogleDataTableCell[];
61
60
  type ChartType = 'area' | 'bar' | 'conversion-funnel' | 'leaderboard' | 'line' | 'pie' | 'pie-semi-circle';
62
61
  type OrientationType = ValueOf<typeof Orientation>;
62
+ /**
63
+ * Annotation styling.
64
+ *
65
+ * Each color member is deprecated on its own rather than the field it sits in: `radius`, `stroke` widths and the label geometry alongside them have no catalog role behind them and still apply.
66
+ */
63
67
  type AnnotationStyles = {
64
- circleSubject?: Omit<CircleSubjectProps, 'x' | 'y'> & {
68
+ circleSubject?: Omit<CircleSubjectProps, 'x' | 'y' | 'fill'> & {
69
+ /** @deprecated Set the `--a8c-charts-color-annotation` custom property inside the provider tree instead. See `TOKENS.md`. */
65
70
  fill?: string;
66
71
  };
67
72
  lineSubject?: Omit<LineSubjectProps, 'x' | 'y'>;
68
- connector?: Omit<ConnectorProps, 'x' | 'y' | 'dx' | 'dy'>;
69
- label?: Omit<LabelProps, 'title' | 'subtitle' | 'x' | 'y'> & {
73
+ connector?: Omit<ConnectorProps, 'x' | 'y' | 'dx' | 'dy' | 'stroke'> & {
74
+ /** @deprecated Set the `--a8c-charts-color-annotation` custom property inside the provider tree instead. See `TOKENS.md`. */
75
+ stroke?: ConnectorProps['stroke'];
76
+ };
77
+ label?: Omit<LabelProps, 'title' | 'subtitle' | 'x' | 'y' | 'anchorLineStroke' | 'backgroundFill'> & {
70
78
  x?: number | 'start' | 'end';
71
79
  y?: number | 'start' | 'end';
80
+ /** @deprecated Set the `--a8c-charts-color-annotation` custom property inside the provider tree instead. See `TOKENS.md`. */
81
+ anchorLineStroke?: LabelProps['anchorLineStroke'];
82
+ /** @deprecated Set the `--a8c-charts-color-surface` custom property inside the provider tree instead. See `TOKENS.md`. */
83
+ backgroundFill?: LabelProps['backgroundFill'];
72
84
  };
73
85
  };
74
86
  type DataPoint = {
@@ -240,7 +252,7 @@ type DataPointPercentage = {
240
252
  */
241
253
  valueDisplay?: string;
242
254
  /**
243
- * Color code for the segment, by default colours are taken from the theme but this property can overrides it
255
+ * Color code for the segment, by default colors are taken from the theme but this property can overrides it
244
256
  */
245
257
  color?: string;
246
258
  /**
@@ -262,41 +274,160 @@ type DataPointPercentageCalculated = DataPointPercentage & {
262
274
  * Base theme configuration for chart components with optional properties
263
275
  */
264
276
  type ChartTheme = {
265
- /** Background color for chart components */backgroundColor: string; /** Background color for labels */
266
- labelBackgroundColor?: string; /** Text color for labels */
267
- labelTextColor?: string; /** Array of colors used for data visualization */
268
- colors: string[]; /** Optional CSS styles for grid lines */
269
- gridStyles?: GridStyles$1; /** Length of axis ticks in pixels */
270
- tickLength: number; /** Color of the grid lines */
271
- gridColor: string; /** Color of the grid lines in dark mode */
272
- gridColorDark: string; /** Styles for x-axis tick lines */
273
- xTickLineStyles?: LineStyles$1; /** Styles for x-axis line */
274
- xAxisLineStyles?: LineStyles$1; /** Styles for series lines */
275
- seriesLineStyles?: LineStyles$1[]; /** Array of render functions for glyphs */
276
- glyphs?: Array<(<Datum extends object>(props: GlyphProps<Datum>) => ReactNode)>; /** Legend specific settings */
277
+ /**
278
+ * Background color for chart components.
279
+ *
280
+ * Still resolved in JS — gradient stops, the glyph stroke and `GeoChart`'s Google Charts config each need a concrete string — but that is about where the value is *consumed*, not where it is *set*. `withCatalogPointers` parks a consumer's value in the catalog role and restores the pointer, so the field is only ever a carrier for `--a8c-charts-color-background`, and setting the role directly does the same job.
281
+ *
282
+ * Optional so the deprecation is actionable: a consumer writing a full theme literal can now stop setting it. `CompleteChartTheme` is `Required< ChartTheme >`, so `defaultTheme` must still carry one.
283
+ *
284
+ * @deprecated Set the `--a8c-charts-color-background` custom property inside the provider tree instead. See `TOKENS.md`.
285
+ */
286
+ backgroundColor?: string;
287
+ /**
288
+ * Background color for labels.
289
+ *
290
+ * @deprecated Set the `--a8c-charts-color-label-background` custom property inside the provider tree instead. See `TOKENS.md`.
291
+ */
292
+ labelBackgroundColor?: string;
293
+ /**
294
+ * Text color for labels.
295
+ *
296
+ * @deprecated Set the `--a8c-charts-color-label-on-fill` custom property inside the provider tree instead. See `TOKENS.md`.
297
+ */
298
+ labelTextColor?: string;
299
+ /**
300
+ * Series palette seeds. Entry N publishes `--a8c-charts-color-series-{N+1}`; entries past the fifth are ignored.
301
+ *
302
+ * Optional so the deprecation is actionable: a consumer writing a full theme literal can now stop setting it. `CompleteChartTheme` is `Required< ChartTheme >`, so `defaultTheme` must still carry one.
303
+ *
304
+ * @deprecated Set the `--a8c-charts-color-series-1` … `-5` custom properties inside the provider tree instead, or `options.stroke` on a series for a single one. See `TOKENS.md`.
305
+ */
306
+ colors?: string[];
307
+ /**
308
+ * Optional CSS styles for grid lines.
309
+ *
310
+ * `stroke` is deprecated on its own, not the whole field: `strokeWidth` has no CSS role behind it and still applies. The same shape is used for the other fields whose color moved to CSS — annotating the field itself would strike through the half that stays.
311
+ */
312
+ gridStyles?: Omit<GridStyles$1, 'stroke'> & {
313
+ /** @deprecated Set the `--a8c-charts-color-grid` custom property inside the provider tree instead. See `TOKENS.md`. */
314
+ stroke?: GridStyles$1['stroke'];
315
+ };
316
+ /** Length of axis ticks in pixels */
317
+ tickLength: number;
318
+ /**
319
+ * Set `--a8c-charts-color-grid` for the gridlines.
320
+ *
321
+ * @deprecated Do not drop this field without replacing it. Nothing in this package consults it, but `buildChartTheme` seeds `y.left/right.axisLine.stroke` and `y.*.tickLine.stroke` from it, and `defaultTheme`'s empty string is the only thing leaving the y axis unpainted — deleting the field hands those a black `#222` instead. CHARTS-263 replaces it with visx's own `yAxisLineStyles`/`yTickLineStyles` and a pair of catalog roles.
322
+ */
323
+ gridColor?: string;
324
+ /**
325
+ * @deprecated Paints nothing, and unlike `gridColor` is safe to delete: `buildChartTheme` seeds `x.*.axisLine.stroke` from it, but spreads `xAxisLineStyles` over the top and `defaultTheme` always carries that stroke. Charts follow the host's theme through the catalog rather than a dark-mode field of their own.
326
+ */
327
+ gridColorDark?: string;
328
+ /** Styles for x-axis tick lines */
329
+ xTickLineStyles?: Omit<LineStyles$1, 'stroke'> & {
330
+ /** @deprecated Set the `--a8c-charts-color-tick` custom property inside the provider tree instead. See `TOKENS.md`. */
331
+ stroke?: LineStyles$1['stroke'];
332
+ };
333
+ /** Styles for x-axis line */
334
+ xAxisLineStyles?: Omit<LineStyles$1, 'stroke'> & {
335
+ /** @deprecated Set the `--a8c-charts-color-axis` custom property inside the provider tree instead. See `TOKENS.md`. */
336
+ stroke?: LineStyles$1['stroke'];
337
+ };
338
+ /** Styles for series lines */
339
+ seriesLineStyles?: LineStyles$1[];
340
+ /** Array of render functions for glyphs */
341
+ glyphs?: Array<(<Datum extends object>(props: GlyphProps<Datum>) => ReactNode)>;
342
+ /** Legend specific settings */
277
343
  legend?: {
278
- /** Styles for legend shapes */shapeStyles?: Record<string, unknown>[]; /** Styles for legend labels */
279
- labelStyles?: CSSProperties; /** Styles for legend container */
344
+ /** Styles for legend shapes */
345
+ shapeStyles?: Record<string, unknown>[];
346
+ /**
347
+ * Styles for legend labels.
348
+ *
349
+ * `color` is deprecated on its own, not the whole field: everything else a consumer sets here — font size, weight, spacing — has no catalog role behind it and still applies.
350
+ */
351
+ labelStyles?: Omit<CSSProperties, 'color'> & {
352
+ /** @deprecated Set the `--a8c-charts-color-label` custom property inside the provider tree instead. See `TOKENS.md`. */
353
+ color?: CSSProperties['color'];
354
+ };
355
+ /** Styles for legend container */
280
356
  containerStyles?: CSSProperties;
281
- }; /** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */
282
- svgLabelSmall?: TextProps; /** Styles for large SVG text (eg. axis titles), passed through to the XYChart theme. */
357
+ };
358
+ /**
359
+ * Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme.
360
+ *
361
+ * `fontFamily: 'inherit'` is load-bearing here — it overrides the font stack `buildChartTheme` injects inline on SVG `<text>` — so only `fill` is deprecated.
362
+ */
363
+ svgLabelSmall?: Omit<TextProps, 'fill'> & {
364
+ /** @deprecated Set the `--a8c-charts-color-label-axis` custom property inside the provider tree instead, or `--a8c-charts-color-label` to move every label at once. See `TOKENS.md`. */
365
+ fill?: TextProps['fill'];
366
+ };
367
+ /** Styles for large SVG text (eg. axis titles), passed through to the XYChart theme. */
283
368
  svgLabelBig?: TextProps;
284
- annotationStyles?: AnnotationStyles; /** GeoChart specific settings */
369
+ annotationStyles?: AnnotationStyles;
370
+ /** GeoChart specific settings */
285
371
  geoChart?: {
286
- /** Default fill color for a geo chart feature (e.g. country) with no data */featureFillColor?: string;
287
- }; /** LeaderboardChart specific settings */
372
+ /**
373
+ * Default fill color for a geo chart feature (e.g. country) with no data.
374
+ *
375
+ * @deprecated Set the `--a8c-charts-color-surface-secondary` custom property inside the provider tree instead. Google Charts still takes a resolved hex, but the value is read from the role. See `TOKENS.md`.
376
+ */
377
+ featureFillColor?: string;
378
+ };
379
+ /** LeaderboardChart specific settings */
288
380
  leaderboardChart?: {
289
- /** Gap between rows in the leaderboard grid */rowGap?: number; /** Gap between columns in the leaderboard grid */
290
- columnGap?: number; /** Spacing between label and progress bars */
291
- labelSpacing?: GapSize; /** Primary color for current period bars */
292
- primaryColor?: string; /** Secondary color for comparison period bars */
293
- secondaryColor?: string; /** Delta colors: [negative, neutral, positive] */
381
+ /** Gap between rows in the leaderboard grid */
382
+ rowGap?: number;
383
+ /** Gap between columns in the leaderboard grid */
384
+ columnGap?: number;
385
+ /** Spacing between label and progress bars */
386
+ labelSpacing?: GapSize;
387
+ /**
388
+ * Primary color for current period bars.
389
+ *
390
+ * @deprecated Use the `primaryColor` prop on `LeaderboardChart` for one chart, or set `--a8c-charts-color-series-1` to move the palette this falls back to. See `TOKENS.md`.
391
+ */
392
+ primaryColor?: string;
393
+ /**
394
+ * Secondary color for comparison period bars.
395
+ *
396
+ * @deprecated Use the `secondaryColor` prop on `LeaderboardChart` for one chart, or set `--a8c-charts-color-series-2` to move the palette this falls back to. See `TOKENS.md`.
397
+ */
398
+ secondaryColor?: string;
399
+ /**
400
+ * Delta colors: [negative, neutral, positive].
401
+ *
402
+ * @deprecated Set the `--a8c-charts-color-trend-down`, `-trend-neutral` and `-trend-up` custom properties inside the provider tree instead. See `TOKENS.md`.
403
+ */
294
404
  deltaColors?: [string, string, string];
295
- }; /** ConversionFunnelChart specific settings */
405
+ };
406
+ /** ConversionFunnelChart specific settings */
296
407
  conversionFunnelChart?: {
297
- /** Primary color for funnel bars */primaryColor?: string; /** Background color for chart container */
298
- backgroundColor?: string; /** Color for positive change indicators */
299
- positiveChangeColor?: string; /** Color for negative change indicators */
408
+ /**
409
+ * Primary color for funnel bars.
410
+ *
411
+ * @deprecated Set `--a8c-charts-color-series-1` to move the palette this falls back to. See `TOKENS.md`.
412
+ */
413
+ primaryColor?: string;
414
+ /**
415
+ * Background color for chart container.
416
+ *
417
+ * @deprecated Set the `--a8c-charts-color-surface-secondary` custom property inside the provider tree instead. See `TOKENS.md`.
418
+ */
419
+ backgroundColor?: string;
420
+ /**
421
+ * Color for positive change indicators.
422
+ *
423
+ * @deprecated Set the `--a8c-charts-color-trend-up` custom property inside the provider tree instead. See `TOKENS.md`.
424
+ */
425
+ positiveChangeColor?: string;
426
+ /**
427
+ * Color for negative change indicators.
428
+ *
429
+ * @deprecated Set the `--a8c-charts-color-trend-down` custom property inside the provider tree instead. See `TOKENS.md`.
430
+ */
300
431
  negativeChangeColor?: string;
301
432
  };
302
433
  lineChart?: {
@@ -304,14 +435,17 @@ type ChartTheme = {
304
435
  };
305
436
  barChart?: {
306
437
  barStyles?: Partial<Record<NonNullable<SeriesDataOptions['type']>, BarStyles>>;
307
- }; /** Sparkline specific settings */
438
+ };
439
+ /** Sparkline specific settings */
308
440
  sparkline?: {
309
- /** Margin around the sparkline chart */margin?: {
441
+ /** Margin around the sparkline chart */
442
+ margin?: {
310
443
  top?: number;
311
444
  right?: number;
312
445
  bottom?: number;
313
446
  left?: number;
314
- }; /** Stroke width for the sparkline line */
447
+ };
448
+ /** Stroke width for the sparkline line */
315
449
  strokeWidth?: number;
316
450
  };
317
451
  /**
@@ -322,9 +456,13 @@ type ChartTheme = {
322
456
  /**
323
457
  * Color the cell scale interpolates toward at the highest value (prop > this >
324
458
  * palette `colors[0]`), fed to CSS `color-mix`. Omit to use the palette color.
459
+ *
460
+ * @deprecated Use the `primaryColor` prop on `HeatmapChart` for one chart, or set `--a8c-charts-color-series-1` to move the palette this falls back to. See `TOKENS.md`.
325
461
  */
326
- primaryColor?: string; /** Gap in px between cells in compact mode */
327
- compactCellGap?: number; /** Fixed square cell size in px for compact mode */
462
+ primaryColor?: string;
463
+ /** Gap in px between cells in compact mode */
464
+ compactCellGap?: number;
465
+ /** Fixed square cell size in px for compact mode */
328
466
  compactCellSize?: number;
329
467
  };
330
468
  };
@@ -426,7 +564,9 @@ type ScaleOptions = {
426
564
  paddingOuter?: number;
427
565
  };
428
566
  type LegendItemStyles = {
429
- /** Margin around each legend item. */margin?: CSSProperties['margin']; /** Flex direction for items within each legend entry. */
567
+ /** Margin around each legend item. */
568
+ margin?: CSSProperties['margin'];
569
+ /** Flex direction for items within each legend entry. */
430
570
  flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
431
571
  };
432
572
  type LegendLabelStyles = Pick<CSSProperties, 'justifyContent' | 'flex' | 'margin'> & {
@@ -443,8 +583,11 @@ type LegendLabelStyles = Pick<CSSProperties, 'justifyContent' | 'flex' | 'margin
443
583
  textOverflow?: 'ellipsis' | 'wrap';
444
584
  };
445
585
  type LegendShapeStyles = {
446
- /** Width of the legend shape in pixels. */width?: number; /** Height of the legend shape in pixels. */
447
- height?: number; /** Margin around the legend shape. */
586
+ /** Width of the legend shape in pixels. */
587
+ width?: number;
588
+ /** Height of the legend shape in pixels. */
589
+ height?: number;
590
+ /** Margin around the legend shape. */
448
591
  margin?: CSSProperties['margin'];
449
592
  };
450
593
  /** Position of the legend relative to chart content. */
@@ -498,7 +641,7 @@ type ChartLegendConfig<T = DataPoint | DataPointDate | LeaderboardEntry> = {
498
641
  /**
499
642
  * Legend config for charts built from `SeriesData` (line, bar, area). Adds `collapseGroups` on top
500
643
  * of the shared config. It is intentionally absent from the base `ChartLegendConfig` so point-based
501
- * charts (pie, semi-circle pie) — whose data points carry `group` only to coordinate colours — can't
644
+ * charts (pie, semi-circle pie) — whose data points carry `group` only to coordinate colors — can't
502
645
  * set it.
503
646
  */
504
647
  type SeriesChartLegendConfig = ChartLegendConfig<SeriesData[]> & {
@@ -576,6 +719,16 @@ type BaseChartProps<T = DataPoint | DataPointDate | LeaderboardEntry> = {
576
719
  * Callback function for pointer out event
577
720
  */
578
721
  onPointerOut?: (event: PointerEvent<Element>) => void;
722
+ /**
723
+ * Callback for Enter or Space on the point keyboard navigation has selected:
724
+ * the keyboard counterpart of a click. `index` is the point's position in its
725
+ * series and `key` the series label.
726
+ */
727
+ onDatumActivate?: (params: {
728
+ datum: DataPoint | DataPointDate;
729
+ index: number;
730
+ key: string;
731
+ }) => void;
579
732
  /**
580
733
  * Whether to show tooltips on hover. False by default.
581
734
  */
@@ -622,11 +775,16 @@ type BaseLegendProps = VisxLegendProps & {
622
775
  items: BaseLegendItem[];
623
776
  orientation?: 'horizontal' | 'vertical';
624
777
  position?: LegendPosition;
625
- alignment?: 'start' | 'center' | 'end'; /** Additional CSS class name for legend items. */
626
- itemClassName?: string; /** CSS styles for each legend item (margin, flexDirection). */
627
- itemStyles?: LegendItemStyles; /** Additional CSS class name for legend labels. */
628
- labelClassName?: string; /** CSS styles for legend labels (justifyContent, flex, margin). */
629
- labelStyles?: LegendLabelStyles; /** Styles for legend shapes (width, height, margin). */
778
+ alignment?: 'start' | 'center' | 'end';
779
+ /** Additional CSS class name for legend items. */
780
+ itemClassName?: string;
781
+ /** CSS styles for each legend item (margin, flexDirection). */
782
+ itemStyles?: LegendItemStyles;
783
+ /** Additional CSS class name for legend labels. */
784
+ labelClassName?: string;
785
+ /** CSS styles for legend labels (justifyContent, flex, margin). */
786
+ labelStyles?: LegendLabelStyles;
787
+ /** Styles for legend shapes (width, height, margin). */
630
788
  shapeStyles?: LegendShapeStyles;
631
789
  /**
632
790
  * Function for rendering a custom legend layout.
@@ -983,19 +1141,11 @@ interface RenderValueProps {
983
1141
  formatter: (value: number) => string;
984
1142
  }
985
1143
  declare const BarListChart: FC<BarListChartProps>;
986
- declare const BarListChartResponsive: ({
987
- resizeDebounceTime,
988
- maxWidth,
989
- aspectRatio,
990
- size,
991
- width,
992
- height,
993
- ...chartProps
994
- }: Omit<BarListChartProps, "height" | "size" | "width"> & {
1144
+ declare const BarListChartResponsive: ({ resizeDebounceTime, maxWidth, aspectRatio, size, width, height, ...chartProps }: Omit<BarListChartProps, "height" | "size" | "width"> & {
995
1145
  width?: number;
996
1146
  height?: number;
997
1147
  size?: number;
998
- } & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
1148
+ } & ResponsiveConfig) => import("react").JSX.Element;
999
1149
  //#endregion
1000
1150
  //#region src/charts/conversion-funnel-chart/types.d.ts
1001
1151
  /**
@@ -1137,24 +1287,17 @@ interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | '
1137
1287
  //#endregion
1138
1288
  //#region src/charts/geo-chart/geo-chart.d.ts
1139
1289
  declare const GeoChartWithProvider: FC<GeoChartProps>;
1140
- declare const GeoChartResponsive: ({
1141
- resizeDebounceTime,
1142
- maxWidth,
1143
- aspectRatio,
1144
- size,
1145
- width,
1146
- height,
1147
- ...chartProps
1148
- }: Omit<GeoChartProps, "height" | "size" | "width"> & {
1290
+ declare const GeoChartResponsive: ({ resizeDebounceTime, maxWidth, aspectRatio, size, width, height, ...chartProps }: Omit<GeoChartProps, "height" | "size" | "width"> & {
1149
1291
  width?: number;
1150
1292
  height?: number;
1151
1293
  size?: number;
1152
- } & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
1294
+ } & ResponsiveConfig) => import("react").JSX.Element;
1153
1295
  //#endregion
1154
1296
  //#region src/charts/heatmap-chart/types.d.ts
1155
1297
  /** A single heatmap cell. `value: null` marks an empty cell. */
1156
1298
  type HeatmapCell = {
1157
- /** Per-cell label used in the tooltip / accessible name. */label?: string;
1299
+ /** Per-cell label used in the tooltip / accessible name. */
1300
+ label?: string;
1158
1301
  value: number | null;
1159
1302
  /**
1160
1303
  * Leave the cell's grid slot empty: nothing is painted and the cell is
@@ -1174,7 +1317,8 @@ type HeatmapCell = {
1174
1317
  };
1175
1318
  /** A heatmap column (rendered left→right); its cells render top→bottom. */
1176
1319
  type HeatmapColumn = {
1177
- /** x-axis label for this column. Empty/omitted renders blank. */label?: string;
1320
+ /** x-axis label for this column. Empty/omitted renders blank. */
1321
+ label?: string;
1178
1322
  data: HeatmapCell[];
1179
1323
  };
1180
1324
  type HeatmapTooltipData = {
@@ -1338,19 +1482,11 @@ declare const LeaderboardChart: FC<LeaderboardChartProps> & {
1338
1482
  chartId?: string;
1339
1483
  } & import("react").RefAttributes<HTMLDivElement>>;
1340
1484
  };
1341
- declare const LeaderboardChartResponsive: (({
1342
- resizeDebounceTime,
1343
- maxWidth,
1344
- aspectRatio,
1345
- size,
1346
- width,
1347
- height,
1348
- ...chartProps
1349
- }: Omit<LeaderboardChartProps, "height" | "size" | "width"> & {
1485
+ declare const LeaderboardChartResponsive: (({ resizeDebounceTime, maxWidth, aspectRatio, size, width, height, ...chartProps }: Omit<LeaderboardChartProps, "height" | "size" | "width"> & {
1350
1486
  width?: number;
1351
1487
  height?: number;
1352
1488
  size?: number;
1353
- } & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element) & {
1489
+ } & ResponsiveConfig) => import("react").JSX.Element) & {
1354
1490
  Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
1355
1491
  items?: BaseLegendItem[];
1356
1492
  chartId?: string;
@@ -1438,11 +1574,7 @@ type FormatMetricValueOptions = {
1438
1574
  * @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)
1439
1575
  * @return Formatted string
1440
1576
  */
1441
- declare const formatMetricValue: (value: string | number, type?: MetricValueType, {
1442
- decimals,
1443
- useMultipliers,
1444
- signDisplay
1445
- }?: FormatMetricValueOptions) => string;
1577
+ declare const formatMetricValue: (value: string | number, type?: MetricValueType, { decimals, useMultipliers, signDisplay }?: FormatMetricValueOptions) => string;
1446
1578
  //#endregion
1447
1579
  //#region src/utils/format-percentage.d.ts
1448
1580
  /**
@@ -1588,14 +1720,7 @@ declare const resolveCssVariable: (value: string, element?: HTMLElement | null)
1588
1720
  * @param root0.legendLabels.comparison - Label for comparison period data
1589
1721
  * @return Array of legend items for the leaderboard chart
1590
1722
  */
1591
- declare function useLeaderboardLegendItems({
1592
- data,
1593
- primaryColor,
1594
- secondaryColor,
1595
- withComparison,
1596
- withOverlayLabel,
1597
- legendLabels
1598
- }: {
1723
+ declare function useLeaderboardLegendItems({ data, primaryColor, secondaryColor, withComparison, withOverlayLabel, legendLabels }: {
1599
1724
  data: LeaderboardEntry[];
1600
1725
  primaryColor?: string;
1601
1726
  secondaryColor?: string;
@@ -1826,7 +1951,7 @@ interface SparklineProps {
1826
1951
  size?: number;
1827
1952
  /**
1828
1953
  * Color for the line stroke (hex or CSS color)
1829
- * @default Theme color (first color in theme.colors array)
1954
+ * @default The first series palette color (`--a8c-charts-color-series-1`)
1830
1955
  */
1831
1956
  color?: string;
1832
1957
  /**
@@ -1886,19 +2011,11 @@ declare const SparklineUnresponsive: import("react").ForwardRefExoticComponent<S
1886
2011
  /**
1887
2012
  * Responsive Sparkline chart component
1888
2013
  */
1889
- declare const Sparkline: ({
1890
- resizeDebounceTime,
1891
- maxWidth,
1892
- aspectRatio,
1893
- size,
1894
- width,
1895
- height,
1896
- ...chartProps
1897
- }: Omit<SparklineProps, "height" | "size" | "width"> & {
2014
+ declare const Sparkline: ({ resizeDebounceTime, maxWidth, aspectRatio, size, width, height, ...chartProps }: Omit<SparklineProps, "height" | "size" | "width"> & {
1898
2015
  width?: number;
1899
2016
  height?: number;
1900
2017
  size?: number;
1901
- } & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
2018
+ } & ResponsiveConfig) => import("react").JSX.Element;
1902
2019
  //#endregion
1903
2020
  //#region src/components/tooltip/base-tooltip.d.ts
1904
2021
  type TooltipData = {
@@ -1933,16 +2050,7 @@ type CustomTooltip = {
1933
2050
  component?: never;
1934
2051
  };
1935
2052
  type BaseTooltipProps = TooltipCommonProps & (DefaultDataTooltip | CustomTooltip);
1936
- declare const BaseTooltip: ({
1937
- data,
1938
- top,
1939
- left,
1940
- component: Component,
1941
- children,
1942
- className,
1943
- style,
1944
- renderContainer
1945
- }: BaseTooltipProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode>;
2053
+ declare const BaseTooltip: ({ data, top, left, component: Component, children, className, style, renderContainer }: BaseTooltipProps) => string | number | true | import("react").JSX.Element | Iterable<ReactNode>;
1946
2054
  //#endregion
1947
2055
  //#region src/components/tooltip/accessible-tooltip.d.ts
1948
2056
  type FlattenedTooltipData = {
@@ -2022,13 +2130,7 @@ type TrendIndicatorProps = {
2022
2130
  * @param {TrendIndicatorProps} props - Component props
2023
2131
  * @return {JSX.Element} The rendered trend indicator
2024
2132
  */
2025
- declare function TrendIndicator({
2026
- direction,
2027
- value,
2028
- className,
2029
- style,
2030
- showIcon
2031
- }: TrendIndicatorProps): import("react/jsx-runtime").JSX.Element;
2133
+ declare function TrendIndicator({ direction, value, className, style, showIcon }: TrendIndicatorProps): import("react").JSX.Element;
2032
2134
  //#endregion
2033
2135
  //#region src/providers/chart-context/types.d.ts
2034
2136
  interface ChartRegistration {
@@ -2080,13 +2182,7 @@ declare const GlobalChartsProvider: FC<GlobalChartsProviderProps>;
2080
2182
  declare const useGlobalChartsContext: () => GlobalChartsContextValue;
2081
2183
  //#endregion
2082
2184
  //#region src/providers/chart-context/hooks/use-chart-registration.d.ts
2083
- declare const useChartRegistration: ({
2084
- chartId,
2085
- legendItems,
2086
- chartType,
2087
- isDataValid,
2088
- metadata
2089
- }: {
2185
+ declare const useChartRegistration: ({ chartId, legendItems, chartType, isDataValid, metadata }: {
2090
2186
  chartId: string;
2091
2187
  legendItems: BaseLegendItem[];
2092
2188
  chartType: ChartType;