UNPKG

@carbon/react

Version:

React components for the Carbon Design System

54 lines (46 loc) 1.84 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'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); const TableBatchAction = ({ renderIcon = iconsReact.AddFilled, iconDescription = 'Add', ...props }) => /*#__PURE__*/React__default["default"].createElement(Button["default"], _rollupPluginBabelHelpers["extends"]({ renderIcon: renderIcon, iconDescription: iconDescription }, props)); TableBatchAction.propTypes = { /** * Specify if the button is an icon-only button */ hasIconOnly: PropTypes__default["default"].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__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object]) }; exports["default"] = TableBatchAction;