Skip to content

Commit 9aca012

Browse files
committed
refactored internal components
1 parent 3034c33 commit 9aca012

32 files changed

+256
-623
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
"build:themeable": "node scripts/themeable-source",
3737
"build:pages:vite": "vite build",
3838
"build:pages:tsc": "tsc -p pages/tsconfig.json",
39-
"postinstall": "node ./scripts/install-peer-dependency.js components:charts-design-tokens"
39+
"postinstall": "npm run postinstall:theming && npm run postinstall:components",
40+
"postinstall:theming": "node ./scripts/install-peer-dependency.js theming-core:expose-size-tokens",
41+
"postinstall:components": "node ./scripts/install-peer-dependency.js components:charts-design-tokens"
4042
},
4143
"exports": {
4244
".": "./index.js",

scripts/install-peer-dependency.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const getModules = (packageName) => {
1515
switch (packageName) {
1616
case "components":
1717
return ["components", "design-tokens"];
18+
case "theming-core":
19+
return ["theming-build", "theming-runtime"];
1820
default:
1921
return [packageName];
2022
}
@@ -26,8 +28,12 @@ const getArtifactPath = (moduleName) => {
2628
return "/lib/components/*";
2729
case "design-tokens":
2830
return "/lib/design-tokens/*";
29-
case '"board-components':
31+
case "board-components":
3032
return "/lib/components/*";
33+
case "theming-build":
34+
return "/lib/node/*";
35+
case "theming-runtime":
36+
return "/lib/browser/*";
3137
default:
3238
return "/lib/*";
3339
}

src/cartesian-chart/chart-cartesian-internal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useControllableState } from "@cloudscape-design/component-toolkit";
88

99
import { CloudscapeHighcharts, CloudscapeHighchartsRef } from "../core/chart-core";
1010
import { getDataAttributes } from "../internal/base-component/get-data-attributes";
11-
import { ChartSeriesMarkerStatus } from "../internal/components/chart-series-marker";
11+
import { ChartSeriesMarkerStatus } from "../internal/components/series-marker";
1212
import { fireNonCancelableEvent, NonCancelableEventHandler } from "../internal/events";
1313
import { useChartTooltipCartesian } from "./chart-tooltip-cartesian";
1414
import { getDefaultFormatter } from "./default-formatters";

src/cartesian-chart/chart-tooltip-cartesian.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
import { useState } from "react";
55

66
import { TooltipContentGetter } from "../core/interfaces-core";
7-
import ChartPopoverFooter from "../internal/components/chart-popover-footer";
8-
import ChartSeriesDetails, { ChartSeriesDetailItem } from "../internal/components/chart-series-details";
9-
import { ChartSeriesMarkerStatus, ChartSeriesMarkerType } from "../internal/components/chart-series-marker";
7+
import ChartSeriesDetails, { ChartSeriesDetailItem } from "../internal/components/series-details";
8+
import { ChartSeriesMarkerStatus, ChartSeriesMarkerType } from "../internal/components/series-marker";
109
import { getDefaultFormatter } from "./default-formatters";
1110
import { CartesianChartProps, InternalCartesianChartOptions, InternalSeriesOptions } from "./interfaces-cartesian";
1211
import { getDataExtremes } from "./utils";
@@ -145,16 +144,12 @@ export function useChartTooltipCartesian(
145144

146145
const footer = props.tooltip?.footer?.(tooltipDetails);
147146

148-
const body = (
149-
<>
150-
{content}
151-
{footer && <ChartPopoverFooter>{footer}</ChartPopoverFooter>}
152-
</>
153-
);
147+
const body = content;
154148

155149
return {
156150
title: props.tooltip?.title?.(tooltipDetails) ?? titleFormatter(point.x),
157151
body,
152+
footer,
158153
};
159154
};
160155
};

src/core/chart-legend-markers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type Highcharts from "highcharts";
88

99
import { colorBackgroundLayoutMain } from "@cloudscape-design/design-tokens";
1010

11-
import { ChartSeriesMarkerG, ChartSeriesMarkerType } from "../internal/components/chart-series-marker";
1211
import Portal from "../internal/components/portal";
12+
import { ChartSeriesMarkerG, ChartSeriesMarkerType } from "../internal/components/series-marker";
1313
import AsyncStore, { useSelector } from "../internal/utils/async-store";
1414
import { LegendMarkersProps } from "./interfaces-core";
1515
import { getLegendItemType, getSimpleColor } from "./utils";

src/core/chart-tooltip.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type Highcharts from "highcharts";
66

77
import { colorChartsLineTick } from "@cloudscape-design/design-tokens";
88

9-
import ChartPopover from "../internal/components/chart-popover";
9+
import Popover from "../internal/components/popover";
1010
import AsyncStore, { useSelector } from "../internal/utils/async-store";
1111
import { DebouncedCall } from "../internal/utils/utils";
1212
import { Point, TooltipContent, TooltipContentGetter } from "./interfaces-core";
@@ -79,7 +79,7 @@ export function ChartTooltip<TooltipState>({
7979
}
8080
const renderedContent = tooltip.content(tooltipState);
8181
return (
82-
<ChartPopover
82+
<Popover
8383
getTrack={tooltipStore.getTrack}
8484
trackKey={tooltip.point.x + ":" + tooltip.point.y}
8585
container={null}
@@ -88,9 +88,10 @@ export function ChartTooltip<TooltipState>({
8888
onMouseEnter={tooltipStore.onMouseEnterTooltip}
8989
onMouseLeave={tooltipStore.onMouseLeaveTooltip}
9090
title={renderedContent.title}
91+
footer={renderedContent.footer}
9192
>
9293
{renderedContent.body}
93-
</ChartPopover>
94+
</Popover>
9495
);
9596
}
9697

src/core/interfaces-core.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import type Highcharts from "highcharts";
55

6-
import { ChartSeriesMarkerStatus } from "../internal/components/chart-series-marker";
6+
import { ChartSeriesMarkerStatus } from "../internal/components/series-marker";
77

88
export interface CloudscapeHighchartsBase {
99
/**
@@ -73,6 +73,7 @@ export interface TooltipProps<TooltipState> {
7373
export interface TooltipContent {
7474
title: React.ReactNode;
7575
body: React.ReactNode;
76+
footer?: React.ReactNode;
7677
}
7778

7879
export interface Point {

src/core/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import type Highcharts from "highcharts";
55

6-
import { ChartSeriesMarkerType } from "../internal/components/chart-series-marker";
6+
import { ChartSeriesMarkerType } from "../internal/components/series-marker";
77

88
type IdToSeriesMapping = Map<string, { series: Highcharts.Series; data: Map<string, Highcharts.Point> }>;
99

src/internal/components/chart-popover-footer/index.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/internal/components/chart-popover-footer/styles.scss

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)