(props)
| 72 | }; |
| 73 | |
| 74 | const UncontrolledTabs = (props) => { |
| 75 | checkPropTypes(propTypes, props, 'prop', 'UncontrolledTabs'); |
| 76 | let tabNodes = useRef([]); |
| 77 | let tabIds = useRef([]); |
| 78 | const ref = useRef(); |
| 79 | |
| 80 | function setSelected(index, event) { |
| 81 | // Check index boundary |
| 82 | if (index < 0 || index >= getTabsCount()) return; |
| 83 | |
| 84 | const { onSelect, selectedIndex } = props; |
| 85 | |
| 86 | // Call change event handler |
| 87 | onSelect(index, selectedIndex, event); |
| 88 | } |
| 89 | |
| 90 | function getNextTab(index) { |
| 91 | const count = getTabsCount(); |
| 92 | |
| 93 | // Look for non-disabled tab from index to the last tab on the right |
| 94 | for (let i = index + 1; i < count; i++) { |
| 95 | if (!isTabDisabled(getTab(i))) { |
| 96 | return i; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // If no tab found, continue searching from first on left to index |
| 101 | for (let i = 0; i < index; i++) { |
| 102 | if (!isTabDisabled(getTab(i))) { |
| 103 | return i; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | // All tabs are disabled, return index |
| 108 | /* istanbul ignore next */ |
| 109 | return index; |
| 110 | } |
| 111 | |
| 112 | function getPrevTab(index) { |
| 113 | let i = index; |
| 114 | |
| 115 | // Look for non-disabled tab from index to first tab on the left |
| 116 | while (i--) { |
| 117 | if (!isTabDisabled(getTab(i))) { |
| 118 | return i; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | // If no tab found, continue searching from last tab on right to index |
| 123 | i = getTabsCount(); |
| 124 | while (i-- > index) { |
| 125 | if (!isTabDisabled(getTab(i))) { |
| 126 | return i; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // All tabs are disabled, return index |
| 131 | /* istanbul ignore next */ |
nothing calls this directly
no test coverage detected
searching dependent graphs…