/** * Copyright (c) Nicolas Gallagher. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ import propsToAriaRole from './propsToAriaRole'; var roleComponents = { article: 'article', banner: 'header', complementary: 'aside', contentinfo: 'footer', form: 'form', link: 'a', list: 'ul', listitem: 'li', main: 'main', navigation: 'nav', region: 'section' }; var emptyObject = {}; var propsToAccessibilityComponent = function propsToAccessibilityComponent(props) { if (props === void 0) { props = emptyObject; } // special-case for "label" role which doesn't map to an ARIA role if (props.accessibilityRole === 'label') { return 'label'; } var role = propsToAriaRole(props); if (role) { if (role === 'heading') { var level = props['aria-level']; if (level != null) { return "h" + level; } return 'h1'; } return roleComponents[role]; } }; export default propsToAccessibilityComponent;