@cloudscape-design/chart-components 1.0.74 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cartesian-chart/chart-cartesian-internal.js +2 -1
- package/cartesian-chart/chart-cartesian-internal.js.map +1 -1
- package/cartesian-chart/chart-series-cartesian.js +12 -1
- package/cartesian-chart/chart-series-cartesian.js.map +1 -1
- package/cartesian-chart/index.js +40 -4
- package/cartesian-chart/index.js.map +1 -1
- package/cartesian-chart/interfaces.d.ts +9 -1
- package/cartesian-chart/interfaces.js.map +1 -1
- package/core/chart-core.js +3 -3
- package/core/chart-core.js.map +1 -1
- package/core/components/core-legend.d.ts +2 -1
- package/core/components/core-legend.js +2 -2
- package/core/components/core-legend.js.map +1 -1
- package/core/interfaces.d.ts +4 -2
- package/core/interfaces.js.map +1 -1
- package/core/utils.d.ts +4 -0
- package/core/utils.js +6 -2
- package/core/utils.js.map +1 -1
- package/internal/api-docs/components/cartesian-chart.js +12 -66
- package/internal/api-docs/test-utils-doc/dom.js +44 -4
- package/internal/api-docs/test-utils-doc/selectors.js +44 -4
- package/internal/components/chart-legend/index.d.ts +2 -1
- package/internal/components/chart-legend/index.js +2 -2
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/test-utils/dom/internal/base.d.ts +8 -2
- package/test-utils/dom/internal/base.js +11 -3
- package/test-utils/dom/internal/base.js.map +1 -1
- package/test-utils/dom/internal/core.d.ts +3 -2
- package/test-utils/dom/internal/core.js +5 -5
- package/test-utils/dom/internal/core.js.map +1 -1
- package/test-utils/selectors/internal/base.d.ts +8 -2
- package/test-utils/selectors/internal/base.js +9 -3
- package/test-utils/selectors/internal/base.js.map +1 -1
- package/test-utils/selectors/internal/core.d.ts +3 -2
- package/test-utils/selectors/internal/core.js +3 -5
- package/test-utils/selectors/internal/core.js.map +1 -1
package/core/ch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AAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC;QACD,GAAG,OAAO;KACX,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,kBAAsD,EAAE,EACxD,iBAA0B;IAE1B,OAAO,iBAAiB;QACtB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,gBAAgB,EAAE,SAAS,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAAE,EAAE,GAAG,eAAe,CAAC;QAC/G,CAAC,CAAC,eAAe,CAAC;AACtB,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 clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\n\nimport {\n getIsRtl,\n isDevelopment,\n KeyCode,\n useMergeRefs,\n useUniqueId,\n} from \"@cloudscape-design/component-toolkit/internal\";\nimport Spinner from \"@cloudscape-design/components/spinner\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { castArray } from \"../internal/utils/utils\";\nimport { useChartAPI } from \"./chart-api\";\nimport { ChartExtraContext } from \"./chart-api/chart-extra-context\";\nimport { ChartContainer } from \"./chart-container\";\nimport { ChartApplication } from \"./components/core-application\";\nimport { ChartFilters } from \"./components/core-filters\";\nimport { ChartLegend } from \"./components/core-legend\";\nimport { ChartNoData } from \"./components/core-no-data\";\nimport { ChartFooter, ChartHeader } from \"./components/core-slots\";\nimport { ChartTooltip } from \"./components/core-tooltip\";\nimport { VerticalAxisTitle } from \"./components/core-vertical-axis-title\";\nimport { getFormatter } from \"./formatters\";\nimport { useChartI18n } from \"./i18n-utils\";\nimport { CoreChartProps } from \"./interfaces\";\nimport { getLegendsProps, getPointAccessibleDescription } from \"./utils\";\n\nimport styles from \"./styles.css.js\";\nimport testClasses from \"./test-classes/styles.css.js\";\n\n/**\n * CoreChart is the core internal abstraction that accepts the entire set of Highcharts options along\n * with Cloudscape props to define custom tooltip, no-data, formatters, items visibility, and more.\n */\nexport function InternalCoreChart({\n options,\n ariaLabel,\n ariaDescription,\n fitHeight,\n chartHeight,\n chartMinHeight,\n chartMinWidth,\n tooltip: tooltipOptions,\n noData: noDataOptions,\n navigator,\n legend: legendOptions,\n fallback = <Spinner />,\n callback,\n emphasizeBaseline = true,\n verticalAxisTitlePlacement = \"side\",\n i18nStrings,\n className,\n header,\n footer,\n filter,\n keyboardNavigation = true,\n onHighlight,\n onLegendItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n visibleItems,\n __internalRootRef,\n getItemOptions,\n ...rest\n}: CoreChartProps & InternalBaseComponentProps) {\n const highcharts = rest.highcharts as null | typeof Highcharts;\n const labels = useChartI18n({ ariaLabel, ariaDescription, i18nStrings });\n const context: ChartExtraContext[\"settings\"] = {\n chartId: useUniqueId(),\n noDataEnabled: !!noDataOptions,\n legendEnabled: legendOptions?.enabled !== false,\n tooltipEnabled: tooltipOptions?.enabled !== false,\n keyboardNavigationEnabled: keyboardNavigation,\n labels,\n getItemOptions: getItemOptions ?? (() => ({})),\n };\n const handlers = { onHighlight, onClearHighlight, onVisibleItemsChange };\n const state = { visibleItems };\n const api = useChartAPI(context, handlers, state);\n\n const rootClassName = clsx(testClasses.root, styles.root, fitHeight && styles[\"root-fit-height\"], className);\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(rootRef, __internalRootRef);\n const rootProps = { ref: mergedRootRef, className: rootClassName, ...getDataAttributes(rest) };\n const legendPosition = legendOptions?.position ?? \"bottom\";\n const commonLegendProps = {\n api: api,\n i18nStrings,\n onItemHighlight: onLegendItemHighlight,\n getLegendTooltipContent: rest.getLegendTooltipContent,\n };\n const containerProps = {\n fitHeight,\n chartHeight,\n chartMinHeight,\n chartMinWidth,\n legendPosition,\n verticalAxisTitlePlacement,\n legendBottomMaxHeight: legendOptions?.bottomMaxHeight,\n };\n\n // AWSUI-61678\n // Add global Escape key listener to dismiss hover tooltips for WCAG Content on Hover/Focus compliance\n // This listener handles Escape when using mouse hover. When keyboard navigation is active (application\n // element is focused), the navigation handler deals with Escape, so we skip to avoid conflicts.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // Skip if keyboard navigation is handling this (event originated from application element)\n const target = event.target as Element;\n if (context.keyboardNavigationEnabled && target?.closest('[role=\"application\"]')) {\n return;\n }\n\n if (event.keyCode === KeyCode.escape && context.tooltipEnabled) {\n const tooltipState = api.tooltipStore.get();\n if (tooltipState.visible && !tooltipState.pinned) {\n api.hideTooltip();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [api, context.tooltipEnabled, context.keyboardNavigationEnabled]);\n\n // Render fallback using the same root and container props as for the chart to ensure consistent\n // size, test classes, and data-attributes assignment.\n if (!highcharts) {\n return (\n <div {...rootProps}>\n <ChartContainer\n {...containerProps}\n chart={(minHeight) => (\n <div className={testClasses.fallback} style={{ minHeight }}>\n {fallback}\n </div>\n )}\n />\n </div>\n );\n }\n\n const apiOptions = api.getOptions();\n const inverted = !!options.chart?.inverted;\n const isRtl = getIsRtl(rootRef?.current);\n\n // The Highcharts options takes all provided Highcharts options and custom properties and merges them together, so that\n // the Cloudscape features and custom Highcharts extensions co-exist.\n // For certain options we provide Cloudscape styling, but in all cases this can be explicitly overridden.\n options = {\n ...options,\n // Hide credits by default.\n credits: options.credits ?? { enabled: false },\n // Hide chart title by default.\n title: options.title ?? { text: \"\" },\n // Use Cloudscape color palette by default.\n // This cannot be reset to Highcharts' default from the outside, but it is possible to provide custom palette.\n colors: options.colors ?? Styles.colors,\n chart: {\n // Animations are disabled by default.\n // This is done for UX and a11y reasons as Highcharts animations do not match our animation timings, and do\n // not respect disabled motion settings. These issues can likely be resolved or we can provide custom animations\n // instead, but this is not a priority.\n animation: false,\n ...Styles.chart,\n ...options.chart,\n className: clsx(testClasses[\"chart-plot\"], options.chart?.className),\n // The debug errors are enabled by default in development mode, but this only works\n // if the Highcharts debugger module is loaded.\n displayErrors: options.chart?.displayErrors ?? isDevelopment,\n style: { ...Styles.chartPlotCss, ...options.chart?.style },\n },\n series: options.series,\n // Highcharts legend is disabled by default in favour of the custom Cloudscape legend.\n legend: options.legend ?? { enabled: false },\n lang: {\n ...options.lang,\n accessibility: {\n // The default chart title is disabled by default to prevent the default \"Chart\" in the screen-reader detail.\n defaultChartTitle: \"\",\n chartContainerLabel: labels.chartLabel,\n svgContainerLabel: labels.chartContainerLabel,\n // We used {names[0]} to inject the axis title, see: https://api.highcharts.com/highcharts/lang.accessibility.axis.xAxisDescriptionSingular.\n axis: {\n xAxisDescriptionSingular: labels.chartXAxisLabel ? `${labels.chartXAxisLabel}, {names[0]}` : undefined,\n yAxisDescriptionSingular: labels.chartYAxisLabel ? `${labels.chartYAxisLabel}, {names[0]}` : undefined,\n },\n ...options.lang?.accessibility,\n },\n },\n accessibility: {\n description: labels.chartDescription,\n screenReaderSection: {\n // We use custom before-message to remove detail that are currently not supported with our i18n.\n // See: https://api.highcharts.com/highcharts/accessibility.screenReaderSection.beforeChartFormat.\n beforeChartFormat: \"<div>{xAxisDescription}</div><div>{yAxisDescription}</div>\",\n // We hide after message as it is currently not supported with our i18n.\n afterChartFormat: \"\",\n },\n ...options.accessibility,\n // Highcharts keyboard navigation is disabled by default in favour of the custom Cloudscape navigation.\n keyboardNavigation: options.accessibility?.keyboardNavigation ?? { enabled: !keyboardNavigation },\n point: {\n // Point description formatter is overridden to respect custom axes value formatters.\n descriptionFormatter: (point) => getPointAccessibleDescription(point, labels),\n ...options.accessibility?.point,\n },\n },\n // We use the rtl adjusted axes (instead of the original options.xAxis/yAxis) to ensure the chart renders\n // with the correct axis orientation for RTL layouts, matching what was used for legend positioning above.\n xAxis: castArray(options.xAxis)?.map((xAxisOptions) => ({\n ...Styles.xAxisOptions,\n ...xAxisOptions,\n // Depending on the chart.inverted the x-axis can be rendered as vertical, and needs to respect page direction.\n reversed: !inverted && isRtl ? !xAxisOptions.reversed : xAxisOptions.reversed,\n opposite: inverted && isRtl ? !xAxisOptions.opposite : xAxisOptions.opposite,\n className: xAxisClassName(inverted, xAxisOptions.className),\n title: axisTitle(xAxisOptions.title ?? {}, !inverted || verticalAxisTitlePlacement === \"side\"),\n labels: axisLabels(xAxisOptions.labels ?? {}),\n })),\n yAxis: castArray(options.yAxis)?.map((yAxisOptions) => ({\n ...Styles.yAxisOptions,\n ...yAxisOptions,\n // Depending on the chart.inverted the y-axis can be rendered as vertical, and needs to respect page direction.\n reversed: inverted && isRtl ? !yAxisOptions.reversed : yAxisOptions.reversed,\n opposite: !inverted && isRtl ? !yAxisOptions.opposite : yAxisOptions.opposite,\n className: yAxisClassName(inverted, yAxisOptions.className),\n title: axisTitle(yAxisOptions.title ?? {}, inverted || verticalAxisTitlePlacement === \"side\"),\n labels: axisLabels(yAxisOptions.labels ?? {}),\n plotLines: yAxisPlotLines(yAxisOptions.plotLines, emphasizeBaseline),\n // We use reversed stack by default so that the order of points in the tooltip and series in the legend\n // correspond the order of stacks.\n reversedStacks: yAxisOptions.reversedStacks ?? true,\n })),\n plotOptions: {\n ...options.plotOptions,\n series: {\n // Animations are disabled by default, same as in the options.chart.\n animation: false,\n // Sticky tracking is disabled by default due to sub-optimal UX in dense charts.\n stickyTracking: false,\n borderColor: Styles.seriesBorderColor,\n ...options.plotOptions?.series,\n dataLabels: { style: Styles.seriesDataLabelsCss, ...options.plotOptions?.series?.dataLabels },\n states: {\n ...options.plotOptions?.series?.states,\n inactive: { opacity: Styles.seriesOpacityInactive, ...options.plotOptions?.series?.states?.inactive },\n },\n },\n area: { ...Styles.areaSeries, ...options.plotOptions?.area },\n areaspline: { ...Styles.areaSeries, ...options.plotOptions?.areaspline },\n arearange: { ...Styles.areaSeries, ...options.plotOptions?.arearange },\n areasplinerange: { ...Styles.areaSeries, ...options.plotOptions?.areasplinerange },\n line: { ...Styles.lineSeries, ...options.plotOptions?.line },\n spline: { ...Styles.lineSeries, ...options.plotOptions?.spline },\n column: { ...Styles.columnSeries, ...options.plotOptions?.column },\n errorbar: { ...Styles.errorbarSeries, ...options.plotOptions?.errorbar },\n // Pie chart is shown in legend by default, that is required for standalone pie charts.\n pie: {\n showInLegend: true,\n ...Styles.pieSeries,\n ...options.plotOptions?.pie,\n dataLabels: { ...Styles.pieSeriesDataLabels, ...options.plotOptions?.pie?.dataLabels },\n },\n },\n // We don't use Highcharts tooltip, but certain tooltip options such as tooltip.snap or tooltip.shared\n // affect the hovering behavior of Highcharts. That is only the case when the tooltip is not disabled,\n // so we render it, but hide with styles.\n tooltip: options.tooltip ?? { enabled: true, snap: Styles.tooltipSnap, style: { opacity: 0 } },\n };\n\n const legendProps = getLegendsProps(options, legendOptions);\n\n return (\n <div {...rootProps}>\n <ChartContainer\n {...containerProps}\n chart={(height) => {\n // We declare event handlers here to ensure that no event fires until the chart is initialized.\n const highchartsOptions: Highcharts.Options = {\n ...options,\n chart: {\n ...options.chart,\n // Use height computed from chartHeight, chartMinHeight, and fitHeight settings by default.\n // It is possible to override it by explicitly providing chart.height, but this will not be\n // compatible with any of the above settings.\n height: options.chart?.height ?? height,\n // We override certain chart events to inject additional behaviors, but it is still possible to define\n // custom callbacks. The Cloudscape behaviors can be disabled or altered via components API. For instance,\n // if no-data props are not provided - the related on-render computations will be skipped.\n events: {\n ...options.chart?.events,\n load(event) {\n apiOptions.onChartLoad.call(this, event);\n return options.chart?.events?.load?.call(this, event);\n },\n render(event) {\n apiOptions.onChartRender.call(this, event);\n return options.chart?.events?.render?.call(this, event);\n },\n click(event) {\n apiOptions.onChartClick.call(this, event);\n return options.chart?.events?.click?.call(this, event);\n },\n },\n },\n plotOptions: {\n ...options.plotOptions,\n series: {\n ...options.plotOptions?.series,\n // We override certain point events to inject additional behaviors, but it is still possible to define\n // custom callbacks. The Cloudscape behaviors can be disabled or altered via components API.\n point: {\n ...options.plotOptions?.series?.point,\n events: {\n ...options.plotOptions?.series?.point?.events,\n mouseOver(event) {\n apiOptions.onSeriesPointMouseOver.call(this, event);\n return options.plotOptions?.series?.point?.events?.mouseOver?.call(this, event);\n },\n mouseOut(event) {\n apiOptions.onSeriesPointMouseOut.call(this, event);\n return options.plotOptions?.series?.point?.events?.mouseOut?.call(this, event);\n },\n click(event) {\n apiOptions.onSeriesPointClick.call(this, event);\n return options.plotOptions?.series?.point?.events?.click?.call(this, event);\n },\n },\n },\n },\n },\n };\n return (\n <>\n <ChartApplication api={api} keyboardNavigation={keyboardNavigation} ariaLabel={ariaLabel} />\n <HighchartsReact\n highcharts={highcharts}\n options={highchartsOptions}\n callback={(chart: Highcharts.Chart) =>\n callback?.({ chart, highcharts: highcharts as typeof Highcharts, ...api.publicApi })\n }\n />\n </>\n );\n }}\n navigator={navigator}\n primaryLegend={\n context.legendEnabled && legendProps.primary ? (\n <ChartLegend {...commonLegendProps} {...legendProps.primary} className={testClasses[\"legend-primary\"]} />\n ) : null\n }\n secondaryLegend={\n context.legendEnabled && legendProps.secondary ? (\n <ChartLegend\n {...commonLegendProps}\n {...legendProps.secondary}\n className={testClasses[\"legend-secondary\"]}\n />\n ) : null\n }\n verticalAxisTitle={\n verticalAxisTitlePlacement === \"top\" ? <VerticalAxisTitle api={api} inverted={!!inverted} /> : null\n }\n header={header?.content ? <ChartHeader>{header.content}</ChartHeader> : null}\n footer={footer?.content ? <ChartFooter>{footer.content}</ChartFooter> : null}\n filter={\n filter?.seriesFilter || filter?.additionalFilters ? (\n <ChartFilters\n api={api}\n seriesFilter={filter?.seriesFilter}\n additionalFilters={filter?.additionalFilters}\n i18nStrings={i18nStrings}\n />\n ) : null\n }\n noData={context.noDataEnabled && <ChartNoData {...noDataOptions} i18nStrings={i18nStrings} api={api} />}\n />\n\n {context.tooltipEnabled && (\n <ChartTooltip\n {...tooltipOptions}\n i18nStrings={i18nStrings}\n getTooltipContent={rest.getTooltipContent}\n sizeAxis={castArray(rest.sizeAxis as CoreChartProps.SizeAxisOptions[])}\n api={api}\n />\n )}\n </div>\n );\n}\n\nfunction xAxisClassName(inverted: boolean, customClassName?: string) {\n return clsx(\n testClasses[\"axis-x\"],\n inverted ? testClasses[\"axis-vertical\"] : testClasses[\"axis-horizontal\"],\n customClassName,\n );\n}\n\nfunction yAxisClassName(inverted: boolean, customClassName?: string) {\n return clsx(\n testClasses[\"axis-y\"],\n inverted ? testClasses[\"axis-horizontal\"] : testClasses[\"axis-vertical\"],\n customClassName,\n );\n}\n\n// When placing vertical axis title in the chart's top, the actual axis title rendered by Highcharts\n// needs to be visually hidden (it is still accessible by screen-readers). We then set title's\n// opacity to 0, and use reserveSpace=false, so that Highcharts stretches the plot area to all available\n// container width.\nfunction axisTitle<O extends Highcharts.XAxisTitleOptions | Highcharts.YAxisTitleOptions>(\n options: O,\n visible: boolean,\n): O {\n return {\n style: { ...Styles.axisTitleCss, opacity: visible ? undefined : 0 },\n reserveSpace: visible ? undefined : false,\n ...options,\n };\n}\n\n// We use custom formatters instead of Highcharts defaults to ensure consistent formatting\n// between axis ticks and tooltip contents.\nfunction axisLabels<O extends Highcharts.XAxisLabelsOptions | Highcharts.YAxisLabelsOptions>(options: O): O {\n return {\n style: Styles.axisLabelsCss,\n formatter: function () {\n const formattedValue = getFormatter(this.axis)(this.value);\n return formattedValue.replace(/\\n/g, \"<br />\");\n },\n ...options,\n };\n}\n\nfunction yAxisPlotLines(\n plotLineOptions: Highcharts.YAxisPlotLinesOptions[] = [],\n emphasizeBaseline: boolean,\n): Highcharts.YAxisPlotLinesOptions[] {\n return emphasizeBaseline\n ? [{ value: 0, ...Styles.chatPlotBaseline, className: testClasses[\"emphasized-baseline\"] }, ...plotLineOptions]\n : plotLineOptions;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-core.js","sourceRoot":"","sources":["../../../src/core/chart-core.tsx"],"names":[],"mapp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AAC;QACjD,CAAC;QACD,GAAG,OAAO;KACX,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CACrB,kBAAsD,EAAE,EACxD,iBAA0B;IAE1B,OAAO,iBAAiB;QACtB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,gBAAgB,EAAE,SAAS,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAAE,EAAE,GAAG,eAAe,CAAC;QAC/G,CAAC,CAAC,eAAe,CAAC;AACtB,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 clsx from \"clsx\";\nimport type Highcharts from \"highcharts\";\nimport HighchartsReact from \"highcharts-react-official\";\n\nimport {\n getIsRtl,\n isDevelopment,\n KeyCode,\n useMergeRefs,\n useUniqueId,\n} from \"@cloudscape-design/component-toolkit/internal\";\nimport Spinner from \"@cloudscape-design/components/spinner\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { castArray } from \"../internal/utils/utils\";\nimport { useChartAPI } from \"./chart-api\";\nimport { ChartExtraContext } from \"./chart-api/chart-extra-context\";\nimport { ChartContainer } from \"./chart-container\";\nimport { ChartApplication } from \"./components/core-application\";\nimport { ChartFilters } from \"./components/core-filters\";\nimport { ChartLegend } from \"./components/core-legend\";\nimport { ChartNoData } from \"./components/core-no-data\";\nimport { ChartFooter, ChartHeader } from \"./components/core-slots\";\nimport { ChartTooltip } from \"./components/core-tooltip\";\nimport { VerticalAxisTitle } from \"./components/core-vertical-axis-title\";\nimport { getFormatter } from \"./formatters\";\nimport { useChartI18n } from \"./i18n-utils\";\nimport { CoreChartProps } from \"./interfaces\";\nimport { getLegendsProps, getPointAccessibleDescription } from \"./utils\";\n\nimport styles from \"./styles.css.js\";\nimport testClasses from \"./test-classes/styles.css.js\";\n\n/**\n * CoreChart is the core internal abstraction that accepts the entire set of Highcharts options along\n * with Cloudscape props to define custom tooltip, no-data, formatters, items visibility, and more.\n */\nexport function InternalCoreChart({\n options,\n ariaLabel,\n ariaDescription,\n fitHeight,\n chartHeight,\n chartMinHeight,\n chartMinWidth,\n tooltip: tooltipOptions,\n noData: noDataOptions,\n navigator,\n legend: legendOptions,\n fallback = <Spinner />,\n callback,\n emphasizeBaseline = true,\n verticalAxisTitlePlacement = \"side\",\n i18nStrings,\n className,\n header,\n footer,\n filter,\n keyboardNavigation = true,\n onHighlight,\n onLegendItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n visibleItems,\n __internalRootRef,\n getItemOptions,\n ...rest\n}: CoreChartProps & InternalBaseComponentProps) {\n const highcharts = rest.highcharts as null | typeof Highcharts;\n const labels = useChartI18n({ ariaLabel, ariaDescription, i18nStrings });\n const context: ChartExtraContext[\"settings\"] = {\n chartId: useUniqueId(),\n noDataEnabled: !!noDataOptions,\n legendEnabled: legendOptions?.enabled !== false,\n tooltipEnabled: tooltipOptions?.enabled !== false,\n keyboardNavigationEnabled: keyboardNavigation,\n labels,\n getItemOptions: getItemOptions ?? (() => ({})),\n };\n const handlers = { onHighlight, onClearHighlight, onVisibleItemsChange };\n const state = { visibleItems };\n const api = useChartAPI(context, handlers, state);\n\n const rootClassName = clsx(testClasses.root, styles.root, fitHeight && styles[\"root-fit-height\"], className);\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(rootRef, __internalRootRef);\n const rootProps = { ref: mergedRootRef, className: rootClassName, ...getDataAttributes(rest) };\n const legendPosition = legendOptions?.position ?? \"bottom\";\n const commonLegendProps = {\n api: api,\n i18nStrings,\n onItemHighlight: onLegendItemHighlight,\n getLegendTooltipContent: rest.getLegendTooltipContent,\n };\n const containerProps = {\n fitHeight,\n chartHeight,\n chartMinHeight,\n chartMinWidth,\n legendPosition,\n verticalAxisTitlePlacement,\n legendBottomMaxHeight: legendOptions?.bottomMaxHeight,\n };\n\n // AWSUI-61678\n // Add global Escape key listener to dismiss hover tooltips for WCAG Content on Hover/Focus compliance\n // This listener handles Escape when using mouse hover. When keyboard navigation is active (application\n // element is focused), the navigation handler deals with Escape, so we skip to avoid conflicts.\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // Skip if keyboard navigation is handling this (event originated from application element)\n const target = event.target as Element;\n if (context.keyboardNavigationEnabled && target?.closest('[role=\"application\"]')) {\n return;\n }\n\n if (event.keyCode === KeyCode.escape && context.tooltipEnabled) {\n const tooltipState = api.tooltipStore.get();\n if (tooltipState.visible && !tooltipState.pinned) {\n api.hideTooltip();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [api, context.tooltipEnabled, context.keyboardNavigationEnabled]);\n\n // Render fallback using the same root and container props as for the chart to ensure consistent\n // size, test classes, and data-attributes assignment.\n if (!highcharts) {\n return (\n <div {...rootProps}>\n <ChartContainer\n {...containerProps}\n chart={(minHeight) => (\n <div className={testClasses.fallback} style={{ minHeight }}>\n {fallback}\n </div>\n )}\n />\n </div>\n );\n }\n\n const apiOptions = api.getOptions();\n const inverted = !!options.chart?.inverted;\n const isRtl = getIsRtl(rootRef?.current);\n\n // The Highcharts options takes all provided Highcharts options and custom properties and merges them together, so that\n // the Cloudscape features and custom Highcharts extensions co-exist.\n // For certain options we provide Cloudscape styling, but in all cases this can be explicitly overridden.\n options = {\n ...options,\n // Hide credits by default.\n credits: options.credits ?? { enabled: false },\n // Hide chart title by default.\n title: options.title ?? { text: \"\" },\n // Use Cloudscape color palette by default.\n // This cannot be reset to Highcharts' default from the outside, but it is possible to provide custom palette.\n colors: options.colors ?? Styles.colors,\n chart: {\n // Animations are disabled by default.\n // This is done for UX and a11y reasons as Highcharts animations do not match our animation timings, and do\n // not respect disabled motion settings. These issues can likely be resolved or we can provide custom animations\n // instead, but this is not a priority.\n animation: false,\n ...Styles.chart,\n ...options.chart,\n className: clsx(testClasses[\"chart-plot\"], options.chart?.className),\n // The debug errors are enabled by default in development mode, but this only works\n // if the Highcharts debugger module is loaded.\n displayErrors: options.chart?.displayErrors ?? isDevelopment,\n style: { ...Styles.chartPlotCss, ...options.chart?.style },\n },\n series: options.series,\n // Highcharts legend is disabled by default in favour of the custom Cloudscape legend.\n legend: options.legend ?? { enabled: false },\n lang: {\n ...options.lang,\n accessibility: {\n // The default chart title is disabled by default to prevent the default \"Chart\" in the screen-reader detail.\n defaultChartTitle: \"\",\n chartContainerLabel: labels.chartLabel,\n svgContainerLabel: labels.chartContainerLabel,\n // We used {names[0]} to inject the axis title, see: https://api.highcharts.com/highcharts/lang.accessibility.axis.xAxisDescriptionSingular.\n axis: {\n xAxisDescriptionSingular: labels.chartXAxisLabel ? `${labels.chartXAxisLabel}, {names[0]}` : undefined,\n yAxisDescriptionSingular: labels.chartYAxisLabel ? `${labels.chartYAxisLabel}, {names[0]}` : undefined,\n },\n ...options.lang?.accessibility,\n },\n },\n accessibility: {\n description: labels.chartDescription,\n screenReaderSection: {\n // We use custom before-message to remove detail that are currently not supported with our i18n.\n // See: https://api.highcharts.com/highcharts/accessibility.screenReaderSection.beforeChartFormat.\n beforeChartFormat: \"<div>{xAxisDescription}</div><div>{yAxisDescription}</div>\",\n // We hide after message as it is currently not supported with our i18n.\n afterChartFormat: \"\",\n },\n ...options.accessibility,\n // Highcharts keyboard navigation is disabled by default in favour of the custom Cloudscape navigation.\n keyboardNavigation: options.accessibility?.keyboardNavigation ?? { enabled: !keyboardNavigation },\n point: {\n // Point description formatter is overridden to respect custom axes value formatters.\n descriptionFormatter: (point) => getPointAccessibleDescription(point, labels),\n ...options.accessibility?.point,\n },\n },\n // We use the rtl adjusted axes (instead of the original options.xAxis/yAxis) to ensure the chart renders\n // with the correct axis orientation for RTL layouts, matching what was used for legend positioning above.\n xAxis: castArray(options.xAxis)?.map((xAxisOptions) => ({\n ...Styles.xAxisOptions,\n ...xAxisOptions,\n // Depending on the chart.inverted the x-axis can be rendered as vertical, and needs to respect page direction.\n reversed: !inverted && isRtl ? !xAxisOptions.reversed : xAxisOptions.reversed,\n opposite: inverted && isRtl ? !xAxisOptions.opposite : xAxisOptions.opposite,\n className: xAxisClassName(inverted, xAxisOptions.className),\n title: axisTitle(xAxisOptions.title ?? {}, !inverted || verticalAxisTitlePlacement === \"side\"),\n labels: axisLabels(xAxisOptions.labels ?? {}),\n })),\n yAxis: castArray(options.yAxis)?.map((yAxisOptions) => ({\n ...Styles.yAxisOptions,\n ...yAxisOptions,\n // Depending on the chart.inverted the y-axis can be rendered as vertical, and needs to respect page direction.\n reversed: inverted && isRtl ? !yAxisOptions.reversed : yAxisOptions.reversed,\n opposite: !inverted && isRtl ? !yAxisOptions.opposite : yAxisOptions.opposite,\n className: yAxisClassName(inverted, yAxisOptions.className, yAxisOptions.id),\n title: axisTitle(yAxisOptions.title ?? {}, inverted || verticalAxisTitlePlacement === \"side\"),\n labels: axisLabels(yAxisOptions.labels ?? {}),\n plotLines: yAxisPlotLines(yAxisOptions.plotLines, emphasizeBaseline),\n // We use reversed stack by default so that the order of points in the tooltip and series in the legend\n // correspond the order of stacks.\n reversedStacks: yAxisOptions.reversedStacks ?? true,\n })),\n plotOptions: {\n ...options.plotOptions,\n series: {\n // Animations are disabled by default, same as in the options.chart.\n animation: false,\n // Sticky tracking is disabled by default due to sub-optimal UX in dense charts.\n stickyTracking: false,\n borderColor: Styles.seriesBorderColor,\n ...options.plotOptions?.series,\n dataLabels: { style: Styles.seriesDataLabelsCss, ...options.plotOptions?.series?.dataLabels },\n states: {\n ...options.plotOptions?.series?.states,\n inactive: { opacity: Styles.seriesOpacityInactive, ...options.plotOptions?.series?.states?.inactive },\n },\n },\n area: { ...Styles.areaSeries, ...options.plotOptions?.area },\n areaspline: { ...Styles.areaSeries, ...options.plotOptions?.areaspline },\n arearange: { ...Styles.areaSeries, ...options.plotOptions?.arearange },\n areasplinerange: { ...Styles.areaSeries, ...options.plotOptions?.areasplinerange },\n line: { ...Styles.lineSeries, ...options.plotOptions?.line },\n spline: { ...Styles.lineSeries, ...options.plotOptions?.spline },\n column: { ...Styles.columnSeries, ...options.plotOptions?.column },\n errorbar: { ...Styles.errorbarSeries, ...options.plotOptions?.errorbar },\n // Pie chart is shown in legend by default, that is required for standalone pie charts.\n pie: {\n showInLegend: true,\n ...Styles.pieSeries,\n ...options.plotOptions?.pie,\n dataLabels: { ...Styles.pieSeriesDataLabels, ...options.plotOptions?.pie?.dataLabels },\n },\n },\n // We don't use Highcharts tooltip, but certain tooltip options such as tooltip.snap or tooltip.shared\n // affect the hovering behavior of Highcharts. That is only the case when the tooltip is not disabled,\n // so we render it, but hide with styles.\n tooltip: options.tooltip ?? { enabled: true, snap: Styles.tooltipSnap, style: { opacity: 0 } },\n };\n\n const legendProps = getLegendsProps(options, legendOptions);\n\n return (\n <div {...rootProps}>\n <ChartContainer\n {...containerProps}\n chart={(height) => {\n // We declare event handlers here to ensure that no event fires until the chart is initialized.\n const highchartsOptions: Highcharts.Options = {\n ...options,\n chart: {\n ...options.chart,\n // Use height computed from chartHeight, chartMinHeight, and fitHeight settings by default.\n // It is possible to override it by explicitly providing chart.height, but this will not be\n // compatible with any of the above settings.\n height: options.chart?.height ?? height,\n // We override certain chart events to inject additional behaviors, but it is still possible to define\n // custom callbacks. The Cloudscape behaviors can be disabled or altered via components API. For instance,\n // if no-data props are not provided - the related on-render computations will be skipped.\n events: {\n ...options.chart?.events,\n load(event) {\n apiOptions.onChartLoad.call(this, event);\n return options.chart?.events?.load?.call(this, event);\n },\n render(event) {\n apiOptions.onChartRender.call(this, event);\n return options.chart?.events?.render?.call(this, event);\n },\n click(event) {\n apiOptions.onChartClick.call(this, event);\n return options.chart?.events?.click?.call(this, event);\n },\n },\n },\n plotOptions: {\n ...options.plotOptions,\n series: {\n ...options.plotOptions?.series,\n // We override certain point events to inject additional behaviors, but it is still possible to define\n // custom callbacks. The Cloudscape behaviors can be disabled or altered via components API.\n point: {\n ...options.plotOptions?.series?.point,\n events: {\n ...options.plotOptions?.series?.point?.events,\n mouseOver(event) {\n apiOptions.onSeriesPointMouseOver.call(this, event);\n return options.plotOptions?.series?.point?.events?.mouseOver?.call(this, event);\n },\n mouseOut(event) {\n apiOptions.onSeriesPointMouseOut.call(this, event);\n return options.plotOptions?.series?.point?.events?.mouseOut?.call(this, event);\n },\n click(event) {\n apiOptions.onSeriesPointClick.call(this, event);\n return options.plotOptions?.series?.point?.events?.click?.call(this, event);\n },\n },\n },\n },\n },\n };\n return (\n <>\n <ChartApplication api={api} keyboardNavigation={keyboardNavigation} ariaLabel={ariaLabel} />\n <HighchartsReact\n highcharts={highcharts}\n options={highchartsOptions}\n callback={(chart: Highcharts.Chart) =>\n callback?.({ chart, highcharts: highcharts as typeof Highcharts, ...api.publicApi })\n }\n />\n </>\n );\n }}\n navigator={navigator}\n primaryLegend={\n context.legendEnabled && legendProps.primary ? (\n <ChartLegend {...commonLegendProps} {...legendProps.primary} className={testClasses[\"legend-primary\"]} />\n ) : null\n }\n secondaryLegend={\n context.legendEnabled && legendProps.secondary ? (\n <ChartLegend\n {...commonLegendProps}\n {...legendProps.secondary}\n className={testClasses[\"legend-secondary\"]}\n />\n ) : null\n }\n verticalAxisTitle={\n verticalAxisTitlePlacement === \"top\" ? <VerticalAxisTitle api={api} inverted={!!inverted} /> : null\n }\n header={header?.content ? <ChartHeader>{header.content}</ChartHeader> : null}\n footer={footer?.content ? <ChartFooter>{footer.content}</ChartFooter> : null}\n filter={\n filter?.seriesFilter || filter?.additionalFilters ? (\n <ChartFilters\n api={api}\n seriesFilter={filter?.seriesFilter}\n additionalFilters={filter?.additionalFilters}\n i18nStrings={i18nStrings}\n />\n ) : null\n }\n noData={context.noDataEnabled && <ChartNoData {...noDataOptions} i18nStrings={i18nStrings} api={api} />}\n />\n\n {context.tooltipEnabled && (\n <ChartTooltip\n {...tooltipOptions}\n i18nStrings={i18nStrings}\n getTooltipContent={rest.getTooltipContent}\n sizeAxis={castArray(rest.sizeAxis as CoreChartProps.SizeAxisOptions[])}\n api={api}\n />\n )}\n </div>\n );\n}\n\nfunction xAxisClassName(inverted: boolean, customClassName?: string) {\n return clsx(\n testClasses[\"axis-x\"],\n inverted ? testClasses[\"axis-vertical\"] : testClasses[\"axis-horizontal\"],\n customClassName,\n );\n}\n\nfunction yAxisClassName(inverted: boolean, customClassName?: string, axisId?: string) {\n return clsx(\n testClasses[\"axis-y\"],\n inverted ? testClasses[\"axis-horizontal\"] : testClasses[\"axis-vertical\"],\n customClassName,\n axisId && `awsui-axis-${axisId}`,\n );\n}\n\n// When placing vertical axis title in the chart's top, the actual axis title rendered by Highcharts\n// needs to be visually hidden (it is still accessible by screen-readers). We then set title's\n// opacity to 0, and use reserveSpace=false, so that Highcharts stretches the plot area to all available\n// container width.\nfunction axisTitle<O extends Highcharts.XAxisTitleOptions | Highcharts.YAxisTitleOptions>(\n options: O,\n visible: boolean,\n): O {\n return {\n style: { ...Styles.axisTitleCss, opacity: visible ? undefined : 0 },\n reserveSpace: visible ? undefined : false,\n ...options,\n };\n}\n\n// We use custom formatters instead of Highcharts defaults to ensure consistent formatting\n// between axis ticks and tooltip contents.\nfunction axisLabels<O extends Highcharts.XAxisLabelsOptions | Highcharts.YAxisLabelsOptions>(options: O): O {\n return {\n style: Styles.axisLabelsCss,\n formatter: function () {\n const formattedValue = getFormatter(this.axis)(this.value);\n return formattedValue.replace(/\\n/g, \"<br />\");\n },\n ...options,\n };\n}\n\nfunction yAxisPlotLines(\n plotLineOptions: Highcharts.YAxisPlotLinesOptions[] = [],\n emphasizeBaseline: boolean,\n): Highcharts.YAxisPlotLinesOptions[] {\n return emphasizeBaseline\n ? [{ value: 0, ...Styles.chatPlotBaseline, className: testClasses[\"emphasized-baseline\"] }, ...plotLineOptions]\n : plotLineOptions;\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NonCancelableEventHandler } from "../../internal/events";
|
|
2
2
|
import { ChartAPI } from "../chart-api";
|
|
3
3
|
import { CoreChartProps, CoreI18nStrings } from "../interfaces";
|
|
4
|
-
export declare function ChartLegend({ api, title, actions, alignment, className, isSecondary, i18nStrings, onItemHighlight, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment, }: {
|
|
4
|
+
export declare function ChartLegend({ api, axisId, title, actions, alignment, className, isSecondary, i18nStrings, onItemHighlight, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment, }: {
|
|
5
5
|
api: ChartAPI;
|
|
6
|
+
axisId?: string;
|
|
6
7
|
title?: string;
|
|
7
8
|
className?: string;
|
|
8
9
|
isSecondary: boolean;
|
|
@@ -5,7 +5,7 @@ import { useInternalI18n } from "@cloudscape-design/components/internal/do-not-u
|
|
|
5
5
|
import { ChartLegend as ChartLegendComponent } from "../../internal/components/chart-legend";
|
|
6
6
|
import { fireNonCancelableEvent } from "../../internal/events";
|
|
7
7
|
import { useSelector } from "../../internal/utils/async-store";
|
|
8
|
-
export function ChartLegend({ api, title, actions, alignment, className, isSecondary, i18nStrings, onItemHighlight, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment = "start", }) {
|
|
8
|
+
export function ChartLegend({ api, axisId, title, actions, alignment, className, isSecondary, i18nStrings, onItemHighlight, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment = "start", }) {
|
|
9
9
|
const i18n = useInternalI18n("[charts]");
|
|
10
10
|
const legendAriaLabel = i18n("i18nStrings.legendAriaLabel", i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.legendAriaLabel);
|
|
11
11
|
// There's currently no builtin property for the secondary ARIA
|
|
@@ -43,7 +43,7 @@ export function ChartLegend({ api, title, actions, alignment, className, isSecon
|
|
|
43
43
|
if (filteredItems.length === 0) {
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
return (_jsx(ChartLegendComponent, { ariaLabel: ariaLabel, className: className, legendTitle: title, items: filteredItems, someHighlighted: someHighlighted, horizontalAlignment: horizontalAlignment, enableHorizontalScroll: enableHorizontalScroll, actions: actions, alignment: alignment, onToggleItem: onToggleItem, onSelectItem: onSelectItem, onItemHighlightExit: api.onClearChartItemsHighlight, onItemHighlightEnter: (item) => {
|
|
46
|
+
return (_jsx(ChartLegendComponent, { axisId: axisId, ariaLabel: ariaLabel, className: className, legendTitle: title, items: filteredItems, someHighlighted: someHighlighted, horizontalAlignment: horizontalAlignment, enableHorizontalScroll: enableHorizontalScroll, actions: actions, alignment: alignment, onToggleItem: onToggleItem, onSelectItem: onSelectItem, onItemHighlightExit: api.onClearChartItemsHighlight, onItemHighlightEnter: (item) => {
|
|
47
47
|
api.onHighlightChartItems([item.id]);
|
|
48
48
|
fireNonCancelableEvent(onItemHighlight, { item });
|
|
49
49
|
}, getTooltipContent: (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-legend.js","sourceRoot":"","sources":["../../../../src/core/components/core-legend.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAA6B,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAI/D,MAAM,UAAU,WAAW,CAAC,EAC1B,GAAG,EACH,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"core-legend.js","sourceRoot":"","sources":["../../../../src/core/components/core-legend.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAEzF,OAAO,EAAE,WAAW,IAAI,oBAAoB,E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// SPDX-License-Identifier: Apache-2.0\n\nimport { useInternalI18n } from \"@cloudscape-design/components/internal/do-not-use/i18n\";\n\nimport { ChartLegend as ChartLegendComponent } from \"../../internal/components/chart-legend\";\nimport { fireNonCancelableEvent, NonCancelableEventHandler } from \"../../internal/events\";\nimport { useSelector } from \"../../internal/utils/async-store\";\nimport { ChartAPI } from \"../chart-api\";\nimport { CoreChartProps, CoreI18nStrings } from \"../interfaces\";\n\nexport function ChartLegend({\n api,\n axisId,\n title,\n actions,\n alignment,\n className,\n isSecondary,\n i18nStrings,\n onItemHighlight,\n getLegendTooltipContent,\n enableHorizontalScroll,\n horizontalAlignment = \"start\",\n}: {\n api: ChartAPI;\n axisId?: string;\n title?: string;\n className?: string;\n isSecondary: boolean;\n actions?: React.ReactNode;\n enableHorizontalScroll?: boolean;\n alignment: \"horizontal\" | \"vertical\";\n horizontalAlignment?: \"start\" | \"center\" | \"end\";\n i18nStrings?: CoreI18nStrings;\n onItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n}) {\n const i18n = useInternalI18n(\"[charts]\");\n const legendAriaLabel = i18n(\"i18nStrings.legendAriaLabel\", i18nStrings?.legendAriaLabel);\n // There's currently no builtin property for the secondary ARIA\n // label, it must be explicitly provided by the consumers.\n const secondaryLegendAriaLabel = i18nStrings?.secondaryLegendAriaLabel;\n const ariaLabel = isSecondary ? secondaryLegendAriaLabel : legendAriaLabel;\n\n const legendItems = useSelector(api.legendStore, (s) => s.items);\n const someHighlighted = legendItems.some((item) => item.highlighted);\n const isChartTooltipPinned = useSelector(api.tooltipStore, (s) => s.pinned);\n const filteredItems = isSecondary\n ? legendItems.filter((item) => item.isSecondary)\n : legendItems.filter((item) => !item.isSecondary);\n\n const onToggleItem = (itemId: string) => {\n const visibleItems = legendItems.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.includes(itemId)) {\n api.onItemVisibilityChange(\n visibleItems.filter((visibleItemId) => visibleItemId !== itemId),\n { interactionType: \"toggle\", targetItemId: itemId },\n );\n } else {\n api.onItemVisibilityChange([...visibleItems, itemId], { interactionType: \"toggle\", targetItemId: itemId });\n }\n // Needed for touch devices.\n api.onClearChartItemsHighlight();\n };\n\n const onSelectItem = (itemId: string) => {\n const visibleItems = legendItems.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.length === 1 && visibleItems[0] === itemId) {\n api.onItemVisibilityChange(\n legendItems.map((i) => i.id),\n { interactionType: \"select\", targetItemId: itemId },\n );\n } else {\n api.onItemVisibilityChange([itemId], { interactionType: \"select\", targetItemId: itemId });\n }\n // Needed for touch devices.\n api.onClearChartItemsHighlight();\n };\n\n if (filteredItems.length === 0) {\n return null;\n }\n return (\n <ChartLegendComponent\n axisId={axisId}\n ariaLabel={ariaLabel}\n className={className}\n legendTitle={title}\n items={filteredItems}\n someHighlighted={someHighlighted}\n horizontalAlignment={horizontalAlignment}\n enableHorizontalScroll={enableHorizontalScroll}\n actions={actions}\n alignment={alignment}\n onToggleItem={onToggleItem}\n onSelectItem={onSelectItem}\n onItemHighlightExit={api.onClearChartItemsHighlight}\n onItemHighlightEnter={(item) => {\n api.onHighlightChartItems([item.id]);\n fireNonCancelableEvent(onItemHighlight, { item });\n }}\n getTooltipContent={(props) => {\n if (isChartTooltipPinned) {\n return null;\n }\n return getLegendTooltipContent?.(props) ?? null;\n }}\n />\n );\n}\n"]}
|
package/core/interfaces.d.ts
CHANGED
|
@@ -213,7 +213,7 @@ export interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions,
|
|
|
213
213
|
data: readonly RangeDataItemOptions[];
|
|
214
214
|
linkedTo: string;
|
|
215
215
|
}
|
|
216
|
-
export interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {
|
|
216
|
+
export interface XThresholdSeriesOptions extends Omit<BaseCartesianLineLikeOptions, "yAxis"> {
|
|
217
217
|
type: "x-threshold";
|
|
218
218
|
value: number;
|
|
219
219
|
}
|
|
@@ -255,7 +255,9 @@ interface BaseSeriesOptions {
|
|
|
255
255
|
name: string;
|
|
256
256
|
color?: string;
|
|
257
257
|
}
|
|
258
|
-
|
|
258
|
+
interface BaseCartesianSeriesOptions extends BaseSeriesOptions {
|
|
259
|
+
yAxis?: string;
|
|
260
|
+
}
|
|
259
261
|
export interface LinkableSeries {
|
|
260
262
|
/**
|
|
261
263
|
* Links this series to another series by ID, or `":previous"` for the immediately preceding series.
|
package/core/interfaces.js.map
CHANGED
|
@@ -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, LinkableSeries {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface BubbleSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"bubble\";\n sizeAxis?: string;\n data: readonly SizePointDataItemOptions[];\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 SizePointDataItemOptions {\n x?: number;\n y: number | null;\n size: number;\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\nexport interface LinkableSeries {\n /**\n * Links this series to another series by ID, or `\":previous\"` for the immediately preceding series.\n * A linked series does not appear as a separate item in the legend or series filter, and its visibility\n * follows the series it is linked to. It still renders in the chart and appears as a separate row in the tooltip.\n *\n * Use this to attach projected, forecast, or supplementary series to a primary series without cluttering the legend.\n */\n linkedTo?: string;\n}\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 sizeAxis?: CoreChartProps.SizeAxisOptions | readonly CoreChartProps.SizeAxisOptions[];\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 SizeAxisOptions {\n id?: string;\n title: string;\n valueFormatter?: (value: null | number) => string;\n }\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 * When set to true, enables horizontal scrolling for legend items with long text.\n * By default, long text is truncated with ellipsis.\n */\n enableHorizontalScroll?: boolean;\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 enableHorizontalScroll?: boolean;\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, LinkableSeries {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions, LinkableSeries {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface BubbleSeriesOptions extends BaseCartesianSeriesOptions, LinkableSeries {\n type: \"bubble\";\n sizeAxis?: string;\n data: readonly SizePointDataItemOptions[];\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\n// X-threshold series render as vertical plot lines spanning the full chart height,\n// so they are not associated with a specific y-axis and omit yAxis.\nexport interface XThresholdSeriesOptions extends Omit<BaseCartesianLineLikeOptions, \"yAxis\"> {\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 SizePointDataItemOptions {\n x?: number;\n y: number | null;\n size: number;\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\ninterface BaseCartesianSeriesOptions extends BaseSeriesOptions {\n yAxis?: string;\n}\n\nexport interface LinkableSeries {\n /**\n * Links this series to another series by ID, or `\":previous\"` for the immediately preceding series.\n * A linked series does not appear as a separate item in the legend or series filter, and its visibility\n * follows the series it is linked to. It still renders in the chart and appears as a separate row in the tooltip.\n *\n * Use this to attach projected, forecast, or supplementary series to a primary series without cluttering the legend.\n */\n linkedTo?: string;\n}\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 sizeAxis?: CoreChartProps.SizeAxisOptions | readonly CoreChartProps.SizeAxisOptions[];\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 SizeAxisOptions {\n id?: string;\n title: string;\n valueFormatter?: (value: null | number) => string;\n }\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 * When set to true, enables horizontal scrolling for legend items with long text.\n * By default, long text is truncated with ellipsis.\n */\n enableHorizontalScroll?: boolean;\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 enableHorizontalScroll?: boolean;\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"]}
|
package/core/utils.d.ts
CHANGED
|
@@ -59,10 +59,13 @@ export type LegendItemOptions = Highcharts.SeriesOptionsType | Highcharts.PointO
|
|
|
59
59
|
export declare function getVisibleLegendItems(options: Highcharts.Options): {
|
|
60
60
|
primaryItems: LegendItemOptions[];
|
|
61
61
|
secondaryItems: LegendItemOptions[];
|
|
62
|
+
primaryAxisId: string | undefined;
|
|
63
|
+
secondaryAxisId: string | undefined;
|
|
62
64
|
};
|
|
63
65
|
export declare function getLegendsProps(options: CoreChartProps.ChartOptions, legendOptions: CoreChartProps.LegendOptions | undefined): {
|
|
64
66
|
primary: {
|
|
65
67
|
readonly isSecondary: false;
|
|
68
|
+
readonly axisId: string | undefined;
|
|
66
69
|
readonly title: string | undefined;
|
|
67
70
|
readonly actions: import("react").ReactNode;
|
|
68
71
|
readonly alignment: "horizontal" | "vertical";
|
|
@@ -71,6 +74,7 @@ export declare function getLegendsProps(options: CoreChartProps.ChartOptions, le
|
|
|
71
74
|
} | undefined;
|
|
72
75
|
secondary: {
|
|
73
76
|
readonly isSecondary: true;
|
|
77
|
+
readonly axisId: string | undefined;
|
|
74
78
|
readonly title: string | undefined;
|
|
75
79
|
readonly actions: import("react").ReactNode;
|
|
76
80
|
readonly alignment: "horizontal" | "vertical";
|
package/core/utils.js
CHANGED
|
@@ -163,6 +163,8 @@ export function getVisibleLegendItems(options) {
|
|
|
163
163
|
const isInverted = (_b = (_a = options.chart) === null || _a === void 0 ? void 0 : _a.inverted) !== null && _b !== void 0 ? _b : false;
|
|
164
164
|
const valueAxes = (_c = (isInverted ? castArray(options.xAxis) : castArray(options.yAxis))) !== null && _c !== void 0 ? _c : [];
|
|
165
165
|
const defaultOpposite = valueAxes.length > 0 ? ((_d = valueAxes[0].opposite) !== null && _d !== void 0 ? _d : false) : false;
|
|
166
|
+
const primaryAxis = valueAxes.find((a) => { var _a; return !((_a = a.opposite) !== null && _a !== void 0 ? _a : false); });
|
|
167
|
+
const secondaryAxis = valueAxes.find((a) => a.opposite === true);
|
|
166
168
|
const primaryItems = [];
|
|
167
169
|
const secondaryItems = [];
|
|
168
170
|
const addLegendItem = (item) => {
|
|
@@ -193,7 +195,7 @@ export function getVisibleLegendItems(options) {
|
|
|
193
195
|
addLegendItem(series);
|
|
194
196
|
}
|
|
195
197
|
});
|
|
196
|
-
return { primaryItems, secondaryItems };
|
|
198
|
+
return { primaryItems, secondaryItems, primaryAxisId: primaryAxis === null || primaryAxis === void 0 ? void 0 : primaryAxis.id, secondaryAxisId: secondaryAxis === null || secondaryAxis === void 0 ? void 0 : secondaryAxis.id };
|
|
197
199
|
}
|
|
198
200
|
function isSecondaryLegendItem(item, isInverted, defaultOpposite, valueAxes) {
|
|
199
201
|
var _a, _b, _c;
|
|
@@ -210,12 +212,13 @@ export function getLegendsProps(options, legendOptions) {
|
|
|
210
212
|
// While Highcharts supports more than two axes, this
|
|
211
213
|
// implementation supports at most two, in which case one
|
|
212
214
|
// of them must be set as opposite (secondary).
|
|
213
|
-
const { primaryItems, secondaryItems } = getVisibleLegendItems(options);
|
|
215
|
+
const { primaryItems, secondaryItems, primaryAxisId, secondaryAxisId } = getVisibleLegendItems(options);
|
|
214
216
|
return {
|
|
215
217
|
primary: primaryItems.length === 0
|
|
216
218
|
? undefined
|
|
217
219
|
: {
|
|
218
220
|
isSecondary: false,
|
|
221
|
+
axisId: primaryAxisId,
|
|
219
222
|
title: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.title,
|
|
220
223
|
actions: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.actions,
|
|
221
224
|
alignment: (legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.position) === "side" ? "vertical" : "horizontal",
|
|
@@ -226,6 +229,7 @@ export function getLegendsProps(options, legendOptions) {
|
|
|
226
229
|
? undefined
|
|
227
230
|
: {
|
|
228
231
|
isSecondary: true,
|
|
232
|
+
axisId: secondaryAxisId,
|
|
229
233
|
title: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.secondaryLegendTitle,
|
|
230
234
|
actions: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.secondaryLegendActions,
|
|
231
235
|
alignment: (legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.position) === "side" ? "vertical" : "horizontal",
|