UNPKG

@carbon/react

Version:

React components for the Carbon Design System

49 lines (43 loc) 1.48 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. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var PropTypes = require('prop-types'); var React = require('react'); var iconsReact = require('@carbon/icons-react'); var Button = require('../Button/Button.js'); require('../Button/Button.Skeleton.js'); const TableBatchAction = ({ renderIcon = iconsReact.AddFilled, iconDescription = 'Add', ...props }) => /*#__PURE__*/React.createElement(Button.default, _rollupPluginBabelHelpers.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]) }; exports.default = TableBatchAction;