| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.ProgressStep = exports.ProgressStepVariant = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const react_1 = require("react"); |
| 7 |
const progress_stepper_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/ProgressStepper/progress-stepper")); |
| 8 |
const react_styles_1 = require("@patternfly/react-styles"); |
| 9 |
const rh_ui_check_circle_fill_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-ui-check-circle-fill-icon')); |
| 10 |
const resources_full_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/resources-full-icon')); |
| 11 |
const rh_ui_warning_fill_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-ui-warning-fill-icon')); |
| 12 |
const rh_ui_error_fill_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/rh-ui-error-fill-icon')); |
| 13 |
var ProgressStepVariant; |
| 14 |
(function (ProgressStepVariant) { |
| 15 |
ProgressStepVariant["default"] = "default"; |
| 16 |
ProgressStepVariant["pending"] = "pending"; |
| 17 |
ProgressStepVariant["success"] = "success"; |
| 18 |
ProgressStepVariant["info"] = "info"; |
| 19 |
ProgressStepVariant["danger"] = "danger"; |
| 20 |
ProgressStepVariant["warning"] = "warning"; |
| 21 |
})(ProgressStepVariant || (exports.ProgressStepVariant = ProgressStepVariant = {})); |
| 22 |
const variantIcons = { |
| 23 |
default: undefined, |
| 24 |
pending: undefined, |
| 25 |
success: (0, jsx_runtime_1.jsx)(rh_ui_check_circle_fill_icon_1.default, {}), |
| 26 |
info: (0, jsx_runtime_1.jsx)(resources_full_icon_1.default, {}), |
| 27 |
warning: (0, jsx_runtime_1.jsx)(rh_ui_warning_fill_icon_1.default, {}), |
| 28 |
danger: (0, jsx_runtime_1.jsx)(rh_ui_error_fill_icon_1.default, {}) |
| 29 |
}; |
| 30 |
const variantStyle = { |
| 31 |
default: '', |
| 32 |
info: progress_stepper_1.default.modifiers.info, |
| 33 |
success: progress_stepper_1.default.modifiers.success, |
| 34 |
pending: progress_stepper_1.default.modifiers.pending, |
| 35 |
warning: progress_stepper_1.default.modifiers.warning, |
| 36 |
danger: progress_stepper_1.default.modifiers.danger |
| 37 |
}; |
| 38 |
const ProgressStep = (_a) => { |
| 39 |
var { children, className, variant, isCurrent, description, icon, titleId, 'aria-label': ariaLabel, popoverRender } = _a, props = tslib_1.__rest(_a, ["children", "className", "variant", "isCurrent", "description", "icon", "titleId", 'aria-label', "popoverRender"]); |
| 40 |
const _icon = icon !== undefined ? icon : variantIcons[variant]; |
| 41 |
const Component = popoverRender !== undefined ? 'button' : 'div'; |
| 42 |
const stepRef = (0, react_1.useRef)(undefined); |
| 43 |
if (props.id === undefined || titleId === undefined) { |
| 44 |
/* eslint-disable no-console */ |
| 45 |
console.warn('ProgressStep: The titleId and id properties are required to make this component accessible, and one or both of these properties are missing.'); |
| 46 |
} |
| 47 |
return ((0, jsx_runtime_1.jsxs)("li", Object.assign({ className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStep, variantStyle[variant], isCurrent && progress_stepper_1.default.modifiers.current, className), "aria-label": ariaLabel, |
| 48 |
// CSS style `display: contents` gives this li a generic role, we need to override that |
| 49 |
role: "listitem" }, (isCurrent && { 'aria-current': 'step' }), props, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStepConnector), children: (0, jsx_runtime_1.jsx)("span", { className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStepIcon), children: _icon && _icon }) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStepMain), children: [(0, jsx_runtime_1.jsxs)(Component, Object.assign({ className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStepTitle, popoverRender && progress_stepper_1.default.modifiers.helpText), id: titleId, ref: stepRef }, (popoverRender && { type: 'button' }), (props.id !== undefined && |
| 50 |
titleId !== undefined && |
| 51 |
popoverRender && { 'aria-labelledby': `${props.id} ${titleId}` }), { children: [children, popoverRender && popoverRender(stepRef)] })), description && (0, jsx_runtime_1.jsx)("div", { className: (0, react_styles_1.css)(progress_stepper_1.default.progressStepperStepDescription), children: description })] })] }))); |
| 52 |
}; |
| 53 |
exports.ProgressStep = ProgressStep; |
| 54 |
exports.ProgressStep.displayName = 'ProgressStep'; |
| 55 |
//# sourceMappingURL=ProgressStep.js.map |