@base-ui/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.
26 lines (25 loc) • 643 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCheckboxStateAttributesMapping = getCheckboxStateAttributesMapping;
var _constants = require("../../internals/field-constants/constants");
function getCheckboxStateAttributesMapping(state) {
return {
checked(value) {
if (state.indeterminate) {
// `data-indeterminate` is already handled by the `indeterminate` prop.
return {};
}
if (value) {
return {
'data-checked': ''
};
}
return {
'data-unchecked': ''
};
},
..._constants.fieldValidityMapping
};
}