UNPKG

@carbon/ibm-products

Version:
61 lines (59 loc) 2.05 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 { useCoachmark } from "../Coachmark/utils/context.js"; import React from "react"; import PropTypes from "prop-types"; import { Button } from "@carbon/react"; //#region src/components/CoachmarkButton/CoachmarkButton.tsx /** * Copyright IBM Corp. 2023, 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. */ var import_classnames = /* @__PURE__ */ __toESM(require_classnames()); const blockClass = `${pkg.prefix}--coachmark-button`; const componentName = "CoachmarkButton"; /** * Use CoachmarkButton for the target prop of a Coachmark component. * @deprecated This component is deprecated. */ const CoachmarkButton = React.forwardRef(({ className, label, ...rest }, ref) => { const coachmark = useCoachmark(); if (!coachmark) return /* @__PURE__ */ React.createElement("div", null, "CoachmarkButton is to be use exclusively within the target prop of Coachmark"); return /* @__PURE__ */ React.createElement(Button, { ...rest, className: (0, import_classnames.default)(blockClass, className, {}), ref, role: "button", "aria-label": label, ...getDevtoolsProps(componentName), ...coachmark.buttonProps }, label); }); /**@ts-ignore*/ CoachmarkButton.deprecated = { level: "warn", details: `${componentName} is deprecated.` }; CoachmarkButton.displayName = componentName; CoachmarkButton.propTypes = { /** * Provide an optional class to be applied to the containing node. */ className: PropTypes.string, /** * The aria label. */ label: PropTypes.string.isRequired }; //#endregion export { CoachmarkButton };