@cloudscape-design/chart-components 1.0.62 → 1.0.64

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.
@@ -1,12 +1,13 @@
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, horizontalAlignment, }: {
4
+ export declare function ChartLegend({ api, title, actions, alignment, className, isSecondary, i18nStrings, onItemHighlight, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment, }: {
5
5
  api: ChartAPI;
6
6
  title?: string;
7
7
  className?: string;
8
8
  isSecondary: boolean;
9
9
  actions?: React.ReactNode;
10
+ enableHorizontalScroll?: boolean;
10
11
  alignment: "horizontal" | "vertical";
11
12
  horizontalAlignment?: "start" | "center" | "end";
12
13
  i18nStrings?: CoreI18nStrings;
@@ -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, horizontalAlignment = "start", }) {
8
+ export function ChartLegend({ api, 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, actions: actions, alignment: alignment, onToggleItem: onToggleItem, onSelectItem: onSelectItem, onItemHighlightExit: api.onClearChartItemsHighlight, onItemHighlightEnter: (item) => {
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) => {
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,mBAAmB,GAAG,OAAO,GAY9B;IACC,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,IAAI,CAAC,6BAA6B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,CAAC,CAAC;IAC1F,+DAA+D;IAC/D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AAE,eAAe,EAChC,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,GAAG,CAAC,0BAA0B,EACnD,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;YAC7B,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YACrC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC,EACD,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE;;YAC3B,IAAI,oBAAoB,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAC;QAClD,CAAC,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// 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 title,\n actions,\n alignment,\n className,\n isSecondary,\n i18nStrings,\n onItemHighlight,\n getLegendTooltipContent,\n horizontalAlignment = \"start\",\n}: {\n api: ChartAPI;\n title?: string;\n className?: string;\n isSecondary: boolean;\n actions?: React.ReactNode;\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 ariaLabel={ariaLabel}\n className={className}\n legendTitle={title}\n items={filteredItems}\n someHighlighted={someHighlighted}\n horizontalAlignment={horizontalAlignment}\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"]}
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,GAa9B;IACC,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,eAAe,GAAG,IAAI,CAAC,6BAA6B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,CAAC,CAAC;IAC1F,+DAA+D;IAC/D,0DAA0D;IAC1D,MAAM,wBAAwB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,wBAAwB,CAAC;IACvE,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,eAAe,CAAC;IAE3E,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjE,M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,EAAE,CAAC,CAAC,CAAC;YACrC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC,EACD,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE;;YAC3B,IAAI,oBAAoB,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAC;QAClD,CAAC,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// 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 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 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 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"]}
@@ -393,6 +393,11 @@ export declare namespace CoreChartProps {
393
393
  * This property only applies when there are secondary items.
394
394
  */
395
395
  secondaryLegendActions?: React.ReactNode;
396
+ /**
397
+ * When set to true, enables horizontal scrolling for legend items with long text.
398
+ * By default, long text is truncated with ellipsis.
399
+ */
400
+ enableHorizontalScroll?: boolean;
396
401
  /**
397
402
  * This property only applies when there are no secondary items and `position="bottom"`.
398
403
  */
@@ -478,6 +483,7 @@ export interface CoreLegendProps {
478
483
  ariaLabel?: string;
479
484
  actions?: React.ReactNode;
480
485
  alignment?: "horizontal" | "vertical";
486
+ enableHorizontalScroll?: boolean;
481
487
  horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;
482
488
  onClearHighlight?: NonCancelableEventHandler;
483
489
  onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * This property only applies when there are no secondary items and `position=\"bottom\"`.\n */\n horizontalAlignment?: LegendOptionsHorizontalAlignment;\n }\n\n export type LegendOptionsHorizontalAlignment = \"start\" | \"center\";\n\n export type LegendItem = InternalComponentTypes.LegendItem;\n export type LegendTooltipContent = InternalComponentTypes.LegendTooltipContent;\n export type GetLegendTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export type GetLegendTooltipContentProps = InternalComponentTypes.GetLegendTooltipContentProps;\n\n export interface TooltipOptions {\n enabled?: boolean;\n placement?: \"middle\" | \"outside\" | \"target\";\n size?: \"small\" | \"medium\" | \"large\";\n debounce?: number | boolean;\n seriesSorting?: \"as-added\" | \"by-value-desc\";\n }\n\n export type GetTooltipContent = (props: GetTooltipContentProps) => TooltipContentRenderer;\n export interface GetTooltipContentProps {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n }\n export interface TooltipContentRenderer {\n point?: (props: TooltipPointProps) => TooltipPointFormatted;\n details?: (props: TooltipDetailsProps) => readonly TooltipDetail[];\n header?: (props: TooltipSlotProps) => React.ReactNode;\n body?: (props: TooltipSlotProps) => React.ReactNode;\n footer?: (props: TooltipSlotProps) => React.ReactNode;\n }\n export type TooltipPointFormatted = BaseTooltipPointFormatted;\n export interface TooltipContentItem {\n point: Highcharts.Point;\n errorRanges: Highcharts.Point[];\n }\n export interface TooltipPointProps {\n item: TooltipContentItem;\n hideTooltip: () => void;\n }\n export interface TooltipSlotProps {\n x: number;\n items: TooltipContentItem[];\n hideTooltip: () => void;\n }\n\n export interface TooltipDetailsProps {\n point: Highcharts.Point;\n hideTooltip: () => void;\n }\n\n export type TooltipDetail = BaseTooltipDetail;\n\n export interface LegendItemHighlightDetail {\n item: LegendItem;\n }\n\n export interface ApiInteraction {\n interactionType: \"api\";\n }\n export interface FilterInteraction {\n interactionType: \"filter\";\n }\n export interface ToggleInteraction {\n interactionType: \"toggle\";\n targetItemId: string;\n }\n export interface SelectInteraction {\n interactionType: \"select\";\n targetItemId: string;\n }\n\n export type InteractionKind = ApiInteraction | FilterInteraction | ToggleInteraction | SelectInteraction;\n\n export type VisibleItemsChangeDetail = { items: readonly LegendItem[] } & InteractionKind;\n\n export interface HighlightChangeDetail {\n point: null | Highcharts.Point;\n group: readonly Highcharts.Point[];\n isApiCall: boolean;\n }\n export interface HighlightClearDetail {\n isApiCall: boolean;\n }\n\n export type I18nStrings = CartesianI18nStrings & PieI18nStrings & CoreI18nStrings;\n}\n\nexport interface CoreLegendProps {\n items: readonly CoreLegendProps.Item[];\n title?: string;\n ariaLabel?: string;\n actions?: React.ReactNode;\n alignment?: \"horizontal\" | \"vertical\";\n horizontalAlignment?: CoreChartProps.LegendOptionsHorizontalAlignment;\n onClearHighlight?: NonCancelableEventHandler;\n onItemHighlight?: NonCancelableEventHandler<CoreLegendProps.ItemHighlightDetail>;\n onVisibleItemsChange?: NonCancelableEventHandler<CoreLegendProps.VisibleItemsChangeDetail>;\n getLegendTooltipContent?: CoreLegendProps.GetTooltipContent;\n}\n\nexport namespace CoreLegendProps {\n export type Item = InternalComponentTypes.LegendItem;\n export type GetTooltipContent = InternalComponentTypes.GetLegendTooltipContent;\n export interface ItemHighlightDetail {\n item: Item;\n }\n export type VisibleItemsChangeDetail = { items: readonly string[] } & (\n | CoreChartProps.ToggleInteraction\n | CoreChartProps.SelectInteraction\n );\n}\n\n// Utility types\n\nexport interface Rect {\n x: number;\n y: number;\n height: number;\n width: number;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport type * as InternalComponentTypes from \"../internal/components/interfaces\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { type NonCancelableEventHandler } from \"../internal/events\";\n\n// All charts take `highcharts` instance, that can be served statically or dynamically.\n// Although it has to be of type Highcharts, the TS type we use is `null | object`, so\n// that it is ignored by the documenter.\n\n/**\n * This interface includes common public chart properties, applicable for all chart types.\n */\nexport interface BaseChartOptions {\n /**\n * The Highcharts instance, which can be obtained using `import Highcharts from \"highcharts\"`.\n * Supported Highcharts versions: 12.\n */\n highcharts: null | object;\n\n /**\n * Custom content that renders when `highcharts=null`. It renders a spinner if not defined.\n */\n fallback?: React.ReactNode;\n\n /**\n * The height of the chart plot in pixels. It does not include legend and filter.\n */\n chartHeight?: number;\n\n /**\n * The chart automatically adjusts its height to fill the parent container when this property is set.\n */\n fitHeight?: boolean;\n\n /**\n * Defines the minimum allowed height of the chart plot. Use this when `fitHeight=true` to\n * prevent the chart plot from becoming too small to display its content. When the parent\n * container is shorter than the minimum height, a vertical scrollbar appears automatically.\n */\n chartMinHeight?: number;\n\n /**\n * Defines the minimum allowed width of the chart plot. When the parent container is narrower than the\n * minimum width, the horizontal scrollbar is automatically added.\n */\n chartMinWidth?: number;\n\n /**\n * Defines the ARIA label for the chart container.\n * This property corresponds to [lang.chartContainerLabel](https://api.highcharts.com/highcharts/lang.accessibility.chartContainerLabel),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaLabel?: string;\n\n /**\n * Defines the ARIA description of the chart container.\n * This property corresponds to [accessibility.description](https://api.highcharts.com/highcharts/accessibility.description),\n * and requires the [accessibility module](https://www.highcharts.com/docs/accessibility/accessibility-module).\n */\n ariaDescription?: string;\n\n /**\n * Defines chart legend options, including:\n * * `enabled` (optional, boolean) - Hides legend when set to `false`.\n * * `title` (optional, string) - Visible label, shown above the legend.\n * * `actions` (optional, slot) - A slot before the legend that can be used to render custom actions.\n */\n legend?: BaseLegendOptions;\n\n /**\n * Defines options to represent empty, no-match, loading, and error state of the chart, including:\n * * `statusType` (optional, \"finished\" | \"loading\" | \"error\") - Specifies the current status of loading data.\n * * `empty` (optional, ReactNode) - Content displayed when the chart data is empty.\n * * `noMatch` (optional, ReactNode) - Content displayed when there is no data to display due to the built-in filtering.\n * * `loading` (optional, ReactNode) - Content displayed when `statusType=\"loading\"`. If omitted, the default loading state\n * is shown, using `i18n.loadingText` or built-in i18n.\n * * `error` (optional, ReactNode) - Content displayed when `statusType=\"error\"`. If omitted, the default error state\n * is shown, using `i18n.errorText` and `i18n.recoveryText` (when `onRecoveryClick` is provided), or built-in i18n.\n * * `onRecoveryClick` (optional, function) - Called when the user clicks the recovery button that appears when using default error\n * state, and only if `onRecoveryClick` is provided. Use this to enable the user to retry a failed request or provide another option\n * for the user to recover from the error.\n */\n noData?: BaseNoDataOptions;\n\n /**\n * Defines options for filtering in the chart, including:\n * * `seriesFilter` (optional, boolean) - Displays default series filter at the top of the chart.\n * * `additionalFilters` (optional, slot) - A slot for custom chart filters at the top of the chart.\n */\n filter?: BaseFilterOptions;\n}\n\nexport interface BaseLegendOptions {\n enabled?: boolean;\n title?: string;\n actions?: React.ReactNode;\n}\n\nexport interface BaseNoDataOptions {\n statusType?: \"finished\" | \"loading\" | \"error\";\n empty?: React.ReactNode;\n error?: React.ReactNode;\n loading?: React.ReactNode;\n noMatch?: React.ReactNode;\n onRecoveryClick?: NonCancelableEventHandler;\n}\n\nexport interface BaseTooltipDetail {\n key: React.ReactNode;\n value: React.ReactNode;\n}\n\nexport interface BaseI18nStrings {\n loadingText?: string;\n errorText?: string;\n recoveryText?: string;\n seriesFilterLabel?: string;\n seriesFilterPlaceholder?: string;\n seriesFilterSelectedAriaLabel?: string;\n legendAriaLabel?: string;\n detailPopoverDismissAriaLabel?: string;\n chartRoleDescription?: string;\n}\n\nexport interface CoreI18nStrings extends BaseI18nStrings {\n /**\n * ARIA label for the secondary legend when using dual axes charts.\n *\n * **Important**: When using dual axes, you should explicitly provide visible titles or ARIA labels\n * for both the primary and secondary legends to ensure proper accessibility. The primary legend\n * has built-in i18n support through `legendAriaLabel`, but the secondary legend currently requires\n * this property to be explicitly provided.\n */\n secondaryLegendAriaLabel?: string;\n\n /**\n * ARIA label for the marker of a series. Series with status \"default\" will not announce a label, thus excluded by this method.\n */\n itemMarkerStatusAriaLabel?: (status: Exclude<ChartSeriesMarkerStatus, \"default\">) => string;\n}\n\nexport interface WithCartesianI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `xAxisRoleDescription` (optional, string) - Accessible role description of the x axis, e.g. \"x axis\".\n * * `yAxisRoleDescription` (optional, string) - Accessible role description of the y axis, e.g. \"y axis\".\n */\n i18nStrings?: CartesianI18nStrings;\n}\n\nexport interface WithPieI18nStrings {\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n *\n * Available properties:\n * * `loadingText` (optional, string) - Text, displayed when the chart is loading, i.e. when `noData.statusType` is set to \"loading\".\n * * `errorText` (optional, string) - Text, displayed when the chart is in error state, i.e. when `noData.statusType` is set to \"error\".\n * * `recoveryText` (optional, string) - Text for the recovery button, displayed next to the error text.\n * * `seriesFilterLabel` (optional, string) - Text for the visible label of the default series filter.\n * * `seriesFilterPlaceholder` (optional, string) - Text for the default series filter placeholder.\n * * `seriesFilterSelectedAriaLabel` (optional, string) - ARIA label of the default series filter which is appended to any option that is selected.\n * * `legendAriaLabel` (optional, string) - ARIA label that is associated with the legend in case there is no visible `legend.title` defined.\n * * `detailPopoverDismissAriaLabel` (optional, string) - ARIA label for the details popover dismiss button.\n * * `chartRoleDescription` (optional, string) - Accessible role description of the chart plot area, e.g. \"interactive chart\".\n * * `segmentRoleDescription` (optional, string) - Accessible role description of the segment.\n */\n i18nStrings?: PieI18nStrings;\n}\n\nexport interface CartesianI18nStrings extends BaseI18nStrings {\n xAxisRoleDescription?: string;\n yAxisRoleDescription?: string;\n}\n\nexport interface PieI18nStrings extends BaseI18nStrings {\n segmentRoleDescription?: string;\n}\n\nexport interface BaseFilterOptions {\n seriesFilter?: boolean;\n additionalFilters?: React.ReactNode;\n}\n\nexport interface BaseTooltipPointFormatted {\n key?: React.ReactNode;\n value?: React.ReactNode;\n description?: React.ReactNode;\n expandable?: boolean;\n subItems?: ReadonlyArray<{ key: React.ReactNode; value: React.ReactNode }>;\n}\n\nexport interface AreaSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"area\";\n data: readonly PointDataItemType[];\n}\n\nexport interface AreaSplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"areaspline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ColumnSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"column\";\n data: readonly PointDataItemType[];\n}\n\nexport interface LineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"line\";\n data: readonly PointDataItemType[];\n}\n\nexport interface SplineSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"spline\";\n data: readonly PointDataItemType[];\n}\n\nexport interface ScatterSeriesOptions extends BaseCartesianSeriesOptions {\n type: \"scatter\";\n data: readonly PointDataItemType[];\n marker?: PointMarkerOptions;\n}\n\nexport interface ErrorBarSeriesOptions extends Omit<BaseCartesianSeriesOptions, \"name\"> {\n type: \"errorbar\";\n name?: string;\n data: readonly RangeDataItemOptions[];\n linkedTo: string;\n}\n\nexport interface XThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"x-threshold\";\n value: number;\n}\n\nexport interface YThresholdSeriesOptions extends BaseCartesianLineLikeOptions {\n type: \"y-threshold\";\n value: number;\n}\n\nexport interface PieSeriesOptions extends BaseSeriesOptions {\n type: \"pie\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface DonutSeriesOptions extends BaseSeriesOptions {\n type: \"donut\";\n data: readonly PieSegmentOptions[];\n}\n\nexport interface PieSegmentOptions {\n y: number | null;\n id?: string;\n name: string;\n color?: string;\n}\n\nexport type PointDataItemType = null | number | PointDataItemOptions;\n\nexport interface PointDataItemOptions {\n x?: number;\n y: number | null;\n}\n\nexport interface RangeDataItemOptions {\n x?: number;\n low: number;\n high: number;\n}\n\ninterface BaseSeriesOptions {\n id?: string;\n name: string;\n color?: string;\n}\n\ntype BaseCartesianSeriesOptions = BaseSeriesOptions;\n\ninterface BaseCartesianLineLikeOptions extends BaseCartesianSeriesOptions {\n dashStyle?: Highcharts.DashStyleValue;\n}\n\n// The symbols union matches that of Highcharts.PointMarkerOptionsObject\ninterface PointMarkerOptions {\n symbol?: \"circle\" | \"diamond\" | \"square\" | \"triangle\" | \"triangle-down\";\n}\n\nexport interface CoreCartesianOptions {\n /**\n * When set to `true`, adds a visual emphasis on the zero baseline axis.\n */\n emphasizeBaseline?: boolean;\n /**\n * Controls the placement of the vertical axis title.\n * When set to \"side\", displays the title along the axis line.\n */\n verticalAxisTitlePlacement?: \"top\" | \"side\";\n}\n\nexport interface CoreChartProps\n extends\n Pick<\n BaseChartOptions,\n | \"highcharts\"\n | \"fallback\"\n | \"fitHeight\"\n | \"chartHeight\"\n | \"chartMinHeight\"\n | \"chartMinWidth\"\n | \"ariaLabel\"\n | \"ariaDescription\"\n | \"filter\"\n | \"noData\"\n >,\n CoreCartesianOptions {\n /**\n * The Highcharts options. Cloudscape injects custom styles and settings, but all can be\n * overridden with explicitly provided options. An exception is event handlers - those are\n * not overridden, but merged with Cloudscape event handlers so that both are getting called.\n */\n options: CoreChartProps.ChartOptions;\n /**\n * The Cloudscape tooltip, that comes with a vertical cursor when used on cartesian series.\n * The tooltip content is only shown when `getContent` property is defined, which is called\n * for each visited { x, y } point.\n */\n tooltip?: CoreChartProps.TooltipOptions;\n /**\n * A custom slot above the chart plot, chart's axis title, and filter.\n */\n header?: CoreChartProps.HeaderOptions;\n /**\n * Prop for passing a custom navigation control component to be rendered with the chart.\n * Use this property to add timeline navigation, range selectors, or other custom navigation elements.\n */\n navigator?: React.ReactNode;\n /**\n * A custom slot below the chart plot and legend.\n */\n footer?: CoreChartProps.FooterOptions;\n /**\n * Chart legend options.\n */\n legend?: CoreChartProps.LegendOptions;\n /**\n * The callback to init the chart's API when it is ready. The API includes the Highcharts chart object, and\n * additional Cloudscape methods.\n */\n callback?: (chart: CoreChartProps.ChartAPI) => void;\n /**\n * This is used to provide a test-utils selector. Do not use this property to provide custom styles.\n */\n className?: string;\n /**\n * IDs of visible series or points.\n */\n visibleItems?: readonly string[];\n /**\n * Called when a legend item is highlighted.\n */\n onLegendItemHighlight?: NonCancelableEventHandler<CoreChartProps.LegendItemHighlightDetail>;\n /**\n * Called when series/points visibility changes due to user interaction with legend or filter.\n */\n onVisibleItemsChange?: NonCancelableEventHandler<CoreChartProps.VisibleItemsChangeDetail>;\n /**\n * Called whenever chart tooltip is rendered to provide content for tooltip's header, body, and (optional) footer.\n */\n getTooltipContent?: CoreChartProps.GetTooltipContent;\n /**\n * Called whenever a legend item is hovered to provide content for legend tooltip's header, body, and (optional) footer.\n * If not provided, no tooltip will be displayed.\n */\n getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;\n /**\n * Called whenever chart point or group is highlighted.\n */\n onHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightChangeDetail>;\n /**\n * Called whenever chart point or group loses highlight.\n */\n onClearHighlight?: NonCancelableEventHandler<CoreChartProps.HighlightClearDetail>;\n /**\n * Use Cloudscape keyboard navigation.\n */\n keyboardNavigation?: boolean;\n /**\n * An object that contains all of the localized strings required by the component.\n * @i18n\n */\n i18nStrings?: CoreChartProps.I18nStrings;\n /**\n * Specifies the options for each item in the chart.\n */\n getItemOptions?: CoreChartProps.GetItemOptions;\n}\n\nexport namespace CoreChartProps {\n // The API methods allow programmatic triggering of chart's behaviors, some of which are not accessible via React state.\n // This enables advanced integration scenarios, such as building a custom legend, or making multiple charts synchronized.\n export interface ChartAPI {\n chart: Highcharts.Chart;\n highcharts: typeof Highcharts;\n highlightItems(itemIds: readonly string[]): void;\n setItemsVisible(itemIds: readonly string[]): void;\n highlightChartPoint(point: Highcharts.Point): void;\n highlightChartGroup(group: readonly Highcharts.Point[]): void;\n clearChartHighlight(): void;\n }\n\n /**\n * The item id. Can be the id of a series or a point.\n */\n export type GetItemOptions = (itemId: string) => CoreChartProps.ChartItemOptions;\n\n // The extended version of Highcharts.Options. The axes types are extended with Cloudscape value formatter.\n // We use a custom formatter because we cannot use the built-in Highcharts formatter for our tooltip.\n export type ChartOptions = Omit<Highcharts.Options, \"xAxis\" | \"yAxis\"> & {\n xAxis?: XAxisOptions | XAxisOptions[];\n yAxis?: YAxisOptions | YAxisOptions[];\n };\n export type XAxisOptions = Highcharts.XAxisOptions & { valueFormatter?: (value: null | number) => string };\n export type YAxisOptions = Highcharts.YAxisOptions & { valueFormatter?: (value: null | number) => string };\n\n export interface ChartItemOptions {\n /**\n * If specified, specifies the status of an item.\n * An item can be a point or a series.\n */\n status?: ChartSeriesMarkerStatus;\n }\n\n export interface HeaderOptions {\n content: React.ReactNode;\n }\n export interface FooterOptions {\n content: React.ReactNode;\n }\n\n export interface LegendOptions extends BaseLegendOptions {\n bottomMaxHeight?: number;\n position?: \"bottom\" | \"side\";\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendTitle?: string;\n /**\n * This property only applies when there are secondary items.\n */\n secondaryLegendActions?: React.ReactNode;\n /**\n * 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
@@ -56,6 +56,7 @@ export declare function getLegendsProps(options: CoreChartProps.ChartOptions, le
56
56
  readonly actions: import("react").ReactNode;
57
57
  readonly alignment: "horizontal" | "vertical";
58
58
  readonly horizontalAlignment: CoreChartProps.LegendOptionsHorizontalAlignment | undefined;
59
+ readonly enableHorizontalScroll: boolean | undefined;
59
60
  } | undefined;
60
61
  secondary: {
61
62
  readonly isSecondary: true;
@@ -63,6 +64,7 @@ export declare function getLegendsProps(options: CoreChartProps.ChartOptions, le
63
64
  readonly actions: import("react").ReactNode;
64
65
  readonly alignment: "horizontal" | "vertical";
65
66
  readonly horizontalAlignment: "end";
67
+ readonly enableHorizontalScroll: boolean | undefined;
66
68
  } | undefined;
67
69
  };
68
70
  export declare function getPointRect(point: Highcharts.Point): Rect;
package/core/utils.js CHANGED
@@ -210,6 +210,7 @@ export function getLegendsProps(options, legendOptions) {
210
210
  actions: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.actions,
211
211
  alignment: (legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.position) === "side" ? "vertical" : "horizontal",
212
212
  horizontalAlignment: secondaryItems.length === 0 ? legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.horizontalAlignment : "start",
213
+ enableHorizontalScroll: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.enableHorizontalScroll,
213
214
  },
214
215
  secondary: secondaryItems.length === 0
215
216
  ? undefined
@@ -219,6 +220,7 @@ export function getLegendsProps(options, legendOptions) {
219
220
  actions: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.secondaryLegendActions,
220
221
  alignment: (legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.position) === "side" ? "vertical" : "horizontal",
221
222
  horizontalAlignment: "end",
223
+ enableHorizontalScroll: legendOptions === null || legendOptions === void 0 ? void 0 : legendOptions.enableHorizontalScroll,
222
224
  },
223
225
  };
224
226
  }
package/core/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAMtC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAe5C,yHAAyH;AACzH,6HAA6H;AAC7H,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAuB;IAChD,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,OAAuC;;IAClE,OAAO,MAAA,MAAA,OAAO,CAAC,EAAE,mCAAI,OAAO,CAAC,IAAI,mCAAI,eAAe,EAAE,CAAC;AACzD,CAAC;AACD,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,OAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC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,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YAC3D,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB;QACH,CAAC,CAAC;YACE,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;YAC1B,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;AACR,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { ChartSeriesMarkerType } from \"../internal/components/series-marker\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { getChartSeries } from \"../internal/utils/chart-series\";\nimport { castArray } from \"../internal/utils/utils\";\nimport { getFormatter } from \"./formatters\";\nimport { ChartLabels } from \"./i18n-utils\";\nimport { CoreChartProps, Rect } from \"./interfaces\";\n\nexport interface LegendItemSpec {\n id: string;\n name: string;\n markerType: ChartSeriesMarkerType;\n color: string;\n visible: boolean;\n isSecondary: boolean;\n status?: ChartSeriesMarkerStatus;\n markerAriaLabel?: string;\n}\n\n// The below functions extract unique identifier from series, point, or options. The identifier can be item's ID or name.\n// We expect that items requiring referencing (e.g. in order to control their visibility) have the unique identifier defined.\n// Otherwise, we return a randomized id that is to ensure no accidental matches.\nexport function getSeriesId(series: Highcharts.Series): string {\n return getOptionsId(series.options);\n}\nexport function getPointId(point: Highcharts.Point): string {\n return getOptionsId(point.options);\n}\nexport function getOptionsId(options: { id?: string; name?: string }): string {\n return options.id ?? options.name ?? noIdPlaceholder();\n}\nfunction noIdPlaceholder(): string {\n const rand = (Math.random() * 1_000_000).toFixed(0).padStart(6, \"0\");\n return \"awsui-no-id-placeholder-\" + rand;\n}\n\n// There are more possible values that series.stacking can take, but we only explicitly support \"normal\".\nexport function isSeriesStacked(series: Highcharts.Series) {\n return (series.options as any).stacking === \"normal\";\n}\n\n// The threshold series are custom series, implemented as a combination of line series, and plot lines.\n// As Highcharts does not support custom series declaration, we annotate threshold series by using the\n// series.custom property. This is then used in our utilities to recognize threshold series, and retrieve\n// the associated threshold value.\ninterface ThresholdOptions<T extends \"x-threshold\" | \"y-threshold\"> {\n custom: {\n awsui: {\n type: T;\n threshold: number;\n };\n };\n}\nexport function createThresholdMetadata<T extends \"x-threshold\" | \"y-threshold\">(\n type: T,\n value: number,\n): ThresholdOptions<T> {\n return { custom: { awsui: { type, threshold: value } } };\n}\nexport function isXThreshold(\n s: Highcharts.Series,\n): s is Highcharts.Series & { options: ThresholdOptions<\"x-threshold\"> } {\n return typeof s.options.custom === \"object\" && s.options.custom.awsui?.type === \"x-threshold\";\n}\nexport function isYThreshold(\n s: Highcharts.Series,\n): s is Highcharts.Series & { options: ThresholdOptions<\"y-threshold\"> } {\n return typeof s.options.custom === \"object\" && s.options.custom.awsui?.type === \"y-threshold\";\n}\n\n// We check point.series explicitly because Highcharts can destroy point objects, replacing the\n// contents with { destroyed: true }, violating the point's TS contract.\n// See: https://github.com/highcharts/highcharts/issues/23175.\nexport function isPointVisible(point: Highcharts.Point) {\n return point.visible && point.series && point.series.visible;\n}\n\nexport function getSeriesMarkerType(series?: Highcharts.Series): ChartSeriesMarkerType {\n if (!series) {\n return \"large-square\";\n }\n const seriesSymbol = \"symbol\" in series && typeof series.symbol === \"string\" ? series.symbol : \"circle\";\n // In Highcharts, dashStyle supports different types of dashes: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/\n // Return a dashed legend symbol for all of these dashes, excluding the default \"Solid\" option\n if (\"dashStyle\" in series.options && series.options.dashStyle && series.options.dashStyle !== \"Solid\") {\n return \"dashed\";\n }\n switch (series.type) {\n case \"area\":\n case \"areaspline\":\n return \"hollow-square\";\n case \"line\":\n case \"spline\":\n return \"line\";\n case \"scatter\":\n switch (seriesSymbol) {\n case \"square\":\n return \"square\";\n case \"diamond\":\n return \"diamond\";\n case \"triangle\":\n return \"triangle\";\n case \"triangle-down\":\n return \"triangle-down\";\n case \"circle\":\n default:\n return \"circle\";\n }\n case \"column\":\n case \"pie\":\n return \"large-square\";\n case \"errorbar\":\n default:\n return \"large-square\";\n }\n}\n\n// Highcharts supports color objects to represent gradients and more, but we only support string\n// colors in our markers. In case a non-string color is defined, we use black color as as fallback.\nexport function getSeriesColor(series?: Highcharts.Series): string {\n return typeof series?.color === \"string\" ? series.color : \"black\";\n}\nexport function getPointColor(point?: Highcharts.Point): string {\n return typeof point?.color === \"string\" ? point.color : \"black\";\n}\n\n// The custom legend implementation does not rely on the Highcharts legend. When Highcharts legend is disabled,\n// the chart object does not include information on legend items. Instead, we collect series and pie segments\n// using this custom function, respecting Highcharts' showInLegend flag (defined for series only).\n\n// There exists a Highcharts APIs to access legend items, but it is unfortunately not available, when\n// Highcharts legend is disabled. Instead, we use this custom method to collect legend items from the chart.\nexport function getChartLegendItems({\n chart,\n getItemOptions = () => ({}),\n itemMarkerStatusAriaLabel,\n}: {\n chart: Highcharts.Chart;\n getItemOptions?: CoreChartProps.GetItemOptions;\n itemMarkerStatusAriaLabel?: ChartLabels[\"itemMarkerLabel\"];\n}): readonly LegendItemSpec[] {\n const legendItems: LegendItemSpec[] = [];\n const isInverted = chart.inverted ?? false;\n const addSeriesItem = (series: Highcharts.Series, isSecondary: boolean) => {\n // The pie series is not shown in the legend. Instead, we show pie segments.\n if (series.type === \"pie\") {\n return;\n }\n // We only support errorbar series that are linked to other series. Those are not represented separately\n // in the legend, but can be controlled from the outside, using controllable items visibility API.\n if (series.type === \"errorbar\") {\n return;\n }\n // We respect Highcharts showInLegend option to allow hiding certain series from the legend.\n // The same is not supported for pie chart segments.\n if (series.options.showInLegend !== false) {\n const seriesId = getSeriesId(series);\n const itemProps = getItemOptions(seriesId);\n const status = itemProps.status;\n legendItems.push({\n id: seriesId,\n name: series.name,\n markerType: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: series.visible,\n isSecondary,\n status: status,\n markerAriaLabel: itemMarkerStatusAriaLabel?.(status),\n });\n }\n };\n const addPointItem = (point: Highcharts.Point, isSecondary: boolean) => {\n if (point?.series?.type === \"pie\") {\n const pointId = getPointId(point);\n legendItems.push({\n id: pointId,\n name: point.name,\n markerType: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: point.visible,\n status: getItemOptions(pointId).status,\n isSecondary,\n });\n }\n };\n for (const s of getChartSeries(chart.series)) {\n const valueAxis = isInverted ? s.xAxis : s.yAxis;\n const isSecondary = valueAxis?.options?.opposite ?? false;\n addSeriesItem(s, isSecondary);\n s.data.forEach((p) => addPointItem(p, isSecondary));\n }\n return legendItems;\n}\n\nexport type LegendItemOptions = Highcharts.SeriesOptionsType | Highcharts.PointOptionsType;\n\nexport function getVisibleLegendItems(options: Highcharts.Options) {\n const isInverted = options.chart?.inverted ?? false;\n const valueAxes = (isInverted ? castArray(options.xAxis) : castArray(options.yAxis)) ?? [];\n const defaultOpposite = valueAxes.length > 0 ? (valueAxes[0].opposite ?? false) : false;\n\n const primaryItems: LegendItemOptions[] = [];\n const secondaryItems: LegendItemOptions[] = [];\n const addLegendItem = (item: LegendItemOptions) => {\n if (isSecondaryLegendItem(item, isInverted, defaultOpposite, valueAxes)) {\n secondaryItems.push(item);\n } else {\n primaryItems.push(item);\n }\n };\n\n options.series?.forEach((series) => {\n if (!(\"type\" in series)) {\n return;\n }\n\n // The pie series is not shown in the legend. Instead, we show pie segments (points).\n if (series.type === \"pie\") {\n if (Array.isArray(series.data)) {\n series.data.forEach((point) => addLegendItem(point));\n }\n return;\n }\n // We only support errorbar series that are linked to other series. Those are not represented separately\n // in the legend, but can be controlled from the outside, using controllable items visibility API.\n if (series.type === \"errorbar\") {\n return;\n }\n if (series.showInLegend !== false) {\n addLegendItem(series);\n }\n });\n\n return { primaryItems, secondaryItems };\n}\n\nfunction isSecondaryLegendItem(\n item: LegendItemOptions,\n isInverted: boolean,\n defaultOpposite: boolean,\n valueAxes: Array<{ id?: string; opposite?: boolean }>,\n): boolean {\n // Only items that have an associated axis can be considered secondary\n if (item && typeof item === \"object\" && (\"xAxis\" in item || \"yAxis\" in item)) {\n const axisRef = isInverted ? (item.xAxis ?? 0) : (item.yAxis ?? 0);\n // An axis reference can be an index into the axes array or an explicitly passed id\n const valueAxis = typeof axisRef === \"number\" ? valueAxes[axisRef] : valueAxes.find((a) => a.id === axisRef);\n return valueAxis?.opposite ?? false;\n }\n return defaultOpposite;\n}\n\nexport function getLegendsProps(\n options: CoreChartProps.ChartOptions,\n legendOptions: CoreChartProps.LegendOptions | undefined,\n) {\n // While Highcharts supports more than two axes, this\n // implementation supports at most two, in which case one\n // of them must be set as opposite (secondary).\n const { primaryItems, secondaryItems } = getVisibleLegendItems(options);\n return {\n primary:\n primaryItems.length === 0\n ? undefined\n : ({\n isSecondary: false,\n title: legendOptions?.title,\n actions: legendOptions?.actions,\n alignment: legendOptions?.position === \"side\" ? \"vertical\" : \"horizontal\",\n horizontalAlignment: secondaryItems.length === 0 ? legendOptions?.horizontalAlignment : \"start\",\n } as const),\n secondary:\n secondaryItems.length === 0\n ? undefined\n : ({\n isSecondary: true,\n title: legendOptions?.secondaryLegendTitle,\n actions: legendOptions?.secondaryLegendActions,\n alignment: legendOptions?.position === \"side\" ? \"vertical\" : \"horizontal\",\n horizontalAlignment: \"end\",\n } as const),\n };\n}\n\n// This function returns coordinates of a rectangle, including the target point.\n// There are differences in how the rectangle is computed, but in all cases it is supposed to\n// enclose the point's visual representation in the chart, with no extra offsets.\nexport function getPointRect(point: Highcharts.Point): Rect {\n if (!point.series) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n\n switch (point.series.type) {\n case \"column\":\n return getColumnPointRect(point);\n case \"errorbar\":\n return getErrorBarPointRect(point);\n default:\n return getDefaultPointRect(point);\n }\n}\n\n// The group rect is only used for cartesian charts. It returns coordinates of a rectangle,\n// which includes all given points, but also stretched vertically or horizontally (in inverted charts)\n// to the entire chart's height or width.\nexport function getGroupRect(points: readonly Highcharts.Point[]): Rect {\n if (points.length === 0 || !points[0].series) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n const chart = points[0].series.chart;\n const rects = points.map(getPointRect);\n const [first, ...rest] = rects;\n let minX = first.x,\n minY = first.y,\n maxX = first.x + first.width,\n maxY = first.y + first.height;\n for (const r of rest) {\n minX = Math.min(minX, r.x);\n minY = Math.min(minY, r.y);\n maxX = Math.max(maxX, r.x + r.width);\n maxY = Math.max(maxY, r.y + r.height);\n }\n return safeRect(\n chart.inverted\n ? { x: chart.plotLeft, y: minY, width: chart.plotWidth, height: maxY - minY }\n : { x: minX, y: chart.plotTop, width: maxX - minX, height: chart.plotHeight },\n );\n}\n\n// We ensure rect width and height are non-zero to ensure its position is calculated correctly in Firefox.\nexport function safeRect(rect: Rect): Rect {\n return { ...rect, width: Math.max(0.1, rect.width), height: Math.max(0.1, rect.height) };\n}\n\nexport function getChartAccessibleDescription(chart: Highcharts.Chart) {\n return chart.options.lang?.accessibility?.chartContainerLabel ?? \"\";\n}\n\nexport function getPointAccessibleDescription(point: Highcharts.Point, labels: ChartLabels) {\n if (point.series.xAxis && point.series.yAxis) {\n const formattedX = getFormatter(point.series.xAxis)(point.x);\n const formattedY = getFormatter(point.series.yAxis)(point.y);\n return `${formattedX} ${formattedY}, ${point.series.name}`;\n } else if (point.series.type === \"pie\") {\n const segmentLabel = labels.chartSegmentLabel ? `${labels.chartSegmentLabel} ` : \"\";\n return `${segmentLabel}${point.name}, ${point.y}. ${point.series.name}`;\n } else {\n return \"\";\n }\n}\n\nexport function getGroupAccessibleDescription(group: readonly Highcharts.Point[]) {\n const firstPoint = group[0];\n return getFormatter(firstPoint.series.xAxis)(firstPoint.x);\n}\n\n// The area-, line-, or scatter series markers are rendered as single graphic elements,\n// and we can use their respective b-boxes to compute rects.\nfunction getDefaultPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (point.graphic) {\n const box = point.graphic.getBBox();\n return getChartRect(box, chart, false);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The column series graphic elements are rectangles, and they are inverted if the chart is inverted,\n// so that rect's width becomes height and vice-versa.\nfunction getColumnPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (point.graphic) {\n return getChartRect(point.graphic.getBBox(), chart, true);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The errorbar series point rect cannot be computed from the respective graphic element (it gives wrong position).\n// Instead, we have to rely on the internal \"whiskers\" element b-box, which can be inverted, too.\nfunction getErrorBarPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (\"whiskers\" in point) {\n return getChartRect((point.whiskers as Highcharts.SVGElement).getBBox(), chart, true);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The point graphic is not present in large charts to optimize performance.\n// In that case we compute point rects from their coordinates. We also assume the point\n// size is small, and thereby give it 0 width and height, which is alright as there is a\n// small offset that we use for focus outline anyways.\n// See: https://www.highcharts.com/blog/news/175-highcharts-performance-boost/\nfunction getPointRectFromCoordinates(point: Highcharts.Point) {\n const chart = point.series.chart;\n const plotX = point.plotX ?? 0;\n const plotY = point.plotY ?? 0;\n return getChartRect({ x: plotX, y: plotY, width: 0, height: 0 }, chart, true);\n}\n\nfunction getChartRect(rect: Rect, chart: Highcharts.Chart, canBeInverted: boolean): Rect {\n return canBeInverted && chart.inverted\n ? {\n x: chart.plotWidth + chart.plotLeft - (rect.y + rect.height),\n y: chart.plotHeight + chart.plotTop - (rect.x + rect.width),\n width: rect.height,\n height: rect.width,\n }\n : {\n x: chart.plotLeft + rect.x,\n y: chart.plotTop + rect.y,\n width: rect.width,\n height: rect.height,\n };\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":"AAAA,qEAA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esContent":["// 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 { ChartSeriesMarkerType } from \"../internal/components/series-marker\";\nimport { ChartSeriesMarkerStatus } from \"../internal/components/series-marker/interfaces\";\nimport { getChartSeries } from \"../internal/utils/chart-series\";\nimport { castArray } from \"../internal/utils/utils\";\nimport { getFormatter } from \"./formatters\";\nimport { ChartLabels } from \"./i18n-utils\";\nimport { CoreChartProps, Rect } from \"./interfaces\";\n\nexport interface LegendItemSpec {\n id: string;\n name: string;\n markerType: ChartSeriesMarkerType;\n color: string;\n visible: boolean;\n isSecondary: boolean;\n status?: ChartSeriesMarkerStatus;\n markerAriaLabel?: string;\n}\n\n// The below functions extract unique identifier from series, point, or options. The identifier can be item's ID or name.\n// We expect that items requiring referencing (e.g. in order to control their visibility) have the unique identifier defined.\n// Otherwise, we return a randomized id that is to ensure no accidental matches.\nexport function getSeriesId(series: Highcharts.Series): string {\n return getOptionsId(series.options);\n}\nexport function getPointId(point: Highcharts.Point): string {\n return getOptionsId(point.options);\n}\nexport function getOptionsId(options: { id?: string; name?: string }): string {\n return options.id ?? options.name ?? noIdPlaceholder();\n}\nfunction noIdPlaceholder(): string {\n const rand = (Math.random() * 1_000_000).toFixed(0).padStart(6, \"0\");\n return \"awsui-no-id-placeholder-\" + rand;\n}\n\n// There are more possible values that series.stacking can take, but we only explicitly support \"normal\".\nexport function isSeriesStacked(series: Highcharts.Series) {\n return (series.options as any).stacking === \"normal\";\n}\n\n// The threshold series are custom series, implemented as a combination of line series, and plot lines.\n// As Highcharts does not support custom series declaration, we annotate threshold series by using the\n// series.custom property. This is then used in our utilities to recognize threshold series, and retrieve\n// the associated threshold value.\ninterface ThresholdOptions<T extends \"x-threshold\" | \"y-threshold\"> {\n custom: {\n awsui: {\n type: T;\n threshold: number;\n };\n };\n}\nexport function createThresholdMetadata<T extends \"x-threshold\" | \"y-threshold\">(\n type: T,\n value: number,\n): ThresholdOptions<T> {\n return { custom: { awsui: { type, threshold: value } } };\n}\nexport function isXThreshold(\n s: Highcharts.Series,\n): s is Highcharts.Series & { options: ThresholdOptions<\"x-threshold\"> } {\n return typeof s.options.custom === \"object\" && s.options.custom.awsui?.type === \"x-threshold\";\n}\nexport function isYThreshold(\n s: Highcharts.Series,\n): s is Highcharts.Series & { options: ThresholdOptions<\"y-threshold\"> } {\n return typeof s.options.custom === \"object\" && s.options.custom.awsui?.type === \"y-threshold\";\n}\n\n// We check point.series explicitly because Highcharts can destroy point objects, replacing the\n// contents with { destroyed: true }, violating the point's TS contract.\n// See: https://github.com/highcharts/highcharts/issues/23175.\nexport function isPointVisible(point: Highcharts.Point) {\n return point.visible && point.series && point.series.visible;\n}\n\nexport function getSeriesMarkerType(series?: Highcharts.Series): ChartSeriesMarkerType {\n if (!series) {\n return \"large-square\";\n }\n const seriesSymbol = \"symbol\" in series && typeof series.symbol === \"string\" ? series.symbol : \"circle\";\n // In Highcharts, dashStyle supports different types of dashes: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/\n // Return a dashed legend symbol for all of these dashes, excluding the default \"Solid\" option\n if (\"dashStyle\" in series.options && series.options.dashStyle && series.options.dashStyle !== \"Solid\") {\n return \"dashed\";\n }\n switch (series.type) {\n case \"area\":\n case \"areaspline\":\n return \"hollow-square\";\n case \"line\":\n case \"spline\":\n return \"line\";\n case \"scatter\":\n switch (seriesSymbol) {\n case \"square\":\n return \"square\";\n case \"diamond\":\n return \"diamond\";\n case \"triangle\":\n return \"triangle\";\n case \"triangle-down\":\n return \"triangle-down\";\n case \"circle\":\n default:\n return \"circle\";\n }\n case \"column\":\n case \"pie\":\n return \"large-square\";\n case \"errorbar\":\n default:\n return \"large-square\";\n }\n}\n\n// Highcharts supports color objects to represent gradients and more, but we only support string\n// colors in our markers. In case a non-string color is defined, we use black color as as fallback.\nexport function getSeriesColor(series?: Highcharts.Series): string {\n return typeof series?.color === \"string\" ? series.color : \"black\";\n}\nexport function getPointColor(point?: Highcharts.Point): string {\n return typeof point?.color === \"string\" ? point.color : \"black\";\n}\n\n// The custom legend implementation does not rely on the Highcharts legend. When Highcharts legend is disabled,\n// the chart object does not include information on legend items. Instead, we collect series and pie segments\n// using this custom function, respecting Highcharts' showInLegend flag (defined for series only).\n\n// There exists a Highcharts APIs to access legend items, but it is unfortunately not available, when\n// Highcharts legend is disabled. Instead, we use this custom method to collect legend items from the chart.\nexport function getChartLegendItems({\n chart,\n getItemOptions = () => ({}),\n itemMarkerStatusAriaLabel,\n}: {\n chart: Highcharts.Chart;\n getItemOptions?: CoreChartProps.GetItemOptions;\n itemMarkerStatusAriaLabel?: ChartLabels[\"itemMarkerLabel\"];\n}): readonly LegendItemSpec[] {\n const legendItems: LegendItemSpec[] = [];\n const isInverted = chart.inverted ?? false;\n const addSeriesItem = (series: Highcharts.Series, isSecondary: boolean) => {\n // The pie series is not shown in the legend. Instead, we show pie segments.\n if (series.type === \"pie\") {\n return;\n }\n // We only support errorbar series that are linked to other series. Those are not represented separately\n // in the legend, but can be controlled from the outside, using controllable items visibility API.\n if (series.type === \"errorbar\") {\n return;\n }\n // We respect Highcharts showInLegend option to allow hiding certain series from the legend.\n // The same is not supported for pie chart segments.\n if (series.options.showInLegend !== false) {\n const seriesId = getSeriesId(series);\n const itemProps = getItemOptions(seriesId);\n const status = itemProps.status;\n legendItems.push({\n id: seriesId,\n name: series.name,\n markerType: getSeriesMarkerType(series),\n color: getSeriesColor(series),\n visible: series.visible,\n isSecondary,\n status: status,\n markerAriaLabel: itemMarkerStatusAriaLabel?.(status),\n });\n }\n };\n const addPointItem = (point: Highcharts.Point, isSecondary: boolean) => {\n if (point?.series?.type === \"pie\") {\n const pointId = getPointId(point);\n legendItems.push({\n id: pointId,\n name: point.name,\n markerType: getSeriesMarkerType(point.series),\n color: getPointColor(point),\n visible: point.visible,\n status: getItemOptions(pointId).status,\n isSecondary,\n });\n }\n };\n for (const s of getChartSeries(chart.series)) {\n const valueAxis = isInverted ? s.xAxis : s.yAxis;\n const isSecondary = valueAxis?.options?.opposite ?? false;\n addSeriesItem(s, isSecondary);\n s.data.forEach((p) => addPointItem(p, isSecondary));\n }\n return legendItems;\n}\n\nexport type LegendItemOptions = Highcharts.SeriesOptionsType | Highcharts.PointOptionsType;\n\nexport function getVisibleLegendItems(options: Highcharts.Options) {\n const isInverted = options.chart?.inverted ?? false;\n const valueAxes = (isInverted ? castArray(options.xAxis) : castArray(options.yAxis)) ?? [];\n const defaultOpposite = valueAxes.length > 0 ? (valueAxes[0].opposite ?? false) : false;\n\n const primaryItems: LegendItemOptions[] = [];\n const secondaryItems: LegendItemOptions[] = [];\n const addLegendItem = (item: LegendItemOptions) => {\n if (isSecondaryLegendItem(item, isInverted, defaultOpposite, valueAxes)) {\n secondaryItems.push(item);\n } else {\n primaryItems.push(item);\n }\n };\n\n options.series?.forEach((series) => {\n if (!(\"type\" in series)) {\n return;\n }\n\n // The pie series is not shown in the legend. Instead, we show pie segments (points).\n if (series.type === \"pie\") {\n if (Array.isArray(series.data)) {\n series.data.forEach((point) => addLegendItem(point));\n }\n return;\n }\n // We only support errorbar series that are linked to other series. Those are not represented separately\n // in the legend, but can be controlled from the outside, using controllable items visibility API.\n if (series.type === \"errorbar\") {\n return;\n }\n if (series.showInLegend !== false) {\n addLegendItem(series);\n }\n });\n\n return { primaryItems, secondaryItems };\n}\n\nfunction isSecondaryLegendItem(\n item: LegendItemOptions,\n isInverted: boolean,\n defaultOpposite: boolean,\n valueAxes: Array<{ id?: string; opposite?: boolean }>,\n): boolean {\n // Only items that have an associated axis can be considered secondary\n if (item && typeof item === \"object\" && (\"xAxis\" in item || \"yAxis\" in item)) {\n const axisRef = isInverted ? (item.xAxis ?? 0) : (item.yAxis ?? 0);\n // An axis reference can be an index into the axes array or an explicitly passed id\n const valueAxis = typeof axisRef === \"number\" ? valueAxes[axisRef] : valueAxes.find((a) => a.id === axisRef);\n return valueAxis?.opposite ?? false;\n }\n return defaultOpposite;\n}\n\nexport function getLegendsProps(\n options: CoreChartProps.ChartOptions,\n legendOptions: CoreChartProps.LegendOptions | undefined,\n) {\n // While Highcharts supports more than two axes, this\n // implementation supports at most two, in which case one\n // of them must be set as opposite (secondary).\n const { primaryItems, secondaryItems } = getVisibleLegendItems(options);\n return {\n primary:\n primaryItems.length === 0\n ? undefined\n : ({\n isSecondary: false,\n title: legendOptions?.title,\n actions: legendOptions?.actions,\n alignment: legendOptions?.position === \"side\" ? \"vertical\" : \"horizontal\",\n horizontalAlignment: secondaryItems.length === 0 ? legendOptions?.horizontalAlignment : \"start\",\n enableHorizontalScroll: legendOptions?.enableHorizontalScroll,\n } as const),\n secondary:\n secondaryItems.length === 0\n ? undefined\n : ({\n isSecondary: true,\n title: legendOptions?.secondaryLegendTitle,\n actions: legendOptions?.secondaryLegendActions,\n alignment: legendOptions?.position === \"side\" ? \"vertical\" : \"horizontal\",\n horizontalAlignment: \"end\",\n enableHorizontalScroll: legendOptions?.enableHorizontalScroll,\n } as const),\n };\n}\n\n// This function returns coordinates of a rectangle, including the target point.\n// There are differences in how the rectangle is computed, but in all cases it is supposed to\n// enclose the point's visual representation in the chart, with no extra offsets.\nexport function getPointRect(point: Highcharts.Point): Rect {\n if (!point.series) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n\n switch (point.series.type) {\n case \"column\":\n return getColumnPointRect(point);\n case \"errorbar\":\n return getErrorBarPointRect(point);\n default:\n return getDefaultPointRect(point);\n }\n}\n\n// The group rect is only used for cartesian charts. It returns coordinates of a rectangle,\n// which includes all given points, but also stretched vertically or horizontally (in inverted charts)\n// to the entire chart's height or width.\nexport function getGroupRect(points: readonly Highcharts.Point[]): Rect {\n if (points.length === 0 || !points[0].series) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n const chart = points[0].series.chart;\n const rects = points.map(getPointRect);\n const [first, ...rest] = rects;\n let minX = first.x,\n minY = first.y,\n maxX = first.x + first.width,\n maxY = first.y + first.height;\n for (const r of rest) {\n minX = Math.min(minX, r.x);\n minY = Math.min(minY, r.y);\n maxX = Math.max(maxX, r.x + r.width);\n maxY = Math.max(maxY, r.y + r.height);\n }\n return safeRect(\n chart.inverted\n ? { x: chart.plotLeft, y: minY, width: chart.plotWidth, height: maxY - minY }\n : { x: minX, y: chart.plotTop, width: maxX - minX, height: chart.plotHeight },\n );\n}\n\n// We ensure rect width and height are non-zero to ensure its position is calculated correctly in Firefox.\nexport function safeRect(rect: Rect): Rect {\n return { ...rect, width: Math.max(0.1, rect.width), height: Math.max(0.1, rect.height) };\n}\n\nexport function getChartAccessibleDescription(chart: Highcharts.Chart) {\n return chart.options.lang?.accessibility?.chartContainerLabel ?? \"\";\n}\n\nexport function getPointAccessibleDescription(point: Highcharts.Point, labels: ChartLabels) {\n if (point.series.xAxis && point.series.yAxis) {\n const formattedX = getFormatter(point.series.xAxis)(point.x);\n const formattedY = getFormatter(point.series.yAxis)(point.y);\n return `${formattedX} ${formattedY}, ${point.series.name}`;\n } else if (point.series.type === \"pie\") {\n const segmentLabel = labels.chartSegmentLabel ? `${labels.chartSegmentLabel} ` : \"\";\n return `${segmentLabel}${point.name}, ${point.y}. ${point.series.name}`;\n } else {\n return \"\";\n }\n}\n\nexport function getGroupAccessibleDescription(group: readonly Highcharts.Point[]) {\n const firstPoint = group[0];\n return getFormatter(firstPoint.series.xAxis)(firstPoint.x);\n}\n\n// The area-, line-, or scatter series markers are rendered as single graphic elements,\n// and we can use their respective b-boxes to compute rects.\nfunction getDefaultPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (point.graphic) {\n const box = point.graphic.getBBox();\n return getChartRect(box, chart, false);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The column series graphic elements are rectangles, and they are inverted if the chart is inverted,\n// so that rect's width becomes height and vice-versa.\nfunction getColumnPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (point.graphic) {\n return getChartRect(point.graphic.getBBox(), chart, true);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The errorbar series point rect cannot be computed from the respective graphic element (it gives wrong position).\n// Instead, we have to rely on the internal \"whiskers\" element b-box, which can be inverted, too.\nfunction getErrorBarPointRect(point: Highcharts.Point): Rect {\n const chart = point.series.chart;\n if (\"whiskers\" in point) {\n return getChartRect((point.whiskers as Highcharts.SVGElement).getBBox(), chart, true);\n }\n return getPointRectFromCoordinates(point);\n}\n\n// The point graphic is not present in large charts to optimize performance.\n// In that case we compute point rects from their coordinates. We also assume the point\n// size is small, and thereby give it 0 width and height, which is alright as there is a\n// small offset that we use for focus outline anyways.\n// See: https://www.highcharts.com/blog/news/175-highcharts-performance-boost/\nfunction getPointRectFromCoordinates(point: Highcharts.Point) {\n const chart = point.series.chart;\n const plotX = point.plotX ?? 0;\n const plotY = point.plotY ?? 0;\n return getChartRect({ x: plotX, y: plotY, width: 0, height: 0 }, chart, true);\n}\n\nfunction getChartRect(rect: Rect, chart: Highcharts.Chart, canBeInverted: boolean): Rect {\n return canBeInverted && chart.inverted\n ? {\n x: chart.plotWidth + chart.plotLeft - (rect.y + rect.height),\n y: chart.plotHeight + chart.plotTop - (rect.x + rect.width),\n width: rect.height,\n height: rect.width,\n }\n : {\n x: chart.plotLeft + rect.x,\n y: chart.plotTop + rect.y,\n width: rect.width,\n height: rect.height,\n };\n}\n"]}
@@ -9,6 +9,7 @@ export interface ChartLegendProps {
9
9
  actions?: React.ReactNode;
10
10
  someHighlighted: boolean;
11
11
  alignment: LegendAlignment;
12
+ enableHorizontalScroll?: boolean;
12
13
  horizontalAlignment: LegendHorizontalAlignment;
13
14
  onToggleItem: (itemId: string) => void;
14
15
  onSelectItem: (itemId: string) => void;
@@ -16,4 +17,4 @@ export interface ChartLegendProps {
16
17
  onItemHighlightExit: () => void;
17
18
  getTooltipContent: (props: GetLegendTooltipContentProps) => null | LegendTooltipContent;
18
19
  }
19
- export declare const ChartLegend: ({ items, legendTitle, ariaLabel, actions, alignment, className, someHighlighted, onToggleItem, onSelectItem, onItemHighlightEnter, onItemHighlightExit, getTooltipContent, horizontalAlignment, }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const ChartLegend: ({ items, legendTitle, ariaLabel, actions, alignment, className, someHighlighted, onToggleItem, onSelectItem, onItemHighlightEnter, onItemHighlightExit, getTooltipContent, horizontalAlignment, enableHorizontalScroll, }: ChartLegendProps) => import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ const TOOLTIP_SHOW_DELAY = 300;
14
14
  const TOOLTIP_BLUR_DELAY = 50;
15
15
  const HIGHLIGHT_LOST_DELAY = 50;
16
16
  const SCROLL_DELAY = 100;
17
- export const ChartLegend = ({ items, legendTitle, ariaLabel, actions, alignment, className, someHighlighted, onToggleItem, onSelectItem, onItemHighlightEnter, onItemHighlightExit, getTooltipContent, horizontalAlignment, }) => {
17
+ export const ChartLegend = ({ items, legendTitle, ariaLabel, actions, alignment, className, someHighlighted, onToggleItem, onSelectItem, onItemHighlightEnter, onItemHighlightExit, getTooltipContent, horizontalAlignment, enableHorizontalScroll, }) => {
18
18
  var _a;
19
19
  const containerRef = useRef(null);
20
20
  const elementsByIndexRef = useRef([]);
@@ -153,6 +153,7 @@ export const ChartLegend = ({ items, legendTitle, ariaLabel, actions, alignment,
153
153
  // Setting the tab index to -1 does fix the problem.
154
154
  tabIndex: -1, ref: containerRef, className: clsx(styles.list, {
155
155
  [styles[`list-bottom-${horizontalAlignment}`]]: !isVertical,
156
+ [styles["list-horizontal-scroll"]]: enableHorizontalScroll,
156
157
  [styles["list-bottom"]]: !isVertical,
157
158
  [styles["list-side"]]: isVertical,
158
159
  }), children: [actions && (_jsxs(_Fragment, { children: [_jsxs("div", { className: clsx(testClasses.actions, styles.actions, styles["actions-bottom"]), children: [actions, !isVertical && _jsx("div", { className: styles["actions-divider-bottom"] })] }), isVertical && _jsx("div", { className: styles["actions-divider-side"] })] })), items.map((item, index) => {
@@ -191,7 +192,7 @@ export const ChartLegend = ({ items, legendTitle, ariaLabel, actions, alignment,
191
192
  onSelectItem(item.id);
192
193
  }
193
194
  }, isHighlighted: item.highlighted, someHighlighted: someHighlighted, itemId: item.id, label: item.name, visible: item.visible, marker: item.marker }, index));
194
- })] }), tooltipContent && (_jsx(InternalChartTooltip, { trackRef: tooltipTrack, trackKey: tooltipTarget.id, container: null, dismissButton: false, onDismiss: () => { }, position: tooltipPosition, title: tooltipContent.header, onMouseEnter: () => showTooltip(tooltipTarget.id), onMouseLeave: () => hideTooltip(), onBlur: () => hideTooltip(), footer: tooltipContent.footer && (_jsxs(_Fragment, { children: [_jsx("hr", { "aria-hidden": true }), tooltipContent.footer] })), children: tooltipContent.body }))] }) }));
195
+ })] }), tooltipContent && (_jsx(InternalChartTooltip, { trackRef: tooltipTrack, triggerClampRef: containerRef, trackKey: tooltipTarget.id, container: null, dismissButton: false, onDismiss: () => { }, position: tooltipPosition, title: tooltipContent.header, onMouseEnter: () => showTooltip(tooltipTarget.id), onMouseLeave: () => hideTooltip(), onBlur: () => hideTooltip(), footer: tooltipContent.footer && (_jsxs(_Fragment, { children: [_jsx("hr", { "aria-hidden": true }), tooltipContent.footer] })), children: tooltipContent.body }))] }) }));
195
196
  };
