@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
24 lines • 2.04 kB
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import { getAnalyticsMetadataAttribute } from '@awsui/component-toolkit/internal/analytics-metadata';
import ScreenreaderOnly from '../../internal/components/screenreader-only';
import { TableTdElement } from '../body-cell/td-element';
import { TableThElement } from '../header-cell/th-element';
import { Divider } from '../resizer';
import { SelectionControl } from './selection-control';
import styles from '../styles.css.js';
export function TableHeaderSelectionCell({ focusedComponent, singleSelectionHeaderAriaLabel, getSelectAllProps, onFocusMove, ...props }) {
const selectAllProps = getSelectAllProps ? getSelectAllProps() : undefined;
return (React.createElement(TableThElement, { ...props, isSelection: true, colIndex: 0, focusedComponent: focusedComponent, ariaLabel: selectAllProps === null || selectAllProps === void 0 ? void 0 : selectAllProps.selectionGroupLabel, ...getAnalyticsMetadataAttribute({
action: (selectAllProps === null || selectAllProps === void 0 ? void 0 : selectAllProps.checked) ? 'deselectAll' : 'selectAll',
}) },
selectAllProps ? (React.createElement(SelectionControl, { onFocusDown: event => {
onFocusMove(event.target, -1, +1);
}, focusedComponent: focusedComponent, ...selectAllProps, ...(props.sticky ? { tabIndex: -1 } : {}) })) : (React.createElement(ScreenreaderOnly, null, singleSelectionHeaderAriaLabel)),
React.createElement(Divider, { className: styles['resize-divider'] })));
}
export function TableBodySelectionCell({ selectionControlProps, ...props }) {
return (React.createElement(TableTdElement, { ...props, isSelection: true, wrapLines: false, isEditable: false, isEditing: false, colIndex: 0 }, selectionControlProps ? (React.createElement(SelectionControl, { ...selectionControlProps, verticalAlign: props.verticalAlign })) : null));
}
//# sourceMappingURL=selection-cell.js.map