@gooddata/sdk-ui-vis-commons 11.47.0-alpha.0 → 11.47.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export { ColorLegend, type IColorLegendProps } from "./legend/ColorLegend.js";
20
20
  export { Paging, type IPagingProps, type ButtonsOrientationType } from "./legend/Paging.js";
21
21
  export { HeadlinePagination, type IHeadlinePaginationProps } from "./compactSize/HeadlinePagination.js";
22
22
  export { formatLegendLabel, shouldShowFluid, FLUID_LEGEND_THRESHOLD } from "./legend/helpers.js";
23
+ export { POINT_SHAPE_POLYGONS, CUSTOM_POINT_SHAPES, getPointShapeClipPath, getPointShapeSvgPath, } from "./legend/pointShapes.js";
23
24
  export { type PositionType, type IColorLegendItem, type IGeoCategoryLegendItem, type IGeoChartLegendData, type IHeatmapLegendItem, type ILegendOptions, type IPushpinCategoryLegendItem, type IRange, type LegendOptionsItemType, type ItemBorderRadiusPredicate, type IColorLegendSize, type ISeriesItem, type ILegendGroup, type IGroupedSeries, type IGroupedSeriesItem, type ISeriesItemMetric, type ISeriesItemSeparator, type ISeriesItemAxisIndicator, DEFAULT_LEGEND_CONFIG, LegendPosition, SupportedLegendPositions, isLegendGroup, isSeriesItemMetric, isSeriesItemSeparator, isSeriesItemAxisIndicator, LEGEND_AXIS_INDICATOR, LEGEND_SEPARATOR, LEGEND_GROUP, } from "./legend/types.js";
24
25
  export { fixEmptyHeaderItems } from "./utils/fixEmptyHeaderItems.js";
25
26
  export { valueWithEmptyHandling } from "./utils/valueWithEmptyHandling.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACH,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,iCAAiC,EACt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,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EACH,gBAAgB,EAChB,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,GACrC,MAAM,+CAA+C,CAAC"}
package/esm/index.js CHANGED
@@ -21,6 +21,7 @@ export { ColorLegend } from "./legend/ColorLegend.js";
21
21
  export { Paging } from "./legend/Paging.js";
22
22
  export { HeadlinePagination } from "./compactSize/HeadlinePagination.js";
23
23
  export { formatLegendLabel, shouldShowFluid, FLUID_LEGEND_THRESHOLD } from "./legend/helpers.js";
24
+ export { POINT_SHAPE_POLYGONS, CUSTOM_POINT_SHAPES, getPointShapeClipPath, getPointShapeSvgPath, } from "./legend/pointShapes.js";
24
25
  export { DEFAULT_LEGEND_CONFIG, LegendPosition, SupportedLegendPositions, isLegendGroup, isSeriesItemMetric, isSeriesItemSeparator, isSeriesItemAxisIndicator, LEGEND_AXIS_INDICATOR, LEGEND_SEPARATOR, LEGEND_GROUP, } from "./legend/types.js";
25
26
  export { fixEmptyHeaderItems } from "./utils/fixEmptyHeaderItems.js";
26
27
  export { valueWithEmptyHandling } from "./utils/valueWithEmptyHandling.js";
