UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

93 lines (84 loc) 3.61 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 { getDevtoolsProps } from '../../global/js/utils/devtools.js'; import { pkg } from '../../settings.js'; import { InlineLoading } from '@carbon/react'; import { CircleStroke, ErrorOutline, CheckmarkOutline } from '@carbon/react/icons'; var _CircleStroke, _InlineLoading, _ErrorOutline, _CheckmarkOutline; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--status-indicator-step`; const componentName = 'StatusIndicatorStep'; const defaults = { status: 'inactive' }; /** * An icon/description pair that describes one step of the `StatusIndicator`. * @deprecated This component is deprecated */ let StatusIndicatorStep = /*#__PURE__*/React__default.forwardRef((_ref, ref) => { let { className, description, errorMessage, status = defaults.status, ...rest } = _ref; return /*#__PURE__*/React__default.createElement("li", _extends({}, rest, { className: cx(blockClass, className, `${blockClass}--${status}`), ref: ref }, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", { className: `${blockClass}__details` }, /*#__PURE__*/React__default.createElement("div", { className: `${blockClass}__icon` }, status === 'inactive' && (_CircleStroke || (_CircleStroke = /*#__PURE__*/React__default.createElement(CircleStroke, { size: 16, viewBox: "1 1 14 14" }))), status === 'active' && (_InlineLoading || (_InlineLoading = /*#__PURE__*/React__default.createElement(InlineLoading, null))), status === 'error' && (_ErrorOutline || (_ErrorOutline = /*#__PURE__*/React__default.createElement(ErrorOutline, { size: 16 }))), status === 'finished' && (_CheckmarkOutline || (_CheckmarkOutline = /*#__PURE__*/React__default.createElement(CheckmarkOutline, { size: 16 })))), /*#__PURE__*/React__default.createElement("div", { className: `${blockClass}__text` }, description)), status === 'error' && errorMessage && /*#__PURE__*/React__default.createElement("div", { className: `${blockClass}__error-message` }, errorMessage)); }); StatusIndicatorStep.deprecated = { level: 'warn', details: `This component is deprecated` }; // Return a placeholder if not released and not enabled by feature flag StatusIndicatorStep = pkg.checkComponentEnabled(StatusIndicatorStep, componentName); // The display name of the component, used by React. Note that displayName // is used in preference to relying on function.name. StatusIndicatorStep.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. StatusIndicatorStep.propTypes = { /** * Provide an optional class to be applied to the containing node. */ className: PropTypes.string, /** * The text associated with the icon. */ description: PropTypes.string.isRequired, /** * This message will appear below the description if the `status` is "error". */ errorMessage: PropTypes.string, /** * Each `status` represents a different icon.. */ status: PropTypes.oneOf(['inactive', 'active', 'error', 'finished']).isRequired }; export { StatusIndicatorStep };