@cloudscape-design/components 3.0.425 → 3.0.427
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/drawer/index.js.map +1 -1
- package/app-layout/drawer/interfaces.d.ts +5 -5
- package/app-layout/drawer/interfaces.d.ts.map +1 -1
- package/app-layout/drawer/interfaces.js.map +1 -1
- package/app-layout/drawer/overflow-menu.d.ts +2 -2
- package/app-layout/drawer/overflow-menu.d.ts.map +1 -1
- package/app-layout/drawer/overflow-menu.js.map +1 -1
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +11 -5
- package/app-layout/index.js.map +1 -1
- package/app-layout/interfaces.d.ts +54 -26
- package/app-layout/interfaces.d.ts.map +1 -1
- package/app-layout/interfaces.js.map +1 -1
- package/app-layout/mobile-toolbar/index.d.ts +3 -3
- package/app-layout/mobile-toolbar/index.d.ts.map +1 -1
- package/app-layout/mobile-toolbar/index.js.map +1 -1
- package/app-layout/runtime-api.d.ts +3 -3
- package/app-layout/runtime-api.d.ts.map +1 -1
- package/app-layout/runtime-api.js.map +1 -1
- package/app-layout/utils/use-drawers.d.ts +7 -8
- package/app-layout/utils/use-drawers.d.ts.map +1 -1
- package/app-layout/utils/use-drawers.js +1 -3
- package/app-layout/utils/use-drawers.js.map +1 -1
- package/app-layout/utils/use-resize.d.ts +2 -2
- package/app-layout/utils/use-resize.d.ts.map +1 -1
- package/app-layout/utils/use-resize.js.map +1 -1
- package/app-layout/visual-refresh/context.d.ts +3 -2
- package/app-layout/visual-refresh/context.d.ts.map +1 -1
- package/app-layout/visual-refresh/context.js +4 -1
- package/app-layout/visual-refresh/context.js.map +1 -1
- package/app-layout/visual-refresh/layout.d.ts.map +1 -1
- package/app-layout/visual-refresh/layout.js +2 -1
- package/app-layout/visual-refresh/layout.js.map +1 -1
- package/app-layout/visual-refresh/mobile-toolbar.d.ts.map +1 -1
- package/app-layout/visual-refresh/mobile-toolbar.js +4 -2
- package/app-layout/visual-refresh/mobile-toolbar.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +78 -77
- package/app-layout/visual-refresh/styles.scoped.css +168 -165
- package/app-layout/visual-refresh/styles.selectors.js +78 -77
- package/area-chart/elements/chart-popover.d.ts.map +1 -1
- package/area-chart/elements/chart-popover.js +2 -2
- package/area-chart/elements/chart-popover.js.map +1 -1
- package/area-chart/styles.css.js +6 -6
- package/area-chart/styles.scoped.css +10 -10
- package/area-chart/styles.selectors.js +6 -6
- package/cards/index.d.ts.map +1 -1
- package/cards/index.js +12 -4
- package/cards/index.js.map +1 -1
- package/cards/interfaces.d.ts +5 -0
- package/cards/interfaces.d.ts.map +1 -1
- package/cards/interfaces.js.map +1 -1
- package/{internal/components/drawer → drawer}/index.d.ts +1 -0
- package/drawer/index.d.ts.map +1 -0
- package/{internal/components/drawer → drawer}/index.js +10 -6
- package/drawer/index.js.map +1 -0
- package/{internal/components/drawer → drawer}/interfaces.d.ts +1 -1
- package/drawer/interfaces.d.ts.map +1 -0
- package/drawer/interfaces.js.map +1 -0
- package/{internal/components/drawer → drawer}/styles.css.js +3 -3
- package/{internal/components/drawer → drawer}/styles.scoped.css +8 -8
- package/{internal/components/drawer → drawer}/styles.selectors.js +3 -3
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internal/components/chart-popover-footer/index.d.ts +5 -0
- package/internal/components/chart-popover-footer/index.d.ts.map +1 -0
- package/internal/components/chart-popover-footer/index.js +8 -0
- package/internal/components/chart-popover-footer/index.js.map +1 -0
- package/internal/components/chart-popover-footer/styles.css.js +6 -0
- package/internal/components/chart-popover-footer/styles.scoped.css +17 -0
- package/internal/components/chart-popover-footer/styles.selectors.js +7 -0
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/mixed-line-bar-chart/chart-popover.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-popover.js +2 -2
- package/mixed-line-bar-chart/chart-popover.js.map +1 -1
- package/package.json +2 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +2 -1
- package/pie-chart/pie-chart.js.map +1 -1
- package/test-utils/dom/drawer/index.d.ts +6 -0
- package/test-utils/dom/drawer/index.js +17 -0
- package/test-utils/dom/drawer/index.js.map +1 -0
- package/test-utils/dom/index.d.ts +3 -0
- package/test-utils/dom/index.js +10 -2
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/selectors/drawer/index.d.ts +6 -0
- package/test-utils/selectors/drawer/index.js +17 -0
- package/test-utils/selectors/drawer/index.js.map +1 -0
- package/test-utils/selectors/index.d.ts +3 -0
- package/test-utils/selectors/index.js +10 -2
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/internal/components/drawer/index.d.ts.map +0 -1
- package/internal/components/drawer/index.js.map +0 -1
- package/internal/components/drawer/interfaces.d.ts.map +0 -1
- package/internal/components/drawer/interfaces.js.map +0 -1
- /package/{internal/components/drawer → drawer}/interfaces.js +0 -0
|
@@ -2,82 +2,83 @@
|
|
|
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-mobile-triggers-container": "awsui_drawers-mobile-triggers-
|
|
17
|
-
"drawers-trigger-content": "awsui_drawers-trigger-
|
|
18
|
-
"drawers-trigger-overflow": "awsui_drawers-trigger-
|
|
19
|
-
"drawers-trigger": "awsui_drawers-
|
|
20
|
-
"drawer": "
|
|
21
|
-
"drawer-content-container": "awsui_drawer-content-
|
|
22
|
-
"drawer-close-button": "awsui_drawer-close-
|
|
23
|
-
"drawer-content": "awsui_drawer-
|
|
24
|
-
"drawer-content-hidden": "awsui_drawer-content-
|
|
25
|
-
"drawer-slider": "awsui_drawer-
|
|
26
|
-
"is-drawer-open": "awsui_is-drawer-
|
|
27
|
-
"content": "
|
|
28
|
-
"layout": "
|
|
29
|
-
"has-max-content-width": "awsui_has-max-content-
|
|
30
|
-
"content-type-dashboard": "awsui_content-type-
|
|
31
|
-
"is-overlap-disabled": "awsui_is-overlap-
|
|
32
|
-
"
|
|
33
|
-
"has-content-gap-
|
|
34
|
-
"content-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"split-panel
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"is-
|
|
47
|
-
"is-
|
|
48
|
-
"split-panel-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"mobile-toolbar
|
|
52
|
-
"mobile-toolbar-
|
|
53
|
-
"mobile-toolbar-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"tools": "
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"trigger": "
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
5
|
+
"background": "awsui_background_hyvsj_ae7i0_93",
|
|
6
|
+
"scrolling-background": "awsui_scrolling-background_hyvsj_ae7i0_96",
|
|
7
|
+
"sticky-background": "awsui_sticky-background_hyvsj_ae7i0_102",
|
|
8
|
+
"has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_ae7i0_110",
|
|
9
|
+
"breadcrumbs": "awsui_breadcrumbs_hyvsj_ae7i0_123",
|
|
10
|
+
"has-sticky-background": "awsui_has-sticky-background_hyvsj_ae7i0_133",
|
|
11
|
+
"drawers-container": "awsui_drawers-container_hyvsj_ae7i0_145",
|
|
12
|
+
"has-open-drawer": "awsui_has-open-drawer_hyvsj_ae7i0_156",
|
|
13
|
+
"disable-body-scroll": "awsui_disable-body-scroll_hyvsj_ae7i0_180",
|
|
14
|
+
"drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_ae7i0_185",
|
|
15
|
+
"has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_ae7i0_204",
|
|
16
|
+
"drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_ae7i0_214",
|
|
17
|
+
"drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_ae7i0_218",
|
|
18
|
+
"drawers-trigger-overflow": "awsui_drawers-trigger-overflow_hyvsj_ae7i0_232",
|
|
19
|
+
"drawers-trigger": "awsui_drawers-trigger_hyvsj_ae7i0_218",
|
|
20
|
+
"drawer": "awsui_drawer_hyvsj_ae7i0_145",
|
|
21
|
+
"drawer-content-container": "awsui_drawer-content-container_hyvsj_ae7i0_262",
|
|
22
|
+
"drawer-close-button": "awsui_drawer-close-button_hyvsj_ae7i0_271",
|
|
23
|
+
"drawer-content": "awsui_drawer-content_hyvsj_ae7i0_262",
|
|
24
|
+
"drawer-content-hidden": "awsui_drawer-content-hidden_hyvsj_ae7i0_279",
|
|
25
|
+
"drawer-slider": "awsui_drawer-slider_hyvsj_ae7i0_282",
|
|
26
|
+
"is-drawer-open": "awsui_is-drawer-open_hyvsj_ae7i0_289",
|
|
27
|
+
"content": "awsui_content_hyvsj_ae7i0_314",
|
|
28
|
+
"layout": "awsui_layout_hyvsj_ae7i0_335",
|
|
29
|
+
"has-max-content-width": "awsui_has-max-content-width_hyvsj_ae7i0_418",
|
|
30
|
+
"content-type-dashboard": "awsui_content-type-dashboard_hyvsj_ae7i0_433",
|
|
31
|
+
"is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_ae7i0_450",
|
|
32
|
+
"is-hide-mobile-toolbar": "awsui_is-hide-mobile-toolbar_hyvsj_ae7i0_453",
|
|
33
|
+
"has-content-gap-left": "awsui_has-content-gap-left_hyvsj_ae7i0_485",
|
|
34
|
+
"has-content-gap-right": "awsui_has-content-gap-right_hyvsj_ae7i0_488",
|
|
35
|
+
"content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_ae7i0_498",
|
|
36
|
+
"has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_ae7i0_501",
|
|
37
|
+
"content-first-child-header": "awsui_content-first-child-header_hyvsj_ae7i0_504",
|
|
38
|
+
"has-header": "awsui_has-header_hyvsj_ae7i0_504",
|
|
39
|
+
"content-first-child-main": "awsui_content-first-child-main_hyvsj_ae7i0_525",
|
|
40
|
+
"disable-content-paddings": "awsui_disable-content-paddings_hyvsj_ae7i0_525",
|
|
41
|
+
"has-split-panel": "awsui_has-split-panel_hyvsj_ae7i0_568",
|
|
42
|
+
"split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_ae7i0_568",
|
|
43
|
+
"block-body-scroll": "awsui_block-body-scroll_hyvsj_ae7i0_584",
|
|
44
|
+
"unfocusable": "awsui_unfocusable_hyvsj_ae7i0_589",
|
|
45
|
+
"container": "awsui_container_hyvsj_ae7i0_599",
|
|
46
|
+
"is-navigation-open": "awsui_is-navigation-open_hyvsj_ae7i0_624",
|
|
47
|
+
"is-tools-open": "awsui_is-tools-open_hyvsj_ae7i0_627",
|
|
48
|
+
"is-split-panel-open": "awsui_is-split-panel-open_hyvsj_ae7i0_627",
|
|
49
|
+
"split-panel-position-side": "awsui_split-panel-position-side_hyvsj_ae7i0_627",
|
|
50
|
+
"has-active-drawer": "awsui_has-active-drawer_hyvsj_ae7i0_627",
|
|
51
|
+
"mobile-toolbar": "awsui_mobile-toolbar_hyvsj_ae7i0_636",
|
|
52
|
+
"mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_ae7i0_652",
|
|
53
|
+
"mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_ae7i0_656",
|
|
54
|
+
"mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_ae7i0_660",
|
|
55
|
+
"navigation-container": "awsui_navigation-container_hyvsj_ae7i0_669",
|
|
56
|
+
"show-navigation": "awsui_show-navigation_hyvsj_ae7i0_713",
|
|
57
|
+
"animating": "awsui_animating_hyvsj_ae7i0_735",
|
|
58
|
+
"showButtons": "awsui_showButtons_hyvsj_ae7i0_1",
|
|
59
|
+
"navigation": "awsui_navigation_hyvsj_ae7i0_669",
|
|
60
|
+
"openNavigation": "awsui_openNavigation_hyvsj_ae7i0_1",
|
|
61
|
+
"animated-content": "awsui_animated-content_hyvsj_ae7i0_797",
|
|
62
|
+
"hide-navigation": "awsui_hide-navigation_hyvsj_ae7i0_806",
|
|
63
|
+
"notifications": "awsui_notifications_hyvsj_ae7i0_816",
|
|
64
|
+
"sticky-notifications": "awsui_sticky-notifications_hyvsj_ae7i0_822",
|
|
65
|
+
"split-panel-bottom": "awsui_split-panel-bottom_hyvsj_ae7i0_839",
|
|
66
|
+
"position-bottom": "awsui_position-bottom_hyvsj_ae7i0_886",
|
|
67
|
+
"openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_ae7i0_1",
|
|
68
|
+
"split-panel-side": "awsui_split-panel-side_hyvsj_ae7i0_915",
|
|
69
|
+
"position-side": "awsui_position-side_hyvsj_ae7i0_928",
|
|
70
|
+
"tools-container": "awsui_tools-container_hyvsj_ae7i0_947",
|
|
71
|
+
"tools": "awsui_tools_hyvsj_ae7i0_947",
|
|
72
|
+
"openTools": "awsui_openTools_hyvsj_ae7i0_1",
|
|
73
|
+
"has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_ae7i0_1042",
|
|
74
|
+
"hide-tools": "awsui_hide-tools_hyvsj_ae7i0_1052",
|
|
75
|
+
"show-tools": "awsui_show-tools_hyvsj_ae7i0_1064",
|
|
76
|
+
"has-tools-form": "awsui_has-tools-form_hyvsj_ae7i0_1042",
|
|
77
|
+
"trigger-badge-wrapper": "awsui_trigger-badge-wrapper_hyvsj_ae7i0_1124",
|
|
78
|
+
"trigger": "awsui_trigger_hyvsj_ae7i0_1124",
|
|
79
|
+
"selected": "awsui_selected_hyvsj_ae7i0_1188",
|
|
80
|
+
"badge": "awsui_badge_hyvsj_ae7i0_1208",
|
|
81
|
+
"trigger-wrapper": "awsui_trigger-wrapper_hyvsj_ae7i0_1212",
|
|
82
|
+
"dot": "awsui_dot_hyvsj_ae7i0_1218"
|
|
82
83
|
};
|
|
83
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-popover.d.ts","sourceRoot":"lib/default/","sources":["area-chart/elements/chart-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-popover.d.ts","sourceRoot":"lib/default/","sources":["area-chart/elements/chart-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,SAAS,cAAc,CAAC,SAAS,EAAE,EAC3E,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACrB,gBAAgB,EAAE,IAAI,GAAG,gBAAgB,CAAC;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC5C,sBA6BA"}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import ChartPopover from '../../internal/components/chart-popover';
|
|
5
5
|
import ChartSeriesDetails from '../../internal/components/chart-series-details';
|
|
6
|
-
import InternalBox from '../../box/internal';
|
|
7
6
|
import styles from '../styles.css.js';
|
|
7
|
+
import ChartPopoverFooter from '../../internal/components/chart-popover-footer';
|
|
8
8
|
export default function AreaChartPopover({ model, highlightDetails, dismissAriaLabel, footer, size, onBlur, }) {
|
|
9
9
|
if (!highlightDetails) {
|
|
10
10
|
return null;
|
|
@@ -22,6 +22,6 @@ export default function AreaChartPopover({ model, highlightDetails, dismissAriaL
|
|
|
22
22
|
React.createElement(ChartSeriesDetails, { details: highlightDetails.seriesDetails }),
|
|
23
23
|
React.createElement("div", { className: styles['popover-divider'] }),
|
|
24
24
|
React.createElement(ChartSeriesDetails, { details: highlightDetails.totalDetails }),
|
|
25
|
-
footer && React.createElement(
|
|
25
|
+
footer && React.createElement(ChartPopoverFooter, null, footer)));
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=chart-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-popover.js","sourceRoot":"lib/default/","sources":["area-chart/elements/chart-popover.tsx"],"names":[],"mapp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BAAgB,CAAC,aAAa,GAAI;QAC/D,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,GAAI;QAC7C,oBAAC,kBAAkB,IAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,GAAI;QAC7D,MAAM,IAAI,oBAAC,kBAAkB,QAAE,MAAM,CAAsB,CAC/C,CAChB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport ChartPopover from '../../internal/components/chart-popover';\nimport ChartSeriesDetails from '../../internal/components/chart-series-details';\n\nimport { AreaChartProps } from '../interfaces';\nimport { ChartModel } from '../model';\nimport styles from '../styles.css.js';\nimport { HighlightDetails } from './use-highlight-details';\nimport ChartPopoverFooter from '../../internal/components/chart-popover-footer';\n\nexport default function AreaChartPopover<T extends AreaChartProps.DataTypes>({\n model,\n highlightDetails,\n dismissAriaLabel,\n footer,\n size,\n onBlur,\n}: {\n model: ChartModel<T>;\n highlightDetails: null | HighlightDetails;\n dismissAriaLabel?: string;\n footer?: React.ReactNode;\n size?: 'small' | 'medium' | 'large';\n onBlur?: (event: React.FocusEvent) => void;\n}) {\n if (!highlightDetails) {\n return null;\n }\n\n const popoverProps = {\n title: highlightDetails.formattedX,\n trackRef: model.refs.verticalMarker,\n trackKey: highlightDetails.highlightIndex,\n dismissButton: highlightDetails.isPopoverPinned,\n onDismiss: model.handlers.onPopoverDismiss,\n onMouseLeave: model.handlers.onPopoverLeave,\n ref: model.refs.popoverRef,\n };\n\n return (\n <ChartPopover\n {...popoverProps}\n container={model.refs.container.current}\n dismissAriaLabel={dismissAriaLabel}\n size={size}\n onBlur={onBlur}\n >\n <ChartSeriesDetails details={highlightDetails.seriesDetails} />\n <div className={styles['popover-divider']} />\n <ChartSeriesDetails details={highlightDetails.totalDetails} />\n {footer && <ChartPopoverFooter>{footer}</ChartPopoverFooter>}\n </ChartPopover>\n );\n}\n"]}
|
package/area-chart/styles.css.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"series": "
|
|
5
|
-
"root": "
|
|
6
|
-
"series--highlighted": "awsui_series--
|
|
7
|
-
"series--dimmed": "awsui_series--
|
|
8
|
-
"series--threshold": "awsui_series--
|
|
9
|
-
"popover-divider": "awsui_popover-
|
|
4
|
+
"series": "awsui_series_y1yrh_1pspp_93",
|
|
5
|
+
"root": "awsui_root_y1yrh_1pspp_111",
|
|
6
|
+
"series--highlighted": "awsui_series--highlighted_y1yrh_1pspp_123",
|
|
7
|
+
"series--dimmed": "awsui_series--dimmed_y1yrh_1pspp_127",
|
|
8
|
+
"series--threshold": "awsui_series--threshold_y1yrh_1pspp_131",
|
|
9
|
+
"popover-divider": "awsui_popover-divider_y1yrh_1pspp_136"
|
|
10
10
|
};
|
|
11
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_1pspp_93 > rect:not(#\9) {
|
|
94
94
|
transition: opacity var(--motion-duration-transition-quick-6npj01, 90ms) var(--motion-easing-transition-quick-l9jfsx, linear);
|
|
95
95
|
}
|
|
96
96
|
@media (prefers-reduced-motion: reduce) {
|
|
97
|
-
.
|
|
97
|
+
.awsui_series_y1yrh_1pspp_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_1pspp_93 > rect:not(#\9), .awsui-mode-entering .awsui_series_y1yrh_1pspp_93 > rect:not(#\9) {
|
|
103
103
|
animation: none;
|
|
104
104
|
transition: none;
|
|
105
105
|
}
|
|
@@ -108,11 +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
|
-
.
|
|
111
|
+
.awsui_root_y1yrh_1pspp_111:not(#\9) {
|
|
112
112
|
/* used in test-utils */
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
.
|
|
115
|
+
.awsui_series_y1yrh_1pspp_93:not(#\9) {
|
|
116
116
|
display: block;
|
|
117
117
|
stroke-width: var(--border-line-chart-width-9mzos2, 2px);
|
|
118
118
|
fill: none;
|
|
@@ -120,20 +120,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
120
120
|
stroke-linejoin: var(--border-line-chart-line-join-hdz0jf, round);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
.awsui_series--
|
|
123
|
+
.awsui_series--highlighted_y1yrh_1pspp_123:not(#\9) {
|
|
124
124
|
/* used in test-utils */
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.awsui_series--
|
|
127
|
+
.awsui_series--dimmed_y1yrh_1pspp_127:not(#\9) {
|
|
128
128
|
opacity: 0.3;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
.awsui_series--
|
|
131
|
+
.awsui_series--threshold_y1yrh_1pspp_131:not(#\9) {
|
|
132
132
|
stroke-dasharray: var(--border-line-chart-dash-array-k49cgz, 3 5);
|
|
133
133
|
stroke-width: var(--border-line-chart-width-9mzos2, 2px);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
.awsui_popover-
|
|
137
|
-
margin: var(--space-
|
|
136
|
+
.awsui_popover-divider_y1yrh_1pspp_136:not(#\9) {
|
|
137
|
+
margin: var(--space-xs-zb16t3, 8px) 0;
|
|
138
138
|
border-bottom: var(--border-divider-section-width-8a5uu9, 2px) solid var(--color-border-divider-default-et9j7s, #e9ebed);
|
|
139
139
|
}
|
|
@@ -2,11 +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
|
-
"series--highlighted": "awsui_series--
|
|
8
|
-
"series--dimmed": "awsui_series--
|
|
9
|
-
"series--threshold": "awsui_series--
|
|
10
|
-
"popover-divider": "awsui_popover-
|
|
5
|
+
"series": "awsui_series_y1yrh_1pspp_93",
|
|
6
|
+
"root": "awsui_root_y1yrh_1pspp_111",
|
|
7
|
+
"series--highlighted": "awsui_series--highlighted_y1yrh_1pspp_123",
|
|
8
|
+
"series--dimmed": "awsui_series--dimmed_y1yrh_1pspp_127",
|
|
9
|
+
"series--threshold": "awsui_series--threshold_y1yrh_1pspp_131",
|
|
10
|
+
"popover-divider": "awsui_popover-divider_y1yrh_1pspp_136"
|
|
11
11
|
};
|
|
12
12
|
|
package/cards/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBAmKc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
|
package/cards/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { AnalyticsFunnelSubStep } from '../internal/analytics/components/analyti
|
|
|
26
26
|
import { CollectionLabelContext } from '../internal/context/collection-label-context';
|
|
27
27
|
import { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';
|
|
28
28
|
const Cards = React.forwardRef(function (_a, ref) {
|
|
29
|
-
var { items = [], cardDefinition, cardsPerRow = [], header, filter, pagination, preferences, empty, loading, loadingText, trackBy, selectedItems, selectionType, isItemDisabled, onSelectionChange, ariaLabels, visibleSections, stickyHeader, stickyHeaderVerticalOffset, variant = 'container', renderAriaLive, firstIndex, totalItemsCount } = _a, rest = __rest(_a, ["items", "cardDefinition", "cardsPerRow", "header", "filter", "pagination", "preferences", "empty", "loading", "loadingText", "trackBy", "selectedItems", "selectionType", "isItemDisabled", "onSelectionChange", "ariaLabels", "visibleSections", "stickyHeader", "stickyHeaderVerticalOffset", "variant", "renderAriaLive", "firstIndex", "totalItemsCount"]);
|
|
29
|
+
var { items = [], cardDefinition, cardsPerRow = [], header, filter, pagination, preferences, empty, loading, loadingText, trackBy, selectedItems, selectionType, isItemDisabled, onSelectionChange, ariaLabels, visibleSections, stickyHeader, stickyHeaderVerticalOffset, variant = 'container', renderAriaLive, firstIndex, totalItemsCount, entireCardClickable } = _a, rest = __rest(_a, ["items", "cardDefinition", "cardsPerRow", "header", "filter", "pagination", "preferences", "empty", "loading", "loadingText", "trackBy", "selectedItems", "selectionType", "isItemDisabled", "onSelectionChange", "ariaLabels", "visibleSections", "stickyHeader", "stickyHeaderVerticalOffset", "variant", "renderAriaLive", "firstIndex", "totalItemsCount", "entireCardClickable"]);
|
|
30
30
|
const { __internalRootRef } = useBaseComponent('Cards');
|
|
31
31
|
const baseProps = getBaseProps(rest);
|
|
32
32
|
const isRefresh = useVisualRefresh();
|
|
@@ -91,11 +91,12 @@ const Cards = React.forwardRef(function (_a, ref) {
|
|
|
91
91
|
React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences })))), footer: hasFooterPagination && React.createElement("div", { className: styles['footer-pagination'] }, pagination), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef, __darkHeader: computedVariant === 'full-page', __disableFooterDivider: true },
|
|
92
92
|
React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header']) },
|
|
93
93
|
!!renderAriaLive && !!firstIndex && (React.createElement(LiveRegion, null,
|
|
94
|
-
React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus, ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.cardsLabel, ariaLabelledby: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined }))))))));
|
|
94
|
+
React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))), status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus, ariaLabel: ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.cardsLabel, ariaLabelledby: isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined, entireCardClickable: entireCardClickable }))))))));
|
|
95
95
|
});
|
|
96
96
|
export default Cards;
|
|
97
|
-
const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections, updateShiftToggle, onFocus, ariaLabelledby, ariaLabel, }) => {
|
|
97
|
+
const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isItemSelected, getItemSelectionProps, visibleSections, updateShiftToggle, onFocus, ariaLabelledby, ariaLabel, entireCardClickable, }) => {
|
|
98
98
|
const selectable = !!selectionType;
|
|
99
|
+
const canClickEntireCard = selectable && entireCardClickable;
|
|
99
100
|
const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);
|
|
100
101
|
let visibleSectionsDefinition = cardDefinition.sections || [];
|
|
101
102
|
visibleSectionsDefinition = visibleSections
|
|
@@ -111,7 +112,14 @@ const CardsList = ({ items, cardDefinition, trackBy, selectionType, columns, isI
|
|
|
111
112
|
[styles['card-selectable']]: selectable,
|
|
112
113
|
[styles['card-selected']]: selectable && isItemSelected(item),
|
|
113
114
|
}), key: getItemKey(trackBy, item, index), onFocus: onFocus }, (focusMarkers && focusMarkers.item), { role: listItemRole }),
|
|
114
|
-
React.createElement("div", { className: styles['card-inner']
|
|
115
|
+
React.createElement("div", { className: styles['card-inner'], onClick: canClickEntireCard
|
|
116
|
+
? event => {
|
|
117
|
+
var _a;
|
|
118
|
+
getItemSelectionProps(item).onChange();
|
|
119
|
+
// Manually move focus to the native input (checkbox or radio button)
|
|
120
|
+
(_a = event.currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus();
|
|
121
|
+
}
|
|
122
|
+
: undefined },
|
|
115
123
|
React.createElement("div", { className: styles['card-header'] },
|
|
116
124
|
React.createElement("div", { className: styles['card-header-inner'] }, cardDefinition.header ? cardDefinition.header(item) : ''),
|
|
117
125
|
selectable && (React.createElement("div", { className: styles['selection-control'] },
|
package/cards/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,M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N,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex,\n totalItemsCount,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards');\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div className={clsx(hasToolsHeader && styles['has-header'])}>\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n}: Pick<CardsProps<T>, 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections'> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div className={styles['card-inner']}>\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE3F,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAEhB,YAAY,EACZ,qBAAqB,EACrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAA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mBAAmB,CAAC,IACxC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CACrD;gBACL,UAAU,IAAI,CACb,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBACzC,oBAAC,gBAAgB,kBACf,WAAW,EAAE,aAAa,EAC1B,SAAS,EAAE,WAAW,EACtB,aAAa,EAAE,iBAAiB,IAC5B,qBAAqB,CAAC,IAAI,CAAC,EAC/B,CACE,CACP,CACG;YACL,yBAAyB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9E,6BAAK,GAAG,EAAE,EAAE,IAAI,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE;gBAC5E,MAAM,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,MAAM,CAAO,CAAC,CAAC,CAAC,EAAE;gBACtE,OAAO,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { getBaseProps } from '../internal/base-component';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport {\n SelectionControl,\n SelectionControlProps,\n focusMarkers,\n useSelectionFocusMove,\n useSelection,\n} from '../table/selection';\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport LiveRegion from '../internal/components/live-region';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { supportsStickyPosition } from '../internal/utils/dom';\nimport { useInternalI18n } from '../i18n/context';\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards');\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps, updateShiftToggle } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = supportsStickyPosition() && !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <LiveRegion visible={true}>{loadingText}</LiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __darkHeader={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div className={clsx(hasToolsHeader && styles['has-header'])}>\n {!!renderAriaLive && !!firstIndex && (\n <LiveRegion>\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </LiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n updateShiftToggle={updateShiftToggle}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n updateShiftToggle,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps: (item: T) => SelectionControlProps;\n updateShiftToggle: (state: boolean) => void;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={styles['card-inner']}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {selectable && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n onShiftToggle={updateShiftToggle}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
|
package/cards/interfaces.d.ts
CHANGED
|
@@ -185,6 +185,11 @@ export interface CardsProps<T = any> extends BaseComponentProps {
|
|
|
185
185
|
* @visualrefresh `full-page` variant
|
|
186
186
|
*/
|
|
187
187
|
variant?: 'container' | 'full-page';
|
|
188
|
+
/**
|
|
189
|
+
* Activating this property makes the entire card clickable to select it.
|
|
190
|
+
* Don't use this property if the card has any other interactive elements.
|
|
191
|
+
*/
|
|
192
|
+
entireCardClickable?: boolean;
|
|
188
193
|
}
|
|
189
194
|
export declare namespace CardsProps {
|
|
190
195
|
interface CardDefinition<T> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["cards/interfaces.tsx"],"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,mBAAmB;IAClC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG;QAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CAC9E;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,kBAAkB;IAC7D;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB;;OAEG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C;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,GAAG;QAClB;;;WAGG;QACH,WAAW,IAAI,IAAI,CAAC;KACrB;CACF"}
|
package/cards/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["cards/interfaces.tsx"],"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 CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined. */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n * If the cards list has no pagination, leave this property undefined. */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * Requires the properties firstIndex and totalItemsCount to be set correctly.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n totalItemsCount?: number;\n firstIndex: number;\n lastIndex: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["cards/interfaces.tsx"],"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 CardsForwardRefType {\n <T>(props: CardsProps<T> & { ref?: React.Ref<CardsProps.Ref> }): JSX.Element;\n}\n\nexport interface CardsProps<T = any> extends BaseComponentProps {\n /**\n * Displayed only when the list of items is empty.\n */\n empty?: React.ReactNode;\n\n /**\n * Heading element of the table container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Use this slot to add filtering controls to the component.\n */\n filter?: React.ReactNode;\n\n /**\n * Use this slot to add the [pagination component](/components/pagination/) to the component.\n */\n pagination?: React.ReactNode;\n\n /**\n * Use this slot to add [collection preferences](/components/collection-preferences/) to the component.\n */\n preferences?: React.ReactNode;\n\n /**\n * Specifies the items that serve as data source for a card.\n *\n * The `cardDefinition` property handles the display of this data.\n */\n items: ReadonlyArray<T>;\n\n /**\n * Renders the cards in a loading state. We recommend that you also set a `loadingText`.\n */\n loading?: boolean;\n\n /**\n * Specifies the text to display when in loading state.\n */\n loadingText?: string;\n\n /**\n * Defines what to display in each card. It has the following properties:\n * * `header` ((item) => ReactNode) - Responsible for displaying the card header. You receive the current item as an argument.\n * Use `fontSize=\"inherit\"` on [link](/components/link/) components inside card header.\n * * `sections` (array) - Responsible for displaying the card content. Cards can have many sections in their\n * body. Each entry in the array is responsible for displaying a section. An entry has the following properties:\n * * `id`: (string) - A unique identifier for the section. The property is used as a [keys](https://reactjs.org/docs/lists-and-keys.html#keys)\n * source for React rendering, and to match entries in the `visibleSections` property (if it's defined).\n * * `header`: (ReactNode) - Responsible for displaying the section header.\n * * `content`: ((item) => ReactNode) - Responsible for displaying the section content. You receive the current item as an argument.\n * * `width`: (number) - Specifies the width of the card section in percent. Use this to display multiple sections in\n * the same row. The default value is 100%.\n *\n * All of the above properties are optional.\n */\n cardDefinition: CardsProps.CardDefinition<T>;\n /**\n * Determines the number of cards per row for any interval of container width.\n * It's an array whose entries are objects containing the following:\n * - `cards` (number) - Specifies the number of cards per row.\n * - `minWidth` (number) - Specifies the minimum container width (in pixels) for which this configuration object should apply.\n *\n * For example, with this configuration:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 500,\n * cards: 2\n * }, {\n * minWidth: 800,\n * cards: 3\n * }]\n * ```\n *\n * the cards component displays:\n * * 1 card per row when the container width is below 500px.\n * * 2 cards per row when the container width is between 500px and 799px.\n * * 3 cards per row when the container width is 800px or wider.\n *\n * The number of cards per row can't be greater than 20.\n *\n * Default value:\n * ```\n * [{\n * cards: 1\n * }, {\n * minWidth: 768,\n * cards: 2\n * }, {\n * minWidth: 992,\n * cards: 3\n * }, {\n * minWidth: 1200,\n * cards: 4\n * }, {\n * minWidth: 1400,\n * cards: 5\n * }, {\n * minWidth: 1920,\n * cards: 6\n * }]\n * ```\n */\n cardsPerRow?: ReadonlyArray<CardsProps.CardsLayout>;\n /**\n * Specifies the property inside items that uniquely identifies them.\n * When it's set, it's used to provide [keys for React](https://reactjs.org/docs/lists-and-keys.html#keys)\n * for performance optimizations.\n *\n * It's also used for connecting `items` and `selectedItems` values when they don't reference the same object.\n */\n trackBy?: CardsProps.TrackBy<T>;\n /**\n * Specifies the selection mode. It can be either `single` or `multi`.\n */\n selectionType?: CardsProps.SelectionType;\n /**\n * Specifies the list of selected items.\n */\n selectedItems?: ReadonlyArray<T>;\n /**\n * Determines which items are disabled. If an item is disabled, users can't select it.\n */\n isItemDisabled?: CardsProps.IsItemDisabled<T>;\n /**\n * Adds labels to the selection components (checkboxes and radio buttons) as follows:\n * * `itemSelectionLabel` ((SelectionState, Item) => string) - Determines the label for an item.\n * * `selectionGroupLabel` (string) - Specifies the label for the group selection control.\n * * `cardsLabel` (string) - Provides alternative text for the cards list.\n * By default the contents of the `header` are used.\n *\n * You can use the first arguments of type `SelectionState` to access the current selection\n * state of the component (for example, the `selectedItems` list). The label function for individual\n * items also receives the corresponding `Item` object. You can use the group label to\n * add a meaningful description to the whole selection.\n * @i18n\n */\n ariaLabels?: CardsProps.AriaLabels<T>;\n /**\n * Specifies an array containing the `id` of each visible section. If not set, all sections are displayed.\n *\n * Use it in conjunction with the visible content preference of the [collection preferences](/components/collection-preferences/) component.\n *\n * The order of `id`s doesn't influence the order of display of sections, which is controlled by the `cardDefinition` property.\n */\n visibleSections?: ReadonlyArray<string>;\n /**\n * Called when a user interaction causes a change in the list of selected items.\n * The event `detail` contains the current list of `selectedItems`.\n */\n onSelectionChange?: NonCancelableEventHandler<CardsProps.SelectionChangeDetail<T>>;\n /**\n * If set to true, the cards header remains visible when the user scrolls down.\n */\n stickyHeader?: boolean;\n /**\n * Optionally provide a vertical offset (in pixels) for the sticky header, for example if you\n * need to position the sticky header below other fixed position elements on the page.\n */\n stickyHeaderVerticalOffset?: number;\n\n /**\n * Use this property to inform screen readers how many cards there are.\n * It specifies the total number of cards.\n * If there is an unknown total number of cards, leave this property undefined. */\n totalItemsCount?: number;\n /**\n * Use this property to inform screen readers which range of cards is currently displayed.\n * It specifies the index (1-based) of the first card.\n * If the cards list has no pagination, leave this property undefined. */\n firstIndex?: number;\n /**\n * Use this function to announce page changes to screen reader users.\n * Requires the properties firstIndex and totalItemsCount to be set correctly.\n */\n renderAriaLive?: (data: CardsProps.LiveAnnouncement) => string;\n\n /**\n * Specify a cards variant with one of the following:\n * * `container` - Use this variant to have the cards displayed as a container.\n * * `full-page` – Use this variant when cards are the entire content of a page. Full page variants\n * implement the high contrast header and content behavior automatically.\n * @visualrefresh `full-page` variant\n */\n variant?: 'container' | 'full-page';\n\n /**\n * Activating this property makes the entire card clickable to select it.\n * Don't use this property if the card has any other interactive elements.\n */\n entireCardClickable?: boolean;\n}\n\nexport namespace CardsProps {\n export interface CardDefinition<T> {\n header?(item: T): React.ReactNode;\n sections?: ReadonlyArray<SectionDefinition<T>>;\n }\n\n export interface SectionDefinition<T> {\n id?: string;\n header?: React.ReactNode;\n content?(item: T): React.ReactNode;\n width?: number;\n }\n\n export interface CardsLayout {\n cards: number;\n minWidth?: number;\n }\n\n export type TrackBy<T> = string | ((item: T) => string);\n\n export type SelectionType = 'single' | 'multi';\n\n export interface SelectionState<T> {\n selectedItems: ReadonlyArray<T>;\n }\n\n export interface SelectionChangeDetail<T> {\n selectedItems: T[];\n }\n\n export type IsItemDisabled<T> = (item: T) => boolean;\n\n export interface AriaLabels<T> {\n itemSelectionLabel: (data: CardsProps.SelectionState<T>, row: T) => string;\n selectionGroupLabel: string;\n cardsLabel?: string;\n }\n\n export interface LiveAnnouncement {\n totalItemsCount?: number;\n firstIndex: number;\n lastIndex: number;\n }\n\n export interface Ref {\n /**\n * When the sticky header is enabled, calling this function scrolls cards's\n * scroll parent up to reveal the first card or row of cards.\n */\n scrollToTop(): void;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["drawer/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,EAAE,WAAW,eAoBnG"}
|
|
@@ -3,20 +3,24 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { getBaseProps } from '
|
|
7
|
-
import InternalStatusIndicator from '
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import InternalStatusIndicator from '../status-indicator/internal';
|
|
8
8
|
import styles from './styles.css.js';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
10
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
11
|
+
import LiveRegion from '../internal/components/live-region';
|
|
12
|
+
import { useInternalI18n } from '../i18n/context';
|
|
11
13
|
export default function Drawer(_a) {
|
|
12
14
|
var { header, children, loading, i18nStrings } = _a, restProps = __rest(_a, ["header", "children", "loading", "i18nStrings"]);
|
|
15
|
+
const { __internalRootRef } = useBaseComponent('Drawer');
|
|
13
16
|
const baseProps = getBaseProps(restProps);
|
|
14
17
|
const i18n = useInternalI18n('drawer');
|
|
15
18
|
const containerProps = Object.assign(Object.assign({}, baseProps), { className: clsx(baseProps.className, styles.drawer) });
|
|
16
|
-
return loading ? (React.createElement("div", Object.assign({}, containerProps),
|
|
19
|
+
return loading ? (React.createElement("div", Object.assign({}, containerProps, { ref: __internalRootRef }),
|
|
17
20
|
React.createElement(InternalStatusIndicator, { type: "loading" },
|
|
18
|
-
React.createElement(LiveRegion, { visible: true }, i18n('i18nStrings.loadingText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.loadingText))))) : (React.createElement("div", Object.assign({}, containerProps),
|
|
21
|
+
React.createElement(LiveRegion, { visible: true }, i18n('i18nStrings.loadingText', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.loadingText))))) : (React.createElement("div", Object.assign({}, containerProps, { ref: __internalRootRef }),
|
|
19
22
|
header && React.createElement("div", { className: clsx(styles.header) }, header),
|
|
20
23
|
React.createElement("div", { className: clsx(styles['test-utils-drawer-content']) }, children)));
|
|
21
24
|
}
|
|
25
|
+
applyDisplayName(Drawer, 'Drawer');
|
|
22
26
|
//# sourceMappingURL=index.js.map
|