@cloudscape-design/components 3.0.328 → 3.0.330
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/app-layout/runtime-api.d.ts.map +1 -1
- package/app-layout/runtime-api.js +5 -4
- package/app-layout/runtime-api.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +69 -69
- package/app-layout/visual-refresh/styles.scoped.css +167 -167
- package/app-layout/visual-refresh/styles.selectors.js +69 -69
- package/area-chart/chart-container.d.ts.map +1 -1
- package/area-chart/chart-container.js +8 -15
- package/area-chart/chart-container.js.map +1 -1
- package/area-chart/internal.d.ts.map +1 -1
- package/area-chart/internal.js +2 -16
- package/area-chart/internal.js.map +1 -1
- package/area-chart/styles.css.js +6 -13
- package/area-chart/styles.scoped.css +10 -82
- package/area-chart/styles.selectors.js +6 -13
- package/expandable-section/styles.css.js +28 -31
- package/expandable-section/styles.scoped.css +85 -66
- package/expandable-section/styles.selectors.js +28 -31
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +5 -1
- package/form-field/internal.js.map +1 -1
- package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/internal/analytics/components/analytics-funnel.js +4 -1
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/analytics/interfaces.d.ts +2 -0
- package/internal/analytics/interfaces.d.ts.map +1 -1
- package/internal/analytics/interfaces.js.map +1 -1
- package/internal/analytics/selectors.d.ts +1 -0
- package/internal/analytics/selectors.d.ts.map +1 -1
- package/internal/analytics/selectors.js +1 -0
- package/internal/analytics/selectors.js.map +1 -1
- package/internal/components/cartesian-chart/chart-container.d.ts +11 -0
- package/internal/components/cartesian-chart/chart-container.d.ts.map +1 -0
- package/internal/components/cartesian-chart/chart-container.js +15 -0
- package/internal/components/cartesian-chart/chart-container.js.map +1 -0
- package/internal/components/cartesian-chart/styles.css.js +23 -21
- package/internal/components/cartesian-chart/styles.scoped.css +37 -25
- package/internal/components/cartesian-chart/styles.selectors.js +23 -21
- package/internal/components/chart-wrapper/index.d.ts +17 -0
- package/internal/components/chart-wrapper/index.d.ts.map +1 -0
- package/internal/components/chart-wrapper/index.js +26 -0
- package/internal/components/chart-wrapper/index.js.map +1 -0
- package/internal/components/chart-wrapper/styles.css.js +11 -0
- package/internal/components/chart-wrapper/styles.scoped.css +155 -0
- package/internal/components/chart-wrapper/styles.selectors.js +12 -0
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/internal/plugins/drawers-controller.d.ts +2 -4
- package/internal/plugins/drawers-controller.d.ts.map +1 -1
- package/internal/plugins/drawers-controller.js.map +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +9 -1
- package/link/internal.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +12 -19
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/internal.d.ts.map +1 -1
- package/mixed-line-bar-chart/internal.js +10 -15
- package/mixed-line-bar-chart/internal.js.map +1 -1
- package/mixed-line-bar-chart/styles.css.js +11 -19
- package/mixed-line-bar-chart/styles.scoped.css +18 -94
- package/mixed-line-bar-chart/styles.selectors.js +11 -19
- package/package.json +1 -1
- package/pie-chart/index.d.ts.map +1 -1
- package/pie-chart/index.js +26 -14
- package/pie-chart/index.js.map +1 -1
- package/pie-chart/pie-chart.d.ts +5 -3
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +14 -40
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/styles.css.js +23 -27
- package/pie-chart/styles.scoped.css +38 -94
- package/pie-chart/styles.selectors.js +23 -27
- package/table/body-cell/styles.css.js +28 -28
- package/table/body-cell/styles.scoped.css +75 -69
- package/table/body-cell/styles.selectors.js +28 -28
- package/test-utils/dom/mixed-line-bar-chart/index.js +2 -1
- package/test-utils/dom/mixed-line-bar-chart/index.js.map +1 -1
- package/test-utils/dom/pie-chart/index.js +2 -1
- package/test-utils/dom/pie-chart/index.js.map +1 -1
- package/test-utils/selectors/mixed-line-bar-chart/index.js +2 -1
- package/test-utils/selectors/mixed-line-bar-chart/index.js.map +1 -1
- package/test-utils/selectors/pie-chart/index.js +2 -1
- package/test-utils/selectors/pie-chart/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/internal.d.ts.map +1 -1
- package/wizard/internal.js +5 -2
- package/wizard/internal.js.map +1 -1
- package/mixed-line-bar-chart/chart-filters.d.ts +0 -13
- package/mixed-line-bar-chart/chart-filters.d.ts.map +0 -1
- package/mixed-line-bar-chart/chart-filters.js +0 -22
- package/mixed-line-bar-chart/chart-filters.js.map +0 -1
|
@@ -2,74 +2,74 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"background": "
|
|
6
|
-
"scrolling-background": "awsui_scrolling-
|
|
7
|
-
"sticky-background": "awsui_sticky-
|
|
8
|
-
"has-sticky-notifications": "awsui_has-sticky-
|
|
9
|
-
"breadcrumbs": "
|
|
10
|
-
"has-sticky-background": "awsui_has-sticky-
|
|
11
|
-
"drawers-container": "awsui_drawers-
|
|
12
|
-
"has-open-drawer": "awsui_has-open-
|
|
13
|
-
"disable-body-scroll": "awsui_disable-body-
|
|
14
|
-
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-
|
|
15
|
-
"has-multiple-triggers": "awsui_has-multiple-
|
|
16
|
-
"drawers-trigger-content": "awsui_drawers-trigger-
|
|
17
|
-
"drawers-trigger": "awsui_drawers-
|
|
18
|
-
"drawer": "
|
|
19
|
-
"drawer-close-button": "awsui_drawer-close-
|
|
20
|
-
"drawer-content": "awsui_drawer-
|
|
21
|
-
"drawer-slider": "awsui_drawer-
|
|
22
|
-
"is-drawer-open": "awsui_is-drawer-
|
|
23
|
-
"content": "
|
|
24
|
-
"layout": "
|
|
25
|
-
"has-max-content-width": "awsui_has-max-content-
|
|
26
|
-
"content-type-dashboard": "awsui_content-type-
|
|
27
|
-
"is-overlap-disabled": "awsui_is-overlap-
|
|
28
|
-
"has-content-gap-left": "awsui_has-content-gap-
|
|
29
|
-
"has-content-gap-right": "awsui_has-content-gap-
|
|
30
|
-
"content-first-child-notifications": "awsui_content-first-child-
|
|
31
|
-
"has-breadcrumbs": "awsui_has-
|
|
32
|
-
"content-first-child-header": "awsui_content-first-child-
|
|
33
|
-
"has-header": "awsui_has-
|
|
34
|
-
"content-first-child-main": "awsui_content-first-child-
|
|
35
|
-
"disable-content-paddings": "awsui_disable-content-
|
|
36
|
-
"has-split-panel": "awsui_has-split-
|
|
37
|
-
"split-panel-position-bottom": "awsui_split-panel-position-
|
|
38
|
-
"block-body-scroll": "awsui_block-body-
|
|
39
|
-
"unfocusable": "
|
|
40
|
-
"container": "
|
|
41
|
-
"is-navigation-open": "awsui_is-navigation-
|
|
42
|
-
"is-tools-open": "awsui_is-tools-
|
|
43
|
-
"is-split-panel-open": "awsui_is-split-panel-
|
|
44
|
-
"split-panel-position-side": "awsui_split-panel-position-
|
|
45
|
-
"mobile-toolbar": "awsui_mobile-
|
|
46
|
-
"mobile-toolbar-nav": "awsui_mobile-toolbar-
|
|
47
|
-
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-
|
|
48
|
-
"mobile-toolbar-tools": "awsui_mobile-toolbar-
|
|
49
|
-
"navigation-container": "awsui_navigation-
|
|
50
|
-
"show-navigation": "awsui_show-
|
|
51
|
-
"animating": "
|
|
52
|
-
"showButtons": "
|
|
53
|
-
"navigation": "
|
|
54
|
-
"openNavigation": "
|
|
55
|
-
"animated-content": "awsui_animated-
|
|
56
|
-
"hide-navigation": "awsui_hide-
|
|
57
|
-
"notifications": "
|
|
58
|
-
"sticky-notifications": "awsui_sticky-
|
|
59
|
-
"split-panel-bottom": "awsui_split-panel-
|
|
60
|
-
"position-bottom": "awsui_position-
|
|
61
|
-
"openSplitPanelBottom": "
|
|
62
|
-
"split-panel-side": "awsui_split-panel-
|
|
63
|
-
"position-side": "awsui_position-
|
|
64
|
-
"openSplitPanelSide": "
|
|
65
|
-
"tools-container": "awsui_tools-
|
|
66
|
-
"tools": "
|
|
67
|
-
"openTools": "
|
|
68
|
-
"has-tools-form-persistence": "awsui_has-tools-form-
|
|
69
|
-
"hide-tools": "awsui_hide-
|
|
70
|
-
"show-tools": "awsui_show-
|
|
71
|
-
"has-tools-form": "awsui_has-tools-
|
|
72
|
-
"trigger": "
|
|
73
|
-
"selected": "
|
|
5
|
+
"background": "awsui_background_hyvsj_42qar_93",
|
|
6
|
+
"scrolling-background": "awsui_scrolling-background_hyvsj_42qar_96",
|
|
7
|
+
"sticky-background": "awsui_sticky-background_hyvsj_42qar_102",
|
|
8
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_42qar_110",
|
|
9
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_42qar_123",
|
|
10
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_42qar_133",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_hyvsj_42qar_145",
|
|
12
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_42qar_157",
|
|
13
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_42qar_191",
|
|
14
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_42qar_196",
|
|
15
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_42qar_214",
|
|
16
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_42qar_246",
|
|
17
|
+
"drawers-trigger": "awsui_drawers-trigger_hyvsj_42qar_246",
|
|
18
|
+
"drawer": "awsui_drawer_hyvsj_42qar_145",
|
|
19
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_42qar_295",
|
|
20
|
+
"drawer-content": "awsui_drawer-content_hyvsj_42qar_300",
|
|
21
|
+
"drawer-slider": "awsui_drawer-slider_hyvsj_42qar_305",
|
|
22
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_42qar_312",
|
|
23
|
+
"content": "awsui_content_hyvsj_42qar_337",
|
|
24
|
+
"layout": "awsui_layout_hyvsj_42qar_358",
|
|
25
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_42qar_441",
|
|
26
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_42qar_456",
|
|
27
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_42qar_473",
|
|
28
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_42qar_505",
|
|
29
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_42qar_508",
|
|
30
|
+
"content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_42qar_518",
|
|
31
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_42qar_521",
|
|
32
|
+
"content-first-child-header": "awsui_content-first-child-header_hyvsj_42qar_524",
|
|
33
|
+
"has-header": "awsui_has-header_hyvsj_42qar_524",
|
|
34
|
+
"content-first-child-main": "awsui_content-first-child-main_hyvsj_42qar_545",
|
|
35
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_42qar_545",
|
|
36
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_42qar_588",
|
|
37
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_42qar_588",
|
|
38
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_42qar_604",
|
|
39
|
+
"unfocusable": "awsui_unfocusable_hyvsj_42qar_609",
|
|
40
|
+
"container": "awsui_container_hyvsj_42qar_619",
|
|
41
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_42qar_644",
|
|
42
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_42qar_647",
|
|
43
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_42qar_647",
|
|
44
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_42qar_647",
|
|
45
|
+
"mobile-toolbar": "awsui_mobile-toolbar_hyvsj_42qar_656",
|
|
46
|
+
"mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_42qar_672",
|
|
47
|
+
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_42qar_676",
|
|
48
|
+
"mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_42qar_680",
|
|
49
|
+
"navigation-container": "awsui_navigation-container_hyvsj_42qar_689",
|
|
50
|
+
"show-navigation": "awsui_show-navigation_hyvsj_42qar_733",
|
|
51
|
+
"animating": "awsui_animating_hyvsj_42qar_755",
|
|
52
|
+
"showButtons": "awsui_showButtons_hyvsj_42qar_1",
|
|
53
|
+
"navigation": "awsui_navigation_hyvsj_42qar_689",
|
|
54
|
+
"openNavigation": "awsui_openNavigation_hyvsj_42qar_1",
|
|
55
|
+
"animated-content": "awsui_animated-content_hyvsj_42qar_816",
|
|
56
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_42qar_825",
|
|
57
|
+
"notifications": "awsui_notifications_hyvsj_42qar_835",
|
|
58
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_42qar_841",
|
|
59
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_42qar_858",
|
|
60
|
+
"position-bottom": "awsui_position-bottom_hyvsj_42qar_904",
|
|
61
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_42qar_1",
|
|
62
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_42qar_933",
|
|
63
|
+
"position-side": "awsui_position-side_hyvsj_42qar_961",
|
|
64
|
+
"openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_42qar_1",
|
|
65
|
+
"tools-container": "awsui_tools-container_hyvsj_42qar_998",
|
|
66
|
+
"tools": "awsui_tools_hyvsj_42qar_998",
|
|
67
|
+
"openTools": "awsui_openTools_hyvsj_42qar_1",
|
|
68
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_42qar_1092",
|
|
69
|
+
"hide-tools": "awsui_hide-tools_hyvsj_42qar_1102",
|
|
70
|
+
"show-tools": "awsui_show-tools_hyvsj_42qar_1114",
|
|
71
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_42qar_1092",
|
|
72
|
+
"trigger": "awsui_trigger_hyvsj_42qar_1181",
|
|
73
|
+
"selected": "awsui_selected_hyvsj_42qar_1220"
|
|
74
74
|
};
|
|
75
75
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-container.d.ts","sourceRoot":"lib/default/","sources":["area-chart/chart-container.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAiBrC,UAAU,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAC9D,SAAQ,IAAI,CACV,cAAc,CAAC,CAAC,CAAC,EACf,QAAQ,GACR,QAAQ,GACR,mBAAmB,GACnB,qBAAqB,GACrB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,CAChB;IACD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;;AAED,wBAA6D;AAE7D,iBAAS,cAAc,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC1D,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EAAE,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GACzB,GACP,EAAE,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"chart-container.d.ts","sourceRoot":"lib/default/","sources":["area-chart/chart-container.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAiBrC,UAAU,mBAAmB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAC9D,SAAQ,IAAI,CACV,cAAc,CAAC,CAAC,CAAC,EACf,QAAQ,GACR,QAAQ,GACR,mBAAmB,GACnB,qBAAqB,GACrB,WAAW,GACX,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,CAChB;IACD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACrB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;;AAED,wBAA6D;AAE7D,iBAAS,cAAc,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC1D,KAAK,EACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EAAE,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GACzB,GACP,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6GxB"}
|
|
@@ -12,10 +12,10 @@ import AreaDataSeries from './elements/data-series';
|
|
|
12
12
|
import AreaChartPopover from './elements/chart-popover';
|
|
13
13
|
import AreaHighlightedPoint from './elements/highlighted-point';
|
|
14
14
|
import AreaVerticalMarker from './elements/vertical-marker';
|
|
15
|
-
import styles from './styles.css.js';
|
|
16
15
|
import useHighlightDetails from './elements/use-highlight-details';
|
|
17
16
|
import useContainerWidth from '../internal/utils/use-container-width';
|
|
18
17
|
import { useSelector } from './async-store';
|
|
18
|
+
import { CartesianChartContainer } from '../internal/components/cartesian-chart/chart-container';
|
|
19
19
|
const DEFAULT_CHART_WIDTH = 500;
|
|
20
20
|
const LEFT_LABELS_MARGIN = 16;
|
|
21
21
|
const BOTTOM_LABELS_OFFSET = 12;
|
|
@@ -41,19 +41,12 @@ function ChartContainer({ model, autoWidth, xTitle, yTitle, detailPopoverSize, d
|
|
|
41
41
|
const isPointHighlighted = model.interactions.get().highlightedPoint !== null;
|
|
42
42
|
const highlightedX = useSelector(model.interactions, state => state.highlightedX);
|
|
43
43
|
const detailPopoverFooterContent = useMemo(() => (detailPopoverFooter && highlightedX ? detailPopoverFooter(highlightedX[0].x) : null), [detailPopoverFooter, highlightedX]);
|
|
44
|
-
return (React.createElement("
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
React.createElement(
|
|
48
|
-
React.createElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
React.createElement(AreaDataSeries, { model: model }),
|
|
52
|
-
React.createElement(BottomLabels, { width: model.width, height: model.height, scale: model.computed.xScale, ticks: model.computed.xTicks, tickFormatter: xTickFormatter, title: xTitle, ariaRoleDescription: xAxisAriaRoleDescription, autoHeight: setBottomLabelsHeight, offsetLeft: leftLabelsWidth + BOTTOM_LABELS_OFFSET, offsetRight: BOTTOM_LABELS_OFFSET }),
|
|
53
|
-
React.createElement(EmphasizedBaseline, { width: model.width, height: model.height, scale: model.computed.yScale }),
|
|
54
|
-
React.createElement(AreaVerticalMarker, { model: model }),
|
|
55
|
-
React.createElement(AreaHighlightedPoint, { ref: highlightedPointRef, model: model, ariaLabel: highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.activeLabel })),
|
|
56
|
-
React.createElement(AxisLabel, { axis: "x", position: "bottom", title: xTitle })),
|
|
57
|
-
React.createElement(AreaChartPopover, { model: model, highlightDetails: highlightDetails, dismissAriaLabel: detailPopoverDismissAriaLabel, size: detailPopoverSize, footer: detailPopoverFooterContent }))));
|
|
44
|
+
return (React.createElement(CartesianChartContainer, { ref: mergedRef, leftAxisLabel: React.createElement(AxisLabel, { axis: "y", position: "left", title: yTitle }), leftAxisLabelMeasure: React.createElement(LabelsMeasure, { scale: model.computed.yScale, ticks: model.computed.yTicks, tickFormatter: yTickFormatter, autoWidth: setLeftLabelsWidth }), bottomAxisLabel: React.createElement(AxisLabel, { axis: "x", position: "bottom", title: xTitle }), chartPlot: React.createElement(ChartPlot, { ref: model.refs.plot, width: model.width, height: model.height, offsetBottom: bottomLabelsHeight, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, ariaRoleDescription: chartAriaRoleDescription, activeElementKey: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned) && (highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.activeLabel), activeElementRef: isPointHighlighted ? highlightedPointRef : model.refs.verticalMarker, activeElementFocusOffset: isPointHighlighted ? 3 : { x: 8, y: 0 }, isClickable: !(highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.isPopoverPinned), onMouseMove: model.handlers.onSVGMouseMove, onMouseOut: model.handlers.onSVGMouseOut, onMouseDown: model.handlers.onSVGMouseDown, onKeyDown: model.handlers.onSVGKeyDown, onFocus: model.handlers.onSVGFocus, onBlur: model.handlers.onSVGBlur },
|
|
45
|
+
React.createElement(LeftLabels, { width: model.width, height: model.height, scale: model.computed.yScale, ticks: model.computed.yTicks, tickFormatter: yTickFormatter, title: yTitle, ariaRoleDescription: yAxisAriaRoleDescription }),
|
|
46
|
+
React.createElement(AreaDataSeries, { model: model }),
|
|
47
|
+
React.createElement(BottomLabels, { width: model.width, height: model.height, scale: model.computed.xScale, ticks: model.computed.xTicks, tickFormatter: xTickFormatter, title: xTitle, ariaRoleDescription: xAxisAriaRoleDescription, autoHeight: setBottomLabelsHeight, offsetLeft: leftLabelsWidth + BOTTOM_LABELS_OFFSET, offsetRight: BOTTOM_LABELS_OFFSET }),
|
|
48
|
+
React.createElement(EmphasizedBaseline, { width: model.width, height: model.height, scale: model.computed.yScale }),
|
|
49
|
+
React.createElement(AreaVerticalMarker, { model: model }),
|
|
50
|
+
React.createElement(AreaHighlightedPoint, { ref: highlightedPointRef, model: model, ariaLabel: highlightDetails === null || highlightDetails === void 0 ? void 0 : highlightDetails.activeLabel })), popover: React.createElement(AreaChartPopover, { model: model, highlightDetails: highlightDetails, dismissAriaLabel: detailPopoverDismissAriaLabel, size: detailPopoverSize, footer: detailPopoverFooterContent }) }));
|
|
58
51
|
}
|
|
59
52
|
//# sourceMappingURL=chart-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-container.js","sourceRoot":"lib/default/","sources":["area-chart/chart-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAC1E,OAAO,aAAa,MAAM,uDAAuD,CAAC;AAClF,OAAO,UAAU,MAAM,oDAAoD,CAAC;AAC5E,OAAO,YAAY,MAAM,sDAAsD,CAAC;AAChF,OAAO,kBAAkB,MAAM,4DAA4D,CAAC;AAG5F,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,mBAAmB,MAAM,kCAAkC,CAAC;AACnE,OAAO,iBAAiB,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,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UAAU,EAAE,qBAAqB,EACjC,UAAU,EAAE,eAAe,GAAG,oBAAoB,EAClD,WAAW,EAAE,oBAAoB,GACjC;oBAEF,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAI;oBAE9F,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,GAAI;oBAEpC,oBAAC,oBAAoB,IAAC,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,WAAW,GAAI,CAChG;gBAEZ,oBAAC,SAAS,IAAC,IAAI,EAAC,GAAG,EAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,GAAI,CACnD;YAEN,oBAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,6BAA6B,EAC/C,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,0BAA0B,GAClC,CACE,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, memo, useRef, useMemo } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport ChartPlot from '../internal/components/chart-plot';\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport LeftLabels from '../internal/components/cartesian-chart/left-labels';\nimport BottomLabels from '../internal/components/cartesian-chart/bottom-labels';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport { AreaChartProps } from './interfaces';\nimport { ChartModel } from './model';\nimport AreaDataSeries from './elements/data-series';\nimport AreaChartPopover from './elements/chart-popover';\nimport AreaHighlightedPoint from './elements/highlighted-point';\nimport AreaVerticalMarker from './elements/vertical-marker';\n\nimport styles from './styles.css.js';\nimport useHighlightDetails from './elements/use-highlight-details';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { useSelector } from './async-store';\n\nconst DEFAULT_CHART_WIDTH = 500;\nconst LEFT_LABELS_MARGIN = 16;\nconst BOTTOM_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: AreaChartProps.DataTypes) => string);\n\ninterface ChartContainerProps<T extends AreaChartProps.DataTypes>\n extends Pick<\n AreaChartProps<T>,\n | 'xTitle'\n | 'yTitle'\n | 'detailPopoverSize'\n | 'detailPopoverFooter'\n | 'ariaLabel'\n | 'ariaLabelledby'\n | 'ariaDescription'\n | 'i18nStrings'\n > {\n model: ChartModel<T>;\n autoWidth: (value: number) => void;\n}\n\nexport default memo(ChartContainer) as typeof ChartContainer;\n\nfunction ChartContainer<T extends AreaChartProps.DataTypes>({\n model,\n autoWidth,\n xTitle,\n yTitle,\n detailPopoverSize,\n detailPopoverFooter,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings: {\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n chartAriaRoleDescription,\n xAxisAriaRoleDescription,\n yAxisAriaRoleDescription,\n detailPopoverDismissAriaLabel,\n } = {},\n}: ChartContainerProps<T>) {\n const [leftLabelsWidth, setLeftLabelsWidth] = useState(0);\n const [bottomLabelsHeight, setBottomLabelsHeight] = useState(0);\n const [containerWidth, containerWidthRef] = useContainerWidth(DEFAULT_CHART_WIDTH);\n\n // Calculate the width of the plot area and tell it to the parent.\n const plotWidth = Math.max(0, containerWidth - leftLabelsWidth - LEFT_LABELS_MARGIN);\n useEffect(() => {\n autoWidth(plotWidth);\n }, [autoWidth, plotWidth]);\n\n const highlightDetails = useHighlightDetails({\n model,\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n });\n\n const highlightedPointRef = useRef<SVGGElement>(null);\n\n const mergedRef = useMergeRefs(containerWidthRef, model.refs.container);\n\n const isPointHighlighted = model.interactions.get().highlightedPoint !== null;\n\n const highlightedX = useSelector(model.interactions, state => state.highlightedX);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedX ? detailPopoverFooter(highlightedX[0].x) : null),\n [detailPopoverFooter, highlightedX]\n );\n\n return (\n <div className={styles['chart-container']} ref={mergedRef}>\n <AxisLabel axis=\"y\" position=\"left\" title={yTitle} />\n\n <div className={styles['chart-container__horizontal']}>\n <LabelsMeasure\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter as TickFormatter}\n autoWidth={setLeftLabelsWidth}\n />\n\n <div className={styles['chart-container__vertical']}>\n <ChartPlot\n ref={model.refs.plot}\n width={model.width}\n height={model.height}\n offsetBottom={bottomLabelsHeight}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={chartAriaRoleDescription}\n activeElementKey={!highlightDetails?.isPopoverPinned && highlightDetails?.activeLabel}\n activeElementRef={isPointHighlighted ? highlightedPointRef : model.refs.verticalMarker}\n activeElementFocusOffset={isPointHighlighted ? 3 : { x: 8, y: 0 }}\n isClickable={!highlightDetails?.isPopoverPinned}\n onMouseMove={model.handlers.onSVGMouseMove}\n onMouseOut={model.handlers.onSVGMouseOut}\n onMouseDown={model.handlers.onSVGMouseDown}\n onKeyDown={model.handlers.onSVGKeyDown}\n onFocus={model.handlers.onSVGFocus}\n onBlur={model.handlers.onSVGBlur}\n >\n <LeftLabels\n width={model.width}\n height={model.height}\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter}\n title={yTitle}\n ariaRoleDescription={yAxisAriaRoleDescription}\n />\n\n <AreaDataSeries model={model} />\n\n <BottomLabels\n width={model.width}\n height={model.height}\n scale={model.computed.xScale}\n ticks={model.computed.xTicks}\n tickFormatter={xTickFormatter as TickFormatter}\n title={xTitle}\n ariaRoleDescription={xAxisAriaRoleDescription}\n autoHeight={setBottomLabelsHeight}\n offsetLeft={leftLabelsWidth + BOTTOM_LABELS_OFFSET}\n offsetRight={BOTTOM_LABELS_OFFSET}\n />\n\n <EmphasizedBaseline width={model.width} height={model.height} scale={model.computed.yScale} />\n\n <AreaVerticalMarker model={model} />\n\n <AreaHighlightedPoint ref={highlightedPointRef} model={model} ariaLabel={highlightDetails?.activeLabel} />\n </ChartPlot>\n\n <AxisLabel axis=\"x\" position=\"bottom\" title={xTitle} />\n </div>\n\n <AreaChartPopover\n model={model}\n highlightDetails={highlightDetails}\n dismissAriaLabel={detailPopoverDismissAriaLabel}\n size={detailPopoverSize}\n footer={detailPopoverFooterContent}\n />\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chart-container.js","sourceRoot":"lib/default/","sources":["area-chart/chart-container.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,OAAO,SAAS,MAAM,mDAAmD,CAAC;AAC1E,OAAO,aAAa,MAAM,uDAAuD,CAAC;AAClF,OAAO,UAAU,MAAM,oDAAoD,CAAC;AAC5E,OAAO,YAAY,MAAM,sDAAsD,CAAC;AAChF,OAAO,kBAAkB,MAAM,4DAA4D,CAAC;AAG5F,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AACxD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAE5D,OAAO,mBAAmB,MAAM,kCAAkC,CAAC;AACnE,OAAO,i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AC,KAAK,EAClB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAC5B,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAC5B,aAAa,EAAE,cAA+B,EAC9C,KAAK,EAAE,MAAM,EACb,mBAAmB,EAAE,wBAAwB,EAC7C,UAAU,EAAE,qBAAqB,EACjC,UAAU,EAAE,eAAe,GAAG,oBAAoB,EAClD,WAAW,EAAE,oBAAoB,GACjC;YAEF,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAI;YAE9F,oBAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,GAAI;YAEpC,oBAAC,oBAAoB,IAAC,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,WAAW,GAAI,CAChG,EAEd,OAAO,EACL,oBAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,6BAA6B,EAC/C,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,0BAA0B,GAClC,GAEJ,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState, useEffect, memo, useRef, useMemo } from 'react';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\n\nimport ChartPlot from '../internal/components/chart-plot';\nimport AxisLabel from '../internal/components/cartesian-chart/axis-label';\nimport LabelsMeasure from '../internal/components/cartesian-chart/labels-measure';\nimport LeftLabels from '../internal/components/cartesian-chart/left-labels';\nimport BottomLabels from '../internal/components/cartesian-chart/bottom-labels';\nimport EmphasizedBaseline from '../internal/components/cartesian-chart/emphasized-baseline';\nimport { AreaChartProps } from './interfaces';\nimport { ChartModel } from './model';\nimport AreaDataSeries from './elements/data-series';\nimport AreaChartPopover from './elements/chart-popover';\nimport AreaHighlightedPoint from './elements/highlighted-point';\nimport AreaVerticalMarker from './elements/vertical-marker';\n\nimport useHighlightDetails from './elements/use-highlight-details';\nimport useContainerWidth from '../internal/utils/use-container-width';\nimport { useSelector } from './async-store';\nimport { CartesianChartContainer } from '../internal/components/cartesian-chart/chart-container';\n\nconst DEFAULT_CHART_WIDTH = 500;\nconst LEFT_LABELS_MARGIN = 16;\nconst BOTTOM_LABELS_OFFSET = 12;\n\ntype TickFormatter = undefined | ((value: AreaChartProps.DataTypes) => string);\n\ninterface ChartContainerProps<T extends AreaChartProps.DataTypes>\n extends Pick<\n AreaChartProps<T>,\n | 'xTitle'\n | 'yTitle'\n | 'detailPopoverSize'\n | 'detailPopoverFooter'\n | 'ariaLabel'\n | 'ariaLabelledby'\n | 'ariaDescription'\n | 'i18nStrings'\n > {\n model: ChartModel<T>;\n autoWidth: (value: number) => void;\n}\n\nexport default memo(ChartContainer) as typeof ChartContainer;\n\nfunction ChartContainer<T extends AreaChartProps.DataTypes>({\n model,\n autoWidth,\n xTitle,\n yTitle,\n detailPopoverSize,\n detailPopoverFooter,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n i18nStrings: {\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n chartAriaRoleDescription,\n xAxisAriaRoleDescription,\n yAxisAriaRoleDescription,\n detailPopoverDismissAriaLabel,\n } = {},\n}: ChartContainerProps<T>) {\n const [leftLabelsWidth, setLeftLabelsWidth] = useState(0);\n const [bottomLabelsHeight, setBottomLabelsHeight] = useState(0);\n const [containerWidth, containerWidthRef] = useContainerWidth(DEFAULT_CHART_WIDTH);\n\n // Calculate the width of the plot area and tell it to the parent.\n const plotWidth = Math.max(0, containerWidth - leftLabelsWidth - LEFT_LABELS_MARGIN);\n useEffect(() => {\n autoWidth(plotWidth);\n }, [autoWidth, plotWidth]);\n\n const highlightDetails = useHighlightDetails({\n model,\n xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\n detailTotalLabel,\n });\n\n const highlightedPointRef = useRef<SVGGElement>(null);\n\n const mergedRef = useMergeRefs(containerWidthRef, model.refs.container);\n\n const isPointHighlighted = model.interactions.get().highlightedPoint !== null;\n\n const highlightedX = useSelector(model.interactions, state => state.highlightedX);\n\n const detailPopoverFooterContent = useMemo(\n () => (detailPopoverFooter && highlightedX ? detailPopoverFooter(highlightedX[0].x) : null),\n [detailPopoverFooter, highlightedX]\n );\n\n return (\n <CartesianChartContainer\n ref={mergedRef}\n leftAxisLabel={<AxisLabel axis=\"y\" position=\"left\" title={yTitle} />}\n leftAxisLabelMeasure={\n <LabelsMeasure\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter as TickFormatter}\n autoWidth={setLeftLabelsWidth}\n />\n }\n bottomAxisLabel={<AxisLabel axis=\"x\" position=\"bottom\" title={xTitle} />}\n chartPlot={\n <ChartPlot\n ref={model.refs.plot}\n width={model.width}\n height={model.height}\n offsetBottom={bottomLabelsHeight}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n ariaRoleDescription={chartAriaRoleDescription}\n activeElementKey={!highlightDetails?.isPopoverPinned && highlightDetails?.activeLabel}\n activeElementRef={isPointHighlighted ? highlightedPointRef : model.refs.verticalMarker}\n activeElementFocusOffset={isPointHighlighted ? 3 : { x: 8, y: 0 }}\n isClickable={!highlightDetails?.isPopoverPinned}\n onMouseMove={model.handlers.onSVGMouseMove}\n onMouseOut={model.handlers.onSVGMouseOut}\n onMouseDown={model.handlers.onSVGMouseDown}\n onKeyDown={model.handlers.onSVGKeyDown}\n onFocus={model.handlers.onSVGFocus}\n onBlur={model.handlers.onSVGBlur}\n >\n <LeftLabels\n width={model.width}\n height={model.height}\n scale={model.computed.yScale}\n ticks={model.computed.yTicks}\n tickFormatter={yTickFormatter}\n title={yTitle}\n ariaRoleDescription={yAxisAriaRoleDescription}\n />\n\n <AreaDataSeries model={model} />\n\n <BottomLabels\n width={model.width}\n height={model.height}\n scale={model.computed.xScale}\n ticks={model.computed.xTicks}\n tickFormatter={xTickFormatter as TickFormatter}\n title={xTitle}\n ariaRoleDescription={xAxisAriaRoleDescription}\n autoHeight={setBottomLabelsHeight}\n offsetLeft={leftLabelsWidth + BOTTOM_LABELS_OFFSET}\n offsetRight={BOTTOM_LABELS_OFFSET}\n />\n\n <EmphasizedBaseline width={model.width} height={model.height} scale={model.computed.yScale} />\n\n <AreaVerticalMarker model={model} />\n\n <AreaHighlightedPoint ref={highlightedPointRef} model={model} ariaLabel={highlightDetails?.activeLabel} />\n </ChartPlot>\n }\n popover={\n <AreaChartPopover\n model={model}\n highlightDetails={highlightDetails}\n dismissAriaLabel={detailPopoverDismissAriaLabel}\n size={detailPopoverSize}\n footer={detailPopoverFooterContent}\n />\n }\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["area-chart/internal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["area-chart/internal.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAOlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,KAAK,sBAAsB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,IAAI,YAAY,CAC5E,cAAc,CAAC,CAAC,CAAC,EACjB,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,mBAAmB,GAAG,aAAa,CAC5F,GACC,0BAA0B,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC5E,MAAM,EACN,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EAAE,2BAA2B,EAC9C,aAAa,EAAE,uBAAuB,EACtC,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,yBAAyB,EACzC,iBAAiB,EAAE,2BAA2B,EAC9C,WAAW,EACX,SAAS,EACT,cAAc,EACd,eAAe,EACf,MAAM,EACN,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,EACL,OAAO,EACP,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,iBAAwB,EACxB,GAAG,KAAK,EACT,EAAE,sBAAsB,CAAC,CAAC,CAAC,eAkI3B"}
|
package/area-chart/internal.js
CHANGED
|
@@ -5,13 +5,10 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { isDevelopment } from '../internal/is-development';
|
|
7
7
|
import { getBaseProps } from '../internal/base-component';
|
|
8
|
-
import InternalBox from '../box/internal';
|
|
9
8
|
import ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';
|
|
10
9
|
import AreaChartFilter from './elements/area-chart-filter';
|
|
11
10
|
import AreaChartLegend from './elements/area-chart-legend';
|
|
12
|
-
import InternalSpaceBetween from '../space-between/internal';
|
|
13
11
|
import ChartContainer from './chart-container';
|
|
14
|
-
import cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';
|
|
15
12
|
import styles from './styles.css.js';
|
|
16
13
|
import useChartModel from './model/use-chart-model';
|
|
17
14
|
import useFilterProps from './model/use-filter-props';
|
|
@@ -20,6 +17,7 @@ import { isSeriesValid } from './model/utils';
|
|
|
20
17
|
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
21
18
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
22
19
|
import { nodeBelongs } from '../internal/utils/node-belongs';
|
|
20
|
+
import { ChartWrapper } from '../internal/components/chart-wrapper';
|
|
23
21
|
export default function InternalAreaChart(_a) {
|
|
24
22
|
var { height, xScaleType, yScaleType, xDomain, yDomain, highlightedSeries: controlledHighlightedSeries, visibleSeries: controlledVisibleSeries, series: externalSeries, onFilterChange: controlledOnVisibleChange, onHighlightChange: controlledOnHighlightChange, i18nStrings, ariaLabel, ariaLabelledby, ariaDescription, xTitle, yTitle, hideFilter, additionalFilters, hideLegend, legendTitle, statusType, detailPopoverSize, detailPopoverFooter, empty, noMatch, errorText, loadingText, recoveryText, onRecoveryClick, __internalRootRef = null } = _a, props = __rest(_a, ["height", "xScaleType", "yScaleType", "xDomain", "yDomain", "highlightedSeries", "visibleSeries", "series", "onFilterChange", "onHighlightChange", "i18nStrings", "ariaLabel", "ariaLabelledby", "ariaDescription", "xTitle", "yTitle", "hideFilter", "additionalFilters", "hideLegend", "legendTitle", "statusType", "detailPopoverSize", "detailPopoverFooter", "empty", "noMatch", "errorText", "loadingText", "recoveryText", "onRecoveryClick", "__internalRootRef"]);
|
|
25
23
|
const baseProps = getBaseProps(props);
|
|
@@ -71,18 +69,6 @@ export default function InternalAreaChart(_a) {
|
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
71
|
const mergedRef = useMergeRefs(containerRef, __internalRootRef);
|
|
74
|
-
return (React.createElement(
|
|
75
|
-
showFilters && (React.createElement(InternalBox, { className: cartesianStyles['filter-container'], margin: { bottom: 'l' } },
|
|
76
|
-
React.createElement(InternalSpaceBetween, { size: "l", direction: "horizontal", className: clsx({ [styles['has-default-filter']]: !hideFilter }) },
|
|
77
|
-
!hideFilter && (React.createElement(AreaChartFilter, { model: model, filterLabel: i18nStrings.filterLabel, filterPlaceholder: i18nStrings.filterPlaceholder, filterSelectedAriaLabel: i18nStrings.filterSelectedAriaLabel })),
|
|
78
|
-
additionalFilters))),
|
|
79
|
-
React.createElement("div", { className: clsx(styles.content, {
|
|
80
|
-
[styles['content--reserve-filter']]: reserveFilterSpace,
|
|
81
|
-
[styles['content--reserve-legend']]: reserveLegendSpace,
|
|
82
|
-
}), style: { minHeight: height } },
|
|
83
|
-
React.createElement(ChartStatusContainer, { isEmpty: isEmpty, isNoMatch: isNoMatch, showChart: showChart, statusType: statusType, empty: empty, noMatch: noMatch, loadingText: loadingText, errorText: errorText, recoveryText: recoveryText, onRecoveryClick: onRecoveryClick }),
|
|
84
|
-
showChart && (React.createElement(ChartContainer, { model: model, autoWidth: setWidth, detailPopoverSize: detailPopoverSize, detailPopoverFooter: detailPopoverFooter, xTitle: xTitle, yTitle: yTitle, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, i18nStrings: i18nStrings }))),
|
|
85
|
-
showLegend && (React.createElement(InternalBox, { margin: { top: 'm' } },
|
|
86
|
-
React.createElement(AreaChartLegend, { plotContainerRef: containerRef, model: model, legendTitle: legendTitle, ariaLabel: i18nStrings.legendAriaLabel })))));
|
|
72
|
+
return (React.createElement(ChartWrapper, Object.assign({ ref: mergedRef }, baseProps, { className: clsx(baseProps.className, styles.root), contentMinHeight: height, defaultFilter: showFilters && !hideFilter ? (React.createElement(AreaChartFilter, { model: model, filterLabel: i18nStrings.filterLabel, filterPlaceholder: i18nStrings.filterPlaceholder, filterSelectedAriaLabel: i18nStrings.filterSelectedAriaLabel })) : null, additionalFilters: showFilters ? additionalFilters : null, reserveFilterSpace: !!reserveFilterSpace, reserveLegendSpace: !!reserveLegendSpace, chartStatus: React.createElement(ChartStatusContainer, { isEmpty: isEmpty, isNoMatch: isNoMatch, showChart: showChart, statusType: statusType, empty: empty, noMatch: noMatch, loadingText: loadingText, errorText: errorText, recoveryText: recoveryText, onRecoveryClick: onRecoveryClick }), chart: showChart ? (React.createElement(ChartContainer, { model: model, autoWidth: setWidth, detailPopoverSize: detailPopoverSize, detailPopoverFooter: detailPopoverFooter, xTitle: xTitle, yTitle: yTitle, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, ariaDescription: ariaDescription, i18nStrings: i18nStrings })) : null, legend: showLegend ? (React.createElement(AreaChartLegend, { plotContainerRef: containerRef, model: model, legendTitle: legendTitle, ariaLabel: i18nStrings.legendAriaLabel })) : null, onBlur: onBlur })));
|
|
87
73
|
}
|
|
88
74
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["area-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,eAAe,MAAM,sDAAsD,CAAC;AACnF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,M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,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC;YACD,SAAS,IAAI,CACZ,oBAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,GACxB,CACH,CACG;QAEL,UAAU,IAAI,CACb,oBAAC,WAAW,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;YAC/B,oBAAC,eAAe,IACd,gBAAgB,EAAE,YAAY,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,CAAC,eAAe,GACtC,CACU,CACf,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isDevelopment } from '../internal/is-development';\nimport { getBaseProps } from '../internal/base-component';\nimport InternalBox from '../box/internal';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\n\nimport AreaChartFilter from './elements/area-chart-filter';\nimport AreaChartLegend from './elements/area-chart-legend';\nimport { AreaChartProps } from './interfaces';\nimport InternalSpaceBetween from '../space-between/internal';\nimport ChartContainer from './chart-container';\nimport cartesianStyles from '../internal/components/cartesian-chart/styles.css.js';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useChartModel from './model/use-chart-model';\nimport useFilterProps from './model/use-filter-props';\nimport useHighlightProps from './model/use-highlight-props';\nimport { isSeriesValid } from './model/utils';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\n\ntype InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<\n AreaChartProps<T>,\n 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalAreaChart<T extends AreaChartProps.DataTypes>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange: controlledOnVisibleChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n detailPopoverFooter,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalAreaChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isSeriesValid(externalSeries)) {\n warnOnce(\n 'AreaChart',\n \"The `series` property violates the component's constraints: all `area` \" +\n 'series must have `data` arrays of the same length and with the same x-values.'\n );\n }\n }, [externalSeries]);\n }\n\n const [width, setWidth] = useState(0);\n const [visibleSeries, setVisibleSeries] = useFilterProps(\n externalSeries,\n controlledVisibleSeries,\n controlledOnVisibleChange\n );\n const [highlightedSeries, setHighlightedSeries] = useHighlightProps(\n externalSeries,\n controlledHighlightedSeries,\n controlledOnHighlightChange\n );\n const model = useChartModel({\n externalSeries,\n visibleSeries,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n popoverRef,\n });\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries,\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch) && (additionalFilters || !hideFilter);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n\n useEffect(() => {\n const onKeyDown = model.handlers.onDocumentKeyDown;\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [model.handlers.onDocumentKeyDown]);\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeBelongs(containerRef.current, event.relatedTarget)) {\n model.handlers.onContainerBlur();\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef} onBlur={onBlur}>\n {showFilters && (\n <InternalBox className={cartesianStyles['filter-container']} margin={{ bottom: 'l' }}>\n <InternalSpaceBetween\n size=\"l\"\n direction=\"horizontal\"\n className={clsx({ [styles['has-default-filter']]: !hideFilter })}\n >\n {!hideFilter && (\n <AreaChartFilter\n model={model}\n filterLabel={i18nStrings.filterLabel}\n filterPlaceholder={i18nStrings.filterPlaceholder}\n filterSelectedAriaLabel={i18nStrings.filterSelectedAriaLabel}\n />\n )}\n {additionalFilters}\n </InternalSpaceBetween>\n </InternalBox>\n )}\n\n <div\n className={clsx(styles.content, {\n [styles['content--reserve-filter']]: reserveFilterSpace,\n [styles['content--reserve-legend']]: reserveLegendSpace,\n })}\n style={{ minHeight: height }}\n >\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n {showChart && (\n <ChartContainer\n model={model}\n autoWidth={setWidth}\n detailPopoverSize={detailPopoverSize}\n detailPopoverFooter={detailPopoverFooter}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n />\n )}\n </div>\n\n {showLegend && (\n <InternalBox margin={{ top: 'm' }}>\n <AreaChartLegend\n plotContainerRef={containerRef}\n model={model}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings.legendAriaLabel}\n />\n </InternalBox>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["area-chart/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,oBAAoB,EAAE,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAErG,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,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AK,EAAE,KAAK,EACZ,SAAS,EAAE,QAAQ,EACnB,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,MAAM,EACJ,UAAU,CAAC,CAAC,CAAC,CACX,oBAAC,eAAe,IACd,gBAAgB,EAAE,YAAY,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,WAAW,CAAC,eAAe,GACtC,CACH,CAAC,CAAC,CAAC,IAAI,EAEV,MAAM,EAAE,MAAM,IACd,CACH,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { isDevelopment } from '../internal/is-development';\nimport { getBaseProps } from '../internal/base-component';\nimport ChartStatusContainer, { getChartStatus } from '../internal/components/chart-status-container';\n\nimport AreaChartFilter from './elements/area-chart-filter';\nimport AreaChartLegend from './elements/area-chart-legend';\nimport { AreaChartProps } from './interfaces';\nimport ChartContainer from './chart-container';\nimport styles from './styles.css.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport useChartModel from './model/use-chart-model';\nimport useFilterProps from './model/use-filter-props';\nimport useHighlightProps from './model/use-highlight-props';\nimport { isSeriesValid } from './model/utils';\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { nodeBelongs } from '../internal/utils/node-belongs';\nimport { ChartWrapper } from '../internal/components/chart-wrapper';\n\ntype InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<\n AreaChartProps<T>,\n 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'\n> &\n InternalBaseComponentProps;\n\nexport default function InternalAreaChart<T extends AreaChartProps.DataTypes>({\n height,\n xScaleType,\n yScaleType,\n xDomain,\n yDomain,\n highlightedSeries: controlledHighlightedSeries,\n visibleSeries: controlledVisibleSeries,\n series: externalSeries,\n onFilterChange: controlledOnVisibleChange,\n onHighlightChange: controlledOnHighlightChange,\n i18nStrings,\n ariaLabel,\n ariaLabelledby,\n ariaDescription,\n xTitle,\n yTitle,\n hideFilter,\n additionalFilters,\n hideLegend,\n legendTitle,\n statusType,\n detailPopoverSize,\n detailPopoverFooter,\n empty,\n noMatch,\n errorText,\n loadingText,\n recoveryText,\n onRecoveryClick,\n __internalRootRef = null,\n ...props\n}: InternalAreaChartProps<T>) {\n const baseProps = getBaseProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n const popoverRef = useRef<HTMLDivElement>(null);\n\n if (isDevelopment) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (!isSeriesValid(externalSeries)) {\n warnOnce(\n 'AreaChart',\n \"The `series` property violates the component's constraints: all `area` \" +\n 'series must have `data` arrays of the same length and with the same x-values.'\n );\n }\n }, [externalSeries]);\n }\n\n const [width, setWidth] = useState(0);\n const [visibleSeries, setVisibleSeries] = useFilterProps(\n externalSeries,\n controlledVisibleSeries,\n controlledOnVisibleChange\n );\n const [highlightedSeries, setHighlightedSeries] = useHighlightProps(\n externalSeries,\n controlledHighlightedSeries,\n controlledOnHighlightChange\n );\n const model = useChartModel({\n externalSeries,\n visibleSeries,\n setVisibleSeries,\n highlightedSeries,\n setHighlightedSeries,\n xDomain,\n yDomain,\n xScaleType,\n yScaleType,\n height,\n width,\n popoverRef,\n });\n\n const { isEmpty, isNoMatch, showChart } = getChartStatus({\n externalData: externalSeries,\n visibleData: visibleSeries,\n statusType,\n });\n const showFilters = statusType === 'finished' && (!isEmpty || isNoMatch) && (additionalFilters || !hideFilter);\n const showLegend = !hideLegend && !isEmpty && statusType === 'finished';\n const reserveLegendSpace = !showChart && !hideLegend;\n const reserveFilterSpace = !showChart && !isNoMatch && (!hideFilter || additionalFilters);\n\n useEffect(() => {\n const onKeyDown = model.handlers.onDocumentKeyDown;\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [model.handlers.onDocumentKeyDown]);\n\n const onBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget && !nodeBelongs(containerRef.current, event.relatedTarget)) {\n model.handlers.onContainerBlur();\n }\n };\n\n const mergedRef = useMergeRefs(containerRef, __internalRootRef);\n\n return (\n <ChartWrapper\n ref={mergedRef}\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n contentMinHeight={height}\n defaultFilter={\n showFilters && !hideFilter ? (\n <AreaChartFilter\n model={model}\n filterLabel={i18nStrings.filterLabel}\n filterPlaceholder={i18nStrings.filterPlaceholder}\n filterSelectedAriaLabel={i18nStrings.filterSelectedAriaLabel}\n />\n ) : null\n }\n additionalFilters={showFilters ? additionalFilters : null}\n reserveFilterSpace={!!reserveFilterSpace}\n reserveLegendSpace={!!reserveLegendSpace}\n chartStatus={\n <ChartStatusContainer\n isEmpty={isEmpty}\n isNoMatch={isNoMatch}\n showChart={showChart}\n statusType={statusType}\n empty={empty}\n noMatch={noMatch}\n loadingText={loadingText}\n errorText={errorText}\n recoveryText={recoveryText}\n onRecoveryClick={onRecoveryClick}\n />\n }\n chart={\n showChart ? (\n <ChartContainer\n model={model}\n autoWidth={setWidth}\n detailPopoverSize={detailPopoverSize}\n detailPopoverFooter={detailPopoverFooter}\n xTitle={xTitle}\n yTitle={yTitle}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescription={ariaDescription}\n i18nStrings={i18nStrings}\n />\n ) : null\n }\n legend={\n showLegend ? (\n <AreaChartLegend\n plotContainerRef={containerRef}\n model={model}\n legendTitle={legendTitle}\n ariaLabel={i18nStrings.legendAriaLabel}\n />\n ) : null\n }\n onBlur={onBlur}\n />\n );\n}\n"]}
|
package/area-chart/styles.css.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"series": "
|
|
5
|
-
"root": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"content": "awsui_content_y1yrh_191sa_146",
|
|
11
|
-
"content--reserve-filter": "awsui_content--reserve-filter_y1yrh_191sa_153",
|
|
12
|
-
"content--reserve-legend": "awsui_content--reserve-legend_y1yrh_191sa_157",
|
|
13
|
-
"series--highlighted": "awsui_series--highlighted_y1yrh_191sa_169",
|
|
14
|
-
"series--dimmed": "awsui_series--dimmed_y1yrh_191sa_173",
|
|
15
|
-
"series--threshold": "awsui_series--threshold_y1yrh_191sa_177",
|
|
16
|
-
"popover-divider": "awsui_popover-divider_y1yrh_191sa_182"
|
|
4
|
+
"series": "awsui_series_y1yrh_1hj0b_93",
|
|
5
|
+
"root": "awsui_root_y1yrh_1hj0b_111",
|
|
6
|
+
"series--highlighted": "awsui_series--highlighted_y1yrh_1hj0b_123",
|
|
7
|
+
"series--dimmed": "awsui_series--dimmed_y1yrh_1hj0b_127",
|
|
8
|
+
"series--threshold": "awsui_series--threshold_y1yrh_1hj0b_131",
|
|
9
|
+
"popover-divider": "awsui_popover-divider_y1yrh_1hj0b_136"
|
|
17
10
|
};
|
|
18
11
|
|
|
@@ -90,16 +90,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
90
90
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
91
91
|
SPDX-License-Identifier: Apache-2.0
|
|
92
92
|
*/
|
|
93
|
-
.
|
|
93
|
+
.awsui_series_y1yrh_1hj0b_93 > rect:not(#\9) {
|
|
94
94
|
transition: opacity var(--motion-duration-transition-quick-0viajb, 90ms) var(--motion-easing-transition-quick-191occ, linear);
|
|
95
95
|
}
|
|
96
96
|
@media (prefers-reduced-motion: reduce) {
|
|
97
|
-
.
|
|
97
|
+
.awsui_series_y1yrh_1hj0b_93 > rect:not(#\9) {
|
|
98
98
|
animation: none;
|
|
99
99
|
transition: none;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
.awsui-motion-disabled .
|
|
102
|
+
.awsui-motion-disabled .awsui_series_y1yrh_1hj0b_93 > rect:not(#\9), .awsui-mode-entering .awsui_series_y1yrh_1hj0b_93 > rect:not(#\9) {
|
|
103
103
|
animation: none;
|
|
104
104
|
transition: none;
|
|
105
105
|
}
|
|
@@ -108,83 +108,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
108
108
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
109
109
|
SPDX-License-Identifier: Apache-2.0
|
|
110
110
|
*/
|
|
111
|
-
.
|
|
112
|
-
/*
|
|
113
|
-
border-collapse: separate;
|
|
114
|
-
border-spacing: 0;
|
|
115
|
-
caption-side: top;
|
|
116
|
-
cursor: auto;
|
|
117
|
-
direction: ltr;
|
|
118
|
-
empty-cells: show;
|
|
119
|
-
font-family: serif;
|
|
120
|
-
font-size: medium;
|
|
121
|
-
font-style: normal;
|
|
122
|
-
font-variant: normal;
|
|
123
|
-
font-weight: normal;
|
|
124
|
-
font-stretch: normal;
|
|
125
|
-
line-height: normal;
|
|
126
|
-
-webkit-hyphens: none;
|
|
127
|
-
hyphens: none;
|
|
128
|
-
letter-spacing: normal;
|
|
129
|
-
list-style: disc outside none;
|
|
130
|
-
tab-size: 8;
|
|
131
|
-
text-align: left;
|
|
132
|
-
text-align-last: auto;
|
|
133
|
-
text-indent: 0;
|
|
134
|
-
text-shadow: none;
|
|
135
|
-
text-transform: none;
|
|
136
|
-
visibility: visible;
|
|
137
|
-
white-space: normal;
|
|
138
|
-
widows: 2;
|
|
139
|
-
word-spacing: normal;
|
|
140
|
-
box-sizing: border-box;
|
|
141
|
-
font-size: var(--font-body-m-size-7dign1, 14px);
|
|
142
|
-
line-height: var(--font-body-m-line-height-rfgrp9, 22px);
|
|
143
|
-
color: var(--color-text-body-default-su7kuo, #000716);
|
|
144
|
-
font-weight: 400;
|
|
145
|
-
font-family: var(--font-family-base-wn913o, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
146
|
-
-webkit-font-smoothing: auto;
|
|
147
|
-
-moz-osx-font-smoothing: auto;
|
|
148
|
-
position: relative;
|
|
149
|
-
display: block;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.awsui_has-default-filter_y1yrh_191sa_126 > :not(#\9):first-child {
|
|
153
|
-
flex: 280px 0 1;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.awsui_chart-container_y1yrh_191sa_130:not(#\9) {
|
|
157
|
-
display: flex;
|
|
158
|
-
width: 100%;
|
|
159
|
-
flex-direction: column;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.awsui_chart-container__vertical_y1yrh_191sa_136:not(#\9) {
|
|
163
|
-
display: flex;
|
|
164
|
-
flex-direction: column;
|
|
165
|
-
width: 100%;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.awsui_chart-container__horizontal_y1yrh_191sa_142:not(#\9) {
|
|
169
|
-
display: flex;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.awsui_content_y1yrh_191sa_146:not(#\9) {
|
|
173
|
-
display: flex;
|
|
174
|
-
position: relative;
|
|
175
|
-
justify-content: center;
|
|
176
|
-
align-items: center;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.awsui_content--reserve-filter_y1yrh_191sa_153:not(#\9) {
|
|
180
|
-
margin-top: calc(2 * var(--font-body-m-line-height-rfgrp9, 22px));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.awsui_content--reserve-legend_y1yrh_191sa_157:not(#\9) {
|
|
184
|
-
margin-bottom: calc(2 * var(--font-body-m-line-height-rfgrp9, 22px));
|
|
111
|
+
.awsui_root_y1yrh_1hj0b_111:not(#\9) {
|
|
112
|
+
/* used in test-utils */
|
|
185
113
|
}
|
|
186
114
|
|
|
187
|
-
.
|
|
115
|
+
.awsui_series_y1yrh_1hj0b_93:not(#\9) {
|
|
188
116
|
display: block;
|
|
189
117
|
stroke-width: var(--border-line-chart-width-qfyiov, 2px);
|
|
190
118
|
fill: none;
|
|
@@ -192,20 +120,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
192
120
|
stroke-linejoin: var(--border-line-chart-line-join-toe9lv, round);
|
|
193
121
|
}
|
|
194
122
|
|
|
195
|
-
.awsui_series--
|
|
123
|
+
.awsui_series--highlighted_y1yrh_1hj0b_123:not(#\9) {
|
|
196
124
|
/* used in test-utils */
|
|
197
125
|
}
|
|
198
126
|
|
|
199
|
-
.awsui_series--
|
|
127
|
+
.awsui_series--dimmed_y1yrh_1hj0b_127:not(#\9) {
|
|
200
128
|
opacity: 0.3;
|
|
201
129
|
}
|
|
202
130
|
|
|
203
|
-
.awsui_series--
|
|
131
|
+
.awsui_series--threshold_y1yrh_1hj0b_131:not(#\9) {
|
|
204
132
|
stroke-dasharray: var(--border-line-chart-dash-array-ry3ko4, 3 5);
|
|
205
133
|
stroke-width: var(--border-line-chart-width-qfyiov, 2px);
|
|
206
134
|
}
|
|
207
135
|
|
|
208
|
-
.awsui_popover-
|
|
136
|
+
.awsui_popover-divider_y1yrh_1hj0b_136:not(#\9) {
|
|
209
137
|
margin: var(--space-xxs-ja5cp8, 4px) 0;
|
|
210
138
|
border-bottom: var(--border-divider-section-width-orq175, 2px) solid var(--color-border-divider-default-9o8zql, #e9ebed);
|
|
211
139
|
}
|
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"series": "
|
|
6
|
-
"root": "
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"content": "awsui_content_y1yrh_191sa_146",
|
|
12
|
-
"content--reserve-filter": "awsui_content--reserve-filter_y1yrh_191sa_153",
|
|
13
|
-
"content--reserve-legend": "awsui_content--reserve-legend_y1yrh_191sa_157",
|
|
14
|
-
"series--highlighted": "awsui_series--highlighted_y1yrh_191sa_169",
|
|
15
|
-
"series--dimmed": "awsui_series--dimmed_y1yrh_191sa_173",
|
|
16
|
-
"series--threshold": "awsui_series--threshold_y1yrh_191sa_177",
|
|
17
|
-
"popover-divider": "awsui_popover-divider_y1yrh_191sa_182"
|
|
5
|
+
"series": "awsui_series_y1yrh_1hj0b_93",
|
|
6
|
+
"root": "awsui_root_y1yrh_1hj0b_111",
|
|
7
|
+
"series--highlighted": "awsui_series--highlighted_y1yrh_1hj0b_123",
|
|
8
|
+
"series--dimmed": "awsui_series--dimmed_y1yrh_1hj0b_127",
|
|
9
|
+
"series--threshold": "awsui_series--threshold_y1yrh_1hj0b_131",
|
|
10
|
+
"popover-divider": "awsui_popover-divider_y1yrh_1hj0b_136"
|
|
18
11
|
};
|
|
19
12
|
|