isDisabledElement.js 860 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports["default"] = void 0;
  6. var _jsxAstUtils = require("jsx-ast-utils");
  7. var isDisabledElement = function isDisabledElement(attributes) {
  8. var disabledAttr = (0, _jsxAstUtils.getProp)(attributes, 'disabled');
  9. var disabledAttrValue = (0, _jsxAstUtils.getPropValue)(disabledAttr);
  10. var isHTML5Disabled = disabledAttr && disabledAttrValue !== undefined;
  11. if (isHTML5Disabled) {
  12. return true;
  13. }
  14. var ariaDisabledAttr = (0, _jsxAstUtils.getProp)(attributes, 'aria-disabled');
  15. var ariaDisabledAttrValue = (0, _jsxAstUtils.getLiteralPropValue)(ariaDisabledAttr);
  16. if (ariaDisabledAttr && ariaDisabledAttrValue !== undefined && ariaDisabledAttrValue === true) {
  17. return true;
  18. }
  19. return false;
  20. };
  21. var _default = isDisabledElement;
  22. exports["default"] = _default;