@react-md/form
Version:
This package is for creating all the different form input types.
19 lines • 838 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultIsErrored = void 0;
/**
* 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
*/
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);
};
exports.defaultIsErrored = defaultIsErrored;
//# sourceMappingURL=isErrored.js.map