196
197
  function getBoxTextAlignment(horizontalAlignment) {
197
198
  switch (horizontalAlignment) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-legend/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAO,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EAEP,+BAA+B,EAC/B,YAAY,EACZ,0BAA0B,GAC3B,MAAM,+CAA+C,CAAC;AACvD,OAAO,GAAiB,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,oBAAoB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AAa,CAAC,CAAC,EAAE,CAAC,OAAO;YACtC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,aAAa;YAC3D,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,aAAa;SAChE,CAAC,EACF,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,aAEnB,MAAM,EACP,eAAM,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,YAAG,KAAK,GAAQ,IAC9C,CACV,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, Ref, useEffect, useMemo, useRef, useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport {\n circleIndex,\n handleKey,\n KeyCode,\n SingleTabStopNavigationAPI,\n SingleTabStopNavigationProvider,\n useMergeRefs,\n useSingleTabStopNavigation,\n} from \"@cloudscape-design/component-toolkit/internal\";\nimport Box, { BoxProps } from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\n\nimport { scrollIntoViewNearestContainer } from \"../../utils/dom\";\nimport { DebouncedCall } from \"../../utils/utils\";\nimport { GetLegendTooltipContentProps, LegendItem, LegendTooltipContent } from \"../interfaces\";\n\nimport styles from \"./styles.css.js\";\nimport testClasses from \"./test-classes/styles.css.js\";\n\nconst TOOLTIP_SHOW_DELAY = 300;\nconst TOOLTIP_BLUR_DELAY = 50;\nconst HIGHLIGHT_LOST_DELAY = 50;\nconst SCROLL_DELAY = 100;\n\nexport type LegendAlignment = \"horizontal\" | \"vertical\";\nexport type LegendHorizontalAlignment = \"start\" | \"center\" | \"end\";\n\nexport interface ChartLegendProps {\n items: readonly LegendItem[];\n legendTitle?: string;\n ariaLabel?: string;\n className?: string;\n actions?: React.ReactNode;\n someHighlighted: boolean;\n alignment: LegendAlignment;\n horizontalAlignment: LegendHorizontalAlignment;\n onToggleItem: (itemId: string) => void;\n onSelectItem: (itemId: string) => void;\n onItemHighlightEnter: (item: LegendItem) => void;\n onItemHighlightExit: () => void;\n getTooltipContent: (props: GetLegendTooltipContentProps) => null | LegendTooltipContent;\n}\n\nexport const ChartLegend = ({\n items,\n legendTitle,\n ariaLabel,\n actions,\n alignment,\n className,\n someHighlighted,\n onToggleItem,\n onSelectItem,\n onItemHighlightEnter,\n onItemHighlightExit,\n getTooltipContent,\n horizontalAlignment,\n}: ChartLegendProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const elementsByIndexRef = useRef<Record<number, HTMLElement>>([]);\n const elementsByIdRef = useRef<Record<string, HTMLElement>>({});\n const tooltipRef = useRef<HTMLElement>(null);\n const highlightControl = useMemo(() => new DebouncedCall(), []);\n const scrollIntoViewControl = useMemo(() => new DebouncedCall(), []);\n const [selectedIndex, setSelectedIndex] = useState<number>(0);\n const [tooltipItemId, setTooltipItemId] = useState<string | null>(null);\n const { showTooltip, hideTooltip } = useMemo(() => {\n const control = new DebouncedCall();\n return {\n showTooltip(itemId: string) {\n control.call(() => setTooltipItemId(itemId), TOOLTIP_SHOW_DELAY);\n },\n hideTooltip(lock = false) {\n control.call(() => setTooltipItemId(null), TOOLTIP_BLUR_DELAY);\n if (lock) {\n control.lock(TOOLTIP_BLUR_DELAY);\n }\n },\n };\n }, []);\n\n useEffect(() => {\n if (!tooltipItemId) {\n return;\n }\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n hideTooltip(true);\n elementsByIdRef.current[tooltipItemId]?.focus();\n }\n };\n document.addEventListener(\"keydown\", onDocumentKeyDown, true);\n return () => {\n document.removeEventListener(\"keydown\", onDocumentKeyDown, true);\n };\n }, [items, tooltipItemId, hideTooltip]);\n const isMouseInContainer = useRef<boolean>(false);\n\n // Scrolling to the highlighted legend item.\n useEffect(() => {\n const highlightedIndex = items.findIndex((item) => item.highlighted);\n if (highlightedIndex === -1) {\n return;\n }\n scrollIntoViewControl.call(() => {\n if (isMouseInContainer.current) {\n return;\n }\n const element = elementsByIndexRef.current?.[highlightedIndex];\n if (!element) {\n return;\n }\n scrollIntoViewNearestContainer(element, { behavior: \"smooth\", scrollMode: \"if-needed\" });\n }, SCROLL_DELAY);\n }, [items, scrollIntoViewControl]);\n\n const showHighlight = (itemId: string) => {\n const item = items.find((item) => item.id === itemId);\n if (item?.visible) {\n highlightControl.cancelPrevious();\n onItemHighlightEnter(item);\n }\n };\n const clearHighlight = () => {\n highlightControl.call(onItemHighlightExit, HIGHLIGHT_LOST_DELAY);\n };\n\n const navigationAPI = useRef<SingleTabStopNavigationAPI>(null);\n\n function onFocus(index: number, itemId: string) {\n setSelectedIndex(index);\n navigationAPI.current!.updateFocusTarget();\n showHighlight(itemId);\n showTooltip(itemId);\n }\n\n function onBlur(event: React.FocusEvent) {\n navigationAPI.current!.updateFocusTarget();\n\n // Hide tooltip and clear highlight unless focus moves inside tooltip;\n if (tooltipRef.current && event.relatedTarget && !tooltipRef.current.contains(event.relatedTarget)) {\n clearHighlight();\n hideTooltip();\n }\n }\n\n function focusElement(index: number) {\n elementsByIndexRef.current[index]?.focus();\n }\n\n function onKeyDown(event: React.KeyboardEvent<HTMLElement>) {\n if (\n event.keyCode === KeyCode.right ||\n event.keyCode === KeyCode.left ||\n event.keyCode === KeyCode.up ||\n event.keyCode === KeyCode.down ||\n event.keyCode === KeyCode.home ||\n event.keyCode === KeyCode.end ||\n event.keyCode === KeyCode.escape\n ) {\n // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n const range = [0, items.length - 1] as [number, number];\n\n handleKey(event, {\n onInlineStart: () => focusElement(circleIndex(selectedIndex - 1, range)),\n onInlineEnd: () => focusElement(circleIndex(selectedIndex + 1, range)),\n onBlockStart: () => focusElement(circleIndex(selectedIndex - 1, range)),\n onBlockEnd: () => focusElement(circleIndex(selectedIndex + 1, range)),\n onHome: () => focusElement(0),\n onEnd: () => focusElement(items.length - 1),\n onEscape: () => onItemHighlightExit(),\n });\n }\n }\n\n function getNextFocusTarget(): null | HTMLElement {\n if (containerRef.current) {\n const buttons: HTMLButtonElement[] = Array.from(containerRef.current.querySelectorAll(`.${styles.item}`));\n return buttons[selectedIndex] ?? null;\n }\n return null;\n }\n\n function onUnregisterActive(\n focusableElement: HTMLElement,\n navigationAPI: React.RefObject<{ getFocusTarget: () => HTMLElement | null }>,\n ) {\n const target = navigationAPI.current?.getFocusTarget();\n\n if (target && target.dataset.itemid !== focusableElement.dataset.itemid) {\n target.focus();\n }\n }\n\n useEffect(() => {\n navigationAPI.current!.updateFocusTarget();\n });\n\n const isVertical = alignment === \"vertical\";\n\n const tooltipTrack = useRef<null | HTMLElement>(null);\n const tooltipTarget = items.find((item) => item.id === tooltipItemId) ?? null;\n tooltipTrack.current = tooltipItemId ? elementsByIdRef.current[tooltipItemId] : null;\n const tooltipContent = tooltipTarget && getTooltipContent({ legendItem: tooltipTarget });\n const tooltipPosition = isVertical ? \"left\" : \"bottom\";\n\n return (\n <SingleTabStopNavigationProvider\n ref={navigationAPI}\n navigationActive={true}\n getNextFocusTarget={() => getNextFocusTarget()}\n onUnregisterActive={(element: HTMLElement) => onUnregisterActive(element, navigationAPI)}\n >\n <div\n role=\"toolbar\"\n aria-label={legendTitle || ariaLabel}\n className={clsx(testClasses.root, styles.root, className)}\n onMouseEnter={() => (isMouseInContainer.current = true)}\n onMouseLeave={() => (isMouseInContainer.current = false)}\n >\n {legendTitle && (\n <Box fontWeight=\"bold\" className={testClasses.title} textAlign={getBoxTextAlignment(horizontalAlignment)}>\n {legendTitle}\n </Box>\n )}\n <div\n // The list element is not focusable. However, the focus lands on it regardless, when testing in Firefox.\n // Setting the tab index to -1 does fix the problem.\n tabIndex={-1}\n ref={containerRef}\n className={clsx(styles.list, {\n [styles[`list-bottom-${horizontalAlignment}`]]: !isVertical,\n [styles[\"list-bottom\"]]: !isVertical,\n [styles[\"list-side\"]]: isVertical,\n })}\n >\n {actions && (\n <>\n <div className={clsx(testClasses.actions, styles.actions, styles[\"actions-bottom\"])}>\n {actions}\n {!isVertical && <div className={styles[\"actions-divider-bottom\"]} />}\n </div>\n {isVertical && <div className={styles[\"actions-divider-side\"]} />}\n </>\n )}\n {items.map((item, index) => {\n const handlers = {\n onMouseEnter: () => {\n showHighlight(item.id);\n showTooltip(item.id);\n },\n onMouseLeave: () => {\n clearHighlight();\n hideTooltip();\n },\n onFocus: () => {\n onFocus(index, item.id);\n },\n onBlur: (event: React.FocusEvent) => {\n onBlur(event);\n },\n onKeyDown,\n };\n const thisTriggerRef = (elem: null | HTMLElement) => {\n if (elem) {\n elementsByIndexRef.current[index] = elem;\n elementsByIdRef.current[item.id] = elem;\n } else {\n delete elementsByIndexRef.current[index];\n delete elementsByIdRef.current[item.id];\n }\n };\n return (\n <LegendItemTrigger\n key={index}\n {...handlers}\n ref={thisTriggerRef}\n onClick={(event) => {\n if (event.metaKey || event.ctrlKey) {\n onToggleItem(item.id);\n } else {\n onSelectItem(item.id);\n }\n }}\n isHighlighted={item.highlighted}\n someHighlighted={someHighlighted}\n itemId={item.id}\n label={item.name}\n visible={item.visible}\n marker={item.marker}\n />\n );\n })}\n </div>\n {tooltipContent && (\n <InternalChartTooltip\n trackRef={tooltipTrack}\n trackKey={tooltipTarget.id}\n container={null}\n dismissButton={false}\n onDismiss={() => {}}\n position={tooltipPosition}\n title={tooltipContent.header}\n onMouseEnter={() => showTooltip(tooltipTarget.id)}\n onMouseLeave={() => hideTooltip()}\n onBlur={() => hideTooltip()}\n footer={\n tooltipContent.footer && (\n <>\n <hr aria-hidden={true} />\n {tooltipContent.footer}\n </>\n )\n }\n >\n {tooltipContent.body}\n </InternalChartTooltip>\n )}\n </div>\n </SingleTabStopNavigationProvider>\n );\n};\n\nfunction getBoxTextAlignment(horizontalAlignment: LegendHorizontalAlignment): BoxProps.TextAlign {\n switch (horizontalAlignment) {\n case \"start\":\n return \"left\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"right\";\n }\n}\n\nconst LegendItemTrigger = forwardRef(\n (\n {\n isHighlighted,\n someHighlighted,\n itemId,\n label,\n marker,\n visible,\n onClick,\n triggerRef,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown,\n }: {\n isHighlighted?: boolean;\n someHighlighted?: boolean;\n itemId: string;\n label: string;\n marker?: React.ReactNode;\n visible: boolean;\n onClick: (event: React.MouseEvent) => void;\n onMarkerClick?: () => void;\n triggerRef?: Ref<HTMLElement>;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n onFocus?: () => void;\n onBlur?: (event: React.FocusEvent) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n },\n ref: Ref<HTMLButtonElement>,\n ) => {\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(ref, triggerRef, refObject);\n const { tabIndex } = useSingleTabStopNavigation(refObject);\n return (\n <button\n data-itemid={itemId}\n aria-pressed={visible}\n aria-current={isHighlighted}\n className={clsx(testClasses.item, styles.item, {\n [styles[\"item--inactive\"]]: !visible,\n [testClasses[\"hidden-item\"]]: !visible,\n [styles[\"item--dimmed\"]]: someHighlighted && !isHighlighted,\n [testClasses[\"dimmed-item\"]]: someHighlighted && !isHighlighted,\n })}\n ref={mergedRef}\n tabIndex={tabIndex}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n >\n {marker}\n <span className={styles[\"item-label\"]}>{label}</span>\n </button>\n );\n },\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/chart-legend/index.tsx"],"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gBV,EACD,GAA2B,EAC3B,EAAE;IACF,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAC3D,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAC3D,OAAO,CACL,iCACe,MAAM,kBACL,OAAO,kBACP,aAAa,EAC3B,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;YAC7C,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,OAAO;YACpC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,OAAO;YACtC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,aAAa;YAC3D,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,aAAa;SAChE,CAAC,EACF,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,aAEnB,MAAM,EACP,eAAM,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,YAAG,KAAK,GAAQ,IAC9C,CACV,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, Ref, useEffect, useMemo, useRef, useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport {\n circleIndex,\n handleKey,\n KeyCode,\n SingleTabStopNavigationAPI,\n SingleTabStopNavigationProvider,\n useMergeRefs,\n useSingleTabStopNavigation,\n} from \"@cloudscape-design/component-toolkit/internal\";\nimport Box, { BoxProps } from \"@cloudscape-design/components/box\";\nimport { InternalChartTooltip } from \"@cloudscape-design/components/internal/do-not-use/chart-tooltip\";\n\nimport { scrollIntoViewNearestContainer } from \"../../utils/dom\";\nimport { DebouncedCall } from \"../../utils/utils\";\nimport { GetLegendTooltipContentProps, LegendItem, LegendTooltipContent } from \"../interfaces\";\n\nimport styles from \"./styles.css.js\";\nimport testClasses from \"./test-classes/styles.css.js\";\n\nconst TOOLTIP_SHOW_DELAY = 300;\nconst TOOLTIP_BLUR_DELAY = 50;\nconst HIGHLIGHT_LOST_DELAY = 50;\nconst SCROLL_DELAY = 100;\n\nexport type LegendAlignment = \"horizontal\" | \"vertical\";\nexport type LegendHorizontalAlignment = \"start\" | \"center\" | \"end\";\n\nexport interface ChartLegendProps {\n items: readonly LegendItem[];\n legendTitle?: string;\n ariaLabel?: string;\n className?: string;\n actions?: React.ReactNode;\n someHighlighted: boolean;\n alignment: LegendAlignment;\n enableHorizontalScroll?: boolean;\n horizontalAlignment: LegendHorizontalAlignment;\n onToggleItem: (itemId: string) => void;\n onSelectItem: (itemId: string) => void;\n onItemHighlightEnter: (item: LegendItem) => void;\n onItemHighlightExit: () => void;\n getTooltipContent: (props: GetLegendTooltipContentProps) => null | LegendTooltipContent;\n}\n\nexport const ChartLegend = ({\n items,\n legendTitle,\n ariaLabel,\n actions,\n alignment,\n className,\n someHighlighted,\n onToggleItem,\n onSelectItem,\n onItemHighlightEnter,\n onItemHighlightExit,\n getTooltipContent,\n horizontalAlignment,\n enableHorizontalScroll,\n}: ChartLegendProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const elementsByIndexRef = useRef<Record<number, HTMLElement>>([]);\n const elementsByIdRef = useRef<Record<string, HTMLElement>>({});\n const tooltipRef = useRef<HTMLElement>(null);\n const highlightControl = useMemo(() => new DebouncedCall(), []);\n const scrollIntoViewControl = useMemo(() => new DebouncedCall(), []);\n const [selectedIndex, setSelectedIndex] = useState<number>(0);\n const [tooltipItemId, setTooltipItemId] = useState<string | null>(null);\n const { showTooltip, hideTooltip } = useMemo(() => {\n const control = new DebouncedCall();\n return {\n showTooltip(itemId: string) {\n control.call(() => setTooltipItemId(itemId), TOOLTIP_SHOW_DELAY);\n },\n hideTooltip(lock = false) {\n control.call(() => setTooltipItemId(null), TOOLTIP_BLUR_DELAY);\n if (lock) {\n control.lock(TOOLTIP_BLUR_DELAY);\n }\n },\n };\n }, []);\n\n useEffect(() => {\n if (!tooltipItemId) {\n return;\n }\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n hideTooltip(true);\n elementsByIdRef.current[tooltipItemId]?.focus();\n }\n };\n document.addEventListener(\"keydown\", onDocumentKeyDown, true);\n return () => {\n document.removeEventListener(\"keydown\", onDocumentKeyDown, true);\n };\n }, [items, tooltipItemId, hideTooltip]);\n const isMouseInContainer = useRef<boolean>(false);\n\n // Scrolling to the highlighted legend item.\n useEffect(() => {\n const highlightedIndex = items.findIndex((item) => item.highlighted);\n if (highlightedIndex === -1) {\n return;\n }\n scrollIntoViewControl.call(() => {\n if (isMouseInContainer.current) {\n return;\n }\n const element = elementsByIndexRef.current?.[highlightedIndex];\n if (!element) {\n return;\n }\n scrollIntoViewNearestContainer(element, { behavior: \"smooth\", scrollMode: \"if-needed\" });\n }, SCROLL_DELAY);\n }, [items, scrollIntoViewControl]);\n\n const showHighlight = (itemId: string) => {\n const item = items.find((item) => item.id === itemId);\n if (item?.visible) {\n highlightControl.cancelPrevious();\n onItemHighlightEnter(item);\n }\n };\n const clearHighlight = () => {\n highlightControl.call(onItemHighlightExit, HIGHLIGHT_LOST_DELAY);\n };\n\n const navigationAPI = useRef<SingleTabStopNavigationAPI>(null);\n\n function onFocus(index: number, itemId: string) {\n setSelectedIndex(index);\n navigationAPI.current!.updateFocusTarget();\n showHighlight(itemId);\n showTooltip(itemId);\n }\n\n function onBlur(event: React.FocusEvent) {\n navigationAPI.current!.updateFocusTarget();\n\n // Hide tooltip and clear highlight unless focus moves inside tooltip;\n if (tooltipRef.current && event.relatedTarget && !tooltipRef.current.contains(event.relatedTarget)) {\n clearHighlight();\n hideTooltip();\n }\n }\n\n function focusElement(index: number) {\n elementsByIndexRef.current[index]?.focus();\n }\n\n function onKeyDown(event: React.KeyboardEvent<HTMLElement>) {\n if (\n event.keyCode === KeyCode.right ||\n event.keyCode === KeyCode.left ||\n event.keyCode === KeyCode.up ||\n event.keyCode === KeyCode.down ||\n event.keyCode === KeyCode.home ||\n event.keyCode === KeyCode.end ||\n event.keyCode === KeyCode.escape\n ) {\n // Preventing default fixes an issue in Safari+VO when VO additionally interprets arrow keys as its commands.\n event.preventDefault();\n\n const range = [0, items.length - 1] as [number, number];\n\n handleKey(event, {\n onInlineStart: () => focusElement(circleIndex(selectedIndex - 1, range)),\n onInlineEnd: () => focusElement(circleIndex(selectedIndex + 1, range)),\n onBlockStart: () => focusElement(circleIndex(selectedIndex - 1, range)),\n onBlockEnd: () => focusElement(circleIndex(selectedIndex + 1, range)),\n onHome: () => focusElement(0),\n onEnd: () => focusElement(items.length - 1),\n onEscape: () => onItemHighlightExit(),\n });\n }\n }\n\n function getNextFocusTarget(): null | HTMLElement {\n if (containerRef.current) {\n const buttons: HTMLButtonElement[] = Array.from(containerRef.current.querySelectorAll(`.${styles.item}`));\n return buttons[selectedIndex] ?? null;\n }\n return null;\n }\n\n function onUnregisterActive(\n focusableElement: HTMLElement,\n navigationAPI: React.RefObject<{ getFocusTarget: () => HTMLElement | null }>,\n ) {\n const target = navigationAPI.current?.getFocusTarget();\n\n if (target && target.dataset.itemid !== focusableElement.dataset.itemid) {\n target.focus();\n }\n }\n\n useEffect(() => {\n navigationAPI.current!.updateFocusTarget();\n });\n\n const isVertical = alignment === \"vertical\";\n\n const tooltipTrack = useRef<null | HTMLElement>(null);\n const tooltipTarget = items.find((item) => item.id === tooltipItemId) ?? null;\n tooltipTrack.current = tooltipItemId ? elementsByIdRef.current[tooltipItemId] : null;\n const tooltipContent = tooltipTarget && getTooltipContent({ legendItem: tooltipTarget });\n const tooltipPosition = isVertical ? \"left\" : \"bottom\";\n\n return (\n <SingleTabStopNavigationProvider\n ref={navigationAPI}\n navigationActive={true}\n getNextFocusTarget={() => getNextFocusTarget()}\n onUnregisterActive={(element: HTMLElement) => onUnregisterActive(element, navigationAPI)}\n >\n <div\n role=\"toolbar\"\n aria-label={legendTitle || ariaLabel}\n className={clsx(testClasses.root, styles.root, className)}\n onMouseEnter={() => (isMouseInContainer.current = true)}\n onMouseLeave={() => (isMouseInContainer.current = false)}\n >\n {legendTitle && (\n <Box fontWeight=\"bold\" className={testClasses.title} textAlign={getBoxTextAlignment(horizontalAlignment)}>\n {legendTitle}\n </Box>\n )}\n <div\n // The list element is not focusable. However, the focus lands on it regardless, when testing in Firefox.\n // Setting the tab index to -1 does fix the problem.\n tabIndex={-1}\n ref={containerRef}\n className={clsx(styles.list, {\n [styles[`list-bottom-${horizontalAlignment}`]]: !isVertical,\n [styles[\"list-horizontal-scroll\"]]: enableHorizontalScroll,\n [styles[\"list-bottom\"]]: !isVertical,\n [styles[\"list-side\"]]: isVertical,\n })}\n >\n {actions && (\n <>\n <div className={clsx(testClasses.actions, styles.actions, styles[\"actions-bottom\"])}>\n {actions}\n {!isVertical && <div className={styles[\"actions-divider-bottom\"]} />}\n </div>\n {isVertical && <div className={styles[\"actions-divider-side\"]} />}\n </>\n )}\n {items.map((item, index) => {\n const handlers = {\n onMouseEnter: () => {\n showHighlight(item.id);\n showTooltip(item.id);\n },\n onMouseLeave: () => {\n clearHighlight();\n hideTooltip();\n },\n onFocus: () => {\n onFocus(index, item.id);\n },\n onBlur: (event: React.FocusEvent) => {\n onBlur(event);\n },\n onKeyDown,\n };\n const thisTriggerRef = (elem: null | HTMLElement) => {\n if (elem) {\n elementsByIndexRef.current[index] = elem;\n elementsByIdRef.current[item.id] = elem;\n } else {\n delete elementsByIndexRef.current[index];\n delete elementsByIdRef.current[item.id];\n }\n };\n return (\n <LegendItemTrigger\n key={index}\n {...handlers}\n ref={thisTriggerRef}\n onClick={(event) => {\n if (event.metaKey || event.ctrlKey) {\n onToggleItem(item.id);\n } else {\n onSelectItem(item.id);\n }\n }}\n isHighlighted={item.highlighted}\n someHighlighted={someHighlighted}\n itemId={item.id}\n label={item.name}\n visible={item.visible}\n marker={item.marker}\n />\n );\n })}\n </div>\n {tooltipContent && (\n <InternalChartTooltip\n trackRef={tooltipTrack}\n triggerClampRef={containerRef}\n trackKey={tooltipTarget.id}\n container={null}\n dismissButton={false}\n onDismiss={() => {}}\n position={tooltipPosition}\n title={tooltipContent.header}\n onMouseEnter={() => showTooltip(tooltipTarget.id)}\n onMouseLeave={() => hideTooltip()}\n onBlur={() => hideTooltip()}\n footer={\n tooltipContent.footer && (\n <>\n <hr aria-hidden={true} />\n {tooltipContent.footer}\n </>\n )\n }\n >\n {tooltipContent.body}\n </InternalChartTooltip>\n )}\n </div>\n </SingleTabStopNavigationProvider>\n );\n};\n\nfunction getBoxTextAlignment(horizontalAlignment: LegendHorizontalAlignment): BoxProps.TextAlign {\n switch (horizontalAlignment) {\n case \"start\":\n return \"left\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"right\";\n }\n}\n\nconst LegendItemTrigger = forwardRef(\n (\n {\n isHighlighted,\n someHighlighted,\n itemId,\n label,\n marker,\n visible,\n onClick,\n triggerRef,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown,\n }: {\n isHighlighted?: boolean;\n someHighlighted?: boolean;\n itemId: string;\n label: string;\n marker?: React.ReactNode;\n visible: boolean;\n onClick: (event: React.MouseEvent) => void;\n onMarkerClick?: () => void;\n triggerRef?: Ref<HTMLElement>;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n onFocus?: () => void;\n onBlur?: (event: React.FocusEvent) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n },\n ref: Ref<HTMLButtonElement>,\n ) => {\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(ref, triggerRef, refObject);\n const { tabIndex } = useSingleTabStopNavigation(refObject);\n return (\n <button\n data-itemid={itemId}\n aria-pressed={visible}\n aria-current={isHighlighted}\n className={clsx(testClasses.item, styles.item, {\n [styles[\"item--inactive\"]]: !visible,\n [testClasses[\"hidden-item\"]]: !visible,\n [styles[\"item--dimmed\"]]: someHighlighted && !isHighlighted,\n [testClasses[\"dimmed-item\"]]: someHighlighted && !isHighlighted,\n })}\n ref={mergedRef}\n tabIndex={tabIndex}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n >\n {marker}\n <span className={styles[\"item-label\"]}>{label}</span>\n </button>\n );\n },\n);\n"]}
