@carbon/react
Version:
React components for the Carbon Design System
51 lines (49 loc) • 1.72 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { usePrefix } from "../../internal/usePrefix.js";
import { deprecate } from "../../prop-types/deprecate.js";
import InlineCheckbox_default from "../InlineCheckbox/index.js";
import classNames from "classnames";
import "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/DataTable/TableSelectAll.tsx
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const TableSelectAll = ({ ariaLabel: deprecatedAriaLabel = "Select all rows in the table", ["aria-label"]: ariaLabel, checked, id, indeterminate, name, onSelect, disabled, className }) => {
return /* @__PURE__ */ jsx("th", {
"aria-live": "off",
scope: "col",
className: classNames(`${usePrefix()}--table-column-checkbox`, className),
children: /* @__PURE__ */ jsx(InlineCheckbox_default, {
"aria-label": ariaLabel || deprecatedAriaLabel,
checked,
id,
indeterminate,
name,
onClick: onSelect,
disabled
})
});
};
TableSelectAll.propTypes = {
["aria-label"]: PropTypes.string,
ariaLabel: deprecate(PropTypes.string, "This prop syntax has been deprecated. Please use the new `aria-label`."),
checked: PropTypes.bool,
className: PropTypes.string,
disabled: PropTypes.bool,
id: PropTypes.string.isRequired,
indeterminate: PropTypes.bool,
name: PropTypes.string.isRequired,
onSelect: PropTypes.func.isRequired
};
//#endregion
export { TableSelectAll as default };