@carbon/ibm-products
Version:
Carbon for IBM Products
63 lines (61 loc) • 2.32 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_index = require("../../node_modules/classnames/index.js");
const require_settings = require("../../settings.js");
const require_devtools = require("../../global/js/utils/devtools.js");
const require_context = require("../Coachmark/utils/context.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let _carbon_react = require("@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__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.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.default.forwardRef(({ className, label, ...rest }, ref) => {
const coachmark = require_context.useCoachmark();
if (!coachmark) return /* @__PURE__ */ react.default.createElement("div", null, "CoachmarkButton is to be use exclusively within the target prop of Coachmark");
return /* @__PURE__ */ react.default.createElement(_carbon_react.Button, {
...rest,
className: (0, import_classnames.default)(blockClass, className, {}),
ref,
role: "button",
"aria-label": label,
...require_devtools.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: prop_types.default.string,
/**
* The aria label.
*/
label: prop_types.default.string.isRequired
};
//#endregion
exports.CoachmarkButton = CoachmarkButton;