UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

170 lines (165 loc) 6.21 kB
/** * Copyright IBM Corp. 2020, 2025 * * 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'; var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var React = require('react'); var index = require('../../_virtual/index.js'); var devtools = require('../../global/js/utils/devtools.js'); var settings = require('../../settings.js'); var propsHelper = require('../../global/js/utils/props-helper.js'); var Card = require('../Card/Card.js'); const componentName = 'ProductiveCard'; exports.ProductiveCard = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { actionsPlacement = 'top', ...rest } = _ref; const validProps = propsHelper.prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']); return /*#__PURE__*/React.createElement(Card.Card, _rollupPluginBabelHelpers.extends({}, validProps, { actionsPlacement, ref, productive: true }, devtools.getDevtoolsProps(componentName))); }); // Return a placeholder if not released and not enabled by feature flag exports.ProductiveCard = settings.pkg.checkComponentEnabled(exports.ProductiveCard, componentName); exports.ProductiveCard.propTypes = { /** * Icons that are displayed on the card. Refer to design documentation for implementation guidelines. Note: href is deprecated. Set link.href for href functionality. If you are setting link object, href is a required property. link object supports all anchor element properties. Precedence: link.href > href. If link.href or href is set => anchor element, else button. */ /**@ts-ignore */ actionIcons: index.default.arrayOf(index.default.shape({ id: index.default.string, icon: index.default.oneOfType([index.default.func, index.default.object]), onKeyDown: index.default.func, onClick: index.default.func, iconDescription: index.default.string, /** * @deprecated please use the `link.href` instead */ href: index.default.string, link: index.default.shape({ href: index.default.string.isRequired }) })), /** * Determines if the action icons are on the top or bottom of the card */ actionsPlacement: index.default.oneOf(['top', 'bottom']), /** * Content that shows in the body of the card */ children: index.default.node, /** * Optional user provided class */ className: index.default.string, /** * Designates which zones of the card are clickable. Refer to design documentation for implementation guidelines */ clickZone: index.default.oneOf(['one', 'two', 'three']), /** * Optional prop that allows you to pass any component. */ decorator: index.default.oneOfType([index.default.node, index.default.bool]), /** * Optional header description */ description: index.default.oneOfType([index.default.string, index.default.object, index.default.node]), /** * Sets the text for the OverflowMenu trigger button tooltip and OverflowMenu aria label, * gets overridden by the `overflowAriaLabel` prop. * * @deprecated Please use the `overflowAriaLabel` prop instead. */ iconDescription: index.default.string, /** * Optional label for the top of the card */ label: index.default.oneOfType([index.default.string, index.default.object, index.default.node]), /** * Provides the callback for a clickable card */ onClick: index.default.func, /** * Function that's called from the primary button or action icon */ onPrimaryButtonClick: index.default.func, /** * Function that's called from the secondary button or action icon */ onSecondaryButtonClick: index.default.func, /** * Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines */ /**@ts-ignore */ overflowActions: index.default.arrayOf(index.default.shape({ id: index.default.string, itemText: index.default.string, onClick: index.default.func, onKeyDown: index.default.func })), /** * Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip. * Overrides `iconDescription` prop. */ overflowAriaLabel: index.default.string, /** * Determines if the primary button is enabled or not */ primaryButtonDisabled: index.default.bool, /** * Optionally specify an href for your Button to become an <a> element */ primaryButtonHref: index.default.string, /** * Optional prop to allow overriding the icon rendering. Can be a React component class */ /**@ts-ignore */ primaryButtonIcon: index.default.oneOfType([index.default.func, index.default.object]), /** * Determines if the primary button is on the top or bottom of the card */ primaryButtonPlacement: index.default.oneOf(['top', 'bottom']), /** * The text that's displayed in the primary button */ /**@ts-ignore */ primaryButtonText: index.default.node, /** * Optionally specify an href for your Button to become an <a> element */ secondaryButtonHref: index.default.string, /** * Optional prop to allow overriding the icon rendering. Can be a React component class */ /**@ts-ignore */ secondaryButtonIcon: index.default.oneOfType([index.default.func, index.default.object]), /** * Determines if the secondary button is on the top or bottom of the card */ secondaryButtonPlacement: index.default.oneOf(['top', 'bottom']), /** * The text that's displayed in the secondary button */ /**@ts-ignore */ secondaryButtonText: index.default.node, /** * **Experimental:** For all cases a `Slug` component can be provided. * Clickable tiles only accept a boolean value of true and display a hollow slug. */ slug: index.default.oneOfType([index.default.node, index.default.bool]), /** * Title that's displayed at the top of the card */ title: index.default.oneOfType([index.default.string, index.default.object, index.default.node]), /** * Determines title size */ titleSize: index.default.oneOf(['default', 'large']) }; exports.ProductiveCard.displayName = componentName;