@cloudscape-design/chart-components 1.0.48 → 1.0.50

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.
@@ -16,7 +16,7 @@ const CartesianChart = forwardRef(({ fitHeight = false, inverted = false, stacki
16
16
  const yAxis = transformYAxisOptions(props.yAxis);
17
17
  const tooltip = transformTooltip(props.tooltip);
18
18
  const legend = transformLegend(props.legend);
19
- const baseComponentProps = useBaseComponent("CartesianChart", {
19
+ const baseComponentProps = useBaseComponent("CartesianHighcharts", {
20
20
  props: { fitHeight, inverted, stacking, emphasizeBaseline, verticalAxisTitlePlacement },
21
21
  metadata: {},
22
22
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cartesian-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EACE,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,SAAS,EACpB,iBAAiB,GAAG,IAAI,EACxB,0BAA0B,GAAG,KAAK,EAClC,GAAG,KAAK,EACY,EACtB,GAAuC,EACvC,EAAE;IACF,0FAA0F;IAC1F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,C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AI,uBAAJ,IAAI,CAAE,cAAc,EAAE,CAAC;AACjF,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAQ;IAER,OAAO;QACL,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;QAChB,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK;QAClB,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,YAAY,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY;QAChC,UAAU,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU;QAC5B,cAAc,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc;KAChC,CAAC;AACT,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA4C;;IAE5C,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI;QACjC,SAAS,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,QAAQ;QACzC,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,MAA0C;;IAE1C,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PointDataItemType, RangeDataItemOptions } from \"../core/interfaces\";\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalCartesianChart } from \"./chart-cartesian-internal\";\nimport { CartesianChartProps } from \"./interfaces\";\n\nexport type { CartesianChartProps };\n\nconst CartesianChart = forwardRef(\n (\n {\n fitHeight = false,\n inverted = false,\n stacking = undefined,\n emphasizeBaseline = true,\n verticalAxisTitlePlacement = \"top\",\n ...props\n }: CartesianChartProps,\n ref: React.Ref<CartesianChartProps.Ref>,\n ) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series, stacking);\n const xAxis = transformXAxisOptions(props.xAxis);\n const yAxis = transformYAxisOptions(props.yAxis);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"CartesianChart\", {\n props: { fitHeight, inverted, stacking, emphasizeBaseline, verticalAxisTitlePlacement },\n metadata: {},\n });\n\n return (\n <InternalCartesianChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n inverted={inverted}\n stacking={stacking}\n emphasizeBaseline={emphasizeBaseline}\n verticalAxisTitlePlacement={verticalAxisTitlePlacement}\n series={series}\n xAxis={xAxis}\n yAxis={yAxis}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n },\n);\n\napplyDisplayName(CartesianChart, \"CartesianChart\");\n\nexport default CartesianChart;\n\nfunction transformSeries(\n untransformedSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): CartesianChartProps.SeriesOptions[] {\n const transformedSeries: CartesianChartProps.SeriesOptions[] = [];\n function transformSingleSeries(s: CartesianChartProps.SeriesOptions): null | CartesianChartProps.SeriesOptions {\n switch (s.type) {\n case \"area\":\n case \"areaspline\":\n case \"line\":\n case \"spline\":\n return transformLineLikeSeries(s);\n case \"column\":\n return transformColumnSeries(s);\n case \"scatter\":\n return transformScatterSeries(s);\n case \"errorbar\":\n return transformErrorBarSeries(s, untransformedSeries, stacking);\n case \"x-threshold\":\n case \"y-threshold\":\n return transformThresholdSeries(s);\n default:\n return null;\n }\n }\n for (const series of untransformedSeries) {\n const transformed = transformSingleSeries(series);\n if (transformed) {\n transformedSeries.push(transformed);\n }\n }\n return transformedSeries;\n}\n\nfunction transformLineLikeSeries<\n S extends\n | CartesianChartProps.AreaSeriesOptions\n | CartesianChartProps.AreaSplineSeriesOptions\n | CartesianChartProps.LineSeriesOptions\n | CartesianChartProps.SplineSeriesOptions,\n>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, dashStyle: s.dashStyle, data } as S;\n}\n\nfunction transformColumnSeries<S extends CartesianChartProps.ColumnSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, data } as S;\n}\n\nfunction transformScatterSeries<S extends CartesianChartProps.ScatterSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n const marker = s.marker ?? {};\n return { type: s.type, id: s.id, name: s.name, color: s.color, data, marker } as S;\n}\n\nfunction transformThresholdSeries<\n S extends CartesianChartProps.XThresholdSeriesOptions | CartesianChartProps.YThresholdSeriesOptions,\n>(s: S): null | S {\n return { type: s.type, id: s.id, name: s.name, color: s.color, value: s.value, dashStyle: s.dashStyle } as S;\n}\n\nfunction transformErrorBarSeries(\n series: CartesianChartProps.ErrorBarSeriesOptions,\n allSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): null | CartesianChartProps.ErrorBarSeriesOptions {\n // Highcharts only supports error bars for non-stacked series.\n // See: https://github.com/highcharts/highcharts/issues/23080.\n if (stacking) {\n warnOnce(\"CartesianChart\", \"Error bars are not supported for stacked series.\");\n return null;\n }\n // We only support error bars that are linked to some other series. It is only possible to link it\n // using series ID (but not name), or by using \":previous\" pseudo-selector.\n // See: https://api.highcharts.com/highcharts/series.errorbar.linkedTo.\n const linkedSeries =\n series.linkedTo === \":previous\"\n ? allSeries[allSeries.indexOf(series) - 1]\n : allSeries.find(({ id }) => id === series.linkedTo);\n // The non-linked error bars are not supported: those will not appear in our custom legend and tooltip,\n // so we remove them from the series array. We also do not support linking them to other error bars,\n // or our custom threshold series.\n if (!linkedSeries || [\"errorbar\", \"x-threshold\", \"y-threshold\"].includes(linkedSeries.type)) {\n warnOnce(\n \"CartesianChart\",\n 'The `linkedTo` property of \"errorbar\" series points to a missing, or unsupported series.',\n );\n return null;\n }\n const data = transformRangeData(series.data);\n return { type: series.type, id: series.id, name: series.name, color: series.color, linkedTo: series.linkedTo, data };\n}\n\nfunction transformPointData(data: readonly PointDataItemType[]): readonly PointDataItemType[] {\n return data.map((d) => (d && typeof d === \"object\" ? { x: d.x, y: d.y } : d));\n}\n\nfunction transformRangeData(data: readonly RangeDataItemOptions[]): readonly RangeDataItemOptions[] {\n return data.map((d) => ({ x: d.x, low: d.low, high: d.high }));\n}\n\nfunction transformXAxisOptions(axis?: CartesianChartProps.XAxisOptions): CartesianChartProps.XAxisOptions {\n return transformAxisOptions(axis);\n}\n\nfunction transformYAxisOptions(axis?: CartesianChartProps.YAxisOptions): CartesianChartProps.YAxisOptions {\n return { ...transformAxisOptions(axis), reversedStacks: axis?.reversedStacks };\n}\n\nfunction transformAxisOptions<O extends CartesianChartProps.XAxisOptions | CartesianChartProps.YAxisOptions>(\n axis?: O,\n): O {\n return {\n type: axis?.type,\n title: axis?.title,\n min: axis?.min,\n max: axis?.max,\n tickInterval: axis?.tickInterval,\n categories: axis?.categories,\n valueFormatter: axis?.valueFormatter,\n } as O;\n}\n\nfunction transformTooltip(\n tooltip?: CartesianChartProps.TooltipOptions,\n): SomeRequired<CartesianChartProps.TooltipOptions, \"enabled\" | \"placement\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n placement: tooltip?.placement ?? \"middle\",\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(\n legend?: CartesianChartProps.LegendOptions,\n): SomeRequired<CartesianChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cartesian-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EACE,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,SAAS,EACpB,iBAAiB,GAAG,IAAI,EACxB,0BAA0B,GAAG,KAAK,EAClC,GAAG,KAAK,EACY,EACtB,GAAuC,EACvC,EAAE;IACF,0FAA0F;IAC1F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM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AAE,KAAK;QAClB,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,GAAG;QACd,YAAY,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY;QAChC,UAAU,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU;QAC5B,cAAc,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc;KAChC,CAAC;AACT,CAAC;AAED,SAAS,gBAAgB,CACvB,OAA4C;;IAE5C,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI;QACjC,SAAS,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,mCAAI,QAAQ;QACzC,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,MAA0C;;IAE1C,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PointDataItemType, RangeDataItemOptions } from \"../core/interfaces\";\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalCartesianChart } from \"./chart-cartesian-internal\";\nimport { CartesianChartProps } from \"./interfaces\";\n\nexport type { CartesianChartProps };\n\nconst CartesianChart = forwardRef(\n (\n {\n fitHeight = false,\n inverted = false,\n stacking = undefined,\n emphasizeBaseline = true,\n verticalAxisTitlePlacement = \"top\",\n ...props\n }: CartesianChartProps,\n ref: React.Ref<CartesianChartProps.Ref>,\n ) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series, stacking);\n const xAxis = transformXAxisOptions(props.xAxis);\n const yAxis = transformYAxisOptions(props.yAxis);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"CartesianHighcharts\", {\n props: { fitHeight, inverted, stacking, emphasizeBaseline, verticalAxisTitlePlacement },\n metadata: {},\n });\n\n return (\n <InternalCartesianChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n inverted={inverted}\n stacking={stacking}\n emphasizeBaseline={emphasizeBaseline}\n verticalAxisTitlePlacement={verticalAxisTitlePlacement}\n series={series}\n xAxis={xAxis}\n yAxis={yAxis}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n },\n);\n\napplyDisplayName(CartesianChart, \"CartesianChart\");\n\nexport default CartesianChart;\n\nfunction transformSeries(\n untransformedSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): CartesianChartProps.SeriesOptions[] {\n const transformedSeries: CartesianChartProps.SeriesOptions[] = [];\n function transformSingleSeries(s: CartesianChartProps.SeriesOptions): null | CartesianChartProps.SeriesOptions {\n switch (s.type) {\n case \"area\":\n case \"areaspline\":\n case \"line\":\n case \"spline\":\n return transformLineLikeSeries(s);\n case \"column\":\n return transformColumnSeries(s);\n case \"scatter\":\n return transformScatterSeries(s);\n case \"errorbar\":\n return transformErrorBarSeries(s, untransformedSeries, stacking);\n case \"x-threshold\":\n case \"y-threshold\":\n return transformThresholdSeries(s);\n default:\n return null;\n }\n }\n for (const series of untransformedSeries) {\n const transformed = transformSingleSeries(series);\n if (transformed) {\n transformedSeries.push(transformed);\n }\n }\n return transformedSeries;\n}\n\nfunction transformLineLikeSeries<\n S extends\n | CartesianChartProps.AreaSeriesOptions\n | CartesianChartProps.AreaSplineSeriesOptions\n | CartesianChartProps.LineSeriesOptions\n | CartesianChartProps.SplineSeriesOptions,\n>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, dashStyle: s.dashStyle, data } as S;\n}\n\nfunction transformColumnSeries<S extends CartesianChartProps.ColumnSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n return { type: s.type, id: s.id, name: s.name, color: s.color, data } as S;\n}\n\nfunction transformScatterSeries<S extends CartesianChartProps.ScatterSeriesOptions>(s: S): null | S {\n const data = transformPointData(s.data);\n const marker = s.marker ?? {};\n return { type: s.type, id: s.id, name: s.name, color: s.color, data, marker } as S;\n}\n\nfunction transformThresholdSeries<\n S extends CartesianChartProps.XThresholdSeriesOptions | CartesianChartProps.YThresholdSeriesOptions,\n>(s: S): null | S {\n return { type: s.type, id: s.id, name: s.name, color: s.color, value: s.value, dashStyle: s.dashStyle } as S;\n}\n\nfunction transformErrorBarSeries(\n series: CartesianChartProps.ErrorBarSeriesOptions,\n allSeries: readonly CartesianChartProps.SeriesOptions[],\n stacking?: \"normal\",\n): null | CartesianChartProps.ErrorBarSeriesOptions {\n // Highcharts only supports error bars for non-stacked series.\n // See: https://github.com/highcharts/highcharts/issues/23080.\n if (stacking) {\n warnOnce(\"CartesianChart\", \"Error bars are not supported for stacked series.\");\n return null;\n }\n // We only support error bars that are linked to some other series. It is only possible to link it\n // using series ID (but not name), or by using \":previous\" pseudo-selector.\n // See: https://api.highcharts.com/highcharts/series.errorbar.linkedTo.\n const linkedSeries =\n series.linkedTo === \":previous\"\n ? allSeries[allSeries.indexOf(series) - 1]\n : allSeries.find(({ id }) => id === series.linkedTo);\n // The non-linked error bars are not supported: those will not appear in our custom legend and tooltip,\n // so we remove them from the series array. We also do not support linking them to other error bars,\n // or our custom threshold series.\n if (!linkedSeries || [\"errorbar\", \"x-threshold\", \"y-threshold\"].includes(linkedSeries.type)) {\n warnOnce(\n \"CartesianChart\",\n 'The `linkedTo` property of \"errorbar\" series points to a missing, or unsupported series.',\n );\n return null;\n }\n const data = transformRangeData(series.data);\n return { type: series.type, id: series.id, name: series.name, color: series.color, linkedTo: series.linkedTo, data };\n}\n\nfunction transformPointData(data: readonly PointDataItemType[]): readonly PointDataItemType[] {\n return data.map((d) => (d && typeof d === \"object\" ? { x: d.x, y: d.y } : d));\n}\n\nfunction transformRangeData(data: readonly RangeDataItemOptions[]): readonly RangeDataItemOptions[] {\n return data.map((d) => ({ x: d.x, low: d.low, high: d.high }));\n}\n\nfunction transformXAxisOptions(axis?: CartesianChartProps.XAxisOptions): CartesianChartProps.XAxisOptions {\n return transformAxisOptions(axis);\n}\n\nfunction transformYAxisOptions(axis?: CartesianChartProps.YAxisOptions): CartesianChartProps.YAxisOptions {\n return { ...transformAxisOptions(axis), reversedStacks: axis?.reversedStacks };\n}\n\nfunction transformAxisOptions<O extends CartesianChartProps.XAxisOptions | CartesianChartProps.YAxisOptions>(\n axis?: O,\n): O {\n return {\n type: axis?.type,\n title: axis?.title,\n min: axis?.min,\n max: axis?.max,\n tickInterval: axis?.tickInterval,\n categories: axis?.categories,\n valueFormatter: axis?.valueFormatter,\n } as O;\n}\n\nfunction transformTooltip(\n tooltip?: CartesianChartProps.TooltipOptions,\n): SomeRequired<CartesianChartProps.TooltipOptions, \"enabled\" | \"placement\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n placement: tooltip?.placement ?? \"middle\",\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(\n legend?: CartesianChartProps.LegendOptions,\n): SomeRequired<CartesianChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}
@@ -13,12 +13,7 @@ export declare class ChartExtraLegend extends AsyncStore<ReactiveLegendState> {
13
13
  constructor(context: ChartExtraContext);
14
14
  onChartRender: () => void;
15
15
  updateItemsVisibility: () => void;
16
- onItemVisibilityChange: (visibleItems: readonly string[], detail: {
17
- interactionType: "api" | "filter";
18
- } | {
19
- interactionType: "toggle" | "select";
20
- targetItemId: string;
21
- }) => void;
16
+ onItemVisibilityChange: (visibleItems: readonly string[], detail: CoreChartProps.InteractionKind) => void;
22
17
  onHighlightPoint: (point: Highcharts.Point) => void;
23
18
  onHighlightGroup: (group: readonly Highcharts.Point[]) => void;
24
19
  onHighlightItems: (highlightedItems: readonly string[]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"chart-extra-legend.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-legend.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,yCAAyC,CAAC;AAEnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQxE,wDAAwD;AACxD,MAAM,OAAO,gBAAiB,SAAQ,UAA+B;IAInE,YAAY,OAA0B;QACpC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAHf,mBAAc,GAA4B,UAAU,CAAC;QAOtD,kBAAa,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC/B,CAAC,CAAC;QAEF,kHAAkH;QAClH,+DAA+D;QACxD,0BAAqB,GAAG,GAAG,EAAE;YAClC,IAAI,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ved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { LegendItem } from \"../../internal/components/interfaces\";\nimport { ChartSeriesMarker, ChartSeriesMarkerType } from \"../../internal/components/series-marker\";\nimport { ChartSeriesMarkerStatus } from \"../../internal/components/series-marker/interfaces\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { isEqualArrays } from \"../../internal/utils/utils\";\nimport { CoreChartProps } from \"../interfaces\";\nimport { getChartLegendItems, getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\n// The reactive state is used to propagate changes in legend items to the core legend React component.\nexport interface ReactiveLegendState {\n items: readonly CoreChartProps.LegendItem[];\n}\n\n// Chart helper that implements custom legend behaviors.\nexport class ChartExtraLegend extends AsyncStore<ReactiveLegendState> {\n private context: ChartExtraContext;\n private visibilityMode: \"internal\" | \"external\" = \"external\";\n\n constructor(context: ChartExtraContext) {\n super({ items: [] });\n this.context = context;\n }\n\n public onChartRender = () => {\n this.initLegend();\n this.updateItemsVisibility();\n };\n\n // If visible items are explicitly provided, we use them to update visibility of chart's series or points (by ID).\n // If not provided, the visibility state is managed internally.\n public updateItemsVisibility = () => {\n if (this.context.state.visibleItems) {\n this.visibilityMode = \"external\";\n updateItemsVisibility(this.context.chart(), this.get().items, this.context.state.visibleItems);\n } else {\n this.visibilityMode = \"internal\";\n }\n };\n\n // A callback to be called when items visibility changes from the outside or from the legend.\n public onItemVisibilityChange = (\n visibleItems: readonly string[],\n detail: { interactionType: \"api\" | \"filter\" } | { interactionType: \"toggle\" | \"select\"; targetItemId: string },\n ) => {\n const currentItems = this.get().items;\n const updatedItems = currentItems.map((i) => ({ ...i, visible: visibleItems.includes(i.id) }));\n if (this.visibilityMode === \"internal\") {\n this.updateLegendItems(updatedItems);\n updateItemsVisibility(this.context.chart(), this.get().items, visibleItems);\n }\n fireNonCancelableEvent(this.context.handlers.onVisibleItemsChange, { items: updatedItems, ...detail });\n };\n\n // Updates legend highlight state when chart's point is highlighted.\n public onHighlightPoint = (point: Highcharts.Point) => {\n const visibleItems = point.series.type === \"pie\" ? [getPointId(point)] : [getSeriesId(point.series)];\n this.onHighlightItems(visibleItems);\n };\n\n // Updates legend highlight state when chart's group of points is highlighted.\n public onHighlightGroup = (group: readonly Highcharts.Point[]) => {\n const visibleItems = group.map((point) => getSeriesId(point.series));\n this.onHighlightItems(visibleItems);\n };\n\n // Updates legend highlight state given an explicit list of item IDs. This is used to update state\n // when a legend item gets hovered or focused.\n public onHighlightItems = (highlightedItems: readonly string[]) => {\n const currentItems = this.get().items;\n const updatedItems = currentItems.map(({ ...i }) => ({ ...i, highlighted: highlightedItems.includes(i.id) }));\n this.updateLegendItems(updatedItems);\n };\n\n // Clears legend highlight state.\n public onClearHighlight = () => {\n const nextItems = this.get().items.map(({ ...item }) => ({ ...item, highlighted: false }));\n this.updateLegendItems(nextItems);\n };\n\n private initLegend = () => {\n const prevState = this.get().items.reduce((map, item) => map.set(item.id, item), new Map<string, LegendItem>());\n const itemSpecs = getChartLegendItems({\n chart: this.context.chart(),\n getItemOptions: this.context.settings.getItemOptions,\n itemMarkerStatusAriaLabel: this.context.settings.labels.itemMarkerLabel,\n });\n const legendItems = itemSpecs.map(\n ({ id, name, color, markerType, visible, status, isSecondary, markerAriaLabel }) => {\n const marker = this.renderMarker({ type: markerType, color, visible, status, ariaLabel: markerAriaLabel });\n return { id, name, marker, visible, isSecondary, highlighted: prevState.get(id)?.highlighted ?? false };\n },\n );\n this.updateLegendItems(legendItems);\n };\n\n private updateLegendItems = (nextItems: CoreChartProps.LegendItem[]) => {\n function isLegendItemsEqual(a: CoreChartProps.LegendItem, b: CoreChartProps.LegendItem) {\n return (\n a.id === b.id &&\n a.name === b.name &&\n a.marker === b.marker &&\n a.visible === b.visible &&\n a.highlighted === b.highlighted\n );\n }\n if (!isEqualArrays(this.get().items, nextItems, isLegendItemsEqual)) {\n this.set(() => ({ items: nextItems }));\n }\n };\n\n // The chart markers derive from type and color and are cached to avoid unnecessary renders,\n // and allow comparing them by reference.\n private markersCache = new Map<string, React.ReactNode>();\n public renderMarker({\n type,\n status = \"default\",\n color,\n visible = true,\n ariaLabel,\n }: {\n type: ChartSeriesMarkerType;\n color: string;\n visible?: boolean;\n status?: ChartSeriesMarkerStatus;\n ariaLabel?: string;\n }): React.ReactNode {\n const key = `${type}:${color}:${visible}:${status}`;\n const marker = this.markersCache.get(key) ?? (\n <ChartSeriesMarker type={type} color={color} visible={visible} status={status} ariaLabel={ariaLabel} />\n );\n this.markersCache.set(key, marker);\n return marker;\n }\n}\n\nfunction updateItemsVisibility(\n chart: Highcharts.Chart,\n legendItems: readonly CoreChartProps.LegendItem[],\n visibleItems?: readonly string[],\n) {\n const availableItemsSet = new Set(legendItems.map((i) => i.id));\n const visibleItemsSet = new Set(visibleItems);\n\n let updatesCounter = 0;\n const getVisibleAndCount = (id: string, visible: boolean) => {\n const nextVisible = visibleItemsSet.has(id);\n updatesCounter += nextVisible !== visible ? 1 : 0;\n return nextVisible;\n };\n\n for (const series of getChartSeries(chart.series)) {\n if (availableItemsSet.has(getSeriesId(series))) {\n series.setVisible(getVisibleAndCount(getSeriesId(series), series.visible), false);\n }\n for (const point of series.data) {\n if (typeof point.setVisible === \"function\" && availableItemsSet.has(getPointId(point))) {\n point.setVisible(getVisibleAndCount(getPointId(point), point.visible), false);\n }\n }\n }\n\n // The call `seriesOrPoint.setVisible(visible, false)` does not trigger the chart redraw, as it would otherwise\n // impact the performance. Instead, we trigger the redraw explicitly, if any change to visibility has been made.\n if (updatesCounter > 0) {\n chart.redraw();\n }\n}\n"]}
1
+ {"version":3,"file":"chart-extra-legend.js","sourceRoot":"","sources":["../../../../src/core/chart-api/chart-extra-legend.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,yCAAyC,CAAC;AAEnG,OAAO,EAAE,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,kBAAkB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QACpF,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,UAAU,IAAI,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBACvF,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;YAChF,CAAC;QACH,CAAC;IACH,CAAC;IAED,+GAA+G;IAC/G,gHAAgH;IAChH,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,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 { LegendItem } from \"../../internal/components/interfaces\";\nimport { ChartSeriesMarker, ChartSeriesMarkerType } from \"../../internal/components/series-marker\";\nimport { ChartSeriesMarkerStatus } from \"../../internal/components/series-marker/interfaces\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\nimport AsyncStore from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { isEqualArrays } from \"../../internal/utils/utils\";\nimport { CoreChartProps } from \"../interfaces\";\nimport { getChartLegendItems, getPointId, getSeriesId } from \"../utils\";\nimport { ChartExtraContext } from \"./chart-extra-context\";\n\n// The reactive state is used to propagate changes in legend items to the core legend React component.\nexport interface ReactiveLegendState {\n items: readonly CoreChartProps.LegendItem[];\n}\n\n// Chart helper that implements custom legend behaviors.\nexport class ChartExtraLegend extends AsyncStore<ReactiveLegendState> {\n private context: ChartExtraContext;\n private visibilityMode: \"internal\" | \"external\" = \"external\";\n\n constructor(context: ChartExtraContext) {\n super({ items: [] });\n this.context = context;\n }\n\n public onChartRender = () => {\n this.initLegend();\n this.updateItemsVisibility();\n };\n\n // If visible items are explicitly provided, we use them to update visibility of chart's series or points (by ID).\n // If not provided, the visibility state is managed internally.\n public updateItemsVisibility = () => {\n if (this.context.state.visibleItems) {\n this.visibilityMode = \"external\";\n updateItemsVisibility(this.context.chart(), this.get().items, this.context.state.visibleItems);\n } else {\n this.visibilityMode = \"internal\";\n }\n };\n\n // A callback to be called when items visibility changes from the outside or from the legend.\n public onItemVisibilityChange = (visibleItems: readonly string[], detail: CoreChartProps.InteractionKind) => {\n const currentItems = this.get().items;\n const updatedItems = currentItems.map((i) => ({ ...i, visible: visibleItems.includes(i.id) }));\n if (this.visibilityMode === \"internal\") {\n this.updateLegendItems(updatedItems);\n updateItemsVisibility(this.context.chart(), this.get().items, visibleItems);\n }\n fireNonCancelableEvent(this.context.handlers.onVisibleItemsChange, { items: updatedItems, ...detail });\n };\n\n // Updates legend highlight state when chart's point is highlighted.\n public onHighlightPoint = (point: Highcharts.Point) => {\n const visibleItems = point.series.type === \"pie\" ? [getPointId(point)] : [getSeriesId(point.series)];\n this.onHighlightItems(visibleItems);\n };\n\n // Updates legend highlight state when chart's group of points is highlighted.\n public onHighlightGroup = (group: readonly Highcharts.Point[]) => {\n const visibleItems = group.map((point) => getSeriesId(point.series));\n this.onHighlightItems(visibleItems);\n };\n\n // Updates legend highlight state given an explicit list of item IDs. This is used to update state\n // when a legend item gets hovered or focused.\n public onHighlightItems = (highlightedItems: readonly string[]) => {\n const currentItems = this.get().items;\n const updatedItems = currentItems.map(({ ...i }) => ({ ...i, highlighted: highlightedItems.includes(i.id) }));\n this.updateLegendItems(updatedItems);\n };\n\n // Clears legend highlight state.\n public onClearHighlight = () => {\n const nextItems = this.get().items.map(({ ...item }) => ({ ...item, highlighted: false }));\n this.updateLegendItems(nextItems);\n };\n\n private initLegend = () => {\n const prevState = this.get().items.reduce((map, item) => map.set(item.id, item), new Map<string, LegendItem>());\n const itemSpecs = getChartLegendItems({\n chart: this.context.chart(),\n getItemOptions: this.context.settings.getItemOptions,\n itemMarkerStatusAriaLabel: this.context.settings.labels.itemMarkerLabel,\n });\n const legendItems = itemSpecs.map(\n ({ id, name, color, markerType, visible, status, isSecondary, markerAriaLabel }) => {\n const marker = this.renderMarker({ type: markerType, color, visible, status, ariaLabel: markerAriaLabel });\n return { id, name, marker, visible, isSecondary, highlighted: prevState.get(id)?.highlighted ?? false };\n },\n );\n this.updateLegendItems(legendItems);\n };\n\n private updateLegendItems = (nextItems: CoreChartProps.LegendItem[]) => {\n function isLegendItemsEqual(a: CoreChartProps.LegendItem, b: CoreChartProps.LegendItem) {\n return (\n a.id === b.id &&\n a.name === b.name &&\n a.marker === b.marker &&\n a.visible === b.visible &&\n a.highlighted === b.highlighted\n );\n }\n if (!isEqualArrays(this.get().items, nextItems, isLegendItemsEqual)) {\n this.set(() => ({ items: nextItems }));\n }\n };\n\n // The chart markers derive from type and color and are cached to avoid unnecessary renders,\n // and allow comparing them by reference.\n private markersCache = new Map<string, React.ReactNode>();\n public renderMarker({\n type,\n status = \"default\",\n color,\n visible = true,\n ariaLabel,\n }: {\n type: ChartSeriesMarkerType;\n color: string;\n visible?: boolean;\n status?: ChartSeriesMarkerStatus;\n ariaLabel?: string;\n }): React.ReactNode {\n const key = `${type}:${color}:${visible}:${status}`;\n const marker = this.markersCache.get(key) ?? (\n <ChartSeriesMarker type={type} color={color} visible={visible} status={status} ariaLabel={ariaLabel} />\n );\n this.markersCache.set(key, marker);\n return marker;\n }\n}\n\nfunction updateItemsVisibility(\n chart: Highcharts.Chart,\n legendItems: readonly CoreChartProps.LegendItem[],\n visibleItems?: readonly string[],\n) {\n const availableItemsSet = new Set(legendItems.map((i) => i.id));\n const visibleItemsSet = new Set(visibleItems);\n\n let updatesCounter = 0;\n const getVisibleAndCount = (id: string, visible: boolean) => {\n const nextVisible = visibleItemsSet.has(id);\n updatesCounter += nextVisible !== visible ? 1 : 0;\n return nextVisible;\n };\n\n for (const series of getChartSeries(chart.series)) {\n if (availableItemsSet.has(getSeriesId(series))) {\n series.setVisible(getVisibleAndCount(getSeriesId(series), series.visible), false);\n }\n for (const point of series.data) {\n if (typeof point.setVisible === \"function\" && availableItemsSet.has(getPointId(point))) {\n point.setVisible(getVisibleAndCount(getPointId(point), point.visible), false);\n }\n }\n }\n\n // The call `seriesOrPoint.setVisible(visible, false)` does not trigger the chart redraw, as it would otherwise\n // impact the performance. Instead, we trigger the redraw explicitly, if any change to visibility has been made.\n if (updatesCounter > 0) {\n chart.redraw();\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import type Highcharts from "highcharts";
2
2
  import { ReadonlyAsyncStore } from "../../internal/utils/async-store";
3
+ import { CoreChartProps } from "../interfaces";
3
4
  import { ReactiveAxisTitlesState } from "./chart-extra-axis-titles";
4
5
  import { ChartExtraContext } from "./chart-extra-context";
5
6
  import { ReactiveLegendState } from "./chart-extra-legend";
@@ -45,12 +46,7 @@ export declare class ChartAPI {
45
46
  hideTooltip: () => void;
46
47
  setApplication: (element: null | HTMLElement) => void;
47
48
  updateItemsVisibility: () => void;
48
- onItemVisibilityChange: (items: readonly string[], detail: {
49
- interactionType: "filter";
50
- } | {
51
- interactionType: "toggle" | "select";
52
- targetItemId: string;
53
- }) => void;
49
+ onItemVisibilityChange: (items: readonly string[], detail: CoreChartProps.InteractionKind) => void;
54
50
  onHighlightChartItems: (itemIds: readonly string[]) => void;
55
51
  onClearChartItemsHighlight: () => void;
56
52
  highlightChartItems: (itemIds: readonly string[]) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/chart-api/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,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,CAAC,KAAK,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;YAC/E,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBAC9C,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;YACxE,CAAC;YAED,wDAAwD;YACxD,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAgBD,IAAY,eAAe;QACzB,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAC7C,CAAC;CACF;AAED,SAAS,sBAAsB,CAAC,OAA0B,EAAE,IAAuB;IACjF,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,CAAC,OAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,CAAC,CAAA,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,CAAC,OAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,CAAC,CAAA,CAAC;AAC1D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from \"react\";\nimport type Highcharts from \"highcharts\";\n\nimport { fireNonCancelableEvent } from \"../../internal/events\";\nimport { ReadonlyAsyncStore } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { getSeriesData } from \"../../internal/utils/series-data\";\nimport { Writeable } from \"../../internal/utils/utils\";\nimport {\n getChartAccessibleDescription,\n getGroupAccessibleDescription,\n getPointAccessibleDescription,\n isXThreshold,\n} from \"../utils\";\nimport { ChartExtraAxisTitles, ReactiveAxisTitlesState } from \"./chart-extra-axis-titles\";\nimport { ChartExtraContext, createChartContext, updateChartContext } from \"./chart-extra-context\";\nimport { ChartExtraHighlight } from \"./chart-extra-highlight\";\nimport { ChartExtraLegend, ReactiveLegendState } from \"./chart-extra-legend\";\nimport { ChartExtraNavigation, ChartExtraNavigationHandlers } from \"./chart-extra-navigation\";\nimport { ChartExtraNodata, ReactiveNodataState } from \"./chart-extra-nodata\";\nimport { ChartExtraPointer, ChartExtraPointerHandlers } from \"./chart-extra-pointer\";\nimport { ChartExtraTooltip, ReactiveTooltipState } from \"./chart-extra-tooltip\";\n\n// The API helper injects Cloudscape custom behaviors, and returns the API instance that comes with\n// reactive state and handlers to be assigned as Highcharts options, used by Cloudscape components\n// (tooltip, legend, and other), or exposed as public core chart API.\nexport function useChartAPI(\n settings: ChartExtraContext.Settings,\n handlers: ChartExtraContext.Handlers,\n state: ChartExtraContext.State,\n) {\n // The API helper instance defines many pieces of internal state with different lifecycles, most\n // of which are not be invalidated when the hook re-renders, or properties change. That is why we\n // create the instance once, when the component is mounted.\n const api = useRef(new ChartAPI(settings, handlers, state)).current;\n // The consumer-defined properties can still change during the component lifecycle. We propagate the\n // changes by updating the helper's context directly. That is fine for most of the properties, as those\n // are only used in event-based callbacks, and require nothing to recompute when there is a change.\n useEffect(() => {\n api.context.settings = settings;\n api.context.handlers = handlers;\n api.context.state = state;\n });\n\n // The only property that does require notifying the helper when it changes, is the visible items state.\n // We stringify the visible items array so that it is compared by value, and the effect is only fired when\n // there is an actual change to the visible items, including items order.\n const visibleItemsIndex = state.visibleItems ? state.visibleItems.join(\"::\") : null;\n useEffect(() => {\n // When visibleItemsIndex === null, it means the visible items state is managed internally inside the helper,\n // so no need to call the API method.\n // The api.updateItemsVisibility() can only be used once the chart is initialized, so we check for api.ready.\n // The initialization happens after the first React render, so the chart is expected to not be ready when the\n // effect is called for the first time. This is fine, as the initial visibility state is handled by the helper.\n // The code below is needed to notify the helper any time the visible items state changes.\n if (api.ready && visibleItemsIndex !== null) {\n api.updateItemsVisibility();\n }\n }, [api, visibleItemsIndex]);\n\n // Run cleanup code when the component unmounts.\n useEffect(() => () => api.onChartDestroy(), [api]);\n\n return api;\n}\n\n// The main chart helper that provides customizations to Highcharts, including tooltip, legend, keyboard navigation, and more.\n// It is split into multiple dedicated (chart-extra) helpers (highlight, tooltip, navigation, and other), most of which define\n// internal state, and have a lifecycle based on Highcharts render event.\n// The helper code has a shared context, which includes the consumer settings, visible items state, and derived state, computed\n// from Highcharts.Chart on each render, and reused for downstream computations for better efficiency.\nexport class ChartAPI {\n public context = createChartContext();\n private chartExtraHighlight = new ChartExtraHighlight(this.context);\n private chartExtraTooltip = new ChartExtraTooltip(this.context);\n private chartExtraNavigation = new ChartExtraNavigation(this.context, this.navigationHandlers);\n private chartExtraPointer = new ChartExtraPointer(this.context, this.pointerHandlers);\n private chartExtraLegend = new ChartExtraLegend(this.context);\n private chartExtraNodata = new ChartExtraNodata(this.context);\n private chartExtraAxisTitles = new ChartExtraAxisTitles(this.context);\n\n constructor(\n settings: ChartExtraContext.Settings,\n handlers: ChartExtraContext.Handlers,\n state: ChartExtraContext.State,\n ) {\n this.context.settings = settings;\n this.context.handlers = handlers;\n this.context.state = state;\n }\n\n // The ready() returns true if the chart is initialized and helper methods are safe to use (after Highcharts triggers onChartRender).\n // Using any of the helper methods before the chart is initialized will result in an exception.\n public get ready() {\n return !!this.context.chartOrNull;\n }\n\n // The Highcharts options to be merged with the rest of the configuration defined in the chart-core.\n public getOptions() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const chartAPI = this;\n const onChartLoad: Highcharts.ChartLoadCallbackFunction = function (this) {\n chartAPI.chartExtraPointer.onChartLoad(this);\n };\n const onChartRender: Highcharts.ChartRenderCallbackFunction = function (this) {\n updateChartContext(chartAPI.context, this);\n chartAPI.chartExtraHighlight.onChartRender();\n chartAPI.chartExtraLegend.onChartRender();\n chartAPI.chartExtraNodata.onChartRender();\n chartAPI.chartExtraAxisTitles.onChartRender();\n chartAPI.chartExtraTooltip.onChartRender();\n chartAPI.handleDestroyedPoints();\n chartAPI.resetColorCounter();\n chartAPI.showMarkersForIsolatedPoints();\n };\n const onChartClick: Highcharts.ChartClickCallbackFunction = function () {\n chartAPI.chartExtraPointer.onChartClick(this.hoverPoint);\n };\n const onSeriesPointMouseOver: Highcharts.PointMouseOverCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointMouseOver(this);\n };\n const onSeriesPointMouseOut: Highcharts.PointMouseOutCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointMouseOut();\n };\n const onSeriesPointClick: Highcharts.PointClickCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointClick(this);\n };\n return {\n onChartLoad,\n onChartRender,\n onChartClick,\n onSeriesPointMouseOver,\n onSeriesPointMouseOut,\n onSeriesPointClick,\n };\n }\n\n // There is no cleanup or destroy event in Highcharts options, so we define a custom one\n // to be used when the React component unmounts.\n public onChartDestroy = () => {\n this.chartExtraNavigation.onChartDestroy();\n this.chartExtraPointer.onChartDestroy();\n this.chartExtraTooltip.onChartDestroy();\n };\n\n // Reactive state stores.\n public get tooltipStore() {\n return this.chartExtraTooltip as ReadonlyAsyncStore<ReactiveTooltipState>;\n }\n public get legendStore() {\n return this.chartExtraLegend as ReadonlyAsyncStore<ReactiveLegendState>;\n }\n public get nodataStore() {\n return this.chartExtraNodata as ReadonlyAsyncStore<ReactiveNodataState>;\n }\n public get axisTitlesStore() {\n return this.chartExtraAxisTitles as ReadonlyAsyncStore<ReactiveAxisTitlesState>;\n }\n\n // References to SVG elements used for tooltip placement.\n public getTargetTrack = this.chartExtraTooltip.getTargetTrack.bind(this.chartExtraTooltip);\n public getGroupTrack = this.chartExtraTooltip.getGroupTrack.bind(this.chartExtraTooltip);\n\n // Legend marker renderer.\n public renderMarker = this.chartExtraLegend.renderMarker.bind(this.chartExtraLegend);\n\n // Callbacks assigned to the tooltip.\n public onMouseEnterTooltip = this.chartExtraPointer.onMouseEnterTooltip.bind(this.chartExtraPointer);\n public onMouseLeaveTooltip = this.chartExtraPointer.onMouseLeaveTooltip.bind(this.chartExtraPointer);\n public onDismissTooltip = (outsideClick?: boolean) => {\n const { pinned, point, group } = this.chartExtraTooltip.get();\n if (pinned) {\n this.chartExtraTooltip.hideTooltip();\n // The chart highlight is preserved while the tooltip is pinned. We need to clear it manually here, for the case\n // when the pointer lands outside the chart after the tooltip is dismissed, so that the mouse-out event won't fire.\n this.clearChartHighlight({ isApiCall: false });\n // If the tooltip was not dismissed by clicking outside, we bring focus to the point or group, that was\n // associated with the tooltip, so that we user can continue keyboard navigation from that spot.\n if (!outsideClick) {\n this.chartExtraNavigation.focusApplication(point, group);\n }\n }\n };\n\n // Hide the tooltip from an action initiated by the tooltip's content\n public hideTooltip = () => {\n this.chartExtraTooltip.hideTooltip();\n // The chart highlight is preserved while the tooltip is pinned. We need to clear it manually here, for the case\n // when the pointer lands outside the chart after the tooltip is dismissed, so that the mouse-out event won't fire.\n this.clearChartHighlight({ isApiCall: false });\n };\n\n // Reference to the role=\"application\" element used for navigation.\n public setApplication = this.chartExtraNavigation.setApplication.bind(this.chartExtraNavigation);\n\n // A callback to notify the helper when items visibility state changes.\n public updateItemsVisibility = this.chartExtraLegend.updateItemsVisibility.bind(this.chartExtraLegend);\n\n // A callback used by the legend and filter components when series/segments visibility changes.\n public onItemVisibilityChange = (\n items: readonly string[],\n detail: { interactionType: \"filter\" } | { interactionType: \"toggle\" | \"select\"; targetItemId: string },\n ) => this.chartExtraLegend.onItemVisibilityChange(items, detail);\n\n // Callbacks used by the legend component when items highlight state changes.\n public onHighlightChartItems = (itemIds: readonly string[]) => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.highlightChartItems(itemIds);\n this.chartExtraLegend.onHighlightItems(itemIds);\n }\n };\n public onClearChartItemsHighlight = () => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.clearChartItemsHighlight();\n this.chartExtraLegend.onClearHighlight();\n\n // Notify the consumer that a clear-highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onClearHighlight, { isApiCall: false });\n }\n };\n\n // Callbacks used for hover and keyboard navigation, and also exposed to the public API to give the ability\n // to highlight and show tooltip for the given point or group manually.\n public highlightChartItems = (itemIds: readonly string[]) => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.highlightChartItems(itemIds);\n this.chartExtraLegend.onHighlightItems(itemIds);\n }\n };\n public setItemsVisible = (visibleItemsIds: readonly string[]) => {\n this.chartExtraLegend.onItemVisibilityChange(visibleItemsIds, { interactionType: \"api\" });\n };\n public highlightChartPoint = (point: Highcharts.Point, { isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.highlightActions(point, { isApiCall });\n }\n };\n public highlightChartGroup = (group: readonly Highcharts.Point[], { isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.highlightActions(group as Writeable<Highcharts.Point[]>, { isApiCall });\n }\n };\n public clearChartHighlight = ({ isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.clearHighlightActions({ isApiCall });\n }\n };\n public get publicApi() {\n return {\n highlightItems: (itemIds: readonly string[]) => this.highlightChartItems(itemIds),\n setItemsVisible: (visibleItemIds: readonly string[]) => this.setItemsVisible(visibleItemIds),\n highlightChartPoint: (point: Highcharts.Point) => this.highlightChartPoint(point, { isApiCall: true }),\n highlightChartGroup: (group: readonly Highcharts.Point[]) => this.highlightChartGroup(group, { isApiCall: true }),\n clearChartHighlight: () => this.clearChartHighlight({ isApiCall: true }),\n };\n }\n\n // A set of callbacks required for keyboard navigation.\n private get navigationHandlers(): ChartExtraNavigationHandlers {\n return {\n onFocusChart: () => {\n this.clearChartHighlight({ isApiCall: false });\n this.chartExtraNavigation.announceChart(getChartAccessibleDescription(this.context.chart()));\n },\n onFocusGroup: (group: Highcharts.Point[]) => {\n this.highlightActions(group, { isApiCall: false, overrideTooltipLock: true });\n this.chartExtraNavigation.announceElement(getGroupAccessibleDescription(group), false);\n },\n onFocusPoint: (point: Highcharts.Point) => {\n const labels = this.context.settings.labels;\n this.highlightActions(point, { isApiCall: false, overrideTooltipLock: true });\n this.chartExtraNavigation.announceElement(getPointAccessibleDescription(point, labels), false);\n },\n onBlur: () => this.clearChartHighlight({ isApiCall: false }),\n onActivateGroup: () => {\n const current = this.chartExtraTooltip.get();\n if (current.group.length > 0) {\n this.chartExtraTooltip.pinTooltip();\n this.chartExtraNavigation.announceElement(getGroupAccessibleDescription(current.group), true);\n }\n },\n onActivatePoint: () => {\n const current = this.chartExtraTooltip.get();\n if (current.point) {\n const labels = this.context.settings.labels;\n this.chartExtraTooltip.pinTooltip();\n this.chartExtraNavigation.announceElement(getPointAccessibleDescription(current.point, labels), true);\n }\n },\n };\n }\n\n // A set of callbacks required for pointer navigation.\n private get pointerHandlers(): ChartExtraPointerHandlers {\n return {\n onPointHover: (point) => {\n this.highlightChartPoint(point, { isApiCall: false });\n },\n onGroupHover: (group) => {\n this.highlightChartGroup(group, { isApiCall: false });\n },\n onHoverLost: () => {\n this.clearChartHighlight({ isApiCall: false });\n },\n onPointClick: (point) => {\n this.pinTooltipOnPoint(point);\n },\n onGroupClick: (group) => {\n this.pinTooltipOnGroup(group);\n },\n };\n }\n\n // Area- or line series can be defined with just a single point, or include missing data (y=null) in such\n // a way, that certain points become isolated. As we prefer the markers to not be shown for area- and line\n // series by default, those points become invisible, unless hovered. To fix this, we use the function below,\n // that finds isolates points and overrides the marker.enabled configuration for those.\n // See: https://github.com/highcharts/highcharts/issues/1210.\n private showMarkersForIsolatedPoints() {\n let shouldRedraw = false;\n for (const s of this.context.chart().series) {\n const seriesData = getSeriesData(s.data);\n for (let i = 0; i < seriesData.length; i++) {\n const isEligibleSeries = !isXThreshold(s) && s.type !== \"scatter\" && !seriesData[i].options.marker?.enabled;\n if (\n isEligibleSeries &&\n (seriesData[i - 1]?.y === undefined || seriesData[i - 1]?.y === null) &&\n (seriesData[i + 1]?.y === undefined || seriesData[i + 1]?.y === null)\n ) {\n seriesData[i].update({ marker: { enabled: true } }, false);\n shouldRedraw = true;\n }\n }\n }\n if (shouldRedraw) {\n this.context.chart().redraw();\n }\n }\n\n // Highcharts sometimes destroys points upon re-rendering. As result, the already stored points can get\n // replaced by `{ destroyed: true }`. This can affect the tooltip state, making the component crash when\n // obtaining data from points, or making it hidden yet pinned, so not visible on hover until a click is made.\n // To prevent these issues, on each render we check for destroyed points in the tooltip state, and proactively\n // hide the tooltip if found. The behavior is only observed during the initial chart loading, and is not expected\n // to cause UX issues with the tooltip being closed unexpectedly.\n // See: https://github.com/highcharts/highcharts/issues/23175.\n private handleDestroyedPoints() {\n const tooltipState = this.chartExtraTooltip.get();\n if (tooltipState.group.some((p) => !p.series)) {\n this.chartExtraTooltip.hideTooltip();\n }\n }\n\n // We reset color counter so that when a series is removed and then added back - it will\n // have the same color as before, not the next one in the color sequence.\n // See: https://github.com/highcharts/highcharts/issues/23077.\n private resetColorCounter() {\n const chart = this.context.chart();\n if (\"colorCounter\" in chart && typeof chart.colorCounter === \"number\") {\n chart.colorCounter = getChartSeries(chart.series).length;\n }\n }\n\n private pinTooltipOnPoint = (point: Highcharts.Point) => {\n const currentPoint = this.chartExtraTooltip.get().point;\n const currentGroup = this.chartExtraTooltip.get().group;\n const positionsMatch = isPointsPositionsEqual(currentPoint ?? currentGroup[0], point);\n\n // If the previously hovered and now clicked positions match, and the the tooltip wasn't\n // dismissed just a moment ago, we make the tooltip pinned in this position.\n if (positionsMatch && !this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(point, { isApiCall: false });\n this.chartExtraTooltip.pinTooltip();\n }\n // If the tooltip was just dismissed, it means this happened by clicking somewhere in the plot area.\n // If the clicked position differs from the one that was pinned - we show tooltip in the new position.\n else if (!positionsMatch && this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(point, { isApiCall: false, overrideTooltipLock: true });\n }\n };\n\n private pinTooltipOnGroup = (group: Highcharts.Point[]) => {\n const currentPoint = this.chartExtraTooltip.get().point;\n const currentGroup = this.chartExtraTooltip.get().group;\n const positionsMatch = isPointsPositionsEqual(currentPoint ?? currentGroup[0], group[0]);\n\n // If the previously hovered and now clicked positions match, and the the tooltip wasn't\n // dismissed just a moment ago, we make the tooltip pinned in this position.\n if (positionsMatch && !this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(group, { isApiCall: false });\n this.chartExtraTooltip.pinTooltip();\n }\n // If the tooltip was just dismissed, it means this happened by clicking somewhere in the plot area.\n // If the clicked position differs from the one that was pinned - we show tooltip in the new position.\n else if (!positionsMatch && this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(group, { isApiCall: false, overrideTooltipLock: true });\n }\n };\n\n private highlightActions(\n target: Highcharts.Point | Highcharts.Point[],\n { isApiCall, overrideTooltipLock }: { isApiCall: boolean; overrideTooltipLock?: boolean },\n ) {\n const point = Array.isArray(target) ? null : target;\n const group = Array.isArray(target) ? target : this.context.derived.getPointsByX(target.x);\n\n if (!this.isTooltipPinned) {\n // Update Highcharts elements state.\n if (point) {\n this.chartExtraHighlight.highlightChartPoint(point);\n } else {\n this.chartExtraHighlight.highlightChartGroup(group);\n }\n\n // Update tooltip and legend state.\n if (point) {\n this.chartExtraLegend.onHighlightPoint(point);\n this.chartExtraTooltip.showTooltipOnPoint(point, group, overrideTooltipLock);\n } else {\n this.chartExtraLegend.onHighlightGroup(group);\n this.chartExtraTooltip.showTooltipOnGroup(group, overrideTooltipLock);\n }\n\n // Notify the consumer that a highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onHighlight, { point, group, isApiCall });\n }\n }\n\n private clearHighlightActions = ({ isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n // Update Highcharts elements state.\n this.chartExtraHighlight.clearChartItemsHighlight();\n\n // Update tooltip and legend state.\n this.chartExtraTooltip.hideTooltip();\n this.chartExtraLegend.onClearHighlight();\n\n // Notify the consumer that a clear-highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onClearHighlight, { isApiCall });\n }\n };\n\n private get isTooltipPinned() {\n return this.chartExtraTooltip.get().pinned;\n }\n}\n\nfunction isPointsPositionsEqual(current?: Highcharts.Point, next?: Highcharts.Point) {\n return current?.x === next?.x && current?.y === next?.y;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/chart-api/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAA2B,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAqB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAgC,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAA6B,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,uBAAuB,CAAC;AAEhF,mGAAmG;AACnG,kGAAkG;AAClG,qEAAqE;AACrE,MAAM,UAAU,WAAW,CACzB,QAAoC,EACpC,QAAoC,EACpC,KAA8B;IAE9B,gGAAgG;IAChG,iGAAiG;IACjG,2DAA2D;IAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAA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\"react\";\nimport type Highcharts from \"highcharts\";\n\nimport { fireNonCancelableEvent } from \"../../internal/events\";\nimport { ReadonlyAsyncStore } from \"../../internal/utils/async-store\";\nimport { getChartSeries } from \"../../internal/utils/chart-series\";\nimport { getSeriesData } from \"../../internal/utils/series-data\";\nimport { Writeable } from \"../../internal/utils/utils\";\nimport { CoreChartProps } from \"../interfaces\";\nimport {\n getChartAccessibleDescription,\n getGroupAccessibleDescription,\n getPointAccessibleDescription,\n isXThreshold,\n} from \"../utils\";\nimport { ChartExtraAxisTitles, ReactiveAxisTitlesState } from \"./chart-extra-axis-titles\";\nimport { ChartExtraContext, createChartContext, updateChartContext } from \"./chart-extra-context\";\nimport { ChartExtraHighlight } from \"./chart-extra-highlight\";\nimport { ChartExtraLegend, ReactiveLegendState } from \"./chart-extra-legend\";\nimport { ChartExtraNavigation, ChartExtraNavigationHandlers } from \"./chart-extra-navigation\";\nimport { ChartExtraNodata, ReactiveNodataState } from \"./chart-extra-nodata\";\nimport { ChartExtraPointer, ChartExtraPointerHandlers } from \"./chart-extra-pointer\";\nimport { ChartExtraTooltip, ReactiveTooltipState } from \"./chart-extra-tooltip\";\n\n// The API helper injects Cloudscape custom behaviors, and returns the API instance that comes with\n// reactive state and handlers to be assigned as Highcharts options, used by Cloudscape components\n// (tooltip, legend, and other), or exposed as public core chart API.\nexport function useChartAPI(\n settings: ChartExtraContext.Settings,\n handlers: ChartExtraContext.Handlers,\n state: ChartExtraContext.State,\n) {\n // The API helper instance defines many pieces of internal state with different lifecycles, most\n // of which are not be invalidated when the hook re-renders, or properties change. That is why we\n // create the instance once, when the component is mounted.\n const api = useRef(new ChartAPI(settings, handlers, state)).current;\n // The consumer-defined properties can still change during the component lifecycle. We propagate the\n // changes by updating the helper's context directly. That is fine for most of the properties, as those\n // are only used in event-based callbacks, and require nothing to recompute when there is a change.\n useEffect(() => {\n api.context.settings = settings;\n api.context.handlers = handlers;\n api.context.state = state;\n });\n\n // The only property that does require notifying the helper when it changes, is the visible items state.\n // We stringify the visible items array so that it is compared by value, and the effect is only fired when\n // there is an actual change to the visible items, including items order.\n const visibleItemsIndex = state.visibleItems ? state.visibleItems.join(\"::\") : null;\n useEffect(() => {\n // When visibleItemsIndex === null, it means the visible items state is managed internally inside the helper,\n // so no need to call the API method.\n // The api.updateItemsVisibility() can only be used once the chart is initialized, so we check for api.ready.\n // The initialization happens after the first React render, so the chart is expected to not be ready when the\n // effect is called for the first time. This is fine, as the initial visibility state is handled by the helper.\n // The code below is needed to notify the helper any time the visible items state changes.\n if (api.ready && visibleItemsIndex !== null) {\n api.updateItemsVisibility();\n }\n }, [api, visibleItemsIndex]);\n\n // Run cleanup code when the component unmounts.\n useEffect(() => () => api.onChartDestroy(), [api]);\n\n return api;\n}\n\n// The main chart helper that provides customizations to Highcharts, including tooltip, legend, keyboard navigation, and more.\n// It is split into multiple dedicated (chart-extra) helpers (highlight, tooltip, navigation, and other), most of which define\n// internal state, and have a lifecycle based on Highcharts render event.\n// The helper code has a shared context, which includes the consumer settings, visible items state, and derived state, computed\n// from Highcharts.Chart on each render, and reused for downstream computations for better efficiency.\nexport class ChartAPI {\n public context = createChartContext();\n private chartExtraHighlight = new ChartExtraHighlight(this.context);\n private chartExtraTooltip = new ChartExtraTooltip(this.context);\n private chartExtraNavigation = new ChartExtraNavigation(this.context, this.navigationHandlers);\n private chartExtraPointer = new ChartExtraPointer(this.context, this.pointerHandlers);\n private chartExtraLegend = new ChartExtraLegend(this.context);\n private chartExtraNodata = new ChartExtraNodata(this.context);\n private chartExtraAxisTitles = new ChartExtraAxisTitles(this.context);\n\n constructor(\n settings: ChartExtraContext.Settings,\n handlers: ChartExtraContext.Handlers,\n state: ChartExtraContext.State,\n ) {\n this.context.settings = settings;\n this.context.handlers = handlers;\n this.context.state = state;\n }\n\n // The ready() returns true if the chart is initialized and helper methods are safe to use (after Highcharts triggers onChartRender).\n // Using any of the helper methods before the chart is initialized will result in an exception.\n public get ready() {\n return !!this.context.chartOrNull;\n }\n\n // The Highcharts options to be merged with the rest of the configuration defined in the chart-core.\n public getOptions() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const chartAPI = this;\n const onChartLoad: Highcharts.ChartLoadCallbackFunction = function (this) {\n chartAPI.chartExtraPointer.onChartLoad(this);\n };\n const onChartRender: Highcharts.ChartRenderCallbackFunction = function (this) {\n updateChartContext(chartAPI.context, this);\n chartAPI.chartExtraHighlight.onChartRender();\n chartAPI.chartExtraLegend.onChartRender();\n chartAPI.chartExtraNodata.onChartRender();\n chartAPI.chartExtraAxisTitles.onChartRender();\n chartAPI.chartExtraTooltip.onChartRender();\n chartAPI.handleDestroyedPoints();\n chartAPI.resetColorCounter();\n chartAPI.showMarkersForIsolatedPoints();\n };\n const onChartClick: Highcharts.ChartClickCallbackFunction = function () {\n chartAPI.chartExtraPointer.onChartClick(this.hoverPoint);\n };\n const onSeriesPointMouseOver: Highcharts.PointMouseOverCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointMouseOver(this);\n };\n const onSeriesPointMouseOut: Highcharts.PointMouseOutCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointMouseOut();\n };\n const onSeriesPointClick: Highcharts.PointClickCallbackFunction = function () {\n chartAPI.chartExtraPointer.onSeriesPointClick(this);\n };\n return {\n onChartLoad,\n onChartRender,\n onChartClick,\n onSeriesPointMouseOver,\n onSeriesPointMouseOut,\n onSeriesPointClick,\n };\n }\n\n // There is no cleanup or destroy event in Highcharts options, so we define a custom one\n // to be used when the React component unmounts.\n public onChartDestroy = () => {\n this.chartExtraNavigation.onChartDestroy();\n this.chartExtraPointer.onChartDestroy();\n this.chartExtraTooltip.onChartDestroy();\n };\n\n // Reactive state stores.\n public get tooltipStore() {\n return this.chartExtraTooltip as ReadonlyAsyncStore<ReactiveTooltipState>;\n }\n public get legendStore() {\n return this.chartExtraLegend as ReadonlyAsyncStore<ReactiveLegendState>;\n }\n public get nodataStore() {\n return this.chartExtraNodata as ReadonlyAsyncStore<ReactiveNodataState>;\n }\n public get axisTitlesStore() {\n return this.chartExtraAxisTitles as ReadonlyAsyncStore<ReactiveAxisTitlesState>;\n }\n\n // References to SVG elements used for tooltip placement.\n public getTargetTrack = this.chartExtraTooltip.getTargetTrack.bind(this.chartExtraTooltip);\n public getGroupTrack = this.chartExtraTooltip.getGroupTrack.bind(this.chartExtraTooltip);\n\n // Legend marker renderer.\n public renderMarker = this.chartExtraLegend.renderMarker.bind(this.chartExtraLegend);\n\n // Callbacks assigned to the tooltip.\n public onMouseEnterTooltip = this.chartExtraPointer.onMouseEnterTooltip.bind(this.chartExtraPointer);\n public onMouseLeaveTooltip = this.chartExtraPointer.onMouseLeaveTooltip.bind(this.chartExtraPointer);\n public onDismissTooltip = (outsideClick?: boolean) => {\n const { pinned, point, group } = this.chartExtraTooltip.get();\n if (pinned) {\n this.chartExtraTooltip.hideTooltip();\n // The chart highlight is preserved while the tooltip is pinned. We need to clear it manually here, for the case\n // when the pointer lands outside the chart after the tooltip is dismissed, so that the mouse-out event won't fire.\n this.clearChartHighlight({ isApiCall: false });\n // If the tooltip was not dismissed by clicking outside, we bring focus to the point or group, that was\n // associated with the tooltip, so that we user can continue keyboard navigation from that spot.\n if (!outsideClick) {\n this.chartExtraNavigation.focusApplication(point, group);\n }\n }\n };\n\n // Hide the tooltip from an action initiated by the tooltip's content\n public hideTooltip = () => {\n this.chartExtraTooltip.hideTooltip();\n // The chart highlight is preserved while the tooltip is pinned. We need to clear it manually here, for the case\n // when the pointer lands outside the chart after the tooltip is dismissed, so that the mouse-out event won't fire.\n this.clearChartHighlight({ isApiCall: false });\n };\n\n // Reference to the role=\"application\" element used for navigation.\n public setApplication = this.chartExtraNavigation.setApplication.bind(this.chartExtraNavigation);\n\n // A callback to notify the helper when items visibility state changes.\n public updateItemsVisibility = this.chartExtraLegend.updateItemsVisibility.bind(this.chartExtraLegend);\n\n // A callback used by the legend and filter components when series/segments visibility changes.\n public onItemVisibilityChange = (items: readonly string[], detail: CoreChartProps.InteractionKind) =>\n this.chartExtraLegend.onItemVisibilityChange(items, detail);\n\n // Callbacks used by the legend component when items highlight state changes.\n public onHighlightChartItems = (itemIds: readonly string[]) => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.highlightChartItems(itemIds);\n this.chartExtraLegend.onHighlightItems(itemIds);\n }\n };\n public onClearChartItemsHighlight = () => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.clearChartItemsHighlight();\n this.chartExtraLegend.onClearHighlight();\n\n // Notify the consumer that a clear-highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onClearHighlight, { isApiCall: false });\n }\n };\n\n // Callbacks used for hover and keyboard navigation, and also exposed to the public API to give the ability\n // to highlight and show tooltip for the given point or group manually.\n public highlightChartItems = (itemIds: readonly string[]) => {\n if (!this.isTooltipPinned) {\n this.chartExtraHighlight.highlightChartItems(itemIds);\n this.chartExtraLegend.onHighlightItems(itemIds);\n }\n };\n public setItemsVisible = (visibleItemsIds: readonly string[]) => {\n this.chartExtraLegend.onItemVisibilityChange(visibleItemsIds, { interactionType: \"api\" });\n };\n public highlightChartPoint = (point: Highcharts.Point, { isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.highlightActions(point, { isApiCall });\n }\n };\n public highlightChartGroup = (group: readonly Highcharts.Point[], { isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.highlightActions(group as Writeable<Highcharts.Point[]>, { isApiCall });\n }\n };\n public clearChartHighlight = ({ isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n this.clearHighlightActions({ isApiCall });\n }\n };\n public get publicApi() {\n return {\n highlightItems: (itemIds: readonly string[]) => this.highlightChartItems(itemIds),\n setItemsVisible: (visibleItemIds: readonly string[]) => this.setItemsVisible(visibleItemIds),\n highlightChartPoint: (point: Highcharts.Point) => this.highlightChartPoint(point, { isApiCall: true }),\n highlightChartGroup: (group: readonly Highcharts.Point[]) => this.highlightChartGroup(group, { isApiCall: true }),\n clearChartHighlight: () => this.clearChartHighlight({ isApiCall: true }),\n };\n }\n\n // A set of callbacks required for keyboard navigation.\n private get navigationHandlers(): ChartExtraNavigationHandlers {\n return {\n onFocusChart: () => {\n this.clearChartHighlight({ isApiCall: false });\n this.chartExtraNavigation.announceChart(getChartAccessibleDescription(this.context.chart()));\n },\n onFocusGroup: (group: Highcharts.Point[]) => {\n this.highlightActions(group, { isApiCall: false, overrideTooltipLock: true });\n this.chartExtraNavigation.announceElement(getGroupAccessibleDescription(group), false);\n },\n onFocusPoint: (point: Highcharts.Point) => {\n const labels = this.context.settings.labels;\n this.highlightActions(point, { isApiCall: false, overrideTooltipLock: true });\n this.chartExtraNavigation.announceElement(getPointAccessibleDescription(point, labels), false);\n },\n onBlur: () => this.clearChartHighlight({ isApiCall: false }),\n onActivateGroup: () => {\n const current = this.chartExtraTooltip.get();\n if (current.group.length > 0) {\n this.chartExtraTooltip.pinTooltip();\n this.chartExtraNavigation.announceElement(getGroupAccessibleDescription(current.group), true);\n }\n },\n onActivatePoint: () => {\n const current = this.chartExtraTooltip.get();\n if (current.point) {\n const labels = this.context.settings.labels;\n this.chartExtraTooltip.pinTooltip();\n this.chartExtraNavigation.announceElement(getPointAccessibleDescription(current.point, labels), true);\n }\n },\n };\n }\n\n // A set of callbacks required for pointer navigation.\n private get pointerHandlers(): ChartExtraPointerHandlers {\n return {\n onPointHover: (point) => {\n this.highlightChartPoint(point, { isApiCall: false });\n },\n onGroupHover: (group) => {\n this.highlightChartGroup(group, { isApiCall: false });\n },\n onHoverLost: () => {\n this.clearChartHighlight({ isApiCall: false });\n },\n onPointClick: (point) => {\n this.pinTooltipOnPoint(point);\n },\n onGroupClick: (group) => {\n this.pinTooltipOnGroup(group);\n },\n };\n }\n\n // Area- or line series can be defined with just a single point, or include missing data (y=null) in such\n // a way, that certain points become isolated. As we prefer the markers to not be shown for area- and line\n // series by default, those points become invisible, unless hovered. To fix this, we use the function below,\n // that finds isolates points and overrides the marker.enabled configuration for those.\n // See: https://github.com/highcharts/highcharts/issues/1210.\n private showMarkersForIsolatedPoints() {\n let shouldRedraw = false;\n for (const s of this.context.chart().series) {\n const seriesData = getSeriesData(s.data);\n for (let i = 0; i < seriesData.length; i++) {\n const isEligibleSeries = !isXThreshold(s) && s.type !== \"scatter\" && !seriesData[i].options.marker?.enabled;\n if (\n isEligibleSeries &&\n (seriesData[i - 1]?.y === undefined || seriesData[i - 1]?.y === null) &&\n (seriesData[i + 1]?.y === undefined || seriesData[i + 1]?.y === null)\n ) {\n seriesData[i].update({ marker: { enabled: true } }, false);\n shouldRedraw = true;\n }\n }\n }\n if (shouldRedraw) {\n this.context.chart().redraw();\n }\n }\n\n // Highcharts sometimes destroys points upon re-rendering. As result, the already stored points can get\n // replaced by `{ destroyed: true }`. This can affect the tooltip state, making the component crash when\n // obtaining data from points, or making it hidden yet pinned, so not visible on hover until a click is made.\n // To prevent these issues, on each render we check for destroyed points in the tooltip state, and proactively\n // hide the tooltip if found. The behavior is only observed during the initial chart loading, and is not expected\n // to cause UX issues with the tooltip being closed unexpectedly.\n // See: https://github.com/highcharts/highcharts/issues/23175.\n private handleDestroyedPoints() {\n const tooltipState = this.chartExtraTooltip.get();\n if (tooltipState.group.some((p) => !p.series)) {\n this.chartExtraTooltip.hideTooltip();\n }\n }\n\n // We reset color counter so that when a series is removed and then added back - it will\n // have the same color as before, not the next one in the color sequence.\n // See: https://github.com/highcharts/highcharts/issues/23077.\n private resetColorCounter() {\n const chart = this.context.chart();\n if (\"colorCounter\" in chart && typeof chart.colorCounter === \"number\") {\n chart.colorCounter = getChartSeries(chart.series).length;\n }\n }\n\n private pinTooltipOnPoint = (point: Highcharts.Point) => {\n const currentPoint = this.chartExtraTooltip.get().point;\n const currentGroup = this.chartExtraTooltip.get().group;\n const positionsMatch = isPointsPositionsEqual(currentPoint ?? currentGroup[0], point);\n\n // If the previously hovered and now clicked positions match, and the the tooltip wasn't\n // dismissed just a moment ago, we make the tooltip pinned in this position.\n if (positionsMatch && !this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(point, { isApiCall: false });\n this.chartExtraTooltip.pinTooltip();\n }\n // If the tooltip was just dismissed, it means this happened by clicking somewhere in the plot area.\n // If the clicked position differs from the one that was pinned - we show tooltip in the new position.\n else if (!positionsMatch && this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(point, { isApiCall: false, overrideTooltipLock: true });\n }\n };\n\n private pinTooltipOnGroup = (group: Highcharts.Point[]) => {\n const currentPoint = this.chartExtraTooltip.get().point;\n const currentGroup = this.chartExtraTooltip.get().group;\n const positionsMatch = isPointsPositionsEqual(currentPoint ?? currentGroup[0], group[0]);\n\n // If the previously hovered and now clicked positions match, and the the tooltip wasn't\n // dismissed just a moment ago, we make the tooltip pinned in this position.\n if (positionsMatch && !this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(group, { isApiCall: false });\n this.chartExtraTooltip.pinTooltip();\n }\n // If the tooltip was just dismissed, it means this happened by clicking somewhere in the plot area.\n // If the clicked position differs from the one that was pinned - we show tooltip in the new position.\n else if (!positionsMatch && this.chartExtraTooltip.tooltipLock) {\n this.highlightActions(group, { isApiCall: false, overrideTooltipLock: true });\n }\n };\n\n private highlightActions(\n target: Highcharts.Point | Highcharts.Point[],\n { isApiCall, overrideTooltipLock }: { isApiCall: boolean; overrideTooltipLock?: boolean },\n ) {\n const point = Array.isArray(target) ? null : target;\n const group = Array.isArray(target) ? target : this.context.derived.getPointsByX(target.x);\n\n if (!this.isTooltipPinned) {\n // Update Highcharts elements state.\n if (point) {\n this.chartExtraHighlight.highlightChartPoint(point);\n } else {\n this.chartExtraHighlight.highlightChartGroup(group);\n }\n\n // Update tooltip and legend state.\n if (point) {\n this.chartExtraLegend.onHighlightPoint(point);\n this.chartExtraTooltip.showTooltipOnPoint(point, group, overrideTooltipLock);\n } else {\n this.chartExtraLegend.onHighlightGroup(group);\n this.chartExtraTooltip.showTooltipOnGroup(group, overrideTooltipLock);\n }\n\n // Notify the consumer that a highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onHighlight, { point, group, isApiCall });\n }\n }\n\n private clearHighlightActions = ({ isApiCall }: { isApiCall: boolean }) => {\n if (!this.isTooltipPinned) {\n // Update Highcharts elements state.\n this.chartExtraHighlight.clearChartItemsHighlight();\n\n // Update tooltip and legend state.\n this.chartExtraTooltip.hideTooltip();\n this.chartExtraLegend.onClearHighlight();\n\n // Notify the consumer that a clear-highlight action was made.\n fireNonCancelableEvent(this.context.handlers.onClearHighlight, { isApiCall });\n }\n };\n\n private get isTooltipPinned() {\n return this.chartExtraTooltip.get().pinned;\n }\n}\n\nfunction isPointsPositionsEqual(current?: Highcharts.Point, next?: Highcharts.Point) {\n return current?.x === next?.x && current?.y === next?.y;\n}\n"]}
@@ -458,9 +458,10 @@ export declare namespace CoreChartProps {
458
458
  interactionType: "select";
459
459
  targetItemId: string;
460
460
  }
461
+ type InteractionKind = ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction;
461
462
  type VisibleItemsChangeDetail = {
462
463
  items: readonly LegendItem[];
463
- } & (ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction);
464
+ } & InteractionKind;
464
465
  interface HighlightChangeDetail {
465
466
  point: null | Highcharts.Point;
466
467
  group: readonly Highcharts.Point[];
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","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 type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * This property only applies when there are no secondary items and `position=\"bottom\"`.\n */\n horizontalAlignment?: LegendOptionsHorizontalAlignment;\n }\n\n export type LegendOptionsHorizontalAlignment = \"start\" | \"center\";\n\n export type LegendItem = InternalComponentTypes.LegendItem;\n export type LegendTooltipContent = InternalComponentTypes.LegendTooltipContent;\n export type GetLegendTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export type GetLegendTooltipContentProps = InternalComponentTypes.GetLegendTooltipContentProps;\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\" | \"target\";\n size?: \"small\" | \"medium\" | \"large\";\n debounce?: number | boolean;\n seriesSorting?: \"as-added\" | \"by-value-desc\";\n }\n\n export type GetTooltipContent = (props: GetTooltipContentProps) => TooltipContentRenderer;\n export interface GetTooltipContentProps {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }\n export interface TooltipContentRenderer {\n point?: (props: TooltipPointProps) => TooltipPointFormatted;\n details?: (props: TooltipDetailsProps) => readonly TooltipDetail[];\n header?: (props: TooltipSlotProps) => React.ReactNode;\n body?: (props: TooltipSlotProps) => React.ReactNode;\n footer?: (props: TooltipSlotProps) => React.ReactNode;\n }\n export type TooltipPointFormatted = BaseTooltipPointFormatted;\n export interface TooltipContentItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n }\n export interface TooltipPointProps {\n item: TooltipContentItem;\n hideTooltip: () => void;\n }\n export interface TooltipSlotProps {\n x: number;\n items: TooltipContentItem[];\n hideTooltip: () => void;\n }\n\n export interface TooltipDetailsProps {\n point: Highcharts.Point;\n hideTooltip: () => void;\n }\n\n export type TooltipDetail = BaseTooltipDetail;\n\n export interface LegendItemHighlightDetail {\n item: LegendItem;\n }\n\n export interface ApiInteraction {\n interactionType: \"api\";\n }\n export interface FilterInteraction {\n interactionType: \"filter\";\n }\n export interface ToggleInteraction {\n interactionType: \"toggle\";\n targetItemId: string;\n }\n export interface SelectInteraction {\n interactionType: \"select\";\n targetItemId: string;\n }\n\n export type VisibleItemsChangeDetail = { items: readonly LegendItem[] } & (\n | ApiInteraction\n | FilterInteraction\n | ToggleInteraction\n | SelectInteraction\n );\n\n export interface HighlightChangeDetail {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n isApiCall: boolean;\n }\n export interface HighlightClearDetail {\n isApiCall: boolean;\n }\n\n export type I18nStrings = CartesianI18nStrings & PieI18nStrings & CoreI18nStrings;\n}\n\nexport interface CoreLegendProps {\n items: readonly CoreLegendProps.Item[];\n title?: string;\n ariaLabel?: string;\n actions?: React.ReactNode;\n alignment?: \"horizontal\" | \"vertical\";\n horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;\n onClearHighlight?: NonCancelableEventHandler;\n onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreLegendProps.VisibleItemsChangeDetail>;\n getLegendTooltipContent?: CoreLegendProps.GetTooltipContent;\n}\n\nexport namespace CoreLegendProps {\n export type Item = InternalComponentTypes.LegendItem;\n export type GetTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export interface ItemHighlightDetail {\n item: Item;\n }\n export type VisibleItemsChangeDetail = { items: readonly string[] } & (\n | CoreChartProps.ToggleInteraction\n | CoreChartProps.SelectInteraction\n );\n}\n\n// Utility types\n\nexport interface Rect {\n x: number;\n y: number;\n height: number;\n width: number;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","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 type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * This property only applies when there are no secondary items and `position=\"bottom\"`.\n */\n horizontalAlignment?: LegendOptionsHorizontalAlignment;\n }\n\n export type LegendOptionsHorizontalAlignment = \"start\" | \"center\";\n\n export type LegendItem = InternalComponentTypes.LegendItem;\n export type LegendTooltipContent = InternalComponentTypes.LegendTooltipContent;\n export type GetLegendTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export type GetLegendTooltipContentProps = InternalComponentTypes.GetLegendTooltipContentProps;\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\" | \"target\";\n size?: \"small\" | \"medium\" | \"large\";\n debounce?: number | boolean;\n seriesSorting?: \"as-added\" | \"by-value-desc\";\n }\n\n export type GetTooltipContent = (props: GetTooltipContentProps) => TooltipContentRenderer;\n export interface GetTooltipContentProps {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }\n export interface TooltipContentRenderer {\n point?: (props: TooltipPointProps) => TooltipPointFormatted;\n details?: (props: TooltipDetailsProps) => readonly TooltipDetail[];\n header?: (props: TooltipSlotProps) => React.ReactNode;\n body?: (props: TooltipSlotProps) => React.ReactNode;\n footer?: (props: TooltipSlotProps) => React.ReactNode;\n }\n export type TooltipPointFormatted = BaseTooltipPointFormatted;\n export interface TooltipContentItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n }\n export interface TooltipPointProps {\n item: TooltipContentItem;\n hideTooltip: () => void;\n }\n export interface TooltipSlotProps {\n x: number;\n items: TooltipContentItem[];\n hideTooltip: () => void;\n }\n\n export interface TooltipDetailsProps {\n point: Highcharts.Point;\n hideTooltip: () => void;\n }\n\n export type TooltipDetail = BaseTooltipDetail;\n\n export interface LegendItemHighlightDetail {\n item: LegendItem;\n }\n\n export interface ApiInteraction {\n interactionType: \"api\";\n }\n export interface FilterInteraction {\n interactionType: \"filter\";\n }\n export interface ToggleInteraction {\n interactionType: \"toggle\";\n targetItemId: string;\n }\n export interface SelectInteraction {\n interactionType: \"select\";\n targetItemId: string;\n }\n\n export type InteractionKind = ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction;\n\n export type VisibleItemsChangeDetail = { items: readonly LegendItem[] } & InteractionKind;\n\n export interface HighlightChangeDetail {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n isApiCall: boolean;\n }\n export interface HighlightClearDetail {\n isApiCall: boolean;\n }\n\n export type I18nStrings = CartesianI18nStrings & PieI18nStrings & CoreI18nStrings;\n}\n\nexport interface CoreLegendProps {\n items: readonly CoreLegendProps.Item[];\n title?: string;\n ariaLabel?: string;\n actions?: React.ReactNode;\n alignment?: \"horizontal\" | \"vertical\";\n horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;\n onClearHighlight?: NonCancelableEventHandler;\n onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreLegendProps.VisibleItemsChangeDetail>;\n getLegendTooltipContent?: CoreLegendProps.GetTooltipContent;\n}\n\nexport namespace CoreLegendProps {\n export type Item = InternalComponentTypes.LegendItem;\n export type GetTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export interface ItemHighlightDetail {\n item: Item;\n }\n export type VisibleItemsChangeDetail = { items: readonly string[] } & (\n | CoreChartProps.ToggleInteraction\n | CoreChartProps.SelectInteraction\n );\n}\n\n// Utility types\n\nexport interface Rect {\n x: number;\n y: number;\n height: number;\n width: number;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chart-components";
2
- export var PACKAGE_VERSION = "1.0.0 (3a4021d6)";
2
+ export var PACKAGE_VERSION = "1.0.0 (04070990)";
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 (3a4021d6)",
3
+ "PACKAGE_VERSION": "1.0.0 (04070990)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true,
6
6
  "SYSTEM": "core"
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "3a4021d62a265f9276cfffd7a30604247979f3c0"
2
+ "commit": "040709907ecc2464acc9b72248346ec95fd2bef6"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chart-components",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chart-components.git"
@@ -13,7 +13,7 @@ const PieChart = forwardRef(({ fitHeight = false, ...props }, ref) => {
13
13
  const series = transformSeries(props.series);
14
14
  const tooltip = transformTooltip(props.tooltip);
15
15
  const legend = transformLegend(props.legend);
16
- const baseComponentProps = useBaseComponent("PieChart", { props: { fitHeight } });
16
+ const baseComponentProps = useBaseComponent("PieHighcharts", { props: { fitHeight } });
17
17
  return (_jsx(InternalPieChart, { ref: ref, ...props, fitHeight: fitHeight, series: series, tooltip: tooltip, legend: legend, ...getDataAttributes(props), ...baseComponentProps }));
18
18
  });
19
19
  applyDisplayName(PieChart, "PieChart");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAKxD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,EAAiB,EAAE,GAAiC,EAAE,EAAE;IAChH,0FAA0F;IAC1F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7C,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,UAAU,EAAE,EA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,mCAAI,IAAI;QACjC,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAoC;;IAC3D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalPieChart } from \"./chart-pie-internal\";\nimport { PieChartProps } from \"./interfaces\";\n\nexport type { PieChartProps };\n\nconst PieChart = forwardRef(({ fitHeight = false, ...props }: PieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"PieChart\", { props: { fitHeight } });\n\n return (\n <InternalPieChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n series={series}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n});\n\napplyDisplayName(PieChart, \"PieChart\");\n\nexport default PieChart;\n\nfunction transformSeries(series: null | PieChartProps.SeriesOptions): readonly PieChartProps.SeriesOptions[] {\n if (!series) {\n return [];\n }\n switch (series.type) {\n case \"pie\":\n case \"donut\":\n return [\n { type: series.type, id: series.id, name: series.name, color: series.color, data: transformData(series.data) },\n ];\n }\n}\n\nfunction transformData(data: readonly PieChartProps.PieSegmentOptions[]): readonly PieChartProps.PieSegmentOptions[] {\n return data.map((d) => ({ id: d.id, name: d.name, color: d.color, y: d.y }));\n}\n\nfunction transformTooltip(\n tooltip?: PieChartProps.TooltipOptions,\n): SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(legend?: PieChartProps.LegendOptions): SomeRequired<PieChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAKxD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,KAAK,EAAiB,EAAE,GAAiC,EAAE,EAAE;IAChH,0FAA0F;IAC1F,2FAA2F;IAC3F,0EAA0E;IAC1E,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7C,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAEv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,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAoC;;IAC3D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalPieChart } from \"./chart-pie-internal\";\nimport { PieChartProps } from \"./interfaces\";\n\nexport type { PieChartProps };\n\nconst PieChart = forwardRef(({ fitHeight = false, ...props }: PieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"PieHighcharts\", { props: { fitHeight } });\n\n return (\n <InternalPieChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n series={series}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n});\n\napplyDisplayName(PieChart, \"PieChart\");\n\nexport default PieChart;\n\nfunction transformSeries(series: null | PieChartProps.SeriesOptions): readonly PieChartProps.SeriesOptions[] {\n if (!series) {\n return [];\n }\n switch (series.type) {\n case \"pie\":\n case \"donut\":\n return [\n { type: series.type, id: series.id, name: series.name, color: series.color, data: transformData(series.data) },\n ];\n }\n}\n\nfunction transformData(data: readonly PieChartProps.PieSegmentOptions[]): readonly PieChartProps.PieSegmentOptions[] {\n return data.map((d) => ({ id: d.id, name: d.name, color: d.color, y: d.y }));\n}\n\nfunction transformTooltip(\n tooltip?: PieChartProps.TooltipOptions,\n): SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(legend?: PieChartProps.LegendOptions): SomeRequired<PieChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}