UNPKG

@carbon/ibm-products

Version:
73 lines (71 loc) 3.11 kB
/** * 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. */ import { __toESM } from "../../_virtual/_rolldown/runtime.js"; import { require_classnames } from "../../node_modules/classnames/index.js"; import { pkg } from "../../settings.js"; import { getDevtoolsProps } from "../../global/js/utils/devtools.js"; import React from "react"; import PropTypes from "prop-types"; import { InlineLoading } from "@carbon/react"; import { CheckmarkOutline, CircleStroke, ErrorOutline } from "@carbon/react/icons"; //#region src/components/StatusIndicator/StatusIndicatorStep.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__ */ __toESM(require_classnames()); 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 = React.forwardRef(({ className, description, errorMessage, status = defaults.status, ...rest }, ref) => { return /* @__PURE__ */ React.createElement("li", { ...rest, className: (0, import_classnames.default)(blockClass, className, `${blockClass}--${status}`), ref, ...getDevtoolsProps(componentName) }, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__details` }, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__icon` }, status === "inactive" && /* @__PURE__ */ React.createElement(CircleStroke, { size: 16, viewBox: "1 1 14 14" }), status === "active" && /* @__PURE__ */ React.createElement(InlineLoading, null), status === "error" && /* @__PURE__ */ React.createElement(ErrorOutline, { size: 16 }), status === "finished" && /* @__PURE__ */ React.createElement(CheckmarkOutline, { size: 16 })), /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__text` }, description)), status === "error" && errorMessage && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__error-message` }, errorMessage)); }); StatusIndicatorStep.deprecated = { level: "warn", details: `This component is deprecated` }; StatusIndicatorStep = pkg.checkComponentEnabled(StatusIndicatorStep, componentName); StatusIndicatorStep.displayName = componentName; 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 }; //#endregion export { StatusIndicatorStep };