@cloudscape-design/components 3.0.487 → 3.0.489

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ export interface ChartSeriesDetailsProps extends BaseComponentProps {
18
18
  expandedSeries?: ExpandedSeries;
19
19
  setPopoverText?: (s: string) => void;
20
20
  setExpandedState?: (seriesTitle: string, state: boolean) => void;
21
+ compactList?: boolean;
21
22
  }
22
23
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChartSeriesDetailsProps & React.RefAttributes<HTMLDivElement>>>;
23
24
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/chart-series-details/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAA0B,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAMlF,UAAU,eAAe;IACvB,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;CAClB;AAUD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClE;;AAED,wBAAoD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/chart-series-details/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAoB,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AACxE,OAA0B,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAMlF,UAAU,eAAe;IACvB,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;CAClB;AAUD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AACD,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAEzC,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,OAAO,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACjE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;;AAED,wBAAoD"}
@@ -11,7 +11,7 @@ import getSeriesDetailsText from './series-details-text';
11
11
  import { useMergeRefs } from '../../hooks/use-merge-refs';
12
12
  export default memo(forwardRef(ChartSeriesDetails));
13
13
  function ChartSeriesDetails(_a, ref) {
14
- var { details, expandedSeries, setPopoverText, setExpandedState } = _a, restProps = __rest(_a, ["details", "expandedSeries", "setPopoverText", "setExpandedState"]);
14
+ var { details, expandedSeries, setPopoverText, setExpandedState, compactList } = _a, restProps = __rest(_a, ["details", "expandedSeries", "setPopoverText", "setExpandedState", "compactList"]);
15
15
  const baseProps = getBaseProps(restProps);
16
16
  const className = clsx(baseProps.className, styles.root);
17
17
  const detailsRef = useRef(null);
@@ -30,7 +30,7 @@ function ChartSeriesDetails(_a, ref) {
30
30
  }, [details, setPopoverText]);
31
31
  const isExpanded = (seriesTitle) => !!expandedSeries && expandedSeries.has(seriesTitle);
