UNPKG

@s-ui/react-molecule-field

Version:

`MoleculeField` is a component that wraps a composition of Label + some input (input, textarea, ...) + Validation Messages.

16 lines 735 B
import { AtomLabelTypes } from '@s-ui/react-atom-label'; var useTypeValidationLabel = function useTypeValidationLabel(_ref) { var useContrastLabel = _ref.useContrastLabel, errorText = _ref.errorText, successText = _ref.successText, alertText = _ref.alertText, disabled = _ref.disabled, status = _ref.status; if (status && [AtomLabelTypes.SUCCESS, AtomLabelTypes.ERROR, AtomLabelTypes.ALERT].includes(status)) return status; if (disabled) return AtomLabelTypes.DISABLED; if (alertText) return AtomLabelTypes.ALERT; if (successText) return AtomLabelTypes.SUCCESS; if (errorText) return AtomLabelTypes.ERROR; if (useContrastLabel) return AtomLabelTypes.CONTRAST; }; export default useTypeValidationLabel;