@inkeep/cxkit-primitives 0.5.47 → 0.5.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),je=require("@radix-ui/react-dialog"),G=require("react"),_e=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),D=require("@radix-ui/react-id"),Pe=require("../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Ae=require("../../constants/search.cjs"),Me=require("../../utils/compose-event-handlers.cjs"),Le=require("../shadow/context.cjs");function fe(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const F=fe(je),c=fe(G),O='[cmdk-group=""]',te='[cmdk-group-items=""]',Oe='[cmdk-group-heading=""]',me='[cmdk-item=""]',de=`${me}:not([aria-disabled="true"])`,ne="cmdk-item-select",A="data-value",ve=(t,r,n)=>_e.commandScore(t,r,n??[]),he=c.createContext(void 0),q=()=>c.useContext(he),ge=c.createContext(void 0),K=()=>c.useContext(ge),be=c.createContext(void 0),re=c.forwardRef((t,r)=>{const n=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=Ie(t),{label:h,children:d,value:S,onValueChange:E,filter:y,shouldFilter:C,loop:w,disablePointerSelection:P=!1,vimBindings:B=!0,defaultSearch:oe,...$}=t,g=M(()=>({search:oe??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=D.useId(),H=D.useId(),z=D.useId(),R=c.useRef(null),b=Fe();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,se)},[]);const V=Le.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(V?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,se),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,ce(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(n.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),n.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:z,labelId:H,listInnerRef:R}),[]);function ce(e,l){const o=i.current?.filter??ve;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(ee=>{const ke=e.get(ee);p=Math.max(ke,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),ee=m.getAttribute("id");return(e.get(ee)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(te);if(m){const p=u.parentElement===m?u:u.closest(`${te} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${te} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${A}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Ae.ASK_AI_TRIGGER_VALUE)?.getAttribute(A);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=n.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of n.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=ce(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function se(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(Oe)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${me}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(de)||[])}function Y(e){const o=L()[e];o&&x.setState("value",o.getAttribute(A))}function Z(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(A))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?qe(o,O):Ve(o,O),u=o?.querySelector(de);u?x.setState("value",u.getAttribute(A)):Z(e)}const le=()=>Y(L().length-1),ue=e=>{e.preventDefault(),e.metaKey?le():e.altKey?ie(1):Z(1)},ae=e=>{e.preventDefault(),e.metaKey?Y(0):e.altKey?ie(-1):Z(-1)};return v.jsxs(I.Primitive.div,{ref:r,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if($.onKeyDown?.(e),!e.defaultPrevented)switch(e.key){case"n":case"j":{B&&e.ctrlKey&&ue(e);break}case"ArrowDown":{ue(e);break}case"p":case"k":{B&&e.ctrlKey&&ae(e);break}case"ArrowUp":{ae(e);break}case"Home":{e.preventDefault(),Y(0);break}case"End":{e.preventDefault(),le();break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(ne);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ke,children:h}),N(t,e=>v.jsx(ge.Provider,{value:x,children:v.jsx(he.Provider,{value:W,children:e})}))]})}),pe=c.forwardRef((t,r)=>{const{id:n}=t,s=c.useRef(null),a=c.useContext(be),f=q(),i=Ie(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(n,a?.id)},[h]);const d=Re(n,s,[t.value,t.children,s],t.keywords),S=K(),E=_(b=>b.value&&b.value===d.current),y=_(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(n)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const V=()=>w("keyboard");return b.addEventListener(ne,V),()=>b.removeEventListener(ne,V)},[y,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),w=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!y)return null;const{disabled:P,value:B,onSelect:oe,forceMount:$,keywords:g,onClick:U,...H}=t,z=G.useMemo(()=>T([s,r]),[s,r]),R=Me.composeEventHandlers(U,w);return v.jsx(I.Primitive.div,{ref:z,...H,id:n,"cmdk-item":"",role:"option","aria-disabled":!!P,"aria-selected":!!E,"data-disabled":!!P,"data-selected":!!E,onPointerMove:P||f.getDisablePointerSelection()?void 0:C,onClick:P?void 0:R,onFocus:P?void 0:C,children:t.children})}),De=c.forwardRef((t,r)=>{const{heading:n,children:s,forceMount:a,...f}=t,i=D.useId(),h=c.useRef(null),d=c.useRef(null),S=D.useId(),E=q(),y=_(w=>a||E.filter()===!1?!0:w.search?w.filtered.groups.has(i):!0);j(()=>E.group(i),[]),Re(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:T([h,r]),...f,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0,children:[n&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:n}),N(t,w=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?S:void 0,children:v.jsx(be.Provider,{value:C,children:w})}))]})}),Se=c.forwardRef((t,r)=>{const{alwaysRender:n,...s}=t,a=c.useRef(null),f=_(i=>!i.search);return!n&&!f?null:v.jsx(I.Primitive.div,{ref:T([a,r]),...s,"cmdk-separator":"",role:"separator"})}),xe=c.forwardRef((t,r)=>{const{onValueChange:n,...s}=t,a=t.value!=null,f=K(),i=_(d=>d.search),h=q();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),n?.(d.target.value)}})}),Ee=c.forwardRef((t,r)=>{const{children:n,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=q();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const y=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return y.observe(d),()=>{cancelAnimationFrame(E),y.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:T([f,r]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:T([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),Ce=c.forwardRef((t,r)=>{const{open:n,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(F.Root,{open:n,onOpenChange:s,children:v.jsxs(F.Portal,{container:i,children:[v.jsx(F.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(F.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(re,{ref:r,...h})})]})})}),ye=c.forwardRef((t,r)=>_(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:r,...t,"cmdk-empty":"",role:"presentation"}):null),we=c.forwardRef((t,r)=>{const{progress:n,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:r,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),Te=Object.assign(re,{List:Ee,Item:pe,Input:xe,Group:De,Separator:Se,Dialog:Ce,Empty:ye,Loading:we});function qe(t,r){let n=t.nextElementSibling;for(;n;){if(n.matches(r))return n;n=n.nextElementSibling}}function Ve(t,r){let n=t.previousElementSibling;for(;n;){if(n.matches(r))return n;n=n.previousElementSibling}}function Ie(t){const r=c.useRef(t);return j(()=>{r.current=t}),r}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const r=c.useRef(void 0);return r.current===void 0&&(r.current=t()),r}function T(t){return r=>{t.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}function _(t){const r=K(),n=()=>t(r.snapshot());return Pe.shimExports.useSyncExternalStore(r.subscribe,n,n)}function Re(t,r,n,s=[]){const a=c.useRef(void 0),f=q();return j(()=>{const i=(()=>{for(const d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),r.current?.setAttribute(A,i),a.current=i}),a}const Fe=()=>{const[t,r]=c.useState(),n=M(()=>new Map);return j(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),r({})}};function Ge(t){const r=t.type;return typeof r=="function"?r(t.props):"render"in r?r.render(t.props):t}function N({asChild:t,children:r},n){return t&&c.isValidElement(r)?c.cloneElement(Ge(r),{ref:r.ref},n(r.props.children)):n(r)}const Ke={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=Te;exports.CommandDialog=Ce;exports.CommandEmpty=ye;exports.CommandInput=xe;exports.CommandItem=pe;exports.CommandList=Ee;exports.CommandLoading=we;exports.CommandRoot=re;exports.CommandSeparator=Se;exports.defaultFilter=ve;exports.useCommandState=_;exports.useCommandStore=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),je=require("@radix-ui/react-dialog"),G=require("react"),_e=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),T=require("@radix-ui/react-id"),Pe=require("../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Ae=require("../../constants/search.cjs"),Me=require("../../utils/compose-event-handlers.cjs"),Le=require("../shadow/context.cjs");function de(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const F=de(je),c=de(G),O='[cmdk-group=""]',ee='[cmdk-group-items=""]',Oe='[cmdk-group-heading=""]',fe='[cmdk-item=""]',ae=`${fe}:not([aria-disabled="true"])`,te="cmdk-item-select",A="data-value",me=(t,r,n)=>_e.commandScore(t,r,n??[]),ve=c.createContext(void 0),D=()=>c.useContext(ve),he=c.createContext(void 0),K=()=>c.useContext(he),ge=c.createContext(void 0),ne=c.forwardRef((t,r)=>{const n=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=we(t),{label:h,children:d,value:S,onValueChange:E,filter:y,shouldFilter:C,loop:w,disablePointerSelection:P=!1,vimBindings:B=!0,defaultSearch:re,...$}=t,g=M(()=>({search:re??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=T.useId(),z=T.useId(),H=T.useId(),R=c.useRef(null),b=Fe();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,ce)},[]);const V=Le.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(V?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,ce),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,oe(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(n.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),n.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:H,labelId:z,listInnerRef:R}),[]);function oe(e,l){const o=i.current?.filter??me;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(Z=>{const ke=e.get(Z);p=Math.max(ke,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),Z=m.getAttribute("id");return(e.get(Z)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(ee);if(m){const p=u.parentElement===m?u:u.closest(`${ee} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${ee} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${A}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Ae.ASK_AI_TRIGGER_VALUE)?.getAttribute(A);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=n.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of n.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=oe(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function ce(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(Oe)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${fe}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(ae)||[])}function se(e){const o=L()[e];o&&x.setState("value",o.getAttribute(A))}function Y(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(A))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?De(o,O):Ve(o,O),u=o?.querySelector(ae);u?x.setState("value",u.getAttribute(A)):Y(e)}const Re=()=>se(L().length-1),le=e=>{e.preventDefault(),e.metaKey?Re():e.altKey?ie(1):Y(1)},ue=e=>{e.preventDefault(),e.metaKey?se(0):e.altKey?ie(-1):Y(-1)};return v.jsxs(I.Primitive.div,{ref:r,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if($.onKeyDown?.(e),!e.defaultPrevented)switch(e.key){case"n":case"j":{B&&e.ctrlKey&&le(e);break}case"ArrowDown":{le(e);break}case"p":case"k":{B&&e.ctrlKey&&ue(e);break}case"ArrowUp":{ue(e);break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(te);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ke,children:h}),N(t,e=>v.jsx(he.Provider,{value:x,children:v.jsx(ve.Provider,{value:W,children:e})}))]})}),be=c.forwardRef((t,r)=>{const{id:n}=t,s=c.useRef(null),a=c.useContext(ge),f=D(),i=we(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(n,a?.id)},[h]);const d=Ie(n,s,[t.value,t.children,s],t.keywords),S=K(),E=_(b=>b.value&&b.value===d.current),y=_(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(n)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const V=()=>w("keyboard");return b.addEventListener(te,V),()=>b.removeEventListener(te,V)},[y,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),w=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!y)return null;const{disabled:P,value:B,onSelect:re,forceMount:$,keywords:g,onClick:U,...z}=t,H=G.useMemo(()=>q([s,r]),[s,r]),R=Me.composeEventHandlers(U,w);return v.jsx(I.Primitive.div,{ref:H,...z,id:n,"cmdk-item":"",role:"option","aria-disabled":!!P,"aria-selected":!!E,"data-disabled":!!P,"data-selected":!!E,onPointerMove:P||f.getDisablePointerSelection()?void 0:C,onClick:P?void 0:R,onFocus:P?void 0:C,children:t.children})}),Te=c.forwardRef((t,r)=>{const{heading:n,children:s,forceMount:a,...f}=t,i=T.useId(),h=c.useRef(null),d=c.useRef(null),S=T.useId(),E=D(),y=_(w=>a||E.filter()===!1?!0:w.search?w.filtered.groups.has(i):!0);j(()=>E.group(i),[]),Ie(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:q([h,r]),...f,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0,children:[n&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:n}),N(t,w=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?S:void 0,children:v.jsx(ge.Provider,{value:C,children:w})}))]})}),pe=c.forwardRef((t,r)=>{const{alwaysRender:n,...s}=t,a=c.useRef(null),f=_(i=>!i.search);return!n&&!f?null:v.jsx(I.Primitive.div,{ref:q([a,r]),...s,"cmdk-separator":"",role:"separator"})}),Se=c.forwardRef((t,r)=>{const{onValueChange:n,...s}=t,a=t.value!=null,f=K(),i=_(d=>d.search),h=D();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:r,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),n?.(d.target.value)}})}),xe=c.forwardRef((t,r)=>{const{children:n,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=D();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const y=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return y.observe(d),()=>{cancelAnimationFrame(E),y.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:q([f,r]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:q([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),Ee=c.forwardRef((t,r)=>{const{open:n,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(F.Root,{open:n,onOpenChange:s,children:v.jsxs(F.Portal,{container:i,children:[v.jsx(F.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(F.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(ne,{ref:r,...h})})]})})}),Ce=c.forwardRef((t,r)=>_(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:r,...t,"cmdk-empty":"",role:"presentation"}):null),ye=c.forwardRef((t,r)=>{const{progress:n,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:r,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),qe=Object.assign(ne,{List:xe,Item:be,Input:Se,Group:Te,Separator:pe,Dialog:Ee,Empty:Ce,Loading:ye});function De(t,r){let n=t.nextElementSibling;for(;n;){if(n.matches(r))return n;n=n.nextElementSibling}}function Ve(t,r){let n=t.previousElementSibling;for(;n;){if(n.matches(r))return n;n=n.previousElementSibling}}function we(t){const r=c.useRef(t);return j(()=>{r.current=t}),r}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const r=c.useRef(void 0);return r.current===void 0&&(r.current=t()),r}function q(t){return r=>{t.forEach(n=>{typeof n=="function"?n(r):n!=null&&(n.current=r)})}}function _(t){const r=K(),n=()=>t(r.snapshot());return Pe.shimExports.useSyncExternalStore(r.subscribe,n,n)}function Ie(t,r,n,s=[]){const a=c.useRef(void 0),f=D();return j(()=>{const i=(()=>{for(const d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),r.current?.setAttribute(A,i),a.current=i}),a}const Fe=()=>{const[t,r]=c.useState(),n=M(()=>new Map);return j(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),r({})}};function Ge(t){const r=t.type;return typeof r=="function"?r(t.props):"render"in r?r.render(t.props):t}function N({asChild:t,children:r},n){return t&&c.isValidElement(r)?c.cloneElement(Ge(r),{ref:r.ref},n(r.props.children)):n(r)}const Ke={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=qe;exports.CommandDialog=Ee;exports.CommandEmpty=Ce;exports.CommandInput=Se;exports.CommandItem=be;exports.CommandList=xe;exports.CommandLoading=ye;exports.CommandRoot=ne;exports.CommandSeparator=pe;exports.defaultFilter=me;exports.useCommandState=_;exports.useCommandStore=K;
@@ -1,17 +1,17 @@
1
- import { jsxs as te, jsx as p } from "react/jsx-runtime";
1
+ import { jsxs as ee, jsx as p } from "react/jsx-runtime";
2
2
  import * as K from "@radix-ui/react-dialog";
3
3
  import * as c from "react";
4
- import { useCallback as ue, useMemo as Ee } from "react";
4
+ import { useCallback as ae, useMemo as Ee } from "react";
5
5
  import { commandScore as Ce } from "./command-score.js";
6
6
  import { Primitive as I } from "@radix-ui/react-primitive";
7
- import { useId as T } from "@radix-ui/react-id";
7
+ import { useId as F } from "@radix-ui/react-id";
8
8
  import { s as we } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
9
9
  import { ASK_AI_TRIGGER_VALUE as ye } from "../../constants/search.js";
10
10
  import { composeEventHandlers as Re } from "../../utils/compose-event-handlers.js";
11
11
  import { useShadow as Ie } from "../shadow/context.js";
12
- const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-heading=""]', fe = '[cmdk-item=""]', de = `${fe}:not([aria-disabled="true"])`, ee = "cmdk-item-select", L = "data-value", xe = (t, n, r) => Ce(t, n, r ?? []), me = c.createContext(void 0), O = () => c.useContext(me), ve = c.createContext(void 0), re = () => c.useContext(ve), he = c.createContext(void 0), ge = c.forwardRef((t, n) => {
13
- const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), u = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = pe(t), {
14
- label: v,
12
+ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', xe = '[cmdk-group-heading=""]', de = '[cmdk-item=""]', ue = `${de}:not([aria-disabled="true"])`, Z = "cmdk-item-select", L = "data-value", ke = (t, n, r) => Ce(t, n, r ?? []), fe = c.createContext(void 0), D = () => c.useContext(fe), me = c.createContext(void 0), te = () => c.useContext(me), he = c.createContext(void 0), ve = c.forwardRef((t, n) => {
13
+ const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), u = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = ge(t), {
14
+ label: h,
15
15
  children: d,
16
16
  value: S,
17
17
  onValueChange: C,
@@ -20,11 +20,11 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
20
20
  loop: R,
21
21
  disablePointerSelection: _ = !1,
22
22
  vimBindings: N = !0,
23
- defaultSearch: ne,
23
+ defaultSearch: re,
24
24
  ...U
25
- } = t, h = M(() => ({
25
+ } = t, v = M(() => ({
26
26
  /** Value of the search query. */
27
- search: ne ?? "",
27
+ search: re ?? "",
28
28
  /** Currently selected item value. */
29
29
  value: t.value ?? t.defaultValue ?? "",
30
30
  /** Currently selected item id. */
@@ -37,27 +37,27 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
37
37
  /** Set of groups with at least one visible item. */
38
38
  groups: /* @__PURE__ */ new Set()
39
39
  }
40
- })), $ = T(), j = T(), q = T(), k = c.useRef(null), g = Ge();
40
+ })), $ = F(), j = F(), q = F(), x = c.useRef(null), g = Ge();
41
41
  A(() => {
42
42
  if (S !== void 0) {
43
43
  const e = S.trim();
44
- h.current.value = e, E.emit();
44
+ v.current.value = e, E.emit();
45
45
  }
46
46
  }, [S]), A(() => {
47
- g(6, ce);
47
+ g(6, oe);
48
48
  }, []);
49
49
  const G = Ie(), E = c.useMemo(() => ({
50
50
  subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
51
- snapshot: () => h.current,
51
+ snapshot: () => v.current,
52
52
  setState: (e, l, o) => {
53
- if (!Object.is(h.current[e], l)) {
54
- if (h.current[e] = l, e === "search")
55
- J(), z(), g(1, W);
53
+ if (!Object.is(v.current[e], l)) {
54
+ if (v.current[e] = l, e === "search")
55
+ J(), H(), g(1, W);
56
56
  else if (e === "value" && (G?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || g(1, () => {
57
- x()?.focus();
57
+ k()?.focus();
58
58
  }), g(7, () => {
59
- h.current.selectedItemId = x()?.id, E.emit();
60
- }), o || g(5, ce), s.current?.value !== void 0)) {
59
+ v.current.selectedItemId = k()?.id, E.emit();
60
+ }), o || g(5, oe), s.current?.value !== void 0)) {
61
61
  const b = l ?? "";
62
62
  s.current.onValueChange?.(b);
63
63
  return;
@@ -68,20 +68,20 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
68
68
  emit: () => {
69
69
  f.current.forEach((e) => e());
70
70
  }
71
- }), []), H = c.useMemo(
71
+ }), []), z = c.useMemo(
72
72
  () => ({
73
73
  // Keep id → {value, keywords} mapping up-to-date
74
74
  value: (e, l, o) => {
75
- l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e, oe(l, o)), g(2, () => {
76
- z(), E.emit();
75
+ l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), v.current.filtered.items.set(e, ne(l, o)), g(2, () => {
76
+ H(), E.emit();
77
77
  }));
78
78
  },
79
79
  // Track item lifecycle (mount, unmount)
80
80
  item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), g(3, () => {
81
- J(), z(), h.current.value || W(), E.emit();
81
+ J(), H(), v.current.value || W(), E.emit();
82
82
  }), () => {
83
- u.current.delete(e), r.current.delete(e), h.current.filtered.items.delete(e);
84
- const o = x();
83
+ u.current.delete(e), r.current.delete(e), v.current.filtered.items.delete(e);
84
+ const o = k();
85
85
  g(4, () => {
86
86
  J(), o?.getAttribute("id") === e && W(), E.emit();
87
87
  });
@@ -91,48 +91,48 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
91
91
  u.current.delete(e), i.current.delete(e);
92
92
  }),
93
93
  filter: () => !!s.current.shouldFilter,
94
- label: v || t["aria-label"] || "",
94
+ label: h || t["aria-label"] || "",
95
95
  getDisablePointerSelection: () => !!s.current.disablePointerSelection,
96
96
  listId: $,
97
97
  inputId: q,
98
98
  labelId: j,
99
- listInnerRef: k
99
+ listInnerRef: x
100
100
  }),
101
101
  []
102
102
  );
103
- function oe(e, l) {
104
- const o = s.current?.filter ?? xe;
105
- return e ? o?.(e, h.current.search, l) : 0;
103
+ function ne(e, l) {
104
+ const o = s.current?.filter ?? ke;
105
+ return e ? o?.(e, v.current.search, l) : 0;
106
106
  }
107
- function z() {
108
- if (!h.current.search || // Explicitly false, because true | undefined is the default
107
+ function H() {
108
+ if (!v.current.search || // Explicitly false, because true | undefined is the default
109
109
  s.current.shouldFilter === !1)
110
110
  return;
111
- const e = h.current.filtered.items, l = [];
112
- h.current.filtered.groups.forEach((a) => {
111
+ const e = v.current.filtered.items, l = [];
112
+ v.current.filtered.groups.forEach((a) => {
113
113
  const m = i.current.get(a);
114
114
  let b = 0;
115
- m.forEach((Y) => {
116
- const Se = e.get(Y);
115
+ m.forEach((X) => {
116
+ const Se = e.get(X);
117
117
  b = Math.max(Se, b);
118
118
  }), l.push([a, b]);
119
119
  });
120
- const o = k.current;
120
+ const o = x.current;
121
121
  V().sort((a, m) => {
122
- const b = a.getAttribute("id"), Y = m.getAttribute("id");
123
- return (e.get(Y) ?? 0) - (e.get(b) ?? 0);
122
+ const b = a.getAttribute("id"), X = m.getAttribute("id");
123
+ return (e.get(X) ?? 0) - (e.get(b) ?? 0);
124
124
  }).forEach((a) => {
125
- const m = a.closest(Z);
125
+ const m = a.closest(Y);
126
126
  if (m) {
127
- const b = a.parentElement === m ? a : a.closest(`${Z} > *`);
127
+ const b = a.parentElement === m ? a : a.closest(`${Y} > *`);
128
128
  b && m.appendChild(b);
129
129
  } else {
130
- const b = a.parentElement === o ? a : a.closest(`${Z} > *`);
130
+ const b = a.parentElement === o ? a : a.closest(`${Y} > *`);
131
131
  b && o?.appendChild(b);
132
132
  }
133
133
  }), l.sort((a, m) => m[1] - a[1]).forEach((a) => {
134
- const m = k.current?.querySelector(
135
- `${D}[${L}="${encodeURIComponent(a[0])}"]`
134
+ const m = x.current?.querySelector(
135
+ `${T}[${L}="${encodeURIComponent(a[0])}"]`
136
136
  );
137
137
  m?.parentElement?.appendChild(m);
138
138
  });
@@ -144,58 +144,58 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
144
144
  E.setState("value", l || void 0);
145
145
  }
146
146
  function J() {
147
- if (!h.current.search || // Explicitly false, because true | undefined is the default
147
+ if (!v.current.search || // Explicitly false, because true | undefined is the default
148
148
  s.current.shouldFilter === !1) {
149
- h.current.filtered.count = r.current.size;
149
+ v.current.filtered.count = r.current.size;
150
150
  return;
151
151
  }
152
- h.current.filtered.groups = /* @__PURE__ */ new Set();
152
+ v.current.filtered.groups = /* @__PURE__ */ new Set();
153
153
  let e = 0;
154
154
  for (const l of r.current) {
155
- const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = oe(o, a);
156
- h.current.filtered.items.set(l, m), m > 0 && e++;
155
+ const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = ne(o, a);
156
+ v.current.filtered.items.set(l, m), m > 0 && e++;
157
157
  }
158
158
  for (const [l, o] of i.current)
159
159
  for (const a of o) {
160
- const m = h.current.filtered.items.get(a);
160
+ const m = v.current.filtered.items.get(a);
161
161
  if (m && m > 0) {
162
- h.current.filtered.groups.add(l);
162
+ v.current.filtered.groups.add(l);
163
163
  break;
164
164
  }
165
165
  }
166
- h.current.filtered.count = e;
166
+ v.current.filtered.count = e;
167
167
  }
168
- function ce() {
169
- const e = x();
170
- e && (e.parentElement?.firstChild === e && e.closest(D)?.querySelector(ke)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
168
+ function oe() {
169
+ const e = k();
170
+ e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(xe)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
171
171
  }
172
- function x() {
173
- return k.current?.querySelector(`${fe}[aria-selected="true"]`);
172
+ function k() {
173
+ return x.current?.querySelector(`${de}[aria-selected="true"]`);
174
174
  }
175
175
  function V() {
176
- return Array.from(k.current?.querySelectorAll(de) || []);
176
+ return Array.from(x.current?.querySelectorAll(ue) || []);
177
177
  }
178
- function Q(e) {
178
+ function ce(e) {
179
179
  const o = V()[e];
180
180
  o && E.setState("value", o.getAttribute(L));
181
181
  }
182
- function X(e) {
183
- const l = x(), o = V(), a = o.findIndex((b) => b === l);
182
+ function Q(e) {
183
+ const l = k(), o = V(), a = o.findIndex((b) => b === l);
184
184
  let m = o[a + e];
185
185
  s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(L));
186
186
  }
187
187
  function se(e) {
188
- let o = x()?.closest(D), a;
188
+ let o = k()?.closest(T), a;
189
189
  for (; o && !a; )
190
- o = e > 0 ? Fe(o, D) : Oe(o, D), a = o?.querySelector(de);
191
- a ? E.setState("value", a.getAttribute(L)) : X(e);
190
+ o = e > 0 ? Oe(o, T) : De(o, T), a = o?.querySelector(ue);
191
+ a ? E.setState("value", a.getAttribute(L)) : Q(e);
192
192
  }
193
- const ie = () => Q(V().length - 1), le = (e) => {
194
- e.preventDefault(), e.metaKey ? ie() : e.altKey ? se(1) : X(1);
195
- }, ae = (e) => {
196
- e.preventDefault(), e.metaKey ? Q(0) : e.altKey ? se(-1) : X(-1);
193
+ const be = () => ce(V().length - 1), ie = (e) => {
194
+ e.preventDefault(), e.metaKey ? be() : e.altKey ? se(1) : Q(1);
195
+ }, le = (e) => {
196
+ e.preventDefault(), e.metaKey ? ce(0) : e.altKey ? se(-1) : Q(-1);
197
197
  };
198
- return /* @__PURE__ */ te(
198
+ return /* @__PURE__ */ ee(
199
199
  I.div,
200
200
  {
201
201
  ref: n,
@@ -207,36 +207,28 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
207
207
  switch (e.key) {
208
208
  case "n":
209
209
  case "j": {
210
- N && e.ctrlKey && le(e);
210
+ N && e.ctrlKey && ie(e);
211
211
  break;
212
212
  }
213
213
  case "ArrowDown": {
214
- le(e);
214
+ ie(e);
215
215
  break;
216
216
  }
217
217
  case "p":
218
218
  case "k": {
219
- N && e.ctrlKey && ae(e);
219
+ N && e.ctrlKey && le(e);
220
220
  break;
221
221
  }
222
222
  case "ArrowUp": {
223
- ae(e);
224
- break;
225
- }
226
- case "Home": {
227
- e.preventDefault(), Q(0);
228
- break;
229
- }
230
- case "End": {
231
- e.preventDefault(), ie();
223
+ le(e);
232
224
  break;
233
225
  }
234
226
  case "Enter":
235
227
  if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
236
228
  e.preventDefault();
237
- const l = x();
229
+ const l = k();
238
230
  if (l) {
239
- const o = new Event(ee);
231
+ const o = new Event(Z);
240
232
  l.dispatchEvent(o);
241
233
  }
242
234
  }
@@ -250,34 +242,34 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
250
242
  "label",
251
243
  {
252
244
  "cmdk-label": "",
253
- htmlFor: H.inputId,
254
- id: H.labelId,
245
+ htmlFor: z.inputId,
246
+ id: z.labelId,
255
247
  style: Be,
256
- children: v
248
+ children: h
257
249
  }
258
250
  ),
259
- B(t, (e) => /* @__PURE__ */ p(ve.Provider, { value: E, children: /* @__PURE__ */ p(me.Provider, { value: H, children: e }) }))
251
+ B(t, (e) => /* @__PURE__ */ p(me.Provider, { value: E, children: /* @__PURE__ */ p(fe.Provider, { value: z, children: e }) }))
260
252
  ]
261
253
  }
262
254
  );
263
255
  }), Ae = c.forwardRef((t, n) => {
264
- const { id: r } = t, i = c.useRef(null), u = c.useContext(he), f = O(), s = pe(t), v = s.current?.forceMount ?? u?.forceMount;
256
+ const { id: r } = t, i = c.useRef(null), u = c.useContext(he), f = D(), s = ge(t), h = s.current?.forceMount ?? u?.forceMount;
265
257
  A(() => {
266
- if (!v)
258
+ if (!h)
267
259
  return f.item(r, u?.id);
268
- }, [v]);
269
- const d = be(r, i, [t.value, t.children, i], t.keywords), S = re(), C = P((g) => g.value && g.value === d.current), y = P(
270
- (g) => v || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
260
+ }, [h]);
261
+ const d = pe(r, i, [t.value, t.children, i], t.keywords), S = te(), C = P((g) => g.value && g.value === d.current), y = P(
262
+ (g) => h || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
271
263
  );
272
264
  c.useEffect(() => {
273
265
  const g = i.current;
274
266
  if (!g || t.disabled) return;
275
267
  const G = () => R("keyboard");
276
- return g.addEventListener(ee, G), () => g.removeEventListener(ee, G);
268
+ return g.addEventListener(Z, G), () => g.removeEventListener(Z, G);
277
269
  }, [y, t.onSelect, t.disabled]);
278
- const w = ue(() => {
270
+ const w = ae(() => {
279
271
  S.setState("value", d.current, !0);
280
- }, [S, d]), R = ue(
272
+ }, [S, d]), R = ae(
281
273
  (g = "click") => {
282
274
  w(), s.current.onSelect?.({ value: d.current, trigger: g });
283
275
  },
@@ -287,12 +279,12 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
287
279
  const {
288
280
  disabled: _,
289
281
  value: N,
290
- onSelect: ne,
282
+ onSelect: re,
291
283
  forceMount: U,
292
- keywords: h,
284
+ keywords: v,
293
285
  onClick: $,
294
286
  ...j
295
- } = t, q = Ee(() => F([i, n]), [i, n]), k = Re($, R);
287
+ } = t, q = Ee(() => O([i, n]), [i, n]), x = Re($, R);
296
288
  return /* @__PURE__ */ p(
297
289
  I.div,
298
290
  {
@@ -306,21 +298,21 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
306
298
  "data-disabled": !!_,
307
299
  "data-selected": !!C,
308
300
  onPointerMove: _ || f.getDisablePointerSelection() ? void 0 : w,
309
- onClick: _ ? void 0 : k,
301
+ onClick: _ ? void 0 : x,
310
302
  onFocus: _ ? void 0 : w,
311
303
  children: t.children
312
304
  }
313
305
  );
314
306
  }), _e = c.forwardRef((t, n) => {
315
- const { heading: r, children: i, forceMount: u, ...f } = t, s = T(), v = c.useRef(null), d = c.useRef(null), S = T(), C = O(), y = P(
307
+ const { heading: r, children: i, forceMount: u, ...f } = t, s = F(), h = c.useRef(null), d = c.useRef(null), S = F(), C = D(), y = P(
316
308
  (R) => u || C.filter() === !1 ? !0 : R.search ? R.filtered.groups.has(s) : !0
317
309
  );
318
- A(() => C.group(s), []), be(s, v, [t.value, t.heading, d]);
310
+ A(() => C.group(s), []), pe(s, h, [t.value, t.heading, d]);
319
311
  const w = c.useMemo(() => ({ id: s, forceMount: u }), [u]);
320
- return /* @__PURE__ */ te(
312
+ return /* @__PURE__ */ ee(
321
313
  I.div,
322
314
  {
323
- ref: F([v, n]),
315
+ ref: O([h, n]),
324
316
  ...f,
325
317
  "cmdk-group": "",
326
318
  role: "presentation",
@@ -339,14 +331,14 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
339
331
  return !r && !f ? null : /* @__PURE__ */ p(
340
332
  I.div,
341
333
  {
342
- ref: F([u, n]),
334
+ ref: O([u, n]),
343
335
  ...i,
344
336
  "cmdk-separator": "",
345
337
  role: "separator"
346
338
  }
347
339
  );
348
340
  }), Me = c.forwardRef((t, n) => {
349
- const { onValueChange: r, ...i } = t, u = t.value != null, f = re(), s = P((d) => d.search), v = O();
341
+ const { onValueChange: r, ...i } = t, u = t.value != null, f = te(), s = P((d) => d.search), h = D();
350
342
  return c.useEffect(() => {
351
343
  t.value != null && f.setState("search", t.value);
352
344
  }, [t.value]), /* @__PURE__ */ p(
@@ -361,9 +353,9 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
361
353
  "aria-autocomplete": "list",
362
354
  role: "combobox",
363
355
  "aria-expanded": !0,
364
- "aria-controls": v.listId,
365
- "aria-labelledby": v.labelId,
366
- id: v.inputId,
356
+ "aria-controls": h.listId,
357
+ "aria-labelledby": h.labelId,
358
+ id: h.inputId,
367
359
  type: "text",
368
360
  value: u ? t.value : s,
369
361
  onChange: (d) => {
@@ -372,7 +364,7 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
372
364
  }
373
365
  );
374
366
  }), Pe = c.forwardRef((t, n) => {
375
- const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v = O();
367
+ const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), h = D();
376
368
  return c.useEffect(() => {
377
369
  if (s.current && f.current) {
378
370
  const d = s.current, S = f.current;
@@ -390,22 +382,22 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
390
382
  }, []), /* @__PURE__ */ p(
391
383
  I.div,
392
384
  {
393
- ref: F([f, n]),
385
+ ref: O([f, n]),
394
386
  ...u,
395
387
  "cmdk-list": "",
396
388
  tabIndex: -1,
397
389
  "aria-label": i,
398
- id: v.listId,
399
- children: B(t, (d) => /* @__PURE__ */ p("div", { ref: F([s, v.listInnerRef]), "cmdk-list-sizer": "", children: d }))
390
+ id: h.listId,
391
+ children: B(t, (d) => /* @__PURE__ */ p("div", { ref: O([s, h.listInnerRef]), "cmdk-list-sizer": "", children: d }))
400
392
  }
401
393
  );
402
394
  }), Ve = c.forwardRef((t, n) => {
403
- const { open: r, onOpenChange: i, overlayClassName: u, contentClassName: f, container: s, ...v } = t;
404
- return /* @__PURE__ */ p(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ te(K.Portal, { container: s, children: [
395
+ const { open: r, onOpenChange: i, overlayClassName: u, contentClassName: f, container: s, ...h } = t;
396
+ return /* @__PURE__ */ p(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ ee(K.Portal, { container: s, children: [
405
397
  /* @__PURE__ */ p(K.Overlay, { "cmdk-overlay": "", className: u }),
406
- /* @__PURE__ */ p(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(ge, { ref: n, ...v }) })
398
+ /* @__PURE__ */ p(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(ve, { ref: n, ...h }) })
407
399
  ] }) });
408
- }), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(I.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Te = c.forwardRef((t, n) => {
400
+ }), Te = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(I.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Fe = c.forwardRef((t, n) => {
409
401
  const { progress: r, children: i, label: u = "Loading...", ...f } = t;
410
402
  return /* @__PURE__ */ p(
411
403
  I.div,
@@ -421,31 +413,31 @@ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-head
421
413
  children: B(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
422
414
  }
423
415
  );
424
- }), Qe = Object.assign(ge, {
416
+ }), Qe = Object.assign(ve, {
425
417
  List: Pe,
426
418
  Item: Ae,
427
419
  Input: Me,
428
420
  Group: _e,
429
421
  Separator: Le,
430
422
  Dialog: Ve,
431
- Empty: De,
432
- Loading: Te
423
+ Empty: Te,
424
+ Loading: Fe
433
425
  });
434
- function Fe(t, n) {
426
+ function Oe(t, n) {
435
427
  let r = t.nextElementSibling;
436
428
  for (; r; ) {
437
429
  if (r.matches(n)) return r;
438
430
  r = r.nextElementSibling;
439
431
  }
440
432
  }
441
- function Oe(t, n) {
433
+ function De(t, n) {
442
434
  let r = t.previousElementSibling;
443
435
  for (; r; ) {
444
436
  if (r.matches(n)) return r;
445
437
  r = r.previousElementSibling;
446
438
  }
447
439
  }
448
- function pe(t) {
440
+ function ge(t) {
449
441
  const n = c.useRef(t);
450
442
  return A(() => {
451
443
  n.current = t;
@@ -456,7 +448,7 @@ function M(t) {
456
448
  const n = c.useRef(void 0);
457
449
  return n.current === void 0 && (n.current = t()), n;
458
450
  }
459
- function F(t) {
451
+ function O(t) {
460
452
  return (n) => {
461
453
  t.forEach((r) => {
462
454
  typeof r == "function" ? r(n) : r != null && (r.current = n);
@@ -464,11 +456,11 @@ function F(t) {
464
456
  };
465
457
  }
466
458
  function P(t) {
467
- const n = re(), r = () => t(n.snapshot());
459
+ const n = te(), r = () => t(n.snapshot());
468
460
  return we.useSyncExternalStore(n.subscribe, r, r);
469
461
  }
470
- function be(t, n, r, i = []) {
471
- const u = c.useRef(void 0), f = O();
462
+ function pe(t, n, r, i = []) {
463
+ const u = c.useRef(void 0), f = D();
472
464
  return A(() => {
473
465
  const s = (() => {
474
466
  for (const d of r) {
@@ -477,8 +469,8 @@ function be(t, n, r, i = []) {
477
469
  if (typeof d == "object" && "current" in d)
478
470
  return d.current ? d.current.textContent?.trim() : u.current;
479
471
  }
480
- })(), v = i.map((d) => d.trim());
481
- f.value(t, s, v), n.current?.setAttribute(L, s), u.current = s;
472
+ })(), h = i.map((d) => d.trim());
473
+ f.value(t, s, h), n.current?.setAttribute(L, s), u.current = s;
482
474
  }), u;
483
475
  }
484
476
  const Ge = () => {
@@ -515,14 +507,14 @@ const Be = {
515
507
  export {
516
508
  Qe as Command,
517
509
  Ve as CommandDialog,
518
- De as CommandEmpty,
510
+ Te as CommandEmpty,
519
511
  Me as CommandInput,
520
512
  Ae as CommandItem,
521
513
  Pe as CommandList,
522
- Te as CommandLoading,
523
- ge as CommandRoot,
514
+ Fe as CommandLoading,
515
+ ve as CommandRoot,
524
516
  Le as CommandSeparator,
525
- xe as defaultFilter,
517
+ ke as defaultFilter,
526
518
  P as useCommandState,
527
- re as useCommandStore
519
+ te as useCommandStore
528
520
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.47",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.48",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
7
7
  const u = x(void 0), U = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.47",
10
+ widgetLibraryVersion: "0.5.48",
11
11
  componentType: n,
12
12
  tags: i
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.47",
3
+ "version": "0.5.48",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -59,9 +59,9 @@
59
59
  "remark-gfm": "^4.0.1",
60
60
  "unist-util-visit": "^5.0.0",
61
61
  "use-sync-external-store": "^1.4.0",
62
- "@inkeep/cxkit-color-mode": "0.5.47",
63
- "@inkeep/cxkit-theme": "0.5.47",
64
- "@inkeep/cxkit-types": "0.5.47"
62
+ "@inkeep/cxkit-color-mode": "0.5.48",
63
+ "@inkeep/cxkit-theme": "0.5.48",
64
+ "@inkeep/cxkit-types": "0.5.48"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "1.9.4",