@cloudscape-design/chart-components 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cartesian-chart/chart-cartesian-internal.js.map +1 -1
- package/cartesian-chart/chart-series-cartesian.js.map +1 -1
- package/cartesian-chart/index.js.map +1 -1
- package/cartesian-chart/interfaces.js.map +1 -1
- package/core/chart-api/chart-extra-axis-titles.js.map +1 -1
- package/core/chart-api/chart-extra-context.js.map +1 -1
- package/core/chart-api/chart-extra-highlight.js.map +1 -1
- package/core/chart-api/chart-extra-legend.js.map +1 -1
- package/core/chart-api/chart-extra-navigation.js.map +1 -1
- package/core/chart-api/chart-extra-nodata.js.map +1 -1
- package/core/chart-api/chart-extra-pointer.js.map +1 -1
- package/core/chart-api/chart-extra-tooltip.d.ts +2 -2
- package/core/chart-api/chart-extra-tooltip.js.map +1 -1
- package/core/chart-api/index.d.ts +7 -7
- package/core/chart-api/index.js.map +1 -1
- package/core/chart-core.js.map +1 -1
- package/core/components/core-legend.js.map +1 -1
- package/core/components/core-no-data.js.map +1 -1
- package/core/components/core-tooltip.js.map +1 -1
- package/core/components/core-vertical-axis-title.js.map +1 -1
- package/core/formatters.js.map +1 -1
- package/core/i18n-utils.js.map +1 -1
- package/core/interfaces.js.map +1 -1
- package/core/utils.js +3 -0
- package/core/utils.js.map +1 -1
- package/internal/api-docs/components/cartesian-chart.js +2 -2
- package/internal/api-docs/components/pie-chart.js +2 -2
- package/internal/base-component/get-data-attributes.js.map +1 -1
- package/internal/components/chart-legend/index.js.map +1 -1
- package/internal/components/series-details/index.js.map +1 -1
- package/internal/components/series-marker/render-marker.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/events/index.js.map +1 -1
- package/internal/generated/styles/tokens.d.ts +0 -2
- package/internal/generated/styles/tokens.js +2 -4
- package/internal/generated/theming/index.cjs +2 -64
- package/internal/generated/theming/index.js +2 -64
- package/internal/manifest.json +1 -1
- package/internal/utils/async-store.js.map +1 -1
- package/internal/utils/dom.js.map +1 -1
- package/internal/utils/renderer-utils.js.map +1 -1
- package/internal/utils/use-debounced-value.js.map +1 -1
- package/internal/utils/utils.js.map +1 -1
- package/internal-do-not-use/core-legend/index.js.map +1 -1
- package/package.json +4 -4
- package/pie-chart/chart-inner-area.js.map +1 -1
- package/pie-chart/chart-pie-internal.js.map +1 -1
- package/pie-chart/index.js.map +1 -1
- package/test-utils/dom/cartesian-chart/index.js +1 -1
- package/test-utils/dom/cartesian-chart/index.js.map +1 -1
- package/test-utils/dom/index.js +1 -1
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/dom/internal/base.js +1 -1
- package/test-utils/dom/internal/base.js.map +1 -1
- package/test-utils/dom/pie-chart/index.js +1 -1
- package/test-utils/dom/pie-chart/index.js.map +1 -1
- package/test-utils/selectors/cartesian-chart/index.js +1 -1
- package/test-utils/selectors/cartesian-chart/index.js.map +1 -1
- package/test-utils/selectors/index.js +1 -1
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/selectors/internal/base.js +1 -1
- package/test-utils/selectors/internal/base.js.map +1 -1
- package/test-utils/selectors/pie-chart/index.js +1 -1
- package/test-utils/selectors/pie-chart/index.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-pie-internal.js","sourceRoot":"","sources":["../../../src/pie-chart/chart-pie-internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,MAAM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K,CAAC,eAAe,EACnC,oBAAoB,EAAE,uBAAuB,EAC7C,SAAS,EAAE,WAAW,CAAC,IAAI,GAC3B,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, useImperativeHandle, useRef } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport type Highcharts from \"highcharts\";\n\nimport { useControllableState } from \"@cloudscape-design/component-toolkit\";\n\nimport { InternalCoreChart } from \"../core/chart-core\";\nimport { CoreChartProps } from \"../core/interfaces\";\nimport { getOptionsId } from \"../core/utils\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { fireNonCancelableEvent } from \"../internal/events\";\nimport { SomeRequired, Writeable } from \"../internal/utils/utils\";\nimport { useInnerArea } from \"./chart-inner-area\";\nimport { PieChartProps } from \"./interfaces\";\n\nimport testClasses from \"./test-classes/styles.css.js\";\n\ninterface InternalPieChartProps extends InternalBaseComponentProps, Omit<PieChartProps, \"series\"> {\n series: readonly PieChartProps.SeriesOptions[];\n tooltip: SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\">;\n legend: SomeRequired<PieChartProps.LegendOptions, \"enabled\">;\n}\n\nexport const InternalPieChart = forwardRef(\n ({ series: originalSeries, tooltip, ...props }: InternalPieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n const apiRef = useRef<null | CoreChartProps.ChartAPI>(null);\n\n // When visibleSegments and onVisibleSegmentsChange are provided - the segments visibility can be controlled from the outside.\n // Otherwise - the component handles segments visibility using its internal state.\n useControllableState(props.visibleSegments, props.onVisibleSegmentsChange, undefined, {\n componentName: \"PieChart\",\n propertyName: \"visibleSegments\",\n changeHandlerName: \"onVisibleSegmentsChange\",\n });\n const allSegmentIds = originalSeries.flatMap((s) => s.data.map((d) => getOptionsId(d)));\n const onVisibleSegmentsChange: CoreChartProps[\"onVisibleItemsChange\"] = ({ detail: { items } }) => {\n const visibleSegments = items.filter((i) => i.visible).map((i) => i.id);\n fireNonCancelableEvent(props.onVisibleSegmentsChange, { visibleSegments });\n };\n\n // Converting donut series to Highcharts pie series.\n const series: Highcharts.SeriesOptionsType[] = originalSeries.map((s) => {\n const data = s.data as Writeable<PieChartProps.PieSegmentOptions[]>;\n const style = s.type === \"pie\" ? Styles.pieSeries : Styles.donutSeries;\n return { ...s, type: \"pie\", data, ...style };\n });\n\n // Pie chart imperative API.\n useImperativeHandle(ref, () => ({\n setVisibleSegments: (visibleSegmentsIds) => apiRef.current?.setItemsVisible(visibleSegmentsIds),\n showAllSegments: () => apiRef.current?.setItemsVisible(allSegmentIds),\n }));\n\n // Get inner area title and description for donut chart.\n const innerArea = useInnerArea(originalSeries, props);\n\n // We convert pie tooltip options to the core chart's getTooltipContent callback,\n // ensuring no internal types are exposed to the consumer-defined render functions.\n const getTooltipContent: CoreChartProps[\"getTooltipContent\"] = () => {\n const transformDetailsProps = ({\n point,\n }: CoreChartProps.TooltipDetailsProps): PieChartProps.TooltipDetailsRenderProps => {\n return {\n totalValue: point.total ?? 0,\n segmentValue: point.y ?? 0,\n segmentId: getOptionsId(point.options),\n segmentName: point.name ?? \"\",\n };\n };\n const transformSlotProps = (props: CoreChartProps.TooltipSlotProps): PieChartProps.TooltipDetailsRenderProps => {\n const point = props.items[0].point;\n return transformDetailsProps({ point, hideTooltip: props.hideTooltip });\n };\n return {\n header: tooltip?.header ? (props) => tooltip.header!(transformSlotProps(props)) : undefined,\n details: tooltip?.details ? (props) => tooltip.details!(transformDetailsProps(props)) : undefined,\n body: tooltip?.body ? (props) => tooltip.body!(transformSlotProps(props)) : undefined,\n footer: tooltip?.footer ? (props) => tooltip.footer!(transformSlotProps(props)) : undefined,\n };\n };\n\n // Convert pie segment props to Highcharts segment data labels.\n const segmentDataLabels:\n | Highcharts.SeriesPieDataLabelsOptionsObject\n | Highcharts.SeriesPieDataLabelsOptionsObject[] = {\n position: \"left\",\n formatter() {\n const { segmentTitle, segmentDescription } = props;\n const segmentProps = {\n // For pie series, we expect y, total, and name to be always present, and y to be non-null for any visible segment.\n // However, these are optional in Highcharts types, so we need to do a fallback.\n totalValue: this.total ?? 0,\n segmentValue: this.y ?? 0,\n segmentId: this.options.id,\n segmentName: this.options.name ?? \"\",\n };\n const title = segmentTitle ? segmentTitle(segmentProps) : this.name;\n const description = segmentDescription?.(segmentProps);\n if (title || description) {\n return renderToStaticMarkup(\n <text>\n {title ? <tspan>{title}</tspan> : null}\n <br />\n {description ? <tspan style={Styles.segmentDescriptionCss}>{description}</tspan> : null}\n </text>,\n );\n }\n return null;\n },\n useHTML: false,\n };\n\n const highchartsOptions: Highcharts.Options = {\n chart: {\n events: {\n render(event) {\n innerArea.onChartRender.call(this, event);\n },\n },\n },\n plotOptions: {\n pie: {\n dataLabels: segmentDataLabels,\n },\n },\n series,\n };\n\n return (\n <InternalCoreChart\n {...props}\n callback={(api) => (apiRef.current = api)}\n options={highchartsOptions}\n tooltip={tooltip}\n getTooltipContent={getTooltipContent}\n visibleItems={props.visibleSegments}\n onVisibleItemsChange={onVisibleSegmentsChange}\n className={testClasses.root}\n />\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"chart-pie-internal.js","sourceRoot":"","sources":["../../../src/pie-chart/chart-pie-internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OA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nC,oBAAoB,EAAE,uBAAuB,EAC7C,SAAS,EAAE,WAAW,CAAC,IAAI,GAC3B,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef, useImperativeHandle, useRef } from \"react\";\nimport { renderToStaticMarkup } from \"react-dom/server\";\nimport type Highcharts from \"highcharts\";\n\nimport { useControllableState } from \"@cloudscape-design/component-toolkit\";\n\nimport { InternalCoreChart } from \"../core/chart-core\";\nimport { CoreChartProps } from \"../core/interfaces\";\nimport { getOptionsId } from \"../core/utils\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { fireNonCancelableEvent } from \"../internal/events\";\nimport { SomeRequired, Writeable } from \"../internal/utils/utils\";\nimport { useInnerArea } from \"./chart-inner-area\";\nimport { PieChartProps } from \"./interfaces\";\n\nimport testClasses from \"./test-classes/styles.css.js\";\n\ninterface InternalPieChartProps extends InternalBaseComponentProps, Omit<PieChartProps, \"series\"> {\n series: readonly PieChartProps.SeriesOptions[];\n tooltip: SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\">;\n legend: SomeRequired<PieChartProps.LegendOptions, \"enabled\">;\n}\n\nexport const InternalPieChart = forwardRef(\n ({ series: originalSeries, tooltip, ...props }: InternalPieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n const apiRef = useRef<null | CoreChartProps.ChartAPI>(null);\n\n // When visibleSegments and onVisibleSegmentsChange are provided - the segments visibility can be controlled from the outside.\n // Otherwise - the component handles segments visibility using its internal state.\n useControllableState(props.visibleSegments, props.onVisibleSegmentsChange, undefined, {\n componentName: \"PieChart\",\n propertyName: \"visibleSegments\",\n changeHandlerName: \"onVisibleSegmentsChange\",\n });\n const allSegmentIds = originalSeries.flatMap((s) => s.data.map((d) => getOptionsId(d)));\n const onVisibleSegmentsChange: CoreChartProps[\"onVisibleItemsChange\"] = ({ detail: { items } }) => {\n const visibleSegments = items.filter((i) => i.visible).map((i) => i.id);\n fireNonCancelableEvent(props.onVisibleSegmentsChange, { visibleSegments });\n };\n\n // Converting donut series to Highcharts pie series.\n const series: Highcharts.SeriesOptionsType[] = originalSeries.map((s) => {\n const data = s.data as Writeable<PieChartProps.PieSegmentOptions[]>;\n const style = s.type === \"pie\" ? Styles.pieSeries : Styles.donutSeries;\n return { ...s, type: \"pie\", data, ...style };\n });\n\n // Pie chart imperative API.\n useImperativeHandle(ref, () => ({\n setVisibleSegments: (visibleSegmentsIds) => apiRef.current?.setItemsVisible(visibleSegmentsIds),\n showAllSegments: () => apiRef.current?.setItemsVisible(allSegmentIds),\n }));\n\n // Get inner area title and description for donut chart.\n const innerArea = useInnerArea(originalSeries, props);\n\n // We convert pie tooltip options to the core chart's getTooltipContent callback,\n // ensuring no internal types are exposed to the consumer-defined render functions.\n const getTooltipContent: CoreChartProps[\"getTooltipContent\"] = () => {\n const transformDetailsProps = ({\n point,\n }: CoreChartProps.TooltipDetailsProps): PieChartProps.TooltipDetailsRenderProps => {\n return {\n totalValue: point.total ?? 0,\n segmentValue: point.y ?? 0,\n segmentId: getOptionsId(point.options),\n segmentName: point.name ?? \"\",\n };\n };\n const transformSlotProps = (props: CoreChartProps.TooltipSlotProps): PieChartProps.TooltipDetailsRenderProps => {\n const point = props.items[0].point;\n return transformDetailsProps({ point, hideTooltip: props.hideTooltip });\n };\n return {\n header: tooltip?.header ? (props) => tooltip.header!(transformSlotProps(props)) : undefined,\n details: tooltip?.details ? (props) => tooltip.details!(transformDetailsProps(props)) : undefined,\n body: tooltip?.body ? (props) => tooltip.body!(transformSlotProps(props)) : undefined,\n footer: tooltip?.footer ? (props) => tooltip.footer!(transformSlotProps(props)) : undefined,\n };\n };\n\n // Convert pie segment props to Highcharts segment data labels.\n const segmentDataLabels:\n | Highcharts.SeriesPieDataLabelsOptionsObject\n | Highcharts.SeriesPieDataLabelsOptionsObject[] = {\n position: \"left\",\n formatter() {\n const { segmentTitle, segmentDescription } = props;\n const segmentProps = {\n // For pie series, we expect y, total, and name to be always present, and y to be non-null for any visible segment.\n // However, these are optional in Highcharts types, so we need to do a fallback.\n totalValue: this.total ?? 0,\n segmentValue: this.y ?? 0,\n segmentId: this.options.id,\n segmentName: this.options.name ?? \"\",\n };\n const title = segmentTitle ? segmentTitle(segmentProps) : this.name;\n const description = segmentDescription?.(segmentProps);\n if (title || description) {\n return renderToStaticMarkup(\n <text>\n {title ? <tspan>{title}</tspan> : null}\n <br />\n {description ? <tspan style={Styles.segmentDescriptionCss}>{description}</tspan> : null}\n </text>,\n );\n }\n return null;\n },\n useHTML: false,\n };\n\n const highchartsOptions: Highcharts.Options = {\n chart: {\n events: {\n render(event) {\n innerArea.onChartRender.call(this, event);\n },\n },\n },\n plotOptions: {\n pie: {\n dataLabels: segmentDataLabels,\n },\n },\n series,\n };\n\n return (\n <InternalCoreChart\n {...props}\n callback={(api) => (apiRef.current = api)}\n options={highchartsOptions}\n tooltip={tooltip}\n getTooltipContent={getTooltipContent}\n visibleItems={props.visibleSegments}\n onVisibleItemsChange={onVisibleSegmentsChange}\n className={testClasses.root}\n />\n );\n },\n);\n"]}
|
package/pie-chart/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pie-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAKxD,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GA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AAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAsC;;IAEtC,OAAO;QACL,GAAG,OAAO;QACV,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI;QACjC,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,QAAQ;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAoC;;IAC3D,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,IAAI,EAAE,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { forwardRef } from \"react\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { SomeRequired } from \"../internal/utils/utils\";\nimport { InternalPieChart } from \"./chart-pie-internal\";\nimport { PieChartProps } from \"./interfaces\";\n\nexport type { PieChartProps };\n\nconst PieChart = forwardRef(({ fitHeight = false, ...props }: PieChartProps, ref: React.Ref<PieChartProps.Ref>) => {\n // We transform options before propagating them to the internal chart to ensure only those\n // defined in the component's contract can be propagated down to the underlying Highcharts.\n // Additionally, we assign all default options, including the nested ones.\n const series = transformSeries(props.series);\n const tooltip = transformTooltip(props.tooltip);\n const legend = transformLegend(props.legend);\n\n const baseComponentProps = useBaseComponent(\"PieChart\", { props: { fitHeight } });\n\n return (\n <InternalPieChart\n ref={ref}\n {...props}\n fitHeight={fitHeight}\n series={series}\n tooltip={tooltip}\n legend={legend}\n {...getDataAttributes(props)}\n {...baseComponentProps}\n />\n );\n});\n\napplyDisplayName(PieChart, \"PieChart\");\n\nexport default PieChart;\n\nfunction transformSeries(series: null | PieChartProps.SeriesOptions): readonly PieChartProps.SeriesOptions[] {\n if (!series) {\n return [];\n }\n switch (series.type) {\n case \"pie\":\n case \"donut\":\n return [\n { type: series.type, id: series.id, name: series.name, color: series.color, data: transformData(series.data) },\n ];\n }\n}\n\nfunction transformData(data: readonly PieChartProps.PieSegmentOptions[]): readonly PieChartProps.PieSegmentOptions[] {\n return data.map((d) => ({ id: d.id, name: d.name, color: d.color, y: d.y }));\n}\n\nfunction transformTooltip(\n tooltip?: PieChartProps.TooltipOptions,\n): SomeRequired<PieChartProps.TooltipOptions, \"enabled\" | \"size\"> {\n return {\n ...tooltip,\n enabled: tooltip?.enabled ?? true,\n size: tooltip?.size ?? \"medium\",\n };\n}\n\nfunction transformLegend(legend?: PieChartProps.LegendOptions): SomeRequired<PieChartProps.LegendOptions, \"enabled\"> {\n return { ...legend, enabled: legend?.enabled ?? true };\n}\n"]}
|
|
@@ -19,6 +19,6 @@ class CartesianChartWrapper extends base_1.default {
|
|
|
19
19
|
return this.findAllByClassName("highcharts-series");
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.default = CartesianChartWrapper;
|
|
23
22
|
CartesianChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
23
|
+
exports.default = CartesianChartWrapper;
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/cartesian-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,2CAAgD;AAChD,uCAAyD;AAEzD,mGAAoF;AAEpF,MAAqB,qBAAsB,SAAQ,cAAgB;IAGjE;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sCAA4B,CAAC,YAAY,EAAE,EAAE,sCAA4B,CAAC,CAAC;IAC3G,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/cartesian-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,2CAAgD;AAChD,uCAAyD;AAEzD,mGAAoF;AAEpF,MAAqB,qBAAsB,SAAQ,cAAgB;IAGjE;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sCAA4B,CAAC,YAAY,EAAE,EAAE,sCAA4B,CAAC,CAAC;IAC3G,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;;AAdM,kCAAY,GAAW,6BAAW,CAAC,IAAI,CAAC;kBAD5B,qBAAqB","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\n\nimport BaseChartWrapper from \"../internal/base\";\nimport { CartesianChartTooltipWrapper } from \"./tooltip\";\n\nimport testClasses from \"../../../cartesian-chart/test-classes/styles.selectors.js\";\n\nexport default class CartesianChartWrapper extends BaseChartWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds chart's tooltip when visible.\n */\n public findTooltip(): null | CartesianChartTooltipWrapper {\n return this.findComponent(`.${CartesianChartTooltipWrapper.rootSelector}`, CartesianChartTooltipWrapper);\n }\n\n /**\n * Finds series elements. Use this to assert the number of visible series.\n */\n public findSeries(): Array<ElementWrapper> {\n return this.findAllByClassName(\"highcharts-series\");\n }\n}\n"]}
|
package/test-utils/dom/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.PieChartWrapper = exports.CartesianChartWrapper = exports.ElementWrapper = void 0;
|
|
6
|
+
exports.default = wrapper;
|
|
6
7
|
const dom_1 = require("@cloudscape-design/test-utils-core/dom");
|
|
7
8
|
Object.defineProperty(exports, "ElementWrapper", { enumerable: true, get: function () { return dom_1.ElementWrapper; } });
|
|
8
9
|
const utils_1 = require("@cloudscape-design/test-utils-core/utils");
|
|
@@ -31,5 +32,4 @@ function wrapper(root = document.body) {
|
|
|
31
32
|
}
|
|
32
33
|
return new dom_1.ElementWrapper(root);
|
|
33
34
|
}
|
|
34
|
-
exports.default = wrapper;
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/dom/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/dom/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAsEtC,0BAOC;AA3ED,gEAAwE;AAG/D,+FAHA,oBAAc,OAGA;AAFvB,oEAA0E;AAI1E,uDAAsD;AAG7C,gCAHF,yBAAqB,CAGE;AAF9B,2CAA0C;AAEV,0BAFzB,mBAAe,CAEyB;AA2C/C,oBAAc,CAAC,SAAS,CAAC,uBAAuB,GAAG,UAAU,QAAQ;IACnE,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,yBAAqB,EAAE,QAAQ,CAAC,EAAE,yBAAqB,CAAC,CAAC;AAC1G,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,iBAAiB,GAAG,UAAU,QAAQ;IAC7D,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,mBAAe,EAAE,QAAQ,CAAC,EAAE,mBAAe,CAAC,CAAC;AAC9F,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,0BAA0B,GAAG,UAAU,QAAQ;IACtE,OAAO,IAAI,CAAC,iBAAiB,CAAC,yBAAqB,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC,CAAC;AACF,oBAAc,CAAC,SAAS,CAAC,oBAAoB,GAAG,UAAU,QAAQ;IAChE,OAAO,IAAI,CAAC,iBAAiB,CAAC,mBAAe,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,OAAiC,EAAE,QAAiB;IAChF,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,sBAAc,EAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;AACtG,CAAC;AAED,SAAwB,OAAO,CAAC,OAAgB,QAAQ,CAAC,IAAI;IAC3D,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,OAAO,CAAC,IAAI,CACV,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,oBAAc,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\nimport { appendSelector } from \"@cloudscape-design/test-utils-core/utils\";\n\nexport { ElementWrapper };\n\nimport CartesianChartWrapper from \"./cartesian-chart\";\nimport PieChartWrapper from \"./pie-chart\";\n\nexport { CartesianChartWrapper, PieChartWrapper };\n\ndeclare module \"@cloudscape-design/test-utils-core/dist/dom\" {\n interface ElementWrapper {\n /**\n * Returns the wrapper of the first cartesian chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first cartesian chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper | null}\n */\n findCartesianHighcharts(selector?: string): CartesianChartWrapper | null;\n /**\n * Returns the wrapper of the first pie chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first pie chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper | null}\n */\n findPieHighcharts(selector?: string): PieChartWrapper | null;\n /**\n * Returns an array of cartesian chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all cartesian charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper[]}\n */\n findAllCartesianHighcharts(selector?: string): Array<CartesianChartWrapper>;\n /**\n * Returns an array of pie chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all pie charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper[]}\n */\n findAllPieHighcharts(selector?: string): Array<PieChartWrapper>;\n }\n}\n\nElementWrapper.prototype.findCartesianHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(CartesianChartWrapper, selector), CartesianChartWrapper);\n};\nElementWrapper.prototype.findPieHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(PieChartWrapper, selector), PieChartWrapper);\n};\nElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {\n return this.findAllComponents(CartesianChartWrapper, selector);\n};\nElementWrapper.prototype.findAllPieHighcharts = function (selector) {\n return this.findAllComponents(PieChartWrapper, selector);\n};\n\nfunction getComponentSelector(wrapper: { rootSelector: string }, selector?: string) {\n return selector ? appendSelector(selector, `.${wrapper.rootSelector}`) : `.${wrapper.rootSelector}`;\n}\n\nexport default function wrapper(root: Element = document.body) {\n if (document && document.body && !document.body.contains(root)) {\n console.warn(\n \"[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly\",\n );\n }\n return new ElementWrapper(root);\n}\n"]}
|
|
@@ -61,8 +61,8 @@ class BaseChartWrapper extends dom_2.ComponentWrapper {
|
|
|
61
61
|
return ((_a = this.findByClassName(styles_selectors_js_1.default["axis-y-title"])) !== null && _a !== void 0 ? _a : this.find(`.highcharts-axis.${styles_selectors_js_1.default["axis-y"]} > .highcharts-axis-title`));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
exports.default = BaseChartWrapper;
|
|
65
64
|
BaseChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
65
|
+
exports.default = BaseChartWrapper;
|
|
66
66
|
class BaseChartFilterWrapper extends dom_2.ComponentWrapper {
|
|
67
67
|
/**
|
|
68
68
|
* Finds default series filter when defined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/internal/base.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,sEAA6E;AAC7E,uGAAsG;AACtG,gEAA0F;AAE1F,wFAAyE;AACzE,oHAA2G;AAE3G,MAAqB,gBAAiB,SAAQ,sBAAgB;IAG5D;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sBAAsB,CAAC,YAAY,EAAE,EAAE,sBAAsB,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sBAAsB,CAAC,YAAY,EAAE,EAAE,sBAAsB,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,uBAAmB,CAAC,YAAY,EAAE,EAAE,uBAAmB,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,I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AE,MAAM,MAAK,KAAK,EAAE,CAAC;YAC9B,QAAQ,IAAI,IAAI,6BAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;;AA/BH,wDAgCC;AA/BQ,mCAAY,GAAW,6BAAiB,CAAC,IAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonWrapper } from \"@cloudscape-design/components/test-utils/dom\";\nimport ChartTooltipWrapper from \"@cloudscape-design/components/test-utils/dom/internal/chart-tooltip\";\nimport { ComponentWrapper, ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\n\nimport testClasses from \"../../../core/test-classes/styles.selectors.js\";\nimport legendTestClasses from \"../../../internal/components/chart-legend/test-classes/styles.selectors.js\";\n\nexport default class BaseChartWrapper extends ComponentWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds chart's filters area when default series filter or additional filters are defined.\n */\n public findFilter(): null | BaseChartFilterWrapper {\n return this.findComponent(`.${BaseChartFilterWrapper.rootSelector}`, BaseChartFilterWrapper);\n }\n\n /**\n * Finds chart's legend when defined.\n */\n public findLegend(): null | BaseChartLegendWrapper {\n return this.findComponent(`.${BaseChartLegendWrapper.rootSelector}`, BaseChartLegendWrapper);\n }\n\n /**\n * Finds chart's tooltip when visible.\n */\n public findTooltip(): null | ChartTooltipWrapper {\n return this.findComponent(`.${ChartTooltipWrapper.rootSelector}`, ChartTooltipWrapper);\n }\n\n /**\n * Finds chart's no-data when the chart is in no-data state.\n */\n public findNoData(): null | BaseChartNoDataWrapper {\n return this.findComponent(`.${testClasses[\"no-data\"]}`, BaseChartNoDataWrapper);\n }\n\n /**\n * Finds fallback slot, rendered when highcharts=`null`.\n */\n public findFallback(): null | ElementWrapper {\n return this.findByClassName(testClasses.fallback);\n }\n\n /**\n * Finds focusable chart application element. When focused, it renders a focus outline around the chart,\n * and accepts keyboard commands. The application element is not available in empty charts.\n */\n public findApplication(): null | ElementWrapper {\n return this.findByClassName(testClasses.application);\n }\n\n /**\n * Finds visible title of the x axis.\n */\n public findXAxisTitle(): null | ElementWrapper {\n return (\n this.findByClassName(testClasses[\"axis-x-title\"]) ??\n this.find(`.highcharts-axis.${testClasses[\"axis-x\"]} > .highcharts-axis-title`)\n );\n }\n\n /**\n * Finds visible title of the y axis.\n */\n public findYAxisTitle(): null | ElementWrapper {\n return (\n this.findByClassName(testClasses[\"axis-y-title\"]) ??\n this.find(`.highcharts-axis.${testClasses[\"axis-y\"]} > .highcharts-axis-title`)\n );\n }\n}\n\nexport class BaseChartFilterWrapper extends ComponentWrapper {\n static rootSelector: string = testClasses[\"chart-filters\"];\n\n /**\n * Finds default series filter when defined.\n */\n public findSeriesFilter(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"chart-filters-series\"]);\n }\n\n /**\n * Finds custom additional filters slot when defined.\n */\n public findAdditionalFilters(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"chart-filters-additional\"]);\n }\n}\n\nexport class BaseChartNoDataWrapper extends ComponentWrapper {\n /**\n * Finds no-data empty slot when the chart is in empty state.\n */\n public findEmpty(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"no-data-empty\"]);\n }\n\n /**\n * Finds no-data no-match slot when the chart is in no-match state.\n */\n public findNoMatch(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"no-data-no-match\"]);\n }\n\n /**\n * Finds no-data loading slot when the chart is in loading state.\n */\n public findLoading(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"no-data-loading\"]);\n }\n\n /**\n * Finds no-data error slot when the chart is in error state.\n */\n public findError(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"no-data-error\"]);\n }\n\n /**\n * Finds no-data retry button when the chart is in error state, and uses the default recovery button.\n */\n public findRetryButton(): null | ButtonWrapper {\n return this.findComponent(`.${testClasses[\"no-data-retry\"]}`, ButtonWrapper);\n }\n}\n\ninterface LegendItemOptions {\n active?: boolean;\n}\n\nexport class BaseChartLegendWrapper extends ComponentWrapper {\n static rootSelector: string = legendTestClasses.root;\n\n /**\n * Finds legend's visible title element when defined.\n */\n findTitle(): ElementWrapper | null {\n return this.findByClassName(legendTestClasses.title);\n }\n\n /**\n * Finds legend's actions slot when defined.\n */\n findActions(): ElementWrapper | null {\n return this.findByClassName(legendTestClasses.actions);\n }\n\n /**\n * Finds legend items that match given options:\n * * `active` (optional, boolean) - Matches only active legend items when `true`, and only inactive when `false`.\n * When options are not set, the function matches all legend items.\n */\n findItems(options?: LegendItemOptions): Array<ElementWrapper> {\n let selector = `.${legendTestClasses.item}`;\n if (options?.active === true) {\n selector += `:not(.${legendTestClasses[\"hidden-item\"]})`;\n }\n if (options?.active === false) {\n selector += `.${legendTestClasses[\"hidden-item\"]}`;\n }\n return this.findAll(selector);\n }\n}\n"]}
|
|
@@ -24,6 +24,6 @@ class PieChartWrapper extends base_1.default {
|
|
|
24
24
|
return this.findByClassName(styles_selectors_js_1.default["inner-description"]);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
exports.default = PieChartWrapper;
|
|
28
27
|
PieChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
28
|
+
exports.default = PieChartWrapper;
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/pie-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,2CAAgD;AAEhD,6FAA8E;AAE9E,MAAqB,eAAgB,SAAQ,cAAgB;IAG3D;;OAEG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,wBAAwB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/pie-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,2CAAgD;AAEhD,6FAA8E;AAE9E,MAAqB,eAAgB,SAAQ,cAAgB;IAG3D;;OAEG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,wBAAwB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,CAAC;;AArBM,4BAAY,GAAW,6BAAW,CAAC,IAAI,CAAC;kBAD5B,eAAe","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/dom\";\n\nimport BaseChartWrapper from \"../internal/base\";\n\nimport testClasses from \"../../../pie-chart/test-classes/styles.selectors.js\";\n\nexport default class PieChartWrapper extends BaseChartWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds segments elements. Use this to assert the number of visible segments.\n */\n public findSegments(): Array<ElementWrapper> {\n return this.findAllByClassName(\"highcharts-point\");\n }\n\n /**\n * Finds donut chart's inner area title when defined.\n */\n public findInnerAreaTitle(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"inner-value\"]);\n }\n\n /**\n * Finds donut chart's inner area description when defined.\n */\n public findInnerAreaDescription(): null | ElementWrapper {\n return this.findByClassName(testClasses[\"inner-description\"]);\n }\n}\n"]}
|
|
@@ -19,6 +19,6 @@ class CartesianChartWrapper extends base_1.default {
|
|
|
19
19
|
return this.findAllByClassName("highcharts-series");
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.default = CartesianChartWrapper;
|
|
23
22
|
CartesianChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
23
|
+
exports.default = CartesianChartWrapper;
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/cartesian-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,2CAAgD;AAChD,uCAAyD;AACzD,mGAAoF;AACpF,MAAqB,qBAAsB,SAAQ,cAAgB;IAGjE;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sCAA4B,CAAC,YAAY,EAAE,EAAE,sCAA4B,CAAC,CAAC;IAC3G,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/cartesian-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,2CAAgD;AAChD,uCAAyD;AACzD,mGAAoF;AACpF,MAAqB,qBAAsB,SAAQ,cAAgB;IAGjE;;OAEG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sCAA4B,CAAC,YAAY,EAAE,EAAE,sCAA4B,CAAC,CAAC;IAC3G,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;;AAdM,kCAAY,GAAW,6BAAW,CAAC,IAAI,CAAC;kBAD5B,qBAAqB","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/selectors\";\nimport BaseChartWrapper from \"../internal/base\";\nimport { CartesianChartTooltipWrapper } from \"./tooltip\";\nimport testClasses from \"../../../cartesian-chart/test-classes/styles.selectors.js\";\nexport default class CartesianChartWrapper extends BaseChartWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds chart's tooltip when visible.\n */\n public findTooltip() {\n return this.findComponent(`.${CartesianChartTooltipWrapper.rootSelector}`, CartesianChartTooltipWrapper);\n }\n\n /**\n * Finds series elements. Use this to assert the number of visible series.\n */\n public findSeries() {\n return this.findAllByClassName(\"highcharts-series\");\n }\n}"]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.PieChartWrapper = exports.CartesianChartWrapper = exports.ElementWrapper = void 0;
|
|
6
|
+
exports.default = wrapper;
|
|
6
7
|
const selectors_1 = require("@cloudscape-design/test-utils-core/selectors");
|
|
7
8
|
Object.defineProperty(exports, "ElementWrapper", { enumerable: true, get: function () { return selectors_1.ElementWrapper; } });
|
|
8
9
|
const utils_1 = require("@cloudscape-design/test-utils-core/utils");
|
|
@@ -28,5 +29,4 @@ function getComponentSelector(wrapper, selector) {
|
|
|
28
29
|
function wrapper(root = "body") {
|
|
29
30
|
return new selectors_1.ElementWrapper(root);
|
|
30
31
|
}
|
|
31
|
-
exports.default = wrapper;
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-utils/selectors/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/test-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affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/selectors\";\nimport { appendSelector } from \"@cloudscape-design/test-utils-core/utils\";\n\nexport { ElementWrapper };\n\nimport CartesianChartWrapper from \"./cartesian-chart\";\nimport PieChartWrapper from \"./pie-chart\";\n\nexport { CartesianChartWrapper, PieChartWrapper };\n\ndeclare module \"@cloudscape-design/test-utils-core/dist/selectors\" {\n interface ElementWrapper {\n /**\n * Returns the wrapper of the first cartesian chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first cartesian chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper | null}\n */\n findCartesianHighcharts(selector?: string): CartesianChartWrapper;\n /**\n * Returns the wrapper of the first pie chart that matches the specified CSS selector.\n * If no CSS selector is specified, returns the wrapper of the first pie chart.\n * If no matching chart is found, returns `null`.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper | null}\n */\n findPieHighcharts(selector?: string): PieChartWrapper;\n /**\n * Returns an array of cartesian chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all cartesian charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {CartesianChartWrapper[]}\n */\n findAllCartesianHighcharts(selector?: string): MultiElementWrapper<CartesianChartWrapper>;\n /**\n * Returns an array of pie chart wrappers that matches the specified CSS selector.\n * If no CSS selector is specified, returns all pie charts inside the current wrapper.\n * If no matching chart is found, returns an empty array.\n *\n * @param {string} [selector] CSS Selector\n * @returns {PieChartWrapper[]}\n */\n findAllPieHighcharts(selector?: string): MultiElementWrapper<PieChartWrapper>;\n }\n}\n\nElementWrapper.prototype.findCartesianHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(CartesianChartWrapper, selector), CartesianChartWrapper);\n};\nElementWrapper.prototype.findPieHighcharts = function (selector) {\n return this.findComponent(getComponentSelector(PieChartWrapper, selector), PieChartWrapper);\n};\nElementWrapper.prototype.findAllCartesianHighcharts = function (selector) {\n return this.findAllComponents(CartesianChartWrapper, selector);\n};\nElementWrapper.prototype.findAllPieHighcharts = function (selector) {\n return this.findAllComponents(PieChartWrapper, selector);\n};\n\nfunction getComponentSelector(wrapper: { rootSelector: string }, selector?: string) {\n return selector ? appendSelector(selector, `.${wrapper.rootSelector}`) : `.${wrapper.rootSelector}`;\n}\n\nexport default function wrapper(root: string = \"body\") {\n return new ElementWrapper(root);\n}\n"]}
|
|
@@ -61,8 +61,8 @@ class BaseChartWrapper extends selectors_2.ComponentWrapper {
|
|
|
61
61
|
return (_a = this.findByClassName(styles_selectors_js_1.default["axis-y-title"])) !== null && _a !== void 0 ? _a : this.find(`.highcharts-axis.${styles_selectors_js_1.default["axis-y"]} > .highcharts-axis-title`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
exports.default = BaseChartWrapper;
|
|
65
64
|
BaseChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
65
|
+
exports.default = BaseChartWrapper;
|
|
66
66
|
class BaseChartFilterWrapper extends selectors_2.ComponentWrapper {
|
|
67
67
|
/**
|
|
68
68
|
* Finds default series filter when defined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/internal/base.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,kFAAmF;AACnF,6GAA4G;AAC5G,4EAAgG;AAChG,wFAAyE;AACzE,oHAA2G;AAC3G,MAAqB,gBAAiB,SAAQ,4BAAgB;IAG5D;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sBAAsB,CAAC,YAAY,EAAE,EAAE,sBAAsB,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,sBAAsB,CAAC,YAAY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P,OAAO,CAAE,MAAM,MAAK,IAAI,EAAE,CAAC;YAC7B,QAAQ,IAAI,SAAS,6BAAiB,CAAC,aAAa,CAAC,GAAG,CAAC;QAC3D,CAAC;QACD,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,KAAK,EAAE,CAAC;YAC9B,QAAQ,IAAI,IAAI,6BAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;QACrD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;;AA/BH,wDAgCC;AA/BQ,mCAAY,GAAW,6BAAiB,CAAC,IAAI,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ButtonWrapper } from \"@cloudscape-design/components/test-utils/selectors\";\nimport ChartTooltipWrapper from \"@cloudscape-design/components/test-utils/selectors/internal/chart-tooltip\";\nimport { ComponentWrapper, ElementWrapper } from \"@cloudscape-design/test-utils-core/selectors\";\nimport testClasses from \"../../../core/test-classes/styles.selectors.js\";\nimport legendTestClasses from \"../../../internal/components/chart-legend/test-classes/styles.selectors.js\";\nexport default class BaseChartWrapper extends ComponentWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds chart's filters area when default series filter or additional filters are defined.\n */\n public findFilter() {\n return this.findComponent(`.${BaseChartFilterWrapper.rootSelector}`, BaseChartFilterWrapper);\n }\n\n /**\n * Finds chart's legend when defined.\n */\n public findLegend() {\n return this.findComponent(`.${BaseChartLegendWrapper.rootSelector}`, BaseChartLegendWrapper);\n }\n\n /**\n * Finds chart's tooltip when visible.\n */\n public findTooltip() {\n return this.findComponent(`.${ChartTooltipWrapper.rootSelector}`, ChartTooltipWrapper);\n }\n\n /**\n * Finds chart's no-data when the chart is in no-data state.\n */\n public findNoData() {\n return this.findComponent(`.${testClasses[\"no-data\"]}`, BaseChartNoDataWrapper);\n }\n\n /**\n * Finds fallback slot, rendered when highcharts=`null`.\n */\n public findFallback() {\n return this.findByClassName(testClasses.fallback);\n }\n\n /**\n * Finds focusable chart application element. When focused, it renders a focus outline around the chart,\n * and accepts keyboard commands. The application element is not available in empty charts.\n */\n public findApplication() {\n return this.findByClassName(testClasses.application);\n }\n\n /**\n * Finds visible title of the x axis.\n */\n public findXAxisTitle() {\n return this.findByClassName(testClasses[\"axis-x-title\"]) ?? this.find(`.highcharts-axis.${testClasses[\"axis-x\"]} > .highcharts-axis-title`);\n }\n\n /**\n * Finds visible title of the y axis.\n */\n public findYAxisTitle() {\n return this.findByClassName(testClasses[\"axis-y-title\"]) ?? this.find(`.highcharts-axis.${testClasses[\"axis-y\"]} > .highcharts-axis-title`);\n }\n}\nexport class BaseChartFilterWrapper extends ComponentWrapper {\n static rootSelector: string = testClasses[\"chart-filters\"];\n\n /**\n * Finds default series filter when defined.\n */\n public findSeriesFilter() {\n return this.findByClassName(testClasses[\"chart-filters-series\"]);\n }\n\n /**\n * Finds custom additional filters slot when defined.\n */\n public findAdditionalFilters() {\n return this.findByClassName(testClasses[\"chart-filters-additional\"]);\n }\n}\nexport class BaseChartNoDataWrapper extends ComponentWrapper {\n /**\n * Finds no-data empty slot when the chart is in empty state.\n */\n public findEmpty() {\n return this.findByClassName(testClasses[\"no-data-empty\"]);\n }\n\n /**\n * Finds no-data no-match slot when the chart is in no-match state.\n */\n public findNoMatch() {\n return this.findByClassName(testClasses[\"no-data-no-match\"]);\n }\n\n /**\n * Finds no-data loading slot when the chart is in loading state.\n */\n public findLoading() {\n return this.findByClassName(testClasses[\"no-data-loading\"]);\n }\n\n /**\n * Finds no-data error slot when the chart is in error state.\n */\n public findError() {\n return this.findByClassName(testClasses[\"no-data-error\"]);\n }\n\n /**\n * Finds no-data retry button when the chart is in error state, and uses the default recovery button.\n */\n public findRetryButton() {\n return this.findComponent(`.${testClasses[\"no-data-retry\"]}`, ButtonWrapper);\n }\n}\ninterface LegendItemOptions {\n active?: boolean;\n}\nexport class BaseChartLegendWrapper extends ComponentWrapper {\n static rootSelector: string = legendTestClasses.root;\n\n /**\n * Finds legend's visible title element when defined.\n */\n findTitle() {\n return this.findByClassName(legendTestClasses.title);\n }\n\n /**\n * Finds legend's actions slot when defined.\n */\n findActions() {\n return this.findByClassName(legendTestClasses.actions);\n }\n\n /**\n * Finds legend items that match given options:\n * * `active` (optional, boolean) - Matches only active legend items when `true`, and only inactive when `false`.\n * When options are not set, the function matches all legend items.\n */\n findItems(options?: LegendItemOptions) {\n let selector = `.${legendTestClasses.item}`;\n if (options?.active === true) {\n selector += `:not(.${legendTestClasses[\"hidden-item\"]})`;\n }\n if (options?.active === false) {\n selector += `.${legendTestClasses[\"hidden-item\"]}`;\n }\n return this.findAll(selector);\n }\n}"]}
|
|
@@ -24,6 +24,6 @@ class PieChartWrapper extends base_1.default {
|
|
|
24
24
|
return this.findByClassName(styles_selectors_js_1.default["inner-description"]);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
exports.default = PieChartWrapper;
|
|
28
27
|
PieChartWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
28
|
+
exports.default = PieChartWrapper;
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/pie-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,2CAAgD;AAChD,6FAA8E;AAC9E,MAAqB,eAAgB,SAAQ,cAAgB;IAG3D;;OAEG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,wBAAwB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/selectors/pie-chart/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,2CAAgD;AAChD,6FAA8E;AAC9E,MAAqB,eAAgB,SAAQ,cAAgB;IAG3D;;OAEG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,wBAAwB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,CAAC;;AArBM,4BAAY,GAAW,6BAAW,CAAC,IAAI,CAAC;kBAD5B,eAAe","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ElementWrapper } from \"@cloudscape-design/test-utils-core/selectors\";\nimport BaseChartWrapper from \"../internal/base\";\nimport testClasses from \"../../../pie-chart/test-classes/styles.selectors.js\";\nexport default class PieChartWrapper extends BaseChartWrapper {\n static rootSelector: string = testClasses.root;\n\n /**\n * Finds segments elements. Use this to assert the number of visible segments.\n */\n public findSegments() {\n return this.findAllByClassName(\"highcharts-point\");\n }\n\n /**\n * Finds donut chart's inner area title when defined.\n */\n public findInnerAreaTitle() {\n return this.findByClassName(testClasses[\"inner-value\"]);\n }\n\n /**\n * Finds donut chart's inner area description when defined.\n */\n public findInnerAreaDescription() {\n return this.findByClassName(testClasses[\"inner-description\"]);\n }\n}"]}
|