@@ -1,22 +1,23 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "focus-outline": "awsui_focus-outline_1kjc7_wcvbv_15",
5
- "item": "awsui_item_1kjc7_wcvbv_27",
6
- "root": "awsui_root_1kjc7_wcvbv_41",
7
- "list": "awsui_list_1kjc7_wcvbv_86",
8
- "list-bottom": "awsui_list-bottom_1kjc7_wcvbv_97",
9
- "list-bottom-start": "awsui_list-bottom-start_1kjc7_wcvbv_101",
10
- "list-bottom-center": "awsui_list-bottom-center_1kjc7_wcvbv_104",
11
- "list-bottom-end": "awsui_list-bottom-end_1kjc7_wcvbv_107",
12
- "list-side": "awsui_list-side_1kjc7_wcvbv_111",
13
- "item--inactive": "awsui_item--inactive_1kjc7_wcvbv_181",
14
- "item--dimmed": "awsui_item--dimmed_1kjc7_wcvbv_187",
15
- "item-label": "awsui_item-label_1kjc7_wcvbv_191",
16
- "actions": "awsui_actions_1kjc7_wcvbv_201",
17
- "actions-bottom": "awsui_actions-bottom_1kjc7_wcvbv_206",
18
- "actions-side": "awsui_actions-side_1kjc7_wcvbv_210",
19
- "actions-divider-bottom": "awsui_actions-divider-bottom_1kjc7_wcvbv_215",
20
- "actions-divider-side": "awsui_actions-divider-side_1kjc7_wcvbv_222"
4
+ "focus-outline": "awsui_focus-outline_1kjc7_1vywc_15",
5
+ "item": "awsui_item_1kjc7_1vywc_27",
6
+ "root": "awsui_root_1kjc7_1vywc_41",
7
+ "list": "awsui_list_1kjc7_1vywc_86",
8
+ "list-bottom": "awsui_list-bottom_1kjc7_1vywc_97",
9
+ "list-bottom-start": "awsui_list-bottom-start_1kjc7_1vywc_101",
10
+ "list-bottom-center": "awsui_list-bottom-center_1kjc7_1vywc_104",
11
+ "list-bottom-end": "awsui_list-bottom-end_1kjc7_1vywc_107",
12
+ "list-side": "awsui_list-side_1kjc7_1vywc_111",
13
+ "item--inactive": "awsui_item--inactive_1kjc7_1vywc_181",
14
+ "item--dimmed": "awsui_item--dimmed_1kjc7_1vywc_187",
15
+ "item-label": "awsui_item-label_1kjc7_1vywc_191",
16
+ "list-horizontal-scroll": "awsui_list-horizontal-scroll_1kjc7_1vywc_201",
17
+ "actions": "awsui_actions_1kjc7_1vywc_205",
18
+ "actions-bottom": "awsui_actions-bottom_1kjc7_1vywc_210",
19
+ "actions-side": "awsui_actions-side_1kjc7_1vywc_214",
20
+ "actions-divider-bottom": "awsui_actions-divider-bottom_1kjc7_1vywc_219",
21
+ "actions-divider-side": "awsui_actions-divider-side_1kjc7_1vywc_226"
21
22
  };
