Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getTagProps = ({
key = requiredParam('key'),
id = this.getTagId(key),
onMouseDown,
onMouseUp,
onClick,
...other
}) => {
const { tagFocusedKey } = this.getControlledState();
const isFocusedItem = key === tagFocusedKey;
const currentIndex = this.tagSelectionModel.numItems;
this.tagIndexKeyMap[currentIndex] = key;
if (isFocusedItem) {
this.tagSelectionModel.selectedIndex = currentIndex;
}
getItemProps = ({
key = requiredParam('key'),
id = this.getItemId(key),
role = 'option',
onClick,
onMouseMove,
index,
...other
} = {}) => {
const { focusedKey } = this.getControlledState();
const isFocusedItem = key === focusedKey;
const currentIndex = index === undefined ? this.focusSelectionModel.numItems : index;
this.indexKeyMap[currentIndex] = key;
if (isFocusedItem) {
this.focusSelectionModel.selectedIndex = currentIndex;
}