@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
35 lines (34 loc) • 894 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fieldValidityMapping = exports.DEFAULT_VALIDITY_STATE = void 0;
var _FieldControlDataAttributes = require("../control/FieldControlDataAttributes");
const DEFAULT_VALIDITY_STATE = exports.DEFAULT_VALIDITY_STATE = {
badInput: false,
customError: false,
patternMismatch: false,
rangeOverflow: false,
rangeUnderflow: false,
stepMismatch: false,
tooLong: false,
tooShort: false,
typeMismatch: false,
valid: null,
valueMissing: false
};
const fieldValidityMapping = exports.fieldValidityMapping = {
valid(value) {
if (value === null) {
return null;
}
if (value) {
return {
[_FieldControlDataAttributes.FieldControlDataAttributes.valid]: ''
};
}
return {
[_FieldControlDataAttributes.FieldControlDataAttributes.invalid]: ''
};
}
};
;