@cloudscape-design/components 3.0.1387 → 3.0.1389
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/checkbox/internal.d.ts.map +1 -1
- package/checkbox/internal.js +1 -1
- package/checkbox/internal.js.map +1 -1
- package/checkbox/styles.css.js +3 -7
- package/checkbox/styles.scoped.css +5 -19
- package/checkbox/styles.selectors.js +3 -7
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +6 -0
- package/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/components/abstract-switch/styles.css.js +13 -13
- package/internal/components/abstract-switch/styles.scoped.css +23 -23
- package/internal/components/abstract-switch/styles.selectors.js +13 -13
- package/internal/components/radio-button/index.d.ts.map +1 -1
- package/internal/components/radio-button/index.js +2 -2
- package/internal/components/radio-button/index.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/manifest.json +1 -1
- package/manifest.json +2 -2
- package/package.json +19 -1
- package/radio-button/interfaces.d.ts +14 -0
- package/radio-button/interfaces.d.ts.map +1 -1
- package/radio-button/interfaces.js.map +1 -1
- package/table/body-cell/styles.css.js +47 -46
- package/table/body-cell/styles.scoped.css +376 -376
- package/table/body-cell/styles.selectors.js +47 -46
- package/table/body-cell/td-element.d.ts.map +1 -1
- package/table/body-cell/td-element.js +12 -12
- package/table/body-cell/td-element.js.map +1 -1
- package/table/header-cell/styles.css.js +39 -38
- package/table/header-cell/styles.scoped.css +80 -80
- package/table/header-cell/styles.selectors.js +39 -38
- package/table/header-cell/th-element.d.ts.map +1 -1
- package/table/header-cell/th-element.js +18 -8
- package/table/header-cell/th-element.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +9 -3
- package/table/internal.js.map +1 -1
- package/table/sticky-columns/use-sticky-columns.d.ts.map +1 -1
- package/table/sticky-columns/use-sticky-columns.js +13 -3
- package/table/sticky-columns/use-sticky-columns.js.map +1 -1
- package/table-body/index.d.ts +4 -0
- package/table-body/index.d.ts.map +1 -0
- package/table-body/index.js +14 -0
- package/table-body/index.js.map +1 -0
- package/table-body/interfaces.d.ts +17 -0
- package/table-body/interfaces.d.ts.map +1 -0
- package/table-body/interfaces.js +2 -0
- package/table-body/interfaces.js.map +1 -0
- package/table-body/internal.d.ts +10 -0
- package/table-body/internal.d.ts.map +1 -0
- package/table-body/internal.js +13 -0
- package/table-body/internal.js.map +1 -0
- package/table-body/styles.css.js +7 -0
- package/table-body/styles.scoped.css +11 -0
- package/table-body/styles.selectors.js +8 -0
- package/table-body-cell/index.d.ts +4 -0
- package/table-body-cell/index.d.ts.map +1 -0
- package/table-body-cell/index.js +17 -0
- package/table-body-cell/index.js.map +1 -0
- package/table-body-cell/interfaces.d.ts +20 -0
- package/table-body-cell/interfaces.d.ts.map +1 -0
- package/table-body-cell/interfaces.js +2 -0
- package/table-body-cell/interfaces.js.map +1 -0
- package/table-body-cell/internal.d.ts +25 -0
- package/table-body-cell/internal.d.ts.map +1 -0
- package/table-body-cell/internal.js +36 -0
- package/table-body-cell/internal.js.map +1 -0
- package/table-body-cell/styles.css.js +7 -0
- package/table-body-cell/styles.scoped.css +38 -0
- package/table-body-cell/styles.selectors.js +8 -0
- package/table-head/index.d.ts +4 -0
- package/table-head/index.d.ts.map +1 -0
- package/table-head/index.js +14 -0
- package/table-head/index.js.map +1 -0
- package/table-head/interfaces.d.ts +7 -0
- package/table-head/interfaces.d.ts.map +1 -0
- package/table-head/interfaces.js +2 -0
- package/table-head/interfaces.js.map +1 -0
- package/table-head/internal.d.ts +8 -0
- package/table-head/internal.d.ts.map +1 -0
- package/table-head/internal.js +13 -0
- package/table-head/internal.js.map +1 -0
- package/table-head/styles.css.js +7 -0
- package/table-head/styles.scoped.css +11 -0
- package/table-head/styles.selectors.js +8 -0
- package/table-header-cell/index.d.ts +4 -0
- package/table-header-cell/index.d.ts.map +1 -0
- package/table-header-cell/index.js +16 -0
- package/table-header-cell/index.js.map +1 -0
- package/table-header-cell/interfaces.d.ts +21 -0
- package/table-header-cell/interfaces.d.ts.map +1 -0
- package/table-header-cell/interfaces.js +2 -0
- package/table-header-cell/interfaces.js.map +1 -0
- package/table-header-cell/internal.d.ts +17 -0
- package/table-header-cell/internal.d.ts.map +1 -0
- package/table-header-cell/internal.js +33 -0
- package/table-header-cell/internal.js.map +1 -0
- package/table-header-cell/styles.css.js +11 -0
- package/table-header-cell/styles.scoped.css +49 -0
- package/table-header-cell/styles.selectors.js +12 -0
- package/table-root/context.d.ts +9 -0
- package/table-root/context.d.ts.map +1 -0
- package/table-root/context.js +16 -0
- package/table-root/context.js.map +1 -0
- package/table-root/grid-template-columns.d.ts +2 -0
- package/table-root/grid-template-columns.d.ts.map +1 -0
- package/table-root/grid-template-columns.js +34 -0
- package/table-root/grid-template-columns.js.map +1 -0
- package/table-root/index.d.ts +7 -0
- package/table-root/index.d.ts.map +1 -0
- package/table-root/index.js +17 -0
- package/table-root/index.js.map +1 -0
- package/table-root/interfaces.d.ts +63 -0
- package/table-root/interfaces.d.ts.map +1 -0
- package/table-root/interfaces.js +2 -0
- package/table-root/interfaces.js.map +1 -0
- package/table-root/internal.d.ts +13 -0
- package/table-root/internal.d.ts.map +1 -0
- package/table-root/internal.js +58 -0
- package/table-root/internal.js.map +1 -0
- package/table-root/styles.css.js +10 -0
- package/table-root/styles.scoped.css +71 -0
- package/table-root/styles.selectors.js +11 -0
- package/table-row/index.d.ts +4 -0
- package/table-row/index.d.ts.map +1 -0
- package/table-row/index.js +16 -0
- package/table-row/index.js.map +1 -0
- package/table-row/interfaces.d.ts +38 -0
- package/table-row/interfaces.d.ts.map +1 -0
- package/table-row/interfaces.js +2 -0
- package/table-row/interfaces.js.map +1 -0
- package/table-row/internal.d.ts +15 -0
- package/table-row/internal.d.ts.map +1 -0
- package/table-row/internal.js +13 -0
- package/table-row/internal.js.map +1 -0
- package/table-row/styles.css.js +7 -0
- package/table-row/styles.scoped.css +42 -0
- package/table-row/styles.selectors.js +8 -0
- package/test-utils/dom/index.d.ts +168 -0
- package/test-utils/dom/index.js +116 -1
- package/test-utils/dom/index.js.map +1 -1
- package/test-utils/dom/table-body/index.d.ts +4 -0
- package/test-utils/dom/table-body/index.js +11 -0
- package/test-utils/dom/table-body/index.js.map +1 -0
- package/test-utils/dom/table-body-cell/index.d.ts +4 -0
- package/test-utils/dom/table-body-cell/index.js +11 -0
- package/test-utils/dom/table-body-cell/index.js.map +1 -0
- package/test-utils/dom/table-head/index.d.ts +4 -0
- package/test-utils/dom/table-head/index.js +11 -0
- package/test-utils/dom/table-head/index.js.map +1 -0
- package/test-utils/dom/table-header-cell/index.d.ts +4 -0
- package/test-utils/dom/table-header-cell/index.js +11 -0
- package/test-utils/dom/table-header-cell/index.js.map +1 -0
- package/test-utils/dom/table-root/index.d.ts +4 -0
- package/test-utils/dom/table-root/index.js +11 -0
- package/test-utils/dom/table-root/index.js.map +1 -0
- package/test-utils/dom/table-row/index.d.ts +4 -0
- package/test-utils/dom/table-row/index.js +11 -0
- package/test-utils/dom/table-row/index.js.map +1 -0
- package/test-utils/selectors/index.d.ts +108 -0
- package/test-utils/selectors/index.js +86 -1
- package/test-utils/selectors/index.js.map +1 -1
- package/test-utils/selectors/table-body/index.d.ts +4 -0
- package/test-utils/selectors/table-body/index.js +11 -0
- package/test-utils/selectors/table-body/index.js.map +1 -0
- package/test-utils/selectors/table-body-cell/index.d.ts +4 -0
- package/test-utils/selectors/table-body-cell/index.js +11 -0
- package/test-utils/selectors/table-body-cell/index.js.map +1 -0
- package/test-utils/selectors/table-head/index.d.ts +4 -0
- package/test-utils/selectors/table-head/index.js +11 -0
- package/test-utils/selectors/table-head/index.js.map +1 -0
- package/test-utils/selectors/table-header-cell/index.d.ts +4 -0
- package/test-utils/selectors/table-header-cell/index.js +11 -0
- package/test-utils/selectors/table-header-cell/index.js.map +1 -0
- package/test-utils/selectors/table-root/index.d.ts +4 -0
- package/test-utils/selectors/table-root/index.js +11 -0
- package/test-utils/selectors/table-root/index.js.map +1 -0
- package/test-utils/selectors/table-row/index.d.ts +4 -0
- package/test-utils/selectors/table-row/index.js +11 -0
- package/test-utils/selectors/table-row/index.js.map +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
+
import { InternalTableHeaderCell } from './internal';
|
|
8
|
+
function TableHeaderCell(props) {
|
|
9
|
+
const { __internalRootRef } = useBaseComponent('TableHeaderCell', {
|
|
10
|
+
props: { disablePaddings: props.disablePaddings },
|
|
11
|
+
});
|
|
12
|
+
return React.createElement(InternalTableHeaderCell, { ...props, ref: __internalRootRef });
|
|
13
|
+
}
|
|
14
|
+
applyDisplayName(TableHeaderCell, 'TableHeaderCell');
|
|
15
|
+
export default TableHeaderCell;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table-header-cell/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAIrD,SAAS,eAAe,CAAC,KAA2B;IAClD,MAAM,EAAE,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QAChE,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE;KAClD,CAAC,CAAC;IACH,OAAO,oBAAC,uBAAuB,OAAK,KAAK,EAAE,GAAG,EAAE,iBAAiB,GAAI,CAAC;AACxE,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { TableHeaderCellProps } from './interfaces';\nimport { InternalTableHeaderCell } from './internal';\n\nexport { TableHeaderCellProps };\n\nfunction TableHeaderCell(props: TableHeaderCellProps) {\n const { __internalRootRef } = useBaseComponent('TableHeaderCell', {\n props: { disablePaddings: props.disablePaddings },\n });\n return <InternalTableHeaderCell {...props} ref={__internalRootRef} />;\n}\n\napplyDisplayName(TableHeaderCell, 'TableHeaderCell');\nexport default TableHeaderCell;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../types/base-component';
|
|
3
|
+
/** Renders a single column header cell. Put the column label, or a composed sort control, in `children`. */
|
|
4
|
+
export interface TableHeaderCellProps extends BaseComponentProps {
|
|
5
|
+
/** Provides an accessible name for the header cell. Use this or `ariaLabelledby`. */
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
/** Sets `aria-labelledby`. Use the ID(s) of visible element(s) that label the header cell. */
|
|
8
|
+
ariaLabelledby?: string;
|
|
9
|
+
/** Sets `aria-describedby`. Use the ID(s) of visible element(s) that describe the header cell. */
|
|
10
|
+
ariaDescribedby?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the column's sort direction on the cell's `aria-sort` attribute.
|
|
13
|
+
*/
|
|
14
|
+
ariaSort?: React.AriaAttributes['aria-sort'];
|
|
15
|
+
/**
|
|
16
|
+
* Removes the cell's built-in padding so you can compose your own spacing. Defaults to `false`.
|
|
17
|
+
*/
|
|
18
|
+
disablePaddings?: boolean;
|
|
19
|
+
/** The header content, such as a column label or a sort control. */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/table-header-cell/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,4GAA4G;AAC5G,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kGAAkG;IAClG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table-header-cell/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';\n\nimport { BaseComponentProps } from '../types/base-component';\n\n/** Renders a single column header cell. Put the column label, or a composed sort control, in `children`. */\nexport interface TableHeaderCellProps extends BaseComponentProps {\n /** Provides an accessible name for the header cell. Use this or `ariaLabelledby`. */\n ariaLabel?: string;\n /** Sets `aria-labelledby`. Use the ID(s) of visible element(s) that label the header cell. */\n ariaLabelledby?: string;\n /** Sets `aria-describedby`. Use the ID(s) of visible element(s) that describe the header cell. */\n ariaDescribedby?: string;\n /**\n * Sets the column's sort direction on the cell's `aria-sort` attribute.\n */\n ariaSort?: React.AriaAttributes['aria-sort'];\n /**\n * Removes the cell's built-in padding so you can compose your own spacing. Defaults to `false`.\n */\n disablePaddings?: boolean;\n /** The header content, such as a column label or a sort control. */\n children?: React.ReactNode;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NativeAttributes } from '../types/native-attributes';
|
|
3
|
+
import { TableHeaderCellProps } from './interfaces';
|
|
4
|
+
export type InternalTableHeaderCellProps = TableHeaderCellProps & {
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
tabIndex?: number;
|
|
7
|
+
nativeAttributes?: NativeAttributes<React.ThHTMLAttributes<HTMLTableCellElement>>;
|
|
8
|
+
disableContentWrapper?: boolean;
|
|
9
|
+
disableDivider?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const InternalTableHeaderCell: React.ForwardRefExoticComponent<TableHeaderCellProps & {
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
tabIndex?: number;
|
|
14
|
+
nativeAttributes?: NativeAttributes<React.ThHTMLAttributes<HTMLTableCellElement>>;
|
|
15
|
+
disableContentWrapper?: boolean;
|
|
16
|
+
disableDivider?: boolean;
|
|
17
|
+
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table-header-cell/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAKpD,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClF,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,uBAAuB;YAT1B,KAAK,CAAC,aAAa;eAChB,MAAM;uBAGE,gBAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;4BACzD,OAAO;qBACd,OAAO;8CA0DzB,CAAC"}
|
|
@@ -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 { getBaseProps } from '../internal/base-component';
|
|
6
|
+
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
7
|
+
import { useTableContext } from '../table-root/context';
|
|
8
|
+
import headerCellStyles from '../table/header-cell/styles.css.js';
|
|
9
|
+
import styles from './styles.css.js';
|
|
10
|
+
export const InternalTableHeaderCell = React.forwardRef((props, ref) => {
|
|
11
|
+
const { ariaLabel, ariaLabelledby, ariaDescribedby, ariaSort, disablePaddings, style, tabIndex, nativeAttributes, disableContentWrapper, disableDivider, children, } = props;
|
|
12
|
+
const { className, ...restBaseProps } = getBaseProps(props);
|
|
13
|
+
const { isGrid } = useTableContext();
|
|
14
|
+
const isVisualRefresh = useVisualRefresh();
|
|
15
|
+
// `scope='col'` is the default for a public header cell; an internal caller's nativeAttributes (e.g. the
|
|
16
|
+
// existing Table's `scope='colgroup'` and computed role/aria-sort) override it. Grid mode adds the role.
|
|
17
|
+
const mergedNativeAttributes = {
|
|
18
|
+
scope: 'col',
|
|
19
|
+
...nativeAttributes,
|
|
20
|
+
...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : undefined),
|
|
21
|
+
...(ariaLabelledby !== undefined ? { 'aria-labelledby': ariaLabelledby } : undefined),
|
|
22
|
+
...(ariaDescribedby !== undefined ? { 'aria-describedby': ariaDescribedby } : undefined),
|
|
23
|
+
...(ariaSort !== undefined ? { 'aria-sort': ariaSort } : undefined),
|
|
24
|
+
...(isGrid ? { role: 'columnheader' } : undefined),
|
|
25
|
+
};
|
|
26
|
+
return (React.createElement("th", { ref: ref, ...restBaseProps, className: clsx(headerCellStyles['header-cell'], className, styles['header-cell'], isGrid && styles['header-cell-grid'],
|
|
27
|
+
// Gated on runtime VR mode: this substrate is shared with the existing Table, which still supports
|
|
28
|
+
// runtime classic visual mode (non-VR). Atomic tables render VR-only, so useVisualRefresh() is true there.
|
|
29
|
+
isVisualRefresh && headerCellStyles['is-visual-refresh'],
|
|
30
|
+
// Own is-visual-refresh marker keys the first-column content-offset reset (VR only).
|
|
31
|
+
isVisualRefresh && styles['is-visual-refresh'], disablePaddings && styles['disable-paddings'], !disablePaddings && headerCellStyles['with-paddings'], disableDivider && styles['no-divider']), style: style, tabIndex: tabIndex, ...mergedNativeAttributes }, disableContentWrapper ? children : React.createElement("div", { className: styles['header-cell-content'] }, children)));
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/table-header-cell/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,gBAAgB,MAAM,oCAAoC,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAYrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC,U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,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC;QACpC,mGAAmG;QACnG,2GAA2G;QAC3G,eAAe,IAAI,gBAAgB,CAAC,mBAAmB,CAAC;QACxD,qFAAqF;QACrF,eAAe,IAAI,MAAM,CAAC,mBAAmB,CAAC,EAC9C,eAAe,IAAI,MAAM,CAAC,kBAAkB,CAAC,EAC7C,CAAC,eAAe,IAAI,gBAAgB,CAAC,eAAe,CAAC,EACrD,cAAc,IAAI,MAAM,CAAC,YAAY,CAAC,CACvC,EACD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,KACd,sBAAsB,IAEzB,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,IAAG,QAAQ,CAAO,CAChG,CACN,CAAC;AACJ,CAAC,CACF,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';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { useTableContext } from '../table-root/context';\nimport { NativeAttributes } from '../types/native-attributes';\nimport { TableHeaderCellProps } from './interfaces';\n\nimport headerCellStyles from '../table/header-cell/styles.css.js';\nimport styles from './styles.css.js';\n\nexport type InternalTableHeaderCellProps = TableHeaderCellProps & {\n style?: React.CSSProperties;\n tabIndex?: number;\n // Non-base native attributes injected by internal callers (the existing Table's th-element): colSpan,\n // scope, role, aria-sort. Base props (className/id/data-*) flow directly and are read via getBaseProps.\n nativeAttributes?: NativeAttributes<React.ThHTMLAttributes<HTMLTableCellElement>>;\n disableContentWrapper?: boolean;\n disableDivider?: boolean;\n};\n\nexport const InternalTableHeaderCell = React.forwardRef<HTMLTableCellElement, InternalTableHeaderCellProps>(\n (props, ref) => {\n const {\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaSort,\n disablePaddings,\n style,\n tabIndex,\n nativeAttributes,\n disableContentWrapper,\n disableDivider,\n children,\n } = props;\n const { className, ...restBaseProps } = getBaseProps(props);\n const { isGrid } = useTableContext();\n const isVisualRefresh = useVisualRefresh();\n // `scope='col'` is the default for a public header cell; an internal caller's nativeAttributes (e.g. the\n // existing Table's `scope='colgroup'` and computed role/aria-sort) override it. Grid mode adds the role.\n const mergedNativeAttributes = {\n scope: 'col' as const,\n ...nativeAttributes,\n ...(ariaLabel !== undefined ? { 'aria-label': ariaLabel } : undefined),\n ...(ariaLabelledby !== undefined ? { 'aria-labelledby': ariaLabelledby } : undefined),\n ...(ariaDescribedby !== undefined ? { 'aria-describedby': ariaDescribedby } : undefined),\n ...(ariaSort !== undefined ? { 'aria-sort': ariaSort } : undefined),\n ...(isGrid ? { role: 'columnheader' as const } : undefined),\n };\n return (\n <th\n ref={ref}\n {...restBaseProps}\n className={clsx(\n headerCellStyles['header-cell'],\n className,\n styles['header-cell'],\n isGrid && styles['header-cell-grid'],\n // Gated on runtime VR mode: this substrate is shared with the existing Table, which still supports\n // runtime classic visual mode (non-VR). Atomic tables render VR-only, so useVisualRefresh() is true there.\n isVisualRefresh && headerCellStyles['is-visual-refresh'],\n // Own is-visual-refresh marker keys the first-column content-offset reset (VR only).\n isVisualRefresh && styles['is-visual-refresh'],\n disablePaddings && styles['disable-paddings'],\n !disablePaddings && headerCellStyles['with-paddings'],\n disableDivider && styles['no-divider']\n )}\n style={style}\n tabIndex={tabIndex}\n {...mergedNativeAttributes}\n >\n {disableContentWrapper ? children : <div className={styles['header-cell-content']}>{children}</div>}\n </th>\n );\n }\n);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import './styles.scoped.css';
|
|
3
|
+
export default {
|
|
4
|
+
"header-cell": "awsui_header-cell_uzgsh_ga5hv_5",
|
|
5
|
+
"no-divider": "awsui_no-divider_uzgsh_ga5hv_9",
|
|
6
|
+
"disable-paddings": "awsui_disable-paddings_uzgsh_ga5hv_23",
|
|
7
|
+
"header-cell-content": "awsui_header-cell-content_uzgsh_ga5hv_28",
|
|
8
|
+
"is-visual-refresh": "awsui_is-visual-refresh_uzgsh_ga5hv_40",
|
|
9
|
+
"header-cell-grid": "awsui_header-cell-grid_uzgsh_ga5hv_44"
|
|
10
|
+
};
|
|
11
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
.awsui_header-cell_uzgsh_ga5hv_5:not(#\9) {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.awsui_header-cell_uzgsh_ga5hv_5:not(#\9):not(:last-child):not(.awsui_no-divider_uzgsh_ga5hv_9)::after {
|
|
10
|
+
content: "";
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset-inline-end: 0;
|
|
13
|
+
inset-block-start: 0;
|
|
14
|
+
inset-block-end: 0;
|
|
15
|
+
min-block-size: var(--line-height-heading-xs-wcrr4i, 18px);
|
|
16
|
+
max-block-size: calc(100% - calc(2 * var(--space-xs-m9b7jf, 8px) + var(--space-xxxs-3ulqs3, 2px)));
|
|
17
|
+
margin-block: auto;
|
|
18
|
+
border-inline-start: var(--border-divider-list-width-2qbfmz, 1px) solid var(--color-border-divider-default-diwd4w, #c6c6cd);
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.awsui_header-cell_uzgsh_ga5hv_5.awsui_disable-paddings_uzgsh_ga5hv_23:not(#\9) {
|
|
24
|
+
padding-block: 0;
|
|
25
|
+
padding-inline: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.awsui_header-cell-content_uzgsh_ga5hv_28:not(#\9) {
|
|
29
|
+
padding-block: var(--space-scaled-xxs-j00t0m, 4px);
|
|
30
|
+
padding-inline-start: var(--space-s-kll7oj, 12px);
|
|
31
|
+
padding-inline-end: var(--space-s-kll7oj, 12px);
|
|
32
|
+
line-height: var(--line-height-body-m-5xw6xo, 20px);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.awsui_header-cell_uzgsh_ga5hv_5.awsui_disable-paddings_uzgsh_ga5hv_23 > .awsui_header-cell-content_uzgsh_ga5hv_28:not(#\9) {
|
|
36
|
+
padding-block: 0;
|
|
37
|
+
padding-inline: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.awsui_header-cell_uzgsh_ga5hv_5.awsui_is-visual-refresh_uzgsh_ga5hv_40:not(#\9):first-child > .awsui_header-cell-content_uzgsh_ga5hv_28 {
|
|
41
|
+
padding-inline-start: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.awsui_header-cell-grid_uzgsh_ga5hv_44:not(#\9) {
|
|
45
|
+
min-inline-size: 0;
|
|
46
|
+
align-self: stretch;
|
|
47
|
+
display: grid;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
// es-module interop with Babel and Typescript
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
module.exports.default = {
|
|
5
|
+
"header-cell": "awsui_header-cell_uzgsh_ga5hv_5",
|
|
6
|
+
"no-divider": "awsui_no-divider_uzgsh_ga5hv_9",
|
|
7
|
+
"disable-paddings": "awsui_disable-paddings_uzgsh_ga5hv_23",
|
|
8
|
+
"header-cell-content": "awsui_header-cell-content_uzgsh_ga5hv_28",
|
|
9
|
+
"is-visual-refresh": "awsui_is-visual-refresh_uzgsh_ga5hv_40",
|
|
10
|
+
"header-cell-grid": "awsui_header-cell-grid_uzgsh_ga5hv_44"
|
|
11
|
+
};
|
|
12
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TableContextValue {
|
|
2
|
+
/** Whether the table uses `grid` layout (vs `auto`). */
|
|
3
|
+
isGrid: boolean;
|
|
4
|
+
/** The `grid-template-columns` value for `grid` layout; `undefined` in `auto` layout. */
|
|
5
|
+
gridTemplateColumns?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const defaultTableContext: TableContextValue;
|
|
8
|
+
export declare const TableContextProvider: import("react").Provider<TableContextValue>;
|
|
9
|
+
export declare function useTableContext(): TableContextValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/table-root/context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,MAAM,EAAE,OAAO,CAAC;IAChB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAKD,eAAO,MAAM,mBAAmB,EAAE,iBAGjC,CAAC;AAIF,eAAO,MAAM,oBAAoB,6CAAwB,CAAC;AAE1D,wBAAgB,eAAe,IAAI,iBAAiB,CAEnD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
// A part rendered outside `TableRoot` reads this default (auto layout) instead of throwing. It is also
|
|
5
|
+
// the value the existing `Table` resets to at its root, so a Table nested inside an atomic grid cell
|
|
6
|
+
// renders from auto layout rather than inheriting the outer table's.
|
|
7
|
+
export const defaultTableContext = {
|
|
8
|
+
isGrid: false,
|
|
9
|
+
gridTemplateColumns: undefined,
|
|
10
|
+
};
|
|
11
|
+
const TableContext = createContext(defaultTableContext);
|
|
12
|
+
export const TableContextProvider = TableContext.Provider;
|
|
13
|
+
export function useTableContext() {
|
|
14
|
+
return useContext(TableContext);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/table-root/context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASlD,uGAAuG;AACvG,qGAAqG;AACrG,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,MAAM,EAAE,KAAK;IACb,mBAAmB,EAAE,SAAS;CAC/B,CAAC;AAEF,MAAM,YAAY,GAAG,aAAa,CAAoB,mBAAmB,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,CAAC;AAE1D,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, useContext } from 'react';\n\nexport interface TableContextValue {\n /** Whether the table uses `grid` layout (vs `auto`). */\n isGrid: boolean;\n /** The `grid-template-columns` value for `grid` layout; `undefined` in `auto` layout. */\n gridTemplateColumns?: string;\n}\n\n// A part rendered outside `TableRoot` reads this default (auto layout) instead of throwing. It is also\n// the value the existing `Table` resets to at its root, so a Table nested inside an atomic grid cell\n// renders from auto layout rather than inheriting the outer table's.\nexport const defaultTableContext: TableContextValue = {\n isGrid: false,\n gridTemplateColumns: undefined,\n};\n\nconst TableContext = createContext<TableContextValue>(defaultTableContext);\n\nexport const TableContextProvider = TableContext.Provider;\n\nexport function useTableContext(): TableContextValue {\n return useContext(TableContext);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-template-columns.d.ts","sourceRoot":"","sources":["../../../src/table-root/grid-template-columns.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,cAAc,CAAC,YAAY,GAAG,MAAM,GAAG,SAAS,CAKxG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Clamp negatives to 0 so one malformed dimension can't invalidate the whole
|
|
2
|
+
// grid-template-columns string; a non-finite value (NaN/Infinity) returns undefined
|
|
3
|
+
// so the caller drops that dimension and falls back to a sensible track.
|
|
4
|
+
function clamp(value) {
|
|
5
|
+
return value === undefined || !Number.isFinite(value) ? undefined : Math.max(0, value);
|
|
6
|
+
}
|
|
7
|
+
// Compiles a `grid` layout's columns into a `grid-template-columns` value; `undefined` in `auto` layout.
|
|
8
|
+
export function computeGridTemplateColumns(columnLayout) {
|
|
9
|
+
if (columnLayout.type !== 'grid') {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return columnLayout.columns.map(compileColumnTrack).join(' ');
|
|
13
|
+
}
|
|
14
|
+
function compileColumnTrack(column) {
|
|
15
|
+
var _a;
|
|
16
|
+
const { size, minWidth, maxWidth } = column;
|
|
17
|
+
const min = `${(_a = clamp(minWidth)) !== null && _a !== void 0 ? _a : 0}px`;
|
|
18
|
+
if (typeof size === 'number') {
|
|
19
|
+
const px = clamp(size);
|
|
20
|
+
if (px !== undefined) {
|
|
21
|
+
return `${px}px`; // fixed track — minWidth/maxWidth don't apply.
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (size) {
|
|
25
|
+
const flex = clamp(size.flex);
|
|
26
|
+
if (flex !== undefined) {
|
|
27
|
+
return `minmax(${min}, ${flex}fr)`; // weighted track — the type forbids a maxWidth (can't cap an fr track).
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// No (or non-finite) size: a hard-capped track (maxWidth) or the default growable track.
|
|
31
|
+
const max = clamp(maxWidth);
|
|
32
|
+
return max !== undefined ? `minmax(${min}, ${max}px)` : `minmax(${min}, 1fr)`;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=grid-template-columns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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;IACD,yFAAyF;IACzF,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,GAAG,QAAQ,CAAC;AAChF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { TableRootProps } from './interfaces';\n\n// Clamp negatives to 0 so one malformed dimension can't invalidate the whole\n// grid-template-columns string; a non-finite value (NaN/Infinity) returns undefined\n// so the caller drops that dimension and falls back to a sensible track.\nfunction clamp(value: number | undefined): number | undefined {\n return value === undefined || !Number.isFinite(value) ? undefined : Math.max(0, value);\n}\n\n// Compiles a `grid` layout's columns into a `grid-template-columns` value; `undefined` in `auto` layout.\nexport function computeGridTemplateColumns(columnLayout: TableRootProps.ColumnLayout): string | undefined {\n if (columnLayout.type !== 'grid') {\n return undefined;\n }\n return columnLayout.columns.map(compileColumnTrack).join(' ');\n}\n\nfunction compileColumnTrack(column: TableRootProps.ColumnDefinition): string {\n const { size, minWidth, maxWidth }: { size?: number | { flex: number }; minWidth?: number; maxWidth?: number } =\n column;\n const min = `${clamp(minWidth) ?? 0}px`;\n if (typeof size === 'number') {\n const px = clamp(size);\n if (px !== undefined) {\n return `${px}px`; // fixed track — minWidth/maxWidth don't apply.\n }\n } else if (size) {\n const flex = clamp(size.flex);\n if (flex !== undefined) {\n return `minmax(${min}, ${flex}fr)`; // weighted track — the type forbids a maxWidth (can't cap an fr track).\n }\n }\n // No (or non-finite) size: a hard-capped track (maxWidth) or the default growable track.\n const max = clamp(maxWidth);\n return max !== undefined ? `minmax(${min}, ${max}px)` : `minmax(${min}, 1fr)`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table-root/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,iBAAS,SAAS,CAAC,EAAE,YAA+B,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,eAM/E;AAID,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
'use client';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
+
import InternalTableRoot from './internal';
|
|
8
|
+
function TableRoot({ columnLayout = { type: 'auto' }, ...props }) {
|
|
9
|
+
const baseComponentProps = useBaseComponent('TableRoot', {
|
|
10
|
+
props: {},
|
|
11
|
+
metadata: { columnLayoutType: columnLayout.type },
|
|
12
|
+
});
|
|
13
|
+
return React.createElement(InternalTableRoot, { columnLayout: columnLayout, ...props, ...baseComponentProps });
|
|
14
|
+
}
|
|
15
|
+
applyDisplayName(TableRoot, 'TableRoot');
|
|
16
|
+
export default TableRoot;
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table-root/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAK3C,SAAS,SAAS,CAAC,EAAE,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,EAAkB;IAC9E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE,gBAAgB,EAAE,YAAY,CAAC,IAAI,EAAE;KAClD,CAAC,CAAC;IACH,OAAO,oBAAC,iBAAiB,IAAC,YAAY,EAAE,YAAY,KAAM,KAAK,KAAM,kBAAkB,GAAI,CAAC;AAC9F,CAAC;AAED,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { TableRootProps } from './interfaces';\nimport InternalTableRoot from './internal';\n\n// Each part is its own top-level component (one default export + props type) so the documenter documents it separately.\nexport { TableRootProps };\n\nfunction TableRoot({ columnLayout = { type: 'auto' }, ...props }: TableRootProps) {\n const baseComponentProps = useBaseComponent('TableRoot', {\n props: {},\n metadata: { columnLayoutType: columnLayout.type },\n });\n return <InternalTableRoot columnLayout={columnLayout} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(TableRoot, 'TableRoot');\n\nexport default TableRoot;\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../types/base-component';
|
|
3
|
+
/**
|
|
4
|
+
* A composable table. You render the head and rows as children, and TableRoot provides the column
|
|
5
|
+
* layout and accessibility semantics.
|
|
6
|
+
*/
|
|
7
|
+
export interface TableRootProps extends BaseComponentProps {
|
|
8
|
+
/**
|
|
9
|
+
* The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Determines how column widths are calculated.
|
|
14
|
+
* * `{ type: 'auto' }` - Renders a standard HTML table whose columns size to their content. No
|
|
15
|
+
* column configuration is required.
|
|
16
|
+
* * `{ type: 'grid'; columns: ColumnDefinition[] }` - Renders a CSS grid. The columns are then provided as
|
|
17
|
+
* an array of objects with the following properties:
|
|
18
|
+
* * `size` (number | { flex: number }) - A number sets a fixed pixel width; `{ flex }` gives the
|
|
19
|
+
* column a weight that shares the remaining space in proportion. Omit it for a flexible column
|
|
20
|
+
* with the default weight of 1.
|
|
21
|
+
* * `minWidth` (number) - The minimum width in pixels for a flexible column. We recommend setting one;
|
|
22
|
+
* without it the column can shrink until its content clips or overlaps at narrow widths.
|
|
23
|
+
* * `maxWidth` (number) - Caps a flexible column's width in pixels (it grows up to the cap). A capped
|
|
24
|
+
* column can't also carry a proportional `flex` weight, so weighting applies to the uncapped columns.
|
|
25
|
+
*
|
|
26
|
+
* Defaults to `{ type: 'auto' }`.
|
|
27
|
+
*/
|
|
28
|
+
columnLayout?: TableRootProps.ColumnLayout;
|
|
29
|
+
/** Provides an accessible name for the table. Use this or `ariaLabelledby` to label the table. */
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
/** Sets the `aria-labelledby` attribute. Use the ID of a visible element that labels the table. */
|
|
32
|
+
ariaLabelledby?: string;
|
|
33
|
+
/** Sets the `aria-describedby` attribute. Use the ID of a visible element that describes the table. */
|
|
34
|
+
ariaDescribedby?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the table's `aria-rowcount`, counting the header row. Provide it only when you render a
|
|
37
|
+
* subset of rows, such as with virtualization; otherwise it is derived from the DOM.
|
|
38
|
+
*/
|
|
39
|
+
ariaRowcount?: number;
|
|
40
|
+
}
|
|
41
|
+
export declare namespace TableRootProps {
|
|
42
|
+
type ColumnLayout = {
|
|
43
|
+
type: 'auto';
|
|
44
|
+
} | {
|
|
45
|
+
type: 'grid';
|
|
46
|
+
columns: ReadonlyArray<ColumnDefinition>;
|
|
47
|
+
};
|
|
48
|
+
type ColumnDefinition = {
|
|
49
|
+
size: number;
|
|
50
|
+
minWidth?: never;
|
|
51
|
+
maxWidth?: never;
|
|
52
|
+
} | {
|
|
53
|
+
size: {
|
|
54
|
+
flex: number;
|
|
55
|
+
};
|
|
56
|
+
minWidth?: number;
|
|
57
|
+
maxWidth?: never;
|
|
58
|
+
} | {
|
|
59
|
+
size?: never;
|
|
60
|
+
minWidth?: number;
|
|
61
|
+
maxWidth?: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/table-root/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC;IAE3C,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uGAAuG;IACvG,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,YAAY,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;KAAE,CAAC;IAEzG,KAAY,gBAAgB,GACxB;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;KAAE,GACpD;QAAE,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;KAAE,GAC/D;QAAE,IAAI,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/table-root/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';\n\nimport { BaseComponentProps } from '../types/base-component';\n\n/**\n * A composable table. You render the head and rows as children, and TableRoot provides the column\n * layout and accessibility semantics.\n */\nexport interface TableRootProps extends BaseComponentProps {\n /**\n * The table's content. Provide a `TableHead` followed by a `TableBody` that contains the rows.\n */\n children: React.ReactNode;\n\n /**\n * Determines how column widths are calculated.\n * * `{ type: 'auto' }` - Renders a standard HTML table whose columns size to their content. No\n * column configuration is required.\n * * `{ type: 'grid'; columns: ColumnDefinition[] }` - Renders a CSS grid. The columns are then provided as\n * an array of objects with the following properties:\n * * `size` (number | { flex: number }) - A number sets a fixed pixel width; `{ flex }` gives the\n * column a weight that shares the remaining space in proportion. Omit it for a flexible column\n * with the default weight of 1.\n * * `minWidth` (number) - The minimum width in pixels for a flexible column. We recommend setting one;\n * without it the column can shrink until its content clips or overlaps at narrow widths.\n * * `maxWidth` (number) - Caps a flexible column's width in pixels (it grows up to the cap). A capped\n * column can't also carry a proportional `flex` weight, so weighting applies to the uncapped columns.\n *\n * Defaults to `{ type: 'auto' }`.\n */\n columnLayout?: TableRootProps.ColumnLayout;\n\n /** Provides an accessible name for the table. Use this or `ariaLabelledby` to label the table. */\n ariaLabel?: string;\n /** Sets the `aria-labelledby` attribute. Use the ID of a visible element that labels the table. */\n ariaLabelledby?: string;\n /** Sets the `aria-describedby` attribute. Use the ID of a visible element that describes the table. */\n ariaDescribedby?: string;\n\n /**\n * Sets the table's `aria-rowcount`, counting the header row. Provide it only when you render a\n * subset of rows, such as with virtualization; otherwise it is derived from the DOM.\n */\n ariaRowcount?: number;\n}\n\nexport namespace TableRootProps {\n export type ColumnLayout = { type: 'auto' } | { type: 'grid'; columns: ReadonlyArray<ColumnDefinition> };\n\n export type ColumnDefinition =\n | { size: number; minWidth?: never; maxWidth?: never }\n | { size: { flex: number }; minWidth?: number; maxWidth?: never }\n | { size?: never; minWidth?: number; maxWidth?: number };\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
2
|
+
import { TableRootProps } from './interfaces';
|
|
3
|
+
export interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}
|
|
4
|
+
export default function InternalTableRoot({
|
|
5
|
+
columnLayout,
|
|
6
|
+
ariaRowcount,
|
|
7
|
+
ariaLabel,
|
|
8
|
+
ariaLabelledby,
|
|
9
|
+
ariaDescribedby,
|
|
10
|
+
children,
|
|
11
|
+
__internalRootRef,
|
|
12
|
+
...rest
|
|
13
|
+
}: InternalTableRootProps): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,WAAW,sBAAuB,SAAQ,cAAc,EAAE,0BAA0B;CAAG;AAE7F,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,YAA+B,EAC/B,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,sBAAsB,eAiExB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';
|
|
6
|
+
import { getBaseProps } from '../internal/base-component';
|
|
7
|
+
import { TableContextProvider } from './context';
|
|
8
|
+
import { computeGridTemplateColumns } from './grid-template-columns';
|
|
9
|
+
import styles from './styles.css.js';
|
|
10
|
+
export default function InternalTableRoot({ columnLayout = { type: 'auto' }, ariaRowcount, ariaLabel, ariaLabelledby, ariaDescribedby, children, __internalRootRef, ...rest }) {
|
|
11
|
+
const isGrid = columnLayout.type === 'grid';
|
|
12
|
+
const gridTemplateColumns = computeGridTemplateColumns(columnLayout);
|
|
13
|
+
// Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are
|
|
14
|
+
// primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.
|
|
15
|
+
const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);
|
|
16
|
+
const baseProps = getBaseProps(rest);
|
|
17
|
+
// A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no
|
|
18
|
+
// focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller
|
|
19
|
+
// as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's
|
|
20
|
+
// getTableWrapperRoleProps.
|
|
21
|
+
const scrollerRef = useRef(null);
|
|
22
|
+
const [isScrollable, setIsScrollable] = useState(false);
|
|
23
|
+
const measureScrollable = useCallback(() => {
|
|
24
|
+
const node = scrollerRef.current;
|
|
25
|
+
if (node) {
|
|
26
|
+
setIsScrollable(node.scrollWidth - node.clientWidth > 1);
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
// Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and
|
|
30
|
+
// auto-layout content growth changes the table box — either can start or stop the horizontal overflow.
|
|
31
|
+
useResizeObserver(scrollerRef, measureScrollable);
|
|
32
|
+
useResizeObserver(() => { var _a, _b; return (_b = (_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.firstElementChild) !== null && _b !== void 0 ? _b : null; }, measureScrollable);
|
|
33
|
+
// Grid column templates change the tracks' overflow without resizing either observed box, so no observer
|
|
34
|
+
// fires — re-measure when the template changes.
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (isGrid) {
|
|
37
|
+
measureScrollable();
|
|
38
|
+
}
|
|
39
|
+
}, [isGrid, gridTemplateColumns, measureScrollable]);
|
|
40
|
+
// Set role="region" whenever scrollable (label passes through even if undefined), matching the
|
|
41
|
+
// existing Table's getTableWrapperRoleProps rather than gating the role on a label.
|
|
42
|
+
const scrollRegionProps = isScrollable
|
|
43
|
+
? {
|
|
44
|
+
role: 'region',
|
|
45
|
+
tabIndex: 0,
|
|
46
|
+
'aria-label': ariaLabel,
|
|
47
|
+
'aria-labelledby': ariaLabelledby,
|
|
48
|
+
}
|
|
49
|
+
: {};
|
|
50
|
+
return (React.createElement("div", { ...baseProps, className: clsx(baseProps.className, styles.root), ref: __internalRootRef },
|
|
51
|
+
React.createElement(TableContextProvider, { value: tableContext },
|
|
52
|
+
React.createElement("div", { className: styles['body-scroller'], ref: scrollerRef, ...scrollRegionProps },
|
|
53
|
+
React.createElement("table", {
|
|
54
|
+
// Grid mode only: display:grid drops the table's implicit role. Auto mode keeps the
|
|
55
|
+
// native role (an explicit role="table" there is redundant and flagged by a11y validators).
|
|
56
|
+
role: isGrid ? 'table' : undefined, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-rowcount": ariaRowcount, className: clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto']) }, children)))));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,gBACtB,SAAS,qBACJ,cAAc,sBACb,eAAe,mBAClB,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAElF,QAAQ,CACH,CACJ,CACe,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { TableContextProvider } from './context';\nimport { computeGridTemplateColumns } from './grid-template-columns';\nimport { TableRootProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}\n\nexport default function InternalTableRoot({\n columnLayout = { type: 'auto' },\n ariaRowcount,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n children,\n __internalRootRef,\n ...rest\n}: InternalTableRootProps) {\n const isGrid = columnLayout.type === 'grid';\n const gridTemplateColumns = computeGridTemplateColumns(columnLayout);\n // Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are\n // primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.\n const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);\n const baseProps = getBaseProps(rest);\n\n // A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no\n // focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller\n // as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's\n // getTableWrapperRoleProps.\n const scrollerRef = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const measureScrollable = useCallback(() => {\n const node = scrollerRef.current;\n if (node) {\n setIsScrollable(node.scrollWidth - node.clientWidth > 1);\n }\n }, []);\n // Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and\n // auto-layout content growth changes the table box — either can start or stop the horizontal overflow.\n useResizeObserver(scrollerRef, measureScrollable);\n useResizeObserver(() => scrollerRef.current?.firstElementChild ?? null, measureScrollable);\n // Grid column templates change the tracks' overflow without resizing either observed box, so no observer\n // fires — re-measure when the template changes.\n useEffect(() => {\n if (isGrid) {\n measureScrollable();\n }\n }, [isGrid, gridTemplateColumns, measureScrollable]);\n\n // Set role=\"region\" whenever scrollable (label passes through even if undefined), matching the\n // existing Table's getTableWrapperRoleProps rather than gating the role on a label.\n const scrollRegionProps = isScrollable\n ? {\n role: 'region' as const,\n tabIndex: 0,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n }\n : {};\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n {/* TableContext supplies this table's column layout to every part. */}\n <TableContextProvider value={tableContext}>\n {/* The page owns vertical scroll; this wrapper reintroduces an inline scroll viewport so a wide table scrolls horizontally instead of spilling out. */}\n <div className={styles['body-scroller']} ref={scrollerRef} {...scrollRegionProps}>\n <table\n // Grid mode only: display:grid drops the table's implicit role. Auto mode keeps the\n // native role (an explicit role=\"table\" there is redundant and flagged by a11y validators).\n role={isGrid ? 'table' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-rowcount={ariaRowcount}\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto'])}\n >\n {children}\n </table>\n </div>\n </TableContextProvider>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import './styles.scoped.css';
|
|
3
|
+
export default {
|
|
4
|
+
"root": "awsui_root_1pkvc_1idsc_9",
|
|
5
|
+
"body-scroller": "awsui_body-scroller_1pkvc_1idsc_46",
|
|
6
|
+
"table": "awsui_table_1pkvc_1idsc_59",
|
|
7
|
+
"table-auto": "awsui_table-auto_1pkvc_1idsc_65",
|
|
8
|
+
"table-grid": "awsui_table-grid_1pkvc_1idsc_69"
|
|
9
|
+
};
|
|
10
|
+
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
/* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
6
|
+
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
7
|
+
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
8
|
+
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
9
|
+
.awsui_root_1pkvc_1idsc_9:not(#\9) {
|
|
10
|
+
border-collapse: separate;
|
|
11
|
+
border-spacing: 0;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
caption-side: top;
|
|
14
|
+
cursor: auto;
|
|
15
|
+
direction: inherit;
|
|
16
|
+
empty-cells: show;
|
|
17
|
+
font-family: serif;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-variant: normal;
|
|
20
|
+
font-stretch: normal;
|
|
21
|
+
hyphens: none;
|
|
22
|
+
letter-spacing: normal;
|
|
23
|
+
list-style: disc outside none;
|
|
24
|
+
tab-size: 8;
|
|
25
|
+
text-align: start;
|
|
26
|
+
text-indent: 0;
|
|
27
|
+
text-shadow: none;
|
|
28
|
+
text-transform: none;
|
|
29
|
+
visibility: visible;
|
|
30
|
+
white-space: normal;
|
|
31
|
+
word-spacing: normal;
|
|
32
|
+
font-size: var(--font-size-body-m-tq5a14, 14px);
|
|
33
|
+
line-height: var(--line-height-body-m-5xw6xo, 20px);
|
|
34
|
+
color: var(--color-text-body-default-b2us04, #0f141a);
|
|
35
|
+
font-weight: var(--font-weight-normal-fr92v6, 400);
|
|
36
|
+
font-family: var(--font-family-base-c9u5cr, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
37
|
+
-webkit-font-smoothing: auto;
|
|
38
|
+
-moz-osx-font-smoothing: auto;
|
|
39
|
+
position: relative;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
inline-size: 100%;
|
|
43
|
+
background: var(--color-background-container-content-mjfil9, #ffffff);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.awsui_body-scroller_1pkvc_1idsc_46:not(#\9) {
|
|
47
|
+
overflow-x: auto;
|
|
48
|
+
}
|
|
49
|
+
body[data-awsui-focus-visible=true] .awsui_body-scroller_1pkvc_1idsc_46:not(#\9):focus {
|
|
50
|
+
outline: 2px dotted transparent;
|
|
51
|
+
outline-offset: 2px;
|
|
52
|
+
border-start-start-radius: var(--border-radius-container-33hhdh, 16px);
|
|
53
|
+
border-start-end-radius: var(--border-radius-container-33hhdh, 16px);
|
|
54
|
+
border-end-start-radius: var(--border-radius-container-33hhdh, 16px);
|
|
55
|
+
border-end-end-radius: var(--border-radius-container-33hhdh, 16px);
|
|
56
|
+
box-shadow: 0 0 0 2px var(--color-border-item-focused-sewkzn, #006ce0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.awsui_table_1pkvc_1idsc_59:not(#\9) {
|
|
60
|
+
inline-size: 100%;
|
|
61
|
+
border-collapse: separate;
|
|
62
|
+
border-spacing: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.awsui_table-auto_1pkvc_1idsc_65:not(#\9) {
|
|
66
|
+
table-layout: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.awsui_table-grid_1pkvc_1idsc_69:not(#\9) {
|
|
70
|
+
display: block;
|
|
71
|
+
}
|
|
@@ -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
|
+
"root": "awsui_root_1pkvc_1idsc_9",
|
|
6
|
+
"body-scroller": "awsui_body-scroller_1pkvc_1idsc_46",
|
|
7
|
+
"table": "awsui_table_1pkvc_1idsc_59",
|
|
8
|
+
"table-auto": "awsui_table-auto_1pkvc_1idsc_65",
|
|
9
|
+
"table-grid": "awsui_table-grid_1pkvc_1idsc_69"
|
|
10
|
+
};
|
|
11
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table-row/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,eAKrC;AAGD,eAAe,QAAQ,CAAC"}
|