UNPKG

@react-md/form

Version:

This package is for creating all the different form input types.

15 lines 688 B
/** * The default implementation for checking if a `TextField` or `TextArea` is * errored by returning `true` if the `errorMessage` string is truthy or the * value is not within the `minLength` and `maxLength` constraints when they * exist. * * @remarks \@since 2.5.0 */ export var defaultIsErrored = function (_a) { var value = _a.value, errorMessage = _a.errorMessage, minLength = _a.minLength, maxLength = _a.maxLength, isBlurEvent = _a.isBlurEvent; return !!errorMessage || (typeof maxLength === "number" && value.length > maxLength) || (isBlurEvent && typeof minLength === "number" && value.length < minLength); }; //# sourceMappingURL=isErrored.js.map