| 1 |
import { __rest } from "tslib"; |
| 2 |
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; |
| 3 |
import styles from '@patternfly/react-styles/css/components/HelperText/helper-text.mjs'; |
| 4 |
import { css } from '@patternfly/react-styles'; |
| 5 |
import MinusIcon from '@patternfly/react-icons/dist/esm/icons/minus-icon'; |
| 6 |
import RhUiWarningFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-warning-fill-icon'; |
| 7 |
import RhUiCheckCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-check-circle-fill-icon'; |
| 8 |
import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon'; |
| 9 |
export var HelperTextItemVariant; |
| 10 |
(function (HelperTextItemVariant) { |
| 11 |
HelperTextItemVariant["default"] = "default"; |
| 12 |
HelperTextItemVariant["warning"] = "warning"; |
| 13 |
HelperTextItemVariant["error"] = "error"; |
| 14 |
HelperTextItemVariant["success"] = "success"; |
| 15 |
})(HelperTextItemVariant || (HelperTextItemVariant = {})); |
| 16 |
const defaultVariantIcons = { |
| 17 |
indeterminate: _jsx(MinusIcon, {}), |
| 18 |
warning: _jsx(RhUiWarningFillIcon, {}), |
| 19 |
success: _jsx(RhUiCheckCircleFillIcon, {}), |
| 20 |
error: _jsx(RhUiErrorFillIcon, {}) |
| 21 |
}; |
| 22 |
export const HelperTextItem = (_a) => { |
| 23 |
var { children, className, component = 'div', variant = 'default', icon, id, screenReaderText = `${variant} status` } = _a, props = __rest(_a, ["children", "className", "component", "variant", "icon", "id", "screenReaderText"]); |
| 24 |
const Component = component; |
| 25 |
const isNotDefaultVariant = variant !== 'default'; |
| 26 |
const defaultIcon = isNotDefaultVariant && defaultVariantIcons[variant]; |
| 27 |
const shouldRenderSRText = isNotDefaultVariant && screenReaderText && screenReaderText !== ''; |
| 28 |
return (_jsxs(Component, Object.assign({ className: css(styles.helperTextItem, isNotDefaultVariant && styles.modifiers[variant], className), id: id }, props, { children: [(defaultIcon || icon) && _jsx("span", { className: css(styles.helperTextItemIcon), children: icon || defaultIcon }), _jsxs("span", { className: css(styles.helperTextItemText), children: [children, shouldRenderSRText && _jsxs("span", { className: "pf-v6-screen-reader", children: [": ", screenReaderText, ";"] })] })] }))); |
| 29 |
}; |
| 30 |
HelperTextItem.displayName = 'HelperTextItem'; |
| 31 |
//# sourceMappingURL=HelperTextItem.js.map |