@cloudscape-design/chart-components 1.0.0
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/LICENSE +175 -0
- package/NOTICE +1 -0
- package/README.md +25 -0
- package/cartesian-chart/chart-cartesian-internal.d.ts +10 -0
- package/cartesian-chart/chart-cartesian-internal.js +99 -0
- package/cartesian-chart/chart-cartesian-internal.js.map +1 -0
- package/cartesian-chart/chart-series-cartesian.d.ts +7 -0
- package/cartesian-chart/chart-series-cartesian.js +95 -0
- package/cartesian-chart/chart-series-cartesian.js.map +1 -0
- package/cartesian-chart/index.d.ts +5 -0
- package/cartesian-chart/index.js +133 -0
- package/cartesian-chart/index.js.map +1 -0
- package/cartesian-chart/interfaces.d.ts +166 -0
- package/cartesian-chart/interfaces.js +4 -0
- package/cartesian-chart/interfaces.js.map +1 -0
- package/cartesian-chart/test-classes/styles.css.js +6 -0
- package/cartesian-chart/test-classes/styles.scoped.css +7 -0
- package/cartesian-chart/test-classes/styles.selectors.js +7 -0
- package/core/chart-api/chart-extra-axis-titles.d.ts +10 -0
- package/core/chart-api/chart-extra-axis-titles.js +42 -0
- package/core/chart-api/chart-extra-axis-titles.js.map +1 -0
- package/core/chart-api/chart-extra-context.d.ts +41 -0
- package/core/chart-api/chart-extra-context.js +93 -0
- package/core/chart-api/chart-extra-context.js.map +1 -0
- package/core/chart-api/chart-extra-highlight.d.ts +20 -0
- package/core/chart-api/chart-extra-highlight.js +205 -0
- package/core/chart-api/chart-extra-highlight.js.map +1 -0
- package/core/chart-api/chart-extra-legend.d.ts +27 -0
- package/core/chart-api/chart-extra-legend.js +118 -0
- package/core/chart-api/chart-extra-legend.js.map +1 -0
- package/core/chart-api/chart-extra-navigation.d.ts +84 -0
- package/core/chart-api/chart-extra-navigation.js +470 -0
- package/core/chart-api/chart-extra-navigation.js.map +1 -0
- package/core/chart-api/chart-extra-nodata.d.ts +15 -0
- package/core/chart-api/chart-extra-nodata.js +45 -0
- package/core/chart-api/chart-extra-nodata.js.map +1 -0
- package/core/chart-api/chart-extra-pointer.d.ts +33 -0
- package/core/chart-api/chart-extra-pointer.js +173 -0
- package/core/chart-api/chart-extra-pointer.js.map +1 -0
- package/core/chart-api/chart-extra-tooltip.d.ts +33 -0
- package/core/chart-api/chart-extra-tooltip.js +209 -0
- package/core/chart-api/chart-extra-tooltip.js.map +1 -0
- package/core/chart-api/index.d.ts +75 -0
- package/core/chart-api/index.js +383 -0
- package/core/chart-api/index.js.map +1 -0
- package/core/chart-container.d.ts +20 -0
- package/core/chart-container.js +55 -0
- package/core/chart-container.js.map +1 -0
- package/core/chart-core.d.ts +7 -0
- package/core/chart-core.js +287 -0
- package/core/chart-core.js.map +1 -0
- package/core/components/core-application.d.ts +6 -0
- package/core/components/core-application.js +16 -0
- package/core/components/core-application.js.map +1 -0
- package/core/components/core-filters.d.ts +9 -0
- package/core/components/core-filters.js +22 -0
- package/core/components/core-filters.js.map +1 -0
- package/core/components/core-legend.d.ts +13 -0
- package/core/components/core-legend.js +27 -0
- package/core/components/core-legend.js.map +1 -0
- package/core/components/core-no-data.d.ts +6 -0
- package/core/components/core-no-data.js +48 -0
- package/core/components/core-no-data.js.map +1 -0
- package/core/components/core-slots.d.ts +7 -0
- package/core/components/core-slots.js +11 -0
- package/core/components/core-slots.js.map +1 -0
- package/core/components/core-tooltip.d.ts +7 -0
- package/core/components/core-tooltip.js +183 -0
- package/core/components/core-tooltip.js.map +1 -0
- package/core/components/core-vertical-axis-title.d.ts +5 -0
- package/core/components/core-vertical-axis-title.js +15 -0
- package/core/components/core-vertical-axis-title.js.map +1 -0
- package/core/formatters.d.ts +2 -0
- package/core/formatters.js +113 -0
- package/core/formatters.js.map +1 -0
- package/core/i18n-utils.d.ts +21 -0
- package/core/i18n-utils.js +18 -0
- package/core/i18n-utils.js.map +1 -0
- package/core/interfaces.d.ts +436 -0
- package/core/interfaces.js +4 -0
- package/core/interfaces.js.map +1 -0
- package/core/styles.css.js +25 -0
- package/core/styles.scoped.css +115 -0
- package/core/styles.selectors.js +26 -0
- package/core/test-classes/styles.css.js +33 -0
- package/core/test-classes/styles.scoped.css +34 -0
- package/core/test-classes/styles.selectors.js +34 -0
- package/core/utils.d.ts +45 -0
- package/core/utils.js +262 -0
- package/core/utils.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +5 -0
- package/index.js.map +1 -0
- package/internal/api-docs/components/cartesian-chart.js +571 -0
- package/internal/api-docs/components/index.d.ts +3 -0
- package/internal/api-docs/components/index.js +4 -0
- package/internal/api-docs/components/interfaces.d.ts +81 -0
- package/internal/api-docs/components/pie-chart.js +430 -0
- package/internal/api-docs/test-utils-doc/dom.js +4 -0
- package/internal/api-docs/test-utils-doc/selectors.js +4 -0
- package/internal/base-component/get-data-attributes.d.ts +1 -0
- package/internal/base-component/get-data-attributes.js +12 -0
- package/internal/base-component/get-data-attributes.js.map +1 -0
- package/internal/base-component/use-base-component.d.ts +13 -0
- package/internal/base-component/use-base-component.js +18 -0
- package/internal/base-component/use-base-component.js.map +1 -0
- package/internal/base-component/use-telemetry.d.ts +2 -0
- package/internal/base-component/use-telemetry.js +8 -0
- package/internal/base-component/use-telemetry.js.map +1 -0
- package/internal/chart-styles.d.ts +88 -0
- package/internal/chart-styles.js +145 -0
- package/internal/chart-styles.js.map +1 -0
- package/internal/components/chart-legend/index.d.ts +14 -0
- package/internal/components/chart-legend/index.js +245 -0
- package/internal/components/chart-legend/index.js.map +1 -0
- package/internal/components/chart-legend/styles.css.js +22 -0
- package/internal/components/chart-legend/styles.scoped.css +233 -0
- package/internal/components/chart-legend/styles.selectors.js +23 -0
- package/internal/components/chart-legend/test-classes/styles.css.js +11 -0
- package/internal/components/chart-legend/test-classes/styles.scoped.css +12 -0
- package/internal/components/chart-legend/test-classes/styles.selectors.js +12 -0
- package/internal/components/chart-series-filter/index.d.ts +17 -0
- package/internal/components/chart-series-filter/index.js +14 -0
- package/internal/components/chart-series-filter/index.js.map +1 -0
- package/internal/components/interfaces.d.ts +17 -0
- package/internal/components/interfaces.js +4 -0
- package/internal/components/interfaces.js.map +1 -0
- package/internal/components/series-details/index.d.ts +23 -0
- package/internal/components/series-details/index.js +45 -0
- package/internal/components/series-details/index.js.map +1 -0
- package/internal/components/series-details/styles.css.js +22 -0
- package/internal/components/series-details/styles.scoped.css +150 -0
- package/internal/components/series-details/styles.selectors.js +23 -0
- package/internal/components/series-details/test-classes/styles.css.js +10 -0
- package/internal/components/series-details/test-classes/styles.scoped.css +11 -0
- package/internal/components/series-details/test-classes/styles.selectors.js +11 -0
- package/internal/components/series-marker/index.d.ts +8 -0
- package/internal/components/series-marker/index.js +45 -0
- package/internal/components/series-marker/index.js.map +1 -0
- package/internal/components/series-marker/interfaces.d.ts +1 -0
- package/internal/components/series-marker/interfaces.js +4 -0
- package/internal/components/series-marker/interfaces.js.map +1 -0
- package/internal/components/series-marker/render-marker.d.ts +3 -0
- package/internal/components/series-marker/render-marker.js +74 -0
- package/internal/components/series-marker/render-marker.js.map +1 -0
- package/internal/components/series-marker/styles.css.js +7 -0
- package/internal/components/series-marker/styles.scoped.css +55 -0
- package/internal/components/series-marker/styles.selectors.js +8 -0
- package/internal/environment.d.ts +4 -0
- package/internal/environment.js +5 -0
- package/internal/environment.json +7 -0
- package/internal/events/index.d.ts +23 -0
- package/internal/events/index.js +41 -0
- package/internal/events/index.js.map +1 -0
- package/internal/generated/styles/tokens.d.ts +756 -0
- package/internal/generated/styles/tokens.js +756 -0
- package/internal/generated/theming/index.cjs +12584 -0
- package/internal/generated/theming/index.cjs.d.ts +2399 -0
- package/internal/generated/theming/index.d.ts +2399 -0
- package/internal/generated/theming/index.js +12584 -0
- package/internal/manifest.json +3 -0
- package/internal/styles.css.js +6 -0
- package/internal/styles.scoped.css +13 -0
- package/internal/styles.selectors.js +7 -0
- package/internal/utils/apply-display-name.d.ts +1 -0
- package/internal/utils/apply-display-name.js +6 -0
- package/internal/utils/apply-display-name.js.map +1 -0
- package/internal/utils/async-store.d.ts +19 -0
- package/internal/utils/async-store.js +58 -0
- package/internal/utils/async-store.js.map +1 -0
- package/internal/utils/chart-series.d.ts +8 -0
- package/internal/utils/chart-series.js +11 -0
- package/internal/utils/chart-series.js.map +1 -0
- package/internal/utils/renderer-utils.d.ts +17 -0
- package/internal/utils/renderer-utils.js +95 -0
- package/internal/utils/renderer-utils.js.map +1 -0
- package/internal/utils/series-data.d.ts +2 -0
- package/internal/utils/series-data.js +8 -0
- package/internal/utils/series-data.js.map +1 -0
- package/internal/utils/test-i18n-provider.d.ts +8 -0
- package/internal/utils/test-i18n-provider.js +8 -0
- package/internal/utils/test-i18n-provider.js.map +1 -0
- package/internal/utils/use-previous.d.ts +4 -0
- package/internal/utils/use-previous.js +14 -0
- package/internal/utils/use-previous.js.map +1 -0
- package/internal/utils/utils.d.ts +16 -0
- package/internal/utils/utils.js +49 -0
- package/internal/utils/utils.js.map +1 -0
- package/internal-do-not-use/core-chart/index.d.ts +4 -0
- package/internal-do-not-use/core-chart/index.js +13 -0
- package/internal-do-not-use/core-chart/index.js.map +1 -0
- package/internal-do-not-use/core-legend/index.d.ts +2 -0
- package/internal-do-not-use/core-legend/index.js +11 -0
- package/internal-do-not-use/core-legend/index.js.map +1 -0
- package/package.json +106 -0
- package/pie-chart/chart-inner-area.d.ts +10 -0
- package/pie-chart/chart-inner-area.js +63 -0
- package/pie-chart/chart-inner-area.js.map +1 -0
- package/pie-chart/chart-pie-internal.d.ts +11 -0
- package/pie-chart/chart-pie-internal.js +103 -0
- package/pie-chart/chart-pie-internal.js.map +1 -0
- package/pie-chart/index.d.ts +5 -0
- package/pie-chart/index.js +48 -0
- package/pie-chart/index.js.map +1 -0
- package/pie-chart/interfaces.d.ts +101 -0
- package/pie-chart/interfaces.js +4 -0
- package/pie-chart/interfaces.js.map +1 -0
- package/pie-chart/test-classes/styles.css.js +8 -0
- package/pie-chart/test-classes/styles.scoped.css +9 -0
- package/pie-chart/test-classes/styles.selectors.js +9 -0
- package/test-utils/dom/cartesian-chart/index.d.ts +14 -0
- package/test-utils/dom/cartesian-chart/index.js +24 -0
- package/test-utils/dom/cartesian-chart/index.js.map +1 -0
- package/test-utils/dom/cartesian-chart/tooltip.d.ts +28 -0
- package/test-utils/dom/cartesian-chart/tooltip.js +48 -0
- package/test-utils/dom/cartesian-chart/tooltip.js.map +1 -0
- package/test-utils/dom/index.d.ts +46 -0
- package/test-utils/dom/index.js +35 -0
- package/test-utils/dom/index.js.map +1 -0
- package/test-utils/dom/internal/base.d.ts +93 -0
- package/test-utils/dom/internal/base.js +146 -0
- package/test-utils/dom/internal/base.js.map +1 -0
- package/test-utils/dom/internal/core.d.ts +14 -0
- package/test-utils/dom/internal/core.js +37 -0
- package/test-utils/dom/internal/core.js.map +1 -0
- package/test-utils/dom/pie-chart/index.d.ts +17 -0
- package/test-utils/dom/pie-chart/index.js +29 -0
- package/test-utils/dom/pie-chart/index.js.map +1 -0
- package/test-utils/selectors/cartesian-chart/index.d.ts +14 -0
- package/test-utils/selectors/cartesian-chart/index.js +24 -0
- package/test-utils/selectors/cartesian-chart/index.js.map +1 -0
- package/test-utils/selectors/cartesian-chart/tooltip.d.ts +28 -0
- package/test-utils/selectors/cartesian-chart/tooltip.js +48 -0
- package/test-utils/selectors/cartesian-chart/tooltip.js.map +1 -0
- package/test-utils/selectors/index.d.ts +46 -0
- package/test-utils/selectors/index.js +32 -0
- package/test-utils/selectors/index.js.map +1 -0
- package/test-utils/selectors/internal/base.d.ts +93 -0
- package/test-utils/selectors/internal/base.js +146 -0
- package/test-utils/selectors/internal/base.js.map +1 -0
- package/test-utils/selectors/internal/core.d.ts +14 -0
- package/test-utils/selectors/internal/core.js +37 -0
- package/test-utils/selectors/internal/core.js.map +1 -0
- package/test-utils/selectors/pie-chart/index.d.ts +17 -0
- package/test-utils/selectors/pie-chart/index.js +29 -0
- package/test-utils/selectors/pie-chart/index.js.map +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import './styles.scoped.css';
|
|
3
|
+
export default {
|
|
4
|
+
"key": "awsui_key_vf2b9_17459_5",
|
|
5
|
+
"value": "awsui_value_vf2b9_17459_6",
|
|
6
|
+
"list-item": "awsui_list-item_vf2b9_17459_7",
|
|
7
|
+
"inner-list-item": "awsui_inner-list-item_vf2b9_17459_8",
|
|
8
|
+
"description": "awsui_description_vf2b9_17459_9"
|
|
9
|
+
};
|
|
10
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
.awsui_key_vf2b9_17459_5:not(#\9),
|
|
6
|
+
.awsui_value_vf2b9_17459_6:not(#\9),
|
|
7
|
+
.awsui_list-item_vf2b9_17459_7:not(#\9),
|
|
8
|
+
.awsui_inner-list-item_vf2b9_17459_8:not(#\9),
|
|
9
|
+
.awsui_description_vf2b9_17459_9:not(#\9) {
|
|
10
|
+
/* used in test-utils */
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"key": "awsui_key_vf2b9_17459_5",
|
|
6
|
+
"value": "awsui_value_vf2b9_17459_6",
|
|
7
|
+
"list-item": "awsui_list-item_vf2b9_17459_7",
|
|
8
|
+
"inner-list-item": "awsui_inner-list-item_vf2b9_17459_8",
|
|
9
|
+
"description": "awsui_description_vf2b9_17459_9"
|
|
10
|
+
};
|
|
11
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseComponentProps } from "@cloudscape-design/components/internal/base-component";
|
|
2
|
+
export type ChartSeriesMarkerType = "line" | "dashed" | "square" | "large-square" | "hollow-square" | "diamond" | "triangle" | "triangle-down" | "circle";
|
|
3
|
+
export interface ChartSeriesMarkerProps extends BaseComponentProps {
|
|
4
|
+
type: ChartSeriesMarkerType;
|
|
5
|
+
color: string;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function ChartSeriesMarker({ type, color, visible }: ChartSeriesMarkerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { colorTextInteractiveDisabled } from "@cloudscape-design/design-tokens";
|
|
3
|
+
import styles from "./styles.css.js";
|
|
4
|
+
function scale(size, value) {
|
|
5
|
+
return `translate(${size * ((1 - value) / 2)}, ${size * ((1 - value) / 2)}) scale(${value})`;
|
|
6
|
+
}
|
|
7
|
+
export function ChartSeriesMarker({ type = "line", color, visible = true }) {
|
|
8
|
+
color = visible ? color : colorTextInteractiveDisabled;
|
|
9
|
+
return (_jsx("div", { className: styles.marker, children: _jsxs("svg", { focusable: false, "aria-hidden": true, viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", children: [type === "line" && _jsx(SVGLine, { color: color }), type === "dashed" && _jsx(SVGLineDashed, { color: color }), type === "large-square" && _jsx(SVGLargeSquare, { color: color }), type === "hollow-square" && _jsx(SVGHollowSquare, { color: color }), type === "square" && _jsx(SVGSquare, { color: color }), type === "diamond" && _jsx(SVGDiamond, { color: color }), type === "triangle" && _jsx(SVGTriangle, { color: color }), type === "triangle-down" && _jsx(SVGTriangleDown, { color: color }), type === "circle" && _jsx(SVGCircle, { color: color })] }) }));
|
|
10
|
+
}
|
|
11
|
+
function SVGLine({ color }) {
|
|
12
|
+
return _jsx("rect", { x: 1, y: 7, height: 4, width: 14, strokeWidth: 0, rx: 2, fill: color });
|
|
13
|
+
}
|
|
14
|
+
function SVGLineDashed({ color }) {
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx("rect", { x: 1, y: 7, height: 4, width: 6, strokeWidth: 0, rx: 2, fill: color }), _jsx("rect", { x: 9, y: 7, height: 4, width: 6, strokeWidth: 0, rx: 2, fill: color })] }));
|
|
16
|
+
}
|
|
17
|
+
function SVGLargeSquare({ color }) {
|
|
18
|
+
const shape = { x: 0, y: 0, width: 16, height: 16, rx: 2, transform: scale(16, 0.85) };
|
|
19
|
+
return _jsx("rect", { ...shape, strokeWidth: 0, fill: color });
|
|
20
|
+
}
|
|
21
|
+
function SVGHollowSquare({ color }) {
|
|
22
|
+
const size = { x: 0, y: 0, width: 16, height: 16, rx: 2, transform: scale(16, 0.75) };
|
|
23
|
+
return _jsx("rect", { ...size, strokeWidth: 2, stroke: color, fill: color, fillOpacity: "0.40" });
|
|
24
|
+
}
|
|
25
|
+
function SVGSquare({ color }) {
|
|
26
|
+
const size = { x: 3, y: 3, width: 10, height: 10, rx: 2 };
|
|
27
|
+
return _jsx("rect", { ...size, strokeWidth: 0, fill: color });
|
|
28
|
+
}
|
|
29
|
+
function SVGDiamond({ color }) {
|
|
30
|
+
const shape = { points: "8,0 16,8 8,16 0,8", transform: scale(16, 0.65) };
|
|
31
|
+
return _jsx("polygon", { ...shape, strokeWidth: 0, fill: color });
|
|
32
|
+
}
|
|
33
|
+
function SVGTriangle({ color }) {
|
|
34
|
+
const shape = { points: "8,0 16,16 0,16", transform: scale(16, 0.65) };
|
|
35
|
+
return _jsx("polygon", { ...shape, strokeWidth: 0, fill: color });
|
|
36
|
+
}
|
|
37
|
+
function SVGTriangleDown({ color }) {
|
|
38
|
+
const shape = { points: "8,16 0,0 16,0", transform: scale(16, 0.65) };
|
|
39
|
+
return _jsx("polygon", { ...shape, strokeWidth: 0, fill: color });
|
|
40
|
+
}
|
|
41
|
+
function SVGCircle({ color }) {
|
|
42
|
+
const shape = { cx: 8, cy: 8, r: 5 };
|
|
43
|
+
return _jsx("circle", { ...shape, strokeWidth: 0, fill: color });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources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,KAAK,EAAqB;IACnD,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;IACtE,OAAO,qBAAa,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,GAAI,CAAC;AAC7D,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,KAAK,EAAqB;IAC7C,MAAM,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACrC,OAAO,oBAAY,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,GAAI,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from \"@cloudscape-design/components/internal/base-component\";\nimport { colorTextInteractiveDisabled } from \"@cloudscape-design/design-tokens\";\n\nimport styles from \"./styles.css.js\";\n\nexport type ChartSeriesMarkerType =\n | \"line\"\n | \"dashed\"\n | \"square\"\n | \"large-square\"\n | \"hollow-square\"\n | \"diamond\"\n | \"triangle\"\n | \"triangle-down\"\n | \"circle\";\n\nexport interface ChartSeriesMarkerProps extends BaseComponentProps {\n type: ChartSeriesMarkerType;\n color: string;\n visible?: boolean;\n}\n\nfunction scale(size: number, value: number) {\n return `translate(${size * ((1 - value) / 2)}, ${size * ((1 - value) / 2)}) scale(${value})`;\n}\n\nexport function ChartSeriesMarker({ type = \"line\", color, visible = true }: ChartSeriesMarkerProps) {\n color = visible ? color : colorTextInteractiveDisabled;\n return (\n <div className={styles.marker}>\n <svg focusable={false} aria-hidden={true} viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\">\n {type === \"line\" && <SVGLine color={color} />}\n\n {type === \"dashed\" && <SVGLineDashed color={color} />}\n\n {type === \"large-square\" && <SVGLargeSquare color={color} />}\n\n {type === \"hollow-square\" && <SVGHollowSquare color={color} />}\n\n {type === \"square\" && <SVGSquare color={color} />}\n\n {type === \"diamond\" && <SVGDiamond color={color} />}\n\n {type === \"triangle\" && <SVGTriangle color={color} />}\n\n {type === \"triangle-down\" && <SVGTriangleDown color={color} />}\n\n {type === \"circle\" && <SVGCircle color={color} />}\n </svg>\n </div>\n );\n}\n\nfunction SVGLine({ color }: { color: string }) {\n return <rect x={1} y={7} height={4} width={14} strokeWidth={0} rx={2} fill={color} />;\n}\n\nfunction SVGLineDashed({ color }: { color: string }) {\n return (\n <>\n <rect x={1} y={7} height={4} width={6} strokeWidth={0} rx={2} fill={color} />\n <rect x={9} y={7} height={4} width={6} strokeWidth={0} rx={2} fill={color} />\n </>\n );\n}\n\nfunction SVGLargeSquare({ color }: { color: string }) {\n const shape = { x: 0, y: 0, width: 16, height: 16, rx: 2, transform: scale(16, 0.85) };\n return <rect {...shape} strokeWidth={0} fill={color} />;\n}\n\nfunction SVGHollowSquare({ color }: { color: string }) {\n const size = { x: 0, y: 0, width: 16, height: 16, rx: 2, transform: scale(16, 0.75) };\n return <rect {...size} strokeWidth={2} stroke={color} fill={color} fillOpacity=\"0.40\" />;\n}\n\nfunction SVGSquare({ color }: { color: string }) {\n const size = { x: 3, y: 3, width: 10, height: 10, rx: 2 };\n return <rect {...size} strokeWidth={0} fill={color} />;\n}\n\nfunction SVGDiamond({ color }: { color: string }) {\n const shape = { points: \"8,0 16,8 8,16 0,8\", transform: scale(16, 0.65) };\n return <polygon {...shape} strokeWidth={0} fill={color} />;\n}\n\nfunction SVGTriangle({ color }: { color: string }) {\n const shape = { points: \"8,0 16,16 0,16\", transform: scale(16, 0.65) };\n return <polygon {...shape} strokeWidth={0} fill={color} />;\n}\n\nfunction SVGTriangleDown({ color }: { color: string }) {\n const shape = { points: \"8,16 0,0 16,0\", transform: scale(16, 0.65) };\n return <polygon {...shape} strokeWidth={0} fill={color} />;\n}\n\nfunction SVGCircle({ color }: { color: string }) {\n const shape = { cx: 8, cy: 8, r: 5 };\n return <circle {...shape} strokeWidth={0} fill={color} />;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ChartSeriesMarkerType = "line" | "dashed" | "square" | "large-square" | "hollow-square" | "diamond" | "triangle" | "triangle-down" | "circle";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../src/internal/components/series-marker/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type ChartSeriesMarkerType =\n | \"line\"\n | \"dashed\"\n | \"square\"\n | \"large-square\"\n | \"hollow-square\"\n | \"diamond\"\n | \"triangle\"\n | \"triangle-down\"\n | \"circle\";\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type Highcharts from "highcharts";
|
|
2
|
+
import { SVGRendererPool } from "../../utils/renderer-utils";
|
|
3
|
+
export declare function renderMarker(chart: Highcharts.Chart, pool: SVGRendererPool, point: Highcharts.Point, selected: boolean, className?: string): Highcharts.SVGElement | undefined;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { colorBackgroundContainerContent, colorTextBodyDefault } from "@cloudscape-design/design-tokens";
|
|
4
|
+
export function renderMarker(chart, pool, point, selected, className) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if (point.plotX === undefined || point.plotY === undefined) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const rr = chart.renderer;
|
|
10
|
+
const inverted = !!chart.inverted;
|
|
11
|
+
const size = selected ? 4 : 3;
|
|
12
|
+
const pointStyle = {
|
|
13
|
+
zIndex: selected ? 6 : 5,
|
|
14
|
+
"stroke-width": 2,
|
|
15
|
+
stroke: selected ? colorTextBodyDefault : point.color,
|
|
16
|
+
fill: selected ? point.color : colorBackgroundContainerContent,
|
|
17
|
+
opacity: 1,
|
|
18
|
+
style: "pointer-events: none",
|
|
19
|
+
class: className,
|
|
20
|
+
};
|
|
21
|
+
const haloStyle = {
|
|
22
|
+
zIndex: 6,
|
|
23
|
+
"stroke-width": 0,
|
|
24
|
+
stroke: point.color,
|
|
25
|
+
fill: point.color,
|
|
26
|
+
opacity: 0.4,
|
|
27
|
+
style: "pointer-events: none",
|
|
28
|
+
};
|
|
29
|
+
const x = inverted ? chart.plotLeft + chart.plotWidth - point.plotY : chart.plotLeft + ((_a = point.plotX) !== null && _a !== void 0 ? _a : 0);
|
|
30
|
+
const y = inverted ? chart.plotTop + chart.plotHeight - point.plotX : chart.plotTop + ((_b = point.plotY) !== null && _b !== void 0 ? _b : 0);
|
|
31
|
+
if (selected) {
|
|
32
|
+
pool.circle(rr, { ...haloStyle, x, y, r: 10 });
|
|
33
|
+
}
|
|
34
|
+
const type = getSeriesMarkerType(point.series);
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "square":
|
|
37
|
+
return pool.rect(rr, { ...pointStyle, x: x - size, y: y - size, width: size * 2, height: size * 2 });
|
|
38
|
+
case "diamond": {
|
|
39
|
+
const path = ["M", x, y - size, "L", x + size, y, "L", x, y + size, "L", x - size, y, "Z"];
|
|
40
|
+
return pool.path(rr, { ...pointStyle, d: path });
|
|
41
|
+
}
|
|
42
|
+
case "triangle": {
|
|
43
|
+
const path = ["M", x, y - size, "L", x + size, y + size, "L", x - size, y + size, "Z"];
|
|
44
|
+
return pool.path(rr, { ...pointStyle, d: path });
|
|
45
|
+
}
|
|
46
|
+
case "triangle-down": {
|
|
47
|
+
const path = ["M", x, y + size, "L", x - size, y - size, "L", x + size, y - size, "Z"];
|
|
48
|
+
return pool.path(rr, { ...pointStyle, d: path });
|
|
49
|
+
}
|
|
50
|
+
case "circle":
|
|
51
|
+
default:
|
|
52
|
+
return pool.circle(rr, { ...pointStyle, x, y, r: size });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function getSeriesMarkerType(series) {
|
|
56
|
+
const seriesSymbol = "symbol" in series && typeof series.symbol === "string" ? series.symbol : "circle";
|
|
57
|
+
if (series.type === "scatter") {
|
|
58
|
+
switch (seriesSymbol) {
|
|
59
|
+
case "square":
|
|
60
|
+
return "square";
|
|
61
|
+
case "diamond":
|
|
62
|
+
return "diamond";
|
|
63
|
+
case "triangle":
|
|
64
|
+
return "triangle";
|
|
65
|
+
case "triangle-down":
|
|
66
|
+
return "triangle-down";
|
|
67
|
+
case "circle":
|
|
68
|
+
default:
|
|
69
|
+
return "circle";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return "circle";
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=render-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-marker.js","sourceRoot":"","sources":["../../../../../src/internal/components/series-marker/render-marker.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAKzG,MAAM,UAAU,YAAY,CAC1B,KAAuB,EACvB,IAAqB,EACrB,KAAuB,EACvB,QAAiB,EACjB,SAAkB;;IAElB,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE;QAC1D,OAAO;KACR;IAED,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1B,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,UAAU,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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C,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;SAClD;QAED,KAAK,QAAQ,CAAC;QACd;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;KAC5D;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAyB;IACpD,MAAM,YAAY,GAAG,QAAQ,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxG,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;QAC7B,QAAQ,YAAY,EAAE;YACpB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB,KAAK,SAAS;gBACZ,OAAO,SAAS,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,eAAe,CAAC;YACzB,KAAK,QAAQ,CAAC;YACd;gBACE,OAAO,QAAQ,CAAC;SACnB;KACF;IACD,OAAO,QAAQ,CAAC;AAClB,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 { colorBackgroundContainerContent, colorTextBodyDefault } from \"@cloudscape-design/design-tokens\";\n\nimport { SVGRendererPool } from \"../../utils/renderer-utils\";\nimport { ChartSeriesMarkerType } from \"./interfaces\";\n\nexport function renderMarker(\n chart: Highcharts.Chart,\n pool: SVGRendererPool,\n point: Highcharts.Point,\n selected: boolean,\n className?: string,\n) {\n if (point.plotX === undefined || point.plotY === undefined) {\n return;\n }\n\n const rr = chart.renderer;\n const inverted = !!chart.inverted;\n const size = selected ? 4 : 3;\n const pointStyle = {\n zIndex: selected ? 6 : 5,\n \"stroke-width\": 2,\n stroke: selected ? colorTextBodyDefault : point.color,\n fill: selected ? point.color : colorBackgroundContainerContent,\n opacity: 1,\n style: \"pointer-events: none\",\n class: className,\n };\n const haloStyle = {\n zIndex: 6,\n \"stroke-width\": 0,\n stroke: point.color,\n fill: point.color,\n opacity: 0.4,\n style: \"pointer-events: none\",\n };\n\n const x = inverted ? chart.plotLeft + chart.plotWidth - point.plotY : chart.plotLeft + (point.plotX ?? 0);\n const y = inverted ? chart.plotTop + chart.plotHeight - point.plotX : chart.plotTop + (point.plotY ?? 0);\n\n if (selected) {\n pool.circle(rr, { ...haloStyle, x, y, r: 10 });\n }\n\n const type = getSeriesMarkerType(point.series);\n switch (type) {\n case \"square\":\n return pool.rect(rr, { ...pointStyle, x: x - size, y: y - size, width: size * 2, height: size * 2 });\n\n case \"diamond\": {\n const path = [\"M\", x, y - size, \"L\", x + size, y, \"L\", x, y + size, \"L\", x - size, y, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"triangle\": {\n const path = [\"M\", x, y - size, \"L\", x + size, y + size, \"L\", x - size, y + size, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"triangle-down\": {\n const path = [\"M\", x, y + size, \"L\", x - size, y - size, \"L\", x + size, y - size, \"Z\"] as any;\n return pool.path(rr, { ...pointStyle, d: path });\n }\n\n case \"circle\":\n default:\n return pool.circle(rr, { ...pointStyle, x, y, r: size });\n }\n}\n\nfunction getSeriesMarkerType(series: Highcharts.Series): ChartSeriesMarkerType {\n const seriesSymbol = \"symbol\" in series && typeof series.symbol === \"string\" ? series.symbol : \"circle\";\n if (series.type === \"scatter\") {\n switch (seriesSymbol) {\n case \"square\":\n return \"square\";\n case \"diamond\":\n return \"diamond\";\n case \"triangle\":\n return \"triangle\";\n case \"triangle-down\":\n return \"triangle-down\";\n case \"circle\":\n default:\n return \"circle\";\n }\n }\n return \"circle\";\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
11
|
+
SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
*/
|
|
13
|
+
/* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
14
|
+
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
15
|
+
body[data-awsui-focus-visible=true] .awsui_focus-outline_kfsgg_13s31_15:not(#\9) {
|
|
16
|
+
stroke: var(--color-border-item-focused-uk47pl, #006ce0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.awsui_marker_kfsgg_13s31_19:not(#\9) {
|
|
20
|
+
border-collapse: separate;
|
|
21
|
+
border-spacing: 0;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
caption-side: top;
|
|
24
|
+
cursor: auto;
|
|
25
|
+
direction: inherit;
|
|
26
|
+
empty-cells: show;
|
|
27
|
+
font-family: serif;
|
|
28
|
+
font-size: medium;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-variant: normal;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
font-stretch: normal;
|
|
33
|
+
line-height: normal;
|
|
34
|
+
hyphens: none;
|
|
35
|
+
letter-spacing: normal;
|
|
36
|
+
list-style: disc outside none;
|
|
37
|
+
tab-size: 8;
|
|
38
|
+
text-align: start;
|
|
39
|
+
text-indent: 0;
|
|
40
|
+
text-shadow: none;
|
|
41
|
+
text-transform: none;
|
|
42
|
+
visibility: visible;
|
|
43
|
+
white-space: normal;
|
|
44
|
+
word-spacing: normal;
|
|
45
|
+
margin-block-start: var(--space-static-xxxs-yidks1, 2px);
|
|
46
|
+
margin-inline-end: var(--space-static-xxs-ns94dp, 4px);
|
|
47
|
+
border-start-start-radius: 2px;
|
|
48
|
+
border-start-end-radius: 2px;
|
|
49
|
+
border-end-start-radius: 2px;
|
|
50
|
+
border-end-end-radius: 2px;
|
|
51
|
+
inline-size: 16px;
|
|
52
|
+
block-size: 16px;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
cursor: inherit;
|
|
55
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type CancelableEventHandler<Detail = object> = (event: CustomEvent<Detail>) => void;
|
|
3
|
+
export type NonCancelableEventHandler<Detail = {}> = (event: NonCancelableCustomEvent<Detail>) => void;
|
|
4
|
+
export type NonCancelableCustomEvent<DetailType> = Omit<CustomEvent<DetailType>, "preventDefault">;
|
|
5
|
+
export interface ClickDetail {
|
|
6
|
+
button: number;
|
|
7
|
+
ctrlKey: boolean;
|
|
8
|
+
shiftKey: boolean;
|
|
9
|
+
altKey: boolean;
|
|
10
|
+
metaKey: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class CustomEventStub<T> {
|
|
13
|
+
cancelable: boolean;
|
|
14
|
+
detail: T | null;
|
|
15
|
+
defaultPrevented: boolean;
|
|
16
|
+
cancelBubble: boolean;
|
|
17
|
+
constructor(cancelable?: boolean, detail?: T | null);
|
|
18
|
+
preventDefault(): void;
|
|
19
|
+
stopPropagation(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function createCustomEvent<T>({ cancelable, detail }: CustomEventInit<T>): CustomEvent<T>;
|
|
22
|
+
export declare function fireCancelableEvent<T>(handler: CancelableEventHandler<T> | undefined, detail: T, sourceEvent?: React.SyntheticEvent | Event): boolean;
|
|
23
|
+
export declare function fireNonCancelableEvent<T = null>(handler: NonCancelableEventHandler<T> | undefined, detail?: T): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export class CustomEventStub {
|
|
4
|
+
constructor(cancelable = false, detail = null) {
|
|
5
|
+
this.cancelable = cancelable;
|
|
6
|
+
this.detail = detail;
|
|
7
|
+
this.defaultPrevented = false;
|
|
8
|
+
this.cancelBubble = false;
|
|
9
|
+
}
|
|
10
|
+
preventDefault() {
|
|
11
|
+
this.defaultPrevented = true;
|
|
12
|
+
}
|
|
13
|
+
stopPropagation() {
|
|
14
|
+
this.cancelBubble = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function createCustomEvent({ cancelable, detail }) {
|
|
18
|
+
return new CustomEventStub(cancelable, detail);
|
|
19
|
+
}
|
|
20
|
+
export function fireCancelableEvent(handler, detail, sourceEvent) {
|
|
21
|
+
if (!handler) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
const event = createCustomEvent({ cancelable: true, detail });
|
|
25
|
+
handler(event);
|
|
26
|
+
if (event.defaultPrevented && sourceEvent) {
|
|
27
|
+
sourceEvent.preventDefault();
|
|
28
|
+
}
|
|
29
|
+
if (event.cancelBubble && sourceEvent) {
|
|
30
|
+
sourceEvent.stopPropagation();
|
|
31
|
+
}
|
|
32
|
+
return event.defaultPrevented;
|
|
33
|
+
}
|
|
34
|
+
export function fireNonCancelableEvent(handler, detail) {
|
|
35
|
+
if (!handler) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const event = createCustomEvent({ cancelable: false, detail });
|
|
39
|
+
handler(event);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/events/index.ts"],"names":[],"mapp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AAC;AACjB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport type CancelableEventHandler<Detail = object> = (event: CustomEvent<Detail>) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type NonCancelableEventHandler<Detail = {}> = (event: NonCancelableCustomEvent<Detail>) => void;\n\nexport type NonCancelableCustomEvent<DetailType> = Omit<CustomEvent<DetailType>, \"preventDefault\">;\n\nexport interface ClickDetail {\n button: number;\n ctrlKey: boolean;\n shiftKey: boolean;\n altKey: boolean;\n metaKey: boolean;\n}\n\nexport class CustomEventStub<T> {\n defaultPrevented = false;\n cancelBubble = false;\n constructor(\n public cancelable: boolean = false,\n public detail: T | null = null,\n ) {}\n\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n stopPropagation() {\n this.cancelBubble = true;\n }\n}\n\nexport function createCustomEvent<T>({ cancelable, detail }: CustomEventInit<T>): CustomEvent<T> {\n return new CustomEventStub(cancelable, detail) as CustomEvent;\n}\n\nexport function fireCancelableEvent<T>(\n handler: CancelableEventHandler<T> | undefined,\n detail: T,\n sourceEvent?: React.SyntheticEvent | Event,\n) {\n if (!handler) {\n return false;\n }\n const event = createCustomEvent({ cancelable: true, detail });\n handler(event);\n if (event.defaultPrevented && sourceEvent) {\n sourceEvent.preventDefault();\n }\n if (event.cancelBubble && sourceEvent) {\n sourceEvent.stopPropagation();\n }\n return event.defaultPrevented;\n}\n\nexport function fireNonCancelableEvent<T = null>(handler: NonCancelableEventHandler<T> | undefined, detail?: T) {\n if (!handler) {\n return;\n }\n const event = createCustomEvent({ cancelable: false, detail });\n handler(event);\n}\n"]}
|