@@ -1 +1 @@
1
- {"version":3,"file":"LegendItem.d.ts","sourceRoot":"","sources":["../../src/legend/LegendItem.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,sBAAsB,CAAC;AAG/E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,UAAU,gBAAgB;IACtB,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,aAAa,CAAC;CAC7B;AAoID,eAAO,MAAM,UAAU,mGAsGrB,CAAC"}
1
+ {"version":3,"file":"LegendItem.d.ts","sourceRoot":"","sources":["../../src/legend/LegendItem.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,sBAAsB,CAAC;AAI/E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,UAAU,gBAAgB;IACtB,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,aAAa,CAAC;CAC7B;AAqFD,eAAO,MAAM,UAAU,mGAsGrB,CAAC"}
@@ -8,6 +8,7 @@ import { withTheme } from "@gooddata/sdk-ui-theme-provider";
8
8
  import { getDarkerColor, isPatternObject } from "../coloring/color.js";
9
9
  import { PatternFill } from "../coloring/PatternFill.js";
10
10
  import { LegendSeriesContextStore, useItemVisibility } from "./context.js";
11
+ import { getPointShapeClipPath } from "./pointShapes.js";
11
12
  const DEFAULT_DISABLED_COLOR = "#CCCCCC";
12
13
  function getPointShapeStyles(pointShape, iconSize, enableBorderRadius) {
13
14
  if (!pointShape) {
@@ -26,14 +27,6 @@ function getPointShapeStyles(pointShape, iconSize, enableBorderRadius) {
26
27
  width: `${Math.round(iconSize * 0.7)}px`,
27
28
  height: `${Math.round(iconSize * 0.7)}px`,
28
29
  };
29
- case "triangle":
30
- case "triangle-down":
31
- return {
32
- borderRadius: "0",
33
- width: "0",
34
- height: "0",
35
- backgroundColor: "transparent",
36
- };
37
30
  case "circle":
38
31
  default:
39
32
  return {
@@ -41,62 +34,30 @@ function getPointShapeStyles(pointShape, iconSize, enableBorderRadius) {
41
34
  };
42
35
  }
43
36
  }
44
- function getTrianglePointShapesStyles(pointShape, chartFill, triangleColor, iconSize) {
45
- const isTriangle = pointShape === "triangle" || pointShape === "triangle-down";
46
- if (!isTriangle) {
47
- return {};
48
- }
49
- const triangleStyles = {
50
- width: `${iconSize}px`,
51
- height: `${iconSize}px`,
52
- };
53
- // For pattern and outline fills, we need actual area for content/border
54
- // Use clip-path method for these cases
55
- if (chartFill === "pattern" || chartFill === "outline") {
56
- if (pointShape === "triangle") {
57
- triangleStyles.clipPath = "polygon(50% 0%, 0% 100%, 100% 100%)";
58
- }
59
- else if (pointShape === "triangle-down") {
60
- triangleStyles.clipPath = "polygon(0% 0%, 100% 0%, 50% 100%)";
61
- }
62
- }
63
- else {
64
- // Use border method for solid fills only - ensure clip-path is reset
65
- triangleStyles.clipPath = "none";
66
- if (pointShape === "triangle") {
67
- triangleStyles.borderLeft = `${iconSize / 2}px solid transparent`;
68
- triangleStyles.borderRight = `${iconSize / 2}px solid transparent`;
69
- triangleStyles.borderBottom = `${iconSize}px solid ${triangleColor}`;
70
- triangleStyles.borderTop = "none";
71
- }
72
- else if (pointShape === "triangle-down") {
73
- triangleStyles.borderLeft = `${iconSize / 2}px solid transparent`;
74
- triangleStyles.borderRight = `${iconSize / 2}px solid transparent`;
75
- triangleStyles.borderTop = `${iconSize}px solid ${triangleColor}`;
76
- triangleStyles.borderBottom = "none";
77
- }
78
- }
79
- return triangleStyles;
80
- }
81
37
  function getIconStyle(type, chartFill, color, enableBorderRadius, isVisible, pointShape) {
82
38
  // line and bullet target series should always be solid
83
39
  const appliedChartFill = type === "line" || type === "bullet" ? "solid" : chartFill;
84
40
  // use default color if color is not provided (this should not happen at this stage)
85
41
  const baseColor = (isPatternObject(color) ? color.pattern.color : color) ?? DEFAULT_DISABLED_COLOR;
86
42
  const iconSize = 9;
87
- // For triangles, we need special CSS border handling to create the triangle shape
88
- const isTriangle = pointShape === "triangle" || pointShape === "triangle-down";
89
- const baseCssProps = {
90
- ...getPointShapeStyles(pointShape, iconSize, enableBorderRadius),
91
- ...getTrianglePointShapesStyles(pointShape, appliedChartFill, baseColor, iconSize),
92
- };
43
+ // Polygonal shapes (triangles, star, pentagon, cross, ...) are rendered with a CSS clip-path
44
+ // derived from the same normalized geometry as the Highcharts markers; the fill mode is
45
+ // applied by the switch below.
46
+ const clipPath = getPointShapeClipPath(pointShape);
47
+ const baseCssProps = clipPath
48
+ ? {
49
+ clipPath,
50
+ width: `${iconSize}px`,
51
+ height: `${iconSize}px`,
52
+ }
53
+ : getPointShapeStyles(pointShape, iconSize, enableBorderRadius);
93
54
  switch (appliedChartFill) {
94
55
  case "pattern":
95
56
  return {
96
57
  ...baseCssProps,
97
58
  color: baseColor,
98
- // Don't override triangle borders
99
- border: isTriangle ? undefined : `1px solid ${baseColor}`,
59
+ // a border on clip-path shapes would be clipped away
60
+ border: clipPath ? undefined : `1px solid ${baseColor}`,
100
61
  position: "relative",
101
62
  backgroundColor: isVisible ? "transparent" : baseColor,
102
63
  };
@@ -110,7 +71,7 @@ function getIconStyle(type, chartFill, color, enableBorderRadius, isVisible, poi
110
71
  default:
111
72
  return {
112
73
  ...baseCssProps,
113
- backgroundColor: isTriangle ? "transparent" : baseColor,
74
+ backgroundColor: baseColor,
114
75
  };
115
76
  }
116
77
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Polygonal point-shape geometry shared by chart markers and legend icons.
3
+ *
4
+ * @remarks
5
+ * Highcharts ships only five marker symbols ("circle", "square", "diamond", "triangle",
6
+ * "triangle-down"). Any other symbol name handed to a marker silently falls back to "circle".
7
+ * To support the full documented set of point shapes we describe each polygonal shape as a polygon
8
+ * in a normalized 0..1 box (origin top-left, y pointing down) and derive both the Highcharts SVG
9
+ * marker path and the legend CSS `clip-path` from the same geometry so chart markers and legend
10
+ * icons always match. The built-in "triangle" and "triangle-down" are included for the legend
11
+ * `clip-path` only — they are never registered as custom Highcharts symbols.
12
+ *
13
+ * @internal
14
+ */
15
+ export declare const POINT_SHAPE_POLYGONS: Record<string, ReadonlyArray<readonly [number, number]>>;
16
+ /**
17
+ * Names of the custom (non built-in) point-shape symbols to register on the Highcharts renderer.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare const CUSTOM_POINT_SHAPES: string[];
22
+ /**
23
+ * Returns a CSS `clip-path` polygon for a polygonal point shape (including the built-in triangles),
24
+ * or `undefined` when the shape has no polygon geometry (circle/square/diamond) and is handled by
25
+ * plain CSS elsewhere.
26
+ *
27
+ * @internal
28
+ */
29
+ export declare function getPointShapeClipPath(pointShape: string | undefined): string | undefined;
30
+ /**
31
+ * Builds a Highcharts SVG marker path (array of path segments) for a custom point shape within the
32
+ * bounding box defined by `x`, `y`, `width`, `height`. Returns `undefined` for unknown / built-in
33
+ * shapes so callers can defer to Highcharts.
34
+ *
35
+ * @internal
36
+ */
37
+ export declare function getPointShapeSvgPath(pointShape: string, x: number, y: number, width: number, height: number): Array<Array<string | number>> | undefined;
38
+ //# sourceMappingURL=pointShapes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointShapes.d.ts","sourceRoot":"","sources":["../../src/legend/pointShapes.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqGzF,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAEvC,CAAC;AAMF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAYxF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,MAAM,EAClB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACf,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,GAAG,SAAS,CAU3C"}
@@ -0,0 +1,162 @@
1
+ // (C) 2026 GoodData Corporation
2
+ /**
3
+ * Polygonal point-shape geometry shared by chart markers and legend icons.
4
+ *
5
+ * @remarks
6
+ * Highcharts ships only five marker symbols ("circle", "square", "diamond", "triangle",
7
+ * "triangle-down"). Any other symbol name handed to a marker silently falls back to "circle".
8
+ * To support the full documented set of point shapes we describe each polygonal shape as a polygon
9
+ * in a normalized 0..1 box (origin top-left, y pointing down) and derive both the Highcharts SVG
10
+ * marker path and the legend CSS `clip-path` from the same geometry so chart markers and legend
11
+ * icons always match. The built-in "triangle" and "triangle-down" are included for the legend
12
+ * `clip-path` only — they are never registered as custom Highcharts symbols.
13
+ *
14
+ * @internal
15
+ */
16
+ export const POINT_SHAPE_POLYGONS = {
17
+ triangle: [
18
+ [0.5, 0],
19
+ [1, 1],
20
+ [0, 1],
21
+ ],
22
+ "triangle-down": [
23
+ [0, 0],
24
+ [1, 0],
25
+ [0.5, 1],
26
+ ],
27
+ // alias of the built-in "triangle" so the documented "triangle-up" name renders too
28
+ "triangle-up": [
29
+ [0.5, 0],
30
+ [1, 1],
31
+ [0, 1],
32
+ ],
33
+ "triangle-left": [
34
+ [0, 0.5],
35
+ [1, 0],
36
+ [1, 1],
37
+ ],
38
+ "triangle-right": [
39
+ [0, 0],
40
+ [1, 0.5],
41
+ [0, 1],
42
+ ],
43
+ pentagon: [
44
+ [0.5, 0],
45
+ [0.9755, 0.3455],
46
+ [0.7939, 0.9045],
47
+ [0.2061, 0.9045],
48
+ [0.0245, 0.3455],
49
+ ],
50
+ hexagon: [
51
+ [0.25, 0],
52
+ [0.75, 0],
53
+ [1, 0.5],
54
+ [0.75, 1],
55
+ [0.25, 1],
56
+ [0, 0.5],
57
+ ],
58
+ octagon: [
59
+ [0.3, 0],
60
+ [0.7, 0],
61
+ [1, 0.3],
62
+ [1, 0.7],
63
+ [0.7, 1],
64
+ [0.3, 1],
65
+ [0, 0.7],
66
+ [0, 0.3],
67
+ ],
68
+ star: [
69
+ [0.5, 0],
70
+ [0.6176, 0.3382],
71
+ [0.9755, 0.3455],
72
+ [0.6902, 0.5618],
73
+ [0.7939, 0.9045],
74
+ [0.5, 0.7],
75
+ [0.2061, 0.9045],
76
+ [0.3098, 0.5618],
77
+ [0.0245, 0.3455],
78
+ [0.3824, 0.3382],
79
+ ],
80
+ plus: [
81
+ [0.35, 0],
82
+ [0.65, 0],
83
+ [0.65, 0.35],
84
+ [1, 0.35],
85
+ [1, 0.65],
86
+ [0.65, 0.65],
87
+ [0.65, 1],
88
+ [0.35, 1],
89
+ [0.35, 0.65],
90
+ [0, 0.65],
91
+ [0, 0.35],
92
+ [0.35, 0.35],
93
+ ],
94
+ cross: [
95
+ [0.2, 0],
96
+ [0.5, 0.3],
97
+ [0.8, 0],
98
+ [1, 0.2],
99
+ [0.7, 0.5],
100
+ [1, 0.8],
101
+ [0.8, 1],
102
+ [0.5, 0.7],
103
+ [0.2, 1],
104
+ [0, 0.8],
105
+ [0.3, 0.5],
106
+ [0, 0.2],
107
+ ],
108
+ arrow: [
109
+ [0.5, 0],
110
+ [1, 0.5],
111
+ [0.7, 0.5],
112
+ [0.7, 1],
113
+ [0.3, 1],
114
+ [0.3, 0.5],
115
+ [0, 0.5],
116
+ ],
117
+ };
118
+ const HIGHCHARTS_BUILT_IN_POINT_SHAPES = ["circle", "square", "diamond", "triangle", "triangle-down"];
119
+ /**
120
+ * Names of the custom (non built-in) point-shape symbols to register on the Highcharts renderer.
121
+ *
122
+ * @internal
123
+ */
124
+ export const CUSTOM_POINT_SHAPES = Object.keys(POINT_SHAPE_POLYGONS).filter((shape) => !HIGHCHARTS_BUILT_IN_POINT_SHAPES.includes(shape));
125
+ function roundPercent(value) {
126
+ return Math.round(value * 10000) / 100;
127
+ }
128
+ /**
129
+ * Returns a CSS `clip-path` polygon for a polygonal point shape (including the built-in triangles),
130
+ * or `undefined` when the shape has no polygon geometry (circle/square/diamond) and is handled by
131
+ * plain CSS elsewhere.
132
+ *
133
+ * @internal
134
+ */
135
+ export function getPointShapeClipPath(pointShape) {
136
+ if (!pointShape) {
137
+ return undefined;
138
+ }
139
+ const polygon = POINT_SHAPE_POLYGONS[pointShape];
140
+ if (!polygon) {
141
+ return undefined;
142
+ }
143
+ const points = polygon.map(([x, y]) => `${roundPercent(x)}% ${roundPercent(y)}%`).join(", ");
144
+ return `polygon(${points})`;
145
+ }
146
+ /**
147
+ * Builds a Highcharts SVG marker path (array of path segments) for a custom point shape within the
148
+ * bounding box defined by `x`, `y`, `width`, `height`. Returns `undefined` for unknown / built-in
149
+ * shapes so callers can defer to Highcharts.
150
+ *
151
+ * @internal
152
+ */
153
+ export function getPointShapeSvgPath(pointShape, x, y, width, height) {
154
+ const polygon = POINT_SHAPE_POLYGONS[pointShape];
155
+ if (!polygon) {
156
+ return undefined;
157
+ }
158
+ return [
159
+ ...polygon.map(([nx, ny], index) => [index === 0 ? "M" : "L", x + nx * width, y + ny * height]),
160
+ ["Z"],
161
+ ];
162
+ }
@@ -156,6 +156,13 @@ export declare const ColorUtils: {
156
156
  */
157
157
  export declare function composeCustomTooltipSectionHtml(content: string, inChartValues: IResolvedReferenceValues, externalValues: IResolvedReferenceValues, localizedStrings: ITooltipLocalizedStrings): string;
158
158
 
159
+ /**
160
+ * Names of the custom (non built-in) point-shape symbols to register on the Highcharts renderer.
161
+ *
162
+ * @internal
163
+ */
164
+ export declare const CUSTOM_POINT_SHAPES: string[];
165
+
159
166
  /**
160
167
  * Placement of the custom tooltip section relative to the default tooltip content.
161
168
  *
@@ -288,6 +295,24 @@ export declare function getPatternFillByIndex(index: number): IPatternOptionsObj
288
295
  */
289
296
  export declare function getPatternFillByName(name: PatternFillName): IPatternOptionsObject | undefined;
290
297
 
298
+ /**
299
+ * Returns a CSS `clip-path` polygon for a polygonal point shape (including the built-in triangles),
300
+ * or `undefined` when the shape has no polygon geometry (circle/square/diamond) and is handled by
301
+ * plain CSS elsewhere.
302
+ *
303
+ * @internal
304
+ */
305
+ export declare function getPointShapeClipPath(pointShape: string | undefined): string | undefined;
306
+
307
+ /**
308
+ * Builds a Highcharts SVG marker path (array of path segments) for a custom point shape within the
309
+ * bounding box defined by `x`, `y`, `width`, `height`. Returns `undefined` for unknown / built-in
310
+ * shapes so callers can defer to Highcharts.
311
+ *
312
+ * @internal
313
+ */
314
+ export declare function getPointShapeSvgPath(pointShape: string, x: number, y: number, width: number, height: number): Array<Array<string | number>> | undefined;
315
+
291
316
  /**
292
317
  * @internal
293
318
  */
@@ -1019,6 +1044,22 @@ export declare function PatternFill({ patternFill }: IPatternFillProps): JSX.Ele
1019
1044
  */
1020
1045
  export declare type PatternFillName = (typeof PATTERN_FILLS)[number]["name"];
1021
1046
 
1047
+ /**
1048
+ * Polygonal point-shape geometry shared by chart markers and legend icons.
1049
+ *
1050
+ * @remarks
1051
+ * Highcharts ships only five marker symbols ("circle", "square", "diamond", "triangle",
1052
+ * "triangle-down"). Any other symbol name handed to a marker silently falls back to "circle".
1053
+ * To support the full documented set of point shapes we describe each polygonal shape as a polygon
1054
+ * in a normalized 0..1 box (origin top-left, y pointing down) and derive both the Highcharts SVG
1055
+ * marker path and the legend CSS `clip-path` from the same geometry so chart markers and legend
1056
+ * icons always match. The built-in "triangle" and "triangle-down" are included for the legend
1057
+ * `clip-path` only — they are never registered as custom Highcharts symbols.
1058
+ *
1059
+ * @internal
1060
+ */
1061
+ export declare const POINT_SHAPE_POLYGONS: Record<string, ReadonlyArray<readonly [number, number]>>;
1062
+
1022
1063
  /**
1023
1064
  * @internal
1024
1065
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-vis-commons",
3
- "version": "11.47.0-alpha.0",
3
+ "version": "11.47.0-alpha.2",
4
4
  "description": "GoodData.UI SDK - common functionality for different types of visualizations",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -36,11 +36,11 @@
36
36
  "react-intl": "7.1.11",
37
37
  "react-measure": "^2.5.2",
38
38
  "tslib": "2.8.1",
39
- "@gooddata/sdk-model": "11.47.0-alpha.0",
40
- "@gooddata/sdk-backend-spi": "11.47.0-alpha.0",
41
- "@gooddata/sdk-ui": "11.47.0-alpha.0",
42
- "@gooddata/sdk-ui-kit": "11.47.0-alpha.0",
43
- "@gooddata/sdk-ui-theme-provider": "11.47.0-alpha.0"
39
+ "@gooddata/sdk-backend-spi": "11.47.0-alpha.2",
40
+ "@gooddata/sdk-model": "11.47.0-alpha.2",
41
+ "@gooddata/sdk-ui": "11.47.0-alpha.2",
42
+ "@gooddata/sdk-ui-theme-provider": "11.47.0-alpha.2",
43
+ "@gooddata/sdk-ui-kit": "11.47.0-alpha.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@microsoft/api-documenter": "^7.17.0",
@@ -81,11 +81,11 @@
81
81
  "typescript": "5.9.3",
82
82
  "vitest": "4.1.8",
83
83
  "vitest-dom": "0.1.1",
84
- "@gooddata/eslint-config": "11.47.0-alpha.0",
85
- "@gooddata/oxlint-config": "11.47.0-alpha.0",
86
- "@gooddata/reference-workspace": "11.47.0-alpha.0",
87
- "@gooddata/sdk-backend-mockingbird": "11.47.0-alpha.0",
88
- "@gooddata/stylelint-config": "11.47.0-alpha.0"
84
+ "@gooddata/eslint-config": "11.47.0-alpha.2",
85
+ "@gooddata/oxlint-config": "11.47.0-alpha.2",
86
+ "@gooddata/sdk-backend-mockingbird": "11.47.0-alpha.2",
87
+ "@gooddata/reference-workspace": "11.47.0-alpha.2",
88
+ "@gooddata/stylelint-config": "11.47.0-alpha.2"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^18.0.0 || ^19.0.0",