@cloudscape-design/components 3.0.337 → 3.0.338
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/styles.css.js +17 -17
- package/app-layout/styles.scoped.css +21 -21
- package/app-layout/styles.selectors.js +17 -17
- package/app-layout/visual-refresh/styles.css.js +69 -69
- package/app-layout/visual-refresh/styles.scoped.css +173 -169
- package/app-layout/visual-refresh/styles.selectors.js +69 -69
- package/area-chart/chart-container.d.ts +2 -2
- package/area-chart/chart-container.d.ts.map +1 -1
- package/area-chart/chart-container.js +1 -1
- package/area-chart/chart-container.js.map +1 -1
- package/area-chart/interfaces.d.ts +5 -1
- package/area-chart/interfaces.d.ts.map +1 -1
- package/area-chart/interfaces.js.map +1 -1
- package/area-chart/internal.d.ts +1 -1
- package/area-chart/internal.d.ts.map +1 -1
- package/area-chart/internal.js +2 -2
- package/area-chart/internal.js.map +1 -1
- package/attribute-editor/interfaces.d.ts +7 -0
- package/attribute-editor/interfaces.d.ts.map +1 -1
- package/attribute-editor/interfaces.js.map +1 -1
- package/attribute-editor/internal.d.ts.map +1 -1
- package/attribute-editor/internal.js +2 -2
- package/attribute-editor/internal.js.map +1 -1
- package/attribute-editor/row.d.ts +3 -2
- package/attribute-editor/row.d.ts.map +1 -1
- package/attribute-editor/row.js +2 -2
- package/attribute-editor/row.js.map +1 -1
- package/box/styles.css.js +189 -189
- package/box/styles.scoped.css +257 -257
- package/box/styles.selectors.js +189 -189
- package/button/styles.css.js +20 -20
- package/button/styles.scoped.css +154 -154
- package/button/styles.selectors.js +20 -20
- package/button-dropdown/category-elements/styles.css.js +13 -13
- package/button-dropdown/category-elements/styles.scoped.css +25 -25
- package/button-dropdown/category-elements/styles.selectors.js +13 -13
- package/button-dropdown/item-element/styles.css.js +14 -14
- package/button-dropdown/item-element/styles.scoped.css +20 -20
- package/button-dropdown/item-element/styles.selectors.js +14 -14
- package/cards/styles.css.js +38 -38
- package/cards/styles.scoped.css +57 -62
- package/cards/styles.selectors.js +38 -38
- package/container/styles.css.js +28 -28
- package/container/styles.scoped.css +57 -54
- package/container/styles.selectors.js +28 -28
- package/content-layout/styles.css.js +7 -7
- package/content-layout/styles.scoped.css +13 -13
- package/content-layout/styles.selectors.js +7 -7
- package/expandable-section/styles.css.js +29 -29
- package/expandable-section/styles.scoped.css +61 -61
- package/expandable-section/styles.selectors.js +29 -29
- package/flashbar/styles.css.js +46 -46
- package/flashbar/styles.scoped.css +146 -146
- package/flashbar/styles.selectors.js +46 -46
- package/form-field/internal.js +3 -2
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +5 -5
- package/header/internal.js.map +1 -1
- package/header/styles.css.js +33 -44
- package/header/styles.scoped.css +85 -91
- package/header/styles.selectors.js +33 -44
- package/help-panel/styles.css.js +4 -4
- package/help-panel/styles.scoped.css +80 -80
- package/help-panel/styles.selectors.js +4 -4
- package/icon/styles.css.js +21 -21
- package/icon/styles.scoped.css +54 -54
- package/icon/styles.selectors.js +21 -21
- package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/internal/analytics/components/analytics-funnel.js +14 -13
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/analytics/context/analytics-context.d.ts +6 -7
- package/internal/analytics/context/analytics-context.d.ts.map +1 -1
- package/internal/analytics/context/analytics-context.js +2 -6
- package/internal/analytics/context/analytics-context.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts +4 -7
- package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/internal/analytics/hooks/use-funnel.js +9 -7
- package/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/internal/base-component/styles.scoped.css +45 -35
- package/internal/components/button-trigger/index.d.ts +2 -1
- package/internal/components/button-trigger/index.d.ts.map +1 -1
- package/internal/components/button-trigger/index.js +2 -2
- package/internal/components/button-trigger/index.js.map +1 -1
- package/internal/components/cartesian-chart/interfaces.d.ts +10 -2
- package/internal/components/cartesian-chart/interfaces.d.ts.map +1 -1
- package/internal/components/cartesian-chart/interfaces.js.map +1 -1
- package/internal/components/dropdown/index.d.ts +1 -1
- package/internal/components/dropdown/index.d.ts.map +1 -1
- package/internal/components/dropdown/index.js +4 -4
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/components/dropdown/interfaces.d.ts +8 -0
- package/internal/components/dropdown/interfaces.d.ts.map +1 -1
- package/internal/components/dropdown/interfaces.js.map +1 -1
- package/internal/components/menu-dropdown/styles.css.js +7 -7
- package/internal/components/menu-dropdown/styles.scoped.css +14 -14
- package/internal/components/menu-dropdown/styles.selectors.js +7 -7
- package/internal/environment.js +1 -1
- package/internal/generated/theming/index.cjs +153 -120
- package/internal/generated/theming/index.js +153 -120
- package/internal/manifest.json +1 -1
- package/link/internal.d.ts.map +1 -1
- package/link/internal.js +3 -2
- package/link/internal.js.map +1 -1
- package/link/styles.css.js +20 -20
- package/link/styles.scoped.css +83 -83
- package/link/styles.selectors.js +20 -20
- package/mixed-line-bar-chart/internal.d.ts +1 -1
- package/mixed-line-bar-chart/internal.d.ts.map +1 -1
- package/mixed-line-bar-chart/internal.js +2 -2
- package/mixed-line-bar-chart/internal.js.map +1 -1
- package/modal/styles.css.js +23 -23
- package/modal/styles.scoped.css +40 -40
- package/modal/styles.selectors.js +23 -23
- package/package.json +1 -1
- package/pagination/styles.css.js +9 -9
- package/pagination/styles.scoped.css +24 -24
- package/pagination/styles.selectors.js +9 -9
- package/popover/styles.css.js +50 -50
- package/popover/styles.scoped.css +65 -65
- package/popover/styles.selectors.js +50 -50
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +4 -3
- package/property-filter/index.js.map +1 -1
- package/property-filter/interfaces.d.ts +16 -5
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/s3-resource-selector/index.d.ts.map +1 -1
- package/s3-resource-selector/index.js +2 -2
- package/s3-resource-selector/index.js.map +1 -1
- package/s3-resource-selector/interfaces.d.ts +7 -0
- package/s3-resource-selector/interfaces.d.ts.map +1 -1
- package/s3-resource-selector/interfaces.js.map +1 -1
- package/s3-resource-selector/s3-in-context/index.d.ts +1 -0
- package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-in-context/index.js +2 -2
- package/s3-resource-selector/s3-in-context/index.js.map +1 -1
- package/segmented-control/styles.css.js +14 -14
- package/segmented-control/styles.scoped.css +35 -35
- package/segmented-control/styles.selectors.js +14 -14
- package/select/utils/use-select.d.ts +5 -7
- package/select/utils/use-select.d.ts.map +1 -1
- package/select/utils/use-select.js +6 -0
- package/select/utils/use-select.js.map +1 -1
- package/side-navigation/styles.css.js +28 -28
- package/side-navigation/styles.scoped.css +49 -49
- package/side-navigation/styles.selectors.js +28 -28
- package/spinner/styles.css.js +13 -13
- package/spinner/styles.scoped.css +22 -22
- package/spinner/styles.selectors.js +13 -13
- package/split-panel/styles.css.js +56 -56
- package/split-panel/styles.scoped.css +80 -80
- package/split-panel/styles.selectors.js +56 -56
- package/table/header-cell/styles.css.js +24 -24
- package/table/header-cell/styles.scoped.css +41 -41
- package/table/header-cell/styles.selectors.js +24 -24
- package/table/styles.css.js +34 -34
- package/table/styles.scoped.css +45 -52
- package/table/styles.selectors.js +34 -34
- package/tabs/styles.css.js +21 -21
- package/tabs/styles.scoped.css +41 -41
- package/tabs/styles.selectors.js +21 -21
- package/tag-editor/styles.css.js +3 -3
- package/tag-editor/styles.scoped.css +11 -11
- package/tag-editor/styles.selectors.js +3 -3
- package/text-content/styles.css.js +1 -1
- package/text-content/styles.scoped.css +71 -71
- package/text-content/styles.selectors.js +1 -1
- package/top-navigation/1.0-beta/styles.css.js +25 -25
- package/top-navigation/1.0-beta/styles.scoped.css +45 -45
- package/top-navigation/1.0-beta/styles.selectors.js +25 -25
- package/top-navigation/styles.css.js +47 -47
- package/top-navigation/styles.scoped.css +74 -74
- package/top-navigation/styles.selectors.js +47 -47
- package/tutorial-panel/components/tutorial-detail-view/styles.css.js +20 -20
- package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +22 -22
- package/tutorial-panel/components/tutorial-detail-view/styles.selectors.js +20 -20
- package/wizard/interfaces.d.ts +10 -3
- package/wizard/interfaces.d.ts.map +1 -1
- package/wizard/interfaces.js.map +1 -1
- package/wizard/internal.d.ts +1 -1
- package/wizard/internal.d.ts.map +1 -1
- package/wizard/internal.js +5 -5
- package/wizard/internal.js.map +1 -1
- package/wizard/wizard-form.d.ts +2 -1
- package/wizard/wizard-form.d.ts.map +1 -1
- package/wizard/wizard-form.js +2 -2
- package/wizard/wizard-form.js.map +1 -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_1cy16_93",
|
|
6
|
+
"scrolling-background": "awsui_scrolling-background_hyvsj_1cy16_96",
|
|
7
|
+
"sticky-background": "awsui_sticky-background_hyvsj_1cy16_102",
|
|
8
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_1cy16_110",
|
|
9
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_1cy16_123",
|
|
10
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_1cy16_133",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_hyvsj_1cy16_145",
|
|
12
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_1cy16_157",
|
|
13
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_1cy16_191",
|
|
14
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_1cy16_196",
|
|
15
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_1cy16_215",
|
|
16
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_1cy16_247",
|
|
17
|
+
"drawers-trigger": "awsui_drawers-trigger_hyvsj_1cy16_247",
|
|
18
|
+
"drawer": "awsui_drawer_hyvsj_1cy16_145",
|
|
19
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_1cy16_297",
|
|
20
|
+
"drawer-content": "awsui_drawer-content_hyvsj_1cy16_302",
|
|
21
|
+
"drawer-slider": "awsui_drawer-slider_hyvsj_1cy16_307",
|
|
22
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_1cy16_314",
|
|
23
|
+
"content": "awsui_content_hyvsj_1cy16_339",
|
|
24
|
+
"layout": "awsui_layout_hyvsj_1cy16_360",
|
|
25
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_1cy16_443",
|
|
26
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_1cy16_458",
|
|
27
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_1cy16_475",
|
|
28
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_1cy16_507",
|
|
29
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_1cy16_510",
|
|
30
|
+
"content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_1cy16_520",
|
|
31
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_1cy16_523",
|
|
32
|
+
"content-first-child-header": "awsui_content-first-child-header_hyvsj_1cy16_526",
|
|
33
|
+
"has-header": "awsui_has-header_hyvsj_1cy16_526",
|
|
34
|
+
"content-first-child-main": "awsui_content-first-child-main_hyvsj_1cy16_547",
|
|
35
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_1cy16_547",
|
|
36
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_1cy16_590",
|
|
37
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_1cy16_590",
|
|
38
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_1cy16_606",
|
|
39
|
+
"unfocusable": "awsui_unfocusable_hyvsj_1cy16_611",
|
|
40
|
+
"container": "awsui_container_hyvsj_1cy16_621",
|
|
41
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_1cy16_646",
|
|
42
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_1cy16_649",
|
|
43
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_1cy16_649",
|
|
44
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_1cy16_649",
|
|
45
|
+
"mobile-toolbar": "awsui_mobile-toolbar_hyvsj_1cy16_658",
|
|
46
|
+
"mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_1cy16_674",
|
|
47
|
+
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_1cy16_678",
|
|
48
|
+
"mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_1cy16_682",
|
|
49
|
+
"navigation-container": "awsui_navigation-container_hyvsj_1cy16_691",
|
|
50
|
+
"show-navigation": "awsui_show-navigation_hyvsj_1cy16_735",
|
|
51
|
+
"animating": "awsui_animating_hyvsj_1cy16_757",
|
|
52
|
+
"showButtons": "awsui_showButtons_hyvsj_1cy16_1",
|
|
53
|
+
"navigation": "awsui_navigation_hyvsj_1cy16_691",
|
|
54
|
+
"openNavigation": "awsui_openNavigation_hyvsj_1cy16_1",
|
|
55
|
+
"animated-content": "awsui_animated-content_hyvsj_1cy16_819",
|
|
56
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_1cy16_828",
|
|
57
|
+
"notifications": "awsui_notifications_hyvsj_1cy16_838",
|
|
58
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_1cy16_844",
|
|
59
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_1cy16_861",
|
|
60
|
+
"position-bottom": "awsui_position-bottom_hyvsj_1cy16_907",
|
|
61
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_1cy16_1",
|
|
62
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_1cy16_936",
|
|
63
|
+
"position-side": "awsui_position-side_hyvsj_1cy16_964",
|
|
64
|
+
"openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_1cy16_1",
|
|
65
|
+
"tools-container": "awsui_tools-container_hyvsj_1cy16_1001",
|
|
66
|
+
"tools": "awsui_tools_hyvsj_1cy16_1001",
|
|
67
|
+
"openTools": "awsui_openTools_hyvsj_1cy16_1",
|
|
68
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_1cy16_1096",
|
|
69
|
+
"hide-tools": "awsui_hide-tools_hyvsj_1cy16_1106",
|
|
70
|
+
"show-tools": "awsui_show-tools_hyvsj_1cy16_1118",
|
|
71
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_1cy16_1096",
|
|
72
|
+
"trigger": "awsui_trigger_hyvsj_1cy16_1185",
|
|
73
|
+
"selected": "awsui_selected_hyvsj_1cy16_1224"
|
|
74
74
|
};
|
|
75
75
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AreaChartProps } from './interfaces';
|
|
3
3
|
import { ChartModel } from './model';
|
|
4
|
-
interface ChartContainerProps<T extends AreaChartProps.DataTypes> extends Pick<AreaChartProps<T>, 'xTitle' | 'yTitle' | 'detailPopoverSize' | 'detailPopoverFooter' | 'ariaLabel' | 'ariaLabelledby' | 'ariaDescription' | 'i18nStrings'> {
|
|
4
|
+
interface ChartContainerProps<T extends AreaChartProps.DataTypes> extends Pick<AreaChartProps<T>, 'xTitle' | 'yTitle' | 'xTickFormatter' | 'yTickFormatter' | 'detailTotalFormatter' | 'detailPopoverSize' | 'detailPopoverFooter' | 'ariaLabel' | 'ariaLabelledby' | 'ariaDescription' | 'i18nStrings'> {
|
|
5
5
|
model: ChartModel<T>;
|
|
6
6
|
autoWidth: (value: number) => void;
|
|
7
7
|
}
|
|
8
8
|
declare const _default: typeof ChartContainer;
|
|
9
9
|
export default _default;
|
|
10
|
-
declare function ChartContainer<T extends AreaChartProps.DataTypes>({ model, autoWidth, xTitle, yTitle, detailPopoverSize, detailPopoverFooter, ariaLabel, ariaLabelledby, ariaDescription, i18nStrings: { xTickFormatter, yTickFormatter, detailTotalFormatter, detailTotalLabel, chartAriaRoleDescription, xAxisAriaRoleDescription, yAxisAriaRoleDescription, detailPopoverDismissAriaLabel, }, }: ChartContainerProps<T>): JSX.Element;
|
|
10
|
+
declare function ChartContainer<T extends AreaChartProps.DataTypes>({ model, autoWidth, xTitle, yTitle, detailPopoverSize, detailPopoverFooter, ariaLabel, ariaLabelledby, ariaDescription, i18nStrings: { xTickFormatter: deprecatedXTickFormatter, yTickFormatter: deprecatedYTickFormatter, detailTotalFormatter: deprecatedDetailTotalFormatter, detailTotalLabel, chartAriaRoleDescription, xAxisAriaRoleDescription, yAxisAriaRoleDescription, detailPopoverDismissAriaLabel, }, xTickFormatter, yTickFormatter, detailTotalFormatter, }: ChartContainerProps<T>): JSX.Element;
|
|
11
11
|
//# sourceMappingURL=chart-container.d.ts.map
|
|
@@ -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,
|
|
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,gBAAgB,GAChB,gBAAgB,GAChB,sBAAsB,GACtB,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,EAAE,wBAAwB,EACxC,cAAc,EAAE,wBAAwB,EACxC,oBAAoB,EAAE,8BAA8B,EACpD,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GACzB,EACN,cAAyC,EACzC,cAAyC,EACzC,oBAAqD,GACtD,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6GxB"}
|
|
@@ -20,7 +20,7 @@ const DEFAULT_CHART_WIDTH = 500;
|
|
|
20
20
|
const LEFT_LABELS_MARGIN = 16;
|
|
21
21
|
const BOTTOM_LABELS_OFFSET = 12;
|
|
22
22
|
export default memo(ChartContainer);
|
|
23
|
-
function ChartContainer({ model, autoWidth, xTitle, yTitle, detailPopoverSize, detailPopoverFooter, ariaLabel, ariaLabelledby, ariaDescription, i18nStrings: { xTickFormatter, yTickFormatter, detailTotalFormatter, detailTotalLabel, chartAriaRoleDescription, xAxisAriaRoleDescription, yAxisAriaRoleDescription, detailPopoverDismissAriaLabel, } = {}, }) {
|
|
23
|
+
function ChartContainer({ model, autoWidth, xTitle, yTitle, detailPopoverSize, detailPopoverFooter, ariaLabel, ariaLabelledby, ariaDescription, i18nStrings: { xTickFormatter: deprecatedXTickFormatter, yTickFormatter: deprecatedYTickFormatter, detailTotalFormatter: deprecatedDetailTotalFormatter, detailTotalLabel, chartAriaRoleDescription, xAxisAriaRoleDescription, yAxisAriaRoleDescription, detailPopoverDismissAriaLabel, } = {}, xTickFormatter = deprecatedXTickFormatter, yTickFormatter = deprecatedYTickFormatter, detailTotalFormatter = deprecatedDetailTotalFormatter, }) {
|
|
24
24
|
const [leftLabelsWidth, setLeftLabelsWidth] = useState(0);
|
|
25
25
|
const [bottomLabelsHeight, setBottomLabelsHeight] = useState(0);
|
|
26
26
|
const [containerWidth, containerWidthRef] = useContainerWidth(DEFAULT_CHART_WIDTH);
|
|
@@ -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,OA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BAAC,cAAc,IAAC,KAAK,EAAE,KAAK,GAAI;YAEhC,oBAAC,YAAY,IACX,KAAK,EAAE,KAAK,CAAC,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
|
+
{"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,MA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AAC;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 | 'xTickFormatter'\n | 'yTickFormatter'\n | 'detailTotalFormatter'\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: deprecatedXTickFormatter,\n yTickFormatter: deprecatedYTickFormatter,\n detailTotalFormatter: deprecatedDetailTotalFormatter,\n detailTotalLabel,\n chartAriaRoleDescription,\n xAxisAriaRoleDescription,\n yAxisAriaRoleDescription,\n detailPopoverDismissAriaLabel,\n } = {},\n xTickFormatter = deprecatedXTickFormatter,\n yTickFormatter = deprecatedYTickFormatter,\n detailTotalFormatter = deprecatedDetailTotalFormatter,\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"]}
|
|
@@ -11,6 +11,10 @@ export interface AreaChartProps<T extends AreaChartProps.DataTypes> extends Cart
|
|
|
11
11
|
* * `valueFormatter` (Function): (Optional) A function that formats data values before rendering in the UI, For example, in the details popover.
|
|
12
12
|
*/
|
|
13
13
|
series: ReadonlyArray<AreaChartProps.Series<T>>;
|
|
14
|
+
/**
|
|
15
|
+
* Function to format the displayed values total.
|
|
16
|
+
*/
|
|
17
|
+
detailTotalFormatter?: AreaChartProps.TickFormatter<number>;
|
|
14
18
|
/**
|
|
15
19
|
* An object containing all the necessary localized strings required by the component.
|
|
16
20
|
* @i18n
|
|
@@ -45,7 +49,7 @@ export declare namespace AreaChartProps {
|
|
|
45
49
|
interface I18nStrings<T> extends CartesianChartProps.I18nStrings<T> {
|
|
46
50
|
/** The title of the values total in the popover. */
|
|
47
51
|
detailTotalLabel?: string;
|
|
48
|
-
/**
|
|
52
|
+
/** @deprecated Use `detailTotalFormatter` on the component instead. */
|
|
49
53
|
detailTotalFormatter?: TickFormatter<number>;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["area-chart/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AAExG,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,CAChE,SAAQ,mBAAmB,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxD;;;;;;;;;OASG;IACH,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhD;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC7C;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,SAAS,GAAG,cAAc,CAAC;IAEvC,UAAiB,KAAK,CAAC,CAAC;QACtB,CAAC,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,CAAC;QACf,CAAC,EAAE,MAAM,CAAC;QACV,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KACxC;IAED,KAAY,kBAAkB,CAAC,CAAC,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtF,KAAY,qBAAqB,CAAC,CAAC,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5F,KAAY,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEpE,KAAY,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,IAAI,mBAAmB,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEnG,UAAiB,WAAW,CAAC,CAAC,CAAE,SAAQ,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;QACxE,oDAAoD;QACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,uEAAuE;QACvE,oBAAoB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KAC9C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["area-chart/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CartesianChartProps, ChartDataTypes } from '../internal/components/cartesian-chart/interfaces';\n\nexport interface AreaChartProps<T extends AreaChartProps.DataTypes>\n extends CartesianChartProps<T, AreaChartProps.Series<T>> {\n /**\n * Array that represents the source of data for the displayed chart.\n * Each element can represent an area series, or a threshold, and can have the following properties:\n *\n * * `title` (string): A human-readable title for this series\n * * `type` (string): Series type (`\"area\"`, or `\"threshold\"`)\n * * `data` (Array): An array of data points, represented as objects with `x` and `y` properties. The `x` values must be consistent across all series\n * * `color` (string): (Optional) A color hex value for this series. When assigned, it takes priority over the automatically assigned color\n * * `valueFormatter` (Function): (Optional) A function that formats data values before rendering in the UI, For example, in the details popover.\n */\n series: ReadonlyArray<AreaChartProps.Series<T>>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: AreaChartProps.I18nStrings<T>;\n}\n\nexport namespace AreaChartProps {\n export type DataTypes = ChartDataTypes;\n\n export interface Datum<T> {\n x: T;\n y: number;\n }\n\n export type Series<T> = AreaSeries<T> | ThresholdSeries;\n\n export interface AreaSeries<T> {\n type: 'area';\n title: string;\n color?: string;\n data: T extends unknown ? ReadonlyArray<Datum<T>> : ReadonlyArray<Datum<T>>;\n valueFormatter?: ValueFormatter<number, T>;\n }\n\n export interface ThresholdSeries {\n type: 'threshold';\n title: string;\n color?: string;\n y: number;\n valueFormatter?: TickFormatter<number>;\n }\n\n export type FilterChangeDetail<T> = CartesianChartProps.FilterChangeDetail<Series<T>>;\n\n export type HighlightChangeDetail<T> = CartesianChartProps.HighlightChangeDetail<Series<T>>;\n\n export type TickFormatter<T> = CartesianChartProps.TickFormatter<T>;\n\n export type ValueFormatter<YType, XType = null> = CartesianChartProps.ValueFormatter<YType, XType>;\n\n export interface I18nStrings<T> extends CartesianChartProps.I18nStrings<T> {\n /** The title of the values total in the popover. */\n detailTotalLabel?: string;\n /**
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["area-chart/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CartesianChartProps, ChartDataTypes } from '../internal/components/cartesian-chart/interfaces';\n\nexport interface AreaChartProps<T extends AreaChartProps.DataTypes>\n extends CartesianChartProps<T, AreaChartProps.Series<T>> {\n /**\n * Array that represents the source of data for the displayed chart.\n * Each element can represent an area series, or a threshold, and can have the following properties:\n *\n * * `title` (string): A human-readable title for this series\n * * `type` (string): Series type (`\"area\"`, or `\"threshold\"`)\n * * `data` (Array): An array of data points, represented as objects with `x` and `y` properties. The `x` values must be consistent across all series\n * * `color` (string): (Optional) A color hex value for this series. When assigned, it takes priority over the automatically assigned color\n * * `valueFormatter` (Function): (Optional) A function that formats data values before rendering in the UI, For example, in the details popover.\n */\n series: ReadonlyArray<AreaChartProps.Series<T>>;\n\n /**\n * Function to format the displayed values total.\n */\n detailTotalFormatter?: AreaChartProps.TickFormatter<number>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: AreaChartProps.I18nStrings<T>;\n}\n\nexport namespace AreaChartProps {\n export type DataTypes = ChartDataTypes;\n\n export interface Datum<T> {\n x: T;\n y: number;\n }\n\n export type Series<T> = AreaSeries<T> | ThresholdSeries;\n\n export interface AreaSeries<T> {\n type: 'area';\n title: string;\n color?: string;\n data: T extends unknown ? ReadonlyArray<Datum<T>> : ReadonlyArray<Datum<T>>;\n valueFormatter?: ValueFormatter<number, T>;\n }\n\n export interface ThresholdSeries {\n type: 'threshold';\n title: string;\n color?: string;\n y: number;\n valueFormatter?: TickFormatter<number>;\n }\n\n export type FilterChangeDetail<T> = CartesianChartProps.FilterChangeDetail<Series<T>>;\n\n export type HighlightChangeDetail<T> = CartesianChartProps.HighlightChangeDetail<Series<T>>;\n\n export type TickFormatter<T> = CartesianChartProps.TickFormatter<T>;\n\n export type ValueFormatter<YType, XType = null> = CartesianChartProps.ValueFormatter<YType, XType>;\n\n export interface I18nStrings<T> extends CartesianChartProps.I18nStrings<T> {\n /** The title of the values total in the popover. */\n detailTotalLabel?: string;\n /** @deprecated Use `detailTotalFormatter` on the component instead. */\n detailTotalFormatter?: TickFormatter<number>;\n }\n}\n"]}
|
package/area-chart/internal.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import { AreaChartProps } from './interfaces';
|
|
|
3
3
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
4
4
|
import { SomeRequired } from '../internal/types';
|
|
5
5
|
type InternalAreaChartProps<T extends AreaChartProps.DataTypes> = SomeRequired<AreaChartProps<T>, 'height' | 'xScaleType' | 'yScaleType' | 'statusType' | 'detailPopoverSize' | 'i18nStrings'> & InternalBaseComponentProps;
|
|
6
|
-
export default function InternalAreaChart<T extends AreaChartProps.DataTypes>({ 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, ...props }: InternalAreaChartProps<T>): JSX.Element;
|
|
6
|
+
export default function InternalAreaChart<T extends AreaChartProps.DataTypes>({ height, xScaleType, yScaleType, xDomain, yDomain, xTickFormatter, yTickFormatter, detailTotalFormatter, 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, ...props }: InternalAreaChartProps<T>): JSX.Element;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,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B,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC5E,MAAM,EACN,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,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,eAqI3B"}
|
package/area-chart/internal.js
CHANGED
|
@@ -19,7 +19,7 @@ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
|
19
19
|
import { nodeBelongs } from '../internal/utils/node-belongs';
|
|
20
20
|
import { ChartWrapper } from '../internal/components/chart-wrapper';
|
|
21
21
|
export default function InternalAreaChart(_a) {
|
|
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"]);
|
|
22
|
+
var { height, xScaleType, yScaleType, xDomain, yDomain, xTickFormatter, yTickFormatter, detailTotalFormatter, 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", "xTickFormatter", "yTickFormatter", "detailTotalFormatter", "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"]);
|
|
23
23
|
const baseProps = getBaseProps(props);
|
|
24
24
|
const containerRef = useRef(null);
|
|
25
25
|
const popoverRef = useRef(null);
|
|
@@ -69,6 +69,6 @@ export default function InternalAreaChart(_a) {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
const mergedRef = useMergeRefs(containerRef, __internalRootRef);
|
|
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 })));
|
|
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, xTickFormatter: xTickFormatter, yTickFormatter: yTickFormatter, detailTotalFormatter: detailTotalFormatter, 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 })));
|
|
73
73
|
}
|
|
74
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,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,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAQpE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAqC,EAgClD;QAhCkD,EAC5E,MAAM,EACN,UAAU,EACV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H,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"]}
|
|
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,QA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ACd,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 xTickFormatter,\n yTickFormatter,\n detailTotalFormatter,\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 xTickFormatter={xTickFormatter}\n yTickFormatter={yTickFormatter}\n detailTotalFormatter={detailTotalFormatter}\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"]}
|
|
@@ -34,6 +34,9 @@ export declare namespace AttributeEditorProps {
|
|
|
34
34
|
interface I18nStrings<T = any> {
|
|
35
35
|
errorIconAriaLabel?: string;
|
|
36
36
|
itemRemovedAriaLive?: string;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `removeButtonAriaLabel` on the component instead.
|
|
39
|
+
*/
|
|
37
40
|
removeButtonAriaLabel?: (item: T) => string;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
@@ -55,6 +58,10 @@ export interface AttributeEditorProps<T> extends BaseComponentProps {
|
|
|
55
58
|
* @i18n
|
|
56
59
|
*/
|
|
57
60
|
removeButtonText?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Adds an `aria-label` to the remove button.
|
|
63
|
+
*/
|
|
64
|
+
removeButtonAriaLabel?: (item: T) => string;
|
|
58
65
|
/**
|
|
59
66
|
* Specifies the items that serve as the data source for all rows.
|
|
60
67
|
* The display of a row is handled by the `definition` property.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAY/D,MAAM,WAAW,6BAA6B;IAC5C,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CAClG;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,uBAAuB,CAAC,CAAC;QACxC,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC;KACpB;IAED,KAAY,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACjF,UAAiB,eAAe,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACxB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;QAC/C,SAAS,CAAC,EAAE,eAAe,CAAC,CAAC,CAA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;;;;;OAUG;IACH,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE;;OAEG;IACH,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IAE7C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAE9F;;OAEG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface AttributeEditorForwardRefType {\n <T>(props: AttributeEditorProps<T> & { ref?: React.Ref<AttributeEditorProps.Ref> }): JSX.Element;\n}\n\nexport namespace AttributeEditorProps {\n export interface IsItemRemovableFunction<T> {\n (item: T): boolean;\n }\n\n export type FieldRenderable<T> = (item: T, itemIndex: number) => React.ReactNode;\n export interface FieldDefinition<T> {\n label?: React.ReactNode;\n info?: React.ReactNode;\n control?: FieldRenderable<T> | React.ReactNode;\n errorText?: FieldRenderable<T> | React.ReactNode;\n constraintText?: FieldRenderable<T> | React.ReactNode;\n }\n\n export interface RemoveButtonClickDetail {\n itemIndex: number;\n }\n\n export interface Ref {\n /**\n * Focuses the 'remove' button for the given row index.\n */\n focusRemoveButton(itemIndex: number): void;\n /**\n * Focuses the 'add' button. Use this, for example, after a user removes the last row.\n */\n focusAddButton(): void;\n }\n\n export interface I18nStrings<T = any> {\n errorIconAriaLabel?: string;\n itemRemovedAriaLive?: string;\n removeButtonAriaLabel?: (item: T) => string;\n }\n}\n\nexport interface AttributeEditorProps<T> extends BaseComponentProps {\n /**\n * Displayed when there are no items to display.\n */\n empty?: React.ReactNode;\n\n /**\n * Displayed below the add button. Use it for additional information related to the attribute editor.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Specifies the text that's displayed in the add button.\n */\n addButtonText: string;\n\n /**\n * Specifies the text that's displayed in the remove button.\n * @i18n\n */\n removeButtonText?: string;\n\n /**\n * Specifies the items that serve as the data source for all rows.\n * The display of a row is handled by the `definition` property.\n */\n items?: ReadonlyArray<T>;\n\n /**\n * Function that determines whether an item is removable. When this function returns `false`, the remove\n * button is not rendered and the user can't remove the item.\n * By default, all items are removable.\n */\n isItemRemovable?: AttributeEditorProps.IsItemRemovableFunction<T>;\n\n /**\n * Determines whether the add button is disabled.\n */\n disableAddButton?: boolean;\n\n /**\n * Defines the editor configuration. Each object in the array represents one form field in the row.\n * * `label` (ReactNode) - Text label for the form field.\n * * `info` (ReactNode) - Info link for the form field.\n * * `errorText` ((item, itemIndex) => ReactNode) - Error message text to display as a control validation message.\n * It renders the form field as invalid if the returned value is not `null` or `undefined`.\n * * `constraintText` ((item, itemIndex) => ReactNode) - Text to display as a constraint message below the field.\n * * `control` ((item, itemIndex) => ReactNode) - A control to use as the input for the field.\n *\n * A maximum of four fields are supported.\n */\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n\n /**\n * Called when add button is clicked.\n */\n onAddButtonClick?: NonCancelableEventHandler;\n\n /**\n * Called when remove button is clicked.\n * The event `detail` contains the index of the corresponding item.\n */\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: AttributeEditorProps.I18nStrings<T>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["attribute-editor/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\n/*\n * HACK: Cast the component to a named parametrized interface.\n *\n * This lets us use React.forwardRef and still let the component have type\n * parameters, and the naming convention lets the documenter know that this is\n * a forwardRef-wrapped component.\n *\n * We don't need to expose this type to customers because it's just a simple\n * function type.\n */\nexport interface AttributeEditorForwardRefType {\n <T>(props: AttributeEditorProps<T> & { ref?: React.Ref<AttributeEditorProps.Ref> }): JSX.Element;\n}\n\nexport namespace AttributeEditorProps {\n export interface IsItemRemovableFunction<T> {\n (item: T): boolean;\n }\n\n export type FieldRenderable<T> = (item: T, itemIndex: number) => React.ReactNode;\n export interface FieldDefinition<T> {\n label?: React.ReactNode;\n info?: React.ReactNode;\n control?: FieldRenderable<T> | React.ReactNode;\n errorText?: FieldRenderable<T> | React.ReactNode;\n constraintText?: FieldRenderable<T> | React.ReactNode;\n }\n\n export interface RemoveButtonClickDetail {\n itemIndex: number;\n }\n\n export interface Ref {\n /**\n * Focuses the 'remove' button for the given row index.\n */\n focusRemoveButton(itemIndex: number): void;\n /**\n * Focuses the 'add' button. Use this, for example, after a user removes the last row.\n */\n focusAddButton(): void;\n }\n\n export interface I18nStrings<T = any> {\n errorIconAriaLabel?: string;\n itemRemovedAriaLive?: string;\n\n /**\n * @deprecated Use `removeButtonAriaLabel` on the component instead.\n */\n removeButtonAriaLabel?: (item: T) => string;\n }\n}\n\nexport interface AttributeEditorProps<T> extends BaseComponentProps {\n /**\n * Displayed when there are no items to display.\n */\n empty?: React.ReactNode;\n\n /**\n * Displayed below the add button. Use it for additional information related to the attribute editor.\n */\n additionalInfo?: React.ReactNode;\n\n /**\n * Specifies the text that's displayed in the add button.\n */\n addButtonText: string;\n\n /**\n * Specifies the text that's displayed in the remove button.\n * @i18n\n */\n removeButtonText?: string;\n\n /**\n * Adds an `aria-label` to the remove button.\n */\n removeButtonAriaLabel?: (item: T) => string;\n\n /**\n * Specifies the items that serve as the data source for all rows.\n * The display of a row is handled by the `definition` property.\n */\n items?: ReadonlyArray<T>;\n\n /**\n * Function that determines whether an item is removable. When this function returns `false`, the remove\n * button is not rendered and the user can't remove the item.\n * By default, all items are removable.\n */\n isItemRemovable?: AttributeEditorProps.IsItemRemovableFunction<T>;\n\n /**\n * Determines whether the add button is disabled.\n */\n disableAddButton?: boolean;\n\n /**\n * Defines the editor configuration. Each object in the array represents one form field in the row.\n * * `label` (ReactNode) - Text label for the form field.\n * * `info` (ReactNode) - Info link for the form field.\n * * `errorText` ((item, itemIndex) => ReactNode) - Error message text to display as a control validation message.\n * It renders the form field as invalid if the returned value is not `null` or `undefined`.\n * * `constraintText` ((item, itemIndex) => ReactNode) - Text to display as a constraint message below the field.\n * * `control` ((item, itemIndex) => ReactNode) - A control to use as the input for the field.\n *\n * A maximum of four fields are supported.\n */\n definition: ReadonlyArray<AttributeEditorProps.FieldDefinition<T>>;\n\n /**\n * Called when add button is clicked.\n */\n onAddButtonClick?: NonCancelableEventHandler;\n\n /**\n * Called when remove button is clicked.\n * The event `detail` contains the index of the corresponding item.\n */\n onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n */\n i18nStrings?: AttributeEditorProps.I18nStrings<T>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AAgBnF,QAAA,MAAM,uBAAuB,+
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/internal.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,6BAA6B,EAAwB,MAAM,cAAc,CAAC;AAgBnF,QAAA,MAAM,uBAAuB,+BA+FK,CAAC;AAEnC,eAAe,uBAAuB,CAAC"}
|
|
@@ -15,7 +15,7 @@ import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
|
15
15
|
import { usePrevious } from '../internal/hooks/use-previous';
|
|
16
16
|
import LiveRegion from '../internal/components/live-region';
|
|
17
17
|
const InternalAttributeEditor = React.forwardRef((_a, ref) => {
|
|
18
|
-
var { additionalInfo, disableAddButton, definition, items, isItemRemovable = () => true, empty, addButtonText, removeButtonText, i18nStrings, onAddButtonClick, onRemoveButtonClick, __internalRootRef = null } = _a, props = __rest(_a, ["additionalInfo", "disableAddButton", "definition", "items", "isItemRemovable", "empty", "addButtonText", "removeButtonText", "i18nStrings", "onAddButtonClick", "onRemoveButtonClick", "__internalRootRef"]);
|
|
18
|
+
var { additionalInfo, disableAddButton, definition, items, isItemRemovable = () => true, empty, addButtonText, removeButtonText, removeButtonAriaLabel, i18nStrings, onAddButtonClick, onRemoveButtonClick, __internalRootRef = null } = _a, props = __rest(_a, ["additionalInfo", "disableAddButton", "definition", "items", "isItemRemovable", "empty", "addButtonText", "removeButtonText", "removeButtonAriaLabel", "i18nStrings", "onAddButtonClick", "onRemoveButtonClick", "__internalRootRef"]);
|
|
19
19
|
const [breakpoint, breakpointRef] = useContainerBreakpoints(['default', 'xxs', 'xs']);
|
|
20
20
|
const removeButtonRefs = useRef([]);
|
|
21
21
|
const addButtonRef = useRef(null);
|
|
@@ -51,7 +51,7 @@ const InternalAttributeEditor = React.forwardRef((_a, ref) => {
|
|
|
51
51
|
return (React.createElement("div", Object.assign({}, baseProps, { ref: mergedRef, className: clsx(baseProps.className, styles.root) }),
|
|
52
52
|
React.createElement(InternalBox, { margin: { bottom: 'l' } },
|
|
53
53
|
isEmpty && React.createElement("div", { className: clsx(styles.empty, wasNonEmpty.current && styles['empty-appear']) }, empty),
|
|
54
|
-
items.map((item, index) => (React.createElement(Row, { key: index, index: index, breakpoint: breakpoint, item: item, definition: definition, i18nStrings: i18nStrings, removable: isItemRemovable(item), removeButtonText: removeButtonText, removeButtonRefs: removeButtonRefs.current, onRemoveButtonClick: onRemoveButtonClick })))),
|
|
54
|
+
items.map((item, index) => (React.createElement(Row, { key: index, index: index, breakpoint: breakpoint, item: item, definition: definition, i18nStrings: i18nStrings, removable: isItemRemovable(item), removeButtonText: removeButtonText, removeButtonRefs: removeButtonRefs.current, onRemoveButtonClick: onRemoveButtonClick, removeButtonAriaLabel: removeButtonAriaLabel })))),
|
|
55
55
|
React.createElement(InternalButton, { className: styles['add-button'], disabled: disableAddButton, onClick: onAddButtonClick, formAction: "none", ref: addButtonRef, ariaDescribedby: infoAriaDescribedBy }, addButtonText),
|
|
56
56
|
React.createElement(LiveRegion, { "data-testid": "removal-announcement", delay: 5, key: items.length }, removalAnnouncement),
|
|
57
57
|
!!additionalInfo && React.createElement(AdditionalInfo, { id: infoAriaDescribedBy }, additionalInfo)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["attribute-editor/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,WAAW,MAAM,iBAAiB,CAAC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SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,EAC/B,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAC,MAAM,EACjB,GAAG,EAAE,YAAY,EACjB,eAAe,EAAE,mBAAmB,IAEnC,aAAa,CACC;QACjB,oBAAC,UAAU,mBAAa,sBAAsB,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,IACvE,mBAAmB,CACT;QACZ,CAAC,CAAC,cAAc,IAAI,oBAAC,cAAc,IAAC,EAAE,EAAE,mBAAmB,IAAG,cAAc,CAAkB,CAC3F,CACP,CAAC;AACJ,CAAC,CAC+B,CAAC;AAEnC,eAAe,uBAAuB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useImperativeHandle, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\n\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\n\nimport { AttributeEditorForwardRefType, AttributeEditorProps } from './interfaces';\nimport { AdditionalInfo } from './additional-info';\nimport { Row } from './row';\n\nimport styles from './styles.css.js';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport InternalBox from '../box/internal';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { SomeRequired } from '../internal/types';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { usePrevious } from '../internal/hooks/use-previous';\nimport LiveRegion from '../internal/components/live-region';\n\ntype InternalAttributeEditorProps<T> = SomeRequired<AttributeEditorProps<T>, 'items'> & InternalBaseComponentProps;\n\nconst InternalAttributeEditor = React.forwardRef(\n <T,>(\n {\n additionalInfo,\n disableAddButton,\n definition,\n items,\n isItemRemovable = () => true,\n empty,\n addButtonText,\n removeButtonText,\n removeButtonAriaLabel,\n i18nStrings,\n onAddButtonClick,\n onRemoveButtonClick,\n __internalRootRef = null,\n ...props\n }: InternalAttributeEditorProps<T>,\n ref: React.Ref<AttributeEditorProps.Ref>\n ) => {\n const [breakpoint, breakpointRef] = useContainerBreakpoints(['default', 'xxs', 'xs']);\n const removeButtonRefs = useRef<Array<ButtonProps.Ref | undefined>>([]);\n const addButtonRef = useRef<ButtonProps.Ref>(null);\n const wasNonEmpty = useRef<boolean>(false);\n const [removalAnnouncement, setRemovalAnnouncement] = useState<string>('');\n\n const baseProps = getBaseProps(props);\n const isEmpty = items && items.length === 0;\n\n wasNonEmpty.current = wasNonEmpty.current || !isEmpty;\n\n useImperativeHandle(ref, () => ({\n focusRemoveButton(rowIndex: number) {\n removeButtonRefs.current[rowIndex]?.focus();\n },\n focusAddButton() {\n addButtonRef.current?.focus();\n },\n }));\n\n const mergedRef = useMergeRefs(breakpointRef, __internalRootRef);\n\n const additionalInfoId = useUniqueId('attribute-editor-info');\n const infoAriaDescribedBy = additionalInfo ? additionalInfoId : undefined;\n\n const prevItemsLength = usePrevious(items.length);\n\n React.useEffect(() => {\n if (prevItemsLength && prevItemsLength > items.length && i18nStrings?.itemRemovedAriaLive) {\n setRemovalAnnouncement(i18nStrings.itemRemovedAriaLive);\n } else {\n setRemovalAnnouncement('');\n }\n // we only want to announce when the number of items decreases (i.e. when an item is removed)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [items, i18nStrings?.itemRemovedAriaLive]);\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root)}>\n <InternalBox margin={{ bottom: 'l' }}>\n {isEmpty && <div className={clsx(styles.empty, wasNonEmpty.current && styles['empty-appear'])}>{empty}</div>}\n {items.map((item, index) => (\n <Row<T>\n key={index}\n index={index}\n breakpoint={breakpoint}\n item={item}\n definition={definition}\n i18nStrings={i18nStrings}\n removable={isItemRemovable(item)}\n removeButtonText={removeButtonText}\n removeButtonRefs={removeButtonRefs.current}\n onRemoveButtonClick={onRemoveButtonClick}\n removeButtonAriaLabel={removeButtonAriaLabel}\n />\n ))}\n </InternalBox>\n\n <InternalButton\n className={styles['add-button']}\n disabled={disableAddButton}\n onClick={onAddButtonClick}\n formAction=\"none\"\n ref={addButtonRef}\n ariaDescribedby={infoAriaDescribedBy}\n >\n {addButtonText}\n </InternalButton>\n <LiveRegion data-testid=\"removal-announcement\" delay={5} key={items.length}>\n {removalAnnouncement}\n </LiveRegion>\n {!!additionalInfo && <AdditionalInfo id={infoAriaDescribedBy}>{additionalInfo}</AdditionalInfo>}\n </div>\n );\n }\n) as AttributeEditorForwardRefType;\n\nexport default InternalAttributeEditor;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ColumnLayoutBreakpoint } from '../column-layout/internal';
|
|
3
3
|
import { AttributeEditorProps } from './interfaces';
|
|
4
4
|
import { ButtonProps } from '../button/interfaces';
|
|
@@ -13,6 +13,7 @@ export interface RowProps<T> {
|
|
|
13
13
|
removeButtonText?: string;
|
|
14
14
|
removeButtonRefs: Array<ButtonProps.Ref | undefined>;
|
|
15
15
|
onRemoveButtonClick?: NonCancelableEventHandler<AttributeEditorProps.RemoveButtonClickDetail>;
|
|
16
|
+
removeButtonAriaLabel?: (item: T) => string;
|
|
16
17
|
}
|
|
17
|
-
export declare const Row:
|
|
18
|
+
export declare const Row: <T>(props: RowProps<T>) => JSX.Element;
|
|
18
19
|
//# sourceMappingURL=row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"lib/default/","sources":["attribute-editor/row.tsx"],"names":[],"mappings":";AAMA,OAA6B,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAA0B,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AASvF,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,WAAW,EAAE,oBAAoB,CAAC,WAAW,GAAG,SAAS,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC;IAC9F,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;CAC7C;AAYD,eAAO,MAAM,GAAG,6BA6EgB,WAAW,CAAC"}
|
package/attribute-editor/row.js
CHANGED
|
@@ -17,7 +17,7 @@ function render(item, itemIndex, slot) {
|
|
|
17
17
|
}
|
|
18
18
|
const GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }];
|
|
19
19
|
const REMOVABLE_GRID_DEFINITION = [{ colspan: { default: 12, xs: 9 } }, { colspan: { default: 12, xs: 3 } }];
|
|
20
|
-
export const Row = React.memo(({ breakpoint, item, definition, i18nStrings = {}, index, removable, removeButtonText, removeButtonRefs, onRemoveButtonClick, }) => {
|
|
20
|
+
export const Row = React.memo(({ breakpoint, item, definition, i18nStrings = {}, index, removable, removeButtonText, removeButtonRefs, onRemoveButtonClick, removeButtonAriaLabel, }) => {
|
|
21
21
|
var _a;
|
|
22
22
|
const i18n = useInternalI18n('attribute-editor');
|
|
23
23
|
const isNarrowViewport = breakpoint === 'default' || breakpoint === 'xxs';
|
|
@@ -33,7 +33,7 @@ export const Row = React.memo(({ breakpoint, item, definition, i18nStrings = {},
|
|
|
33
33
|
removable && (React.createElement(ButtonContainer, { index: index, isNarrowViewport: isNarrowViewport, hasLabel: definition.some(row => row.label) },
|
|
34
34
|
React.createElement(InternalButton, { className: styles['remove-button'], formAction: "none", ref: ref => {
|
|
35
35
|
removeButtonRefs[index] = ref !== null && ref !== void 0 ? ref : undefined;
|
|
36
|
-
}, ariaLabel: (_a = i18nStrings.removeButtonAriaLabel) === null || _a === void 0 ? void 0 : _a
|
|
36
|
+
}, ariaLabel: (_a = (removeButtonAriaLabel !== null && removeButtonAriaLabel !== void 0 ? removeButtonAriaLabel : i18nStrings.removeButtonAriaLabel)) === null || _a === void 0 ? void 0 : _a(item), onClick: handleRemoveClick }, i18n('removeButtonText', removeButtonText)))))),
|
|
37
37
|
isNarrowViewport && React.createElement(Divider, null)));
|
|
38
38
|
});
|
|
39
39
|
const ButtonContainer = ({ index, children, isNarrowViewport, hasLabel }) => (React.createElement("div", { className: clsx({
|