@carbon/ibm-products
Version:
Carbon for IBM Products
91 lines (89 loc) • 3.28 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../../node_modules/classnames/index.js");
const require_settings = require("../../settings.js");
const require_devtools = require("../../global/js/utils/devtools.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let _carbon_react = require("@carbon/react");
let _carbon_react_icons = require("@carbon/react/icons");
//#region src/components/StatusIndicator/StatusIndicator.jsx
/**
* Copyright IBM Corp. 2024, 2024
*
* 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 import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_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
*/
let StatusIndicator = react.default.forwardRef(({ children, className, onRetry, retryLabel = defaults.retryLabel, showRetry = defaults.showRetry, title, ...rest }, ref) => {
return /* @__PURE__ */ react.default.createElement("div", {
...rest,
className: (0, import_classnames.default)(blockClass, className),
ref,
...require_devtools.getDevtoolsProps(componentName)
}, title && /* @__PURE__ */ react.default.createElement("h1", { className: `${blockClass}__title` }, title), /* @__PURE__ */ react.default.createElement("ul", { className: `${blockClass}__list` }, children), showRetry && onRetry && retryLabel && /* @__PURE__ */ react.default.createElement(_carbon_react.Button, {
className: `${blockClass}__button`,
kind: "ghost",
onClick: onRetry,
onKeyUp: onRetry,
renderIcon: () => /* @__PURE__ */ react.default.createElement(_carbon_react_icons.Restart, { size: 16 })
}, retryLabel));
});
StatusIndicator.deprecated = {
level: "warn",
details: `This component is deprecated`
};
StatusIndicator = require_settings.pkg.checkComponentEnabled(StatusIndicator, componentName);
StatusIndicator.displayName = componentName;
StatusIndicator.propTypes = {
/**
* Provide the contents of the StatusIndicator.
*/
children: prop_types.default.node.isRequired,
/**
* Provide an optional class to be applied to the containing node.
*/
className: prop_types.default.string,
/**
* Optional callback function for the retry button.
*/
onRetry: prop_types.default.func,
/**
* The text for the retry button.
*/
retryLabel: prop_types.default.string,
/**
* Set to `true` to show the retry button.
*
* `retryLabel` and `onRetry` must also be defined.
*/
showRetry: prop_types.default.bool,
/**
* The title that appears at the top of the list.
*/
title: prop_types.default.node
};
//#endregion
Object.defineProperty(exports, "StatusIndicator", {
enumerable: true,
get: function() {
return StatusIndicator;
}
});