UNPKG

@carbon/ibm-products

Version:
58 lines (56 loc) 1.95 kB
/** * 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. */ import { __toESM } from "../../../_virtual/_rolldown/runtime.js"; import { require_classnames } from "../../../node_modules/classnames/index.js"; import { pkg } from "../../../settings.js"; import { getDevtoolsProps } from "../../../global/js/utils/devtools.js"; import React, { forwardRef } from "react"; import PropTypes from "prop-types"; //#region src/components/Card/next/CardAction.tsx /** * Copyright IBM Corp. 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. */ var import_classnames = /* @__PURE__ */ __toESM(require_classnames()); const blockClass = `${pkg.prefix}--card-next`; const componentName = "CardAction"; /** * CardAction is a wrapper for interactive elements in the card footer. * Its presence signals action-set layout to the footer (no padding, auto * border, stretch behavior). * * Note: do not use CardAction inside a clickable card — clickable cards * should not contain interactive elements (see usage guidelines). */ let CardAction = forwardRef(({ children, className, ...rest }, ref) => { return /* @__PURE__ */ React.createElement("div", { ...rest, ref, className: (0, import_classnames.default)(`${blockClass}__action`, className), ...getDevtoolsProps(componentName) }, children); }); CardAction.propTypes = { /** * Provide the contents of the CardAction. */ children: PropTypes.node, /** * Provide an optional class to be applied to the containing node. */ className: PropTypes.string, /** * Label shown in the overflow menu when this action is hidden. */ label: PropTypes.string }; CardAction = pkg.checkComponentEnabled(CardAction, componentName); CardAction.displayName = componentName; //#endregion export { CardAction };