@cloudscape-design/chart-components 1.0.66 → 1.0.68

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.
@@ -18,7 +18,7 @@ export class ChartExtraHighlight {
18
18
  for (const s of this.context.chart().series) {
19
19
  // In pie charts it is the points, not series, that are shown in the legend, and can be highlighted.
20
20
  if (s.type === "pie") {
21
- for (const p of s.data) {
21
+ for (const p of getSeriesData(s.data)) {
22
22
  if (itemIds.includes(getPointId(p))) {
23
23
  this.setPointState(p, "hover");
24
24
  }
@@ -47,7 +47,7 @@ export class ChartExtraHighlight {
47
47
  // For column series we ensure only one group/stack that matches selected X is highlighted.
48
48
  // See: https://github.com/highcharts/highcharts/issues/23076.
49
49
  if (s.type === "column") {
50
- for (const d of s.data) {
50
+ for (const d of getSeriesData(s.data)) {
51
51
  this.setPointState(d, includedPoints.has(d) ? "" : "inactive");
52
52
  }
53
53
  }
@@ -62,14 +62,14 @@ export class ChartExtraHighlight {
62
62
  // For pie charts it is important that the hover actions comes last, as otherwise the segment's highlight "halo"
63
63
  // is removed whenever any segment is made inactive.
64
64
  if (s.type === "pie") {
65
- for (const d of s.data) {
65
+ for (const d of getSeriesData(s.data)) {
66
66
  this.setPointState(d, "inactive");
67
67
  }
68
68
  this.setPointState(point, "hover");
69
69
  }
70
70
  // For column series we ensure only one group/stack that matches selected X is highlighted.
71
71
  else if (s.type === "column") {
72
- for (const d of s.data) {
72
+ for (const d of getSeriesData(s.data)) {
73
73
  this.setPointState(d, d === point ? "hover" : "inactive");
74
74
  }
75
75
  }
@@ -87,7 +87,7 @@ export class ChartExtraHighlight {
87
87
  var _a;
88
88
  for (const s of (_a = this.context.chart().series) !== null && _a !== void 0 ? _a : []) {
89
89
  this.setSeriesState(s, "");
90
- for (const p of s.data) {
90
+ for (const p of getSeriesData(s.data)) {
91
91
  this.setPointState(p, "");
92
92
  }
93
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-highlight.js","s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A,EAAA,CACtF,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAuB,EAAE,EAA6D;;IAC9G,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,sEAAsE;QACtE,IAAI,mBAAmB,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,IAA+B,EAAE,EAAE;gBACjE,wFAAwF;gBACxF,oFAAoF;gBACpF,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;oBACpB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { getSeriesData } from \"../../internal/utils/series-data\";\nimport { getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst SET_STATE_LOCK = Symbol(\"awsui-set-state-lock\");\n\ntype SeriesSetStateWithLock = Highcharts.Series[\"setState\"] & { [SET_STATE_LOCK]: boolean };\ntype PointSetStateWithLock = Highcharts.Point[\"setState\"] & { [SET_STATE_LOCK]: boolean };\n\n// Chart helper that mutes Highcharts default highlighting behavior and offers custom methods\n// for customized control over series and points highlighting.\nexport class ChartExtraHighlight {\n private context: ChartExtraContext;\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n // We keep track of the previously highlighted series and points to recover highlight state if needed.\n // The recover is necessary if the chart was re-rendered while the highlighting is set. For example,\n // when triggered a state update from the consumer-provided tooltip footer action.\n private seriesState = new Map<string, \"\" | Highcharts.SeriesStateValue>();\n private pointState = new Map<string, Map<string, \"\" | Highcharts.PointStateValue>>();\n\n public onChartRender() {\n this.overrideStateSetters();\n this.restoreHighlightState();\n }\n\n // The method highlights specified series or points (by id). It is used when hovering over the legend items.\n public highlightChartItems = (itemIds: readonly string[]) => {\n for (const s of this.context.chart().series) {\n // In pie charts it is the points, not series, that are shown in the legend, and can be highlighted.\n if (s.type === \"pie\") {\n for (const p of s.data) {\n if (itemIds.includes(getPointId(p))) {\n this.setPointState(p, \"hover\");\n }\n }\n } else {\n this.setSeriesState(s, itemIds.includes(getSeriesId(s)) ? \"\" : \"inactive\");\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => itemIds.includes(lineId));\n };\n\n // This method is similar to the above, but it takes a group of points. The cartesian chart points\n // do not have IDs, so we match points and series by their references instead. This is used to control\n // highlight state when chart elements are hovered or focused.\n public highlightChartGroup = (points: readonly Highcharts.Point[]) => {\n const includedPoints = new Set<Highcharts.Point>();\n const includedSeries = new Set<Highcharts.Series>();\n const includedSeriesIds = new Set<string>();\n points.forEach((point) => {\n includedPoints.add(point);\n includedSeries.add(point.series);\n includedSeriesIds.add(getSeriesId(point.series));\n });\n for (const s of this.context.chart().series) {\n this.setSeriesState(s, includedSeries.has(s) ? \"\" : \"inactive\");\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n // See: https://github.com/highcharts/highcharts/issues/23076.\n if (s.type === \"column\") {\n for (const d of s.data) {\n this.setPointState(d, includedPoints.has(d) ? \"\" : \"inactive\");\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => includedSeriesIds.has(lineId));\n };\n\n // This method is similar to the above, but it takes a single point. This is used for point highlighting\n // in cartesian charts, and for pie chart segments.\n public highlightChartPoint = (point: Highcharts.Point) => {\n for (const s of this.context.chart().series) {\n this.setSeriesState(s, point.series === s ? \"hover\" : \"inactive\");\n // For pie charts it is important that the hover actions comes last, as otherwise the segment's highlight \"halo\"\n // is removed whenever any segment is made inactive.\n if (s.type === \"pie\") {\n for (const d of s.data) {\n this.setPointState(d, \"inactive\");\n }\n this.setPointState(point, \"hover\");\n }\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n else if (s.type === \"column\") {\n for (const d of s.data) {\n this.setPointState(d, d === point ? \"hover\" : \"inactive\");\n }\n }\n }\n // Highlight linked series when target series is highlighted.\n this.context\n .chart()\n .series.filter((series) => series === point.series)\n .forEach((series) => series.linkedSeries.forEach((linked) => this.setSeriesState(linked, \"hover\")));\n // Highlight threshold series plot lines.\n setPlotLinesState(this.context.chart(), (lineId) => lineId === getSeriesId(point.series));\n };\n\n // Removes dimmed state from all series and points.\n public clearChartItemsHighlight = () => {\n for (const s of this.context.chart().series ?? []) {\n this.setSeriesState(s, \"\");\n for (const p of s.data) {\n this.setPointState(p, \"\");\n }\n }\n setPlotLinesState(this.context.chart(), () => true);\n };\n\n // Makes the specified series active or dimmed.\n private setSeriesState(series: Highcharts.Series, state: \"\" | Highcharts.SeriesStateValue) {\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = false;\n series.setState(state, false);\n this.updateStoredSeriesState(series, state);\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Makes the specified point active or dimmed.\n private setPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = false;\n point.setState(state, true);\n this.updateStoredPointState(point, state);\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Restores series and points highlight state after chart's re-render.\n private restoreHighlightState() {\n const inactiveSeriesIds = new Set<string>();\n for (const s of this.context.chart().series) {\n const prevState = this.seriesState.get(getSeriesId(s));\n if (prevState) {\n this.setSeriesState(s, prevState);\n }\n if (prevState === \"inactive\") {\n inactiveSeriesIds.add(getSeriesId(s));\n }\n for (const p of getSeriesData(s.data)) {\n const prevState = this.pointState.get(getSeriesId(s))?.get(this.getPointKey(p));\n if (prevState) {\n this.setPointState(p, prevState);\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => !inactiveSeriesIds.has(lineId));\n }\n\n private updateStoredSeriesState(series: Highcharts.Series, state: \"\" | Highcharts.SeriesStateValue) {\n this.seriesState.set(getSeriesId(series), state);\n }\n\n private updateStoredPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n const pointStateInSeries = this.pointState.get(getSeriesId(point.series)) ?? new Map();\n pointStateInSeries.set(this.getPointKey(point), state);\n this.pointState.set(getSeriesId(point.series), pointStateInSeries);\n }\n\n // The points normally don't have ID's or names. In that case, the points are identified by\n // the combination of x and y values. This is only used to restore the highlight state after re-render.\n private getPointKey = (point: Highcharts.Point) => {\n return point.options.id ?? `${point.x}:${point.y ?? \"null\"}`;\n };\n\n // We replace `setState` method on Highcharts series and points with a custom implementation, that\n // prevents Highcharts from altering it. Instead, every state change is explicitly done by the helper.\n private overrideStateSetters = () => {\n for (const s of this.context.chart().series) {\n // We ensure the replacement is done only once by assigning a custom property to the function.\n // If the property is present - it means the method was already replaced.\n if ((s.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = s.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Series[\"setState\"] = (...args) => {\n if ((overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(s, ...args);\n }\n };\n (overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n s.setState = overridden;\n }\n for (const d of getSeriesData(s.data)) {\n if ((d.setState as PointSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = d.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Point[\"setState\"] = (...args) => {\n if ((overridden as PointSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(d, ...args);\n }\n };\n (overridden as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n d.setState = overridden;\n }\n }\n }\n };\n}\n\n// The cartesian chart thresholds are represented with invisible series and visible plot lines.\n// When the corresponding series are highlighted, we need to make the not matching plot lines dimmed.\nfunction setPlotLinesState(chart: Highcharts.Chart, isActive: (lineId: string) => boolean) {\n iteratePlotLines(chart, (lineId, line) =>\n line.svgElem?.attr({ opacity: !isActive(lineId) ? Styles.dimmedPlotLineOpacity : 1 }),\n );\n}\n\nfunction iteratePlotLines(chart: Highcharts.Chart, cb: (lineId: string, line: Highcharts.PlotLineOrBand) => void) {\n chart.axes?.forEach((axis) => {\n // The Highcharts `Axis.plotLinesAndBands` API is not covered with TS.\n if (\"plotLinesAndBands\" in axis && Array.isArray(axis.plotLinesAndBands)) {\n axis.plotLinesAndBands.forEach((line: Highcharts.PlotLineOrBand) => {\n // We explicitly do not touch plot lines that have no ID, assuming those are decorative.\n // Only plot lines that define ID can be dimmed when certain series get highlighted.\n if (line.options.id) {\n cb(line.options.id, line);\n }\n });\n }\n });\n}\n"]}
1
+ {"version":3,"file":"chart-extra-highlight.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-highlight.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGnD,MAAM,cAAc,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAKtD,6FAA6F;AAC7F,8DAA8D;AAC9D,MAAM,OAAO,mBAAmB;IAE9B,YAAY,OAA0B;QAItC,sGAAsG;QACtG,oGAAoG;QACpG,kFAAkF;QAC1E,gBAAW,GAAG,IAAI,GAAG,EAA4C,CAAC;QAClE,eAAU,GAAG,IAAI,GAAG,EAAwD,CAAC;QAOrF,4GAA4G;QACrG,wBAAmB,GAAG,CAAC,OAA0B,EAAE,EAAE;YAC1D,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,C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C;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { getSeriesData } from \"../../internal/utils/series-data\";\nimport { getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nconst SET_STATE_LOCK = Symbol(\"awsui-set-state-lock\");\n\ntype SeriesSetStateWithLock = Highcharts.Series[\"setState\"] & { [SET_STATE_LOCK]: boolean };\ntype PointSetStateWithLock = Highcharts.Point[\"setState\"] & { [SET_STATE_LOCK]: boolean };\n\n// Chart helper that mutes Highcharts default highlighting behavior and offers custom methods\n// for customized control over series and points highlighting.\nexport class ChartExtraHighlight {\n private context: ChartExtraContext;\n constructor(context: ChartExtraContext) {\n this.context = context;\n }\n\n // We keep track of the previously highlighted series and points to recover highlight state if needed.\n // The recover is necessary if the chart was re-rendered while the highlighting is set. For example,\n // when triggered a state update from the consumer-provided tooltip footer action.\n private seriesState = new Map<string, \"\" | Highcharts.SeriesStateValue>();\n private pointState = new Map<string, Map<string, \"\" | Highcharts.PointStateValue>>();\n\n public onChartRender() {\n this.overrideStateSetters();\n this.restoreHighlightState();\n }\n\n // The method highlights specified series or points (by id). It is used when hovering over the legend items.\n public highlightChartItems = (itemIds: readonly string[]) => {\n for (const s of this.context.chart().series) {\n // In pie charts it is the points, not series, that are shown in the legend, and can be highlighted.\n if (s.type === \"pie\") {\n for (const p of getSeriesData(s.data)) {\n if (itemIds.includes(getPointId(p))) {\n this.setPointState(p, \"hover\");\n }\n }\n } else {\n this.setSeriesState(s, itemIds.includes(getSeriesId(s)) ? \"\" : \"inactive\");\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => itemIds.includes(lineId));\n };\n\n // This method is similar to the above, but it takes a group of points. The cartesian chart points\n // do not have IDs, so we match points and series by their references instead. This is used to control\n // highlight state when chart elements are hovered or focused.\n public highlightChartGroup = (points: readonly Highcharts.Point[]) => {\n const includedPoints = new Set<Highcharts.Point>();\n const includedSeries = new Set<Highcharts.Series>();\n const includedSeriesIds = new Set<string>();\n points.forEach((point) => {\n includedPoints.add(point);\n includedSeries.add(point.series);\n includedSeriesIds.add(getSeriesId(point.series));\n });\n for (const s of this.context.chart().series) {\n this.setSeriesState(s, includedSeries.has(s) ? \"\" : \"inactive\");\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n // See: https://github.com/highcharts/highcharts/issues/23076.\n if (s.type === \"column\") {\n for (const d of getSeriesData(s.data)) {\n this.setPointState(d, includedPoints.has(d) ? \"\" : \"inactive\");\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => includedSeriesIds.has(lineId));\n };\n\n // This method is similar to the above, but it takes a single point. This is used for point highlighting\n // in cartesian charts, and for pie chart segments.\n public highlightChartPoint = (point: Highcharts.Point) => {\n for (const s of this.context.chart().series) {\n this.setSeriesState(s, point.series === s ? \"hover\" : \"inactive\");\n // For pie charts it is important that the hover actions comes last, as otherwise the segment's highlight \"halo\"\n // is removed whenever any segment is made inactive.\n if (s.type === \"pie\") {\n for (const d of getSeriesData(s.data)) {\n this.setPointState(d, \"inactive\");\n }\n this.setPointState(point, \"hover\");\n }\n // For column series we ensure only one group/stack that matches selected X is highlighted.\n else if (s.type === \"column\") {\n for (const d of getSeriesData(s.data)) {\n this.setPointState(d, d === point ? \"hover\" : \"inactive\");\n }\n }\n }\n // Highlight linked series when target series is highlighted.\n this.context\n .chart()\n .series.filter((series) => series === point.series)\n .forEach((series) => series.linkedSeries.forEach((linked) => this.setSeriesState(linked, \"hover\")));\n // Highlight threshold series plot lines.\n setPlotLinesState(this.context.chart(), (lineId) => lineId === getSeriesId(point.series));\n };\n\n // Removes dimmed state from all series and points.\n public clearChartItemsHighlight = () => {\n for (const s of this.context.chart().series ?? []) {\n this.setSeriesState(s, \"\");\n for (const p of getSeriesData(s.data)) {\n this.setPointState(p, \"\");\n }\n }\n setPlotLinesState(this.context.chart(), () => true);\n };\n\n // Makes the specified series active or dimmed.\n private setSeriesState(series: Highcharts.Series, state: \"\" | Highcharts.SeriesStateValue) {\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = false;\n series.setState(state, false);\n this.updateStoredSeriesState(series, state);\n (series.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Makes the specified point active or dimmed.\n private setPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = false;\n point.setState(state, true);\n this.updateStoredPointState(point, state);\n (point.setState as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n }\n\n // Restores series and points highlight state after chart's re-render.\n private restoreHighlightState() {\n const inactiveSeriesIds = new Set<string>();\n for (const s of this.context.chart().series) {\n const prevState = this.seriesState.get(getSeriesId(s));\n if (prevState) {\n this.setSeriesState(s, prevState);\n }\n if (prevState === \"inactive\") {\n inactiveSeriesIds.add(getSeriesId(s));\n }\n for (const p of getSeriesData(s.data)) {\n const prevState = this.pointState.get(getSeriesId(s))?.get(this.getPointKey(p));\n if (prevState) {\n this.setPointState(p, prevState);\n }\n }\n }\n setPlotLinesState(this.context.chart(), (lineId) => !inactiveSeriesIds.has(lineId));\n }\n\n private updateStoredSeriesState(series: Highcharts.Series, state: \"\" | Highcharts.SeriesStateValue) {\n this.seriesState.set(getSeriesId(series), state);\n }\n\n private updateStoredPointState(point: Highcharts.Point, state: \"\" | Highcharts.PointStateValue) {\n const pointStateInSeries = this.pointState.get(getSeriesId(point.series)) ?? new Map();\n pointStateInSeries.set(this.getPointKey(point), state);\n this.pointState.set(getSeriesId(point.series), pointStateInSeries);\n }\n\n // The points normally don't have ID's or names. In that case, the points are identified by\n // the combination of x and y values. This is only used to restore the highlight state after re-render.\n private getPointKey = (point: Highcharts.Point) => {\n return point.options.id ?? `${point.x}:${point.y ?? \"null\"}`;\n };\n\n // We replace `setState` method on Highcharts series and points with a custom implementation, that\n // prevents Highcharts from altering it. Instead, every state change is explicitly done by the helper.\n private overrideStateSetters = () => {\n for (const s of this.context.chart().series) {\n // We ensure the replacement is done only once by assigning a custom property to the function.\n // If the property is present - it means the method was already replaced.\n if ((s.setState as SeriesSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = s.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Series[\"setState\"] = (...args) => {\n if ((overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(s, ...args);\n }\n };\n (overridden as SeriesSetStateWithLock)[SET_STATE_LOCK] = true;\n s.setState = overridden;\n }\n for (const d of getSeriesData(s.data)) {\n if ((d.setState as PointSetStateWithLock)[SET_STATE_LOCK] === undefined) {\n const original = d.setState;\n // The overridden setState method does nothing unless setState[SET_STATE_LOCK] === false.\n const overridden: Highcharts.Point[\"setState\"] = (...args) => {\n if ((overridden as PointSetStateWithLock)[SET_STATE_LOCK] === false) {\n original.call(d, ...args);\n }\n };\n (overridden as PointSetStateWithLock)[SET_STATE_LOCK] = true;\n d.setState = overridden;\n }\n }\n }\n };\n}\n\n// The cartesian chart thresholds are represented with invisible series and visible plot lines.\n// When the corresponding series are highlighted, we need to make the not matching plot lines dimmed.\nfunction setPlotLinesState(chart: Highcharts.Chart, isActive: (lineId: string) => boolean) {\n iteratePlotLines(chart, (lineId, line) =>\n line.svgElem?.attr({ opacity: !isActive(lineId) ? Styles.dimmedPlotLineOpacity : 1 }),\n );\n}\n\nfunction iteratePlotLines(chart: Highcharts.Chart, cb: (lineId: string, line: Highcharts.PlotLineOrBand) => void) {\n chart.axes?.forEach((axis) => {\n // The Highcharts `Axis.plotLinesAndBands` API is not covered with TS.\n if (\"plotLinesAndBands\" in axis && Array.isArray(axis.plotLinesAndBands)) {\n axis.plotLinesAndBands.forEach((line: Highcharts.PlotLineOrBand) => {\n // We explicitly do not touch plot lines that have no ID, assuming those are decorative.\n // Only plot lines that define ID can be dimmed when certain series get highlighted.\n if (line.options.id) {\n cb(line.options.id, line);\n }\n });\n }\n });\n}\n"]}
@@ -7,7 +7,7 @@ import { renderMarker } from "../../internal/components/series-marker/render-mar
7
7
  import AsyncStore from "../../internal/utils/async-store";
8
8
  import { SVGRendererPool, SVGRendererSingle } from "../../internal/utils/renderer-utils";
9
9
  import { DebouncedCall, isEqualArrays } from "../../internal/utils/utils";
10
- import { getGroupRect, getPointRect, getSeriesId, isXThreshold, safeRect } from "../utils";
10
+ import { getGroupRect, getPointRect, getSeriesId, isPointVisible, isXThreshold, safeRect } from "../utils";
11
11
  import testClasses from "../test-classes/styles.css.js";
12
12
  const TOOLTIP_LAST_DISMISS_DELAY = 250;
13
13
  // Chart helper that implements tooltip placement logic and cursors.
@@ -143,7 +143,10 @@ class HighlightCursorCartesian {
143
143
  this.lineElement = new SVGRendererSingle();
144
144
  this.markerElementsPool = new SVGRendererPool();
145
145
  this.isPointEligibleForMarker = (point) => {
146
- return !isXThreshold(point.series) && point.series.type !== "column" && point.series.type !== "errorbar";
146
+ return (isPointVisible(point) &&
147
+ !isXThreshold(point.series) &&
148
+ point.series.type !== "column" &&
149
+ point.series.type !== "errorbar");
147
150
  };
148
151
  }
149
152
  create(target, point, group, showLine) {
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-tooltip.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-tooltip.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO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AC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7G,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7G,MAAM,MAAM,GACV,CAAC,OAAO,gBAAgB,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7G,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAuB;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IACjC,OAAO,QAAQ,CAAC;QACd,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC;QACvC,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC;QACvC,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\n\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { renderMarker } from \"../../internal/components/series-marker/render-marker\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { SVGRendererPool, SVGRendererSingle } from \"../../internal/utils/renderer-utils\";\nimport { DebouncedCall, isEqualArrays } from \"../../internal/utils/utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, getSeriesId, isXThreshold, safeRect } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nimport testClasses from \"../test-classes/styles.css.js\";\n\nconst TOOLTIP_LAST_DISMISS_DELAY = 250;\n\n// The reactive state is used to propagate updates to the chart tooltip React component. The tooltip\n// content is to be derived from the target point and group.\nexport interface ReactiveTooltipState {\n visible: boolean;\n pinned: boolean;\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Chart helper that implements tooltip placement logic and cursors.\nexport class ChartExtraTooltip extends AsyncStore<ReactiveTooltipState> {\n private context: ChartExtraContext;\n\n // The tooltip lock is used to prevent tooltip position changes shortly after it was dismissed, to\n // deny its immediate re-appearance in the spot under where the dismiss button was.\n public tooltipLock = false;\n private tooltipLockCall = new DebouncedCall();\n private setTooltipLock = () => {\n if (this.get().pinned) {\n this.tooltipLock = true;\n this.tooltipLockCall.call(() => (this.tooltipLock = false), TOOLTIP_LAST_DISMISS_DELAY);\n }\n };\n\n // The cursor is a vertical or horizontal (in inverted charts) line and hollow or filled markers,\n // shown in cartesian charts on top of the matched group or point.\n private cursor = new HighlightCursorCartesian();\n // The track elements are invisible rectangles, compted for the given target point or group.\n // The target track is used for the \"target\" tooltip placement. The group track is used for\n // the \"middle\" and \"outside\" tooltip placement.\n private targetTrack = new SVGRendererSingle();\n private groupTrack = new SVGRendererSingle();\n\n // Cached coordinates to update cursor's position on re-render.\n private lastPoint: null | Highcharts.Point = null;\n private lastGroup: null | readonly Highcharts.Point[] = null;\n\n constructor(context: ChartExtraContext) {\n super({ visible: false, pinned: false, point: null, group: [] });\n this.context = context;\n }\n\n // The targetElement.element can get invalidated by Highcharts, so we cannot use\n // trackRef.current = targetElement.element as it might get invalidated unexpectedly.\n // The getTrack function ensures the latest element reference is given on each request.\n public getTargetTrack = () => (this.targetTrack.element?.element ?? null) as null | SVGElement;\n public getGroupTrack = () => {\n return (this.groupTrack.element?.element ?? null) as null | SVGElement;\n };\n\n public onChartRender() {\n if (this.lastGroup && this.get().visible) {\n this.updateTooltipCursor({ point: this.lastPoint, group: this.lastGroup });\n }\n }\n\n public onChartDestroy() {\n this.cursor.destroy();\n this.targetTrack.destroy();\n this.groupTrack.destroy();\n }\n\n public showTooltipOnPoint(point: Highcharts.Point, matchingGroup: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point, group: matchingGroup });\n this.set(() => ({ visible: true, pinned: false, point, group: matchingGroup }));\n }\n }\n\n public showTooltipOnGroup(group: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point: null, group });\n this.setGroupIfDifferent(group);\n }\n }\n\n public hideTooltip() {\n this.cursor.hide();\n this.targetTrack.hide();\n this.groupTrack.hide();\n this.setTooltipLock();\n this.set((prev) => ({ ...prev, visible: false, pinned: false }));\n }\n\n public pinTooltip() {\n if (this.context.settings.tooltipEnabled) {\n this.set((prev) => ({ ...prev, visible: true, pinned: true }));\n }\n }\n\n // Avoid re-rendering the tooltip on every cursor position change when hovering over the graph.\n // Just re-render when the groups are different.\n private setGroupIfDifferent(group: readonly Highcharts.Point[]) {\n function isGroupEqual(a: Highcharts.Point, b: Highcharts.Point) {\n return a?.x === b?.x && a?.y === b?.y && getSeriesId(a?.series) === getSeriesId(b?.series);\n }\n this.set((prev) => {\n return prev.point === null && isEqualArrays(prev.group, group, isGroupEqual)\n ? prev\n : { visible: true, pinned: false, point: null, group };\n });\n }\n\n private updateTooltipCursor = (props: { point: null | Highcharts.Point; group: readonly Highcharts.Point[] }) => {\n this.lastPoint = props.point;\n this.lastGroup = props.group;\n\n const chartType =\n this.context.chart().series.find((s) => s.type === \"pie\" || s.type === \"solidgauge\")?.type ?? \"cartesian\";\n if (chartType === \"pie\") {\n return this.updateTooltipCursorPie(props.group[0]);\n } else if (chartType === \"solidgauge\") {\n return this.updateTooltipCursorGauge(props.group[0]);\n } else {\n return this.updateTooltipCursorCartesian(props);\n }\n };\n\n private updateTooltipCursorCartesian = ({\n point,\n group,\n }: {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }) => {\n const pointRect = point ? getPointRect(point) : getGroupRect(group.slice(0, 1));\n const groupRect = getGroupRect(group);\n // The cursor is not shown when column series are present (a UX decision).\n const hasColumnSeries = this.context.chart().series.some((s) => s.type === \"column\");\n this.cursor.create(groupRect, point, group, !hasColumnSeries);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n this.groupTrack.rect(this.context.chart().renderer, { ...groupRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorPie = (point: Highcharts.Point) => {\n // We only create target track for pie chart as pie chart does not support groups.\n // It is also expected that only \"target\" tooltip position is used for pie charts.\n const pointRect = getPieChartTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorGauge = (point: Highcharts.Point) => {\n // Solid gauge charts are similar to pie charts in that they have a circular shape\n // and don't support grouping. We use a similar approach to pie charts.\n const pointRect = getSolidGaugeTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private get commonTrackAttrs() {\n return { fill: \"transparent\", zIndex: -1, \"pointer-events\": \"none\", direction: this.direction };\n }\n\n // We compute the direction from the chart container and then explicitly set it to the track\n // elements, as otherwise the direction check done for track elements always results to \"ltr\".\n private get direction() {\n const isRtl = getIsRtl(this.context.chart().container.parentElement);\n return isRtl ? \"rtl\" : \"ltr\";\n }\n}\n\n// A helper class to draw the cursor elements (include cursor line and matched points markers).\nclass HighlightCursorCartesian {\n private lineElement = new SVGRendererSingle();\n private markerElementsPool = new SVGRendererPool();\n\n public create(target: Rect, point: null | Highcharts.Point, group: readonly Highcharts.Point[], showLine: boolean) {\n this.hide();\n if (!group[0]?.series) {\n return;\n }\n\n const chart = group[0]?.series.chart;\n if (!chart) {\n return;\n }\n if (showLine) {\n // The cursor line is rendered orthogonally to the x axis (when the chart is inverted, the line is rendered horizontally).\n // The line is 1px thick, and is rendered through the center of the target's rect.\n const lineAttrs = chart.inverted\n ? {\n x: chart.plotLeft,\n y: chart.plotTop + target.y - target.height - 1,\n width: chart.plotWidth,\n height: 1,\n }\n : {\n x: target.x + target.width / 2,\n y: chart.plotTop,\n width: 1,\n height: chart.plotHeight,\n };\n this.lineElement.rect(chart.renderer, { ...Styles.cursorLine, ...lineAttrs });\n }\n for (const p of group.filter(this.isPointEligibleForMarker)) {\n if (p.plotX !== undefined && p.plotY !== undefined) {\n const selected = p === point;\n const className = clsx(testClasses[\"highlight-marker\"], selected && testClasses[\"highlight-marker-selected\"]);\n renderMarker({ chart, pool: this.markerElementsPool, point: p, selected, className });\n }\n }\n }\n\n public hide() {\n this.lineElement.hide();\n this.markerElementsPool.hideAll();\n }\n\n public destroy() {\n this.lineElement.destroy();\n this.markerElementsPool.destroyAll();\n }\n\n private isPointEligibleForMarker = (point: Highcharts.Point) => {\n return !isXThreshold(point.series) && point.series.type !== \"column\" && point.series.type !== \"errorbar\";\n };\n}\n\nfunction getPieChartTargetPlacement(point: Highcharts.Point): Rect {\n // The pie series segments do not provide plotX, plotY to compute the tooltip placement.\n // Instead, there is a `tooltipPos` tuple, which is not covered by TS.\n // See: https://github.com/highcharts/highcharts/issues/23118.\n if (\"tooltipPos\" in point && Array.isArray(point.tooltipPos)) {\n return safeRect({ x: point.tooltipPos[0], y: point.tooltipPos[1], width: 0, height: 0 });\n }\n // We use the alternative, middle, tooltip placement as a fallback, in case the undocumented \"tooltipPos\"\n // is no longer available in the point.\n return getPieMiddlePlacement(point);\n}\n\nfunction getPieMiddlePlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n const [relativeX, relativeY, relativeDiameter] = point.series.center;\n const plotLeft = chart.plotLeft;\n const plotTop = chart.plotTop;\n const centerX = plotLeft + (typeof relativeX === \"number\" ? relativeX : (relativeX / 100) * chart.plotWidth);\n const centerY = plotTop + (typeof relativeY === \"number\" ? relativeY : (relativeY / 100) * chart.plotHeight);\n const radius =\n (typeof relativeDiameter === \"number\" ? relativeDiameter : (relativeDiameter / 100) * chart.plotWidth) / 2;\n return { x: centerX, y: centerY - radius, width: 1, height: 2 * radius };\n}\n\nfunction getSolidGaugeTargetPlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n return safeRect({\n x: chart.plotLeft + chart.plotWidth / 2,\n y: chart.plotTop + chart.plotHeight / 2,\n width: 0,\n height: 0,\n });\n}\n"]}
1
+ {"version":3,"file":"chart-extra-tooltip.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-tooltip.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG3G,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAWvC,oEAAoE;AACpE,MAAM,OAAO,iBAAkB,SAAQ,UAAgC;IA2BrE,YAAY,OAA0B;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAA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AC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC7G,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAuB;IAC3D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IACjC,OAAO,QAAQ,CAAC;QACd,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC;QACvC,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC;QACvC,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\n\nimport { getIsRtl } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport * as Styles from \"../../internal/chart-styles\";\nimport { renderMarker } from \"../../internal/components/series-marker/render-marker\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { SVGRendererPool, SVGRendererSingle } from \"../../internal/utils/renderer-utils\";\nimport { DebouncedCall, isEqualArrays } from \"../../internal/utils/utils\";\nimport { Rect } from \"../interfaces\";\nimport { getGroupRect, getPointRect, getSeriesId, isPointVisible, isXThreshold, safeRect } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\nimport testClasses from \"../test-classes/styles.css.js\";\n\nconst TOOLTIP_LAST_DISMISS_DELAY = 250;\n\n// The reactive state is used to propagate updates to the chart tooltip React component. The tooltip\n// content is to be derived from the target point and group.\nexport interface ReactiveTooltipState {\n visible: boolean;\n pinned: boolean;\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n}\n\n// Chart helper that implements tooltip placement logic and cursors.\nexport class ChartExtraTooltip extends AsyncStore<ReactiveTooltipState> {\n private context: ChartExtraContext;\n\n // The tooltip lock is used to prevent tooltip position changes shortly after it was dismissed, to\n // deny its immediate re-appearance in the spot under where the dismiss button was.\n public tooltipLock = false;\n private tooltipLockCall = new DebouncedCall();\n private setTooltipLock = () => {\n if (this.get().pinned) {\n this.tooltipLock = true;\n this.tooltipLockCall.call(() => (this.tooltipLock = false), TOOLTIP_LAST_DISMISS_DELAY);\n }\n };\n\n // The cursor is a vertical or horizontal (in inverted charts) line and hollow or filled markers,\n // shown in cartesian charts on top of the matched group or point.\n private cursor = new HighlightCursorCartesian();\n // The track elements are invisible rectangles, compted for the given target point or group.\n // The target track is used for the \"target\" tooltip placement. The group track is used for\n // the \"middle\" and \"outside\" tooltip placement.\n private targetTrack = new SVGRendererSingle();\n private groupTrack = new SVGRendererSingle();\n\n // Cached coordinates to update cursor's position on re-render.\n private lastPoint: null | Highcharts.Point = null;\n private lastGroup: null | readonly Highcharts.Point[] = null;\n\n constructor(context: ChartExtraContext) {\n super({ visible: false, pinned: false, point: null, group: [] });\n this.context = context;\n }\n\n // The targetElement.element can get invalidated by Highcharts, so we cannot use\n // trackRef.current = targetElement.element as it might get invalidated unexpectedly.\n // The getTrack function ensures the latest element reference is given on each request.\n public getTargetTrack = () => (this.targetTrack.element?.element ?? null) as null | SVGElement;\n public getGroupTrack = () => {\n return (this.groupTrack.element?.element ?? null) as null | SVGElement;\n };\n\n public onChartRender() {\n if (this.lastGroup && this.get().visible) {\n this.updateTooltipCursor({ point: this.lastPoint, group: this.lastGroup });\n }\n }\n\n public onChartDestroy() {\n this.cursor.destroy();\n this.targetTrack.destroy();\n this.groupTrack.destroy();\n }\n\n public showTooltipOnPoint(point: Highcharts.Point, matchingGroup: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point, group: matchingGroup });\n this.set(() => ({ visible: true, pinned: false, point, group: matchingGroup }));\n }\n }\n\n public showTooltipOnGroup(group: readonly Highcharts.Point[], ignoreLock = false) {\n if (!this.tooltipLock || ignoreLock) {\n this.updateTooltipCursor({ point: null, group });\n this.setGroupIfDifferent(group);\n }\n }\n\n public hideTooltip() {\n this.cursor.hide();\n this.targetTrack.hide();\n this.groupTrack.hide();\n this.setTooltipLock();\n this.set((prev) => ({ ...prev, visible: false, pinned: false }));\n }\n\n public pinTooltip() {\n if (this.context.settings.tooltipEnabled) {\n this.set((prev) => ({ ...prev, visible: true, pinned: true }));\n }\n }\n\n // Avoid re-rendering the tooltip on every cursor position change when hovering over the graph.\n // Just re-render when the groups are different.\n private setGroupIfDifferent(group: readonly Highcharts.Point[]) {\n function isGroupEqual(a: Highcharts.Point, b: Highcharts.Point) {\n return a?.x === b?.x && a?.y === b?.y && getSeriesId(a?.series) === getSeriesId(b?.series);\n }\n this.set((prev) => {\n return prev.point === null && isEqualArrays(prev.group, group, isGroupEqual)\n ? prev\n : { visible: true, pinned: false, point: null, group };\n });\n }\n\n private updateTooltipCursor = (props: { point: null | Highcharts.Point; group: readonly Highcharts.Point[] }) => {\n this.lastPoint = props.point;\n this.lastGroup = props.group;\n\n const chartType =\n this.context.chart().series.find((s) => s.type === \"pie\" || s.type === \"solidgauge\")?.type ?? \"cartesian\";\n if (chartType === \"pie\") {\n return this.updateTooltipCursorPie(props.group[0]);\n } else if (chartType === \"solidgauge\") {\n return this.updateTooltipCursorGauge(props.group[0]);\n } else {\n return this.updateTooltipCursorCartesian(props);\n }\n };\n\n private updateTooltipCursorCartesian = ({\n point,\n group,\n }: {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }) => {\n const pointRect = point ? getPointRect(point) : getGroupRect(group.slice(0, 1));\n const groupRect = getGroupRect(group);\n // The cursor is not shown when column series are present (a UX decision).\n const hasColumnSeries = this.context.chart().series.some((s) => s.type === \"column\");\n this.cursor.create(groupRect, point, group, !hasColumnSeries);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n this.groupTrack.rect(this.context.chart().renderer, { ...groupRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorPie = (point: Highcharts.Point) => {\n // We only create target track for pie chart as pie chart does not support groups.\n // It is also expected that only \"target\" tooltip position is used for pie charts.\n const pointRect = getPieChartTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private updateTooltipCursorGauge = (point: Highcharts.Point) => {\n // Solid gauge charts are similar to pie charts in that they have a circular shape\n // and don't support grouping. We use a similar approach to pie charts.\n const pointRect = getSolidGaugeTargetPlacement(point);\n this.targetTrack.rect(this.context.chart().renderer, { ...pointRect, ...this.commonTrackAttrs });\n };\n\n private get commonTrackAttrs() {\n return { fill: \"transparent\", zIndex: -1, \"pointer-events\": \"none\", direction: this.direction };\n }\n\n // We compute the direction from the chart container and then explicitly set it to the track\n // elements, as otherwise the direction check done for track elements always results to \"ltr\".\n private get direction() {\n const isRtl = getIsRtl(this.context.chart().container.parentElement);\n return isRtl ? \"rtl\" : \"ltr\";\n }\n}\n\n// A helper class to draw the cursor elements (include cursor line and matched points markers).\nclass HighlightCursorCartesian {\n private lineElement = new SVGRendererSingle();\n private markerElementsPool = new SVGRendererPool();\n\n public create(target: Rect, point: null | Highcharts.Point, group: readonly Highcharts.Point[], showLine: boolean) {\n this.hide();\n if (!group[0]?.series) {\n return;\n }\n\n const chart = group[0]?.series.chart;\n if (!chart) {\n return;\n }\n if (showLine) {\n // The cursor line is rendered orthogonally to the x axis (when the chart is inverted, the line is rendered horizontally).\n // The line is 1px thick, and is rendered through the center of the target's rect.\n const lineAttrs = chart.inverted\n ? {\n x: chart.plotLeft,\n y: chart.plotTop + target.y - target.height - 1,\n width: chart.plotWidth,\n height: 1,\n }\n : {\n x: target.x + target.width / 2,\n y: chart.plotTop,\n width: 1,\n height: chart.plotHeight,\n };\n this.lineElement.rect(chart.renderer, { ...Styles.cursorLine, ...lineAttrs });\n }\n for (const p of group.filter(this.isPointEligibleForMarker)) {\n if (p.plotX !== undefined && p.plotY !== undefined) {\n const selected = p === point;\n const className = clsx(testClasses[\"highlight-marker\"], selected && testClasses[\"highlight-marker-selected\"]);\n renderMarker({ chart, pool: this.markerElementsPool, point: p, selected, className });\n }\n }\n }\n\n public hide() {\n this.lineElement.hide();\n this.markerElementsPool.hideAll();\n }\n\n public destroy() {\n this.lineElement.destroy();\n this.markerElementsPool.destroyAll();\n }\n\n private isPointEligibleForMarker = (point: Highcharts.Point) => {\n return (\n isPointVisible(point) &&\n !isXThreshold(point.series) &&\n point.series.type !== \"column\" &&\n point.series.type !== \"errorbar\"\n );\n };\n}\n\nfunction getPieChartTargetPlacement(point: Highcharts.Point): Rect {\n // The pie series segments do not provide plotX, plotY to compute the tooltip placement.\n // Instead, there is a `tooltipPos` tuple, which is not covered by TS.\n // See: https://github.com/highcharts/highcharts/issues/23118.\n if (\"tooltipPos\" in point && Array.isArray(point.tooltipPos)) {\n return safeRect({ x: point.tooltipPos[0], y: point.tooltipPos[1], width: 0, height: 0 });\n }\n // We use the alternative, middle, tooltip placement as a fallback, in case the undocumented \"tooltipPos\"\n // is no longer available in the point.\n return getPieMiddlePlacement(point);\n}\n\nfunction getPieMiddlePlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n const [relativeX, relativeY, relativeDiameter] = point.series.center;\n const plotLeft = chart.plotLeft;\n const plotTop = chart.plotTop;\n const centerX = plotLeft + (typeof relativeX === \"number\" ? relativeX : (relativeX / 100) * chart.plotWidth);\n const centerY = plotTop + (typeof relativeY === \"number\" ? relativeY : (relativeY / 100) * chart.plotHeight);\n const radius =\n (typeof relativeDiameter === \"number\" ? relativeDiameter : (relativeDiameter / 100) * chart.plotWidth) / 2;\n return { x: centerX, y: centerY - radius, width: 1, height: 2 * radius };\n}\n\nfunction getSolidGaugeTargetPlacement(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n return safeRect({\n x: chart.plotLeft + chart.plotWidth / 2,\n y: chart.plotTop + chart.plotHeight / 2,\n width: 0,\n height: 0,\n });\n}\n"]}
@@ -11,7 +11,7 @@ import { useSelector } from "../../internal/utils/async-store";
11
11
  import { getChartSeries } from "../../internal/utils/chart-series";
12
12
  import { useDebouncedValue } from "../../internal/utils/use-debounced-value";
13
13
  import { getFormatter } from "../formatters";
14
- import { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isXThreshold } from "../utils";
14
+ import { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isPointVisible, isXThreshold, } from "../utils";
15
15
  import styles from "../styles.css.js";
16
16
  const MIN_VISIBLE_BLOCK_SIZE = 200;
17
17
  const DEFAULT_DEBOUNCE = 200;
@@ -173,6 +173,9 @@ function findTooltipSeriesItems(series, group, seriesSorting) {
173
173
  const matchedSeries = new Set();
174
174
  const matchedItems = [];
175
175
  for (const point of group) {
176
+ if (!isPointVisible(point)) {
177
+ continue;
178
+ }
176
179
  // We only support errorbar series that are linked to other series. In tooltip content we add
177
180
  // linked error bars to series detail slot.
178
181
  if (point.series.type === "errorbar") {
@@ -1 +1 @@
1
- {"version":3,"file":"core-tooltip.js","sourceRoot":"","sources":["../../../../src/core/components/core-tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,GAAG,MAAM,mCAAmC,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iEAAiE,CAAC;AACvG,OAAO,UAAU,MAAM,2CAA2C,CAAC;AAEnE,OAAO,kBAA6C,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,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AC,mCAAI,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC;QACF,8FAA8F;SAC7F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;QACZ,MAAM,WAAW,GAAG,MAAA,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,mCAAI,EAAE,CAAC;QAC3E,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9G,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACrD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useState } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\nimport Box from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\nimport LiveRegion from \"@cloudscape-design/components/live-region\";\n\nimport ChartSeriesDetails, { ChartSeriesDetailItem } from \"../../internal/components/series-details\";\nimport { useSelector } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { useDebouncedValue } from \"../../internal/utils/use-debounced-value\";\nimport { ChartAPI } from \"../chart-api\";\nimport { getFormatter } from \"../formatters\";\nimport { BaseI18nStrings, CoreChartProps } from \"../interfaces\";\nimport { getPointColor, getPointId, getSeriesColor, getSeriesId, getSeriesMarkerType, isXThreshold } from \"../utils\";\n\nimport styles from \"../styles.css.js\";\n\nconst MIN_VISIBLE_BLOCK_SIZE = 200;\nconst DEFAULT_DEBOUNCE = 200;\n\ntype ExpandedSeriesState = Record<string, Set<string>>;\n\ninterface ExpandedSeriesStateProps {\n expandedSeries: ExpandedSeriesState;\n setExpandedSeries: (cb: (state: ExpandedSeriesState) => ExpandedSeriesState) => void;\n}\n\ninterface RenderedTooltipContent {\n header: React.ReactNode;\n body: React.ReactNode;\n footer: React.ReactNode;\n}\n\ninterface MatchedItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n}\n\nexport function ChartTooltip({\n placement = \"target\",\n size,\n getTooltipContent: getTooltipContentOverrides,\n api,\n i18nStrings,\n debounce = false,\n seriesSorting = \"as-added\",\n}: CoreChartProps.TooltipOptions & {\n i18nStrings?: BaseI18nStrings;\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n api: ChartAPI;\n}) {\n const [expandedSeries, setExpandedSeries] = useState<ExpandedSeriesState>({});\n const tooltip = useSelector(api.tooltipStore, (s) => s);\n const debouncedTooltip = useDebouncedValue(tooltip, debounce === true ? DEFAULT_DEBOUNCE : debounce || 0);\n\n if (\n !debouncedTooltip ||\n !debouncedTooltip.visible ||\n debouncedTooltip.group.length === 0 ||\n debouncedTooltip.group[0].series === undefined\n ) {\n return null;\n }\n\n const chart = debouncedTooltip.group[0]?.series.chart;\n const renderers = getTooltipContentOverrides?.({ point: debouncedTooltip.point, group: debouncedTooltip.group });\n const getTrack = placement === \"target\" ? api.getTargetTrack : api.getGroupTrack;\n const position = (() => {\n if (placement === \"target\" || placement === \"middle\") {\n return !chart.inverted ? \"right\" : \"bottom\";\n } else {\n return !chart.inverted ? \"bottom\" : \"right\";\n }\n })();\n const content = getTooltipContent(api, {\n renderers,\n point: debouncedTooltip.point,\n group: debouncedTooltip.group,\n expandedSeries,\n setExpandedSeries,\n seriesSorting,\n hideTooltip: () => {\n api.hideTooltip();\n },\n });\n if (!content) {\n return null;\n }\n return (\n <InternalChartTooltip\n getTrack={getTrack}\n trackKey={getTrackKey(debouncedTooltip.point, debouncedTooltip.group)}\n container={null}\n dismissButton={debouncedTooltip.pinned}\n dismissAriaLabel={i18nStrings?.detailPopoverDismissAriaLabel}\n onDismiss={api.onDismissTooltip}\n onMouseEnter={api.onMouseEnterTooltip}\n onMouseLeave={api.onMouseLeaveTooltip}\n title={content.header}\n footer={\n content.footer ? (\n <>\n <hr aria-hidden={true} />\n {content.footer}\n </>\n ) : null\n }\n size={size}\n position={position}\n minVisibleBlockSize={MIN_VISIBLE_BLOCK_SIZE}\n >\n <LiveRegion>{content.body}</LiveRegion>\n </InternalChartTooltip>\n );\n}\n\nfunction getTrackKey(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n const pointId = point && (point.options.id || point.options.name);\n if (point && pointId) {\n return `p-${pointId}-${point.x}-${point.y}`;\n }\n if (point) {\n return `p-${point.x}-${point.y}`;\n }\n return `g_${group.length}_${group[0].x}`;\n}\n\nfunction getTooltipContent(\n api: ChartAPI,\n props: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): null | RenderedTooltipContent {\n if (props.point && props.point.series.type === \"pie\") {\n return getTooltipContentPie(api, { ...props, point: props.point });\n } else if (props.group.length > 0 && props.group[0].series.type !== \"pie\") {\n return getTooltipContentCartesian(api, props);\n } else {\n return null;\n }\n}\n\nfunction getTooltipContentCartesian(\n api: ChartAPI,\n {\n point,\n group,\n expandedSeries,\n renderers = {},\n setExpandedSeries,\n hideTooltip,\n seriesSorting,\n }: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): RenderedTooltipContent {\n // The cartesian tooltip might or might not have a selected point, but it always has a non-empty group.\n // By design, every point of the group has the same x value.\n const x = group[0].x;\n const chart = group[0].series.chart;\n const getSeriesMarker = (series: Highcharts.Series) => {\n const itemOptions = api.context.settings.getItemOptions?.(getSeriesId(series));\n return api.renderMarker({\n type: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status),\n });\n };\n const matchedItems = findTooltipSeriesItems(getChartSeries(chart.series), group, seriesSorting);\n const detailItems: ChartSeriesDetailItem[] = matchedItems.map((item) => {\n const valueFormatter = getFormatter(item.point.series.yAxis);\n const itemY = isXThreshold(item.point.series) ? null : (item.point.y ?? null);\n const customContent = renderers.point\n ? renderers.point({\n item,\n hideTooltip,\n })\n : undefined;\n return {\n key: customContent?.key ?? item.point.series.name,\n value: customContent?.value ?? valueFormatter(itemY),\n marker: getSeriesMarker(item.point.series),\n subItems: customContent?.subItems,\n expandableId: customContent?.expandable ? item.point.series.name : undefined,\n highlighted: item.point.x === point?.x && item.point.y === point?.y,\n description:\n customContent?.description === undefined && item.errorRanges.length ? (\n <>\n {item.errorRanges.map((errorBarPoint, index) => (\n <div key={index} className={styles[\"error-range\"]}>\n <span>{errorBarPoint.series.userOptions.name ? errorBarPoint.series.userOptions.name : \"\"}</span>\n <span>\n {valueFormatter(errorBarPoint.options.low ?? 0)} - {valueFormatter(errorBarPoint.options.high ?? 0)}\n </span>\n </div>\n ))}\n </>\n ) : (\n customContent?.description\n ),\n };\n });\n // We only support cartesian charts with a single x axis.\n const titleFormatter = getFormatter(chart.xAxis[0]);\n const slotRenderProps: CoreChartProps.TooltipSlotProps = {\n x,\n items: matchedItems,\n hideTooltip: hideTooltip,\n };\n return {\n header: renderers.header?.(slotRenderProps) ?? titleFormatter(x),\n body: renderers.body?.(slotRenderProps) ?? (\n <ChartSeriesDetails\n details={detailItems}\n expandedSeries={expandedSeries[x]}\n setExpandedState={(id, isExpanded) => {\n setExpandedSeries((oldState) => {\n const expandedSeriesInCurrentCoordinate = new Set(oldState[x]);\n if (isExpanded) {\n expandedSeriesInCurrentCoordinate.add(id);\n } else {\n expandedSeriesInCurrentCoordinate.delete(id);\n }\n return { ...oldState, [x]: expandedSeriesInCurrentCoordinate };\n });\n }}\n />\n ),\n footer: renderers.footer?.(slotRenderProps),\n };\n}\n\nfunction getTooltipContentPie(\n api: ChartAPI,\n {\n point,\n renderers = {},\n hideTooltip,\n }: { point: Highcharts.Point } & { renderers?: CoreChartProps.TooltipContentRenderer; hideTooltip: () => void },\n): RenderedTooltipContent {\n const tooltipDetails: CoreChartProps.TooltipSlotProps = {\n x: point.x,\n items: [{ point, errorRanges: [] }],\n hideTooltip,\n };\n\n const itemOptions = api.context.settings.getItemOptions?.(getPointId(point));\n const markerAriaLabel = api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status);\n\n return {\n header: renderers.header?.(tooltipDetails) ?? (\n <div className={styles[\"tooltip-default-header\"]}>\n {api.renderMarker({\n type: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: markerAriaLabel,\n })}\n <Box variant=\"span\" fontWeight=\"bold\">\n {point.name}\n </Box>\n </div>\n ),\n body:\n renderers.body?.(tooltipDetails) ??\n (renderers.details ? (\n <ChartSeriesDetails\n details={renderers.details({\n point,\n hideTooltip,\n })}\n compactList={true}\n />\n ) : (\n // We expect all pie chart segments to have defined y values. We use y=0 as fallback\n // because the property is optional in Highcharts types.\n <ChartSeriesDetails details={[{ key: point.series.name, value: point.y ?? 0 }]} />\n )),\n footer: renderers.footer?.(tooltipDetails),\n };\n}\n\nfunction findTooltipSeriesItems(\n series: readonly Highcharts.Series[],\n group: readonly Highcharts.Point[],\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>,\n): MatchedItem[] {\n const seriesOrder = series.reduce((d, s, i) => d.set(s, i), new Map<Highcharts.Series, number>());\n const getSeriesIndex = (s: Highcharts.Series) => seriesOrder.get(s) ?? -1;\n const seriesErrors = new Map<string, Highcharts.Point[]>();\n const matchedSeries = new Set<Highcharts.Series>();\n const matchedItems: MatchedItem[] = [];\n for (const point of group) {\n // We only support errorbar series that are linked to other series. In tooltip content we add\n // linked error bars to series detail slot.\n if (point.series.type === \"errorbar\") {\n if (point.series.linkedParent) {\n addError(getSeriesId(point.series.linkedParent), point);\n } else {\n warnOnce(\n \"chart-components\",\n 'The `linkedTo` property of \"errorbar\" series is missing, or points to a series that does not exist.',\n );\n }\n } else {\n addMatchedPoints(point);\n }\n }\n function addError(seriesId: string, errorPoint: Highcharts.Point) {\n if (errorPoint.options.low !== undefined && errorPoint.options.high !== undefined) {\n const errorRanges = seriesErrors.get(seriesId) ?? [];\n errorRanges.push(errorPoint);\n seriesErrors.set(seriesId, errorRanges);\n }\n }\n function addMatchedPoints(point: Highcharts.Point) {\n if (!matchedSeries.has(point.series)) {\n matchedSeries.add(point.series);\n if (isXThreshold(point.series)) {\n matchedItems.push({ point, errorRanges: [] });\n } else {\n point.series.data\n .filter((d) => d.x === point.x)\n .sort((a, b) => (a.y ?? 0) - (b.y ?? 0))\n .forEach((point) => matchedItems.push({ point, errorRanges: [] }));\n }\n }\n }\n return (\n matchedItems\n .sort((i1, i2) => {\n if (seriesSorting === \"by-value-desc\") {\n return (i2.point.y ?? 0) - (i1.point.y ?? 0);\n }\n // We sort matched items by series order. If there are multiple items that belong to the same series, we sort them by value.\n const s1 = getSeriesIndex(i1.point.series) - getSeriesIndex(i2.point.series);\n return s1 || (i1.point.y ?? 0) - (i2.point.y ?? 0);\n })\n // For each series item we add linked error ranges, sorted by their respective series indices.\n .map((item) => {\n const errorRanges = seriesErrors.get(getSeriesId(item.point.series)) ?? [];\n const sortedErrorRanges = errorRanges.sort((i1, i2) => getSeriesIndex(i1.series) - getSeriesIndex(i2.series));\n return { ...item, errorRanges: sortedErrorRanges };\n })\n );\n}\n"]}
1
+ {"version":3,"file":"core-tooltip.js","sourceRoot":"","sources":["../../../../src/core/components/core-tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEj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GAAG,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,4HAA4H;QAC5H,MAAM,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO,EAAE,IAAI,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,EAAE,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC;QACF,8FAA8F;SAC7F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;QACZ,MAAM,WAAW,GAAG,MAAA,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,mCAAI,EAAE,CAAC;QAC3E,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9G,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACrD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useState } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\nimport Box from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\nimport LiveRegion from \"@cloudscape-design/components/live-region\";\n\nimport ChartSeriesDetails, { ChartSeriesDetailItem } from \"../../internal/components/series-details\";\nimport { useSelector } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { useDebouncedValue } from \"../../internal/utils/use-debounced-value\";\nimport { ChartAPI } from \"../chart-api\";\nimport { getFormatter } from \"../formatters\";\nimport { BaseI18nStrings, CoreChartProps } from \"../interfaces\";\nimport {\n getPointColor,\n getPointId,\n getSeriesColor,\n getSeriesId,\n getSeriesMarkerType,\n isPointVisible,\n isXThreshold,\n} from \"../utils\";\n\nimport styles from \"../styles.css.js\";\n\nconst MIN_VISIBLE_BLOCK_SIZE = 200;\nconst DEFAULT_DEBOUNCE = 200;\n\ntype ExpandedSeriesState = Record<string, Set<string>>;\n\ninterface ExpandedSeriesStateProps {\n expandedSeries: ExpandedSeriesState;\n setExpandedSeries: (cb: (state: ExpandedSeriesState) => ExpandedSeriesState) => void;\n}\n\ninterface RenderedTooltipContent {\n header: React.ReactNode;\n body: React.ReactNode;\n footer: React.ReactNode;\n}\n\ninterface MatchedItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n}\n\nexport function ChartTooltip({\n placement = \"target\",\n size,\n getTooltipContent: getTooltipContentOverrides,\n api,\n i18nStrings,\n debounce = false,\n seriesSorting = \"as-added\",\n}: CoreChartProps.TooltipOptions & {\n i18nStrings?: BaseI18nStrings;\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n api: ChartAPI;\n}) {\n const [expandedSeries, setExpandedSeries] = useState<ExpandedSeriesState>({});\n const tooltip = useSelector(api.tooltipStore, (s) => s);\n const debouncedTooltip = useDebouncedValue(tooltip, debounce === true ? DEFAULT_DEBOUNCE : debounce || 0);\n\n if (\n !debouncedTooltip ||\n !debouncedTooltip.visible ||\n debouncedTooltip.group.length === 0 ||\n debouncedTooltip.group[0].series === undefined\n ) {\n return null;\n }\n\n const chart = debouncedTooltip.group[0]?.series.chart;\n const renderers = getTooltipContentOverrides?.({ point: debouncedTooltip.point, group: debouncedTooltip.group });\n const getTrack = placement === \"target\" ? api.getTargetTrack : api.getGroupTrack;\n const position = (() => {\n if (placement === \"target\" || placement === \"middle\") {\n return !chart.inverted ? \"right\" : \"bottom\";\n } else {\n return !chart.inverted ? \"bottom\" : \"right\";\n }\n })();\n const content = getTooltipContent(api, {\n renderers,\n point: debouncedTooltip.point,\n group: debouncedTooltip.group,\n expandedSeries,\n setExpandedSeries,\n seriesSorting,\n hideTooltip: () => {\n api.hideTooltip();\n },\n });\n if (!content) {\n return null;\n }\n return (\n <InternalChartTooltip\n getTrack={getTrack}\n trackKey={getTrackKey(debouncedTooltip.point, debouncedTooltip.group)}\n container={null}\n dismissButton={debouncedTooltip.pinned}\n dismissAriaLabel={i18nStrings?.detailPopoverDismissAriaLabel}\n onDismiss={api.onDismissTooltip}\n onMouseEnter={api.onMouseEnterTooltip}\n onMouseLeave={api.onMouseLeaveTooltip}\n title={content.header}\n footer={\n content.footer ? (\n <>\n <hr aria-hidden={true} />\n {content.footer}\n </>\n ) : null\n }\n size={size}\n position={position}\n minVisibleBlockSize={MIN_VISIBLE_BLOCK_SIZE}\n >\n <LiveRegion>{content.body}</LiveRegion>\n </InternalChartTooltip>\n );\n}\n\nfunction getTrackKey(point: null | Highcharts.Point, group: readonly Highcharts.Point[]) {\n const pointId = point && (point.options.id || point.options.name);\n if (point && pointId) {\n return `p-${pointId}-${point.x}-${point.y}`;\n }\n if (point) {\n return `p-${point.x}-${point.y}`;\n }\n return `g_${group.length}_${group[0].x}`;\n}\n\nfunction getTooltipContent(\n api: ChartAPI,\n props: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): null | RenderedTooltipContent {\n if (props.point && props.point.series.type === \"pie\") {\n return getTooltipContentPie(api, { ...props, point: props.point });\n } else if (props.group.length > 0 && props.group[0].series.type !== \"pie\") {\n return getTooltipContentCartesian(api, props);\n } else {\n return null;\n }\n}\n\nfunction getTooltipContentCartesian(\n api: ChartAPI,\n {\n point,\n group,\n expandedSeries,\n renderers = {},\n setExpandedSeries,\n hideTooltip,\n seriesSorting,\n }: CoreChartProps.GetTooltipContentProps & {\n renderers?: CoreChartProps.TooltipContentRenderer;\n hideTooltip: () => void;\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>;\n } & ExpandedSeriesStateProps,\n): RenderedTooltipContent {\n // The cartesian tooltip might or might not have a selected point, but it always has a non-empty group.\n // By design, every point of the group has the same x value.\n const x = group[0].x;\n const chart = group[0].series.chart;\n const getSeriesMarker = (series: Highcharts.Series) => {\n const itemOptions = api.context.settings.getItemOptions?.(getSeriesId(series));\n return api.renderMarker({\n type: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status),\n });\n };\n const matchedItems = findTooltipSeriesItems(getChartSeries(chart.series), group, seriesSorting);\n const detailItems: ChartSeriesDetailItem[] = matchedItems.map((item) => {\n const valueFormatter = getFormatter(item.point.series.yAxis);\n const itemY = isXThreshold(item.point.series) ? null : (item.point.y ?? null);\n const customContent = renderers.point\n ? renderers.point({\n item,\n hideTooltip,\n })\n : undefined;\n return {\n key: customContent?.key ?? item.point.series.name,\n value: customContent?.value ?? valueFormatter(itemY),\n marker: getSeriesMarker(item.point.series),\n subItems: customContent?.subItems,\n expandableId: customContent?.expandable ? item.point.series.name : undefined,\n highlighted: item.point.x === point?.x && item.point.y === point?.y,\n description:\n customContent?.description === undefined && item.errorRanges.length ? (\n <>\n {item.errorRanges.map((errorBarPoint, index) => (\n <div key={index} className={styles[\"error-range\"]}>\n <span>{errorBarPoint.series.userOptions.name ? errorBarPoint.series.userOptions.name : \"\"}</span>\n <span>\n {valueFormatter(errorBarPoint.options.low ?? 0)} - {valueFormatter(errorBarPoint.options.high ?? 0)}\n </span>\n </div>\n ))}\n </>\n ) : (\n customContent?.description\n ),\n };\n });\n // We only support cartesian charts with a single x axis.\n const titleFormatter = getFormatter(chart.xAxis[0]);\n const slotRenderProps: CoreChartProps.TooltipSlotProps = {\n x,\n items: matchedItems,\n hideTooltip: hideTooltip,\n };\n return {\n header: renderers.header?.(slotRenderProps) ?? titleFormatter(x),\n body: renderers.body?.(slotRenderProps) ?? (\n <ChartSeriesDetails\n details={detailItems}\n expandedSeries={expandedSeries[x]}\n setExpandedState={(id, isExpanded) => {\n setExpandedSeries((oldState) => {\n const expandedSeriesInCurrentCoordinate = new Set(oldState[x]);\n if (isExpanded) {\n expandedSeriesInCurrentCoordinate.add(id);\n } else {\n expandedSeriesInCurrentCoordinate.delete(id);\n }\n return { ...oldState, [x]: expandedSeriesInCurrentCoordinate };\n });\n }}\n />\n ),\n footer: renderers.footer?.(slotRenderProps),\n };\n}\n\nfunction getTooltipContentPie(\n api: ChartAPI,\n {\n point,\n renderers = {},\n hideTooltip,\n }: { point: Highcharts.Point } & { renderers?: CoreChartProps.TooltipContentRenderer; hideTooltip: () => void },\n): RenderedTooltipContent {\n const tooltipDetails: CoreChartProps.TooltipSlotProps = {\n x: point.x,\n items: [{ point, errorRanges: [] }],\n hideTooltip,\n };\n\n const itemOptions = api.context.settings.getItemOptions?.(getPointId(point));\n const markerAriaLabel = api.context.settings.labels.itemMarkerLabel?.(itemOptions?.status);\n\n return {\n header: renderers.header?.(tooltipDetails) ?? (\n <div className={styles[\"tooltip-default-header\"]}>\n {api.renderMarker({\n type: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: true,\n status: itemOptions?.status,\n ariaLabel: markerAriaLabel,\n })}\n <Box variant=\"span\" fontWeight=\"bold\">\n {point.name}\n </Box>\n </div>\n ),\n body:\n renderers.body?.(tooltipDetails) ??\n (renderers.details ? (\n <ChartSeriesDetails\n details={renderers.details({\n point,\n hideTooltip,\n })}\n compactList={true}\n />\n ) : (\n // We expect all pie chart segments to have defined y values. We use y=0 as fallback\n // because the property is optional in Highcharts types.\n <ChartSeriesDetails details={[{ key: point.series.name, value: point.y ?? 0 }]} />\n )),\n footer: renderers.footer?.(tooltipDetails),\n };\n}\n\nfunction findTooltipSeriesItems(\n series: readonly Highcharts.Series[],\n group: readonly Highcharts.Point[],\n seriesSorting: NonNullable<CoreChartProps.TooltipOptions[\"seriesSorting\"]>,\n): MatchedItem[] {\n const seriesOrder = series.reduce((d, s, i) => d.set(s, i), new Map<Highcharts.Series, number>());\n const getSeriesIndex = (s: Highcharts.Series) => seriesOrder.get(s) ?? -1;\n const seriesErrors = new Map<string, Highcharts.Point[]>();\n const matchedSeries = new Set<Highcharts.Series>();\n const matchedItems: MatchedItem[] = [];\n for (const point of group) {\n if (!isPointVisible(point)) {\n continue;\n }\n // We only support errorbar series that are linked to other series. In tooltip content we add\n // linked error bars to series detail slot.\n if (point.series.type === \"errorbar\") {\n if (point.series.linkedParent) {\n addError(getSeriesId(point.series.linkedParent), point);\n } else {\n warnOnce(\n \"chart-components\",\n 'The `linkedTo` property of \"errorbar\" series is missing, or points to a series that does not exist.',\n );\n }\n } else {\n addMatchedPoints(point);\n }\n }\n function addError(seriesId: string, errorPoint: Highcharts.Point) {\n if (errorPoint.options.low !== undefined && errorPoint.options.high !== undefined) {\n const errorRanges = seriesErrors.get(seriesId) ?? [];\n errorRanges.push(errorPoint);\n seriesErrors.set(seriesId, errorRanges);\n }\n }\n function addMatchedPoints(point: Highcharts.Point) {\n if (!matchedSeries.has(point.series)) {\n matchedSeries.add(point.series);\n if (isXThreshold(point.series)) {\n matchedItems.push({ point, errorRanges: [] });\n } else {\n point.series.data\n .filter((d) => d.x === point.x)\n .sort((a, b) => (a.y ?? 0) - (b.y ?? 0))\n .forEach((point) => matchedItems.push({ point, errorRanges: [] }));\n }\n }\n }\n return (\n matchedItems\n .sort((i1, i2) => {\n if (seriesSorting === \"by-value-desc\") {\n return (i2.point.y ?? 0) - (i1.point.y ?? 0);\n }\n // We sort matched items by series order. If there are multiple items that belong to the same series, we sort them by value.\n const s1 = getSeriesIndex(i1.point.series) - getSeriesIndex(i2.point.series);\n return s1 || (i1.point.y ?? 0) - (i2.point.y ?? 0);\n })\n // For each series item we add linked error ranges, sorted by their respective series indices.\n .map((item) => {\n const errorRanges = seriesErrors.get(getSeriesId(item.point.series)) ?? [];\n const sortedErrorRanges = errorRanges.sort((i1, i2) => getSeriesIndex(i1.series) - getSeriesIndex(i2.series));\n return { ...item, errorRanges: sortedErrorRanges };\n })\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chart-components";
2
- export var PACKAGE_VERSION = "1.0.0 (189d1bed)";
2
+ export var PACKAGE_VERSION = "1.0.0 (be40ed7a)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
  export var SYSTEM = "core";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "chart-components",
3
- "PACKAGE_VERSION": "1.0.0 (189d1bed)",
3
+ "PACKAGE_VERSION": "1.0.0 (be40ed7a)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true,
6
6
  "SYSTEM": "core"
@@ -558,6 +558,7 @@ export const fontChartDetailSize: string;
558
558
  export const fontDisplayLabelWeight: string;
559
559
  export const fontExpandableHeadingSize: string;
560
560
  export const fontFamilyBase: string;
561
+ export const fontFamilyDisplay: string;
561
562
  export const fontFamilyHeading: string;
562
563
  export const fontFamilyMonospace: string;
563
564
  export const fontHeaderH2DescriptionLineHeight: string;
@@ -558,6 +558,7 @@ export var fontChartDetailSize = "var(--font-chart-detail-size-9qr25q, 12px)";
558
558
  export var fontDisplayLabelWeight = "var(--font-display-label-weight-zavpeo, 700)";
559
559
  export var fontExpandableHeadingSize = "var(--font-expandable-heading-size-0uk059, 16px)";
560
560
  export var fontFamilyBase = "var(--font-family-base-gmnpzl, 'Open Sans', 'Helvetica Neue', Roboto, Arial, sans-serif)";
561
+ export var fontFamilyDisplay = "var(--font-family-display-a93nj0, 'Open Sans', 'Helvetica Neue', Roboto, Arial, sans-serif)";
561
562
  export var fontFamilyHeading = "var(--font-family-heading-ugphat, 'Open Sans', 'Helvetica Neue', Roboto, Arial, sans-serif)";
562
563
  export var fontFamilyMonospace = "var(--font-family-monospace-q47m7k, Monaco, Menlo, Consolas, 'Courier Prime', Courier, 'Courier New', monospace)";
563
564
  export var fontHeaderH2DescriptionLineHeight = "var(--font-header-h2-description-line-height-ts2s6o, 20px)";
@@ -2261,6 +2261,7 @@ module.exports.preset = {
2261
2261
  "fontDisplayLabelWeight": "700",
2262
2262
  "fontExpandableHeadingSize": "{fontSizeHeadingS}",
2263
2263
  "fontFamilyBase": "'Open Sans', 'Helvetica Neue', Roboto, Arial, sans-serif",
2264
+ "fontFamilyDisplay": "{fontFamilyBase}",
2264
2265
  "fontFamilyHeading": "{fontFamilyBase}",
2265
2266
  "fontFamilyMonospace": "Monaco, Menlo, Consolas, 'Courier Prime', Courier, 'Courier New', monospace",
2266
2267
  "fontHeaderH2DescriptionLineHeight": "{lineHeightBodyM}",
@@ -11733,6 +11734,7 @@ module.exports.preset = {
11733
11734
  "colorDropzoneBorderHover",
11734
11735
  "colorTreeViewConnectorLine",
11735
11736
  "fontFamilyBase",
11737
+ "fontFamilyDisplay",
11736
11738
  "fontFamilyHeading",
11737
11739
  "fontFamilyMonospace",
11738
11740
  "fontSizeBodyM",
@@ -11749,6 +11751,7 @@ module.exports.preset = {
11749
11751
  "fontWeightHeadingM",
11750
11752
  "fontWeightHeadingS",
11751
11753
  "fontWeightHeadingXs",
11754
+ "letterSpacingDisplayL",
11752
11755
  "letterSpacingHeadingXl",
11753
11756
  "letterSpacingHeadingL",
11754
11757
  "letterSpacingHeadingM",
@@ -12117,6 +12120,7 @@ module.exports.preset = {
12117
12120
  "colorDropzoneBorderHover",
12118
12121
  "colorTreeViewConnectorLine",
12119
12122
  "fontFamilyBase",
12123
+ "fontFamilyDisplay",
12120
12124
  "fontFamilyHeading",
12121
12125
  "fontFamilyMonospace",
12122
12126
  "fontSizeBodyM",
@@ -12133,6 +12137,7 @@ module.exports.preset = {
12133
12137
  "fontWeightHeadingM",
12134
12138
  "fontWeightHeadingS",
12135
12139
  "fontWeightHeadingXs",
12140
+ "letterSpacingDisplayL",
12136
12141
  "letterSpacingHeadingXl",
12137
12142
  "letterSpacingHeadingL",
12138
12143
  "letterSpacingHeadingM",
@@ -12772,6 +12777,7 @@ module.exports.preset = {
12772
12777
  "fontDisplayLabelWeight": "font-display-label-weight",
12773
12778
  "fontExpandableHeadingSize": "font-expandable-heading-size",
12774
12779
  "fontFamilyBase": "font-family-base",
12780
+ "fontFamilyDisplay": "font-family-display",
12775
12781
  "fontFamilyHeading": "font-family-heading",
12776
12782
  "fontFamilyMonospace": "font-family-monospace",
12777
12783
  "fontHeaderH2DescriptionLineHeight": "font-header-h2-description-line-height",
@@ -13593,6 +13599,7 @@ module.exports.preset = {
13593
13599
  "fontDisplayLabelWeight": "--font-display-label-weight-zavpeo",
13594
13600
  "fontExpandableHeadingSize": "--font-expandable-heading-size-0uk059",
13595
13601
  "fontFamilyBase": "--font-family-base-gmnpzl",
13602
+ "fontFamilyDisplay": "--font-family-display-a93nj0",
13596
13603
  "fontFamilyHeading": "--font-family-heading-ugphat",
13597
13604
  "fontFamilyMonospace": "--font-family-monospace-q47m7k",
13598
13605
  "fontHeaderH2DescriptionLineHeight": "--font-header-h2-description-line-height-ts2s6o",
@@ -230,6 +230,7 @@ export declare interface TypedOverride {
230
230
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
231
231
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
232
232
  fontFamilyBase?: GlobalValue;
233
+ fontFamilyDisplay?: GlobalValue;
233
234
  fontFamilyHeading?: GlobalValue;
234
235
  fontFamilyMonospace?: GlobalValue;
235
236
  fontSizeBodyM?: GlobalValue;
@@ -246,6 +247,7 @@ export declare interface TypedOverride {
246
247
  fontWeightHeadingM?: GlobalValue;
247
248
  fontWeightHeadingS?: GlobalValue;
248
249
  fontWeightHeadingXs?: GlobalValue;
250
+ letterSpacingDisplayL?: GlobalValue;
249
251
  letterSpacingHeadingXl?: GlobalValue;
250
252
  letterSpacingHeadingL?: GlobalValue;
251
253
  letterSpacingHeadingM?: GlobalValue;
@@ -518,6 +520,7 @@ export declare interface TypedOverride {
518
520
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
519
521
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
520
522
  fontFamilyBase?: GlobalValue;
523
+ fontFamilyDisplay?: GlobalValue;
521
524
  fontFamilyHeading?: GlobalValue;
522
525
  fontFamilyMonospace?: GlobalValue;
523
526
  fontSizeBodyM?: GlobalValue;
@@ -534,6 +537,7 @@ export declare interface TypedOverride {
534
537
  fontWeightHeadingM?: GlobalValue;
535
538
  fontWeightHeadingS?: GlobalValue;
536
539
  fontWeightHeadingXs?: GlobalValue;
540
+ letterSpacingDisplayL?: GlobalValue;
537
541
  letterSpacingHeadingXl?: GlobalValue;
538
542
  letterSpacingHeadingL?: GlobalValue;
539
543
  letterSpacingHeadingM?: GlobalValue;
@@ -806,6 +810,7 @@ export declare interface TypedOverride {
806
810
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
807
811
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
808
812
  fontFamilyBase?: GlobalValue;
813
+ fontFamilyDisplay?: GlobalValue;
809
814
  fontFamilyHeading?: GlobalValue;
810
815
  fontFamilyMonospace?: GlobalValue;
811
816
  fontSizeBodyM?: GlobalValue;
@@ -822,6 +827,7 @@ export declare interface TypedOverride {
822
827
  fontWeightHeadingM?: GlobalValue;
823
828
  fontWeightHeadingS?: GlobalValue;
824
829
  fontWeightHeadingXs?: GlobalValue;
830
+ letterSpacingDisplayL?: GlobalValue;
825
831
  letterSpacingHeadingXl?: GlobalValue;
826
832
  letterSpacingHeadingL?: GlobalValue;
827
833
  letterSpacingHeadingM?: GlobalValue;
@@ -1094,6 +1100,7 @@ export declare interface TypedOverride {
1094
1100
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1095
1101
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1096
1102
  fontFamilyBase?: GlobalValue;
1103
+ fontFamilyDisplay?: GlobalValue;
1097
1104
  fontFamilyHeading?: GlobalValue;
1098
1105
  fontFamilyMonospace?: GlobalValue;
1099
1106
  fontSizeBodyM?: GlobalValue;
@@ -1110,6 +1117,7 @@ export declare interface TypedOverride {
1110
1117
  fontWeightHeadingM?: GlobalValue;
1111
1118
  fontWeightHeadingS?: GlobalValue;
1112
1119
  fontWeightHeadingXs?: GlobalValue;
1120
+ letterSpacingDisplayL?: GlobalValue;
1113
1121
  letterSpacingHeadingXl?: GlobalValue;
1114
1122
  letterSpacingHeadingL?: GlobalValue;
1115
1123
  letterSpacingHeadingM?: GlobalValue;
@@ -1382,6 +1390,7 @@ export declare interface TypedOverride {
1382
1390
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1383
1391
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1384
1392
  fontFamilyBase?: GlobalValue;
1393
+ fontFamilyDisplay?: GlobalValue;
1385
1394
  fontFamilyHeading?: GlobalValue;
1386
1395
  fontFamilyMonospace?: GlobalValue;
1387
1396
  fontSizeBodyM?: GlobalValue;
@@ -1398,6 +1407,7 @@ export declare interface TypedOverride {
1398
1407
  fontWeightHeadingM?: GlobalValue;
1399
1408
  fontWeightHeadingS?: GlobalValue;
1400
1409
  fontWeightHeadingXs?: GlobalValue;
1410
+ letterSpacingDisplayL?: GlobalValue;
1401
1411
  letterSpacingHeadingXl?: GlobalValue;
1402
1412
  letterSpacingHeadingL?: GlobalValue;
1403
1413
  letterSpacingHeadingM?: GlobalValue;
@@ -1670,6 +1680,7 @@ export declare interface TypedOverride {
1670
1680
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1671
1681
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1672
1682
  fontFamilyBase?: GlobalValue;
1683
+ fontFamilyDisplay?: GlobalValue;
1673
1684
  fontFamilyHeading?: GlobalValue;
1674
1685
  fontFamilyMonospace?: GlobalValue;
1675
1686
  fontSizeBodyM?: GlobalValue;
@@ -1686,6 +1697,7 @@ export declare interface TypedOverride {
1686
1697
  fontWeightHeadingM?: GlobalValue;
1687
1698
  fontWeightHeadingS?: GlobalValue;
1688
1699
  fontWeightHeadingXs?: GlobalValue;
1700
+ letterSpacingDisplayL?: GlobalValue;
1689
1701
  letterSpacingHeadingXl?: GlobalValue;
1690
1702
  letterSpacingHeadingL?: GlobalValue;
1691
1703
  letterSpacingHeadingM?: GlobalValue;
@@ -1958,6 +1970,7 @@ export declare interface TypedOverride {
1958
1970
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1959
1971
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1960
1972
  fontFamilyBase?: GlobalValue;
1973
+ fontFamilyDisplay?: GlobalValue;
1961
1974
  fontFamilyHeading?: GlobalValue;
1962
1975
  fontFamilyMonospace?: GlobalValue;
1963
1976
  fontSizeBodyM?: GlobalValue;
@@ -1974,6 +1987,7 @@ export declare interface TypedOverride {
1974
1987
  fontWeightHeadingM?: GlobalValue;
1975
1988
  fontWeightHeadingS?: GlobalValue;
1976
1989
  fontWeightHeadingXs?: GlobalValue;
1990
+ letterSpacingDisplayL?: GlobalValue;
1977
1991
  letterSpacingHeadingXl?: GlobalValue;
1978
1992
  letterSpacingHeadingL?: GlobalValue;
1979
1993
  letterSpacingHeadingM?: GlobalValue;
@@ -2246,6 +2260,7 @@ export declare interface TypedOverride {
2246
2260
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2247
2261
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2248
2262
  fontFamilyBase?: GlobalValue;
2263
+ fontFamilyDisplay?: GlobalValue;
2249
2264
  fontFamilyHeading?: GlobalValue;
2250
2265
  fontFamilyMonospace?: GlobalValue;
2251
2266
  fontSizeBodyM?: GlobalValue;
@@ -2262,6 +2277,7 @@ export declare interface TypedOverride {
2262
2277
  fontWeightHeadingM?: GlobalValue;
2263
2278
  fontWeightHeadingS?: GlobalValue;
2264
2279
  fontWeightHeadingXs?: GlobalValue;
2280
+ letterSpacingDisplayL?: GlobalValue;
2265
2281
  letterSpacingHeadingXl?: GlobalValue;
2266
2282
  letterSpacingHeadingL?: GlobalValue;
2267
2283
  letterSpacingHeadingM?: GlobalValue;
@@ -2534,6 +2550,7 @@ export declare interface TypedOverride {
2534
2550
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2535
2551
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2536
2552
  fontFamilyBase?: GlobalValue;
2553
+ fontFamilyDisplay?: GlobalValue;
2537
2554
  fontFamilyHeading?: GlobalValue;
2538
2555
  fontFamilyMonospace?: GlobalValue;
2539
2556
  fontSizeBodyM?: GlobalValue;
@@ -2550,6 +2567,7 @@ export declare interface TypedOverride {
2550
2567
  fontWeightHeadingM?: GlobalValue;
2551
2568
  fontWeightHeadingS?: GlobalValue;
2552
2569
  fontWeightHeadingXs?: GlobalValue;
2570
+ letterSpacingDisplayL?: GlobalValue;
2553
2571
  letterSpacingHeadingXl?: GlobalValue;
2554
2572
  letterSpacingHeadingL?: GlobalValue;
2555
2573
  letterSpacingHeadingM?: GlobalValue;
@@ -230,6 +230,7 @@ export declare interface TypedOverride {
230
230
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
231
231
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
232
232
  fontFamilyBase?: GlobalValue;
233
+ fontFamilyDisplay?: GlobalValue;
233
234
  fontFamilyHeading?: GlobalValue;
234
235
  fontFamilyMonospace?: GlobalValue;
235
236
  fontSizeBodyM?: GlobalValue;
@@ -246,6 +247,7 @@ export declare interface TypedOverride {
246
247
  fontWeightHeadingM?: GlobalValue;
247
248
  fontWeightHeadingS?: GlobalValue;
248
249
  fontWeightHeadingXs?: GlobalValue;
250
+ letterSpacingDisplayL?: GlobalValue;
249
251
  letterSpacingHeadingXl?: GlobalValue;
250
252
  letterSpacingHeadingL?: GlobalValue;
251
253
  letterSpacingHeadingM?: GlobalValue;
@@ -518,6 +520,7 @@ export declare interface TypedOverride {
518
520
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
519
521
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
520
522
  fontFamilyBase?: GlobalValue;
523
+ fontFamilyDisplay?: GlobalValue;
521
524
  fontFamilyHeading?: GlobalValue;
522
525
  fontFamilyMonospace?: GlobalValue;
523
526
  fontSizeBodyM?: GlobalValue;
@@ -534,6 +537,7 @@ export declare interface TypedOverride {
534
537
  fontWeightHeadingM?: GlobalValue;
535
538
  fontWeightHeadingS?: GlobalValue;
536
539
  fontWeightHeadingXs?: GlobalValue;
540
+ letterSpacingDisplayL?: GlobalValue;
537
541
  letterSpacingHeadingXl?: GlobalValue;
538
542
  letterSpacingHeadingL?: GlobalValue;
539
543
  letterSpacingHeadingM?: GlobalValue;
@@ -806,6 +810,7 @@ export declare interface TypedOverride {
806
810
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
807
811
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
808
812
  fontFamilyBase?: GlobalValue;
813
+ fontFamilyDisplay?: GlobalValue;
809
814
  fontFamilyHeading?: GlobalValue;
810
815
  fontFamilyMonospace?: GlobalValue;
811
816
  fontSizeBodyM?: GlobalValue;
@@ -822,6 +827,7 @@ export declare interface TypedOverride {
822
827
  fontWeightHeadingM?: GlobalValue;
823
828
  fontWeightHeadingS?: GlobalValue;
824
829
  fontWeightHeadingXs?: GlobalValue;
830
+ letterSpacingDisplayL?: GlobalValue;
825
831
  letterSpacingHeadingXl?: GlobalValue;
826
832
  letterSpacingHeadingL?: GlobalValue;
827
833
  letterSpacingHeadingM?: GlobalValue;
@@ -1094,6 +1100,7 @@ export declare interface TypedOverride {
1094
1100
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1095
1101
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1096
1102
  fontFamilyBase?: GlobalValue;
1103
+ fontFamilyDisplay?: GlobalValue;
1097
1104
  fontFamilyHeading?: GlobalValue;
1098
1105
  fontFamilyMonospace?: GlobalValue;
1099
1106
  fontSizeBodyM?: GlobalValue;
@@ -1110,6 +1117,7 @@ export declare interface TypedOverride {
1110
1117
  fontWeightHeadingM?: GlobalValue;
1111
1118
  fontWeightHeadingS?: GlobalValue;
1112
1119
  fontWeightHeadingXs?: GlobalValue;
1120
+ letterSpacingDisplayL?: GlobalValue;
1113
1121
  letterSpacingHeadingXl?: GlobalValue;
1114
1122
  letterSpacingHeadingL?: GlobalValue;
1115
1123
  letterSpacingHeadingM?: GlobalValue;
@@ -1382,6 +1390,7 @@ export declare interface TypedOverride {
1382
1390
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1383
1391
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1384
1392
  fontFamilyBase?: GlobalValue;
1393
+ fontFamilyDisplay?: GlobalValue;
1385
1394
  fontFamilyHeading?: GlobalValue;
1386
1395
  fontFamilyMonospace?: GlobalValue;
1387
1396
  fontSizeBodyM?: GlobalValue;
@@ -1398,6 +1407,7 @@ export declare interface TypedOverride {
1398
1407
  fontWeightHeadingM?: GlobalValue;
1399
1408
  fontWeightHeadingS?: GlobalValue;
1400
1409
  fontWeightHeadingXs?: GlobalValue;
1410
+ letterSpacingDisplayL?: GlobalValue;
1401
1411
  letterSpacingHeadingXl?: GlobalValue;
1402
1412
  letterSpacingHeadingL?: GlobalValue;
1403
1413
  letterSpacingHeadingM?: GlobalValue;
@@ -1670,6 +1680,7 @@ export declare interface TypedOverride {
1670
1680
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1671
1681
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1672
1682
  fontFamilyBase?: GlobalValue;
1683
+ fontFamilyDisplay?: GlobalValue;
1673
1684
  fontFamilyHeading?: GlobalValue;
1674
1685
  fontFamilyMonospace?: GlobalValue;
1675
1686
  fontSizeBodyM?: GlobalValue;
@@ -1686,6 +1697,7 @@ export declare interface TypedOverride {
1686
1697
  fontWeightHeadingM?: GlobalValue;
1687
1698
  fontWeightHeadingS?: GlobalValue;
1688
1699
  fontWeightHeadingXs?: GlobalValue;
1700
+ letterSpacingDisplayL?: GlobalValue;
1689
1701
  letterSpacingHeadingXl?: GlobalValue;
1690
1702
  letterSpacingHeadingL?: GlobalValue;
1691
1703
  letterSpacingHeadingM?: GlobalValue;
@@ -1958,6 +1970,7 @@ export declare interface TypedOverride {
1958
1970
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1959
1971
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
1960
1972
  fontFamilyBase?: GlobalValue;
1973
+ fontFamilyDisplay?: GlobalValue;
1961
1974
  fontFamilyHeading?: GlobalValue;
1962
1975
  fontFamilyMonospace?: GlobalValue;
1963
1976
  fontSizeBodyM?: GlobalValue;
@@ -1974,6 +1987,7 @@ export declare interface TypedOverride {
1974
1987
  fontWeightHeadingM?: GlobalValue;
1975
1988
  fontWeightHeadingS?: GlobalValue;
1976
1989
  fontWeightHeadingXs?: GlobalValue;
1990
+ letterSpacingDisplayL?: GlobalValue;
1977
1991
  letterSpacingHeadingXl?: GlobalValue;
1978
1992
  letterSpacingHeadingL?: GlobalValue;
1979
1993
  letterSpacingHeadingM?: GlobalValue;
@@ -2246,6 +2260,7 @@ export declare interface TypedOverride {
2246
2260
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2247
2261
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2248
2262
  fontFamilyBase?: GlobalValue;
2263
+ fontFamilyDisplay?: GlobalValue;
2249
2264
  fontFamilyHeading?: GlobalValue;
2250
2265
  fontFamilyMonospace?: GlobalValue;
2251
2266
  fontSizeBodyM?: GlobalValue;
@@ -2262,6 +2277,7 @@ export declare interface TypedOverride {
2262
2277
  fontWeightHeadingM?: GlobalValue;
2263
2278
  fontWeightHeadingS?: GlobalValue;
2264
2279
  fontWeightHeadingXs?: GlobalValue;
2280
+ letterSpacingDisplayL?: GlobalValue;
2265
2281
  letterSpacingHeadingXl?: GlobalValue;
2266
2282
  letterSpacingHeadingL?: GlobalValue;
2267
2283
  letterSpacingHeadingM?: GlobalValue;
@@ -2534,6 +2550,7 @@ export declare interface TypedOverride {
2534
2550
  colorDropzoneBorderHover?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2535
2551
  colorTreeViewConnectorLine?: GlobalValue | TypedModeValueOverride<'light' | 'dark'>;
2536
2552
  fontFamilyBase?: GlobalValue;
2553
+ fontFamilyDisplay?: GlobalValue;
2537
2554
  fontFamilyHeading?: GlobalValue;
2538
2555
  fontFamilyMonospace?: GlobalValue;
2539
2556
  fontSizeBodyM?: GlobalValue;
@@ -2550,6 +2567,7 @@ export declare interface TypedOverride {
2550
2567
  fontWeightHeadingM?: GlobalValue;
2551
2568
  fontWeightHeadingS?: GlobalValue;
2552
2569
  fontWeightHeadingXs?: GlobalValue;
2570
+ letterSpacingDisplayL?: GlobalValue;
2553
2571
  letterSpacingHeadingXl?: GlobalValue;
2554
2572
  letterSpacingHeadingL?: GlobalValue;
2555
2573
  letterSpacingHeadingM?: GlobalValue;
@@ -2261,6 +2261,7 @@ export var preset = {
2261
2261
  "fontDisplayLabelWeight": "700",
2262
2262
  "fontExpandableHeadingSize": "{fontSizeHeadingS}",
2263
2263
  "fontFamilyBase": "'Open Sans', 'Helvetica Neue', Roboto, Arial, sans-serif",
2264
+ "fontFamilyDisplay": "{fontFamilyBase}",
2264
2265
  "fontFamilyHeading": "{fontFamilyBase}",
2265
2266
  "fontFamilyMonospace": "Monaco, Menlo, Consolas, 'Courier Prime', Courier, 'Courier New', monospace",
2266
2267
  "fontHeaderH2DescriptionLineHeight": "{lineHeightBodyM}",
@@ -11733,6 +11734,7 @@ export var preset = {
11733
11734
  "colorDropzoneBorderHover",
11734
11735
  "colorTreeViewConnectorLine",
11735
11736
  "fontFamilyBase",
11737
+ "fontFamilyDisplay",
11736
11738
  "fontFamilyHeading",
11737
11739
  "fontFamilyMonospace",
11738
11740
  "fontSizeBodyM",
@@ -11749,6 +11751,7 @@ export var preset = {
11749
11751
  "fontWeightHeadingM",
11750
11752
  "fontWeightHeadingS",
11751
11753
  "fontWeightHeadingXs",
11754
+ "letterSpacingDisplayL",
11752
11755
  "letterSpacingHeadingXl",
11753
11756
  "letterSpacingHeadingL",
11754
11757
  "letterSpacingHeadingM",
@@ -12117,6 +12120,7 @@ export var preset = {
12117
12120
  "colorDropzoneBorderHover",
12118
12121
  "colorTreeViewConnectorLine",
12119
12122
  "fontFamilyBase",
12123
+ "fontFamilyDisplay",
12120
12124
  "fontFamilyHeading",
12121
12125
  "fontFamilyMonospace",
12122
12126
  "fontSizeBodyM",
@@ -12133,6 +12137,7 @@ export var preset = {
12133
12137
  "fontWeightHeadingM",
12134
12138
  "fontWeightHeadingS",
12135
12139
  "fontWeightHeadingXs",
12140
+ "letterSpacingDisplayL",
12136
12141
  "letterSpacingHeadingXl",
12137
12142
  "letterSpacingHeadingL",
12138
12143
  "letterSpacingHeadingM",
@@ -12772,6 +12777,7 @@ export var preset = {
12772
12777
  "fontDisplayLabelWeight": "font-display-label-weight",
12773
12778
  "fontExpandableHeadingSize": "font-expandable-heading-size",
12774
12779
  "fontFamilyBase": "font-family-base",
12780
+ "fontFamilyDisplay": "font-family-display",
12775
12781
  "fontFamilyHeading": "font-family-heading",
12776
12782
  "fontFamilyMonospace": "font-family-monospace",
12777
12783
  "fontHeaderH2DescriptionLineHeight": "font-header-h2-description-line-height",
@@ -13593,6 +13599,7 @@ export var preset = {
13593
13599
  "fontDisplayLabelWeight": "--font-display-label-weight-zavpeo",
13594
13600
  "fontExpandableHeadingSize": "--font-expandable-heading-size-0uk059",
13595
13601
  "fontFamilyBase": "--font-family-base-gmnpzl",
13602
+ "fontFamilyDisplay": "--font-family-display-a93nj0",
13596
13603
  "fontFamilyHeading": "--font-family-heading-ugphat",
13597
13604
  "fontFamilyMonospace": "--font-family-monospace-q47m7k",
13598
13605
  "fontHeaderH2DescriptionLineHeight": "--font-header-h2-description-line-height-ts2s6o",
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "189d1bed96f041fa9dc3f0bc657d3c768f7a67e5"
2
+ "commit": "be40ed7a04b4bea99adc7c2fda9c72d13b6f03df"
3
3
  }
@@ -1,8 +1,9 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ import { isPointVisible } from "../../core/utils";
3
4
  // Although series data can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints
4
5
  // than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)
5
6
  export const getSeriesData = (data) => {
6
- return data.filter((d) => !!d);
7
+ return data.filter((d) => !!d && isPointVisible(d));
7
8
  };
8
9
  //# sourceMappingURL=series-data.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"series-data.js","sourceRoot":"","sources":["../../../../src/internal/utils/series-data.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,qIAAqI;AACrI,wIAAwI;AACxI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAkB,EAAgB,EAAE;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point } from \"highcharts\";\n\n// Although series data can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints\n// than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)\nexport const getSeriesData = (data: Array<Point>): Array<Point> => {\n return data.filter((d) => !!d);\n};\n"]}
1
+ {"version":3,"file":"series-data.js","sourceRoot":"","sources":["../../../../src/internal/utils/series-data.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,qIAAqI;AACrI,wIAAwI;AACxI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAkB,EAAgB,EAAE;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point } from \"highcharts\";\n\nimport { isPointVisible } from \"../../core/utils\";\n\n// Although series data can't be undefined according to Highcharts API, it does become undefined for chart containing more datapoints\n// than the cropThreshold for that series (specific cases of re-rendering the chart with updated options listening to setExteme updates)\nexport const getSeriesData = (data: Array<Point>): Array<Point> => {\n return data.filter((d) => !!d && isPointVisible(d));\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chart-components",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chart-components.git"
@@ -41,6 +41,22 @@ declare module "@cloudscape-design/test-utils-core/dist/dom" {
41
41
  * @returns {PieChartWrapper[]}
42
42
  */
43
43
  findAllPieHighcharts(selector?: string): Array<PieChartWrapper>;
44
+ /**
45
+ * Returns the wrapper of the closest parent CartesianChart for the current element,
46
+ * or the element itself if it is a CartesianChart.
47
+ * If no matching CartesianChart is found, returns `null`.
48
+ *
49
+ * @returns {CartesianChartWrapper | null}
50
+ */
51
+ findClosestCartesianHighcharts(): CartesianChartWrapper | null;
52
+ /**
53
+ * Returns the wrapper of the closest parent PieChart for the current element,
54
+ * or the element itself if it is a PieChart itself.
55
+ * If no matching PieChart is found, returns `null`.
56
+ *
57
+ * @returns {PieChartWrapper | null}
58
+ */
59
+ findClosestPieHighcharts(): PieChartWrapper | null;
44
60
  }
45
61
  }
46
62
  export default function wrapper(root?: Element): ElementWrapper<Element>;
@@ -23,6 +23,12 @@ dom_1.ElementWrapper.prototype.findAllCartesianHighcharts = function (selector)
23
23
  dom_1.ElementWrapper.prototype.findAllPieHighcharts = function (selector) {
24
24
  return this.findAllComponents(pie_chart_1.default, selector);
25
25
  };
26
+ dom_1.ElementWrapper.prototype.findClosestCartesianHighcharts = function () {
27
+ return this.findClosestComponent(cartesian_chart_1.default);
28
+ };
29
+ dom_1.ElementWrapper.prototype.findClosestPieHighcharts = function () {
30
+ return this.findClosestComponent(pie_chart_1.default);
31
+ };
26
32
  function getComponentSelector(wrapper, selector) {
27
33
  return selector ? (0, utils_1.appendSelector)(selector, `.${wrapper.rootSelector}`) : `.${wrapper.rootSelector}`;
28
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/dom/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAs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AAI,CACV,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\nimport { appendSelector } from \"@cloudscape-design/test-utils-core/utils\";\n\nexport { ElementWrapper };\n\nimport CartesianChartWrapper from \"./cartesian-chart\";\nimport PieChartWrapper from \"./pie-chart\";\n\nexport { CartesianChartWrapper, PieChartWrapper };\n\ndeclare module \"@cloudscape-design/test-utils-core/dist/dom\" {\n interface ElementWrapper {\n /**\n * Returns the wrapper of the first cartesian chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first cartesian chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper | null}\n */\n findCartesianHighcharts(selector?: string): CartesianChartWrapper | null;\n /**\n * Returns the wrapper of the first pie chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first pie chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper | null}\n */\n findPieHighcharts(selector?: string): PieChartWrapper | null;\n /**\n * Returns an array of cartesian chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all cartesian charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper[]}\n */\n findAllCartesianHighcharts(selector?: string): Array<CartesianChartWrapper>;\n /**\n * Returns an array of pie chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all pie charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper[]}\n */\n findAllPieHighcharts(selector?: string): Array<PieChartWrapper>;\n }\n}\n\nElementWrapper.prototype.findCartesianHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(CartesianChartWrapper, selector), CartesianChartWrapper);\n};\nElementWrapper.prototype.findPieHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(PieChartWrapper, selector), PieChartWrapper);\n};\nElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {\n return this.findAllComponents(CartesianChartWrapper, selector);\n};\nElementWrapper.prototype.findAllPieHighcharts = function (selector) {\n return this.findAllComponents(PieChartWrapper, selector);\n};\n\nfunction getComponentSelector(wrapper: { rootSelector: string }, selector?: string) {\n return selector ? appendSelector(selector, `.${wrapper.rootSelector}`) : `.${wrapper.rootSelector}`;\n}\n\nexport default function wrapper(root: Element = document.body) {\n if (document && document.body && !document.body.contains(root)) {\n console.warn(\n \"[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly\",\n );\n }\n return new ElementWrapper(root);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/dom/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AA8FtC,0BAOC;AAnGD,gEAAwE;AAG/D,+FAHA,oBAAc,OAGA;AAFvB,oEAA0E;AAI1E,uDAAsD;AAG7C,gCAHF,yBAAqB,CAGE;AAF9B,2CAA0C;AAEV,0BAFzB,mBAAe,CAEyB;AA6D/C,oBAAc,CAAC,SAAS,CAAC,uBAAuB,GAAG,UAAU,QAAQ;IACnE,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,yBAAqB,EAAE,QAAQ,CAAC,EAAE,yBAAqB,CAAC,CAAC;AAC1G,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,QAAQ;IAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,mBAAe,EAAE,QAAQ,CAAC,EAAE,mBAAe,CAAC,CAAC;AAC9F,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,0BAA0B,GAAG,UAAU,QAAQ;IACtE,OAAO,IAAI,CAAC,iBAAiB,CAAC,yBAAqB,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,oBAAoB,GAAG,UAAU,QAAQ;IAChE,OAAO,IAAI,CAAC,iBAAiB,CAAC,mBAAe,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,8BAA8B,GAAG;IACxD,OAAO,IAAI,CAAC,oBAAoB,CAAC,yBAAqB,CAAC,CAAC;AAC1D,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,wBAAwB,GAAG;IAClD,OAAO,IAAI,CAAC,oBAAoB,CAAC,mBAAe,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,OAAiC,EAAE,QAAiB;IAChF,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,sBAAc,EAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;AACtG,CAAC;AAED,SAAwB,OAAO,CAAC,OAAgB,QAAQ,CAAC,IAAI;IAC3D,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,OAAO,CAAC,IAAI,CACV,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\nimport { appendSelector } from \"@cloudscape-design/test-utils-core/utils\";\n\nexport { ElementWrapper };\n\nimport CartesianChartWrapper from \"./cartesian-chart\";\nimport PieChartWrapper from \"./pie-chart\";\n\nexport { CartesianChartWrapper, PieChartWrapper };\n\ndeclare module \"@cloudscape-design/test-utils-core/dist/dom\" {\n interface ElementWrapper {\n /**\n * Returns the wrapper of the first cartesian chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first cartesian chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper | null}\n */\n findCartesianHighcharts(selector?: string): CartesianChartWrapper | null;\n /**\n * Returns the wrapper of the first pie chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first pie chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper | null}\n */\n findPieHighcharts(selector?: string): PieChartWrapper | null;\n /**\n * Returns an array of cartesian chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all cartesian charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper[]}\n */\n findAllCartesianHighcharts(selector?: string): Array<CartesianChartWrapper>;\n /**\n * Returns an array of pie chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all pie charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper[]}\n */\n findAllPieHighcharts(selector?: string): Array<PieChartWrapper>;\n\n /**\n * Returns the wrapper of the closest parent CartesianChart for the current element,\n * or the element itself if it is a CartesianChart.\n * If no matching CartesianChart is found, returns `null`.\n *\n * @returns {CartesianChartWrapper | null}\n */\n findClosestCartesianHighcharts(): CartesianChartWrapper | null;\n\n /**\n * Returns the wrapper of the closest parent PieChart for the current element,\n * or the element itself if it is a PieChart itself.\n * If no matching PieChart is found, returns `null`.\n *\n * @returns {PieChartWrapper | null}\n */\n findClosestPieHighcharts(): PieChartWrapper | null;\n }\n}\n\nElementWrapper.prototype.findCartesianHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(CartesianChartWrapper, selector), CartesianChartWrapper);\n};\nElementWrapper.prototype.findPieHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(PieChartWrapper, selector), PieChartWrapper);\n};\nElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {\n return this.findAllComponents(CartesianChartWrapper, selector);\n};\nElementWrapper.prototype.findAllPieHighcharts = function (selector) {\n return this.findAllComponents(PieChartWrapper, selector);\n};\nElementWrapper.prototype.findClosestCartesianHighcharts = function () {\n return this.findClosestComponent(CartesianChartWrapper);\n};\nElementWrapper.prototype.findClosestPieHighcharts = function () {\n return this.findClosestComponent(PieChartWrapper);\n};\n\nfunction getComponentSelector(wrapper: { rootSelector: string }, selector?: string) {\n return selector ? appendSelector(selector, `.${wrapper.rootSelector}`) : `.${wrapper.rootSelector}`;\n}\n\nexport default function wrapper(root: Element = document.body) {\n if (document && document.body && !document.body.contains(root)) {\n console.warn(\n \"[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly\",\n );\n }\n return new ElementWrapper(root);\n}\n"]}