@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
72 lines (68 loc) • 1.77 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import PropTypes from 'prop-types';
import React__default from 'react';
import InlineCheckbox from '../InlineCheckbox/InlineCheckbox.js';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
const TableSelectAll = _ref => {
let {
ariaLabel,
checked,
id,
indeterminate,
name,
onSelect,
disabled,
className
} = _ref;
const prefix = usePrefix();
return /*#__PURE__*/React__default.createElement("th", {
scope: "col",
className: cx(`${prefix}--table-column-checkbox`, className)
}, /*#__PURE__*/React__default.createElement(InlineCheckbox, {
"aria-label": ariaLabel,
checked: checked,
id: id,
indeterminate: indeterminate,
name: name,
onClick: onSelect,
disabled: disabled
}));
};
TableSelectAll.propTypes = {
/**
* Specify the aria label for the underlying input control
*/
ariaLabel: PropTypes.string.isRequired,
/**
* Specify whether all items are selected, or not
*/
checked: PropTypes.bool.isRequired,
/**
* The CSS class names of the cell that wraps the underlying input control
*/
className: PropTypes.string,
/**
* Specify whether the checkbox input should be disabled
*/
disabled: PropTypes.bool,
/**
* Provide an `id` for the underlying input control
*/
id: PropTypes.string.isRequired,
/**
* Specify whether the selection only has a subset of all items
*/
indeterminate: PropTypes.bool,
/**
* Provide a `name` for the underlying input control
*/
name: PropTypes.string.isRequired,
/**
* Provide a handler to listen to when a user initiates a selection request
*/
onSelect: PropTypes.func.isRequired
};
export { TableSelectAll as default };