Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmdk

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmdk - npm Package Compare versions

Comparing version 0.1.21 to 0.1.22

2

dist/index.js

@@ -1,1 +0,1 @@

var me=Object.create;var F=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var be=(r,o)=>{for(var n in o)F(r,n,{get:o[n],enumerable:!0})},te=(r,o,n,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of pe(o))!Re.call(r,l)&&l!==n&&F(r,l,{get:()=>o[l],enumerable:!(i=ge(o,l))||i.enumerable});return r};var z=(r,o,n)=>(n=r!=null?me(ve(r)):{},te(o||!r||!r.__esModule?F(n,"default",{value:r,enumerable:!0}):n,r)),he=r=>te(F({},"__esModule",{value:!0}),r);var _e={};be(_e,{Command:()=>Me,useCommandState:()=>y});module.exports=he(_e);var C=z(require("@radix-ui/react-dialog")),t=z(require("react")),ne=z(require("command-score")),Ee='[cmdk-list-sizer=""]',M='[cmdk-group=""]',U='[cmdk-group-items=""]',Se='[cmdk-group-heading=""]',oe='[cmdk-item=""]',re=`${oe}:not([aria-disabled="true"])`,B="cmdk-item-select",S="data-value",Ce=(r,o)=>(0,ne.default)(r,o),ie=t.createContext(void 0),k=()=>t.useContext(ie),se=t.createContext(void 0),W=()=>t.useContext(se),ae=t.createContext(void 0),ce=t.forwardRef((r,o)=>{let n=t.useRef(null),i=T(()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}})),l=T(()=>new Set),u=T(()=>new Map),g=T(()=>new Map),f=T(()=>new Set),d=le(r),{label:b,children:E,value:v,onValueChange:w,filter:O,shouldFilter:de,...D}=r,K=t.useId(),p=t.useId(),A=t.useId(),x=Oe();L(()=>{if(v!==void 0){let e=v.trim().toLowerCase();i.current.value=e,x(6,Q),h.emit()}},[v]);let h=t.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>i.current,setState:(e,c,a)=>{var s,m,R;if(!Object.is(i.current[e],c)){if(i.current[e]=c,e==="search")q(),V(),x(1,j);else if(e==="value")if(((s=d.current)==null?void 0:s.value)!==void 0){(R=(m=d.current).onValueChange)==null||R.call(m,c);return}else a||x(5,Q);h.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),G=t.useMemo(()=>({value:(e,c)=>{c!==g.current.get(e)&&(g.current.set(e,c),i.current.filtered.items.set(e,J(c)),x(2,()=>{V(),h.emit()}))},item:(e,c)=>(l.current.add(e),c&&(u.current.has(c)?u.current.get(c).add(e):u.current.set(c,new Set([e]))),x(3,()=>{q(),V(),i.current.value||j(),h.emit()}),()=>{g.current.delete(e),l.current.delete(e),i.current.filtered.items.delete(e),x(4,()=>{q(),j(),h.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{g.current.delete(e),u.current.delete(e)}),filter:()=>d.current.shouldFilter,label:b||r["aria-label"],listId:K,inputId:A,labelId:p}),[]);function J(e){var a;let c=((a=d.current)==null?void 0:a.filter)??Ce;return e?c(e,i.current.search):0}function V(){if(!n.current||!i.current.search||d.current.shouldFilter===!1)return;let e=i.current.filtered.items,c=[];i.current.filtered.groups.forEach(s=>{let m=u.current.get(s),R=0;m.forEach(P=>{let fe=e.get(P);R=Math.max(fe,R)}),c.push([s,R])});let a=n.current.querySelector(Ee);I().sort((s,m)=>{let R=s.getAttribute(S),P=m.getAttribute(S);return(e.get(P)??0)-(e.get(R)??0)}).forEach(s=>{let m=s.closest(U);m?m.appendChild(s.parentElement===m?s:s.closest(`${U} > *`)):a.appendChild(s.parentElement===a?s:s.closest(`${U} > *`))}),c.sort((s,m)=>m[1]-s[1]).forEach(s=>{let m=n.current.querySelector(`${M}[${S}="${s[0]}"]`);m==null||m.parentElement.appendChild(m)})}function j(){let e=I().find(a=>!a.ariaDisabled),c=e==null?void 0:e.getAttribute(S);h.setState("value",c||void 0)}function q(){if(!i.current.search||d.current.shouldFilter===!1){i.current.filtered.count=l.current.size;return}i.current.filtered.groups=new Set;let e=0;for(let c of l.current){let a=g.current.get(c),s=J(a);i.current.filtered.items.set(c,s),s>0&&e++}for(let[c,a]of u.current)for(let s of a)if(i.current.filtered.items.get(s)>0){i.current.filtered.groups.add(c);break}i.current.filtered.count=e}function Q(){var c,a,s;let e=_();e&&(((c=e.parentElement)==null?void 0:c.firstChild)===e&&((s=(a=e.closest(M))==null?void 0:a.querySelector(Se))==null||s.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}))}function _(){return n.current.querySelector(`${oe}[aria-selected="true"]`)}function I(){return Array.from(n.current.querySelectorAll(re))}function $(e){let a=I()[e];a&&h.setState("value",a.getAttribute(S))}function N(e){var R;let c=_(),a=I(),s=a.findIndex(P=>P===c),m=a[s+e];(R=d.current)!=null&&R.loop&&(m=s+e<0?a[a.length-1]:s+e===a.length?a[0]:a[s+e]),m&&h.setState("value",m.getAttribute(S))}function X(e){let c=_(),a=c==null?void 0:c.closest(M),s;for(;a&&!s;)a=e>0?ke(a,M):He(a,M),s=a==null?void 0:a.querySelector(re);s?h.setState("value",s.getAttribute(S)):N(e)}let Y=()=>$(I().length-1),Z=e=>{e.preventDefault(),e.metaKey?Y():e.altKey?X(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?$(0):e.altKey?X(-1):N(-1)};return t.createElement("div",{ref:H([n,o]),...D,"cmdk-root":"",onKeyDown:e=>{var c;if((c=D.onKeyDown)==null||c.call(D,e),!e.defaultPrevented)switch(e.key){case"n":case"j":{e.ctrlKey&&Z(e);break}case"ArrowDown":{Z(e);break}case"p":case"k":{e.ctrlKey&&ee(e);break}case"ArrowUp":{ee(e);break}case"Home":{e.preventDefault(),$(0);break}case"End":{e.preventDefault(),Y();break}case"Enter":{e.preventDefault();let a=_();if(a){let s=new Event(B);a.dispatchEvent(s)}}}}},t.createElement("label",{"cmdk-label":"",htmlFor:G.inputId,id:G.labelId,style:Ae},b),t.createElement(se.Provider,{value:h},t.createElement(ie.Provider,{value:G},E)))}),ye=t.forwardRef((r,o)=>{let n=t.useId(),i=t.useRef(null),l=t.useContext(ae),u=k(),g=le(r);L(()=>u.item(n,l),[]);let f=ue(n,i,[r.value,r.children,i]),d=W(),b=y(p=>p.value&&p.value===f.current),E=y(p=>u.filter()===!1?!0:p.search?p.filtered.items.get(n)>0:!0);t.useEffect(()=>{let p=i.current;if(!(!p||r.disabled))return p.addEventListener(B,v),()=>p.removeEventListener(B,v)},[E,r.onSelect,r.disabled]);function v(){var p,A;(A=(p=g.current).onSelect)==null||A.call(p,f.current)}function w(){d.setState("value",f.current,!0)}if(!E)return null;let{disabled:O,value:de,onSelect:D,...K}=r;return t.createElement("div",{ref:H([i,o]),...K,"cmdk-item":"",role:"option","aria-disabled":O||void 0,"aria-selected":b||void 0,onPointerMove:O?void 0:w,onClick:O?void 0:v},r.children)}),xe=t.forwardRef((r,o)=>{let{heading:n,children:i,...l}=r,u=t.useId(),g=t.useRef(null),f=t.useRef(null),d=t.useId(),b=k(),E=y(w=>b.filter()===!1?!0:w.search?w.filtered.groups.has(u):!0);L(()=>b.group(u),[]),ue(u,g,[r.value,r.heading,f]);let v=t.createElement(ae.Provider,{value:u},i);return t.createElement("div",{ref:H([g,o]),...l,"cmdk-group":"",role:"presentation",hidden:E?void 0:!0},n&&t.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),t.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},v))}),Te=t.forwardRef((r,o)=>{let{alwaysRender:n,...i}=r,l=t.useRef(null),u=y(g=>!g.search);return!n&&!u?null:t.createElement("div",{ref:H([l,o]),...i,"cmdk-separator":"",role:"separator"})}),Le=t.forwardRef((r,o)=>{let{onValueChange:n,...i}=r,l=r.value!=null,u=W(),g=y(d=>d.search),f=k();return t.useEffect(()=>{r.value!=null&&u.setState("search",r.value)},[r.value]),t.createElement("input",{ref:o,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,id:f.inputId,type:"text",value:l?r.value:g,onChange:d=>{l||u.setState("search",d.target.value),n==null||n(d.target.value)}})}),we=t.forwardRef((r,o)=>{let{children:n,...i}=r,l=t.useRef(null),u=t.useRef(null),g=k();return t.useEffect(()=>{if(u.current&&l.current){let f=u.current,d=l.current,b,E=new ResizeObserver(()=>{b=requestAnimationFrame(()=>{let v=f.getBoundingClientRect().height;d.style.setProperty("--cmdk-list-height",v.toFixed(1)+"px")})});return E.observe(f),()=>{cancelAnimationFrame(b),E.unobserve(f)}}},[]),t.createElement("div",{ref:H([l,o]),...i,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:g.listId,"aria-labelledby":g.inputId},t.createElement("div",{ref:u,"cmdk-list-sizer":""},n))}),De=t.forwardRef((r,o)=>{let{open:n,onOpenChange:i,container:l,...u}=r;return t.createElement(C.Root,{open:n,onOpenChange:i},t.createElement(C.Portal,{container:l},t.createElement(C.Overlay,{"cmdk-overlay":""}),t.createElement(C.Content,{"aria-label":r.label,"cmdk-dialog":""},t.createElement(ce,{ref:o,...u}))))}),Ie=t.forwardRef((r,o)=>{let n=t.useRef(!0),i=y(l=>l.filtered.count===0);return t.useEffect(()=>{n.current=!1},[]),n.current||!i?null:t.createElement("div",{ref:o,...r,"cmdk-empty":"",role:"presentation"})}),Pe=t.forwardRef((r,o)=>{let{progress:n,children:i,...l}=r;return t.createElement("div",{ref:o,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},t.createElement("div",{"aria-hidden":!0},i))}),Me=Object.assign(ce,{List:we,Item:ye,Input:Le,Group:xe,Separator:Te,Dialog:De,Empty:Ie,Loading:Pe});function ke(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling}}function He(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling}}function le(r){let o=t.useRef(r);return L(()=>{o.current=r}),o}var L=typeof window>"u"?t.useEffect:t.useLayoutEffect;function T(r){let o=t.useRef();return o.current===void 0&&(o.current=r()),o}function H(r){return o=>{r.forEach(n=>{typeof n=="function"?n(o):n!=null&&(n.current=o)})}}function y(r){let o=W(),n=()=>r(o.snapshot());return t.useSyncExternalStore(o.subscribe,n,n)}function ue(r,o,n){let i=t.useRef(),l=k();return L(()=>{var g;let u=(()=>{var f;for(let d of n){if(typeof d=="string")return d.trim().toLowerCase();if(typeof d=="object"&&"current"in d&&d.current)return(f=d.current.textContent)==null?void 0:f.trim().toLowerCase()}})();l.value(r,u),(g=o.current)==null||g.setAttribute(S,u),i.current=u}),i}var Oe=()=>{let[r,o]=t.useState(),n=T(()=>new Map);return L(()=>{n.current.forEach(i=>i()),n.current=new Map},[r]),(i,l)=>{n.current.set(i,l),o({})}},Ae={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};0&&(module.exports={Command,useCommandState});
var me=Object.create;var F=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var be=(r,o)=>{for(var n in o)F(r,n,{get:o[n],enumerable:!0})},te=(r,o,n,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of pe(o))!Re.call(r,l)&&l!==n&&F(r,l,{get:()=>o[l],enumerable:!(i=ge(o,l))||i.enumerable});return r};var z=(r,o,n)=>(n=r!=null?me(ve(r)):{},te(o||!r||!r.__esModule?F(n,"default",{value:r,enumerable:!0}):n,r)),he=r=>te(F({},"__esModule",{value:!0}),r);var _e={};be(_e,{Command:()=>Me,useCommandState:()=>y});module.exports=he(_e);var C=z(require("@radix-ui/react-dialog")),t=z(require("react")),ne=z(require("command-score")),Ee='[cmdk-list-sizer=""]',M='[cmdk-group=""]',U='[cmdk-group-items=""]',Se='[cmdk-group-heading=""]',oe='[cmdk-item=""]',re=`${oe}:not([aria-disabled="true"])`,B="cmdk-item-select",S="data-value",Ce=(r,o)=>(0,ne.default)(r,o),ie=t.createContext(void 0),k=()=>t.useContext(ie),se=t.createContext(void 0),W=()=>t.useContext(se),ae=t.createContext(void 0),ce=t.forwardRef((r,o)=>{let n=t.useRef(null),i=T(()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}})),l=T(()=>new Set),u=T(()=>new Map),g=T(()=>new Map),f=T(()=>new Set),d=le(r),{label:v,children:E,value:R,onValueChange:w,filter:O,shouldFilter:de,...D}=r,K=t.useId(),p=t.useId(),A=t.useId(),x=Oe();L(()=>{if(R!==void 0){let e=R.trim().toLowerCase();i.current.value=e,x(6,Q),h.emit()}},[R]);let h=t.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>i.current,setState:(e,c,a)=>{var s,m,b;if(!Object.is(i.current[e],c)){if(i.current[e]=c,e==="search")q(),V(),x(1,j);else if(e==="value")if(((s=d.current)==null?void 0:s.value)!==void 0){(b=(m=d.current).onValueChange)==null||b.call(m,c);return}else a||x(5,Q);h.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),G=t.useMemo(()=>({value:(e,c)=>{c!==g.current.get(e)&&(g.current.set(e,c),i.current.filtered.items.set(e,J(c)),x(2,()=>{V(),h.emit()}))},item:(e,c)=>(l.current.add(e),c&&(u.current.has(c)?u.current.get(c).add(e):u.current.set(c,new Set([e]))),x(3,()=>{q(),V(),i.current.value||j(),h.emit()}),()=>{g.current.delete(e),l.current.delete(e),i.current.filtered.items.delete(e),x(4,()=>{q(),j(),h.emit()})}),group:e=>(u.current.has(e)||u.current.set(e,new Set),()=>{g.current.delete(e),u.current.delete(e)}),filter:()=>d.current.shouldFilter,label:v||r["aria-label"],listId:K,inputId:A,labelId:p}),[]);function J(e){var a;let c=((a=d.current)==null?void 0:a.filter)??Ce;return e?c(e,i.current.search):0}function V(){if(!n.current||!i.current.search||d.current.shouldFilter===!1)return;let e=i.current.filtered.items,c=[];i.current.filtered.groups.forEach(s=>{let m=u.current.get(s),b=0;m.forEach(P=>{let fe=e.get(P);b=Math.max(fe,b)}),c.push([s,b])});let a=n.current.querySelector(Ee);I().sort((s,m)=>{let b=s.getAttribute(S),P=m.getAttribute(S);return(e.get(P)??0)-(e.get(b)??0)}).forEach(s=>{let m=s.closest(U);m?m.appendChild(s.parentElement===m?s:s.closest(`${U} > *`)):a.appendChild(s.parentElement===a?s:s.closest(`${U} > *`))}),c.sort((s,m)=>m[1]-s[1]).forEach(s=>{let m=n.current.querySelector(`${M}[${S}="${s[0]}"]`);m==null||m.parentElement.appendChild(m)})}function j(){let e=I().find(a=>!a.ariaDisabled),c=e==null?void 0:e.getAttribute(S);h.setState("value",c||void 0)}function q(){if(!i.current.search||d.current.shouldFilter===!1){i.current.filtered.count=l.current.size;return}i.current.filtered.groups=new Set;let e=0;for(let c of l.current){let a=g.current.get(c),s=J(a);i.current.filtered.items.set(c,s),s>0&&e++}for(let[c,a]of u.current)for(let s of a)if(i.current.filtered.items.get(s)>0){i.current.filtered.groups.add(c);break}i.current.filtered.count=e}function Q(){var c,a,s;let e=_();e&&(((c=e.parentElement)==null?void 0:c.firstChild)===e&&((s=(a=e.closest(M))==null?void 0:a.querySelector(Se))==null||s.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}))}function _(){return n.current.querySelector(`${oe}[aria-selected="true"]`)}function I(){return Array.from(n.current.querySelectorAll(re))}function $(e){let a=I()[e];a&&h.setState("value",a.getAttribute(S))}function N(e){var b;let c=_(),a=I(),s=a.findIndex(P=>P===c),m=a[s+e];(b=d.current)!=null&&b.loop&&(m=s+e<0?a[a.length-1]:s+e===a.length?a[0]:a[s+e]),m&&h.setState("value",m.getAttribute(S))}function X(e){let c=_(),a=c==null?void 0:c.closest(M),s;for(;a&&!s;)a=e>0?ke(a,M):He(a,M),s=a==null?void 0:a.querySelector(re);s?h.setState("value",s.getAttribute(S)):N(e)}let Y=()=>$(I().length-1),Z=e=>{e.preventDefault(),e.metaKey?Y():e.altKey?X(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?$(0):e.altKey?X(-1):N(-1)};return t.createElement("div",{ref:H([n,o]),...D,"cmdk-root":"",onKeyDown:e=>{var c;if((c=D.onKeyDown)==null||c.call(D,e),!e.defaultPrevented)switch(e.key){case"n":case"j":{e.ctrlKey&&Z(e);break}case"ArrowDown":{Z(e);break}case"p":case"k":{e.ctrlKey&&ee(e);break}case"ArrowUp":{ee(e);break}case"Home":{e.preventDefault(),$(0);break}case"End":{e.preventDefault(),Y();break}case"Enter":{e.preventDefault();let a=_();if(a){let s=new Event(B);a.dispatchEvent(s)}}}}},t.createElement("label",{"cmdk-label":"",htmlFor:G.inputId,id:G.labelId,style:Ae},v),t.createElement(se.Provider,{value:h},t.createElement(ie.Provider,{value:G},E)))}),ye=t.forwardRef((r,o)=>{let n=t.useId(),i=t.useRef(null),l=t.useContext(ae),u=k(),g=le(r);L(()=>u.item(n,l),[]);let f=ue(n,i,[r.value,r.children,i]),d=W(),v=y(p=>p.value&&p.value===f.current),E=y(p=>u.filter()===!1?!0:p.search?p.filtered.items.get(n)>0:!0);t.useEffect(()=>{let p=i.current;if(!(!p||r.disabled))return p.addEventListener(B,R),()=>p.removeEventListener(B,R)},[E,r.onSelect,r.disabled]);function R(){var p,A;(A=(p=g.current).onSelect)==null||A.call(p,f.current)}function w(){d.setState("value",f.current,!0)}if(!E)return null;let{disabled:O,value:de,onSelect:D,...K}=r;return t.createElement("div",{ref:H([i,o]),...K,"cmdk-item":"",role:"option","aria-disabled":O||void 0,"aria-selected":v||void 0,"data-selected":v||void 0,onPointerMove:O?void 0:w,onClick:O?void 0:R},r.children)}),xe=t.forwardRef((r,o)=>{let{heading:n,children:i,...l}=r,u=t.useId(),g=t.useRef(null),f=t.useRef(null),d=t.useId(),v=k(),E=y(w=>v.filter()===!1?!0:w.search?w.filtered.groups.has(u):!0);L(()=>v.group(u),[]),ue(u,g,[r.value,r.heading,f]);let R=t.createElement(ae.Provider,{value:u},i);return t.createElement("div",{ref:H([g,o]),...l,"cmdk-group":"",role:"presentation",hidden:E?void 0:!0},n&&t.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),t.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},R))}),Te=t.forwardRef((r,o)=>{let{alwaysRender:n,...i}=r,l=t.useRef(null),u=y(g=>!g.search);return!n&&!u?null:t.createElement("div",{ref:H([l,o]),...i,"cmdk-separator":"",role:"separator"})}),Le=t.forwardRef((r,o)=>{let{onValueChange:n,...i}=r,l=r.value!=null,u=W(),g=y(d=>d.search),f=k();return t.useEffect(()=>{r.value!=null&&u.setState("search",r.value)},[r.value]),t.createElement("input",{ref:o,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,id:f.inputId,type:"text",value:l?r.value:g,onChange:d=>{l||u.setState("search",d.target.value),n==null||n(d.target.value)}})}),we=t.forwardRef((r,o)=>{let{children:n,...i}=r,l=t.useRef(null),u=t.useRef(null),g=k();return t.useEffect(()=>{if(u.current&&l.current){let f=u.current,d=l.current,v,E=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let R=f.getBoundingClientRect().height;d.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return E.observe(f),()=>{cancelAnimationFrame(v),E.unobserve(f)}}},[]),t.createElement("div",{ref:H([l,o]),...i,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:g.listId,"aria-labelledby":g.inputId},t.createElement("div",{ref:u,"cmdk-list-sizer":""},n))}),De=t.forwardRef((r,o)=>{let{open:n,onOpenChange:i,container:l,...u}=r;return t.createElement(C.Root,{open:n,onOpenChange:i},t.createElement(C.Portal,{container:l},t.createElement(C.Overlay,{"cmdk-overlay":""}),t.createElement(C.Content,{"aria-label":r.label,"cmdk-dialog":""},t.createElement(ce,{ref:o,...u}))))}),Ie=t.forwardRef((r,o)=>{let n=t.useRef(!0),i=y(l=>l.filtered.count===0);return t.useEffect(()=>{n.current=!1},[]),n.current||!i?null:t.createElement("div",{ref:o,...r,"cmdk-empty":"",role:"presentation"})}),Pe=t.forwardRef((r,o)=>{let{progress:n,children:i,...l}=r;return t.createElement("div",{ref:o,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},t.createElement("div",{"aria-hidden":!0},i))}),Me=Object.assign(ce,{List:we,Item:ye,Input:Le,Group:xe,Separator:Te,Dialog:De,Empty:Ie,Loading:Pe});function ke(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling}}function He(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling}}function le(r){let o=t.useRef(r);return L(()=>{o.current=r}),o}var L=typeof window>"u"?t.useEffect:t.useLayoutEffect;function T(r){let o=t.useRef();return o.current===void 0&&(o.current=r()),o}function H(r){return o=>{r.forEach(n=>{typeof n=="function"?n(o):n!=null&&(n.current=o)})}}function y(r){let o=W(),n=()=>r(o.snapshot());return t.useSyncExternalStore(o.subscribe,n,n)}function ue(r,o,n){let i=t.useRef(),l=k();return L(()=>{var g;let u=(()=>{var f;for(let d of n){if(typeof d=="string")return d.trim().toLowerCase();if(typeof d=="object"&&"current"in d&&d.current)return(f=d.current.textContent)==null?void 0:f.trim().toLowerCase()}})();l.value(r,u),(g=o.current)==null||g.setAttribute(S,u),i.current=u}),i}var Oe=()=>{let[r,o]=t.useState(),n=T(()=>new Map);return L(()=>{n.current.forEach(i=>i()),n.current=new Map},[r]),(i,l)=>{n.current.set(i,l),o({})}},Ae={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};0&&(module.exports={Command,useCommandState});
{
"name": "cmdk",
"version": "0.1.21",
"version": "0.1.22",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc