UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

50 lines (44 loc) 2.26 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 '../../global/js/package-settings.js'; import { CodeSnippet } from '@carbon/react'; var _p, _br, _p2, _br2, _p3; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--canary`; /** * Canary component used when the component requested is not yet production */ const Canary = (_ref /*, originalArgs*/) => { let { className, componentName, ...rest } = _ref; const instructions = ` import { pkg } from '@carbon/ibm-products'; // NOTE: must happen before component is first used pkg.component.${componentName} = true; `; return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, { className: cx(blockClass, className) }), /*#__PURE__*/React__default.createElement("h2", null, "This component ", /*#__PURE__*/React__default.createElement("strong", null, componentName), " is not ready yet."), _p || (_p = /*#__PURE__*/React__default.createElement("p", null, "To enable it, initialize package flags before the component is first used.")), _br || (_br = /*#__PURE__*/React__default.createElement("br", null)), _p2 || (_p2 = /*#__PURE__*/React__default.createElement("p", null, "e.g. in main.js")), /*#__PURE__*/React__default.createElement(CodeSnippet, { type: "multi" }, instructions), _br2 || (_br2 = /*#__PURE__*/React__default.createElement("br", null)), _p3 || (_p3 = /*#__PURE__*/React__default.createElement("p", null, "View a live example on", ' ', /*#__PURE__*/React__default.createElement("a", { href: "https://codesandbox.io/s/example-component-olif5?file=/src/config.js" }, "codesandbox"), "."))); }; Canary.propTypes = { /** Provide an optional class to be applied to the containing node */ className: PropTypes.string, /** Name of the component that is not ready yet */ componentName: PropTypes.string.isRequired }; export { Canary };