22
23
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
  /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
14
14
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
15
- body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_wcvbv_15:not(#\9) {
15
+ body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_1vywc_15:not(#\9) {
16
16
  stroke: var(--color-border-item-focused-uk47pl, #006ce0);
17
17
  }
18
18
 
@@ -24,21 +24,21 @@ body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_wcvbv_15:not(#\9)
24
24
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
25
25
  SPDX-License-Identifier: Apache-2.0
26
26
  */
27
- .awsui_item_1kjc7_wcvbv_27:not(#\9) {
27
+ .awsui_item_1kjc7_1vywc_27:not(#\9) {
28
28
  transition: opacity 90ms linear;
29
29
  }
30
30
  @media (prefers-reduced-motion: reduce) {
31
- .awsui_item_1kjc7_wcvbv_27:not(#\9) {
31
+ .awsui_item_1kjc7_1vywc_27:not(#\9) {
32
32
  animation: none;
33
33
  transition: none;
34
34
  }
35
35
  }
36
- .awsui-motion-disabled .awsui_item_1kjc7_wcvbv_27:not(#\9), .awsui-mode-entering .awsui_item_1kjc7_wcvbv_27:not(#\9) {
36
+ .awsui-motion-disabled .awsui_item_1kjc7_1vywc_27:not(#\9), .awsui-mode-entering .awsui_item_1kjc7_1vywc_27:not(#\9) {
37
37
  animation: none;
38
38
  transition: none;
39
39
  }
40
40
 
41
- .awsui_root_1kjc7_wcvbv_41:not(#\9) {
41
+ .awsui_root_1kjc7_1vywc_41:not(#\9) {
42
42
  border-collapse: separate;
43
43
  border-spacing: 0;
44
44
  box-sizing: border-box;
@@ -79,11 +79,11 @@ body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_wcvbv_15:not(#\9)
79
79
  inline-size: 100%;
80
80
  max-block-size: inherit;
81
81
  }
82
- .awsui_root_1kjc7_wcvbv_41:not(#\9):focus {
82
+ .awsui_root_1kjc7_1vywc_41:not(#\9):focus {
83
83
  outline: none;
84
84
  }
85
85
 
86
- .awsui_list_1kjc7_wcvbv_86:not(#\9) {
86
+ .awsui_list_1kjc7_1vywc_86:not(#\9) {
87
87
  display: flex;
88
88
  overflow-y: auto;
89
89
  list-style: none;
@@ -94,27 +94,27 @@ body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_wcvbv_15:not(#\9)
94
94
  margin-block-start: var(--space-scaled-xs-xwoogq, 8px);
95
95
  }
96
96
 
97
- .awsui_list-bottom_1kjc7_wcvbv_97:not(#\9) {
97
+ .awsui_list-bottom_1kjc7_1vywc_97:not(#\9) {
98
98
  flex-wrap: wrap;
99
99
  gap: var(--space-scaled-xxs-pfm1nx, 4px) var(--space-static-xl-4tedi6, 24px);
100
100
  }
101
- .awsui_list-bottom_1kjc7_wcvbv_97.awsui_list-bottom-start_1kjc7_wcvbv_101:not(#\9) {
101
+ .awsui_list-bottom_1kjc7_1vywc_97.awsui_list-bottom-start_1kjc7_1vywc_101:not(#\9) {
102
102
  justify-content: start;
103
103
  }
104
- .awsui_list-bottom_1kjc7_wcvbv_97.awsui_list-bottom-center_1kjc7_wcvbv_104:not(#\9) {
104
+ .awsui_list-bottom_1kjc7_1vywc_97.awsui_list-bottom-center_1kjc7_1vywc_104:not(#\9) {
105
105
  justify-content: center;
106
106
  }
107
- .awsui_list-bottom_1kjc7_wcvbv_97.awsui_list-bottom-end_1kjc7_wcvbv_107:not(#\9) {
107
+ .awsui_list-bottom_1kjc7_1vywc_97.awsui_list-bottom-end_1kjc7_1vywc_107:not(#\9) {
108
108
  justify-content: end;
109
109
  }
110
110
 
111
- .awsui_list-side_1kjc7_wcvbv_111:not(#\9) {
111
+ .awsui_list-side_1kjc7_1vywc_111:not(#\9) {
112
112
  flex-wrap: nowrap;
113
113
  flex-direction: column;
114
114
  gap: var(--space-scaled-xxs-pfm1nx, 4px) var(--space-static-m-m6qboo, 16px);
115
115
  }
116
116
 
117
- .awsui_item_1kjc7_wcvbv_27:not(#\9) {
117
+ .awsui_item_1kjc7_1vywc_27:not(#\9) {
118
118
  border-collapse: separate;
119
119
  border-spacing: 0;
120
120
  box-sizing: border-box;
@@ -157,16 +157,16 @@ body[data-awsui-focus-visible=true] .awsui_focus-outline_1kjc7_wcvbv_15:not(#\9)
157
157
  opacity: 1;
158
158
  max-inline-size: 100%;
159
159
  }
160
- .awsui_item_1kjc7_wcvbv_27:not(#\9):focus {
160
+ .awsui_item_1kjc7_1vywc_27:not(#\9):focus {
161
161
  outline: none;
162
162
  }
163
- body[data-awsui-focus-visible=true] .awsui_item_1kjc7_wcvbv_27:not(#\9):focus {
163
+ body[data-awsui-focus-visible=true] .awsui_item_1kjc7_1vywc_27:not(#\9):focus {
164
164
  position: relative;
165
165
  box-sizing: border-box;
166
166
  outline: 2px dotted transparent;
167
167
  outline-offset: 1px;
168
168
  }
169
- body[data-awsui-focus-visible=true] .awsui_item_1kjc7_wcvbv_27:not(#\9):focus::before {
169
+ body[data-awsui-focus-visible=true] .awsui_item_1kjc7_1vywc_27:not(#\9):focus::before {
170
170
  content: " ";
171
171
  display: block;
172
172
  position: absolute;
@@ -178,17 +178,17 @@ body[data-awsui-focus-visible=true] .awsui_item_1kjc7_wcvbv_27:not(#\9):focus::b
178
178
  border-radius: var(--border-radius-control-default-focus-ring-1uabki, 4px);
179
179
  border: 2px solid var(--color-border-item-focused-uk47pl, #006ce0);
180
180
  }
181
- .awsui_item_1kjc7_wcvbv_27.awsui_item--inactive_1kjc7_wcvbv_181:not(#\9) {
181
+ .awsui_item_1kjc7_1vywc_27.awsui_item--inactive_1kjc7_1vywc_181:not(#\9) {
182
182
  color: var(--color-text-interactive-default-ugh9wp, #424650);
183
183
  text-decoration: line-through;
184
184
  text-decoration-thickness: 2px;
185
185
  text-decoration-color: var(--color-text-interactive-default-ugh9wp, #424650);
186
186
  }
187
- .awsui_item_1kjc7_wcvbv_27.awsui_item--dimmed_1kjc7_wcvbv_187:not(#\9) {
187
+ .awsui_item_1kjc7_1vywc_27.awsui_item--dimmed_1kjc7_1vywc_187:not(#\9) {
188
188
  opacity: 0.35;
189
189
  }
190
190
 
191
- .awsui_item-label_1kjc7_wcvbv_191:not(#\9) {
191
+ .awsui_item-label_1kjc7_1vywc_191:not(#\9) {
192
192
  overflow: hidden;
193
193
  white-space: nowrap;
194
194
  text-overflow: ellipsis;
@@ -198,28 +198,32 @@ body[data-awsui-focus-visible=true] .awsui_item_1kjc7_wcvbv_27:not(#\9):focus::b
198
198
  -webkit-box-orient: vertical;
199
199
  }
200
200
 
201
- .awsui_actions_1kjc7_wcvbv_201:not(#\9) {
201
+ .awsui_list-horizontal-scroll_1kjc7_1vywc_201 .awsui_item-label_1kjc7_1vywc_191:not(#\9) {
202
+ overflow: visible;
203
+ }
204
+
205
+ .awsui_actions_1kjc7_1vywc_205:not(#\9) {
202
206
  display: flex;
203
207
  align-items: center;
204
208
  }
205
209
 
206
- .awsui_actions-bottom_1kjc7_wcvbv_206:not(#\9) {
210
+ .awsui_actions-bottom_1kjc7_1vywc_210:not(#\9) {
207
211
  flex-direction: row;
208
212
  }
209
213
 
210
- .awsui_actions-side_1kjc7_wcvbv_210:not(#\9) {
214
+ .awsui_actions-side_1kjc7_1vywc_214:not(#\9) {
211
215
  flex-direction: column;
212
216
  align-items: flex-start;
213
217
  }
214
218
 
215
- .awsui_actions-divider-bottom_1kjc7_wcvbv_215:not(#\9) {
219
+ .awsui_actions-divider-bottom_1kjc7_1vywc_219:not(#\9) {
216
220
  inline-size: 1px;
217
221
  block-size: 80%;
218
222
  margin-inline: var(--space-scaled-xs-xwoogq, 8px);
219
223
  background: var(--color-border-divider-default-nr68jt, #c6c6cd);
220
224
  }
221
225
 
222
- .awsui_actions-divider-side_1kjc7_wcvbv_222:not(#\9) {
226
+ .awsui_actions-divider-side_1kjc7_1vywc_226:not(#\9) {
223
227
  display: block;
224
228
  border: 0;
225
229
  padding: 0;
@@ -2,22 +2,23 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "focus-outline": "awsui_focus-outline_1kjc7_wcvbv_15",
6
- "item": "awsui_item_1kjc7_wcvbv_27",
7
- "root": "awsui_root_1kjc7_wcvbv_41",
8
- "list": "awsui_list_1kjc7_wcvbv_86",
9
- "list-bottom": "awsui_list-bottom_1kjc7_wcvbv_97",
10
- "list-bottom-start": "awsui_list-bottom-start_1kjc7_wcvbv_101",
11
- "list-bottom-center": "awsui_list-bottom-center_1kjc7_wcvbv_104",
12
- "list-bottom-end": "awsui_list-bottom-end_1kjc7_wcvbv_107",
13
- "list-side": "awsui_list-side_1kjc7_wcvbv_111",
14
- "item--inactive": "awsui_item--inactive_1kjc7_wcvbv_181",
15
- "item--dimmed": "awsui_item--dimmed_1kjc7_wcvbv_187",
16
- "item-label": "awsui_item-label_1kjc7_wcvbv_191",
17
- "actions": "awsui_actions_1kjc7_wcvbv_201",
18
- "actions-bottom": "awsui_actions-bottom_1kjc7_wcvbv_206",
19
- "actions-side": "awsui_actions-side_1kjc7_wcvbv_210",
20
- "actions-divider-bottom": "awsui_actions-divider-bottom_1kjc7_wcvbv_215",
21
- "actions-divider-side": "awsui_actions-divider-side_1kjc7_wcvbv_222"
5
+ "focus-outline": "awsui_focus-outline_1kjc7_1vywc_15",
6
+ "item": "awsui_item_1kjc7_1vywc_27",
7
+ "root": "awsui_root_1kjc7_1vywc_41",
8
+ "list": "awsui_list_1kjc7_1vywc_86",
9
+ "list-bottom": "awsui_list-bottom_1kjc7_1vywc_97",
10
+ "list-bottom-start": "awsui_list-bottom-start_1kjc7_1vywc_101",
11
+ "list-bottom-center": "awsui_list-bottom-center_1kjc7_1vywc_104",
12
+ "list-bottom-end": "awsui_list-bottom-end_1kjc7_1vywc_107",
13
+ "list-side": "awsui_list-side_1kjc7_1vywc_111",
14
+ "item--inactive": "awsui_item--inactive_1kjc7_1vywc_181",
15
+ "item--dimmed": "awsui_item--dimmed_1kjc7_1vywc_187",
16
+ "item-label": "awsui_item-label_1kjc7_1vywc_191",
17
+ "list-horizontal-scroll": "awsui_list-horizontal-scroll_1kjc7_1vywc_201",
18
+ "actions": "awsui_actions_1kjc7_1vywc_205",
19
+ "actions-bottom": "awsui_actions-bottom_1kjc7_1vywc_210",
20
+ "actions-side": "awsui_actions-side_1kjc7_1vywc_214",
21
+ "actions-divider-bottom": "awsui_actions-divider-bottom_1kjc7_1vywc_219",
22
+ "actions-divider-side": "awsui_actions-divider-side_1kjc7_1vywc_226"
22
23
  };
23
24
 
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chart-components";
2
- export var PACKAGE_VERSION = "1.0.0 (ab878c82)";
2
+ export var PACKAGE_VERSION = "1.0.0 (481a071a)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
  export var SYSTEM = "core";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "chart-components",
3
- "PACKAGE_VERSION": "1.0.0 (ab878c82)",
3
+ "PACKAGE_VERSION": "1.0.0 (481a071a)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true,
6
6
  "SYSTEM": "core"
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "ab878c821362b3db0512094aa1d9f8f248482150"
2
+ "commit": "481a071a40d21643144ba0fb4c511d23937bcabb"
3
3
  }
@@ -1,2 +1,2 @@
1
1
  import { CoreLegendProps } from "../../core/interfaces";
2
- export declare const CoreLegend: ({ items, title, actions, ariaLabel: legendAriaLabel, alignment, onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, horizontalAlignment, }: CoreLegendProps) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const CoreLegend: ({ items, title, actions, ariaLabel: legendAriaLabel, alignment, onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment, }: CoreLegendProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { useInternalI18n } from "@cloudscape-design/components/internal/do-not-use/i18n";
5
5
  import { ChartLegend as ChartLegendComponent } from "../../internal/components/chart-legend";
6
6
  import { fireNonCancelableEvent } from "../../internal/events";
7
- export const CoreLegend = ({ items, title, actions, ariaLabel: legendAriaLabel, alignment = "horizontal", onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, horizontalAlignment = "start", }) => {
7
+ export const CoreLegend = ({ items, title, actions, ariaLabel: legendAriaLabel, alignment = "horizontal", onItemHighlight, onClearHighlight, onVisibleItemsChange, getLegendTooltipContent, enableHorizontalScroll, horizontalAlignment = "start", }) => {
8
8
  const i18n = useInternalI18n("[charts]");
9
9
  const ariaLabel = i18n("i18nStrings.legendAriaLabel", legendAriaLabel);
10
10
  const onToggleItem = (itemId) => {
@@ -44,6 +44,6 @@ export const CoreLegend = ({ items, title, actions, ariaLabel: legendAriaLabel,
44
44
  if (items.length === 0) {
45
45
  return null;
46
46
  }
47
- return (_jsx(ChartLegendComponent, { items: items, actions: actions, legendTitle: title, alignment: alignment, horizontalAlignment: horizontalAlignment, ariaLabel: ariaLabel, someHighlighted: items.some((item) => item.highlighted), onToggleItem: onToggleItem, onSelectItem: onSelectItem, getTooltipContent: (props) => { var _a; return (_a = getLegendTooltipContent === null || getLegendTooltipContent === void 0 ? void 0 : getLegendTooltipContent(props)) !== null && _a !== void 0 ? _a : null; }, onItemHighlightExit: () => fireNonCancelableEvent(onClearHighlight), onItemHighlightEnter: (item) => fireNonCancelableEvent(onItemHighlight, { item }) }));
47
+ return (_jsx(ChartLegendComponent, { items: items, actions: actions, legendTitle: title, alignment: alignment, horizontalAlignment: horizontalAlignment, enableHorizontalScroll: enableHorizontalScroll, ariaLabel: ariaLabel, someHighlighted: items.some((item) => item.highlighted), onToggleItem: onToggleItem, onSelectItem: onSelectItem, getTooltipContent: (props) => { var _a; return (_a = getLegendTooltipContent === null || getLegendTooltipContent === void 0 ? void 0 : getLegendTooltipContent(props)) !== null && _a !== void 0 ? _a : null; }, onItemHighlightExit: () => fireNonCancelableEvent(onClearHighlight), onItemHighlightEnter: (item) => fireNonCancelableEvent(onItemHighlight, { item }) }));
48
48
  };
49
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-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OAAA,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAA,EAAA,EACtE,mBAAmB,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EACnE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,GACjF,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useInternalI18n } from \"@cloudscape-design/components/internal/do-not-use/i18n\";\n\nimport { CoreLegendProps } from \"../../core/interfaces\";\nimport { ChartLegend as ChartLegendComponent } from \"../../internal/components/chart-legend\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\n\nexport const CoreLegend = ({\n items,\n title,\n actions,\n ariaLabel: legendAriaLabel,\n alignment = \"horizontal\",\n onItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n getLegendTooltipContent,\n horizontalAlignment = \"start\",\n}: CoreLegendProps) => {\n const i18n = useInternalI18n(\"[charts]\");\n const ariaLabel = i18n(\"i18nStrings.legendAriaLabel\", legendAriaLabel);\n\n const onToggleItem = (itemId: string) => {\n const visibleItems = items.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.includes(itemId)) {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: visibleItems.filter((visibleItemId) => visibleItemId !== itemId),\n interactionType: \"toggle\",\n targetItemId: itemId,\n });\n } else {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: [...visibleItems, itemId],\n interactionType: \"toggle\",\n targetItemId: itemId,\n });\n }\n };\n\n const onSelectItem = (itemId: string) => {\n const visibleItems = items.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.length === 1 && visibleItems[0] === itemId) {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: items.map((i) => i.id),\n interactionType: \"select\",\n targetItemId: itemId,\n });\n } else {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: [itemId],\n interactionType: \"select\",\n targetItemId: itemId,\n });\n }\n };\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <ChartLegendComponent\n items={items}\n actions={actions}\n legendTitle={title}\n alignment={alignment}\n horizontalAlignment={horizontalAlignment}\n ariaLabel={ariaLabel}\n someHighlighted={items.some((item) => item.highlighted)}\n onToggleItem={onToggleItem}\n onSelectItem={onSelectItem}\n getTooltipContent={(props) => getLegendTooltipContent?.(props) ?? null}\n onItemHighlightExit={() => fireNonCancelableEvent(onClearHighlight)}\n onItemHighlightEnter={(item) => fireNonCancelableEvent(onItemHighlight, { item })}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-legend/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAGzF,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EAAE,eAAe,EAC1B,SAAS,GAAG,YAAY,EACxB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,GAAG,OAAO,GACb,EAAE,EAAE;IACpB,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,6BAA6B,EAAE,eAAe,CAAC,CAAC;IAEvE,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE;QACtC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC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ACzB,YAAY,EAAE,MAAM;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EACvD,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAG,KAAK,CAAC,mCAAI,IAAI,CAAA,EAAA,EACtE,mBAAmB,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EACnE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,GACjF,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useInternalI18n } from \"@cloudscape-design/components/internal/do-not-use/i18n\";\n\nimport { CoreLegendProps } from \"../../core/interfaces\";\nimport { ChartLegend as ChartLegendComponent } from \"../../internal/components/chart-legend\";\nimport { fireNonCancelableEvent } from \"../../internal/events\";\n\nexport const CoreLegend = ({\n items,\n title,\n actions,\n ariaLabel: legendAriaLabel,\n alignment = \"horizontal\",\n onItemHighlight,\n onClearHighlight,\n onVisibleItemsChange,\n getLegendTooltipContent,\n enableHorizontalScroll,\n horizontalAlignment = \"start\",\n}: CoreLegendProps) => {\n const i18n = useInternalI18n(\"[charts]\");\n const ariaLabel = i18n(\"i18nStrings.legendAriaLabel\", legendAriaLabel);\n\n const onToggleItem = (itemId: string) => {\n const visibleItems = items.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.includes(itemId)) {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: visibleItems.filter((visibleItemId) => visibleItemId !== itemId),\n interactionType: \"toggle\",\n targetItemId: itemId,\n });\n } else {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: [...visibleItems, itemId],\n interactionType: \"toggle\",\n targetItemId: itemId,\n });\n }\n };\n\n const onSelectItem = (itemId: string) => {\n const visibleItems = items.filter((i) => i.visible).map((i) => i.id);\n if (visibleItems.length === 1 && visibleItems[0] === itemId) {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: items.map((i) => i.id),\n interactionType: \"select\",\n targetItemId: itemId,\n });\n } else {\n fireNonCancelableEvent(onVisibleItemsChange, {\n items: [itemId],\n interactionType: \"select\",\n targetItemId: itemId,\n });\n }\n };\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <ChartLegendComponent\n items={items}\n actions={actions}\n legendTitle={title}\n alignment={alignment}\n horizontalAlignment={horizontalAlignment}\n enableHorizontalScroll={enableHorizontalScroll}\n ariaLabel={ariaLabel}\n someHighlighted={items.some((item) => item.highlighted)}\n onToggleItem={onToggleItem}\n onSelectItem={onSelectItem}\n getTooltipContent={(props) => getLegendTooltipContent?.(props) ?? null}\n onItemHighlightExit={() => fireNonCancelableEvent(onClearHighlight)}\n onItemHighlightEnter={(item) => fireNonCancelableEvent(onItemHighlight, { item })}\n />\n );\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chart-components",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chart-components.git"