@gooddata/sdk-ui-vis-commons 11.44.0-alpha.2 → 11.44.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.
@@ -9,7 +9,6 @@ interface ILegendItemProps {
9
9
  onItemClick: (item: ISeriesItemMetric) => void;
10
10
  theme?: ITheme;
11
11
  chartFill?: ChartFillType;
12
- describedBy?: string;
13
12
  }
14
13
  export declare const LegendItem: import("react").ComponentType<Omit<ILegendItemProps, "theme" | "themeIsLoading" | "themeStatus">>;
15
14
  export {};
@@ -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;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAoID,eAAO,MAAM,UAAU,mGAwGrB,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;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"}
@@ -114,7 +114,7 @@ function getIconStyle(type, chartFill, color, enableBorderRadius, isVisible, poi
114
114
  };
115
115
  }
116
116
  }
117
- export const LegendItem = withTheme(function LegendItem({ item, index, width, enableBorderRadius = false, onItemClick, theme, chartFill, describedBy, }) {
117
+ export const LegendItem = withTheme(function LegendItem({ item, index, width, enableBorderRadius = false, onItemClick, theme, chartFill, }) {
118
118
  const { isFocused, id } = LegendSeriesContextStore.useContextStore((ctx) => ({
119
119
  isFocused: ctx.focusedItem === item,
120
120
  id: ctx.makeItemId(item),
@@ -149,7 +149,7 @@ export const LegendItem = withTheme(function LegendItem({ item, index, width, en
149
149
  _jsx("div", { className: "series-icon", style: iconStyle, children: item.isVisible && isPatternFill && isPatternObject(item.color) ? (_jsx(PatternFill, { patternFill: item.color?.pattern })) : null }), _jsx("div", { id: legendItemId, className: "series-name", style: nameStyle, children: item.name })
150
150
  ] }));
151
151
  }
152
- return (_jsxs("button", { ref: refCallback, "data-testid": "legend-item", role: "switch", "aria-describedby": describedBy, "aria-checked": item.isVisible, id: id, style: style, className: cx("series-item", { "series-item--isFocused": isFocused }), onClick: handleItemClick, "aria-labelledby": legendItemId, title: unescape(item.name), tabIndex: -1, children: [
152
+ return (_jsxs("button", { ref: refCallback, "data-testid": "legend-item", role: "switch", "aria-checked": item.isVisible, id: id, style: style, className: cx("series-item", { "series-item--isFocused": isFocused }), onClick: handleItemClick, "aria-labelledby": legendItemId, title: unescape(item.name), tabIndex: -1, children: [
153
153
  _jsx("div", { className: "series-icon", style: iconStyle, children: item.isVisible && isPatternFill && isPatternObject(item.color) ? (_jsx(PatternFill, { patternFill: item.color?.pattern })) : null }), _jsx("div", { id: legendItemId, className: "series-name", style: nameStyle, children: item.name })
154
154
  ] }));
155
155
  });
@@ -1 +1 @@
1
- {"version":3,"file":"LegendList.d.ts","sourceRoot":"","sources":["../../src/legend/LegendList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAIjC,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AA4CD,eAAO,MAAM,UAAU;;EA6CrB,CAAC"}
1
+ {"version":3,"file":"LegendList.d.ts","sourceRoot":"","sources":["../../src/legend/LegendList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAIjC,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,eAAe,IAAI,YAAY,CAE9C;AAyCD,eAAO,MAAM,UAAU;;EA8BrB,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // (C) 2007-2026 GoodData Corporation
3
- import { memo, useRef } from "react";
4
- import { LegendSeriesContextStore } from "./context.js";
3
+ import { memo } from "react";
5
4
  import { groupSeries } from "./helpers.js";
6
5
  import { LegendGroup } from "./LegendGroup.js";
7
6
  import { LegendItem } from "./LegendItem.js";
@@ -9,35 +8,23 @@ import { isLegendGroup, isSeriesItemMetric, isSeriesItemSeparator, } from "./typ
9
8
  export function LegendSeparator() {
10
9
  return _jsx("div", { className: "legend-separator", "data-testid": "legend-separator", "aria-hidden": true });
11
10
  }
12
- const LegendListItem = memo(function LegendListItem({ index, item, enableBorderRadius, width, describedBy, onItemClick, chartFill, }) {
11
+ const LegendListItem = memo(function LegendListItem({ index, item, enableBorderRadius, width, onItemClick, chartFill, }) {
13
12
  const borderRadius = shouldItemHaveBorderRadius(item, enableBorderRadius);
14
13
  if (isSeriesItemSeparator(item)) {
15
14
  return _jsx(LegendSeparator, {}, index);
16
15
  }
17
16
  if (isSeriesItemMetric(item)) {
18
- return (_jsx("div", { style: { display: "contents" }, role: "listitem", children: _jsx(LegendItem, { index: index, enableBorderRadius: borderRadius, item: item, width: width, onItemClick: onItemClick, describedBy: describedBy, chartFill: chartFill }, index) }));
17
+ return (_jsx("div", { style: { display: "contents" }, role: "listitem", children: _jsx(LegendItem, { index: index, enableBorderRadius: borderRadius, item: item, width: width, onItemClick: onItemClick, chartFill: chartFill }, index) }));
19
18
  }
20
19
  return null;
21
20
  });
22
21
  export const LegendList = memo(function LegendList({ series, enableBorderRadius, onItemClick, width, chartFill, }) {
23
- const descriptionId = LegendSeriesContextStore.useContextStore((ctx) => ctx.descriptionId);
24
- // Only the first item should have aria-describedby
25
- const hasRenderedDescription = useRef(false);
26
- function Item({ item }) {
27
- let shouldHaveDescription = false;
28
- if (isSeriesItemMetric(item) && item.isVisible && !hasRenderedDescription.current) {
29
- shouldHaveDescription = true;
30
- hasRenderedDescription.current = true;
31
- }
32
- return (_jsx(LegendListItem, { index: series.indexOf(item), item: item, enableBorderRadius: enableBorderRadius, width: width, onItemClick: onItemClick, chartFill: chartFill, describedBy: shouldHaveDescription ? descriptionId : undefined }));
33
- }
22
+ const renderItem = (item, key) => (_jsx(LegendListItem, { index: series.indexOf(item), item: item, enableBorderRadius: enableBorderRadius, width: width, onItemClick: onItemClick, chartFill: chartFill }, key));
34
23
  return groupSeries(series).map((seriesItem, seriesIndex) => {
35
24
  if (isLegendGroup(seriesItem)) {
36
- return (_jsx(LegendGroup, { item: seriesItem, width: width, children: seriesItem.items.map((item, index) => {
37
- return _jsx(Item, { item: item }, `item-${index}`);
38
- }) }, `group-${seriesIndex}`));
25
+ return (_jsx(LegendGroup, { item: seriesItem, width: width, children: seriesItem.items.map((item, index) => renderItem(item, `item-${index}`)) }, `group-${seriesIndex}`));
39
26
  }
40
- return _jsx(Item, { item: seriesItem }, `item-${seriesIndex}`);
27
+ return renderItem(seriesItem, `item-${seriesIndex}`);
41
28
  });
42
29
  });
43
30
  function shouldItemHaveBorderRadius(item, enableBorderRadius = false) {
@@ -1 +1 @@
1
- {"version":3,"file":"LegendSeries.d.ts","sourceRoot":"","sources":["../../src/legend/LegendSeries.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,aAAa,EAGlB,KAAK,SAAS,EAIjB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,YAAY,CAAC;AAGlE,UAAU,kBAAkB;IACxB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,4GA0GvB,CAAC"}
1
+ {"version":3,"file":"LegendSeries.d.ts","sourceRoot":"","sources":["../../src/legend/LegendSeries.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,aAAa,EAGlB,KAAK,SAAS,EAIjB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,YAAY,CAAC;AAGlE,UAAU,kBAAkB;IACxB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,4GAsGvB,CAAC"}
@@ -1,8 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // (C) 2025 GoodData Corporation
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // (C) 2025-2026 GoodData Corporation
3
3
  import { forwardRef, useMemo, useState, } from "react";
4
4
  import cx from "classnames";
5
- import { FormattedMessage, useIntl } from "react-intl";
5
+ import { useIntl } from "react-intl";
6
6
  import { useAutoupdateRef } from "@gooddata/sdk-ui";
7
7
  import { makeLinearKeyboardNavigation, useIdPrefixed } from "@gooddata/sdk-ui-kit";
8
8
  import { LegendSeriesContextStore, VisibilityContext, useLegendSeriesContextValue } from "./context.js";
@@ -31,7 +31,7 @@ export const LegendSeries = forwardRef(function LegendSeries({ series, label, st
31
31
  id,
32
32
  focusedIndex,
33
33
  });
34
- const { makeItemId, descriptionId } = legendContextValue;
34
+ const { makeItemId } = legendContextValue;
35
35
  // Initialize visibility detection for legend items
36
36
  const { viewportRefCallback, contextValue: visibilityContextValue } = useVisibilityDetection();
37
37
  const keyDownDepsRef = useAutoupdateRef({
@@ -64,11 +64,9 @@ export const LegendSeries = forwardRef(function LegendSeries({ series, label, st
64
64
  onToggleItem(series[focusedIndex]);
65
65
  },
66
66
  }), [keyDownDepsRef, visibilityContextValue, focusableIndicesMap]);
67
- return (_jsx(LegendSeriesContextStore, { value: legendContextValue, children: _jsx(VisibilityContext.Provider, { value: visibilityContextValue, children: _jsxs("div", { className: cx("series-wrapper legend-series-wrapper", className), role: "group", "aria-activedescendant": makeItemId(series[focusedIndex]), tabIndex: 0, onKeyDown: handleKeyDown, ref: viewportRefCallback, children: [
68
- _jsx("div", { className: "series legend-series", role: "list", "aria-label": label
69
- ? formatMessage({ id: "properties.legend.series.named" }, { name: label })
70
- : formatMessage({ id: "properties.legend.series.unnamed" }), style: style, ref: ref, children: children }), _jsx("p", { id: descriptionId, className: "sr-only", children: _jsx(FormattedMessage, { id: "properties.legend.series.item.description" }) })
71
- ] }) }) }));
67
+ return (_jsx(LegendSeriesContextStore, { value: legendContextValue, children: _jsx(VisibilityContext.Provider, { value: visibilityContextValue, children: _jsx("div", { className: cx("series-wrapper legend-series-wrapper", className), role: "group", "aria-activedescendant": makeItemId(series[focusedIndex]), tabIndex: 0, onKeyDown: handleKeyDown, ref: viewportRefCallback, children: _jsx("div", { className: "series legend-series", role: "list", "aria-label": label
68
+ ? formatMessage({ id: "properties.legend.series.named" }, { name: label })
69
+ : formatMessage({ id: "properties.legend.series.unnamed" }), style: style, ref: ref, children: children }) }) }) }));
72
70
  });
73
71
  // Helper functions for finding visible items using original indices
74
72
  const findFirstVisibleOriginal = (focusableIndicesMap, isVisible) => {
@@ -6,12 +6,10 @@ export declare const useLegendSeriesContextValue: ({ series, focusedIndex, id, }
6
6
  }) => {
7
7
  focusedItem: ISeriesItem;
8
8
  makeItemId: (item?: ISeriesItem | undefined) => string | undefined;
9
- descriptionId: string;
10
9
  };
11
10
  export declare const LegendSeriesContextStore: import("@gooddata/sdk-ui").IContextStore<{
12
11
  focusedItem: ISeriesItem;
13
12
  makeItemId: (item?: ISeriesItem | undefined) => string | undefined;
14
- descriptionId: string;
15
13
  }>;
16
14
  /**
17
15
  * Context for tracking visibility of legend items
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/legend/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,2BAA2B;;;;;;;;CAwBvC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;EACiD,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACnE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oDAAiD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0BAM7B,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/legend/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,2BAA2B;;;;;;;CAqBvC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;EACiD,CAAC;AAEvF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACnE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oDAAiD,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0BAM7B,CAAC"}
@@ -1,14 +1,12 @@
1
- // (C) 2025 GoodData Corporation
1
+ // (C) 2025-2026 GoodData Corporation
2
2
  import { createContext, useCallback, useContext, useMemo } from "react";
3
3
  import { createContextStore } from "@gooddata/sdk-ui";
4
4
  export const useLegendSeriesContextValue = ({ series, focusedIndex, id, }) => {
5
- const descriptionId = `${id}-description`;
6
5
  const makeItemId = useCallback((item) => item && `${id}-${series.indexOf(item)}`, [id, series]);
7
6
  return useMemo(() => ({
8
7
  focusedItem: series[focusedIndex],
9
8
  makeItemId,
10
- descriptionId,
11
- }), [descriptionId, focusedIndex, makeItemId, series]);
9
+ }), [focusedIndex, makeItemId, series]);
12
10
  };
13
11
  export const LegendSeriesContextStore = createContextStore("LegendSeries");
14
12
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-vis-commons",
3
- "version": "11.44.0-alpha.2",
3
+ "version": "11.44.0",
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.44.0-alpha.2",
40
- "@gooddata/sdk-ui": "11.44.0-alpha.2",
41
- "@gooddata/sdk-ui-kit": "11.44.0-alpha.2",
42
- "@gooddata/sdk-ui-theme-provider": "11.44.0-alpha.2",
43
- "@gooddata/sdk-backend-spi": "11.44.0-alpha.2"
39
+ "@gooddata/sdk-backend-spi": "11.44.0",
40
+ "@gooddata/sdk-model": "11.44.0",
41
+ "@gooddata/sdk-ui-kit": "11.44.0",
42
+ "@gooddata/sdk-ui": "11.44.0",
43
+ "@gooddata/sdk-ui-theme-provider": "11.44.0"
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.44.0-alpha.2",
85
- "@gooddata/oxlint-config": "11.44.0-alpha.2",
86
- "@gooddata/reference-workspace": "11.44.0-alpha.2",
87
- "@gooddata/stylelint-config": "11.44.0-alpha.2",
88
- "@gooddata/sdk-backend-mockingbird": "11.44.0-alpha.2"
84
+ "@gooddata/eslint-config": "11.44.0",
85
+ "@gooddata/oxlint-config": "11.44.0",
86
+ "@gooddata/reference-workspace": "11.44.0",
87
+ "@gooddata/sdk-backend-mockingbird": "11.44.0",
88
+ "@gooddata/stylelint-config": "11.44.0"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^18.0.0 || ^19.0.0",