UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

103 lines (94 loc) 3.23 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. */ 'use strict'; 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 _Restart; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${settings.pkg.prefix}--status-indicator`; const componentName = 'StatusIndicator'; const defaults = { retryLabel: 'Retry', showRetry: false }; /** * A list of icon/description pairs used to show multiple states of progress. * @deprecated This component is deprecated */ exports.StatusIndicator = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { children, className, onRetry, retryLabel = defaults.retryLabel, showRetry = defaults.showRetry, title, ...rest } = _ref; return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, { className: cx(blockClass, className), ref: ref }, devtools.getDevtoolsProps(componentName)), title && /*#__PURE__*/React.createElement("h1", { className: `${blockClass}__title` }, title), /*#__PURE__*/React.createElement("ul", { className: `${blockClass}__list` }, children), showRetry && onRetry && retryLabel && /*#__PURE__*/React.createElement(react.Button, { className: `${blockClass}__button`, kind: "ghost", onClick: onRetry, onKeyUp: onRetry, renderIcon: () => _Restart || (_Restart = /*#__PURE__*/React.createElement(icons.Restart, { size: 16 })) }, retryLabel)); }); exports.StatusIndicator.deprecated = { level: 'warn', details: `This component is deprecated` }; // Return a placeholder if not released and not enabled by feature flag exports.StatusIndicator = settings.pkg.checkComponentEnabled(exports.StatusIndicator, componentName); // The display name of the component, used by React. Note that displayName // is used in preference to relying on function.name. exports.StatusIndicator.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.StatusIndicator.propTypes = { /** * Provide the contents of the StatusIndicator. */ children: index.default.node.isRequired, /** * Provide an optional class to be applied to the containing node. */ className: index.default.string, /** * Optional callback function for the retry button. */ onRetry: index.default.func, /** * The text for the retry button. */ retryLabel: index.default.string, /** * Set to `true` to show the retry button. * * `retryLabel` and `onRetry` must also be defined. */ showRetry: index.default.bool, /** * The title that appears at the top of the list. */ title: index.default.node };