@gooddata/sdk-ui-vis-commons 10.42.0-alpha.2 → 10.42.0-alpha.3

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 (56) hide show
  1. package/esm/coloring/attribute.d.ts.map +1 -1
  2. package/esm/coloring/attribute.js +1 -5
  3. package/esm/coloring/attribute.js.map +1 -1
  4. package/esm/coloring/base.d.ts.map +1 -1
  5. package/esm/coloring/base.js +3 -13
  6. package/esm/coloring/base.js.map +1 -1
  7. package/esm/coloring/patternFills.d.ts +31 -1
  8. package/esm/coloring/patternFills.d.ts.map +1 -1
  9. package/esm/coloring/patternFills.js +14 -0
  10. package/esm/coloring/patternFills.js.map +1 -1
  11. package/esm/coloring/types.d.ts +1 -1
  12. package/esm/coloring/types.d.ts.map +1 -1
  13. package/esm/index.d.ts +5 -5
  14. package/esm/index.d.ts.map +1 -1
  15. package/esm/index.js +2 -2
  16. package/esm/index.js.map +1 -1
  17. package/esm/legend/FluidLegend.d.ts +2 -2
  18. package/esm/legend/FluidLegend.d.ts.map +1 -1
  19. package/esm/legend/Legend.d.ts +2 -2
  20. package/esm/legend/Legend.d.ts.map +1 -1
  21. package/esm/legend/LegendGroup.d.ts +8 -0
  22. package/esm/legend/LegendGroup.d.ts.map +1 -0
  23. package/esm/legend/LegendGroup.js +22 -0
  24. package/esm/legend/LegendGroup.js.map +1 -0
  25. package/esm/legend/LegendItem.d.ts +6 -5
  26. package/esm/legend/LegendItem.d.ts.map +1 -1
  27. package/esm/legend/LegendItem.js +12 -14
  28. package/esm/legend/LegendItem.js.map +1 -1
  29. package/esm/legend/LegendList.d.ts +5 -3
  30. package/esm/legend/LegendList.d.ts.map +1 -1
  31. package/esm/legend/LegendList.js +29 -12
  32. package/esm/legend/LegendList.js.map +1 -1
  33. package/esm/legend/LegendSeries.d.ts.map +1 -1
  34. package/esm/legend/LegendSeries.js +3 -4
  35. package/esm/legend/LegendSeries.js.map +1 -1
  36. package/esm/legend/PopUpLegend/PopUpLegend.d.ts +2 -2
  37. package/esm/legend/PopUpLegend/PopUpLegend.d.ts.map +1 -1
  38. package/esm/legend/PopUpLegend/RowLegend.d.ts +2 -2
  39. package/esm/legend/PopUpLegend/RowLegend.d.ts.map +1 -1
  40. package/esm/legend/StaticLegend.d.ts +2 -2
  41. package/esm/legend/StaticLegend.d.ts.map +1 -1
  42. package/esm/legend/helpers.d.ts +2 -3
  43. package/esm/legend/helpers.d.ts.map +1 -1
  44. package/esm/legend/helpers.js +28 -2
  45. package/esm/legend/helpers.js.map +1 -1
  46. package/esm/legend/types.d.ts +67 -20
  47. package/esm/legend/types.d.ts.map +1 -1
  48. package/esm/legend/types.js +36 -0
  49. package/esm/legend/types.js.map +1 -1
  50. package/esm/sdk-ui-vis-commons.d.ts +117 -26
  51. package/package.json +9 -8
  52. package/styles/scss/legend.scss +4 -0
  53. package/esm/legend/LegendAxisIndicator.d.ts +0 -8
  54. package/esm/legend/LegendAxisIndicator.d.ts.map +0 -1
  55. package/esm/legend/LegendAxisIndicator.js +0 -17
  56. package/esm/legend/LegendAxisIndicator.js.map +0 -1
@@ -46,10 +46,30 @@ export declare function calculateHeadlineHeightFontSize(secondaryItem?: boolean,
46
46
  fontSize: number | undefined;
47
47
  };
48
48
 
49
+ /**
50
+ * Chart fill config is used to customize the chart fill.
51
+ *
52
+ * @internal
53
+ */
54
+ export declare interface ChartFillConfig {
55
+ /**
56
+ * Type of the chart fill.
57
+ */
58
+ type?: ChartFillType;
59
+ /**
60
+ * Custom mapping of selected pattern fill by measure.
61
+ * The value is map of measure local identifiers per pattern name.
62
+ * The property is used when type == "pattern".
63
+ * When insight has a measure that is not mapped, the pattern will be assigned according to the
64
+ * measure index, the same way as if no measure would be mapped.
65
+ */
66
+ measureToPatternName?: Record<string, PatternFillName>;
67
+ }
68
+
49
69
  /**
50
70
  * @public
51
71
  */
52
- export declare type ChartFill = "solid" | "pattern" | "outline";
72
+ export declare type ChartFillType = "solid" | "pattern" | "outline";
53
73
 
54
74
  /**
55
75
  * @internal
@@ -178,6 +198,18 @@ export declare function getLighterColor(color: string, percent: number): string;
178
198
  */
179
199
  export declare function getLighterColorFromRGB(color: IRgbColorValue, percent: number): IRgbColorValue;
180
200
 
201
+ /**
202
+ * Returns pattern fill by index.
203
+ *
204
+ * @param index - Index of pattern fill. When the index is a number, it returns a pattern matching
205
+ * the index number of the pattern array. When the index is out of bounds, the pattern fill is repeated.
206
+ * When the index is a pattern name, the matching pattern is returned. If the pattern is not found,
207
+ * the first pattern is returned.
208
+ *
209
+ * @internal
210
+ */
211
+ export declare function getPatternFill(index: number | PatternFillName): IPatternOptionsObject;
212
+
181
213
  /**
182
214
  * Returns pattern fill by index. When index is out of bounds, the pattern fill is repeated.
183
215
  * @param index - index of pattern fill
@@ -228,17 +260,6 @@ export declare function HeadlinePagination({ renderSecondaryItem, renderTertiary
228
260
  */
229
261
  export declare const HeatmapLegend: React_2.NamedExoticComponent<IHeatmapLegendProps>;
230
262
 
231
- /**
232
- * @internal
233
- */
234
- export declare interface IBaseLegendItem {
235
- name: string;
236
- color: string;
237
- legendIndex: number;
238
- yAxis: number;
239
- pointShape?: string;
240
- }
241
-
242
263
  /**
243
264
  * @internal
244
265
  */
@@ -310,7 +331,7 @@ export declare interface IFluidLegendProps {
310
331
  series: IPushpinCategoryLegendItem[];
311
332
  enableBorderRadius?: boolean | ItemBorderRadiusPredicate;
312
333
  onItemClick?(item: IPushpinCategoryLegendItem): void;
313
- chartFill?: ChartFill;
334
+ chartFill?: ChartFillType;
314
335
  }
315
336
 
316
337
  /**
@@ -321,6 +342,16 @@ export declare interface IGeoChartLegendData {
321
342
  sizeData?: number[];
322
343
  }
323
344
 
345
+ /**
346
+ * @internal
347
+ */
348
+ export declare type IGroupedSeries = IGroupedSeriesItem[];
349
+
350
+ /**
351
+ * @internal
352
+ */
353
+ export declare type IGroupedSeriesItem = ISeriesItem | ILegendGroup;
354
+
324
355
  /**
325
356
  * @internal
326
357
  */
@@ -375,6 +406,14 @@ export declare interface ILegendDetails {
375
406
  renderPopUp?: boolean;
376
407
  }
377
408
 
409
+ /**
410
+ * @internal
411
+ */
412
+ export declare type ILegendGroup = Omit<ISeriesItemAxisIndicator, "type"> & {
413
+ type: typeof LEGEND_GROUP;
414
+ items: ISeriesItem[];
415
+ };
416
+
378
417
  /**
379
418
  * @internal
380
419
  */
@@ -406,7 +445,7 @@ export declare interface ILegendProps {
406
445
  locale?: string;
407
446
  showFluidLegend?: boolean;
408
447
  enableBorderRadius?: boolean | ItemBorderRadiusPredicate;
409
- chartFill?: ChartFill;
448
+ chartFill?: ChartFillType;
410
449
  onItemClick(item: ISeriesItem): void;
411
450
  validateOverHeight(legendClient: Rect): void;
412
451
  contentDimensions: {
@@ -469,7 +508,7 @@ export declare interface IPopUpLegendProps {
469
508
  containerId: string;
470
509
  customComponent?: ReactElement | null;
471
510
  customComponentName?: string;
472
- chartFill?: ChartFill;
511
+ chartFill?: ChartFillType;
473
512
  }
474
513
 
475
514
  /**
@@ -480,7 +519,7 @@ export declare interface IPushpinCategoryLegendItem {
480
519
  uri: string;
481
520
  color?: string;
482
521
  legendIndex: number;
483
- isVisible?: boolean;
522
+ isVisible: boolean;
484
523
  }
485
524
 
486
525
  /**
@@ -497,22 +536,44 @@ export declare interface IRange {
497
536
  export declare function isCustomPalette(palette: IColorPalette): boolean;
498
537
 
499
538
  /**
500
- * The items can have many different properties, the data can come from many different sources.
501
- * The components like to use a lot of `any` for the item types, which poisons the type checking further down.
502
- * These are the keys that are definitely used in different cases, but the whole type situation here could use a lot of work.
503
- *
504
539
  * @internal
505
540
  */
506
- export declare type ISeriesItem = {
541
+ export declare type ISeriesItem = ISeriesItemMetric | ISeriesItemAxisIndicator | ISeriesItemSeparator;
542
+
543
+ /**
544
+ * @internal
545
+ */
546
+ export declare type ISeriesItemAxisIndicator = {
547
+ type: typeof LEGEND_AXIS_INDICATOR;
548
+ data?: string[];
549
+ labelKey: string;
550
+ };
551
+
552
+ /**
553
+ * @internal
554
+ */
555
+ export declare type ISeriesItemMetric = {
556
+ type?: string;
507
557
  isVisible?: boolean;
508
558
  name?: string;
509
559
  color?: string | IPatternObject;
510
- type?: string;
511
- labelKey?: string;
512
- data?: string[];
560
+ legendIndex: number;
513
561
  pointShape?: string;
562
+ yAxis?: number;
563
+ };
564
+
565
+ /**
566
+ * @internal
567
+ */
568
+ export declare type ISeriesItemSeparator = {
569
+ type: typeof LEGEND_SEPARATOR;
514
570
  };
515
571
 
572
+ /**
573
+ * @internal
574
+ */
575
+ export declare function isLegendGroup(item: IGroupedSeriesItem): item is ILegendGroup;
576
+
516
577
  /**
517
578
  * Test whether the color is a pattern object.
518
579
  * @param color - tested color object
@@ -521,6 +582,21 @@ export declare type ISeriesItem = {
521
582
  */
522
583
  export declare function isPatternObject(color: string | IPatternObject | undefined): color is IPatternObject;
523
584
 
585
+ /**
586
+ * @internal
587
+ */
588
+ export declare function isSeriesItemAxisIndicator(item: ISeriesItem): item is ISeriesItemAxisIndicator;
589
+
590
+ /**
591
+ * @internal
592
+ */
593
+ export declare function isSeriesItemMetric(item: ISeriesItem): item is ISeriesItemMetric;
594
+
595
+ /**
596
+ * @internal
597
+ */
598
+ export declare function isSeriesItemSeparator(item: ISeriesItem): item is ISeriesItemSeparator;
599
+
524
600
  /**
525
601
  * @internal
526
602
  */
@@ -537,7 +613,7 @@ export declare interface IStaticLegendProps {
537
613
  isLabelVisible?: boolean;
538
614
  onItemClick?(item: ISeriesItem): void;
539
615
  onPageChanged?: (page: number) => void;
540
- chartFill?: ChartFill;
616
+ chartFill?: ChartFillType;
541
617
  }
542
618
 
543
619
  /**
@@ -558,7 +634,22 @@ export declare const Legend: React_2.NamedExoticComponent<ILegendProps>;
558
634
  /**
559
635
  * @internal
560
636
  */
561
- export declare type LegendOptionsItemType = IBaseLegendItem | IHeatmapLegendItem;
637
+ export declare const LEGEND_AXIS_INDICATOR = "legendAxisIndicator";
638
+
639
+ /**
640
+ * @internal
641
+ */
642
+ export declare const LEGEND_GROUP = "legend-group";
643
+
644
+ /**
645
+ * @internal
646
+ */
647
+ export declare const LEGEND_SEPARATOR = "legendSeparator";
648
+
649
+ /**
650
+ * @internal
651
+ */
652
+ export declare type LegendOptionsItemType = ISeriesItemMetric | IHeatmapLegendItem;
562
653
 
563
654
  /**
564
655
  * @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-vis-commons",
3
- "version": "10.42.0-alpha.2",
3
+ "version": "10.42.0-alpha.3",
4
4
  "description": "GoodData.UI SDK - common functionality for different types of visualizations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,11 +36,11 @@
36
36
  "react-intl": "6.8.9",
37
37
  "react-measure": "^2.5.2",
38
38
  "tslib": "2.8.1",
39
- "@gooddata/sdk-backend-spi": "10.42.0-alpha.2",
40
- "@gooddata/sdk-model": "10.42.0-alpha.2",
41
- "@gooddata/sdk-ui": "10.42.0-alpha.2",
42
- "@gooddata/sdk-ui-kit": "10.42.0-alpha.2",
43
- "@gooddata/sdk-ui-theme-provider": "10.42.0-alpha.2"
39
+ "@gooddata/sdk-backend-spi": "10.42.0-alpha.3",
40
+ "@gooddata/sdk-ui": "10.42.0-alpha.3",
41
+ "@gooddata/sdk-ui-kit": "10.42.0-alpha.3",
42
+ "@gooddata/sdk-model": "10.42.0-alpha.3",
43
+ "@gooddata/sdk-ui-theme-provider": "10.42.0-alpha.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@gooddata/eslint-config": "^4.1.1",
@@ -60,6 +60,7 @@
60
60
  "dependency-cruiser": "^13.0.3",
61
61
  "eslint": "^8.57.1",
62
62
  "eslint-config-prettier": "^10.1.5",
63
+ "eslint-plugin-eslint-comments": "^3.2.0",
63
64
  "eslint-plugin-header": "^3.0.0",
64
65
  "eslint-plugin-import": "^2.22.0",
65
66
  "eslint-plugin-import-esm": "^1.2.1",
@@ -83,8 +84,8 @@
83
84
  "typescript": "5.8.3",
84
85
  "vitest": "3.2.4",
85
86
  "vitest-dom": "0.1.1",
86
- "@gooddata/reference-workspace": "10.42.0-alpha.2",
87
- "@gooddata/sdk-backend-mockingbird": "10.42.0-alpha.2"
87
+ "@gooddata/reference-workspace": "10.42.0-alpha.3",
88
+ "@gooddata/sdk-backend-mockingbird": "10.42.0-alpha.3"
88
89
  },
89
90
  "peerDependencies": {
90
91
  "react": "^16.10.0 || ^17.0.0 || ^18.0.0",
@@ -63,6 +63,10 @@ $legend-content-background: var(--gd-chart-backgroundColor, var(--gd-palette-com
63
63
  }
64
64
  }
65
65
 
66
+ .legend-group {
67
+ display: contents;
68
+ }
69
+
66
70
  .series-item,
67
71
  .series-axis-indicator {
68
72
  display: flex;
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- export interface ILegendAxisIndicatorProps {
3
- labelKey?: string;
4
- data?: string[];
5
- width?: number;
6
- }
7
- export declare const LegendAxisIndicator: React.NamedExoticComponent<ILegendAxisIndicatorProps>;
8
- //# sourceMappingURL=LegendAxisIndicator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LegendAxisIndicator.d.ts","sourceRoot":"","sources":["../../src/legend/LegendAxisIndicator.tsx"],"names":[],"mappings":"AACA,OAAO,KAAe,MAAM,OAAO,CAAC;AAMpC,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,mBAAmB,uDA0B9B,CAAC"}
@@ -1,17 +0,0 @@
1
- // (C) 2019-2025 GoodData Corporation
2
- import React, { memo } from "react";
3
- import { useIntl } from "react-intl";
4
- import { messages } from "../locales.js";
5
- export const LegendAxisIndicator = memo(function LegendAxisIndicator({ labelKey, width, data, }) {
6
- const intl = useIntl();
7
- const style = width ? { width: `${width}px` } : {};
8
- const values = (data || []).reduce((result, key, index) => {
9
- result[index] = intl.formatMessage(messages[key]);
10
- return result;
11
- }, {});
12
- return (React.createElement("div", { style: style, className: "series-axis-indicator", "aria-label": "Legend axis indicator", "data-testid": "legend-axis-indicator" },
13
- React.createElement("div", { className: "series-text" },
14
- intl.formatMessage(messages[labelKey], values),
15
- intl.formatMessage(messages["colon"]))));
16
- });
17
- //# sourceMappingURL=LegendAxisIndicator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LegendAxisIndicator.js","sourceRoot":"","sources":["../../src/legend/LegendAxisIndicator.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,mBAAmB,CAAC,EACjE,QAAQ,EACR,KAAK,EACL,IAAI,GACoB;IACxB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAmC,EAAE,GAAW,EAAE,KAAa,EAAE,EAAE;QACnG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAA4B,CAAC,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC;IAClB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,6BACI,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,uBAAuB,gBACtB,uBAAuB,iBACrB,uBAAuB;QAEpC,6BAAK,SAAS,EAAC,aAAa;YACvB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAiC,CAAC,EAAE,MAAM,CAAC;YACvE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CACpC,CACJ,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}