@carbon/react
Version:
React components for the Carbon Design System
66 lines (58 loc) • 2.25 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');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
const TableToolbar = ({
['aria-label']: ariaLabel = 'data table toolbar',
ariaLabel: deprecatedAriaLabel,
children,
size,
...rest
}) => {
const prefix = usePrefix.usePrefix();
const className = cx__default["default"]({
[`${prefix}--table-toolbar`]: true,
[`${prefix}--table-toolbar--${size}`]: size
});
return /*#__PURE__*/React__default["default"].createElement("section", _rollupPluginBabelHelpers["extends"]({
"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__default["default"].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["default"](PropTypes__default["default"].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__default["default"].node,
/**
* `lg` Change the row height of table
*/
size: PropTypes__default["default"].oneOf(['sm', 'lg'])
};
exports["default"] = TableToolbar;