@cloudscape-design/chart-components 1.0.38 → 1.0.39

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.
@@ -27,18 +27,22 @@ export const transformCartesianSeries = (originalSeries, visibleSeries) => {
27
27
  const thresholdX = getThresholdX(originalSeries, visibleSeries);
28
28
  const thresholdY = getThresholdY(originalSeries, visibleSeries);
29
29
  function transformSeriesToHighcharts(s) {
30
- var _a, _b;
30
+ var _a, _b, _c;
31
31
  if (s.type === "x-threshold" || s.type === "y-threshold") {
32
32
  const data = s.type === "x-threshold"
33
33
  ? thresholdY.map((y) => ({ x: s.value, y }))
34
34
  : thresholdX.map((x) => ({ x, y: s.value }));
35
35
  const { custom } = createThresholdMetadata(s.type, s.value);
36
36
  const enableMouseTracking = s.type === "y-threshold";
37
- const style = { ...Styles.thresholdSeries, color: (_a = s.color) !== null && _a !== void 0 ? _a : Styles.thresholdSeries.color };
37
+ const style = {
38
+ ...Styles.thresholdSeries,
39
+ color: (_a = s.color) !== null && _a !== void 0 ? _a : Styles.thresholdSeries.color,
40
+ dashStyle: (_b = s.dashStyle) !== null && _b !== void 0 ? _b : Styles.thresholdSeries.dashStyle,
41
+ };
38
42
  return { type: "line", id: s.id, name: s.name, data, custom, enableMouseTracking, ...style };
39
43
  }
40
44
  if (s.type === "errorbar") {
41
- const color = (_b = s.color) !== null && _b !== void 0 ? _b : colorChartsErrorBarMarker;
45
+ const color = (_c = s.color) !== null && _c !== void 0 ? _c : colorChartsErrorBarMarker;
42
46
  // In Highcharts, the error-bar series graphic color is represented as stem-, and whisker colors.
43
47
  // We simplify that, and only expose a single color prop that sets both of those.
44
48
  const colors = { stemColor: color, whiskerColor: color };
@@ -1 +1 @@
1
- {"version":3,"file":"chart-series-cartesian.js","sourceRoot":"","sources":["../../../src/cartesian-chart/chart-series-cartesian.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,yBAAyB,EAAE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AAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE;QAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,MAAM,CAAC,GAAG,MAAA,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAI,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACb;KACF;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAoD,EAAE,aAAgC;IAClH,MAAM,UAAU,GAKV,EAAE,CAAC;IACT,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;QACtB,IACE,CAAC,CAAC,IAAI,KAAK,aAAa;YACxB,CAAC,CAAC,IAAI,KAAK,aAAa;YACxB,CAAC,CAAC,IAAI,KAAK,UAAU;YACrB,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EACvC;YACA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACpB;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { colorChartsErrorBarMarker } from \"@cloudscape-design/design-tokens\";\n\nimport { PointDataItemType, RangeDataItemOptions } from \"../core/interfaces\";\nimport { createThresholdMetadata, getOptionsId } from \"../core/utils\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { Writeable } from \"../internal/utils/utils\";\nimport { CartesianChartProps } from \"./interfaces\";\n\n// The utility transforms cartesian chart component's series to Highcharts series. This includes transforming\n// custom x- and y-threshold series types, that are represented as a combination of invisible line series, and plot lines.\n// The plot lines, unlike series, are rendered across the entire chart plot width or height.\nexport const transformCartesianSeries = (\n originalSeries: readonly CartesianChartProps.SeriesOptions[],\n visibleSeries: readonly string[],\n) => {\n // The injected plot lines have IDs matching the IDs of the threshold series. This is used by the core chart\n // to manage visibility and highlight state for them, when the corresponding threshold series are toggled\n // or highlighted in the legend or filter.\n const xPlotLines: Highcharts.XAxisPlotLinesOptions[] = [];\n const yPlotLines: Highcharts.YAxisPlotLinesOptions[] = [];\n for (const s of originalSeries) {\n const seriesId = getOptionsId(s);\n const style = { ...Styles.thresholdPlotLine, color: s.color ?? Styles.thresholdPlotLine.color };\n if (s.type === \"x-threshold\" && visibleSeries.includes(seriesId)) {\n xPlotLines.push({ id: seriesId, value: s.value, ...style, dashStyle: s.dashStyle ?? style.dashStyle });\n }\n if (s.type === \"y-threshold\" && visibleSeries.includes(seriesId)) {\n yPlotLines.push({ id: seriesId, value: s.value, ...style, dashStyle: s.dashStyle ?? style.dashStyle });\n }\n }\n // The threshold series require data points to enable keyboard navigation and hover effects.\n const thresholdX = getThresholdX(originalSeries, visibleSeries);\n const thresholdY = getThresholdY(originalSeries, visibleSeries);\n function transformSeriesToHighcharts(s: CartesianChartProps.SeriesOptions): Highcharts.SeriesOptionsType {\n if (s.type === \"x-threshold\" || s.type === \"y-threshold\") {\n const data =\n s.type === \"x-threshold\"\n ? thresholdY.map((y) => ({ x: s.value, y }))\n : thresholdX.map((x) => ({ x, y: s.value }));\n const { custom } = createThresholdMetadata(s.type, s.value);\n const enableMouseTracking = s.type === \"y-threshold\";\n const style = { ...Styles.thresholdSeries, color: s.color ?? Styles.thresholdSeries.color };\n return { type: \"line\", id: s.id, name: s.name, data, custom, enableMouseTracking, ...style };\n }\n if (s.type === \"errorbar\") {\n const color = s.color ?? colorChartsErrorBarMarker;\n // In Highcharts, the error-bar series graphic color is represented as stem-, and whisker colors.\n // We simplify that, and only expose a single color prop that sets both of those.\n const colors = { stemColor: color, whiskerColor: color };\n return { ...s, data: s.data as Writeable<RangeDataItemOptions[]>, ...colors };\n }\n return { ...s, data: s.data as Writeable<PointDataItemType[]> };\n }\n const series = originalSeries.map(transformSeriesToHighcharts);\n // We inject a fake empty series so that the empty state still shows axes, if defined.\n if (series.length === 0) {\n series.push({ type: \"line\", data: [], showInLegend: false });\n }\n return { series, xPlotLines, yPlotLines };\n};\n\n// For x-threshold the point-based navigation is disabled as irrelevant. However, we still need at least\n// one data point for core chart to work correctly, so we find the first visible y value from other series.\nfunction getThresholdY(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n for (const s of getVisibleDataSeries(series, visibleSeries)) {\n for (const d of s.data) {\n const y = d === null ? null : typeof d === \"number\" ? d : d.y;\n if (y !== null) {\n return [y];\n }\n }\n }\n return [];\n}\n\n// For y-threshold we find all defined x values from other series and use it those to create an array of\n// data points. As result, the y-threshold series becomes properly navigable.\nfunction getThresholdX(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n const allX = new Set<number>();\n for (const s of getVisibleDataSeries(series, visibleSeries)) {\n for (let i = 0; i < s.data.length; i++) {\n const d = s.data[i];\n const x = (typeof d === \"object\" ? d?.x : i) ?? i;\n allX.add(x);\n }\n }\n return [...allX].sort((a, b) => a - b);\n}\n\nfunction getVisibleDataSeries(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n const dataSeries: Exclude<\n CartesianChartProps.SeriesOptions,\n | CartesianChartProps.XThresholdSeriesOptions\n | CartesianChartProps.YThresholdSeriesOptions\n | CartesianChartProps.ErrorBarSeriesOptions\n >[] = [];\n for (const s of series) {\n if (\n s.type !== \"x-threshold\" &&\n s.type !== \"y-threshold\" &&\n s.type !== \"errorbar\" &&\n visibleSeries.includes(getOptionsId(s))\n ) {\n dataSeries.push(s);\n }\n }\n return dataSeries;\n}\n"]}
1
+ {"version":3,"file":"chart-series-cartesian.js","sourceRoot":"","sources":["../../../src/cartesian-chart/chart-series-cartesian.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAInD,6GAA6G;AAC7G,0HAA0H;AAC1H,4FAA4F;AAC5F,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,cAA4D,EAC5D,aAAgC,EAChC,EAAE;;IACF,4GAA4G;IAC5G,yGAAyG;IACzG,0CAA0C;IAC1C,MAAM,UAAU,GAAuC,EAAE,CAAC;IAC1D,MAAM,UAAU,GAAuC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE;QAC9B,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,EAAE,GAAG,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,MAAA,CAAC,CAAC,KAAK,mCAAI,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAChG,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAChE,UAAU,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,MAAA,CAAC,CAAC,SAAS,mCAAI,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;SACxG;QACD,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa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UAAU;YACrB,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EACvC;YACA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACpB;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type Highcharts from \"highcharts\";\n\nimport { colorChartsErrorBarMarker } from \"@cloudscape-design/design-tokens\";\n\nimport { PointDataItemType, RangeDataItemOptions } from \"../core/interfaces\";\nimport { createThresholdMetadata, getOptionsId } from \"../core/utils\";\nimport * as Styles from \"../internal/chart-styles\";\nimport { Writeable } from \"../internal/utils/utils\";\nimport { CartesianChartProps } from \"./interfaces\";\n\n// The utility transforms cartesian chart component's series to Highcharts series. This includes transforming\n// custom x- and y-threshold series types, that are represented as a combination of invisible line series, and plot lines.\n// The plot lines, unlike series, are rendered across the entire chart plot width or height.\nexport const transformCartesianSeries = (\n originalSeries: readonly CartesianChartProps.SeriesOptions[],\n visibleSeries: readonly string[],\n) => {\n // The injected plot lines have IDs matching the IDs of the threshold series. This is used by the core chart\n // to manage visibility and highlight state for them, when the corresponding threshold series are toggled\n // or highlighted in the legend or filter.\n const xPlotLines: Highcharts.XAxisPlotLinesOptions[] = [];\n const yPlotLines: Highcharts.YAxisPlotLinesOptions[] = [];\n for (const s of originalSeries) {\n const seriesId = getOptionsId(s);\n const style = { ...Styles.thresholdPlotLine, color: s.color ?? Styles.thresholdPlotLine.color };\n if (s.type === \"x-threshold\" && visibleSeries.includes(seriesId)) {\n xPlotLines.push({ id: seriesId, value: s.value, ...style, dashStyle: s.dashStyle ?? style.dashStyle });\n }\n if (s.type === \"y-threshold\" && visibleSeries.includes(seriesId)) {\n yPlotLines.push({ id: seriesId, value: s.value, ...style, dashStyle: s.dashStyle ?? style.dashStyle });\n }\n }\n // The threshold series require data points to enable keyboard navigation and hover effects.\n const thresholdX = getThresholdX(originalSeries, visibleSeries);\n const thresholdY = getThresholdY(originalSeries, visibleSeries);\n function transformSeriesToHighcharts(s: CartesianChartProps.SeriesOptions): Highcharts.SeriesOptionsType {\n if (s.type === \"x-threshold\" || s.type === \"y-threshold\") {\n const data =\n s.type === \"x-threshold\"\n ? thresholdY.map((y) => ({ x: s.value, y }))\n : thresholdX.map((x) => ({ x, y: s.value }));\n const { custom } = createThresholdMetadata(s.type, s.value);\n const enableMouseTracking = s.type === \"y-threshold\";\n const style = {\n ...Styles.thresholdSeries,\n color: s.color ?? Styles.thresholdSeries.color,\n dashStyle: s.dashStyle ?? Styles.thresholdSeries.dashStyle,\n };\n return { type: \"line\", id: s.id, name: s.name, data, custom, enableMouseTracking, ...style };\n }\n if (s.type === \"errorbar\") {\n const color = s.color ?? colorChartsErrorBarMarker;\n // In Highcharts, the error-bar series graphic color is represented as stem-, and whisker colors.\n // We simplify that, and only expose a single color prop that sets both of those.\n const colors = { stemColor: color, whiskerColor: color };\n return { ...s, data: s.data as Writeable<RangeDataItemOptions[]>, ...colors };\n }\n return { ...s, data: s.data as Writeable<PointDataItemType[]> };\n }\n const series = originalSeries.map(transformSeriesToHighcharts);\n // We inject a fake empty series so that the empty state still shows axes, if defined.\n if (series.length === 0) {\n series.push({ type: \"line\", data: [], showInLegend: false });\n }\n return { series, xPlotLines, yPlotLines };\n};\n\n// For x-threshold the point-based navigation is disabled as irrelevant. However, we still need at least\n// one data point for core chart to work correctly, so we find the first visible y value from other series.\nfunction getThresholdY(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n for (const s of getVisibleDataSeries(series, visibleSeries)) {\n for (const d of s.data) {\n const y = d === null ? null : typeof d === \"number\" ? d : d.y;\n if (y !== null) {\n return [y];\n }\n }\n }\n return [];\n}\n\n// For y-threshold we find all defined x values from other series and use it those to create an array of\n// data points. As result, the y-threshold series becomes properly navigable.\nfunction getThresholdX(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n const allX = new Set<number>();\n for (const s of getVisibleDataSeries(series, visibleSeries)) {\n for (let i = 0; i < s.data.length; i++) {\n const d = s.data[i];\n const x = (typeof d === \"object\" ? d?.x : i) ?? i;\n allX.add(x);\n }\n }\n return [...allX].sort((a, b) => a - b);\n}\n\nfunction getVisibleDataSeries(series: readonly CartesianChartProps.SeriesOptions[], visibleSeries: readonly string[]) {\n const dataSeries: Exclude<\n CartesianChartProps.SeriesOptions,\n | CartesianChartProps.XThresholdSeriesOptions\n | CartesianChartProps.YThresholdSeriesOptions\n | CartesianChartProps.ErrorBarSeriesOptions\n >[] = [];\n for (const s of series) {\n if (\n s.type !== \"x-threshold\" &&\n s.type !== \"y-threshold\" &&\n s.type !== \"errorbar\" &&\n visibleSeries.includes(getOptionsId(s))\n ) {\n dataSeries.push(s);\n }\n }\n return dataSeries;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chart-components";
2
- export var PACKAGE_VERSION = "1.0.0 (7ee705f9)";
2
+ export var PACKAGE_VERSION = "1.0.0 (d2f14020)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
  export var SYSTEM = "core";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "chart-components",
3
- "PACKAGE_VERSION": "1.0.0 (7ee705f9)",
3
+ "PACKAGE_VERSION": "1.0.0 (d2f14020)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true,
6
6
  "SYSTEM": "core"
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "7ee705f9c9356d5b408ae09301abab0d4421967d"
2
+ "commit": "d2f140205631cfdd0be4400fa3f1c8c9828cda7c"
3
3
  }
@@ -5,7 +5,7 @@ import { InternalCoreChart } from "../../core/chart-core";
5
5
  import useBaseComponent from "../../internal/base-component/use-base-component";
6
6
  import { applyDisplayName } from "../../internal/utils/apply-display-name";
7
7
  function CoreChart({ keyboardNavigation = true, ...props }) {
8
- const baseComponentProps = useBaseComponent("ChartCore", { props: {} });
8
+ const baseComponentProps = useBaseComponent("CoreChart", { props: {} });
9
9
  return _jsx(InternalCoreChart, { keyboardNavigation: keyboardNavigation, ...props, ...baseComponentProps });
10
10
  }
11
11
  applyDisplayName(CoreChart, "CoreChart");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,gBAAgB,MAAM,kDAAkD,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAI3E,SAAS,SAAS,CAAC,EAAE,kBAAkB,GAAG,IAAI,EAAE,GAAG,KAAK,EAAkB;IACxE,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACxE,OAAO,KAAC,iBAAiB,IAAC,kBAAkB,EAAE,kBAAkB,KAAM,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAC1G,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { InternalCoreChart } from \"../../core/chart-core\";\nimport { type CoreChartProps } from \"../../core/interfaces\";\nimport useBaseComponent from \"../../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../../internal/utils/apply-display-name\";\n\nexport { CoreChartProps };\n\nfunction CoreChart({ keyboardNavigation = true, ...props }: CoreChartProps) {\n const baseComponentProps = useBaseComponent(\"ChartCore\", { props: {} });\n return <InternalCoreChart keyboardNavigation={keyboardNavigation} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(CoreChart, \"CoreChart\");\n\nexport default CoreChart;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-chart/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,gBAAgB,MAAM,kDAAkD,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAI3E,SAAS,SAAS,CAAC,EAAE,kBAAkB,GAAG,IAAI,EAAE,GAAG,KAAK,EAAkB;IACxE,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACxE,OAAO,KAAC,iBAAiB,IAAC,kBAAkB,EAAE,kBAAkB,KAAM,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAC1G,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { InternalCoreChart } from \"../../core/chart-core\";\nimport { type CoreChartProps } from \"../../core/interfaces\";\nimport useBaseComponent from \"../../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../../internal/utils/apply-display-name\";\n\nexport { CoreChartProps };\n\nfunction CoreChart({ keyboardNavigation = true, ...props }: CoreChartProps) {\n const baseComponentProps = useBaseComponent(\"CoreChart\", { props: {} });\n return <InternalCoreChart keyboardNavigation={keyboardNavigation} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(CoreChart, \"CoreChart\");\n\nexport default CoreChart;\n"]}
@@ -0,0 +1,4 @@
1
+ import { type ChartSeriesMarkerProps } from "../../internal/components/series-marker";
2
+ export { ChartSeriesMarkerProps };
3
+ declare function CoreSeriesMarker(props: ChartSeriesMarkerProps): import("react/jsx-runtime").JSX.Element;
4
+ export default CoreSeriesMarker;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ import useBaseComponent from "../../internal/base-component/use-base-component";
5
+ import { ChartSeriesMarker } from "../../internal/components/series-marker";
6
+ import { applyDisplayName } from "../../internal/utils/apply-display-name";
7
+ function CoreSeriesMarker(props) {
8
+ const baseComponentProps = useBaseComponent("CoreSeriesMarker", { props: {} });
9
+ return _jsx(ChartSeriesMarker, { ...props, ...baseComponentProps });
10
+ }
11
+ applyDisplayName(CoreSeriesMarker, "CoreSeriesMarker");
12
+ export default CoreSeriesMarker;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal-do-not-use/core-series-marker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,gBAAgB,MAAM,kDAAkD,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAA+B,MAAM,yCAAyC,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAI3E,SAAS,gBAAgB,CAAC,KAA6B;IACrD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/E,OAAO,KAAC,iBAAiB,OAAK,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAClE,CAAC;AAED,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AAEvD,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport useBaseComponent from \"../../internal/base-component/use-base-component\";\nimport { ChartSeriesMarker, type ChartSeriesMarkerProps } from \"../../internal/components/series-marker\";\nimport { applyDisplayName } from \"../../internal/utils/apply-display-name\";\n\nexport { ChartSeriesMarkerProps };\n\nfunction CoreSeriesMarker(props: ChartSeriesMarkerProps) {\n const baseComponentProps = useBaseComponent(\"CoreSeriesMarker\", { props: {} });\n return <ChartSeriesMarker {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(CoreSeriesMarker, \"CoreSeriesMarker\");\n\nexport default CoreSeriesMarker;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chart-components",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chart-components.git"
@@ -16,7 +16,8 @@
16
16
  "./test-utils/selectors/internal/core": "./test-utils/selectors/internal/core.js",
17
17
  "./internal/api-docs/*.js": "./internal/api-docs/*.js",
18
18
  "./internal-do-not-use/core-chart": "./internal-do-not-use/core-chart/index.js",
19
- "./internal-do-not-use/core-legend": "./internal-do-not-use/core-legend/index.js"
19
+ "./internal-do-not-use/core-legend": "./internal-do-not-use/core-legend/index.js",
20
+ "./internal-do-not-use/core-series-marker": "./internal-do-not-use/core-series-marker/index.js"
20
21
  },
21
22
  "dependencies": {
22
23
  "@cloudscape-design/component-toolkit": "^1.0.0-beta",