PageSourceSearch

https://colorid.es/packs/dropdown_selector-CkYi8Ggy.js

js colorid.es collected 2026-10-02 13:11:47 UTC 2,593 bytes, 2 lines download raw bytes

1import{j as c}from"./client-By3tlFYA.js";import{r as s}from"./index-DYjD9pVn.js";import{c as K}from"./index-DEFqtOkH.js";import{S as N}from"./info-QqBjnBUf.js";import{a5 as L,cr as V}from"./useSelectableClick-qkezqrgs.js";const R=V?{passive:!0,capture:!0}:!0,z=({style:S,items:u,value:T,classNamePrefix:l="privacy-dropdown",onClose:o,onChange:f})=>{const t=s.useRef(null),v=s.useRef(null),[d,h]=s.useState(T),p=s.useCallback(e=>{const a=e.currentTarget.getAttribute("data-index");e.preventDefault(),o(),a&&f(a)},[o,f]),$=s.useCallback(e=>{var m,x,E,b,k,_,g,j,w,C,D,y,A,I;const a=e.currentTarget.getAttribute("data-index"),r=u.findIndex(i=>i.value===a);let n=null;switch(e.key){case"Escape":o();break;case" ":case"Enter":p(e);break;case"ArrowDown":n=(E=(m=t.current)==null?void 0:m.children[r+1])!=null?E:(x=t.current)==null?void 0:x.firstElementChild;break;case"ArrowUp":n=(_=(b=t.current)==null?void 0:b.children[r-1])!=null?_:(k=t.current)==null?void 0:k.lastElementChild;break;case"Tab":e.shiftKey?n=(w=(g=t.current)==null?void 0:g.children[r-1])!=null?w:(j=t.current)==null?void 0:j.lastElementChild:n=(y=(C=t.current)==null?void 0:C.children[r+1])!=null?y:(D=t.current)==null?void 0:D.firstElementChild;break;case"Home":n=(A=t.current)==null?void 0:A.firstElementChild;break;case"End":n=(I=t.current)==null?void 0:I.lastElementChild;break}if(n&&n instanceof HTMLElement){const i=n.getAttribute("data-index");n.focus(),i&&h(i),e.preventDefault(),e.stopPropagation()}},[u,o,p,h]);return s.useEffect(()=>{var a;const e=r=>{t.current&&r.target instanceof Node&&!t.current.contains(r.target)&&(o(),r.stopPropagation())};return document.addEventListener("click",e,{capture:!0}),document.addEventListener("touchend",e,R),(a=v.current)==null||a.focus({preventScroll:!0}),()=>{document.removeEventListener("click",e,{capture:!0}),document.removeEventListener("touchend",e,R)}},[o]),c.jsx("ul",{style:S,role:"listbox",ref:t,children:u.map(e=>c.jsxs("li",{role:"option",tabIndex:0,"data-index":e.value,onKeyDown:$,onClick:p,className:K("".concat(l,"__option"),{active:e.value===d}),"aria-selected":e.value===d,ref:e.value===d?v:null,children:[e.icon&&e.iconComponent&&c.jsx("div",{className:"".concat(l,"__option__icon"),children:c.jsx(L,{id:e.icon,icon:e.iconComponent})}),c.jsxs("div",{className:"".concat(l,"__option__content"),children:[c.jsx("strong",{children:e.text}),e.meta]}),e.extra&&c.jsx("div",{className:"".concat(l,"__option__additional"),title:e.extra,children:c.jsx(L,{id:"info-circle",icon:N})})]},e.value))})};export{z as D};
2//# sourceMappingURL=dropdown_selector-CkYi8Ggy.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.