+ {visiblePills?.map((pill, index) => (
+
+
{
+ if (element) {
+ pillElementsRef.current[index] = element;
+ } else {
+ pillElementsRef.current = pillElementsRef.current.filter(
+ (pillEl) => pillEl !== element
+ );
+ }
+ }}
+ onFocus={() => setFocusedPillIndex(index)}
+ onKeyDown={handlePillKeyDown}
+ onClick={handlePillClick}
+ tabIndex={
+ focusedPillIndex === -1 || focusedPillIndex === index ? 0 : -1
+ }
+ >
+ {pill}
+ {!hidePillClose && }
+
+
+ ))}
+ {visiblePills.length < pills.length && (
+
+ )}
+