UNPKG

siegel

Version:

Web application development ecosystem

1 lines 687 B
import e from"react";import o from"../../_internals/apply_classname.js";function t(e){e.stopPropagation()}export default function(n,i,l){let a,r,{options:s,selected:c,theme:p,listSelectedOption:m,listDisabledOptions:u}=n,d=[];for(let t=0;t<s.length;t++){let n=s[t],{disabled:f,title:_,value:h,payload:v,className:E}=n;if(!u&&f)continue;let g=h===c;if(g&&(a=n,r=t,!m))continue;let w={children:_,className:o(p.option,[[p.option__active,g||l==t],[p.option__disabled,f],[E,!0]]),onMouseDown:f?void 0:e=>{i(h,e,v)},key:h};d.push(e.createElement("div",{...w}))}return{selectedOption:a,selectedOptionIndex:r,optionsElement:e.createElement("div",{className:p.options,onMouseDown:t,children:d})}}