UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

64 lines (55 loc) 2.02 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. */ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import React__default from 'react'; import PropTypes from '../../_virtual/index.js'; import cx from 'classnames'; import { pkg } from '../../settings.js'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--tooltip-trigger`; const componentName = 'TooltipTrigger'; // NOTE: the component SCSS is not imported here: it is rolled up separately. /** * This is an tooltip trigger as Carbon Tooltip requires an active element to work but provides * no blanked button. */ let TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => { let { children, className, // Collect any other property values passed in. ...rest } = _ref; return /*#__PURE__*/React__default.createElement("button", _extends({ type: "button", ref: ref }, rest, { className: cx(blockClass, // Apply the block class to the main HTML element className // Apply any supplied class names to the main HTML element. ) }), children); }); // Return a placeholder if not released and not enabled by feature flag. TooltipTrigger = pkg.checkComponentEnabled(TooltipTrigger, componentName); // The display name of the component, used by React. Note that displayName // is used in preference to relying on function.name. TooltipTrigger.displayName = componentName; // The types and DocGen commentary for the component props, // in alphabetical order (for consistency). // See https://www.npmjs.com/package/prop-types#usage. TooltipTrigger.propTypes = { /** * Child content of tooltip trigger */ children: PropTypes.node, /** * Provide an optional class to be applied to the containing node. */ className: PropTypes.string }; export { TooltipTrigger };