32
32
  return (React.createElement("div", Object.assign({}, baseProps, { className: className, ref: mergedRef }),
33
- React.createElement("ul", { className: styles.list }, details.map(({ key, value, markerType, color, isDimmed, subItems, expandableId }, index) => (React.createElement("li", { key: index, className: clsx({
33
+ React.createElement("ul", { className: clsx(styles.list, compactList && styles.compact) }, details.map(({ key, value, markerType, color, isDimmed, subItems, expandableId }, index) => (React.createElement("li", { key: index, className: clsx({
34
34
  [styles.dimmed]: isDimmed,
35
35
  [styles['list-item']]: true,
36
36
  [styles['with-sub-items']]: subItems === null || subItems === void 0 ? void 0 : subItems.length,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/chart-series-details/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAa,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,iBAA4C,MAAM,wBAAwB,CAAC;AAClF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,yBAAyB,MAAM,sCAAsC,CAAC;AAC7E,OA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,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAiB;IACzF,OAAO,CACL;QACE,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;YAC9D,6BAAK,SAAS,EAAE,MAAM,CAAC,GAAG;gBACvB,UAAU,IAAI,KAAK,IAAI,oBAAC,iBAAiB,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI;gBAC7E,kCAAO,OAAO,CAAQ,CAClB;YACN,8BAAM,SAAS,EAAE,MAAM,CAAC,KAAK,IAAG,KAAK,CAAQ,CACzC;QACL,QAAQ,IAAI,oBAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,GAAI,CACzC,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, memo, ReactNode, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport ChartSeriesMarker, { ChartSeriesMarkerType } from '../chart-series-marker';\nimport styles from './styles.css.js';\nimport InternalExpandableSection from '../../../expandable-section/internal';\nimport getSeriesDetailsText from './series-details-text';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\n\ninterface ChartDetailPair {\n key: ReactNode;\n value: ReactNode;\n}\n\ninterface ListItemProps {\n itemKey: ReactNode;\n value: ReactNode;\n subItems?: ReadonlyArray<ChartDetailPair>;\n markerType?: ChartSeriesMarkerType;\n color?: string;\n}\n\nexport interface ChartSeriesDetailItem extends ChartDetailPair {\n markerType?: ChartSeriesMarkerType;\n color?: string;\n isDimmed?: boolean;\n subItems?: ReadonlyArray<ChartDetailPair>;\n expandableId?: string;\n}\nexport type ExpandedSeries = Set<string>;\n\nexport interface ChartSeriesDetailsProps extends BaseComponentProps {\n details: ReadonlyArray<ChartSeriesDetailItem>;\n expandedSeries?: ExpandedSeries;\n setPopoverText?: (s: string) => void;\n setExpandedState?: (seriesTitle: string, state: boolean) => void;\n}\n\nexport default memo(forwardRef(ChartSeriesDetails));\n\nfunction ChartSeriesDetails(\n { details, expandedSeries, setPopoverText, setExpandedState, ...restProps }: ChartSeriesDetailsProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const baseProps = getBaseProps(restProps);\n const className = clsx(baseProps.className, styles.root);\n const detailsRef = useRef<HTMLDivElement | null>(null);\n const mergedRef = useMergeRefs(ref, detailsRef);\n\n // Once the component has rendered, pass its content in plain text\n // so that it can be used by screen readers.\n useEffect(() => {\n if (setPopoverText) {\n if (detailsRef.current) {\n setPopoverText(getSeriesDetailsText(detailsRef.current));\n }\n return () => {\n setPopoverText('');\n };\n }\n }, [details, setPopoverText]);\n\n const isExpanded = (seriesTitle: string) => !!expandedSeries && expandedSeries.has(seriesTitle);\n\n return (\n <div {...baseProps} className={className} ref={mergedRef}>\n <ul className={styles.list}>\n {details.map(({ key, value, markerType, color, isDimmed, subItems, expandableId }, index) => (\n <li\n key={index}\n className={clsx({\n [styles.dimmed]: isDimmed,\n [styles['list-item']]: true,\n [styles['with-sub-items']]: subItems?.length,\n [styles.expandable]: !!expandableId,\n })}\n >\n {subItems?.length && !!expandableId ? (\n <ExpandableSeries\n itemKey={key}\n value={value}\n markerType={markerType}\n color={color}\n subItems={subItems}\n expanded={isExpanded(expandableId)}\n setExpandedState={state => setExpandedState && setExpandedState(expandableId, state)}\n />\n ) : (\n <NonExpandableSeries\n itemKey={key}\n value={value}\n markerType={markerType}\n color={color}\n subItems={subItems}\n />\n )}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction SubItems({\n items,\n expandable,\n expanded,\n}: {\n items: ReadonlyArray<ChartDetailPair>;\n expandable?: boolean;\n expanded?: boolean;\n}) {\n return (\n <ul className={clsx(styles['sub-items'], expandable && styles.expandable)}>\n {items.map(({ key, value }, index) => (\n <li\n key={index}\n className={clsx(\n styles['inner-list-item'],\n styles['key-value-pair'],\n (expanded || !expandable) && styles.announced\n )}\n >\n <span className={styles.key}>{key}</span>\n <span className={styles.value}>{value}</span>\n </li>\n ))}\n </ul>\n );\n}\n\nfunction ExpandableSeries({\n itemKey,\n value,\n subItems,\n markerType,\n color,\n expanded,\n setExpandedState,\n}: ListItemProps &\n Required<Pick<ListItemProps, 'subItems'>> & {\n expanded: boolean;\n setExpandedState: (state: boolean) => void;\n }) {\n return (\n <div className={styles['expandable-section']}>\n {markerType && color && <ChartSeriesMarker type={markerType} color={color} />}\n <div className={styles['full-width']}>\n <InternalExpandableSection\n variant=\"compact\"\n headerText={itemKey}\n headerActions={<span className={clsx(styles.value, styles.expandable)}>{value}</span>}\n expanded={expanded}\n onChange={({ detail }) => setExpandedState(detail.expanded)}\n >\n <SubItems items={subItems} expandable={true} expanded={expanded} />\n </InternalExpandableSection>\n </div>\n </div>\n );\n}\n\nfunction NonExpandableSeries({ itemKey, value, subItems, markerType, color }: ListItemProps) {\n return (\n <>\n <div className={clsx(styles['key-value-pair'], styles.announced)}>\n <div className={styles.key}>\n {markerType && color && <ChartSeriesMarker type={markerType} color={color} />}\n <span>{itemKey}</span>\n </div>\n <span className={styles.value}>{value}</span>\n </div>\n {subItems && <SubItems items={subItems} />}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/chart-series-details/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAa,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,iBAA4C,MAAM,wBAAwB,CAAC;AAClF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,yBAAyB,MAAM,sCAAsC,CA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Q,EAAE,QAAQ,GAAI,CACzC,CACxB,CACF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAiB;IACzF,OAAO,CACL;QACE,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC;YAC9D,6BAAK,SAAS,EAAE,MAAM,CAAC,GAAG;gBACvB,UAAU,IAAI,KAAK,IAAI,oBAAC,iBAAiB,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI;gBAC7E,kCAAO,OAAO,CAAQ,CAClB;YACN,8BAAM,SAAS,EAAE,MAAM,CAAC,KAAK,IAAG,KAAK,CAAQ,CACzC;QACL,QAAQ,IAAI,oBAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,GAAI,CACzC,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, memo, ReactNode, useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { BaseComponentProps, getBaseProps } from '../../base-component';\nimport ChartSeriesMarker, { ChartSeriesMarkerType } from '../chart-series-marker';\nimport styles from './styles.css.js';\nimport InternalExpandableSection from '../../../expandable-section/internal';\nimport getSeriesDetailsText from './series-details-text';\nimport { useMergeRefs } from '../../hooks/use-merge-refs';\n\ninterface ChartDetailPair {\n key: ReactNode;\n value: ReactNode;\n}\n\ninterface ListItemProps {\n itemKey: ReactNode;\n value: ReactNode;\n subItems?: ReadonlyArray<ChartDetailPair>;\n markerType?: ChartSeriesMarkerType;\n color?: string;\n}\n\nexport interface ChartSeriesDetailItem extends ChartDetailPair {\n markerType?: ChartSeriesMarkerType;\n color?: string;\n isDimmed?: boolean;\n subItems?: ReadonlyArray<ChartDetailPair>;\n expandableId?: string;\n}\nexport type ExpandedSeries = Set<string>;\n\nexport interface ChartSeriesDetailsProps extends BaseComponentProps {\n details: ReadonlyArray<ChartSeriesDetailItem>;\n expandedSeries?: ExpandedSeries;\n setPopoverText?: (s: string) => void;\n setExpandedState?: (seriesTitle: string, state: boolean) => void;\n compactList?: boolean;\n}\n\nexport default memo(forwardRef(ChartSeriesDetails));\n\nfunction ChartSeriesDetails(\n { details, expandedSeries, setPopoverText, setExpandedState, compactList, ...restProps }: ChartSeriesDetailsProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const baseProps = getBaseProps(restProps);\n const className = clsx(baseProps.className, styles.root);\n const detailsRef = useRef<HTMLDivElement | null>(null);\n const mergedRef = useMergeRefs(ref, detailsRef);\n\n // Once the component has rendered, pass its content in plain text\n // so that it can be used by screen readers.\n useEffect(() => {\n if (setPopoverText) {\n if (detailsRef.current) {\n setPopoverText(getSeriesDetailsText(detailsRef.current));\n }\n return () => {\n setPopoverText('');\n };\n }\n }, [details, setPopoverText]);\n\n const isExpanded = (seriesTitle: string) => !!expandedSeries && expandedSeries.has(seriesTitle);\n\n return (\n <div {...baseProps} className={className} ref={mergedRef}>\n <ul className={clsx(styles.list, compactList && styles.compact)}>\n {details.map(({ key, value, markerType, color, isDimmed, subItems, expandableId }, index) => (\n <li\n key={index}\n className={clsx({\n [styles.dimmed]: isDimmed,\n [styles['list-item']]: true,\n [styles['with-sub-items']]: subItems?.length,\n [styles.expandable]: !!expandableId,\n })}\n >\n {subItems?.length && !!expandableId ? (\n <ExpandableSeries\n itemKey={key}\n value={value}\n markerType={markerType}\n color={color}\n subItems={subItems}\n expanded={isExpanded(expandableId)}\n setExpandedState={state => setExpandedState && setExpandedState(expandableId, state)}\n />\n ) : (\n <NonExpandableSeries\n itemKey={key}\n value={value}\n markerType={markerType}\n color={color}\n subItems={subItems}\n />\n )}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\nfunction SubItems({\n items,\n expandable,\n expanded,\n}: {\n items: ReadonlyArray<ChartDetailPair>;\n expandable?: boolean;\n expanded?: boolean;\n}) {\n return (\n <ul className={clsx(styles['sub-items'], expandable && styles.expandable)}>\n {items.map(({ key, value }, index) => (\n <li\n key={index}\n className={clsx(\n styles['inner-list-item'],\n styles['key-value-pair'],\n (expanded || !expandable) && styles.announced\n )}\n >\n <span className={styles.key}>{key}</span>\n <span className={styles.value}>{value}</span>\n </li>\n ))}\n </ul>\n );\n}\n\nfunction ExpandableSeries({\n itemKey,\n value,\n subItems,\n markerType,\n color,\n expanded,\n setExpandedState,\n}: ListItemProps &\n Required<Pick<ListItemProps, 'subItems'>> & {\n expanded: boolean;\n setExpandedState: (state: boolean) => void;\n }) {\n return (\n <div className={styles['expandable-section']}>\n {markerType && color && <ChartSeriesMarker type={markerType} color={color} />}\n <div className={styles['full-width']}>\n <InternalExpandableSection\n variant=\"compact\"\n headerText={itemKey}\n headerActions={<span className={clsx(styles.value, styles.expandable)}>{value}</span>}\n expanded={expanded}\n onChange={({ detail }) => setExpandedState(detail.expanded)}\n >\n <SubItems items={subItems} expandable={true} expanded={expanded} />\n </InternalExpandableSection>\n </div>\n </div>\n );\n}\n\nfunction NonExpandableSeries({ itemKey, value, subItems, markerType, color }: ListItemProps) {\n return (\n <>\n <div className={clsx(styles['key-value-pair'], styles.announced)}>\n <div className={styles.key}>\n {markerType && color && <ChartSeriesMarker type={markerType} color={color} />}\n <span>{itemKey}</span>\n </div>\n <span className={styles.value}>{value}</span>\n </div>\n {subItems && <SubItems items={subItems} />}\n </>\n );\n}\n"]}
@@ -1,24 +1,25 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "dimmed": "awsui_dimmed_10ipo_jyjn4_93",
5
- "marker": "awsui_marker_10ipo_jyjn4_122",
6
- "marker--line": "awsui_marker--line_10ipo_jyjn4_140",
7
- "marker--rectangle": "awsui_marker--rectangle_10ipo_jyjn4_144",
8
- "marker--hollow-rectangle": "awsui_marker--hollow-rectangle_10ipo_jyjn4_148",
9
- "marker--dashed": "awsui_marker--dashed_10ipo_jyjn4_160",
10
- "root": "awsui_root_10ipo_jyjn4_180",
11
- "value": "awsui_value_10ipo_jyjn4_193",
12
- "expandable": "awsui_expandable_10ipo_jyjn4_197",
13
- "list-item": "awsui_list-item_10ipo_jyjn4_201",
14
- "inner-list-item": "awsui_inner-list-item_10ipo_jyjn4_202",
15
- "key-value-pair": "awsui_key-value-pair_10ipo_jyjn4_207",
16
- "expandable-section": "awsui_expandable-section_10ipo_jyjn4_208",
17
- "key": "awsui_key_10ipo_jyjn4_207",
18
- "sub-items": "awsui_sub-items_10ipo_jyjn4_221",
19
- "list": "awsui_list_10ipo_jyjn4_201",
20
- "with-sub-items": "awsui_with-sub-items_10ipo_jyjn4_245",
21
- "full-width": "awsui_full-width_10ipo_jyjn4_250",
22
- "announced": "awsui_announced_10ipo_jyjn4_254"
4
+ "dimmed": "awsui_dimmed_10ipo_11ixz_93",
5
+ "marker": "awsui_marker_10ipo_11ixz_122",
6
+ "marker--line": "awsui_marker--line_10ipo_11ixz_140",
7
+ "marker--rectangle": "awsui_marker--rectangle_10ipo_11ixz_144",
8
+ "marker--hollow-rectangle": "awsui_marker--hollow-rectangle_10ipo_11ixz_148",
9
+ "marker--dashed": "awsui_marker--dashed_10ipo_11ixz_160",
10
+ "root": "awsui_root_10ipo_11ixz_180",
11
+ "value": "awsui_value_10ipo_11ixz_193",
12
+ "expandable": "awsui_expandable_10ipo_11ixz_197",
13
+ "list-item": "awsui_list-item_10ipo_11ixz_201",
14
+ "inner-list-item": "awsui_inner-list-item_10ipo_11ixz_202",
15
+ "key-value-pair": "awsui_key-value-pair_10ipo_11ixz_207",
16
+ "expandable-section": "awsui_expandable-section_10ipo_11ixz_208",
17
+ "key": "awsui_key_10ipo_11ixz_207",
18
+ "sub-items": "awsui_sub-items_10ipo_11ixz_221",
19
+ "list": "awsui_list_10ipo_11ixz_201",
20
+ "compact": "awsui_compact_10ipo_11ixz_245",
21
+ "with-sub-items": "awsui_with-sub-items_10ipo_11ixz_250",
22
+ "full-width": "awsui_full-width_10ipo_11ixz_255",
23
+ "announced": "awsui_announced_10ipo_11ixz_259"
23
24
  };
24
25
 
@@ -90,7 +90,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_dimmed_10ipo_jyjn4_93:not(#\9) {
93
+ .awsui_dimmed_10ipo_11ixz_93:not(#\9) {
94
94
  transition: opacity var(--motion-duration-transition-quick-6npj01, 90ms) var(--motion-easing-transition-quick-l9jfsx, linear);
95
95
  transition-delay: var(--motion-duration-transition-quick-6npj01, 90ms);
96
96
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
@@ -131,12 +131,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
131
131
  -moz-osx-font-smoothing: auto;
132
132
  }
133
133
  @media (prefers-reduced-motion: reduce) {
134
- .awsui_dimmed_10ipo_jyjn4_93:not(#\9) {
134
+ .awsui_dimmed_10ipo_11ixz_93:not(#\9) {
135
135
  animation: none;
136
136
  transition: none;
137
137
  }
138
138
  }
139
- .awsui-motion-disabled .awsui_dimmed_10ipo_jyjn4_93:not(#\9), .awsui-mode-entering .awsui_dimmed_10ipo_jyjn4_93:not(#\9) {
139
+ .awsui-motion-disabled .awsui_dimmed_10ipo_11ixz_93:not(#\9), .awsui-mode-entering .awsui_dimmed_10ipo_11ixz_93:not(#\9) {
140
140
  animation: none;
141
141
  transition: none;
142
142
  }
@@ -145,7 +145,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
145
145
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
146
146
  SPDX-License-Identifier: Apache-2.0
147
147
  */
148
- .awsui_marker_10ipo_jyjn4_122:not(#\9) {
148
+ .awsui_marker_10ipo_11ixz_122:not(#\9) {
149
149
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
150
150
  border-collapse: separate;
151
151
  border-spacing: 0;
@@ -189,19 +189,19 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
189
189
  flex-shrink: 0;
190
190
  cursor: inherit;
191
191
  }
192
- .awsui_marker--line_10ipo_jyjn4_140:not(#\9) {
192
+ .awsui_marker--line_10ipo_11ixz_140:not(#\9) {
193
193
  margin-top: 9px;
194
194
  height: 4px;
195
195
  }
196
- .awsui_marker--rectangle_10ipo_jyjn4_144:not(#\9) {
196
+ .awsui_marker--rectangle_10ipo_11ixz_144:not(#\9) {
197
197
  height: 14px;
198
198
  border-radius: 2px;
199
199
  }
200
- .awsui_marker--hollow-rectangle_10ipo_jyjn4_148:not(#\9) {
200
+ .awsui_marker--hollow-rectangle_10ipo_11ixz_148:not(#\9) {
201
201
  height: 14px;
202
202
  border-radius: 2px;
203
203
  }
204
- .awsui_marker--hollow-rectangle_10ipo_jyjn4_148:not(#\9)::after {
204
+ .awsui_marker--hollow-rectangle_10ipo_11ixz_148:not(#\9)::after {
205
205
  content: "";
206
206
  display: block;
207
207
  margin: 2px;
@@ -209,13 +209,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
209
209
  background-color: var(--color-background-container-content-4un1ap, #ffffff);
210
210
  opacity: 0.5;
211
211
  }
212
- .awsui_marker--dashed_10ipo_jyjn4_160:not(#\9) {
212
+ .awsui_marker--dashed_10ipo_11ixz_160:not(#\9) {
213
213
  height: 4px;
214
214
  width: 6px;
215
215
  margin-top: 9px;
216
216
  margin-right: 12px;
217
217
  }
218
- .awsui_marker--dashed_10ipo_jyjn4_160:not(#\9)::after {
218
+ .awsui_marker--dashed_10ipo_11ixz_160:not(#\9)::after {
219
219
  content: "";
220
220
  display: block;
221
221
  width: 6px;
@@ -229,7 +229,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
229
229
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
230
230
  SPDX-License-Identifier: Apache-2.0
231
231
  */
232
- .awsui_root_10ipo_jyjn4_180:not(#\9) {
232
+ .awsui_root_10ipo_11ixz_180:not(#\9) {
233
233
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
234
234
  border-collapse: separate;
235
235
  border-spacing: 0;
@@ -268,67 +268,72 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
268
268
  -moz-osx-font-smoothing: auto;
269
269
  }
270
270
 
271
- .awsui_value_10ipo_jyjn4_193:not(#\9) {
271
+ .awsui_value_10ipo_11ixz_193:not(#\9) {
272
272
  text-align: right;
273
273
  margin-inline-start: var(--space-xxl-cu2m1r, 32px);
274
274
  }
275
- .awsui_value_10ipo_jyjn4_193.awsui_expandable_10ipo_jyjn4_197:not(#\9) {
275
+ .awsui_value_10ipo_11ixz_193.awsui_expandable_10ipo_11ixz_197:not(#\9) {
276
276
  font-weight: var(--font-weight-heading-s-cwn6wc, 700);
277
277
  }
278
278
 
279
- .awsui_list-item_10ipo_jyjn4_201:not(#\9),
280
- .awsui_inner-list-item_10ipo_jyjn4_202:not(#\9) {
279
+ .awsui_list-item_10ipo_11ixz_201:not(#\9),
280
+ .awsui_inner-list-item_10ipo_11ixz_202:not(#\9) {
281
281
  list-style: none;
282
282
  }
283
283
 
284
- .awsui_inner-list-item_10ipo_jyjn4_202:not(#\9),
285
- .awsui_list-item_10ipo_jyjn4_201 > .awsui_key-value-pair_10ipo_jyjn4_207:not(#\9),
286
- .awsui_list-item_10ipo_jyjn4_201 > .awsui_expandable-section_10ipo_jyjn4_208:not(#\9) {
284
+ .awsui_inner-list-item_10ipo_11ixz_202:not(#\9),
285
+ .awsui_list-item_10ipo_11ixz_201 > .awsui_key-value-pair_10ipo_11ixz_207:not(#\9),
286
+ .awsui_list-item_10ipo_11ixz_201 > .awsui_expandable-section_10ipo_11ixz_208:not(#\9) {
287
287
  display: flex;
288
288
  flex-direction: row;
289
289
  justify-content: space-between;
290
290
  width: 100%;
291
291
  }
292
- .awsui_inner-list-item_10ipo_jyjn4_202 > .awsui_key_10ipo_jyjn4_207:not(#\9),
293
- .awsui_list-item_10ipo_jyjn4_201 > .awsui_key-value-pair_10ipo_jyjn4_207 > .awsui_key_10ipo_jyjn4_207:not(#\9),
294
- .awsui_list-item_10ipo_jyjn4_201 > .awsui_expandable-section_10ipo_jyjn4_208 > .awsui_key_10ipo_jyjn4_207:not(#\9) {
292
+ .awsui_inner-list-item_10ipo_11ixz_202 > .awsui_key_10ipo_11ixz_207:not(#\9),
293
+ .awsui_list-item_10ipo_11ixz_201 > .awsui_key-value-pair_10ipo_11ixz_207 > .awsui_key_10ipo_11ixz_207:not(#\9),
294
+ .awsui_list-item_10ipo_11ixz_201 > .awsui_expandable-section_10ipo_11ixz_208 > .awsui_key_10ipo_11ixz_207:not(#\9) {
295
295
  display: inline-flex;
296
296
  color: var(--color-text-group-label-jpw8sm, #414d5c);
297
297
  }
298
298
 
299
- .awsui_sub-items_10ipo_jyjn4_221:not(#\9):not(.awsui_expandable_10ipo_jyjn4_197) {
299
+ .awsui_sub-items_10ipo_11ixz_221:not(#\9):not(.awsui_expandable_10ipo_11ixz_197) {
300
300
  padding-inline-start: calc(14px + var(--space-xxs-p8yyaw, 4px));
301
301
  }
302
- .awsui_sub-items_10ipo_jyjn4_221.awsui_expandable_10ipo_jyjn4_197:not(#\9) {
302
+ .awsui_sub-items_10ipo_11ixz_221.awsui_expandable_10ipo_11ixz_197:not(#\9) {
303
303
  padding-inline-start: 0;
304
304
  }
305
- .awsui_sub-items_10ipo_jyjn4_221.awsui_expandable_10ipo_jyjn4_197 > .awsui_inner-list-item_10ipo_jyjn4_202 > .awsui_value_10ipo_jyjn4_193:not(#\9) {
305
+ .awsui_sub-items_10ipo_11ixz_221.awsui_expandable_10ipo_11ixz_197 > .awsui_inner-list-item_10ipo_11ixz_202 > .awsui_value_10ipo_11ixz_193:not(#\9) {
306
306
  white-space: nowrap;
307
307
  }
308
308
 
309
- .awsui_list_10ipo_jyjn4_201:not(#\9) {
309
+ .awsui_list_10ipo_11ixz_201:not(#\9) {
310
310
  display: flex;
311
311
  margin: 0;
312
312
  padding: 0;
313
313
  list-style: none;
314
314
  flex-direction: column;
315
315
  }
316
- .awsui_list_10ipo_jyjn4_201 > .awsui_list-item_10ipo_jyjn4_201 > .awsui_key-value-pair_10ipo_jyjn4_207 > .awsui_key_10ipo_jyjn4_207:not(#\9) {
316
+ .awsui_list_10ipo_11ixz_201 > .awsui_list-item_10ipo_11ixz_201 > .awsui_key-value-pair_10ipo_11ixz_207 > .awsui_key_10ipo_11ixz_207:not(#\9) {
317
317
  align-items: flex-start;
318
318
  }
319
- .awsui_list_10ipo_jyjn4_201 > .awsui_list-item_10ipo_jyjn4_201.awsui_dimmed_10ipo_jyjn4_93:not(#\9) {
319
+ .awsui_list_10ipo_11ixz_201 > .awsui_list-item_10ipo_11ixz_201.awsui_dimmed_10ipo_11ixz_93:not(#\9) {
320
320
  opacity: 0.35;
321
321
  }
322
322
 
323
- .awsui_list-item_10ipo_jyjn4_201.awsui_with-sub-items_10ipo_jyjn4_245:not(#\9):not(.awsui_expandable_10ipo_jyjn4_197) > .awsui_key-value-pair_10ipo_jyjn4_207 > .awsui_key_10ipo_jyjn4_207,
324
- .awsui_list-item_10ipo_jyjn4_201.awsui_with-sub-items_10ipo_jyjn4_245:not(#\9):not(.awsui_expandable_10ipo_jyjn4_197) > .awsui_key-value-pair_10ipo_jyjn4_207 > .awsui_value_10ipo_jyjn4_193 {
323
+ .awsui_list_10ipo_11ixz_201:not(#\9):not(.awsui_compact_10ipo_11ixz_245) > .awsui_list-item_10ipo_11ixz_201:not(:first-child),
324
+ .awsui_inner-list-item_10ipo_11ixz_202:not(#\9) {
325
+ margin-top: var(--space-scaled-xxs-7597g1, 4px);
326
+ }
327
+
328
+ .awsui_list-item_10ipo_11ixz_201.awsui_with-sub-items_10ipo_11ixz_250:not(#\9):not(.awsui_expandable_10ipo_11ixz_197) > .awsui_key-value-pair_10ipo_11ixz_207 > .awsui_key_10ipo_11ixz_207,
329
+ .awsui_list-item_10ipo_11ixz_201.awsui_with-sub-items_10ipo_11ixz_250:not(#\9):not(.awsui_expandable_10ipo_11ixz_197) > .awsui_key-value-pair_10ipo_11ixz_207 > .awsui_value_10ipo_11ixz_193 {
325
330
  font-weight: var(--font-weight-heading-s-cwn6wc, 700);
326
331
  }
327
332
 
328
- .awsui_full-width_10ipo_jyjn4_250:not(#\9) {
333
+ .awsui_full-width_10ipo_11ixz_255:not(#\9) {
329
334
  width: 100%;
330
335
  }
331
336
 
332
- .awsui_announced_10ipo_jyjn4_254:not(#\9) {
337
+ .awsui_announced_10ipo_11ixz_259:not(#\9) {
333
338
  /* Used by getSeriesDetailText to select text to be announced by screen readers */
334
339
  }
@@ -2,24 +2,25 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "dimmed": "awsui_dimmed_10ipo_jyjn4_93",
6
- "marker": "awsui_marker_10ipo_jyjn4_122",
7
- "marker--line": "awsui_marker--line_10ipo_jyjn4_140",
8
- "marker--rectangle": "awsui_marker--rectangle_10ipo_jyjn4_144",
9
- "marker--hollow-rectangle": "awsui_marker--hollow-rectangle_10ipo_jyjn4_148",
10
- "marker--dashed": "awsui_marker--dashed_10ipo_jyjn4_160",
11
- "root": "awsui_root_10ipo_jyjn4_180",
12
- "value": "awsui_value_10ipo_jyjn4_193",
13
- "expandable": "awsui_expandable_10ipo_jyjn4_197",
14
- "list-item": "awsui_list-item_10ipo_jyjn4_201",
15
- "inner-list-item": "awsui_inner-list-item_10ipo_jyjn4_202",
16
- "key-value-pair": "awsui_key-value-pair_10ipo_jyjn4_207",
17
- "expandable-section": "awsui_expandable-section_10ipo_jyjn4_208",
18
- "key": "awsui_key_10ipo_jyjn4_207",
19
- "sub-items": "awsui_sub-items_10ipo_jyjn4_221",
20
- "list": "awsui_list_10ipo_jyjn4_201",
21
- "with-sub-items": "awsui_with-sub-items_10ipo_jyjn4_245",
22
- "full-width": "awsui_full-width_10ipo_jyjn4_250",
23
- "announced": "awsui_announced_10ipo_jyjn4_254"
5
+ "dimmed": "awsui_dimmed_10ipo_11ixz_93",
6
+ "marker": "awsui_marker_10ipo_11ixz_122",
7
+ "marker--line": "awsui_marker--line_10ipo_11ixz_140",
8
+ "marker--rectangle": "awsui_marker--rectangle_10ipo_11ixz_144",
9
+ "marker--hollow-rectangle": "awsui_marker--hollow-rectangle_10ipo_11ixz_148",
10
+ "marker--dashed": "awsui_marker--dashed_10ipo_11ixz_160",
11
+ "root": "awsui_root_10ipo_11ixz_180",
12
+ "value": "awsui_value_10ipo_11ixz_193",
13
+ "expandable": "awsui_expandable_10ipo_11ixz_197",
14
+ "list-item": "awsui_list-item_10ipo_11ixz_201",
15
+ "inner-list-item": "awsui_inner-list-item_10ipo_11ixz_202",
16
+ "key-value-pair": "awsui_key-value-pair_10ipo_11ixz_207",
17
+ "expandable-section": "awsui_expandable-section_10ipo_11ixz_208",
18
+ "key": "awsui_key_10ipo_11ixz_207",
19
+ "sub-items": "awsui_sub-items_10ipo_11ixz_221",
20
+ "list": "awsui_list_10ipo_11ixz_201",
21
+ "compact": "awsui_compact_10ipo_11ixz_245",
22
+ "with-sub-items": "awsui_with-sub-items_10ipo_11ixz_250",
23
+ "full-width": "awsui_full-width_10ipo_11ixz_255",
24
+ "announced": "awsui_announced_10ipo_11ixz_259"
24
25
  };
25
26
 
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (ad343f3b)";
2
+ export var PACKAGE_VERSION = "3.0.0 (9f65ea40)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (ad343f3b)",
3
+ "PACKAGE_VERSION": "3.0.0 (9f65ea40)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "ad343f3b01c270b17bb5f1508c75c6904eb965ad"
2
+ "commit": "9f65ea408177be13561dc2c2e2f56e90f3b1f351"
3
3
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@cloudscape-design/components","main":"./index.js","exports":{".":"./index.js","./package.json":"./package.json","./theming":"./theming/index.js","./test-utils/dom":"./test-utils/dom/index.js","./test-utils/selectors":"./test-utils/selectors/index.js","./interfaces":"./interfaces.js","./contexts/form-field":"./contexts/form-field.js","./alert":"./alert/index.js","./anchor-navigation":"./anchor-navigation/index.js","./annotation-context":"./annotation-context/index.js","./app-layout":"./app-layout/index.js","./area-chart":"./area-chart/index.js","./attribute-editor":"./attribute-editor/index.js","./autosuggest":"./autosuggest/index.js","./badge":"./badge/index.js","./bar-chart":"./bar-chart/index.js","./box":"./box/index.js","./breadcrumb-group":"./breadcrumb-group/index.js","./button":"./button/index.js","./button-dropdown":"./button-dropdown/index.js","./calendar":"./calendar/index.js","./cards":"./cards/index.js","./checkbox":"./checkbox/index.js","./code-editor":"./code-editor/index.js","./collection-preferences":"./collection-preferences/index.js","./column-layout":"./column-layout/index.js","./container":"./container/index.js","./content-layout":"./content-layout/index.js","./date-input":"./date-input/index.js","./date-picker":"./date-picker/index.js","./date-range-picker":"./date-range-picker/index.js","./drawer":"./drawer/index.js","./expandable-section":"./expandable-section/index.js","./file-upload":"./file-upload/index.js","./flashbar":"./flashbar/index.js","./form":"./form/index.js","./form-field":"./form-field/index.js","./grid":"./grid/index.js","./header":"./header/index.js","./help-panel":"./help-panel/index.js","./hotspot":"./hotspot/index.js","./icon":"./icon/index.js","./input":"./input/index.js","./line-chart":"./line-chart/index.js","./link":"./link/index.js","./mixed-line-bar-chart":"./mixed-line-bar-chart/index.js","./modal":"./modal/index.js","./multiselect":"./multiselect/index.js","./pagination":"./pagination/index.js","./pie-chart":"./pie-chart/index.js","./popover":"./popover/index.js","./progress-bar":"./progress-bar/index.js","./property-filter":"./property-filter/index.js","./radio-group":"./radio-group/index.js","./s3-resource-selector":"./s3-resource-selector/index.js","./segmented-control":"./segmented-control/index.js","./select":"./select/index.js","./side-navigation":"./side-navigation/index.js","./space-between":"./space-between/index.js","./spinner":"./spinner/index.js","./split-panel":"./split-panel/index.js","./status-indicator":"./status-indicator/index.js","./table":"./table/index.js","./tabs":"./tabs/index.js","./tag-editor":"./tag-editor/index.js","./text-content":"./text-content/index.js","./text-filter":"./text-filter/index.js","./textarea":"./textarea/index.js","./tiles":"./tiles/index.js","./time-input":"./time-input/index.js","./toggle":"./toggle/index.js","./token-group":"./token-group/index.js","./top-navigation":"./top-navigation/index.js","./tutorial-panel":"./tutorial-panel/index.js","./wizard":"./wizard/index.js","./top-navigation/1.0-beta":"./top-navigation/1.0-beta/index.js","./i18n":"./i18n/index.js","./i18n/messages/all.all":"./i18n/messages/all.all.js","./i18n/messages/all.all.json":"./i18n/messages/all.all.json","./i18n/messages/all.de":"./i18n/messages/all.de.js","./i18n/messages/all.de.json":"./i18n/messages/all.de.json","./i18n/messages/all.en-GB":"./i18n/messages/all.en-GB.js","./i18n/messages/all.en-GB.json":"./i18n/messages/all.en-GB.json","./i18n/messages/all.en":"./i18n/messages/all.en.js","./i18n/messages/all.en.json":"./i18n/messages/all.en.json","./i18n/messages/all.es":"./i18n/messages/all.es.js","./i18n/messages/all.es.json":"./i18n/messages/all.es.json","./i18n/messages/all.fr":"./i18n/messages/all.fr.js","./i18n/messages/all.fr.json":"./i18n/messages/all.fr.json","./i18n/messages/all.id":"./i18n/messages/all.id.js","./i18n/messages/all.id.json":"./i18n/messages/all.id.json","./i18n/messages/all.it":"./i18n/messages/all.it.js","./i18n/messages/all.it.json":"./i18n/messages/all.it.json","./i18n/messages/all.ja":"./i18n/messages/all.ja.js","./i18n/messages/all.ja.json":"./i18n/messages/all.ja.json","./i18n/messages/all.ko":"./i18n/messages/all.ko.js","./i18n/messages/all.ko.json":"./i18n/messages/all.ko.json","./i18n/messages/all.pt-BR":"./i18n/messages/all.pt-BR.js","./i18n/messages/all.pt-BR.json":"./i18n/messages/all.pt-BR.json","./i18n/messages/all.th":"./i18n/messages/all.th.js","./i18n/messages/all.th.json":"./i18n/messages/all.th.json","./i18n/messages/all.tr":"./i18n/messages/all.tr.js","./i18n/messages/all.tr.json":"./i18n/messages/all.tr.json","./i18n/messages/all.zh-CN":"./i18n/messages/all.zh-CN.js","./i18n/messages/all.zh-CN.json":"./i18n/messages/all.zh-CN.json","./i18n/messages/all.zh-TW":"./i18n/messages/all.zh-TW.js","./i18n/messages/all.zh-TW.json":"./i18n/messages/all.zh-TW.json"},"sideEffects":["*.css","./internal/base-component/index.js","./internal/base-component/styles.css.js"],"version":"3.0.487","repository":{"type":"git","url":"https://github.com/cloudscape-design/components.git"},"homepage":"https://cloudscape.design","dependencies":{"@cloudscape-design/collection-hooks":"^1.0.0","@cloudscape-design/component-toolkit":"^1.0.0-beta","@cloudscape-design/test-utils-core":"^1.0.0","@cloudscape-design/theming-runtime":"^1.0.0","@dnd-kit/core":"^6.0.8","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@juggle/resize-observer":"^3.3.1","ace-builds":"^1.23.0","balanced-match":"^1.0.2","clsx":"^1.1.0","d3-shape":"^1.3.7","date-fns":"^2.25.0","intl-messageformat":"^10.3.1","mnth":"^2.0.0","react-keyed-flatten-children":"^1.3.0","react-transition-group":"^4.4.2","react-virtual":"^2.8.2","tslib":"^2.4.0","weekstart":"^1.1.0"},"peerDependencies":{"react":"^16.8 || ^17 || ^18","react-dom":"^16.8 || ^17 || ^18"},"license":"Apache-2.0"}
1
+ {"name":"@cloudscape-design/components","main":"./index.js","exports":{".":"./index.js","./package.json":"./package.json","./theming":"./theming/index.js","./test-utils/dom":"./test-utils/dom/index.js","./test-utils/selectors":"./test-utils/selectors/index.js","./interfaces":"./interfaces.js","./contexts/form-field":"./contexts/form-field.js","./alert":"./alert/index.js","./anchor-navigation":"./anchor-navigation/index.js","./annotation-context":"./annotation-context/index.js","./app-layout":"./app-layout/index.js","./area-chart":"./area-chart/index.js","./attribute-editor":"./attribute-editor/index.js","./autosuggest":"./autosuggest/index.js","./badge":"./badge/index.js","./bar-chart":"./bar-chart/index.js","./box":"./box/index.js","./breadcrumb-group":"./breadcrumb-group/index.js","./button":"./button/index.js","./button-dropdown":"./button-dropdown/index.js","./calendar":"./calendar/index.js","./cards":"./cards/index.js","./checkbox":"./checkbox/index.js","./code-editor":"./code-editor/index.js","./collection-preferences":"./collection-preferences/index.js","./column-layout":"./column-layout/index.js","./container":"./container/index.js","./content-layout":"./content-layout/index.js","./date-input":"./date-input/index.js","./date-picker":"./date-picker/index.js","./date-range-picker":"./date-range-picker/index.js","./drawer":"./drawer/index.js","./expandable-section":"./expandable-section/index.js","./file-upload":"./file-upload/index.js","./flashbar":"./flashbar/index.js","./form":"./form/index.js","./form-field":"./form-field/index.js","./grid":"./grid/index.js","./header":"./header/index.js","./help-panel":"./help-panel/index.js","./hotspot":"./hotspot/index.js","./icon":"./icon/index.js","./input":"./input/index.js","./line-chart":"./line-chart/index.js","./link":"./link/index.js","./mixed-line-bar-chart":"./mixed-line-bar-chart/index.js","./modal":"./modal/index.js","./multiselect":"./multiselect/index.js","./pagination":"./pagination/index.js","./pie-chart":"./pie-chart/index.js","./popover":"./popover/index.js","./progress-bar":"./progress-bar/index.js","./property-filter":"./property-filter/index.js","./radio-group":"./radio-group/index.js","./s3-resource-selector":"./s3-resource-selector/index.js","./segmented-control":"./segmented-control/index.js","./select":"./select/index.js","./side-navigation":"./side-navigation/index.js","./space-between":"./space-between/index.js","./spinner":"./spinner/index.js","./split-panel":"./split-panel/index.js","./status-indicator":"./status-indicator/index.js","./table":"./table/index.js","./tabs":"./tabs/index.js","./tag-editor":"./tag-editor/index.js","./text-content":"./text-content/index.js","./text-filter":"./text-filter/index.js","./textarea":"./textarea/index.js","./tiles":"./tiles/index.js","./time-input":"./time-input/index.js","./toggle":"./toggle/index.js","./token-group":"./token-group/index.js","./top-navigation":"./top-navigation/index.js","./tutorial-panel":"./tutorial-panel/index.js","./wizard":"./wizard/index.js","./top-navigation/1.0-beta":"./top-navigation/1.0-beta/index.js","./i18n":"./i18n/index.js","./i18n/messages/all.all":"./i18n/messages/all.all.js","./i18n/messages/all.all.json":"./i18n/messages/all.all.json","./i18n/messages/all.de":"./i18n/messages/all.de.js","./i18n/messages/all.de.json":"./i18n/messages/all.de.json","./i18n/messages/all.en-GB":"./i18n/messages/all.en-GB.js","./i18n/messages/all.en-GB.json":"./i18n/messages/all.en-GB.json","./i18n/messages/all.en":"./i18n/messages/all.en.js","./i18n/messages/all.en.json":"./i18n/messages/all.en.json","./i18n/messages/all.es":"./i18n/messages/all.es.js","./i18n/messages/all.es.json":"./i18n/messages/all.es.json","./i18n/messages/all.fr":"./i18n/messages/all.fr.js","./i18n/messages/all.fr.json":"./i18n/messages/all.fr.json","./i18n/messages/all.id":"./i18n/messages/all.id.js","./i18n/messages/all.id.json":"./i18n/messages/all.id.json","./i18n/messages/all.it":"./i18n/messages/all.it.js","./i18n/messages/all.it.json":"./i18n/messages/all.it.json","./i18n/messages/all.ja":"./i18n/messages/all.ja.js","./i18n/messages/all.ja.json":"./i18n/messages/all.ja.json","./i18n/messages/all.ko":"./i18n/messages/all.ko.js","./i18n/messages/all.ko.json":"./i18n/messages/all.ko.json","./i18n/messages/all.pt-BR":"./i18n/messages/all.pt-BR.js","./i18n/messages/all.pt-BR.json":"./i18n/messages/all.pt-BR.json","./i18n/messages/all.th":"./i18n/messages/all.th.js","./i18n/messages/all.th.json":"./i18n/messages/all.th.json","./i18n/messages/all.tr":"./i18n/messages/all.tr.js","./i18n/messages/all.tr.json":"./i18n/messages/all.tr.json","./i18n/messages/all.zh-CN":"./i18n/messages/all.zh-CN.js","./i18n/messages/all.zh-CN.json":"./i18n/messages/all.zh-CN.json","./i18n/messages/all.zh-TW":"./i18n/messages/all.zh-TW.js","./i18n/messages/all.zh-TW.json":"./i18n/messages/all.zh-TW.json"},"sideEffects":["*.css","./internal/base-component/index.js","./internal/base-component/styles.css.js"],"version":"3.0.489","repository":{"type":"git","url":"https://github.com/cloudscape-design/components.git"},"homepage":"https://cloudscape.design","dependencies":{"@cloudscape-design/collection-hooks":"^1.0.0","@cloudscape-design/component-toolkit":"^1.0.0-beta","@cloudscape-design/test-utils-core":"^1.0.0","@cloudscape-design/theming-runtime":"^1.0.0","@dnd-kit/core":"^6.0.8","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@juggle/resize-observer":"^3.3.1","ace-builds":"^1.23.0","balanced-match":"^1.0.2","clsx":"^1.1.0","d3-shape":"^1.3.7","date-fns":"^2.25.0","intl-messageformat":"^10.3.1","mnth":"^2.0.0","react-keyed-flatten-children":"^1.3.0","react-transition-group":"^4.4.2","react-virtual":"^2.8.2","tslib":"^2.4.0","weekstart":"^1.1.0"},"peerDependencies":{"react":"^16.8 || ^17 || ^18","react-dom":"^16.8 || ^17 || ^18"},"license":"Apache-2.0"}
@@ -48,7 +48,7 @@ export default ({ fitHeight, height: explicitHeight, variant, size, width, i18nS
48
48
  const detailFunction = detailPopoverContent || defaultDetails(i18n, i18nStrings);
49
49
  const details = popoverData ? detailFunction(popoverData.datum, dataSum) : [];
50
50
  const popoverContentRef = useRef(null);
51
- const popoverContent = popoverData && React.createElement(SeriesDetails, { details: details, ref: popoverContentRef });
51
+ const popoverContent = popoverData && React.createElement(SeriesDetails, { details: details, compactList: true, ref: popoverContentRef });
52
52
  const popoverDismissedRecently = useRef(false);
53
53
  const escapePressed = useRef(false);
54
54
  const highlightSegment = useCallback((internalDatum) => {
@@ -1 +1 @@
1
- {"version":3,"file":"pie-chart.js","sourceRoot":"lib/default/","sources":["pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EA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,EAAE,WAAW,CAAC,6BAA6B,EAC3D,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,GAAG,KAAI,IAAI,EACvC,IAAI,EAAE,iBAAiB,EACvB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,iBAAiB;YAExB,cAAc;YACd,0BAA0B,IAAI,oBAAC,kBAAkB,QAAE,0BAA0B,CAAsB,CACvF,CAChB;QACD,oBAAC,UAAU,IAAC,MAAM,EAAE,CAAC,iBAAiB,CAAC,GAAI,CACvC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PieArcDatum } from 'd3-shape';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport ChartPopover from '../internal/components/chart-popover';\nimport SeriesDetails from '../internal/components/chart-series-details';\nimport SeriesMarker from '../internal/components/chart-series-marker';\nimport InternalBox from '../box/internal';\n\nimport Labels from './labels';\nimport { PieChartProps, SeriesInfo } from './interfaces';\nimport styles from './styles.css.js';\nimport { defaultDetails, getDimensionsBySize } from './utils';\nimport Segments from './segments';\nimport ChartPlot, { ChartPlotRef } from '../internal/components/chart-plot';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../i18n/context';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport clsx from 'clsx';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';\nimport ChartPopoverFooter from '../internal/components/chart-popover-footer';\nimport LiveRegion from '../internal/components/live-region';\n\nexport interface InternalChartDatum<T> {\n index: number;\n color: string;\n datum: Readonly<T>;\n}\n\ninterface InternalPieChartProps<T extends PieChartProps.Datum>\n extends SomeRequired<\n Omit<PieChartProps<T>, 'onHighlightChange' | 'statusType'>,\n 'variant' | 'size' | 'i18nStrings' | 'hideTitles' | 'hideDescriptions'\n > {\n width: number;\n height: number;\n\n highlightedSegment: T | null;\n onHighlightChange: (segment: null | T) => void;\n\n legendSegment: T | null;\n\n pieData: PieArcDatum<InternalChartDatum<T>>[];\n dataSum: number;\n}\n\nexport interface PopoverData<T> {\n datum: T;\n trackRef: React.RefObject<SVGElement>;\n series: SeriesInfo;\n}\n\nexport default <T extends PieChartProps.Datum>({\n fitHeight,\n height: explicitHeight,\n variant,\n size,\n width,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n innerMetricValue,\n innerMetricDescription,\n hideTitles,\n hideDescriptions,\n detailPopoverContent,\n detailPopoverSize,\n detailPopoverFooter,\n segmentDescription,\n highlightedSegment,\n onHighlightChange,\n legendSegment,\n pieData,\n dataSum,\n}: InternalPieChartProps<T>) => {\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const focusedSegmentRef = useRef<SVGGElement>(null);\n const popoverTrackRef = useRef<SVGCircleElement>(null);\n const popoverRef = useRef<HTMLElement | null>(null);\n\n const hasLabels = !(hideTitles && hideDescriptions);\n const isRefresh = useVisualRefresh();\n\n const height = useHeightMeasure(() => plotRef.current?.svg ?? null, !fitHeight) ?? explicitHeight;\n\n const dimensions = useMemo(\n () =>\n getDimensionsBySize({ size: fitHeight ? Math.min(height, width) : size, hasLabels, visualRefresh: isRefresh }),\n [fitHeight, height, width, size, hasLabels, isRefresh]\n );\n\n // Inner content is only available for donut charts and the inner description is not displayed for small charts\n const hasInnerContent =\n variant === 'donut' && (innerMetricValue || (innerMetricDescription && dimensions.size !== 'small'));\n\n const innerMetricId = useUniqueId('awsui-pie-chart__inner');\n\n const [isPopoverOpen, setPopoverOpen] = useState<boolean>(false);\n const [popoverData, setPopoverData] = useState<PopoverData<T>>();\n\n const highlightedSegmentIndex = useMemo(() => {\n for (let index = 0; index < pieData.length; index++) {\n if (pieData[index].data.datum === highlightedSegment) {\n return index;\n }\n }\n return null;\n }, [pieData, highlightedSegment]);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedSegment ? detailPopoverFooter(highlightedSegment) : null),\n [detailPopoverFooter, highlightedSegment]\n );\n\n const i18n = useInternalI18n('pie-chart');\n const detailFunction = detailPopoverContent || defaultDetails(i18n, i18nStrings);\n const details = popoverData ? detailFunction(popoverData.datum, dataSum) : [];\n const popoverContentRef = useRef<HTMLDivElement | null>(null);\n const popoverContent = popoverData && <SeriesDetails details={details} ref={popoverContentRef} />;\n\n const popoverDismissedRecently = useRef(false);\n const escapePressed = useRef(false);\n\n const highlightSegment = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n const segment = internalDatum.datum;\n if (segment !== highlightedSegment) {\n onHighlightChange(segment);\n }\n\n if (popoverTrackRef.current) {\n setPopoverData({\n datum: internalDatum.datum,\n series: {\n color: internalDatum.color,\n index: internalDatum.index,\n label: internalDatum.datum.title,\n markerType: 'rectangle',\n },\n trackRef: popoverTrackRef,\n });\n setPopoverOpen(true);\n }\n },\n [highlightedSegment, setPopoverOpen, onHighlightChange]\n );\n\n const clearHighlightedSegment = useCallback(() => {\n setPopoverOpen(false);\n onHighlightChange(null);\n }, [onHighlightChange, setPopoverOpen]);\n\n const checkMouseLeave = (event: React.MouseEvent) => {\n if (pinnedSegment !== null) {\n return;\n }\n\n if (\n nodeContains(popoverRef.current, event.relatedTarget) ||\n nodeContains(focusedSegmentRef.current, event.relatedTarget)\n ) {\n return;\n }\n\n clearHighlightedSegment();\n };\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n clearHighlightedSegment();\n escapePressed.current = true;\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [clearHighlightedSegment]);\n\n const onMouseDown = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n if (pinnedSegment === internalDatum.datum) {\n setPinnedSegment(null);\n clearHighlightedSegment();\n } else {\n setPinnedSegment(internalDatum.datum);\n highlightSegment(internalDatum);\n }\n },\n [pinnedSegment, clearHighlightedSegment, setPinnedSegment, highlightSegment]\n );\n const onMouseOver = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n if (escapePressed.current) {\n escapePressed.current = false;\n return;\n }\n if (pinnedSegment !== null) {\n return;\n }\n highlightSegment(internalDatum);\n },\n [pinnedSegment, highlightSegment]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.enter &&\n keyCode !== KeyCode.space\n ) {\n return;\n }\n\n event.preventDefault();\n\n let nextIndex = highlightedSegmentIndex || 0;\n const MAX = pieData.length - 1;\n if (keyCode === KeyCode.right) {\n nextIndex++;\n if (nextIndex > MAX) {\n nextIndex = 0;\n }\n } else if (keyCode === KeyCode.left) {\n nextIndex--;\n if (nextIndex < 0) {\n nextIndex = MAX;\n }\n }\n if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n setPinnedSegment(pieData[nextIndex].data.datum);\n }\n highlightSegment(pieData[nextIndex].data);\n },\n [setPinnedSegment, highlightSegment, pieData, highlightedSegmentIndex]\n );\n const onApplicationFocus = useCallback(\n (_event: any, target: 'keyboard' | 'mouse') => {\n // We need to make sure that we do not re-show the popover when we focus the segment after the popover is dismissed.\n // Normally we would check `event.relatedTarget` for the previously focused element,\n // but this is not supported for SVG elements in IE11. The workaround is this `popoverDismissedRecently` ref.\n if (pinnedSegment !== null || popoverDismissedRecently.current || target === 'mouse') {\n return;\n }\n\n const segment = highlightedSegment || legendSegment || pieData[0].data.datum;\n const matched = pieData.filter(d => d.data.datum === segment);\n highlightSegment(matched[0].data);\n },\n [pinnedSegment, pieData, highlightSegment, highlightedSegment, legendSegment]\n );\n\n const onApplicationBlur = useCallback(\n (event: React.FocusEvent) => {\n const blurTarget = event.relatedTarget || event.target;\n if (blurTarget === null || !(blurTarget instanceof Element) || !nodeBelongs(containerRef.current, blurTarget)) {\n // We only need to close the popover and remove the pinned segment so that we keep track of the current\n // highlighted legendSeries. using clearHighlightedSegment() would set the legendSeries to null, in that case\n // using Keyboard Tab will always highlight the first legend item in the legend component.\n setPopoverOpen(false);\n setPinnedSegment(null);\n }\n },\n [setPinnedSegment]\n );\n const onPopoverDismiss = (outsideClick?: boolean) => {\n setPopoverOpen(false);\n setPinnedSegment(null);\n\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n popoverDismissedRecently.current = true;\n plotRef.current!.focusApplication();\n popoverDismissedRecently.current = false;\n }, 0);\n } else {\n onHighlightChange(null);\n }\n };\n\n return (\n <div\n className={clsx(styles['chart-container'], fitHeight && styles['chart-container--fit-height'])}\n ref={containerRef}\n >\n <div\n className={clsx(\n styles['chart-container-chart-plot'],\n fitHeight && styles['chart-container-chart-plot--fit-height']\n )}\n >\n <ChartPlot\n ref={plotRef}\n width=\"100%\"\n height={fitHeight ? '100%' : height}\n transform={`translate(${width / 2} ${height / 2})`}\n isPrecise={true}\n isClickable={!isPopoverOpen}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaDescribedby={hasInnerContent ? innerMetricId : undefined}\n ariaRoleDescription={i18nStrings?.chartAriaRoleDescription}\n activeElementRef={focusedSegmentRef}\n activeElementKey={highlightedSegmentIndex?.toString()}\n onApplicationFocus={onApplicationFocus}\n onApplicationBlur={onApplicationBlur}\n onKeyDown={onKeyDown}\n onMouseOut={checkMouseLeave}\n >\n <Segments\n pieData={pieData}\n dimensions={dimensions}\n variant={variant}\n focusedSegmentRef={focusedSegmentRef}\n popoverTrackRef={popoverTrackRef}\n highlightedSegment={highlightedSegment}\n segmentAriaRoleDescription={i18nStrings?.segmentAriaRoleDescription}\n onMouseDown={onMouseDown}\n onMouseOver={onMouseOver}\n />\n {hasLabels && (\n <Labels\n pieData={pieData}\n dimensions={dimensions}\n segmentDescription={segmentDescription}\n visibleDataSum={dataSum}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n highlightedSegment={highlightedSegment}\n containerRef={containerRef}\n />\n )}\n </ChartPlot>\n </div>\n\n {hasInnerContent && (\n <div className={styles['inner-content']} id={innerMetricId}>\n {innerMetricValue && (\n <InternalBox\n variant={dimensions.size === 'small' ? 'h3' : 'h1'}\n tagOverride=\"div\"\n color=\"inherit\"\n padding=\"n\"\n >\n {innerMetricValue}\n </InternalBox>\n )}\n {innerMetricDescription && dimensions.size !== 'small' && (\n <InternalBox variant=\"h3\" color=\"text-body-secondary\" tagOverride=\"div\" padding=\"n\">\n {innerMetricDescription}\n </InternalBox>\n )}\n </div>\n )}\n {isPopoverOpen && popoverData && (\n <ChartPopover\n ref={popoverRef}\n title={\n popoverData.series && (\n <InternalBox className={styles['popover-header']} variant=\"strong\">\n <SeriesMarker color={popoverData.series.color} type={popoverData.series.markerType} />{' '}\n {popoverData.series.label}\n </InternalBox>\n )\n }\n trackRef={popoverData.trackRef}\n trackKey={popoverData.series.index}\n dismissButton={pinnedSegment !== null}\n dismissAriaLabel={i18nStrings.detailPopoverDismissAriaLabel}\n onDismiss={onPopoverDismiss}\n container={plotRef.current?.svg || null}\n size={detailPopoverSize}\n onMouseLeave={checkMouseLeave}\n onBlur={onApplicationBlur}\n >\n {popoverContent}\n {detailPopoverFooterContent && <ChartPopoverFooter>{detailPopoverFooterContent}</ChartPopoverFooter>}\n </ChartPopover>\n )}\n <LiveRegion source={[popoverContentRef]} />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"pie-chart.js","sourceRoot":"lib/default/","sources":["pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,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,IAAI,EACrC,gBAAgB,EAAE,WAAW,CAAC,6BAA6B,EAC3D,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,GAAG,KAAI,IAAI,EACvC,IAAI,EAAE,iBAAiB,EACvB,YAAY,EAAE,eAAe,EAC7B,MAAM,EAAE,iBAAiB;YAExB,cAAc;YACd,0BAA0B,IAAI,oBAAC,kBAAkB,QAAE,0BAA0B,CAAsB,CACvF,CAChB;QACD,oBAAC,UAAU,IAAC,MAAM,EAAE,CAAC,iBAAiB,CAAC,GAAI,CACvC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PieArcDatum } from 'd3-shape';\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { nodeContains } from '@cloudscape-design/component-toolkit/dom';\n\nimport { KeyCode } from '../internal/keycode';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport ChartPopover from '../internal/components/chart-popover';\nimport SeriesDetails from '../internal/components/chart-series-details';\nimport SeriesMarker from '../internal/components/chart-series-marker';\nimport InternalBox from '../box/internal';\n\nimport Labels from './labels';\nimport { PieChartProps, SeriesInfo } from './interfaces';\nimport styles from './styles.css.js';\nimport { defaultDetails, getDimensionsBySize } from './utils';\nimport Segments from './segments';\nimport ChartPlot, { ChartPlotRef } from '../internal/components/chart-plot';\nimport { SomeRequired } from '../internal/types';\nimport { useInternalI18n } from '../i18n/context';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport clsx from 'clsx';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';\nimport ChartPopoverFooter from '../internal/components/chart-popover-footer';\nimport LiveRegion from '../internal/components/live-region';\n\nexport interface InternalChartDatum<T> {\n index: number;\n color: string;\n datum: Readonly<T>;\n}\n\ninterface InternalPieChartProps<T extends PieChartProps.Datum>\n extends SomeRequired<\n Omit<PieChartProps<T>, 'onHighlightChange' | 'statusType'>,\n 'variant' | 'size' | 'i18nStrings' | 'hideTitles' | 'hideDescriptions'\n > {\n width: number;\n height: number;\n\n highlightedSegment: T | null;\n onHighlightChange: (segment: null | T) => void;\n\n legendSegment: T | null;\n\n pieData: PieArcDatum<InternalChartDatum<T>>[];\n dataSum: number;\n}\n\nexport interface PopoverData<T> {\n datum: T;\n trackRef: React.RefObject<SVGElement>;\n series: SeriesInfo;\n}\n\nexport default <T extends PieChartProps.Datum>({\n fitHeight,\n height: explicitHeight,\n variant,\n size,\n width,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n innerMetricValue,\n innerMetricDescription,\n hideTitles,\n hideDescriptions,\n detailPopoverContent,\n detailPopoverSize,\n detailPopoverFooter,\n segmentDescription,\n highlightedSegment,\n onHighlightChange,\n legendSegment,\n pieData,\n dataSum,\n}: InternalPieChartProps<T>) => {\n const [pinnedSegment, setPinnedSegment] = useState<T | null>(null);\n const plotRef = useRef<ChartPlotRef>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const focusedSegmentRef = useRef<SVGGElement>(null);\n const popoverTrackRef = useRef<SVGCircleElement>(null);\n const popoverRef = useRef<HTMLElement | null>(null);\n\n const hasLabels = !(hideTitles && hideDescriptions);\n const isRefresh = useVisualRefresh();\n\n const height = useHeightMeasure(() => plotRef.current?.svg ?? null, !fitHeight) ?? explicitHeight;\n\n const dimensions = useMemo(\n () =>\n getDimensionsBySize({ size: fitHeight ? Math.min(height, width) : size, hasLabels, visualRefresh: isRefresh }),\n [fitHeight, height, width, size, hasLabels, isRefresh]\n );\n\n // Inner content is only available for donut charts and the inner description is not displayed for small charts\n const hasInnerContent =\n variant === 'donut' && (innerMetricValue || (innerMetricDescription && dimensions.size !== 'small'));\n\n const innerMetricId = useUniqueId('awsui-pie-chart__inner');\n\n const [isPopoverOpen, setPopoverOpen] = useState<boolean>(false);\n const [popoverData, setPopoverData] = useState<PopoverData<T>>();\n\n const highlightedSegmentIndex = useMemo(() => {\n for (let index = 0; index < pieData.length; index++) {\n if (pieData[index].data.datum === highlightedSegment) {\n return index;\n }\n }\n return null;\n }, [pieData, highlightedSegment]);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedSegment ? detailPopoverFooter(highlightedSegment) : null),\n [detailPopoverFooter, highlightedSegment]\n );\n\n const i18n = useInternalI18n('pie-chart');\n const detailFunction = detailPopoverContent || defaultDetails(i18n, i18nStrings);\n const details = popoverData ? detailFunction(popoverData.datum, dataSum) : [];\n const popoverContentRef = useRef<HTMLDivElement | null>(null);\n const popoverContent = popoverData && <SeriesDetails details={details} compactList={true} ref={popoverContentRef} />;\n\n const popoverDismissedRecently = useRef(false);\n const escapePressed = useRef(false);\n\n const highlightSegment = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n const segment = internalDatum.datum;\n if (segment !== highlightedSegment) {\n onHighlightChange(segment);\n }\n\n if (popoverTrackRef.current) {\n setPopoverData({\n datum: internalDatum.datum,\n series: {\n color: internalDatum.color,\n index: internalDatum.index,\n label: internalDatum.datum.title,\n markerType: 'rectangle',\n },\n trackRef: popoverTrackRef,\n });\n setPopoverOpen(true);\n }\n },\n [highlightedSegment, setPopoverOpen, onHighlightChange]\n );\n\n const clearHighlightedSegment = useCallback(() => {\n setPopoverOpen(false);\n onHighlightChange(null);\n }, [onHighlightChange, setPopoverOpen]);\n\n const checkMouseLeave = (event: React.MouseEvent) => {\n if (pinnedSegment !== null) {\n return;\n }\n\n if (\n nodeContains(popoverRef.current, event.relatedTarget) ||\n nodeContains(focusedSegmentRef.current, event.relatedTarget)\n ) {\n return;\n }\n\n clearHighlightedSegment();\n };\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n clearHighlightedSegment();\n escapePressed.current = true;\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [clearHighlightedSegment]);\n\n const onMouseDown = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n if (pinnedSegment === internalDatum.datum) {\n setPinnedSegment(null);\n clearHighlightedSegment();\n } else {\n setPinnedSegment(internalDatum.datum);\n highlightSegment(internalDatum);\n }\n },\n [pinnedSegment, clearHighlightedSegment, setPinnedSegment, highlightSegment]\n );\n const onMouseOver = useCallback(\n (internalDatum: InternalChartDatum<T>) => {\n if (escapePressed.current) {\n escapePressed.current = false;\n return;\n }\n if (pinnedSegment !== null) {\n return;\n }\n highlightSegment(internalDatum);\n },\n [pinnedSegment, highlightSegment]\n );\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const keyCode = event.keyCode;\n if (\n keyCode !== KeyCode.right &&\n keyCode !== KeyCode.left &&\n keyCode !== KeyCode.enter &&\n keyCode !== KeyCode.space\n ) {\n return;\n }\n\n event.preventDefault();\n\n let nextIndex = highlightedSegmentIndex || 0;\n const MAX = pieData.length - 1;\n if (keyCode === KeyCode.right) {\n nextIndex++;\n if (nextIndex > MAX) {\n nextIndex = 0;\n }\n } else if (keyCode === KeyCode.left) {\n nextIndex--;\n if (nextIndex < 0) {\n nextIndex = MAX;\n }\n }\n if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n setPinnedSegment(pieData[nextIndex].data.datum);\n }\n highlightSegment(pieData[nextIndex].data);\n },\n [setPinnedSegment, highlightSegment, pieData, highlightedSegmentIndex]\n );\n const onApplicationFocus = useCallback(\n (_event: any, target: 'keyboard' | 'mouse') => {\n // We need to make sure that we do not re-show the popover when we focus the segment after the popover is dismissed.\n // Normally we would check `event.relatedTarget` for the previously focused element,\n // but this is not supported for SVG elements in IE11. The workaround is this `popoverDismissedRecently` ref.\n if (pinnedSegment !== null || popoverDismissedRecently.current || target === 'mouse') {\n return;\n }\n\n const segment = highlightedSegment || legendSegment || pieData[0].data.datum;\n const matched = pieData.filter(d => d.data.datum === segment);\n highlightSegment(matched[0].data);\n },\n [pinnedSegment, pieData, highlightSegment, highlightedSegment, legendSegment]\n );\n\n const onApplicationBlur = useCallback(\n (event: React.FocusEvent) => {\n const blurTarget = event.relatedTarget || event.target;\n if (blurTarget === null || !(blurTarget instanceof Element) || !nodeBelongs(containerRef.current, blurTarget)) {\n // We only need to close the popover and remove the pinned segment so that we keep track of the current\n // highlighted legendSeries. using clearHighlightedSegment() would set the legendSeries to null, in that case\n // using Keyboard Tab will always highlight the first legend item in the legend component.\n setPopoverOpen(false);\n setPinnedSegment(null);\n }\n },\n [setPinnedSegment]\n );\n const onPopoverDismiss = (outsideClick?: boolean) => {\n setPopoverOpen(false);\n setPinnedSegment(null);\n\n if (!outsideClick) {\n // The delay is needed to bypass focus events caused by click or keypress needed to unpin the popover.\n setTimeout(() => {\n popoverDismissedRecently.current = true;\n plotRef.current!.focusApplication();\n popoverDismissedRecently.current = false;\n }, 0);\n } else {\n onHighlightChange(null);\n }\n };\n\n return (\n <div\n className={clsx(styles['chart-container'], fitHeight && styles['chart-container--fit-height'])}\n ref={containerRef}\n >\n <div\n className={clsx(\n styles['chart-container-chart-plot'],\n fitHeight && styles['chart-container-chart-plot--fit-height']\n )}\n >\n <ChartPlot\n ref={plotRef}\n width=\"100%\"\n height={fitHeight ? '100%' : height}\n transform={`translate(${width / 2} ${height / 2})`}\n isPrecise={true}\n isClickable={!isPopoverOpen}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaDescribedby={hasInnerContent ? innerMetricId : undefined}\n ariaRoleDescription={i18nStrings?.chartAriaRoleDescription}\n activeElementRef={focusedSegmentRef}\n activeElementKey={highlightedSegmentIndex?.toString()}\n onApplicationFocus={onApplicationFocus}\n onApplicationBlur={onApplicationBlur}\n onKeyDown={onKeyDown}\n onMouseOut={checkMouseLeave}\n >\n <Segments\n pieData={pieData}\n dimensions={dimensions}\n variant={variant}\n focusedSegmentRef={focusedSegmentRef}\n popoverTrackRef={popoverTrackRef}\n highlightedSegment={highlightedSegment}\n segmentAriaRoleDescription={i18nStrings?.segmentAriaRoleDescription}\n onMouseDown={onMouseDown}\n onMouseOver={onMouseOver}\n />\n {hasLabels && (\n <Labels\n pieData={pieData}\n dimensions={dimensions}\n segmentDescription={segmentDescription}\n visibleDataSum={dataSum}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n highlightedSegment={highlightedSegment}\n containerRef={containerRef}\n />\n )}\n </ChartPlot>\n </div>\n\n {hasInnerContent && (\n <div className={styles['inner-content']} id={innerMetricId}>\n {innerMetricValue && (\n <InternalBox\n variant={dimensions.size === 'small' ? 'h3' : 'h1'}\n tagOverride=\"div\"\n color=\"inherit\"\n padding=\"n\"\n >\n {innerMetricValue}\n </InternalBox>\n )}\n {innerMetricDescription && dimensions.size !== 'small' && (\n <InternalBox variant=\"h3\" color=\"text-body-secondary\" tagOverride=\"div\" padding=\"n\">\n {innerMetricDescription}\n </InternalBox>\n )}\n </div>\n )}\n {isPopoverOpen && popoverData && (\n <ChartPopover\n ref={popoverRef}\n title={\n popoverData.series && (\n <InternalBox className={styles['popover-header']} variant=\"strong\">\n <SeriesMarker color={popoverData.series.color} type={popoverData.series.markerType} />{' '}\n {popoverData.series.label}\n </InternalBox>\n )\n }\n trackRef={popoverData.trackRef}\n trackKey={popoverData.series.index}\n dismissButton={pinnedSegment !== null}\n dismissAriaLabel={i18nStrings.detailPopoverDismissAriaLabel}\n onDismiss={onPopoverDismiss}\n container={plotRef.current?.svg || null}\n size={detailPopoverSize}\n onMouseLeave={checkMouseLeave}\n onBlur={onApplicationBlur}\n >\n {popoverContent}\n {detailPopoverFooterContent && <ChartPopoverFooter>{detailPopoverFooterContent}</ChartPopoverFooter>}\n </ChartPopover>\n )}\n <LiveRegion source={[popoverContentRef]} />\n </div>\n );\n};\n"]}