@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
18 lines • 670 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.keyLeftMove = exports.keyRightMove = void 0;
const keyRightMove = (lengthOptions, position, numTabsInView) => prevFocus => {
if (prevFocus + 1 >= lengthOptions || prevFocus + 1 === position + numTabsInView) {
return position;
}
return prevFocus + 1;
};
exports.keyRightMove = keyRightMove;
const keyLeftMove = (position, numTabsInView) => prevFocus => {
if (prevFocus - 1 < 0 || prevFocus - 1 < position) {
return position - 1 + numTabsInView;
}
return prevFocus - 1;
};
exports.keyLeftMove = keyLeftMove;
//# sourceMappingURL=getTabMoves.js.map