@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
82 lines (74 loc) • 2.38 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var PropTypes = require('prop-types');
var React = require('react');
var InlineCheckbox = require('../InlineCheckbox/InlineCheckbox.js');
var cx = require('classnames');
var usePrefix = require('../../internal/usePrefix.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
const TableSelectAll = _ref => {
let {
ariaLabel,
checked,
id,
indeterminate,
name,
onSelect,
disabled,
className
} = _ref;
const prefix = usePrefix.usePrefix();
return /*#__PURE__*/React__default["default"].createElement("th", {
scope: "col",
className: cx__default["default"](`${prefix}--table-column-checkbox`, className)
}, /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], {
"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__default["default"].string.isRequired,
/**
* Specify whether all items are selected, or not
*/
checked: PropTypes__default["default"].bool.isRequired,
/**
* The CSS class names of the cell that wraps the underlying input control
*/
className: PropTypes__default["default"].string,
/**
* Specify whether the checkbox input should be disabled
*/
disabled: PropTypes__default["default"].bool,
/**
* Provide an `id` for the underlying input control
*/
id: PropTypes__default["default"].string.isRequired,
/**
* Specify whether the selection only has a subset of all items
*/
indeterminate: PropTypes__default["default"].bool,
/**
* Provide a `name` for the underlying input control
*/
name: PropTypes__default["default"].string.isRequired,
/**
* Provide a handler to listen to when a user initiates a selection request
*/
onSelect: PropTypes__default["default"].func.isRequired
};
exports["default"] = TableSelectAll;