UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

22 lines (19 loc) 916 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.scrollTo = void 0; var scrollTo = function scrollTo(suggestionContainer, selSuggestion) { if (selSuggestion && suggestionContainer) { if (suggestionContainer.scrollHeight === selSuggestion.offsetTop + selSuggestion.offsetHeight) { suggestionContainer.scrollTop = selSuggestion.offsetTop - selSuggestion.offsetHeight; } else if (selSuggestion.offsetTop === 0) { suggestionContainer.scrollTop = 0; } else if (suggestionContainer.offsetHeight + suggestionContainer.scrollTop < selSuggestion.offsetTop) { suggestionContainer.scrollTop = selSuggestion.offsetTop - selSuggestion.offsetHeight; } else if (suggestionContainer.scrollTop > selSuggestion.offsetTop) { suggestionContainer.scrollTop = selSuggestion.offsetTop - selSuggestion.offsetHeight; } } }; exports.scrollTo = scrollTo;