@carbon/react
Version:
React components for the Carbon Design System
61 lines (55 loc) • 1.83 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var cx = require('classnames');
var PropTypes = require('prop-types');
var React = require('react');
var usePrefix = require('../../internal/usePrefix.js');
var deprecate = require('../../prop-types/deprecate.js');
const TableToolbar = ({
['aria-label']: ariaLabel = 'data table toolbar',
ariaLabel: deprecatedAriaLabel,
children,
size,
...rest
}) => {
const prefix = usePrefix.usePrefix();
const className = cx({
[`${prefix}--table-toolbar`]: true,
[`${prefix}--table-toolbar--${size}`]: size
});
return /*#__PURE__*/React.createElement("section", _rollupPluginBabelHelpers.extends({
role: "group",
"aria-label": deprecatedAriaLabel || ariaLabel
}, rest, {
className: className
}), children);
};
TableToolbar.propTypes = {
/**
* 'aria-label' of the TableToolbar component.
* Specify a label to be read by screen readers on the container node
*/
['aria-label']: PropTypes.string,
/**
* Deprecated, please use `aria-label` instead.
* Specify a label to be read by screen readers on the container node.
* 'aria-label' of the TableToolbar component.
*/
ariaLabel: deprecate.deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
/**
* Pass in the children that will be rendered inside the TableToolbar
*/
children: PropTypes.node,
/**
* `lg` Change the row height of table
*/
size: PropTypes.oneOf(['sm', 'lg'])
};
exports.default = TableToolbar;