UNPKG

@carbon/react

Version:

React components for the Carbon Design System

45 lines (41 loc) 1.34 kB
/** * 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 PropTypes from 'prop-types'; import React from 'react'; import { AddFilled } from '@carbon/icons-react'; import Button from '../Button/Button.js'; import '../Button/Button.Skeleton.js'; const TableBatchAction = ({ renderIcon = AddFilled, iconDescription = 'Add', ...props }) => /*#__PURE__*/React.createElement(Button, _extends({ renderIcon: renderIcon, iconDescription: iconDescription }, props)); TableBatchAction.propTypes = { /** * Specify if the button is an icon-only button */ hasIconOnly: PropTypes.bool, /** * If specifying the `renderIcon` prop, provide a description for that icon that can * be read by screen readers */ iconDescription: props => { if (props.renderIcon && !props.children && !props.iconDescription) { return new Error('renderIcon property specified without also providing an iconDescription property.'); } return undefined; }, /** * A component used to render an icon. */ renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]) }; export { TableBatchAction as default };