@cloudscape-design/components-themeable 3.0.654 → 3.0.656
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/drawer/styles.scss +10 -0
- package/lib/internal/scss/button/styles.scss +0 -1
- package/lib/internal/scss/container/styles.scss +26 -20
- package/lib/internal/scss/form/styles.scss +1 -1
- package/lib/internal/scss/grid/styles.scss +0 -3
- package/lib/internal/scss/header/styles.scss +0 -5
- package/lib/internal/scss/input/styles.scss +0 -6
- package/lib/internal/scss/internal/components/autosuggest-input/styles.scss +0 -1
- package/lib/internal/scss/internal/components/dropdown/styles.scss +0 -6
- package/lib/internal/scss/internal/components/panel-resize-handle/styles.scss +50 -0
- package/lib/internal/scss/link/constants.scss +0 -1
- package/lib/internal/scss/popover/styles.scss +0 -6
- package/lib/internal/scss/segmented-control/styles.scss +0 -2
- package/lib/internal/scss/split-panel/styles.scss +1 -59
- package/lib/internal/scss/split-panel/test-classes/styles.scss +15 -0
- package/lib/internal/scss/tiles/styles.scss +1 -5
- package/lib/internal/template/app-layout/drawer/index.js +1 -1
- package/lib/internal/template/app-layout/drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/drawer/resizable-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js +2 -5
- package/lib/internal/template/app-layout/drawer/resizable-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/drawer/styles.css.js +13 -12
- package/lib/internal/template/app-layout/drawer/styles.scoped.css +30 -20
- package/lib/internal/template/app-layout/drawer/styles.selectors.js +13 -12
- package/lib/internal/template/app-layout/utils/use-resize.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-resize.js +3 -7
- package/lib/internal/template/app-layout/utils/use-resize.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/drawers.js +3 -3
- package/lib/internal/template/app-layout/visual-refresh/drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/split-panel.js +1 -3
- package/lib/internal/template/app-layout/visual-refresh/split-panel.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh/tools.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh/tools.js.map +1 -1
- package/lib/internal/template/autosuggest/plain-list.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/plain-list.js +1 -3
- package/lib/internal/template/autosuggest/plain-list.js.map +1 -1
- package/lib/internal/template/autosuggest/virtual-list.d.ts.map +1 -1
- package/lib/internal/template/autosuggest/virtual-list.js +1 -3
- package/lib/internal/template/autosuggest/virtual-list.js.map +1 -1
- package/lib/internal/template/calendar/utils/intl.d.ts.map +1 -1
- package/lib/internal/template/calendar/utils/intl.js +0 -3
- package/lib/internal/template/calendar/utils/intl.js.map +1 -1
- package/lib/internal/template/container/internal.d.ts.map +1 -1
- package/lib/internal/template/container/internal.js +3 -0
- package/lib/internal/template/container/internal.js.map +1 -1
- package/lib/internal/template/container/styles.css.js +29 -28
- package/lib/internal/template/container/styles.scoped.css +55 -52
- package/lib/internal/template/container/styles.selectors.js +29 -28
- package/lib/internal/template/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/grids/index.js +0 -8
- package/lib/internal/template/date-range-picker/calendar/grids/index.js.map +1 -1
- package/lib/internal/template/form/interfaces.d.ts +3 -8
- package/lib/internal/template/form/interfaces.d.ts.map +1 -1
- package/lib/internal/template/form/interfaces.js.map +1 -1
- package/lib/internal/template/form/internal.d.ts +1 -1
- package/lib/internal/template/form/internal.d.ts.map +1 -1
- package/lib/internal/template/form/internal.js +14 -20
- package/lib/internal/template/form/internal.js.map +1 -1
- package/lib/internal/template/form/styles.css.js +8 -9
- package/lib/internal/template/form/styles.scoped.css +8 -8
- package/lib/internal/template/form/styles.selectors.js +8 -9
- package/lib/internal/template/header/internal.d.ts.map +1 -1
- package/lib/internal/template/header/internal.js +1 -3
- package/lib/internal/template/header/internal.js.map +1 -1
- package/lib/internal/template/header/styles.css.js +34 -35
- package/lib/internal/template/header/styles.scoped.css +50 -53
- package/lib/internal/template/header/styles.selectors.js +34 -35
- package/lib/internal/template/input/styles.css.js +13 -13
- package/lib/internal/template/input/styles.scoped.css +32 -35
- package/lib/internal/template/input/styles.selectors.js +13 -13
- package/lib/internal/template/internal/components/chart-plot/application-controller.js +3 -13
- package/lib/internal/template/internal/components/chart-plot/application-controller.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/dropdown/index.js +0 -2
- package/lib/internal/template/internal/components/dropdown/index.js.map +1 -1
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +39 -45
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/panel-resize-handle/icon.d.ts +5 -0
- package/lib/internal/template/internal/components/panel-resize-handle/icon.d.ts.map +1 -0
- package/lib/internal/template/internal/components/panel-resize-handle/icon.js +9 -0
- package/lib/internal/template/internal/components/panel-resize-handle/icon.js.map +1 -0
- package/lib/internal/template/internal/components/panel-resize-handle/index.d.ts +12 -0
- package/lib/internal/template/internal/components/panel-resize-handle/index.d.ts.map +1 -0
- package/lib/internal/template/internal/components/panel-resize-handle/index.js +11 -0
- package/lib/internal/template/internal/components/panel-resize-handle/index.js.map +1 -0
- package/lib/internal/template/internal/components/panel-resize-handle/styles.css.js +10 -0
- package/lib/internal/template/internal/components/panel-resize-handle/styles.scoped.css +153 -0
- package/lib/internal/template/internal/components/panel-resize-handle/styles.selectors.js +11 -0
- package/lib/internal/template/internal/context/single-tab-stop-navigation-context.js +2 -2
- package/lib/internal/template/internal/context/single-tab-stop-navigation-context.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/utils/content-header-utils.d.ts +0 -2
- package/lib/internal/template/internal/utils/content-header-utils.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/content-header-utils.js +0 -3
- package/lib/internal/template/internal/utils/content-header-utils.js.map +1 -1
- package/lib/internal/template/internal/utils/dom.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/dom.js +7 -27
- package/lib/internal/template/internal/utils/dom.js.map +1 -1
- package/lib/internal/template/internal/utils/global-flags.d.ts +0 -1
- package/lib/internal/template/internal/utils/global-flags.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/global-flags.js.map +1 -1
- package/lib/internal/template/link/interfaces.d.ts +6 -1
- package/lib/internal/template/link/interfaces.d.ts.map +1 -1
- package/lib/internal/template/link/interfaces.js.map +1 -1
- package/lib/internal/template/link/internal.d.ts.map +1 -1
- package/lib/internal/template/link/internal.js +12 -2
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/pie-chart/labels.d.ts.map +1 -1
- package/lib/internal/template/pie-chart/labels.js +1 -4
- package/lib/internal/template/pie-chart/labels.js.map +1 -1
- package/lib/internal/template/pie-chart/pie-chart.d.ts.map +1 -1
- package/lib/internal/template/pie-chart/pie-chart.js +0 -3
- package/lib/internal/template/pie-chart/pie-chart.js.map +1 -1
- package/lib/internal/template/pie-chart/utils.d.ts.map +1 -1
- package/lib/internal/template/pie-chart/utils.js +0 -4
- package/lib/internal/template/pie-chart/utils.js.map +1 -1
- package/lib/internal/template/popover/internal.js +3 -6
- package/lib/internal/template/popover/internal.js.map +1 -1
- package/lib/internal/template/popover/styles.css.js +49 -50
- package/lib/internal/template/popover/styles.scoped.css +66 -69
- package/lib/internal/template/popover/styles.selectors.js +49 -50
- package/lib/internal/template/segmented-control/styles.css.js +14 -14
- package/lib/internal/template/segmented-control/styles.scoped.css +33 -33
- package/lib/internal/template/segmented-control/styles.selectors.js +14 -14
- package/lib/internal/template/split-panel/bottom.d.ts.map +1 -1
- package/lib/internal/template/split-panel/bottom.js +4 -2
- package/lib/internal/template/split-panel/bottom.js.map +1 -1
- package/lib/internal/template/split-panel/icons/bottom-icon.js +1 -1
- package/lib/internal/template/split-panel/icons/bottom-icon.js.map +1 -1
- package/lib/internal/template/split-panel/icons/side-position-refresh.js +1 -1
- package/lib/internal/template/split-panel/icons/side-position-refresh.js.map +1 -1
- package/lib/internal/template/split-panel/icons/side-position.js +1 -1
- package/lib/internal/template/split-panel/icons/side-position.js.map +1 -1
- package/lib/internal/template/split-panel/icons/styles.css.js +27 -0
- package/lib/internal/template/split-panel/icons/styles.scoped.css +168 -0
- package/lib/internal/template/split-panel/icons/styles.selectors.js +28 -0
- package/lib/internal/template/split-panel/implementation.d.ts.map +1 -1
- package/lib/internal/template/split-panel/implementation.js +12 -8
- package/lib/internal/template/split-panel/implementation.js.map +1 -1
- package/lib/internal/template/split-panel/side.d.ts.map +1 -1
- package/lib/internal/template/split-panel/side.js +5 -3
- package/lib/internal/template/split-panel/side.js.map +1 -1
- package/lib/internal/template/split-panel/styles.css.js +26 -57
- package/lib/internal/template/split-panel/styles.scoped.css +41 -281
- package/lib/internal/template/split-panel/styles.selectors.js +26 -57
- package/lib/internal/template/split-panel/test-classes/styles.css.js +13 -0
- package/lib/internal/template/split-panel/test-classes/styles.scoped.css +14 -0
- package/lib/internal/template/split-panel/test-classes/styles.selectors.js +14 -0
- package/lib/internal/template/table/selection/selection-control.d.ts.map +1 -1
- package/lib/internal/template/table/selection/selection-control.js.map +1 -1
- package/lib/internal/template/table/table-role/utils.d.ts.map +1 -1
- package/lib/internal/template/table/table-role/utils.js +6 -1
- package/lib/internal/template/table/table-role/utils.js.map +1 -1
- package/lib/internal/template/test-utils/dom/app-layout/index.js +1 -1
- package/lib/internal/template/test-utils/dom/app-layout/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/split-panel/index.js +3 -3
- package/lib/internal/template/test-utils/dom/split-panel/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/app-layout/index.js +1 -1
- package/lib/internal/template/test-utils/selectors/app-layout/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/split-panel/index.js +3 -3
- package/lib/internal/template/test-utils/selectors/split-panel/index.js.map +1 -1
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/tiles/styles.css.js +29 -29
- package/lib/internal/template/tiles/styles.scoped.css +82 -95
- package/lib/internal/template/tiles/styles.selectors.js +29 -29
- package/package.json +1 -1
- package/lib/internal/template/split-panel/icons/resize-handler.d.ts +0 -6
- package/lib/internal/template/split-panel/icons/resize-handler.d.ts.map +0 -1
- package/lib/internal/template/split-panel/icons/resize-handler.js +0 -8
- package/lib/internal/template/split-panel/icons/resize-handler.js.map +0 -1
- /package/lib/internal/scss/split-panel/icons/{icons-styles.scss → styles.scss} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../../../src/pie-chart/labels.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAC;AAG5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAa,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAwBlF,SAAS,YAAY,CAAC,EACpB,CAAC,EACD,CAAC,EACD,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,WAAW,EACX,mBAAmB,GACD;IAClB,OAAO;IACL,mEAAmE;IACnE,2EAA2E;IAC3E,2BAAG,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,SAAS,EAAC,EAAE,YAAS,CAAC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CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1D,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;QAC7B,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACzD,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { arc, PieArcDatum } from 'd3-shape';\n\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { InternalChartDatum } from './pie-chart';\nimport { Dimension, balanceLabelNodes, computeSmartAngle } from './utils';\nimport ResponsiveText from './responsive-text';\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface LabelsProps<T> {\n pieData: PieArcDatum<InternalChartDatum<T>>[];\n visibleDataSum: number;\n dimensions: Dimension;\n hideTitles: boolean;\n hideDescriptions: boolean;\n highlightedSegment: PieChartProps.Datum | null;\n segmentDescription?: PieChartProps.SegmentDescriptionFunction<T>;\n containerRef: React.RefObject<HTMLDivElement>;\n}\n\ninterface LabelElementProps {\n x: number;\n y: number;\n rightSide: boolean;\n hideTitles: boolean;\n hideDescriptions: boolean;\n title: PieChartProps.Datum['title'];\n description?: string;\n containerBoundaries: null | { left: number; right: number };\n}\n\nfunction LabelElement({\n x,\n y,\n hideTitles,\n hideDescriptions,\n rightSide,\n title,\n description,\n containerBoundaries,\n}: LabelElementProps) {\n return (\n // Reset the transform property to prepare for `balanceLabelNodes`.\n // The dataset attributes are also needed in the function for IE11 support.\n <g className={styles['label-text']} transform=\"\" data-x={x} data-y={y}>\n {!hideTitles && (\n <ResponsiveText x={x} y={y} rightSide={rightSide} containerBoundaries={containerBoundaries}>\n {title}\n </ResponsiveText>\n )}\n {!hideDescriptions && description && (\n <ResponsiveText\n x={x}\n y={y + (hideTitles ? 0 : 18)}\n rightSide={rightSide}\n className={styles.label__description}\n containerBoundaries={containerBoundaries}\n >\n {description}\n </ResponsiveText>\n )}\n </g>\n );\n}\n\nexport default <T extends PieChartProps.Datum>({\n pieData,\n dimensions,\n highlightedSegment,\n segmentDescription,\n visibleDataSum,\n hideTitles,\n hideDescriptions,\n containerRef,\n}: LabelsProps<T>) => {\n const containerBoundaries = useElementBoundaries(containerRef);\n const shouldOptimizeLabels =\n containerBoundaries.right - containerBoundaries.left - (dimensions.outerRadius + dimensions.innerLabelPadding) * 2 <\n 300;\n const markers = useMemo(() => {\n const { outerRadius: radius, innerLabelPadding } = dimensions;\n\n // More arc factories for the label positioning\n const arcMarkerStart = arc<PieArcDatum<any>>()\n .innerRadius(radius - 1)\n .outerRadius(radius - 1);\n\n const arcMarkerBreak = arc<PieArcDatum<any>>()\n .innerRadius(radius + innerLabelPadding)\n .outerRadius(radius + innerLabelPadding);\n\n return pieData.map((datum, i) => {\n const labelDatum = pieData[i];\n const smartAngle = computeSmartAngle(labelDatum.startAngle, labelDatum.endAngle, shouldOptimizeLabels);\n\n // Make the marker line longer if the segment is closer to the top or bottom of the chart\n const lineExtension = 0.5 * Math.cos(2 * smartAngle) + 0.5;\n arcMarkerBreak.outerRadius(radius + 20 * lineExtension);\n arcMarkerBreak.innerRadius(radius + 20 * lineExtension);\n const [startX, startY] = arcMarkerStart.centroid({ ...datum, startAngle: smartAngle, endAngle: smartAngle });\n const [breakX, breakY] = arcMarkerBreak.centroid({ ...datum, startAngle: smartAngle, endAngle: smartAngle });\n\n const rightSide = smartAngle < Math.PI;\n const endX = shouldOptimizeLabels ? breakX + 20 * (rightSide ? 1 : -1) : (radius + 20) * (rightSide ? 1 : -1);\n const textX = endX + 5 * (rightSide ? 1 : -1);\n\n return {\n startX,\n startY,\n breakX,\n breakY,\n endX,\n endY: breakY,\n textX,\n textY: breakY,\n rightSide,\n datum,\n };\n });\n }, [pieData, dimensions, shouldOptimizeLabels]);\n\n const rootRef = useRef<SVGGElement>(null);\n\n useLayoutEffect(() => {\n if (!rootRef.current) {\n return;\n }\n\n // Relax labels that are overlapping\n const labelNodes = rootRef.current.querySelectorAll<SVGGElement>(`.${styles['label-text']}`);\n balanceLabelNodes(labelNodes, markers, false, dimensions.outerRadius + dimensions.innerLabelPadding);\n balanceLabelNodes(labelNodes, markers, true, dimensions.outerRadius + dimensions.innerLabelPadding);\n }, [markers, pieData, dimensions]);\n\n return (\n <g className={styles.markers} aria-hidden=\"true\" ref={rootRef}>\n {markers.map(({ startX, startY, breakX, breakY, endX, endY, textX, textY, rightSide, datum }) => {\n const segment = datum.data.datum;\n const description = segmentDescription?.(segment, visibleDataSum);\n if ((hideTitles && !description) || (hideDescriptions && !segment.title)) {\n return null;\n }\n return (\n <g\n key={datum.data.index}\n className={clsx(styles.label, {\n [styles['label--highlighted']]: highlightedSegment === segment,\n [styles['label--dimmed']]: highlightedSegment !== null && highlightedSegment !== segment,\n [styles['label--align-right']]: !rightSide,\n })}\n >\n <line x1={startX} y1={startY} x2={breakX} y2={breakY} />\n <line x1={breakX} y1={breakY} x2={endX} y2={endY} className={styles['label-line']} />\n <LabelElement\n x={textX}\n y={textY}\n rightSide={rightSide}\n title={segment.title}\n description={description}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n containerBoundaries={containerBoundaries}\n />\n </g>\n );\n })}\n </g>\n );\n};\n\nfunction useElementBoundaries(ref: React.RefObject<HTMLElement>): { left: number; right: number } {\n const [state, setState] = useState({ left: 0, right: 0 });\n useResizeObserver(ref, entry => {\n const elementRect = entry.target.getBoundingClientRect();\n setState({ left: elementRect.left, right: elementRect.right });\n });\n return state;\n}\n"]}
|
|
1
|
+
{"version":3,"file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C,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS;aAC3C,CAAC;YAEF,8BAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAI;YACxD,8BAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,GAAI;YACrF,oBAAC,YAAY,IACX,CAAC,EAAE,KAAK,EACR,CAAC,EAAE,KAAK,EACR,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,GACxC,CACA,CACL,CAAC;IACJ,CAAC,CAAC,CACA,CACL,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,GAAiC;IAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1D,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;QAC7B,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACzD,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\nimport { arc, PieArcDatum } from 'd3-shape';\n\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { InternalChartDatum } from './pie-chart';\nimport { Dimension, balanceLabelNodes, computeSmartAngle } from './utils';\nimport ResponsiveText from './responsive-text';\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nexport interface LabelsProps<T> {\n pieData: PieArcDatum<InternalChartDatum<T>>[];\n visibleDataSum: number;\n dimensions: Dimension;\n hideTitles: boolean;\n hideDescriptions: boolean;\n highlightedSegment: PieChartProps.Datum | null;\n segmentDescription?: PieChartProps.SegmentDescriptionFunction<T>;\n containerRef: React.RefObject<HTMLDivElement>;\n}\n\ninterface LabelElementProps {\n x: number;\n y: number;\n rightSide: boolean;\n hideTitles: boolean;\n hideDescriptions: boolean;\n title: PieChartProps.Datum['title'];\n description?: string;\n containerBoundaries: null | { left: number; right: number };\n}\n\nfunction LabelElement({\n x,\n y,\n hideTitles,\n hideDescriptions,\n rightSide,\n title,\n description,\n containerBoundaries,\n}: LabelElementProps) {\n return (\n <g className={styles['label-text']} transform=\"\" data-x={x} data-y={y}>\n {!hideTitles && (\n <ResponsiveText x={x} y={y} rightSide={rightSide} containerBoundaries={containerBoundaries}>\n {title}\n </ResponsiveText>\n )}\n {!hideDescriptions && description && (\n <ResponsiveText\n x={x}\n y={y + (hideTitles ? 0 : 18)}\n rightSide={rightSide}\n className={styles.label__description}\n containerBoundaries={containerBoundaries}\n >\n {description}\n </ResponsiveText>\n )}\n </g>\n );\n}\n\nexport default <T extends PieChartProps.Datum>({\n pieData,\n dimensions,\n highlightedSegment,\n segmentDescription,\n visibleDataSum,\n hideTitles,\n hideDescriptions,\n containerRef,\n}: LabelsProps<T>) => {\n const containerBoundaries = useElementBoundaries(containerRef);\n const shouldOptimizeLabels =\n containerBoundaries.right - containerBoundaries.left - (dimensions.outerRadius + dimensions.innerLabelPadding) * 2 <\n 300;\n const markers = useMemo(() => {\n const { outerRadius: radius, innerLabelPadding } = dimensions;\n\n // More arc factories for the label positioning\n const arcMarkerStart = arc<PieArcDatum<any>>()\n .innerRadius(radius - 1)\n .outerRadius(radius - 1);\n\n const arcMarkerBreak = arc<PieArcDatum<any>>()\n .innerRadius(radius + innerLabelPadding)\n .outerRadius(radius + innerLabelPadding);\n\n return pieData.map((datum, i) => {\n const labelDatum = pieData[i];\n const smartAngle = computeSmartAngle(labelDatum.startAngle, labelDatum.endAngle, shouldOptimizeLabels);\n\n // Make the marker line longer if the segment is closer to the top or bottom of the chart\n const lineExtension = 0.5 * Math.cos(2 * smartAngle) + 0.5;\n arcMarkerBreak.outerRadius(radius + 20 * lineExtension);\n arcMarkerBreak.innerRadius(radius + 20 * lineExtension);\n const [startX, startY] = arcMarkerStart.centroid({ ...datum, startAngle: smartAngle, endAngle: smartAngle });\n const [breakX, breakY] = arcMarkerBreak.centroid({ ...datum, startAngle: smartAngle, endAngle: smartAngle });\n\n const rightSide = smartAngle < Math.PI;\n const endX = shouldOptimizeLabels ? breakX + 20 * (rightSide ? 1 : -1) : (radius + 20) * (rightSide ? 1 : -1);\n const textX = endX + 5 * (rightSide ? 1 : -1);\n\n return {\n startX,\n startY,\n breakX,\n breakY,\n endX,\n endY: breakY,\n textX,\n textY: breakY,\n rightSide,\n datum,\n };\n });\n }, [pieData, dimensions, shouldOptimizeLabels]);\n\n const rootRef = useRef<SVGGElement>(null);\n\n useLayoutEffect(() => {\n if (!rootRef.current) {\n return;\n }\n\n // Relax labels that are overlapping\n const labelNodes = rootRef.current.querySelectorAll<SVGGElement>(`.${styles['label-text']}`);\n balanceLabelNodes(labelNodes, markers, false, dimensions.outerRadius + dimensions.innerLabelPadding);\n balanceLabelNodes(labelNodes, markers, true, dimensions.outerRadius + dimensions.innerLabelPadding);\n }, [markers, pieData, dimensions]);\n\n return (\n <g className={styles.markers} aria-hidden=\"true\" ref={rootRef}>\n {markers.map(({ startX, startY, breakX, breakY, endX, endY, textX, textY, rightSide, datum }) => {\n const segment = datum.data.datum;\n const description = segmentDescription?.(segment, visibleDataSum);\n if ((hideTitles && !description) || (hideDescriptions && !segment.title)) {\n return null;\n }\n return (\n <g\n key={datum.data.index}\n className={clsx(styles.label, {\n [styles['label--highlighted']]: highlightedSegment === segment,\n [styles['label--dimmed']]: highlightedSegment !== null && highlightedSegment !== segment,\n [styles['label--align-right']]: !rightSide,\n })}\n >\n <line x1={startX} y1={startY} x2={breakX} y2={breakY} />\n <line x1={breakX} y1={breakY} x2={endX} y2={endY} className={styles['label-line']} />\n <LabelElement\n x={textX}\n y={textY}\n rightSide={rightSide}\n title={segment.title}\n description={description}\n hideTitles={hideTitles}\n hideDescriptions={hideDescriptions}\n containerBoundaries={containerBoundaries}\n />\n </g>\n );\n })}\n </g>\n );\n};\n\nfunction useElementBoundaries(ref: React.RefObject<HTMLElement>): { left: number; right: number } {\n const [state, setState] = useState({ left: 0, right: 0 });\n useResizeObserver(ref, entry => {\n const elementRect = entry.target.getBoundingClientRect();\n setState({ left: elementRect.left, right: elementRect.right });\n });\n return state;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../src/pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAA4D,MAAM,OAAO,CAAC;AAWjF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAKzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,UAAU,qBAAqB,CAAC,CAAC,SAAS,aAAa,CAAC,KAAK,CAC3D,SAAQ,YAAY,CAClB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAAC,EAC1D,SA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AAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,kBAAkB,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC;IAE/C,aAAa,EAAE,CAAC,GAAG,IAAI,CAAC;IAExB,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC;CACpB;;AAED,wBA8UE"}
|
|
@@ -143,9 +143,6 @@ export default ({ fitHeight, height: explicitHeight, variant, size, width, i18nS
|
|
|
143
143
|
highlightSegment(pieData[nextIndex].data);
|
|
144
144
|
}, [setPinnedSegment, highlightSegment, pieData, highlightedSegmentIndex]);
|
|
145
145
|
const onApplicationFocus = useCallback((_event, target) => {
|
|
146
|
-
// We need to make sure that we do not re-show the popover when we focus the segment after the popover is dismissed.
|
|
147
|
-
// Normally we would check `event.relatedTarget` for the previously focused element,
|
|
148
|
-
// but this is not supported for SVG elements in IE11. The workaround is this `popoverDismissedRecently` ref.
|
|
149
146
|
if (pinnedSegment !== null || popoverDismissedRecently.current || target === 'mouse') {
|
|
150
147
|
return;
|
|
151
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.js","sourceRoot":"","sources":["../../../src/pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EA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AAO,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"]}
|
|
1
|
+
{"version":3,"file":"pie-chart.js","sourceRoot":"","sources":["../../../src/pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,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E,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 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/pie-chart/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,iBA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80
|
while ((leftSide && i >= 0) || (!leftSide && i < nodes.length)) {
|
|
81
81
|
const node = nodes[i];
|
|
82
|
-
// Currently using dataset attributes to determine the base position.
|
|
83
|
-
// This implementation can be changed back to using `getBBox` when we drop IE11 support.
|
|
84
|
-
// Unfortunately, there is no good alternative for `getBBox` that is supported by IE11.
|
|
85
|
-
// `getBoundingClientRect` works for width and height calculations in SVG, but the x/y positions are inaccurate.
|
|
86
82
|
const x = parseFloat(node.getAttribute('data-x') || '0');
|
|
87
83
|
const y = parseFloat(node.getAttribute('data-y') || '0');
|
|
88
84
|
const box = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/pie-chart/utils.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,aAAa,GAAG,EAAE,CAAC,CAAC,mCAAmC;AAC7D,MAAM,cAAc,GAAG,EAAE,CAAC,CAAC,YAAY;AACvC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,aAAa;AACrC,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;AAEvD,MAAM,CAAC,MAAM,gBAAgB,GAA0D;IACrF,KAAK,EAAE;QACL,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,YAAY;QAC/B,OAAO,EAAE,YAAY;QACrB,aAAa;KACd;IACD,MAAM,EAAE;QACN,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,GAAG;QAChB,iBAAiB,EAAE,cAAc;QACjC,OAAO,EAAE,cAAc;QACvB,aAAa;KACd;IACD,KAAK,EAAE;QACL,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,GAAG;QAChB,iBAAiB,EAAE,cAAc;QACjC,OAAO,EAAE,cAAc;QACvB,aAAa;KACd;CACF,CAAC;AAEF,MAAM,CAAC,MAAM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CAAC,EAAE,EAAE;QAC1D,OAAO,IAAI,CAAC,EAAE,CAAC;KAChB;IAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAClC,cAAc,EACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,EAClC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,cAAc,CAC7B,CAAC;IACF,MAAM,qBAAqB,GAAG,IAAI,CAAC,GAAG,CACpC,gBAAgB,EAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,gBAAgB,CAAC,EACpC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,gBAAgB,CAC/B,CAAC;IACF,IAAI,mBAAmB,GAAG,qBAAqB,EAAE;QAC/C,OAAO,cAAc,CAAC;KACvB;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ComponentFormatFunction } from '../i18n/context';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport interface Dimension {\n innerRadius: number;\n outerRadius: number;\n padding: number;\n paddingLabels: number;\n innerLabelPadding: number;\n cornerRadius?: number;\n}\n\nconst minRadius = 30;\nconst paddingLabels = 44; // = 2 * (size-lineHeight-body-100)\nconst defaultPadding = 12; // = space-s\nconst smallPadding = 8; // = space-xs\nexport const minLabelLineAngularPadding = Math.PI / 20;\n\nexport const dimensionsBySize: Record<NonNullable<PieChartProps['size']>, Dimension> = {\n small: {\n innerRadius: 33,\n outerRadius: 50,\n innerLabelPadding: smallPadding,\n padding: smallPadding,\n paddingLabels,\n },\n medium: {\n innerRadius: 66,\n outerRadius: 100,\n innerLabelPadding: defaultPadding,\n padding: defaultPadding,\n paddingLabels,\n },\n large: {\n innerRadius: 93,\n outerRadius: 140,\n innerLabelPadding: defaultPadding,\n padding: defaultPadding,\n paddingLabels,\n },\n};\n\nexport const refreshDimensionsBySize: Record<NonNullable<PieChartProps['size']>, Dimension> = {\n small: {\n ...dimensionsBySize.small,\n innerRadius: 38,\n cornerRadius: 3,\n },\n medium: {\n ...dimensionsBySize.medium,\n innerRadius: 75,\n cornerRadius: 4,\n },\n large: {\n ...dimensionsBySize.large,\n innerRadius: 105,\n cornerRadius: 5,\n },\n};\n\n/**\n * When `size` is a string (\"small\", \"medium\" or \"large\") the predefined pie chart element dimensions for classic and visual refresh are used.\n * When `size` is a number the outer and inner radii are computed and the rest of the dimensions are taken from the closest predefined size.\n */\nexport function getDimensionsBySize({\n size,\n hasLabels,\n visualRefresh,\n}: {\n size: NonNullable<PieChartProps['size']> | number;\n hasLabels: boolean;\n visualRefresh?: boolean;\n}): Dimension & { size: NonNullable<PieChartProps['size']> } {\n if (typeof size === 'string') {\n const dimensions = visualRefresh ? refreshDimensionsBySize[size] : dimensionsBySize[size];\n return { ...dimensions, size };\n }\n const sizeSpec = visualRefresh ? refreshDimensionsBySize : dimensionsBySize;\n const getPixelSize = (d: Dimension) => d.outerRadius * 2 + d.padding * 2 + (hasLabels ? d.paddingLabels : 0) * 2;\n\n let matchedSize: NonNullable<PieChartProps['size']> = 'small';\n if (size > getPixelSize(sizeSpec.medium)) {\n matchedSize = 'medium';\n }\n if (size > getPixelSize(sizeSpec.large)) {\n matchedSize = 'large';\n }\n\n const padding = sizeSpec[matchedSize].padding;\n const paddingLabels = hasLabels ? sizeSpec[matchedSize].paddingLabels : 0;\n const radiiRatio = sizeSpec[matchedSize].outerRadius / sizeSpec[matchedSize].innerRadius;\n const outerRadius = Math.max(minRadius, (size - 2 * paddingLabels - 2 * padding) / 2);\n const innerRadius = outerRadius / radiiRatio;\n\n return { ...sizeSpec[matchedSize], outerRadius, innerRadius, size: matchedSize };\n}\n\nexport const defaultDetails =\n (i18n: ComponentFormatFunction<'pie-chart'>, i18nStrings: PieChartProps.I18nStrings) =>\n (datum: PieChartProps.Datum, dataSum: number) => [\n { key: i18n('i18nStrings.detailsValue', i18nStrings.detailsValue) || '', value: datum.value },\n {\n key: i18n('i18nStrings.detailsPercentage', i18nStrings.detailsPercentage) || '',\n value: `${((datum.value * 100) / dataSum).toFixed(0)}%`,\n },\n ];\n\n/**\n * Adjusts the position of the given label nodes to avoid visual overlapping.\n * @param nodes List of label nodes of the entire chart (both left and right side)\n * @param markers Markers array that was calculated in <Labels>, but we just need the `endY` values\n * @param leftSide Boolean flag whether we are processing the left or right side of the chart labels\n */\nexport const balanceLabelNodes = (\n nodes: NodeListOf<SVGGElement>,\n markers: Array<{ endY: number; endX: number }>,\n leftSide: boolean,\n radius: number\n) => {\n const MARGIN = 10;\n\n let previousBBox: { x: number; y: number; height: number } | null = null;\n\n // When traversing the right side of labels, we start at the beginning of the array and go forwards.\n // For the left side, we need to traverse backwards from the end, so that overlapping nodes are pushed down in the right order.\n let i = leftSide ? nodes.length - 1 : 0;\n\n while ((leftSide && i >= 0) || (!leftSide && i < nodes.length)) {\n const node = nodes[i];\n\n // Currently using dataset attributes to determine the base position.\n // This implementation can be changed back to using `getBBox` when we drop IE11 support.\n // Unfortunately, there is no good alternative for `getBBox` that is supported by IE11.\n // `getBoundingClientRect` works for width and height calculations in SVG, but the x/y positions are inaccurate.\n const x = parseFloat(node.getAttribute('data-x') || '0');\n const y = parseFloat(node.getAttribute('data-y') || '0');\n const box = {\n x,\n y,\n height: node.getBoundingClientRect().height,\n };\n\n const marker = markers[i];\n\n if (leftSide) {\n i--;\n } else {\n i++;\n }\n\n if (!previousBBox) {\n previousBBox = box;\n node.setAttribute('transform', '');\n continue;\n }\n\n if ((!leftSide && box.x < 0) || (leftSide && box.x >= 0)) {\n // We have reached a label that is on the other side of the chart, so we're done.\n break;\n }\n\n node.setAttribute('transform', '');\n\n // Calculate how much the current node is overlapping with the previous one.\n const yOffset = previousBBox.y + previousBBox.height + MARGIN - box.y;\n\n if (yOffset > 0) {\n const xOffset = computeXOffset(box, yOffset, radius) * (leftSide ? -1 : 1);\n // Move the label down.\n node.setAttribute('transform', `translate(${xOffset} ${yOffset})`);\n\n // Adjust the attached line accordingly.\n const lineNode = node.parentNode?.querySelector(`.${styles['label-line']}`);\n if (lineNode) {\n const { endY, endX } = marker;\n lineNode.setAttribute('y2', '' + (endY + yOffset));\n lineNode.setAttribute('x2', '' + (endX + xOffset));\n }\n\n // Update the position accordingly to inform the next label\n box.y += yOffset;\n box.x += xOffset;\n }\n\n previousBBox = box;\n }\n};\n\nconst squareDistance = (edge: [number, number]): number => Math.pow(edge[0], 2) + Math.pow(edge[1], 2);\n\nconst computeXOffset = (box: { x: number; y: number; height: number }, yOffset: number, radius: number): number => {\n const upperEdge: [number, number] = [box.x, box.y + yOffset];\n const lowerEdge: [number, number] = [box.x, box.y + box.height + yOffset];\n const closestEdge = squareDistance(upperEdge) < squareDistance(lowerEdge) ? upperEdge : lowerEdge;\n\n if (squareDistance(closestEdge) < Math.pow(radius, 2)) {\n return Math.sqrt(Math.pow(radius, 2) - Math.pow(closestEdge[1], 2)) - Math.abs(closestEdge[0]);\n }\n return 0;\n};\n\nexport const computeSmartAngle = (startAngle: number, endAngle: number, optimize = false): number => {\n if (!optimize || endAngle - startAngle < 2 * minLabelLineAngularPadding) {\n return (endAngle + startAngle) / 2;\n }\n const paddedStartAngle = startAngle + minLabelLineAngularPadding;\n const paddedEndAngle = endAngle - minLabelLineAngularPadding;\n if (paddedStartAngle < 0 && paddedEndAngle > 0) {\n return 0;\n }\n if (paddedStartAngle < Math.PI && paddedEndAngle > Math.PI) {\n return Math.PI;\n }\n\n const endAngleMinDistance = Math.min(\n paddedEndAngle,\n Math.abs(Math.PI - paddedEndAngle),\n 2 * Math.PI - paddedEndAngle\n );\n const startAngleMinDistance = Math.min(\n paddedStartAngle,\n Math.abs(Math.PI - paddedStartAngle),\n 2 * Math.PI - paddedStartAngle\n );\n if (endAngleMinDistance < startAngleMinDistance) {\n return paddedEndAngle;\n }\n return paddedStartAngle;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sour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C,OAAO,cAAc,CAAC;KACvB;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ComponentFormatFunction } from '../i18n/context';\nimport { PieChartProps } from './interfaces';\nimport styles from './styles.css.js';\n\nexport interface Dimension {\n innerRadius: number;\n outerRadius: number;\n padding: number;\n paddingLabels: number;\n innerLabelPadding: number;\n cornerRadius?: number;\n}\n\nconst minRadius = 30;\nconst paddingLabels = 44; // = 2 * (size-lineHeight-body-100)\nconst defaultPadding = 12; // = space-s\nconst smallPadding = 8; // = space-xs\nexport const minLabelLineAngularPadding = Math.PI / 20;\n\nexport const dimensionsBySize: Record<NonNullable<PieChartProps['size']>, Dimension> = {\n small: {\n innerRadius: 33,\n outerRadius: 50,\n innerLabelPadding: smallPadding,\n padding: smallPadding,\n paddingLabels,\n },\n medium: {\n innerRadius: 66,\n outerRadius: 100,\n innerLabelPadding: defaultPadding,\n padding: defaultPadding,\n paddingLabels,\n },\n large: {\n innerRadius: 93,\n outerRadius: 140,\n innerLabelPadding: defaultPadding,\n padding: defaultPadding,\n paddingLabels,\n },\n};\n\nexport const refreshDimensionsBySize: Record<NonNullable<PieChartProps['size']>, Dimension> = {\n small: {\n ...dimensionsBySize.small,\n innerRadius: 38,\n cornerRadius: 3,\n },\n medium: {\n ...dimensionsBySize.medium,\n innerRadius: 75,\n cornerRadius: 4,\n },\n large: {\n ...dimensionsBySize.large,\n innerRadius: 105,\n cornerRadius: 5,\n },\n};\n\n/**\n * When `size` is a string (\"small\", \"medium\" or \"large\") the predefined pie chart element dimensions for classic and visual refresh are used.\n * When `size` is a number the outer and inner radii are computed and the rest of the dimensions are taken from the closest predefined size.\n */\nexport function getDimensionsBySize({\n size,\n hasLabels,\n visualRefresh,\n}: {\n size: NonNullable<PieChartProps['size']> | number;\n hasLabels: boolean;\n visualRefresh?: boolean;\n}): Dimension & { size: NonNullable<PieChartProps['size']> } {\n if (typeof size === 'string') {\n const dimensions = visualRefresh ? refreshDimensionsBySize[size] : dimensionsBySize[size];\n return { ...dimensions, size };\n }\n const sizeSpec = visualRefresh ? refreshDimensionsBySize : dimensionsBySize;\n const getPixelSize = (d: Dimension) => d.outerRadius * 2 + d.padding * 2 + (hasLabels ? d.paddingLabels : 0) * 2;\n\n let matchedSize: NonNullable<PieChartProps['size']> = 'small';\n if (size > getPixelSize(sizeSpec.medium)) {\n matchedSize = 'medium';\n }\n if (size > getPixelSize(sizeSpec.large)) {\n matchedSize = 'large';\n }\n\n const padding = sizeSpec[matchedSize].padding;\n const paddingLabels = hasLabels ? sizeSpec[matchedSize].paddingLabels : 0;\n const radiiRatio = sizeSpec[matchedSize].outerRadius / sizeSpec[matchedSize].innerRadius;\n const outerRadius = Math.max(minRadius, (size - 2 * paddingLabels - 2 * padding) / 2);\n const innerRadius = outerRadius / radiiRatio;\n\n return { ...sizeSpec[matchedSize], outerRadius, innerRadius, size: matchedSize };\n}\n\nexport const defaultDetails =\n (i18n: ComponentFormatFunction<'pie-chart'>, i18nStrings: PieChartProps.I18nStrings) =>\n (datum: PieChartProps.Datum, dataSum: number) => [\n { key: i18n('i18nStrings.detailsValue', i18nStrings.detailsValue) || '', value: datum.value },\n {\n key: i18n('i18nStrings.detailsPercentage', i18nStrings.detailsPercentage) || '',\n value: `${((datum.value * 100) / dataSum).toFixed(0)}%`,\n },\n ];\n\n/**\n * Adjusts the position of the given label nodes to avoid visual overlapping.\n * @param nodes List of label nodes of the entire chart (both left and right side)\n * @param markers Markers array that was calculated in <Labels>, but we just need the `endY` values\n * @param leftSide Boolean flag whether we are processing the left or right side of the chart labels\n */\nexport const balanceLabelNodes = (\n nodes: NodeListOf<SVGGElement>,\n markers: Array<{ endY: number; endX: number }>,\n leftSide: boolean,\n radius: number\n) => {\n const MARGIN = 10;\n\n let previousBBox: { x: number; y: number; height: number } | null = null;\n\n // When traversing the right side of labels, we start at the beginning of the array and go forwards.\n // For the left side, we need to traverse backwards from the end, so that overlapping nodes are pushed down in the right order.\n let i = leftSide ? nodes.length - 1 : 0;\n\n while ((leftSide && i >= 0) || (!leftSide && i < nodes.length)) {\n const node = nodes[i];\n\n const x = parseFloat(node.getAttribute('data-x') || '0');\n const y = parseFloat(node.getAttribute('data-y') || '0');\n const box = {\n x,\n y,\n height: node.getBoundingClientRect().height,\n };\n\n const marker = markers[i];\n\n if (leftSide) {\n i--;\n } else {\n i++;\n }\n\n if (!previousBBox) {\n previousBBox = box;\n node.setAttribute('transform', '');\n continue;\n }\n\n if ((!leftSide && box.x < 0) || (leftSide && box.x >= 0)) {\n // We have reached a label that is on the other side of the chart, so we're done.\n break;\n }\n\n node.setAttribute('transform', '');\n\n // Calculate how much the current node is overlapping with the previous one.\n const yOffset = previousBBox.y + previousBBox.height + MARGIN - box.y;\n\n if (yOffset > 0) {\n const xOffset = computeXOffset(box, yOffset, radius) * (leftSide ? -1 : 1);\n // Move the label down.\n node.setAttribute('transform', `translate(${xOffset} ${yOffset})`);\n\n // Adjust the attached line accordingly.\n const lineNode = node.parentNode?.querySelector(`.${styles['label-line']}`);\n if (lineNode) {\n const { endY, endX } = marker;\n lineNode.setAttribute('y2', '' + (endY + yOffset));\n lineNode.setAttribute('x2', '' + (endX + xOffset));\n }\n\n // Update the position accordingly to inform the next label\n box.y += yOffset;\n box.x += xOffset;\n }\n\n previousBBox = box;\n }\n};\n\nconst squareDistance = (edge: [number, number]): number => Math.pow(edge[0], 2) + Math.pow(edge[1], 2);\n\nconst computeXOffset = (box: { x: number; y: number; height: number }, yOffset: number, radius: number): number => {\n const upperEdge: [number, number] = [box.x, box.y + yOffset];\n const lowerEdge: [number, number] = [box.x, box.y + box.height + yOffset];\n const closestEdge = squareDistance(upperEdge) < squareDistance(lowerEdge) ? upperEdge : lowerEdge;\n\n if (squareDistance(closestEdge) < Math.pow(radius, 2)) {\n return Math.sqrt(Math.pow(radius, 2) - Math.pow(closestEdge[1], 2)) - Math.abs(closestEdge[0]);\n }\n return 0;\n};\n\nexport const computeSmartAngle = (startAngle: number, endAngle: number, optimize = false): number => {\n if (!optimize || endAngle - startAngle < 2 * minLabelLineAngularPadding) {\n return (endAngle + startAngle) / 2;\n }\n const paddedStartAngle = startAngle + minLabelLineAngularPadding;\n const paddedEndAngle = endAngle - minLabelLineAngularPadding;\n if (paddedStartAngle < 0 && paddedEndAngle > 0) {\n return 0;\n }\n if (paddedStartAngle < Math.PI && paddedEndAngle > Math.PI) {\n return Math.PI;\n }\n\n const endAngleMinDistance = Math.min(\n paddedEndAngle,\n Math.abs(Math.PI - paddedEndAngle),\n 2 * Math.PI - paddedEndAngle\n );\n const startAngleMinDistance = Math.min(\n paddedStartAngle,\n Math.abs(Math.PI - paddedStartAngle),\n 2 * Math.PI - paddedStartAngle\n );\n if (endAngleMinDistance < startAngleMinDistance) {\n return paddedEndAngle;\n }\n return paddedStartAngle;\n};\n"]}
|
|
@@ -70,11 +70,9 @@ function InternalPopover(_a, ref) {
|
|
|
70
70
|
setVisible(false);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
|
|
74
|
-
// the options.capture notation is unsupported by IE.
|
|
75
|
-
document.addEventListener('mousedown', onDocumentClick, false);
|
|
73
|
+
document.addEventListener('mousedown', onDocumentClick);
|
|
76
74
|
return () => {
|
|
77
|
-
document.removeEventListener('mousedown', onDocumentClick
|
|
75
|
+
document.removeEventListener('mousedown', onDocumentClick);
|
|
78
76
|
};
|
|
79
77
|
}, []);
|
|
80
78
|
const popoverClasses = usePortalModeClasses(triggerRef);
|
|
@@ -98,8 +96,7 @@ function InternalPopover(_a, ref) {
|
|
|
98
96
|
clickFrameId.current = null;
|
|
99
97
|
});
|
|
100
98
|
} }),
|
|
101
|
-
triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { tabIndex: triggerTabIndex, type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }),
|
|
102
|
-
React.createElement("span", { className: styles['trigger-inner-text'] }, children))) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
|
|
99
|
+
triggerType === 'text' ? (React.createElement("button", Object.assign({}, triggerProps, { tabIndex: triggerTabIndex, type: "button", "aria-haspopup": "dialog", id: referrerId, "aria-label": triggerAriaLabel }), children)) : (React.createElement("span", Object.assign({}, triggerProps, { id: referrerId }), children)),
|
|
103
100
|
React.createElement(ResetContextsForModal, null, renderWithPortal ? React.createElement(Portal, null, popoverContent) : popoverContent)));
|
|
104
101
|
}
|
|
105
102
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAEnD,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAC3C,OAAO,WAAW,MAAM,QAAQ,CAAC;AAEjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAA6B,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC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identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react';\nimport clsx from 'clsx';\n\nimport { KeyCode } from '../internal/keycode';\nimport { getBaseProps } from '../internal/base-component';\n\nimport Arrow from './arrow';\nimport Portal from '../internal/components/portal';\nimport { PopoverProps } from './interfaces';\nimport PopoverContainer from './container';\nimport PopoverBody from './body';\n\nimport styles from './styles.css.js';\nimport { NonCancelableEventHandler, fireNonCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useInternalI18n } from '../i18n/context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\n\nexport interface InternalPopoverProps extends PopoverProps, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (triggerType === 'text') {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n // useCapture=false makes sure this listener is called after the one attached to the element.\n // the options.capture notation is unsupported by IE.\n document.addEventListener('mousedown', onDocumentClick, false);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick, false);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n {visible && (\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n )}\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {triggerType === 'text' ? (\n <button\n {...triggerProps}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n <span className={styles['trigger-inner-text']}>{children}</span>\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/popover/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAA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EAAE,UAAU,gBACF,gBAAgB,KAE3B,QAAQ,CACF,CACV,CAAC,CAAC,CAAC,CACF,8CAAU,YAAY,IAAE,EAAE,EAAE,UAAU,KACnC,QAAQ,CACJ,CACR;QACD,oBAAC,qBAAqB,QACnB,gBAAgB,CAAC,CAAC,CAAC,oBAAC,MAAM,QAAE,cAAc,CAAU,CAAC,CAAC,CAAC,cAAc,CAChD,CACnB,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react';\nimport clsx from 'clsx';\n\nimport { KeyCode } from '../internal/keycode';\nimport { getBaseProps } from '../internal/base-component';\n\nimport Arrow from './arrow';\nimport Portal from '../internal/components/portal';\nimport { PopoverProps } from './interfaces';\nimport PopoverContainer from './container';\nimport PopoverBody from './body';\n\nimport styles from './styles.css.js';\nimport { NonCancelableEventHandler, fireNonCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useInternalI18n } from '../i18n/context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { getFirstFocusable } from '../internal/components/focus-lock/utils';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { useSingleTabStopNavigation } from '../internal/context/single-tab-stop-navigation-context';\n\nexport interface InternalPopoverProps extends PopoverProps, InternalBaseComponentProps {\n __onOpen?: NonCancelableEventHandler<null>;\n}\n\nexport interface InternalPopoverRef {\n dismissPopover: () => void;\n}\n\nexport default React.forwardRef(InternalPopover);\n\nfunction InternalPopover(\n {\n position = 'right',\n size = 'medium',\n fixedWidth = false,\n triggerType = 'text',\n dismissButton = true,\n\n children,\n header,\n content,\n triggerAriaLabel,\n\n renderWithPortal = false,\n\n __onOpen,\n __internalRootRef = null,\n ...restProps\n }: InternalPopoverProps,\n ref: React.Ref<InternalPopoverRef>\n) {\n const baseProps = getBaseProps(restProps);\n const triggerRef = useRef<HTMLElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const clickFrameId = useRef<number | null>(null);\n\n const i18n = useInternalI18n('popover');\n const dismissAriaLabel = i18n('dismissAriaLabel', restProps.dismissAriaLabel);\n\n const [visible, setVisible] = useState(false);\n\n const focusTrigger = useCallback(() => {\n if (triggerType === 'text') {\n triggerRef.current?.focus();\n } else {\n triggerRef.current && getFirstFocusable(triggerRef.current)?.focus();\n }\n }, [triggerType]);\n\n const onTriggerClick = useCallback(() => {\n fireNonCancelableEvent(__onOpen);\n setVisible(true);\n }, [__onOpen]);\n\n const onDismiss = useCallback(() => {\n setVisible(false);\n focusTrigger();\n }, [focusTrigger]);\n\n const onTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const isEscapeKey = event.keyCode === KeyCode.escape;\n const isTabKey = event.keyCode === KeyCode.tab;\n if (isEscapeKey && visible) {\n event.stopPropagation();\n }\n if (isTabKey || isEscapeKey) {\n setVisible(false);\n }\n },\n [visible]\n );\n\n useImperativeHandle(ref, () => ({\n dismissPopover: onDismiss,\n }));\n\n useEffect(() => {\n if (!triggerRef.current) {\n return;\n }\n const document = triggerRef.current.ownerDocument;\n\n const onDocumentClick = () => {\n // Dismiss popover unless there was a click inside within the last animation frame.\n if (clickFrameId.current === null) {\n setVisible(false);\n }\n };\n\n document.addEventListener('mousedown', onDocumentClick);\n\n return () => {\n document.removeEventListener('mousedown', onDocumentClick);\n };\n }, []);\n\n const popoverClasses = usePortalModeClasses(triggerRef);\n\n const triggerProps = {\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: triggerRef as any,\n onClick: onTriggerClick,\n onKeyDown: onTriggerKeyDown,\n className: clsx(styles.trigger, styles[`trigger-type-${triggerType}`]),\n };\n const { tabIndex: triggerTabIndex } = useSingleTabStopNavigation(triggerRef);\n\n const referrerId = useUniqueId();\n\n const popoverContent = (\n <div\n aria-live={dismissButton ? undefined : 'polite'}\n aria-atomic={dismissButton ? undefined : true}\n className={clsx(popoverClasses, !renderWithPortal && styles['popover-inline-content'])}\n data-awsui-referrer-id={referrerId}\n >\n {visible && (\n <PopoverContainer\n size={size}\n fixedWidth={fixedWidth}\n position={position}\n trackRef={triggerRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={renderWithPortal}\n zIndex={renderWithPortal ? 7000 : undefined}\n >\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <PopoverBody\n dismissButton={dismissButton}\n dismissAriaLabel={dismissAriaLabel}\n header={header}\n onDismiss={onDismiss}\n overflowVisible=\"both\"\n >\n {content}\n </PopoverBody>\n </LinkDefaultVariantContext.Provider>\n </PopoverContainer>\n )}\n </div>\n );\n\n const mergedRef = useMergeRefs(popoverRef, __internalRootRef);\n\n return (\n <span\n {...baseProps}\n className={clsx(styles.root, baseProps.className)}\n ref={mergedRef}\n onMouseDown={() => {\n // Indicate there was a click inside popover recently, including nested portals.\n clickFrameId.current = requestAnimationFrame(() => {\n clickFrameId.current = null;\n });\n }}\n >\n {triggerType === 'text' ? (\n <button\n {...triggerProps}\n tabIndex={triggerTabIndex}\n type=\"button\"\n aria-haspopup=\"dialog\"\n id={referrerId}\n aria-label={triggerAriaLabel}\n >\n {children}\n </button>\n ) : (\n <span {...triggerProps} id={referrerId}>\n {children}\n </span>\n )}\n <ResetContextsForModal>\n {renderWithPortal ? <Portal>{popoverContent}</Portal> : popoverContent}\n </ResetContextsForModal>\n </span>\n );\n}\n"]}
|
|
@@ -1,55 +1,54 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"arrow": "
|
|
5
|
-
"arrow-outer": "awsui_arrow-
|
|
6
|
-
"arrow-inner": "awsui_arrow-
|
|
7
|
-
"refresh": "
|
|
8
|
-
"arrow-position-right-top": "awsui_arrow-position-right-
|
|
9
|
-
"arrow-position-right-bottom": "awsui_arrow-position-right-
|
|
10
|
-
"arrow-position-left-top": "awsui_arrow-position-left-
|
|
11
|
-
"arrow-position-left-bottom": "awsui_arrow-position-left-
|
|
12
|
-
"arrow-position-top-center": "awsui_arrow-position-top-
|
|
13
|
-
"arrow-position-top-right": "awsui_arrow-position-top-
|
|
14
|
-
"arrow-position-top-left": "awsui_arrow-position-top-
|
|
15
|
-
"arrow-position-top-responsive": "awsui_arrow-position-top-
|
|
16
|
-
"arrow-position-bottom-center": "awsui_arrow-position-bottom-
|
|
17
|
-
"arrow-position-bottom-right": "awsui_arrow-position-bottom-
|
|
18
|
-
"arrow-position-bottom-left": "awsui_arrow-position-bottom-
|
|
19
|
-
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-
|
|
20
|
-
"body": "
|
|
21
|
-
"body-overflow-visible": "awsui_body-overflow-
|
|
22
|
-
"has-dismiss": "awsui_has-
|
|
23
|
-
"dismiss": "
|
|
24
|
-
"dismiss-control": "awsui_dismiss-
|
|
25
|
-
"header-row": "awsui_header-
|
|
26
|
-
"header": "
|
|
27
|
-
"content": "
|
|
28
|
-
"content-overflow-visible": "awsui_content-overflow-
|
|
29
|
-
"container": "
|
|
30
|
-
"container-body": "awsui_container-
|
|
31
|
-
"container-body-variant-annotation": "awsui_container-body-variant-
|
|
32
|
-
"container-body-size-small": "awsui_container-body-size-
|
|
33
|
-
"fixed-width": "awsui_fixed-
|
|
34
|
-
"container-body-size-medium": "awsui_container-body-size-
|
|
35
|
-
"container-body-size-large": "awsui_container-body-size-
|
|
36
|
-
"container-arrow": "awsui_container-
|
|
37
|
-
"container-arrow-position-right-top": "awsui_container-arrow-position-right-
|
|
38
|
-
"container-arrow-position-right-bottom": "awsui_container-arrow-position-right-
|
|
39
|
-
"container-arrow-position-left-top": "awsui_container-arrow-position-left-
|
|
40
|
-
"container-arrow-position-left-bottom": "awsui_container-arrow-position-left-
|
|
41
|
-
"container-arrow-position-top-center": "awsui_container-arrow-position-top-
|
|
42
|
-
"container-arrow-position-top-right": "awsui_container-arrow-position-top-
|
|
43
|
-
"container-arrow-position-top-left": "awsui_container-arrow-position-top-
|
|
44
|
-
"container-arrow-position-top-responsive": "awsui_container-arrow-position-top-
|
|
45
|
-
"container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-
|
|
46
|
-
"container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-
|
|
47
|
-
"container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-
|
|
48
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
49
|
-
"root": "
|
|
50
|
-
"trigger": "
|
|
51
|
-
"trigger-type-text": "awsui_trigger-type-
|
|
52
|
-
"
|
|
53
|
-
"popover-inline-content": "awsui_popover-inline-content_xjuzf_2nwcz_922"
|
|
4
|
+
"arrow": "awsui_arrow_xjuzf_13n6r_197",
|
|
5
|
+
"arrow-outer": "awsui_arrow-outer_xjuzf_13n6r_201",
|
|
6
|
+
"arrow-inner": "awsui_arrow-inner_xjuzf_13n6r_201",
|
|
7
|
+
"refresh": "awsui_refresh_xjuzf_13n6r_235",
|
|
8
|
+
"arrow-position-right-top": "awsui_arrow-position-right-top_xjuzf_13n6r_245",
|
|
9
|
+
"arrow-position-right-bottom": "awsui_arrow-position-right-bottom_xjuzf_13n6r_245",
|
|
10
|
+
"arrow-position-left-top": "awsui_arrow-position-left-top_xjuzf_13n6r_248",
|
|
11
|
+
"arrow-position-left-bottom": "awsui_arrow-position-left-bottom_xjuzf_13n6r_248",
|
|
12
|
+
"arrow-position-top-center": "awsui_arrow-position-top-center_xjuzf_13n6r_251",
|
|
13
|
+
"arrow-position-top-right": "awsui_arrow-position-top-right_xjuzf_13n6r_251",
|
|
14
|
+
"arrow-position-top-left": "awsui_arrow-position-top-left_xjuzf_13n6r_251",
|
|
15
|
+
"arrow-position-top-responsive": "awsui_arrow-position-top-responsive_xjuzf_13n6r_251",
|
|
16
|
+
"arrow-position-bottom-center": "awsui_arrow-position-bottom-center_xjuzf_13n6r_254",
|
|
17
|
+
"arrow-position-bottom-right": "awsui_arrow-position-bottom-right_xjuzf_13n6r_254",
|
|
18
|
+
"arrow-position-bottom-left": "awsui_arrow-position-bottom-left_xjuzf_13n6r_254",
|
|
19
|
+
"arrow-position-bottom-responsive": "awsui_arrow-position-bottom-responsive_xjuzf_13n6r_254",
|
|
20
|
+
"body": "awsui_body_xjuzf_13n6r_356",
|
|
21
|
+
"body-overflow-visible": "awsui_body-overflow-visible_xjuzf_13n6r_395",
|
|
22
|
+
"has-dismiss": "awsui_has-dismiss_xjuzf_13n6r_399",
|
|
23
|
+
"dismiss": "awsui_dismiss_xjuzf_13n6r_404",
|
|
24
|
+
"dismiss-control": "awsui_dismiss-control_xjuzf_13n6r_412",
|
|
25
|
+
"header-row": "awsui_header-row_xjuzf_13n6r_416",
|
|
26
|
+
"header": "awsui_header_xjuzf_13n6r_416",
|
|
27
|
+
"content": "awsui_content_xjuzf_13n6r_442",
|
|
28
|
+
"content-overflow-visible": "awsui_content-overflow-visible_xjuzf_13n6r_450",
|
|
29
|
+
"container": "awsui_container_xjuzf_13n6r_552",
|
|
30
|
+
"container-body": "awsui_container-body_xjuzf_13n6r_560",
|
|
31
|
+
"container-body-variant-annotation": "awsui_container-body-variant-annotation_xjuzf_13n6r_603",
|
|
32
|
+
"container-body-size-small": "awsui_container-body-size-small_xjuzf_13n6r_608",
|
|
33
|
+
"fixed-width": "awsui_fixed-width_xjuzf_13n6r_611",
|
|
34
|
+
"container-body-size-medium": "awsui_container-body-size-medium_xjuzf_13n6r_615",
|
|
35
|
+
"container-body-size-large": "awsui_container-body-size-large_xjuzf_13n6r_622",
|
|
36
|
+
"container-arrow": "awsui_container-arrow_xjuzf_13n6r_634",
|
|
37
|
+
"container-arrow-position-right-top": "awsui_container-arrow-position-right-top_xjuzf_13n6r_638",
|
|
38
|
+
"container-arrow-position-right-bottom": "awsui_container-arrow-position-right-bottom_xjuzf_13n6r_638",
|
|
39
|
+
"container-arrow-position-left-top": "awsui_container-arrow-position-left-top_xjuzf_13n6r_654",
|
|
40
|
+
"container-arrow-position-left-bottom": "awsui_container-arrow-position-left-bottom_xjuzf_13n6r_654",
|
|
41
|
+
"container-arrow-position-top-center": "awsui_container-arrow-position-top-center_xjuzf_13n6r_670",
|
|
42
|
+
"container-arrow-position-top-right": "awsui_container-arrow-position-top-right_xjuzf_13n6r_670",
|
|
43
|
+
"container-arrow-position-top-left": "awsui_container-arrow-position-top-left_xjuzf_13n6r_670",
|
|
44
|
+
"container-arrow-position-top-responsive": "awsui_container-arrow-position-top-responsive_xjuzf_13n6r_670",
|
|
45
|
+
"container-arrow-position-bottom-center": "awsui_container-arrow-position-bottom-center_xjuzf_13n6r_686",
|
|
46
|
+
"container-arrow-position-bottom-right": "awsui_container-arrow-position-bottom-right_xjuzf_13n6r_690",
|
|
47
|
+
"container-arrow-position-bottom-left": "awsui_container-arrow-position-bottom-left_xjuzf_13n6r_694",
|
|
48
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_xjuzf_13n6r_1",
|
|
49
|
+
"root": "awsui_root_xjuzf_13n6r_840",
|
|
50
|
+
"trigger": "awsui_trigger_xjuzf_13n6r_876",
|
|
51
|
+
"trigger-type-text": "awsui_trigger-type-text_xjuzf_13n6r_883",
|
|
52
|
+
"popover-inline-content": "awsui_popover-inline-content_xjuzf_13n6r_919"
|
|
54
53
|
};
|
|
55
54
|
|