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