@carbon/react
Version:
React components for the Carbon Design System
56 lines (52 loc) • 1.68 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.
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { usePrefix } from '../../internal/usePrefix.js';
import { deprecate } from '../../prop-types/deprecate.js';
const TableToolbar = ({
['aria-label']: ariaLabel = 'data table toolbar',
ariaLabel: deprecatedAriaLabel,
children,
size,
...rest
}) => {
const prefix = usePrefix();
const className = cx({
[`${prefix}--table-toolbar`]: true,
[`${prefix}--table-toolbar--${size}`]: size
});
return /*#__PURE__*/React.createElement("section", _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.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(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'])
};
export { TableToolbar as default };