@cloudscape-design/components 3.0.304 → 3.0.306
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/column-layout/flexible-column-layout/index.d.ts +9 -0
- package/column-layout/flexible-column-layout/index.d.ts.map +1 -0
- package/column-layout/flexible-column-layout/index.js +33 -0
- package/column-layout/flexible-column-layout/index.js.map +1 -0
- package/column-layout/flexible-column-layout/styles.css.js +10 -0
- package/column-layout/flexible-column-layout/styles.scoped.css +24 -0
- package/column-layout/flexible-column-layout/styles.selectors.js +11 -0
- package/column-layout/grid-column-layout.d.ts +10 -0
- package/column-layout/grid-column-layout.d.ts.map +1 -0
- package/column-layout/grid-column-layout.js +32 -0
- package/column-layout/grid-column-layout.js.map +1 -0
- package/column-layout/index.d.ts.map +1 -1
- package/column-layout/index.js +2 -4
- package/column-layout/index.js.map +1 -1
- package/column-layout/interfaces.d.ts +11 -0
- package/column-layout/interfaces.d.ts.map +1 -1
- package/column-layout/interfaces.js.map +1 -1
- package/column-layout/internal.d.ts +2 -3
- package/column-layout/internal.d.ts.map +1 -1
- package/column-layout/internal.js +6 -27
- package/column-layout/internal.js.map +1 -1
- package/expandable-section/expandable-section-header.d.ts +4 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +19 -10
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/interfaces.d.ts +11 -3
- package/expandable-section/interfaces.d.ts.map +1 -1
- package/expandable-section/interfaces.js.map +1 -1
- package/expandable-section/internal.d.ts +1 -1
- package/expandable-section/internal.d.ts.map +1 -1
- package/expandable-section/internal.js +2 -2
- package/expandable-section/internal.js.map +1 -1
- package/expandable-section/styles.css.js +26 -24
- package/expandable-section/styles.scoped.css +50 -58
- package/expandable-section/styles.selectors.js +26 -24
- package/internal/components/chart-plot/index.js +1 -1
- package/internal/components/chart-plot/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/tag-editor/index.js +1 -1
- package/tag-editor/index.js.map +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InternalColumnLayoutProps } from '../interfaces';
|
|
3
|
+
export declare function calculcateCssColumnCount(columns: number, minColumnWidth: number, containerWidth: number | null): number;
|
|
4
|
+
interface FlexibleColumnLayoutProps extends Pick<InternalColumnLayoutProps, 'minColumnWidth' | 'columns' | 'variant' | 'borders' | 'disableGutters'> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default function FlexibleColumnLayout({ columns, minColumnWidth, disableGutters, variant, children, }: FlexibleColumnLayoutProps): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/flexible-column-layout/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAK1D,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAaR;AAED,UAAU,yBACR,SAAQ,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,CAAC;IAChH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,OAAW,EACX,cAAkB,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACT,EAAE,yBAAyB,eAqC3B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import flattenChildren from 'react-keyed-flatten-children';
|
|
6
|
+
import { useContainerQuery } from '../../internal/hooks/container-queries';
|
|
7
|
+
import styles from './styles.css.js';
|
|
8
|
+
const isOdd = (value) => value % 2 !== 0;
|
|
9
|
+
export function calculcateCssColumnCount(columns, minColumnWidth, containerWidth) {
|
|
10
|
+
if (!containerWidth) {
|
|
11
|
+
return columns;
|
|
12
|
+
}
|
|
13
|
+
// First, calculate how many columns we can have based on the current container width and minColumnWidth.
|
|
14
|
+
const targetColumnCount = Math.min(columns, Math.floor(containerWidth / minColumnWidth));
|
|
15
|
+
// When we start wrapping into fewer columns than desired, we want to keep the number of columns even.
|
|
16
|
+
return Math.max(1, targetColumnCount < columns && isOdd(targetColumnCount) ? targetColumnCount - 1 : targetColumnCount);
|
|
17
|
+
}
|
|
18
|
+
export default function FlexibleColumnLayout({ columns = 1, minColumnWidth = 0, disableGutters, variant, children, }) {
|
|
19
|
+
const [containerWidth, containerRef] = useContainerQuery(rect => rect.width);
|
|
20
|
+
const columnCount = calculcateCssColumnCount(columns, minColumnWidth, containerWidth);
|
|
21
|
+
const shouldDisableGutters = variant !== 'text-grid' && disableGutters;
|
|
22
|
+
// Flattening the children allows us to "see through" React Fragments and nested arrays.
|
|
23
|
+
const flattenedChildren = flattenChildren(children);
|
|
24
|
+
return (React.createElement("div", { ref: containerRef, className: clsx(styles['css-grid'], styles[`grid-variant-${variant}`], shouldDisableGutters && [styles['grid-no-gutters']]), style: { gridTemplateColumns: `repeat(${columnCount}, 1fr)` } }, flattenedChildren.map((child, i) => {
|
|
25
|
+
// If this react child is a primitive value, the key will be undefined
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const key = child.key;
|
|
28
|
+
return (React.createElement("div", { key: key, className: clsx(styles.item, {
|
|
29
|
+
[styles['first-column']]: i % columnCount === 0,
|
|
30
|
+
}) }, child));
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/flexible-column-layout/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AAE1D,MAAM,UAAU,wBAAwB,CACtC,OAAe,EACf,cAAsB,EACtB,cAA6B;IAE7B,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,OAAO,CAAC;KAChB;IAED,yGAAyG;IACzG,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC;IAEzF,sGAAsG;IACtG,OAAO,IAAI,CAAC,GAAG,CACb,CAAC,EACD,iBAAiB,GAAG,OAAO,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CACpG,CAAC;AACJ,CAAC;AAOD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,OAAO,GAAG,CAAC,EACX,cAAc,GAAG,CAAC,EAClB,cAAc,EACd,OAAO,EACP,QAAQ,GACkB;IAC1B,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE7E,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IACtF,MAAM,oBAAoB,GAAG,OAAO,KAAK,WAAW,IAAI,cAAc,CAAC;IAEvE,wFAAwF;IACxF,MAAM,iBAAiB,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAEpD,OAAO,CACL,6BACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,UAAU,CAAC,EAClB,MAAM,CAAC,gBAAgB,OAAO,EAAE,CAAC,EACjC,oBAAoB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CACpD,EACD,KAAK,EAAE,EAAE,mBAAmB,EAAE,UAAU,WAAW,QAAQ,EAAE,IAE5D,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAClC,sEAAsE;QACtE,8DAA8D;QAC9D,MAAM,GAAG,GAAI,KAAa,CAAC,GAAG,CAAC;QAE/B,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC3B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,WAAW,KAAK,CAAC;aAChD,CAAC,IAED,KAAK,CACF,CACP,CAAC;IACJ,CAAC,CAAC,CACE,CACP,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';\nimport clsx from 'clsx';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport { useContainerQuery } from '../../internal/hooks/container-queries';\nimport { InternalColumnLayoutProps } from '../interfaces';\nimport styles from './styles.css.js';\n\nconst isOdd = (value: number): boolean => value % 2 !== 0;\n\nexport function calculcateCssColumnCount(\n columns: number,\n minColumnWidth: number,\n containerWidth: number | null\n): number {\n if (!containerWidth) {\n return columns;\n }\n\n // First, calculate how many columns we can have based on the current container width and minColumnWidth.\n const targetColumnCount = Math.min(columns, Math.floor(containerWidth / minColumnWidth));\n\n // When we start wrapping into fewer columns than desired, we want to keep the number of columns even.\n return Math.max(\n 1,\n targetColumnCount < columns && isOdd(targetColumnCount) ? targetColumnCount - 1 : targetColumnCount\n );\n}\n\ninterface FlexibleColumnLayoutProps\n extends Pick<InternalColumnLayoutProps, 'minColumnWidth' | 'columns' | 'variant' | 'borders' | 'disableGutters'> {\n children: React.ReactNode;\n}\n\nexport default function FlexibleColumnLayout({\n columns = 1,\n minColumnWidth = 0,\n disableGutters,\n variant,\n children,\n}: FlexibleColumnLayoutProps) {\n const [containerWidth, containerRef] = useContainerQuery(rect => rect.width);\n\n const columnCount = calculcateCssColumnCount(columns, minColumnWidth, containerWidth);\n const shouldDisableGutters = variant !== 'text-grid' && disableGutters;\n\n // Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n const flattenedChildren = flattenChildren(children);\n\n return (\n <div\n ref={containerRef}\n className={clsx(\n styles['css-grid'],\n styles[`grid-variant-${variant}`],\n shouldDisableGutters && [styles['grid-no-gutters']]\n )}\n style={{ gridTemplateColumns: `repeat(${columnCount}, 1fr)` }}\n >\n {flattenedChildren.map((child, i) => {\n // If this react child is a primitive value, the key will be undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const key = (child as any).key;\n\n return (\n <div\n key={key}\n className={clsx(styles.item, {\n [styles['first-column']]: i % columnCount === 0,\n })}\n >\n {child}\n </div>\n );\n })}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import './styles.scoped.css';
|
|
3
|
+
export default {
|
|
4
|
+
"css-grid": "awsui_css-grid_zqq3x_19kru_9",
|
|
5
|
+
"grid-no-gutters": "awsui_grid-no-gutters_zqq3x_19kru_13",
|
|
6
|
+
"grid-variant-text-grid": "awsui_grid-variant-text-grid_zqq3x_19kru_16",
|
|
7
|
+
"item": "awsui_item_zqq3x_19kru_16",
|
|
8
|
+
"first-column": "awsui_first-column_zqq3x_19kru_21"
|
|
9
|
+
};
|
|
10
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
.awsui_css-grid_zqq3x_19kru_9:not(#\9) {
|
|
10
|
+
display: grid;
|
|
11
|
+
gap: var(--space-grid-gutter-s46zha, 20px);
|
|
12
|
+
}
|
|
13
|
+
.awsui_css-grid_zqq3x_19kru_9.awsui_grid-no-gutters_zqq3x_19kru_13:not(#\9) {
|
|
14
|
+
gap: 0;
|
|
15
|
+
}
|
|
16
|
+
.awsui_css-grid_zqq3x_19kru_9.awsui_grid-variant-text-grid_zqq3x_19kru_16 > .awsui_item_zqq3x_19kru_16:not(#\9) {
|
|
17
|
+
border-left: var(--border-divider-section-width-orq175, 2px) solid var(--color-border-divider-default-9o8zql, #e9ebed);
|
|
18
|
+
padding-left: var(--space-grid-gutter-s46zha, 20px);
|
|
19
|
+
padding-right: var(--space-grid-gutter-s46zha, 20px);
|
|
20
|
+
}
|
|
21
|
+
.awsui_css-grid_zqq3x_19kru_9.awsui_grid-variant-text-grid_zqq3x_19kru_16 > .awsui_item_zqq3x_19kru_16.awsui_first-column_zqq3x_19kru_21:not(#\9) {
|
|
22
|
+
border-left: 0;
|
|
23
|
+
padding-left: 0;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"css-grid": "awsui_css-grid_zqq3x_19kru_9",
|
|
6
|
+
"grid-no-gutters": "awsui_grid-no-gutters_zqq3x_19kru_13",
|
|
7
|
+
"grid-variant-text-grid": "awsui_grid-variant-text-grid_zqq3x_19kru_16",
|
|
8
|
+
"item": "awsui_item_zqq3x_19kru_16",
|
|
9
|
+
"first-column": "awsui_first-column_zqq3x_19kru_21"
|
|
10
|
+
};
|
|
11
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InternalColumnLayoutProps } from './interfaces';
|
|
3
|
+
import { ColumnLayoutBreakpoint } from './internal';
|
|
4
|
+
interface GridColumnLayoutProps extends Required<Pick<InternalColumnLayoutProps, 'columns' | 'variant' | 'borders' | 'disableGutters'>> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
__breakpoint?: ColumnLayoutBreakpoint;
|
|
7
|
+
}
|
|
8
|
+
export default function GridColumnLayout({ columns, variant, borders, disableGutters, __breakpoint, children, }: GridColumnLayoutProps): JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=grid-column-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-column-layout.d.ts","sourceRoot":"lib/default/","sources":["column-layout/grid-column-layout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAmB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAUrE,UAAU,qBACR,SAAQ,QAAQ,CAAC,IAAI,CAAC,yBAAyB,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,CAAC,CAAC;IACvG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,YAAY,EACZ,QAAQ,GACT,EAAE,qBAAqB,eA2BvB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import flattenChildren from 'react-keyed-flatten-children';
|
|
6
|
+
import InternalGrid from '../grid/internal';
|
|
7
|
+
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
|
|
8
|
+
import { repeat } from './util';
|
|
9
|
+
import { COLUMN_TRIGGERS } from './internal';
|
|
10
|
+
import styles from './styles.css.js';
|
|
11
|
+
const COLUMN_DEFS = {
|
|
12
|
+
1: { colspan: { default: 12, xxs: 12, xs: 12 } },
|
|
13
|
+
2: { colspan: { default: 12, xxs: 6, xs: 6 } },
|
|
14
|
+
3: { colspan: { default: 12, xxs: 6, xs: 4 } },
|
|
15
|
+
4: { colspan: { default: 12, xxs: 6, xs: 3 } },
|
|
16
|
+
};
|
|
17
|
+
export default function GridColumnLayout({ columns, variant, borders, disableGutters, __breakpoint, children, }) {
|
|
18
|
+
var _a;
|
|
19
|
+
const isTextGridVariant = variant === 'text-grid';
|
|
20
|
+
const shouldDisableGutters = !isTextGridVariant && disableGutters;
|
|
21
|
+
const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');
|
|
22
|
+
const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');
|
|
23
|
+
// Flattening the children allows us to "see through" React Fragments and nested arrays.
|
|
24
|
+
const flattenedChildren = flattenChildren(children);
|
|
25
|
+
const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);
|
|
26
|
+
return (React.createElement(InternalGrid, { ref: ref, disableGutters: true, gridDefinition: repeat((_a = COLUMN_DEFS[columns]) !== null && _a !== void 0 ? _a : {}, flattenedChildren.length), className: clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {
|
|
27
|
+
[styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,
|
|
28
|
+
[styles['grid-vertical-borders']]: shouldHaveVerticalBorders,
|
|
29
|
+
[styles['grid-no-gutters']]: shouldDisableGutters,
|
|
30
|
+
}), __breakpoint: __breakpoint || breakpoint, __responsiveClassName: breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`] }, children));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=grid-column-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-column-layout.js","sourceRoot":"lib/default/","sources":["column-layout/grid-column-layout.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAC;AACrE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,WAAW,GAA4D;IAC3E,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IAChD,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;IAC9C,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;IAC9C,CAAC,EAAE,EAAE,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AAY,EAAE,YAAY,IAAI,UAAU,EACxC,qBAAqB,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,IAAI,MAAM,CAAC,mBAAmB,UAAU,EAAE,CAAC,IAEzF,QAAQ,CACI,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';\nimport clsx from 'clsx';\nimport flattenChildren from 'react-keyed-flatten-children';\nimport InternalGrid from '../grid/internal';\nimport { GridProps } from '../grid/interfaces';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { repeat } from './util';\nimport { InternalColumnLayoutProps } from './interfaces';\nimport { COLUMN_TRIGGERS, ColumnLayoutBreakpoint } from './internal';\nimport styles from './styles.css.js';\n\nconst COLUMN_DEFS: Record<number, GridProps.ElementDefinition | undefined> = {\n 1: { colspan: { default: 12, xxs: 12, xs: 12 } },\n 2: { colspan: { default: 12, xxs: 6, xs: 6 } },\n 3: { colspan: { default: 12, xxs: 6, xs: 4 } },\n 4: { colspan: { default: 12, xxs: 6, xs: 3 } },\n};\n\ninterface GridColumnLayoutProps\n extends Required<Pick<InternalColumnLayoutProps, 'columns' | 'variant' | 'borders' | 'disableGutters'>> {\n children: React.ReactNode;\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n\nexport default function GridColumnLayout({\n columns,\n variant,\n borders,\n disableGutters,\n __breakpoint,\n children,\n}: GridColumnLayoutProps) {\n const isTextGridVariant = variant === 'text-grid';\n const shouldDisableGutters = !isTextGridVariant && disableGutters;\n const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');\n const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');\n\n // Flattening the children allows us to \"see through\" React Fragments and nested arrays.\n const flattenedChildren = flattenChildren(children);\n\n const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);\n\n return (\n <InternalGrid\n ref={ref}\n disableGutters={true}\n gridDefinition={repeat(COLUMN_DEFS[columns] ?? {}, flattenedChildren.length)}\n className={clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {\n [styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,\n [styles['grid-vertical-borders']]: shouldHaveVerticalBorders,\n [styles['grid-no-gutters']]: shouldDisableGutters,\n })}\n __breakpoint={__breakpoint || breakpoint}\n __responsiveClassName={breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`]}\n >\n {children}\n </InternalGrid>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAW,EACX,OAAmB,EACnB,OAAgB,EAChB,cAAsB,EACtB,GAAG,KAAK,EACT,EAAE,iBAAiB,eAanB"}
|
package/column-layout/index.js
CHANGED
|
@@ -2,17 +2,15 @@ import { __rest } from "tslib";
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import InternalColumnLayout
|
|
5
|
+
import InternalColumnLayout from './internal';
|
|
6
6
|
import { getExternalProps } from '../internal/utils/external-props';
|
|
7
|
-
import { useContainerBreakpoints } from '../internal/hooks/container-queries';
|
|
8
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
9
8
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
10
9
|
export default function ColumnLayout(_a) {
|
|
11
10
|
var { columns = 1, variant = 'default', borders = 'none', disableGutters = false } = _a, props = __rest(_a, ["columns", "variant", "borders", "disableGutters"]);
|
|
12
11
|
const baseComponentProps = useBaseComponent('ColumnLayout');
|
|
13
|
-
const [breakpoint, ref] = useContainerBreakpoints(COLUMN_TRIGGERS);
|
|
14
12
|
const externalProps = getExternalProps(props);
|
|
15
|
-
return (React.createElement(InternalColumnLayout, Object.assign({ columns: columns, variant: variant, borders: borders, disableGutters: disableGutters }, externalProps, baseComponentProps
|
|
13
|
+
return (React.createElement(InternalColumnLayout, Object.assign({ columns: columns, variant: variant, borders: borders, disableGutters: disableGutters }, externalProps, baseComponentProps)));
|
|
16
14
|
}
|
|
17
15
|
applyDisplayName(ColumnLayout, 'ColumnLayout');
|
|
18
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["column-layout/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAKpE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAMjB;QANiB,EACnC,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,MAAM,EAChB,cAAc,GAAG,KAAK,OAEJ,EADf,KAAK,cAL2B,mDAMpC,CADS;IAER,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CACL,oBAAC,oBAAoB,kBACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,IAC1B,aAAa,EACb,kBAAkB,EACtB,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport InternalColumnLayout from './internal';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { ColumnLayoutProps } from './interfaces';\n\nexport { ColumnLayoutProps };\n\nexport default function ColumnLayout({\n columns = 1,\n variant = 'default',\n borders = 'none',\n disableGutters = false,\n ...props\n}: ColumnLayoutProps) {\n const baseComponentProps = useBaseComponent('ColumnLayout');\n const externalProps = getExternalProps(props);\n return (\n <InternalColumnLayout\n columns={columns}\n variant={variant}\n borders={borders}\n disableGutters={disableGutters}\n {...externalProps}\n {...baseComponentProps}\n />\n );\n}\n\napplyDisplayName(ColumnLayout, 'ColumnLayout');\n"]}
|
|
@@ -6,6 +6,8 @@ export interface ColumnLayoutProps extends BaseComponentProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* Specifies the number of columns in each grid row.
|
|
8
8
|
* Valid values are any integer between 1 and 4.
|
|
9
|
+
*
|
|
10
|
+
* Note that there is no upper limit when used in combination with `minColumnWidth`.
|
|
9
11
|
*/
|
|
10
12
|
columns?: number;
|
|
11
13
|
/**
|
|
@@ -14,12 +16,21 @@ export interface ColumnLayoutProps extends BaseComponentProps {
|
|
|
14
16
|
variant?: ColumnLayoutProps.Variant;
|
|
15
17
|
/**
|
|
16
18
|
* Controls whether dividers are placed between rows and columns.
|
|
19
|
+
*
|
|
20
|
+
* Note: This is not supported when used with `minColumnWidth`.
|
|
17
21
|
*/
|
|
18
22
|
borders?: ColumnLayoutProps.Borders;
|
|
19
23
|
/**
|
|
20
24
|
* Determines whether the default gutters between columns are removed.
|
|
21
25
|
*/
|
|
22
26
|
disableGutters?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Use together with `columns` to specify the desired minimum width for each column in pixels.
|
|
29
|
+
*
|
|
30
|
+
* The number of columns is determined by the value of this property, the available space,
|
|
31
|
+
* and the maximum number of columns as defined by the `columns` property.
|
|
32
|
+
*/
|
|
33
|
+
minColumnWidth?: number;
|
|
23
34
|
/**
|
|
24
35
|
* The columns to render.
|
|
25
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC;IAEpC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAC9C,KAAY,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,KAAK,CAAC;CAClE;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,EAAE,0BAA0B;IAC9F,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { ColumnLayoutBreakpoint } from './internal';\n\nexport interface ColumnLayoutProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4.\n */\n columns?: number;\n\n /**\n * Specifies the content type. This determines the spacing of the grid.\n */\n variant?: ColumnLayoutProps.Variant;\n\n /**\n * Controls whether dividers are placed between rows and columns.\n */\n borders?: ColumnLayoutProps.Borders;\n\n /**\n * Determines whether the default gutters between columns are removed.\n */\n disableGutters?: boolean;\n\n /**\n * The columns to render.\n */\n children?: React.ReactNode;\n}\n\nexport namespace ColumnLayoutProps {\n export type Variant = 'default' | 'text-grid';\n export type Borders = 'none' | 'vertical' | 'horizontal' | 'all';\n}\n\nexport interface InternalColumnLayoutProps extends ColumnLayoutProps, InternalBaseComponentProps {\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["column-layout/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport React from 'react';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { ColumnLayoutBreakpoint } from './internal';\n\nexport interface ColumnLayoutProps extends BaseComponentProps {\n /**\n * Specifies the number of columns in each grid row.\n * Valid values are any integer between 1 and 4.\n *\n * Note that there is no upper limit when used in combination with `minColumnWidth`.\n */\n columns?: number;\n\n /**\n * Specifies the content type. This determines the spacing of the grid.\n */\n variant?: ColumnLayoutProps.Variant;\n\n /**\n * Controls whether dividers are placed between rows and columns.\n *\n * Note: This is not supported when used with `minColumnWidth`.\n */\n borders?: ColumnLayoutProps.Borders;\n\n /**\n * Determines whether the default gutters between columns are removed.\n */\n disableGutters?: boolean;\n\n /**\n * Use together with `columns` to specify the desired minimum width for each column in pixels.\n *\n * The number of columns is determined by the value of this property, the available space,\n * and the maximum number of columns as defined by the `columns` property.\n */\n minColumnWidth?: number;\n\n /**\n * The columns to render.\n */\n children?: React.ReactNode;\n}\n\nexport namespace ColumnLayoutProps {\n export type Variant = 'default' | 'text-grid';\n export type Borders = 'none' | 'vertical' | 'horizontal' | 'all';\n}\n\nexport interface InternalColumnLayoutProps extends ColumnLayoutProps, InternalBaseComponentProps {\n __breakpoint?: ColumnLayoutBreakpoint;\n}\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { InternalColumnLayoutProps } from './interfaces';
|
|
3
3
|
export declare const COLUMN_TRIGGERS: readonly ["default", "xxs", "xs"];
|
|
4
4
|
export type ColumnLayoutBreakpoint = typeof COLUMN_TRIGGERS[number] | null;
|
|
5
5
|
/**
|
|
6
6
|
* A responsive grid layout.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export default _default;
|
|
8
|
+
export default function ColumnLayout({ columns, variant, borders, disableGutters, minColumnWidth, children, __breakpoint, __internalRootRef, ...restProps }: InternalColumnLayoutProps): JSX.Element;
|
|
10
9
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAKzD,eAAO,MAAM,eAAe,mCAAoC,CAAC;AACjE,MAAM,MAAM,sBAAsB,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAW,EACX,OAAmB,EACnB,OAAgB,EAChB,cAAsB,EACtB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,GAAG,SAAS,EACb,EAAE,yBAAyB,eA4B3B"}
|
|
@@ -3,38 +3,17 @@ import { __rest } from "tslib";
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import flattenChildren from 'react-keyed-flatten-children';
|
|
7
|
-
import InternalGrid from '../grid/internal';
|
|
8
6
|
import { getBaseProps } from '../internal/base-component';
|
|
9
|
-
import
|
|
7
|
+
import FlexibleColumnLayout from './flexible-column-layout';
|
|
8
|
+
import GridColumnLayout from './grid-column-layout';
|
|
10
9
|
import styles from './styles.css.js';
|
|
11
10
|
export const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'];
|
|
12
|
-
const COLUMN_DEFS = {
|
|
13
|
-
1: { colspan: { default: 12, xxs: 12, xs: 12 } },
|
|
14
|
-
2: { colspan: { default: 12, xxs: 6, xs: 6 } },
|
|
15
|
-
3: { colspan: { default: 12, xxs: 6, xs: 4 } },
|
|
16
|
-
4: { colspan: { default: 12, xxs: 6, xs: 3 } },
|
|
17
|
-
};
|
|
18
11
|
/**
|
|
19
12
|
* A responsive grid layout.
|
|
20
13
|
*/
|
|
21
|
-
export default
|
|
22
|
-
var
|
|
23
|
-
var { columns = 1, variant = 'default', borders = 'none', disableGutters = false, children, __breakpoint, __internalRootRef } = _a, restProps = __rest(_a, ["columns", "variant", "borders", "disableGutters", "children", "__breakpoint", "__internalRootRef"]);
|
|
14
|
+
export default function ColumnLayout(_a) {
|
|
15
|
+
var { columns = 1, variant = 'default', borders = 'none', disableGutters = false, minColumnWidth, children, __breakpoint, __internalRootRef } = _a, restProps = __rest(_a, ["columns", "variant", "borders", "disableGutters", "minColumnWidth", "children", "__breakpoint", "__internalRootRef"]);
|
|
24
16
|
const baseProps = getBaseProps(restProps);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const shouldHaveHorizontalBorders = !isTextGridVariant && (borders === 'horizontal' || borders === 'all');
|
|
28
|
-
const shouldHaveVerticalBorders = !isTextGridVariant && (borders === 'vertical' || borders === 'all');
|
|
29
|
-
/*
|
|
30
|
-
Flattening the children allows us to "see through" React Fragments and nested arrays.
|
|
31
|
-
*/
|
|
32
|
-
const flattenedChildren = flattenChildren(children);
|
|
33
|
-
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['column-layout']), ref: __internalRootRef }),
|
|
34
|
-
React.createElement(InternalGrid, { ref: ref, disableGutters: true, gridDefinition: repeat((_b = COLUMN_DEFS[columns]) !== null && _b !== void 0 ? _b : {}, flattenedChildren.length), className: clsx(styles.grid, styles[`grid-columns-${columns}`], styles[`grid-variant-${variant}`], {
|
|
35
|
-
[styles['grid-horizontal-borders']]: shouldHaveHorizontalBorders,
|
|
36
|
-
[styles['grid-vertical-borders']]: shouldHaveVerticalBorders,
|
|
37
|
-
[styles['grid-no-gutters']]: shouldDisableGutters,
|
|
38
|
-
}), __breakpoint: __breakpoint, __responsiveClassName: breakpoint => breakpoint && styles[`grid-breakpoint-${breakpoint}`] }, children)));
|
|
39
|
-
});
|
|
17
|
+
return (React.createElement("div", Object.assign({}, baseProps, { className: clsx(baseProps.className, styles['column-layout']), ref: __internalRootRef }), minColumnWidth ? (React.createElement(FlexibleColumnLayout, { columns: columns, borders: borders, variant: variant, minColumnWidth: minColumnWidth, disableGutters: disableGutters }, children)) : (React.createElement(GridColumnLayout, { columns: columns, variant: variant, borders: borders, disableGutters: disableGutters, __breakpoint: __breakpoint }, children))));
|
|
18
|
+
}
|
|
40
19
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["column-layout/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAU,CAAC;AAGjE;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAUT;QAVS,EACnC,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,MAAM,EAChB,cAAc,GAAG,KAAK,EACtB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,iBAAiB,OAES,EADvB,SAAS,cATuB,sHAUpC,CADa;IAEZ,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE1C,OAAO,CACL,6CAAS,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,iBAAiB,KACtG,cAAc,CAAC,CAAC,CAAC,CAChB,oBAAC,oBAAoB,IACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,IAE7B,QAAQ,CACY,CACxB,CAAC,CAAC,CAAC,CACF,oBAAC,gBAAgB,IACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,IAEzB,QAAQ,CACQ,CACpB,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalColumnLayoutProps } from './interfaces';\nimport FlexibleColumnLayout from './flexible-column-layout';\nimport GridColumnLayout from './grid-column-layout';\nimport styles from './styles.css.js';\n\nexport const COLUMN_TRIGGERS = ['default', 'xxs', 'xs'] as const;\nexport type ColumnLayoutBreakpoint = typeof COLUMN_TRIGGERS[number] | null;\n\n/**\n * A responsive grid layout.\n */\nexport default function ColumnLayout({\n columns = 1,\n variant = 'default',\n borders = 'none',\n disableGutters = false,\n minColumnWidth,\n children,\n __breakpoint,\n __internalRootRef,\n ...restProps\n}: InternalColumnLayoutProps) {\n const baseProps = getBaseProps(restProps);\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles['column-layout'])} ref={__internalRootRef}>\n {minColumnWidth ? (\n <FlexibleColumnLayout\n columns={columns}\n borders={borders}\n variant={variant}\n minColumnWidth={minColumnWidth}\n disableGutters={disableGutters}\n >\n {children}\n </FlexibleColumnLayout>\n ) : (\n <GridColumnLayout\n columns={columns}\n variant={variant}\n borders={borders}\n disableGutters={disableGutters}\n __breakpoint={__breakpoint}\n >\n {children}\n </GridColumnLayout>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExpandableSectionProps } from './interfaces';
|
|
2
2
|
import { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';
|
|
3
|
+
export declare const componentName = "ExpandableSection";
|
|
3
4
|
interface ExpandableDefaultHeaderProps {
|
|
4
5
|
id: string;
|
|
5
6
|
className?: string;
|
|
@@ -19,9 +20,11 @@ interface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps
|
|
|
19
20
|
headerText?: ReactNode;
|
|
20
21
|
headerDescription?: ReactNode;
|
|
21
22
|
headerCounter?: string;
|
|
23
|
+
headerInfo?: ReactNode;
|
|
24
|
+
headerActions?: ReactNode;
|
|
22
25
|
headingTagOverride?: ExpandableSectionProps.HeadingTag;
|
|
23
26
|
ariaLabelledBy?: string;
|
|
24
27
|
}
|
|
25
|
-
export declare const ExpandableSectionHeader: ({ id, className, variant, header, headerText, headerDescription, headerCounter, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, }: ExpandableSectionHeaderProps) => JSX.Element;
|
|
28
|
+
export declare const ExpandableSectionHeader: ({ id, className, variant, header, headerText, headerDescription, headerCounter, headerInfo, headerActions, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, }: ExpandableSectionHeaderProps) => JSX.Element;
|
|
26
29
|
export {};
|
|
27
30
|
//# sourceMappingURL=expandable-section-header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUlF,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;CACzC;
|
|
1
|
+
{"version":3,"file":"expandable-section-header.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUlF,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,UAAU,4BAA4B;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;CACzC;AAcD,UAAU,4BAA6B,SAAQ,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,MAAM,CAAC;IACpG,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAiID,eAAO,MAAM,uBAAuB,qNAkBjC,4BAA4B,gBA4E9B,CAAC"}
|
|
@@ -7,6 +7,7 @@ import ScreenreaderOnly from '../internal/components/screenreader-only';
|
|
|
7
7
|
import { useUniqueId } from '../internal/hooks/use-unique-id';
|
|
8
8
|
import { isDevelopment } from '../internal/is-development';
|
|
9
9
|
import { warnOnce } from '../internal/logging';
|
|
10
|
+
export const componentName = 'ExpandableSection';
|
|
10
11
|
const ExpandableDefaultHeader = ({ id, className, onClick, ariaLabel, ariaControls, expanded, children, icon, onKeyUp, onKeyDown, variant, }) => {
|
|
11
12
|
return (React.createElement("div", { id: id, role: "button", className: className, tabIndex: 0, onKeyUp: onKeyUp, onKeyDown: onKeyDown, onClick: onClick, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": expanded },
|
|
12
13
|
React.createElement("div", { className: clsx(styles['icon-container'], styles[`icon-container-${variant}`]) }, icon),
|
|
@@ -17,15 +18,19 @@ const ExpandableNavigationHeader = ({ id, className, onClick, ariaLabelledBy, ar
|
|
|
17
18
|
React.createElement("button", { className: styles['icon-container'], "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, "aria-controls": ariaControls, "aria-expanded": expanded, type: "button" }, icon),
|
|
18
19
|
children));
|
|
19
20
|
};
|
|
20
|
-
const ExpandableHeaderTextWrapper = ({ id, className, onClick, ariaLabel, ariaControls, expanded, children, icon, headerDescription, headerCounter, variant, headingTagOverride, onKeyUp, onKeyDown, }) => {
|
|
21
|
+
const ExpandableHeaderTextWrapper = ({ id, className, onClick, ariaLabel, ariaControls, expanded, children, icon, headerDescription, headerCounter, headerInfo, headerActions, variant, headingTagOverride, onKeyUp, onKeyDown, }) => {
|
|
21
22
|
const screenreaderContentId = useUniqueId('expandable-section-header-content-');
|
|
22
23
|
const isContainer = variant === 'container';
|
|
23
24
|
const HeadingTag = headingTagOverride || 'div';
|
|
24
|
-
const
|
|
25
|
+
const hasInteractiveElements = headerInfo || headerActions;
|
|
26
|
+
const listeners = { onClick, onKeyDown, onKeyUp };
|
|
27
|
+
const wrapperListeners = hasInteractiveElements ? undefined : listeners;
|
|
28
|
+
const headerButtonListeners = hasInteractiveElements ? listeners : undefined;
|
|
29
|
+
const headerButton = (React.createElement("span", Object.assign({ className: isContainer ? styles['header-container-button'] : styles['header-button'], role: "button", tabIndex: 0, "aria-label": ariaLabel, "aria-labelledby": ariaLabel || !isContainer ? undefined : screenreaderContentId, "aria-controls": ariaControls, "aria-expanded": expanded }, headerButtonListeners),
|
|
25
30
|
React.createElement("span", { className: clsx(styles['icon-container'], styles[`icon-container-${variant}`]) }, icon),
|
|
26
31
|
React.createElement("span", null, children)));
|
|
27
|
-
return (React.createElement("div", { id: id, className: className
|
|
28
|
-
isContainer ? (React.createElement(InternalHeader, { variant: "h2", description: headerDescription, counter: headerCounter, headingTagOverride: headingTagOverride }, headerButton)) : (React.createElement(HeadingTag, { className: styles['header-wrapper'] }, headerButton)),
|
|
32
|
+
return (React.createElement("div", Object.assign({ id: id, className: className }, wrapperListeners),
|
|
33
|
+
isContainer ? (React.createElement(InternalHeader, { variant: "h2", description: headerDescription, counter: headerCounter, info: headerInfo, actions: headerActions, headingTagOverride: headingTagOverride }, headerButton)) : (React.createElement(HeadingTag, { className: styles['header-wrapper'] }, headerButton)),
|
|
29
34
|
isContainer && (React.createElement(ScreenreaderOnly, { id: screenreaderContentId },
|
|
30
35
|
children,
|
|
31
36
|
" ",
|
|
@@ -33,7 +38,7 @@ const ExpandableHeaderTextWrapper = ({ id, className, onClick, ariaLabel, ariaCo
|
|
|
33
38
|
" ",
|
|
34
39
|
headerDescription))));
|
|
35
40
|
};
|
|
36
|
-
export const ExpandableSectionHeader = ({ id, className, variant, header, headerText, headerDescription, headerCounter, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, }) => {
|
|
41
|
+
export const ExpandableSectionHeader = ({ id, className, variant, header, headerText, headerDescription, headerCounter, headerInfo, headerActions, headingTagOverride, expanded, ariaControls, ariaLabel, ariaLabelledBy, onKeyUp, onKeyDown, onClick, }) => {
|
|
37
42
|
const icon = (React.createElement(InternalIcon, { size: variant === 'container' ? 'medium' : 'normal', className: clsx(styles.icon, expanded && styles.expanded), name: "caret-down-filled" }));
|
|
38
43
|
const defaultHeaderProps = {
|
|
39
44
|
id: id,
|
|
@@ -44,16 +49,20 @@ export const ExpandableSectionHeader = ({ id, className, variant, header, header
|
|
|
44
49
|
onClick: onClick,
|
|
45
50
|
variant,
|
|
46
51
|
};
|
|
47
|
-
|
|
52
|
+
if ((headerDescription || headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {
|
|
53
|
+
warnOnce(componentName, 'The `headerCounter`, `headerDescription`, `headerInfo` and `headerActions` props are only supported for the "container" variant.');
|
|
54
|
+
}
|
|
55
|
+
const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], expanded && styles['wrapper-expanded']);
|
|
48
56
|
if (variant === 'navigation') {
|
|
49
|
-
return (React.createElement(ExpandableNavigationHeader, Object.assign({ className: clsx(className,
|
|
57
|
+
return (React.createElement(ExpandableNavigationHeader, Object.assign({ className: clsx(className, wrapperClassName), ariaLabelledBy: ariaLabelledBy }, defaultHeaderProps), headerText !== null && headerText !== void 0 ? headerText : header));
|
|
50
58
|
}
|
|
51
59
|
if (headerText) {
|
|
52
|
-
|
|
60
|
+
const hasInteractiveElements = headerInfo || headerActions;
|
|
61
|
+
return (React.createElement(ExpandableHeaderTextWrapper, Object.assign({ className: clsx(className, wrapperClassName, hasInteractiveElements && styles['with-interactive-elements'], expanded && styles.expanded), headerDescription: headerDescription, headerCounter: headerCounter, headerInfo: headerInfo, headerActions: headerActions, headingTagOverride: headingTagOverride, onKeyUp: onKeyUp, onKeyDown: onKeyDown }, defaultHeaderProps), headerText));
|
|
53
62
|
}
|
|
54
63
|
if (variant === 'container' && header && isDevelopment) {
|
|
55
|
-
warnOnce(
|
|
64
|
+
warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');
|
|
56
65
|
}
|
|
57
|
-
return (React.createElement(ExpandableDefaultHeader, Object.assign({ className: clsx(className,
|
|
66
|
+
return (React.createElement(ExpandableDefaultHeader, Object.assign({ className: clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded), onKeyUp: onKeyUp, onKeyDown: onKeyDown }, defaultHeaderProps), header));
|
|
58
67
|
};
|
|
59
68
|
//# sourceMappingURL=expandable-section-header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-section-header.js","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,O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UAAU,GAAI,MAAM,CACM,CAC9B,CAAC;KACH;IAED,IAAI,UAAU,EAAE;QACd,OAAO,CACL,oBAAC,2BAA2B,kBAC1B,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EACzE,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,IAChB,kBAAkB,GAErB,UAAU,CACiB,CAC/B,CAAC;KACH;IAED,IAAI,OAAO,KAAK,WAAW,IAAI,MAAM,IAAI,aAAa,EAAE;QACtD,QAAQ,CACN,mBAAmB,EACnB,yFAAyF,CAC1F,CAAC;KACH;IAED,OAAO,CACL,oBAAC,uBAAuB,kBACtB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,IAChB,kBAAkB,GAErB,MAAM,CACiB,CAC3B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ExpandableSectionProps } from './interfaces';\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalHeader from '../header/internal';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isDevelopment } from '../internal/is-development';\nimport { warnOnce } from '../internal/logging';\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: ExpandableSectionProps.Variant;\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n variant: ExpandableSectionProps.Variant;\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n}\n\nconst ExpandableDefaultHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={className}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n}: ExpandableNavigationHeaderProps) => {\n return (\n <div id={id} className={className} onClick={onClick}>\n <button\n className={styles['icon-container']}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n type=\"button\"\n >\n {icon}\n </button>\n {children}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n}: ExpandableHeaderTextWrapperProps) => {\n const screenreaderContentId = useUniqueId('expandable-section-header-content-');\n const isContainer = variant === 'container';\n const HeadingTag = headingTagOverride || 'div';\n const headerButton = (\n <span\n className={isContainer ? styles['header-container-button'] : styles['header-button']}\n role=\"button\"\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n aria-label={ariaLabel}\n // Do not use aria-labelledby={id} but ScreenreaderOnly because safari+VO does not read headerText in this case.\n aria-labelledby={ariaLabel || !isContainer ? undefined : screenreaderContentId}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n >\n <span className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</span>\n <span>{children}</span>\n </span>\n );\n\n return (\n <div id={id} className={className} onClick={onClick}>\n {isContainer ? (\n <InternalHeader\n variant=\"h2\"\n description={headerDescription}\n counter={headerCounter}\n headingTagOverride={headingTagOverride}\n >\n {headerButton}\n </InternalHeader>\n ) : (\n <HeadingTag className={styles['header-wrapper']}>{headerButton}</HeadingTag>\n )}\n {isContainer && (\n <ScreenreaderOnly id={screenreaderContentId}>\n {children} {headerCounter} {headerDescription}\n </ScreenreaderOnly>\n )}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n}: ExpandableSectionHeaderProps) => {\n const icon = (\n <InternalIcon\n size={variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name=\"caret-down-filled\"\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n };\n\n const triggerClassName = clsx(styles.trigger, styles[`trigger-${variant}`], expanded && styles['trigger-expanded']);\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, triggerClassName)}\n ariaLabelledBy={ariaLabelledBy}\n {...defaultHeaderProps}\n >\n {headerText ?? header}\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText) {\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(className, triggerClassName, expanded && styles.expanded)}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(\n 'ExpandableSection',\n 'Use `headerText` instead of `header` to provide the button within the heading for a11y.'\n );\n }\n\n return (\n <ExpandableDefaultHeader\n className={clsx(className, triggerClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDefaultHeader>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"expandable-section-header.js","sourceRoot":"lib/default/","sources":["expandable-section/expandable-section-header.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAClF,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAwCjD,MAAM,uBAAuB,GAAG,CAA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ates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ExpandableSectionProps } from './interfaces';\nimport React, { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalHeader from '../header/internal';\nimport ScreenreaderOnly from '../internal/components/screenreader-only';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { isDevelopment } from '../internal/is-development';\nimport { warnOnce } from '../internal/logging';\n\nexport const componentName = 'ExpandableSection';\n\ninterface ExpandableDefaultHeaderProps {\n id: string;\n className?: string;\n children?: ReactNode;\n expanded: boolean;\n ariaControls: string;\n ariaLabel?: string;\n onKeyUp: KeyboardEventHandler;\n onKeyDown: KeyboardEventHandler;\n onClick: MouseEventHandler;\n icon: JSX.Element;\n variant: ExpandableSectionProps.Variant;\n}\n\ninterface ExpandableNavigationHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'onKeyUp' | 'onKeyDown'> {\n ariaLabelledBy?: string;\n}\n\ninterface ExpandableHeaderTextWrapperProps extends ExpandableDefaultHeaderProps {\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n}\n\ninterface ExpandableSectionHeaderProps extends Omit<ExpandableDefaultHeaderProps, 'children' | 'icon'> {\n variant: ExpandableSectionProps.Variant;\n header?: ReactNode;\n headerText?: ReactNode;\n headerDescription?: ReactNode;\n headerCounter?: string;\n headerInfo?: ReactNode;\n headerActions?: ReactNode;\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n ariaLabelledBy?: string;\n}\n\nconst ExpandableDefaultHeader = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n onKeyUp,\n onKeyDown,\n variant,\n}: ExpandableDefaultHeaderProps) => {\n return (\n <div\n id={id}\n role=\"button\"\n className={className}\n tabIndex={0}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n >\n <div className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</div>\n {children}\n </div>\n );\n};\n\nconst ExpandableNavigationHeader = ({\n id,\n className,\n onClick,\n ariaLabelledBy,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n}: ExpandableNavigationHeaderProps) => {\n return (\n <div id={id} className={className} onClick={onClick}>\n <button\n className={styles['icon-container']}\n aria-labelledby={ariaLabelledBy}\n aria-label={ariaLabel}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n type=\"button\"\n >\n {icon}\n </button>\n {children}\n </div>\n );\n};\n\nconst ExpandableHeaderTextWrapper = ({\n id,\n className,\n onClick,\n ariaLabel,\n ariaControls,\n expanded,\n children,\n icon,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n variant,\n headingTagOverride,\n onKeyUp,\n onKeyDown,\n}: ExpandableHeaderTextWrapperProps) => {\n const screenreaderContentId = useUniqueId('expandable-section-header-content-');\n const isContainer = variant === 'container';\n const HeadingTag = headingTagOverride || 'div';\n const hasInteractiveElements = headerInfo || headerActions;\n const listeners = { onClick, onKeyDown, onKeyUp };\n const wrapperListeners = hasInteractiveElements ? undefined : listeners;\n const headerButtonListeners = hasInteractiveElements ? listeners : undefined;\n const headerButton = (\n <span\n className={isContainer ? styles['header-container-button'] : styles['header-button']}\n role=\"button\"\n tabIndex={0}\n aria-label={ariaLabel}\n // Do not use aria-labelledby={id} but ScreenreaderOnly because safari+VO does not read headerText in this case.\n aria-labelledby={ariaLabel || !isContainer ? undefined : screenreaderContentId}\n aria-controls={ariaControls}\n aria-expanded={expanded}\n {...headerButtonListeners}\n >\n <span className={clsx(styles['icon-container'], styles[`icon-container-${variant}`])}>{icon}</span>\n <span>{children}</span>\n </span>\n );\n\n return (\n <div id={id} className={className} {...wrapperListeners}>\n {isContainer ? (\n <InternalHeader\n variant=\"h2\"\n description={headerDescription}\n counter={headerCounter}\n info={headerInfo}\n actions={headerActions}\n headingTagOverride={headingTagOverride}\n >\n {headerButton}\n </InternalHeader>\n ) : (\n <HeadingTag className={styles['header-wrapper']}>{headerButton}</HeadingTag>\n )}\n {isContainer && (\n <ScreenreaderOnly id={screenreaderContentId}>\n {children} {headerCounter} {headerDescription}\n </ScreenreaderOnly>\n )}\n </div>\n );\n};\n\nexport const ExpandableSectionHeader = ({\n id,\n className,\n variant,\n header,\n headerText,\n headerDescription,\n headerCounter,\n headerInfo,\n headerActions,\n headingTagOverride,\n expanded,\n ariaControls,\n ariaLabel,\n ariaLabelledBy,\n onKeyUp,\n onKeyDown,\n onClick,\n}: ExpandableSectionHeaderProps) => {\n const icon = (\n <InternalIcon\n size={variant === 'container' ? 'medium' : 'normal'}\n className={clsx(styles.icon, expanded && styles.expanded)}\n name=\"caret-down-filled\"\n />\n );\n const defaultHeaderProps = {\n id: id,\n icon: icon,\n expanded: expanded,\n ariaControls: ariaControls,\n ariaLabel: ariaLabel,\n onClick: onClick,\n variant,\n };\n\n if ((headerDescription || headerCounter || headerInfo || headerActions) && variant !== 'container' && isDevelopment) {\n warnOnce(\n componentName,\n 'The `headerCounter`, `headerDescription`, `headerInfo` and `headerActions` props are only supported for the \"container\" variant.'\n );\n }\n\n const wrapperClassName = clsx(styles.wrapper, styles[`wrapper-${variant}`], expanded && styles['wrapper-expanded']);\n if (variant === 'navigation') {\n return (\n <ExpandableNavigationHeader\n className={clsx(className, wrapperClassName)}\n ariaLabelledBy={ariaLabelledBy}\n {...defaultHeaderProps}\n >\n {headerText ?? header}\n </ExpandableNavigationHeader>\n );\n }\n\n if (headerText) {\n const hasInteractiveElements = headerInfo || headerActions;\n return (\n <ExpandableHeaderTextWrapper\n className={clsx(\n className,\n wrapperClassName,\n hasInteractiveElements && styles['with-interactive-elements'],\n expanded && styles.expanded\n )}\n headerDescription={headerDescription}\n headerCounter={headerCounter}\n headerInfo={headerInfo}\n headerActions={headerActions}\n headingTagOverride={headingTagOverride}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {headerText}\n </ExpandableHeaderTextWrapper>\n );\n }\n\n if (variant === 'container' && header && isDevelopment) {\n warnOnce(componentName, 'Use `headerText` instead of `header` to provide the button within the heading for a11y.');\n }\n\n return (\n <ExpandableDefaultHeader\n className={clsx(className, wrapperClassName, styles.focusable, expanded && styles.expanded)}\n onKeyUp={onKeyUp}\n onKeyDown={onKeyDown}\n {...defaultHeaderProps}\n >\n {header}\n </ExpandableDefaultHeader>\n );\n};\n"]}
|
|
@@ -45,17 +45,17 @@ export interface ExpandableSectionProps extends BaseComponentProps {
|
|
|
45
45
|
*/
|
|
46
46
|
headerText?: React.ReactNode;
|
|
47
47
|
/**
|
|
48
|
-
* Supplementary text below the heading. Use with container variant.
|
|
48
|
+
* Supplementary text below the heading. Use with the container variant.
|
|
49
49
|
*/
|
|
50
50
|
headerDescription?: string;
|
|
51
51
|
/**
|
|
52
|
-
* Specifies secondary text that's displayed to the right of the heading title. Use with container variant.
|
|
52
|
+
* Specifies secondary text that's displayed to the right of the heading title. Use with the container variant.
|
|
53
53
|
* Behaves similar to the Header component counter.
|
|
54
54
|
*/
|
|
55
55
|
headerCounter?: string;
|
|
56
56
|
/**
|
|
57
57
|
* Overrides the default [HTML heading tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements).
|
|
58
|
-
* Use with container variant (which defaults to H2) or default/footer variants (which default to DIV). Note that this only
|
|
58
|
+
* Use with the container variant (which defaults to H2) or default/footer variants (which default to DIV). Note that this only
|
|
59
59
|
* works with the `headerText` slot (not with the deprecated `header`), and not with the navigation variant.
|
|
60
60
|
*/
|
|
61
61
|
headingTagOverride?: ExpandableSectionProps.HeadingTag;
|
|
@@ -69,5 +69,13 @@ export interface ExpandableSectionProps extends BaseComponentProps {
|
|
|
69
69
|
* The event `detail` contains the current value of the `expanded` property.
|
|
70
70
|
*/
|
|
71
71
|
onChange?: NonCancelableEventHandler<ExpandableSectionProps.ChangeDetail>;
|
|
72
|
+
/**
|
|
73
|
+
* The area next to the heading, used to display an Info link. Use with the container variant.
|
|
74
|
+
*/
|
|
75
|
+
headerInfo?: React.ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Actions for the header. Use with the container variant.
|
|
78
|
+
*/
|
|
79
|
+
headerActions?: React.ReactNode;
|
|
72
80
|
}
|
|
73
81
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["expandable-section/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;AAE/D,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;IACxE,UAAiB,YAAY;QAC3B,QAAQ,EAAE,OAAO,CAAC;KACnB;IACD,KAAY,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;SAOK;IACL,OAAO,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC;IAEzC;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,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AU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC;IAEvD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAE1E;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE7B;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["expandable-section/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\nexport namespace ExpandableSectionProps {\n export type Variant = 'default' | 'footer' | 'container' | 'navigation';\n export interface ChangeDetail {\n expanded: boolean;\n }\n export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';\n}\n\nexport interface ExpandableSectionProps extends BaseComponentProps {\n /**\n * Determines whether the component initially displays in expanded state (that is, with content visible). The component operates in an uncontrolled\n * manner even if you provide a value for this property.\n */\n defaultExpanded?: boolean;\n\n /**\n * Determines whether the component is in the expanded state (that is, with content visible). The component operates in a controlled\n * manner if you provide a value for this property.\n */\n expanded?: boolean;\n\n /**\n * The possible variants of an expandable section are as follows:\n * * `default` - Use this variant in any context.\n * * `footer` - Use this variant in container footers.\n * * `container` - Use this variant in a detail page alongside other containers.\n * * `navigation` - Use this variant in the navigation panel with anchors and custom styled content.\n * It doesn't have any default styles.\n * */\n variant?: ExpandableSectionProps.Variant;\n\n /**\n * Determines whether the content section's default padding is removed. This default padding is only present for the `container` variant.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Primary content displayed in the expandable section element.\n */\n children?: React.ReactNode;\n\n /**\n * @deprecated Use `headerText` instead.\n */\n header?: React.ReactNode;\n\n /**\n * The heading text. Use plain text. When using the container variant, you can use additional header props like `headerDescription` and `headerCounter` to display other elements in the header.\n */\n headerText?: React.ReactNode;\n\n /**\n * Supplementary text below the heading. Use with container variant.\n */\n headerDescription?: string;\n\n /**\n * Specifies secondary text that's displayed to the right of the heading title. Use with container variant.\n * Behaves similar to the Header component counter.\n */\n headerCounter?: string;\n\n /**\n * Overrides the default [HTML heading tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements).\n * Use with container variant (which defaults to H2) or default/footer variants (which default to DIV). Note that this only\n * works with the `headerText` slot (not with the deprecated `header`), and not with the navigation variant.\n */\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n\n /**\n * Adds `aria-label` to the header element.\n * Use to assign unique labels when there are multiple expandable sections with the same header text on one page.\n */\n headerAriaLabel?: string;\n\n /**\n * Called when the state changes (that is, when the user expands or collapses the component).\n * The event `detail` contains the current value of the `expanded` property.\n */\n onChange?: NonCancelableEventHandler<ExpandableSectionProps.ChangeDetail>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["expandable-section/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\nexport namespace ExpandableSectionProps {\n export type Variant = 'default' | 'footer' | 'container' | 'navigation';\n export interface ChangeDetail {\n expanded: boolean;\n }\n export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';\n}\n\nexport interface ExpandableSectionProps extends BaseComponentProps {\n /**\n * Determines whether the component initially displays in expanded state (that is, with content visible). The component operates in an uncontrolled\n * manner even if you provide a value for this property.\n */\n defaultExpanded?: boolean;\n\n /**\n * Determines whether the component is in the expanded state (that is, with content visible). The component operates in a controlled\n * manner if you provide a value for this property.\n */\n expanded?: boolean;\n\n /**\n * The possible variants of an expandable section are as follows:\n * * `default` - Use this variant in any context.\n * * `footer` - Use this variant in container footers.\n * * `container` - Use this variant in a detail page alongside other containers.\n * * `navigation` - Use this variant in the navigation panel with anchors and custom styled content.\n * It doesn't have any default styles.\n * */\n variant?: ExpandableSectionProps.Variant;\n\n /**\n * Determines whether the content section's default padding is removed. This default padding is only present for the `container` variant.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Primary content displayed in the expandable section element.\n */\n children?: React.ReactNode;\n\n /**\n * @deprecated Use `headerText` instead.\n */\n header?: React.ReactNode;\n\n /**\n * The heading text. Use plain text. When using the container variant, you can use additional header props like `headerDescription` and `headerCounter` to display other elements in the header.\n */\n headerText?: React.ReactNode;\n\n /**\n * Supplementary text below the heading. Use with the container variant.\n */\n headerDescription?: string;\n\n /**\n * Specifies secondary text that's displayed to the right of the heading title. Use with the container variant.\n * Behaves similar to the Header component counter.\n */\n headerCounter?: string;\n\n /**\n * Overrides the default [HTML heading tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements).\n * Use with the container variant (which defaults to H2) or default/footer variants (which default to DIV). Note that this only\n * works with the `headerText` slot (not with the deprecated `header`), and not with the navigation variant.\n */\n headingTagOverride?: ExpandableSectionProps.HeadingTag;\n\n /**\n * Adds `aria-label` to the header element.\n * Use to assign unique labels when there are multiple expandable sections with the same header text on one page.\n */\n headerAriaLabel?: string;\n\n /**\n * Called when the state changes (that is, when the user expands or collapses the component).\n * The event `detail` contains the current value of the `expanded` property.\n */\n onChange?: NonCancelableEventHandler<ExpandableSectionProps.ChangeDetail>;\n\n /**\n * The area next to the heading, used to display an Info link. Use with the container variant.\n */\n headerInfo?: React.ReactNode;\n\n /**\n * Actions for the header. Use with the container variant.\n */\n headerActions?: React.ReactNode;\n}\n"]}
|