@talend/react-forms
Version:
React forms library based on json schema form.
36 lines • 1.2 kB
JavaScript
import PropTypes from 'prop-types';
import { InlineMessageDestructive, InlineMessageInformation } from '@talend/design-system';
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
export default function Message(props) {
const {
description,
descriptionId,
errorId,
errorMessage,
isValid
} = props;
return description || errorMessage ? /*#__PURE__*/_jsx(_Fragment, {
children: isValid ? description && /*#__PURE__*/_jsx(InlineMessageInformation, {
id: descriptionId,
description: description,
role: undefined,
"aria-live": undefined,
"data-test": "fieldTemplate.inlineMessage"
}) : errorMessage && /*#__PURE__*/_jsx(InlineMessageDestructive, {
id: errorId,
description: errorMessage,
"aria-live": "assertive",
"data-test": "fieldTemplate.inlineMessageError"
})
}) : null;
}
if (process.env.NODE_ENV !== 'production') {
Message.propTypes = {
description: PropTypes.string,
descriptionId: PropTypes.string.isRequired,
errorId: PropTypes.string.isRequired,
errorMessage: PropTypes.string,
isValid: PropTypes.bool
};
}
//# sourceMappingURL=Message.component.js.map