@carbon/ibm-products
Version:
Carbon for IBM Products
175 lines (173 loc) • 6.18 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_devtools = require("../../global/js/utils/devtools.js");
const require_props_helper = require("../../global/js/utils/props-helper.js");
const require_Card = require("../Card/Card.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
//#region src/components/ProductiveCard/ProductiveCard.tsx
const componentName = "ProductiveCard";
const ProductiveCard = (0, react.forwardRef)(({ actionsPlacement = "top", children, ...rest }, ref) => {
const validProps = require_props_helper.prepareProps(rest, [
"media",
"mediaPosition",
"pictogram",
"primaryButtonClick",
"productive",
"secondaryButtonKind"
]);
return /* @__PURE__ */ react.default.createElement(require_Card.Card, {
...validProps,
actionsPlacement,
ref,
productive: true,
...require_devtools.getDevtoolsProps(componentName)
}, children);
});
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: prop_types.default.arrayOf(prop_types.default.shape({
id: prop_types.default.string,
icon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
onKeyDown: prop_types.default.func,
onClick: prop_types.default.func,
iconDescription: prop_types.default.string,
/**
* @deprecated please use the `link.href` instead
*/
href: prop_types.default.string,
link: prop_types.default.shape({ href: prop_types.default.string.isRequired })
})),
/**
* Determines if the action icons are on the top or bottom of the card
*/
actionsPlacement: prop_types.default.oneOf(["top", "bottom"]),
/**
* Content that shows in the body of the card
*/
children: prop_types.default.node,
/**
* Optional user provided class
*/
className: prop_types.default.string,
/**
* Designates which zones of the card are clickable. Refer to design documentation for implementation guidelines
*/
clickZone: prop_types.default.oneOf([
"one",
"two",
"three"
]),
/**
* Optional prop that allows you to pass any component.
*/
decorator: prop_types.default.oneOfType([prop_types.default.node, prop_types.default.bool]),
/**
* Optional header description
*/
description: prop_types.default.oneOfType([prop_types.default.string, prop_types.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: prop_types.default.string,
/**
* Optional label for the top of the card
*/
label: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.node]),
/**
* Provides the callback for a clickable card
*/
onClick: prop_types.default.func,
/**
* Function that's called from the primary button or action icon
*/
onPrimaryButtonClick: prop_types.default.func,
/**
* Function that's called from the secondary button or action icon
*/
onSecondaryButtonClick: prop_types.default.func,
/**
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
*/
/**@ts-ignore */
overflowActions: prop_types.default.arrayOf(prop_types.default.shape({
id: prop_types.default.string,
itemText: prop_types.default.string,
onClick: prop_types.default.func,
onKeyDown: prop_types.default.func
})),
/**
* Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip.
* Overrides `iconDescription` prop.
*/
overflowAriaLabel: prop_types.default.string,
/**
* Determines if the primary button is enabled or not
*/
primaryButtonDisabled: prop_types.default.bool,
/**
* Optionally specify an href for your Button to become an <a> element
*/
primaryButtonHref: prop_types.default.string,
/**
* Optional prop to allow overriding the icon rendering. Can be a React component class
*/
/**@ts-ignore */
primaryButtonIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
/**
* Determines if the primary button is on the top or bottom of the card
*/
primaryButtonPlacement: prop_types.default.oneOf(["top", "bottom"]),
/**
* The text that's displayed in the primary button
*/
/**@ts-ignore */
primaryButtonText: prop_types.default.node,
/**
* Optionally specify an href for your Button to become an <a> element
*/
secondaryButtonHref: prop_types.default.string,
/**
* Optional prop to allow overriding the icon rendering. Can be a React component class
*/
/**@ts-ignore */
secondaryButtonIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
/**
* Determines if the secondary button is on the top or bottom of the card
*/
secondaryButtonPlacement: prop_types.default.oneOf(["top", "bottom"]),
/**
* The text that's displayed in the secondary button
*/
/**@ts-ignore */
secondaryButtonText: prop_types.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: prop_types.default.oneOfType([prop_types.default.node, prop_types.default.bool]),
/**
* Title that's displayed at the top of the card
*/
title: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.node]),
/**
* Determines title size
*/
titleSize: prop_types.default.oneOf(["default", "large"])
};
ProductiveCard.displayName = componentName;
//#endregion
exports.ProductiveCard = ProductiveCard;