@adamosuiteservices/ui 1.9.15 → 2.9.15
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.
- package/dist/combobox.cjs +9 -9
- package/dist/combobox.js +167 -168
- package/dist/components/ui/combobox/combobox.d.ts +10 -14
- package/dist/icon-DTx6Y_mx.cjs +6 -0
- package/dist/icon-DmU_SEHC.js +36 -0
- package/dist/icon.cjs +1 -6
- package/dist/icon.js +2 -34
- package/docs/components/ui/combobox.md +6 -6
- package/package.json +1 -1
package/dist/combobox.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./jsx-runtime-BB_1_6y_.cjs"),Ce=require("./button-D-qFRXiM.cjs"),Ae=require("./checkbox-CdnZ8VFJ.cjs"),q=require("./index-DoxiiusW.cjs"),ue=require("react"),ie=require("./index-BFyr34mw.cjs"),D=require("./index-CocSS1YK.cjs"),B=require("./index-WIv2ndLu.cjs"),ee=require("./index-_XxjJPRD.cjs"),Ne=require("./createLucideIcon-CAtnV-yz.cjs"),oe=require("./icon-DTx6Y_mx.cjs"),ce=require("./popover-CYbik-H4.cjs");function Pe(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const p=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,p.get?p:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=Pe(ue);/**
|
|
2
2
|
* @license lucide-react v0.546.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const qe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Me=Ae.createLucideIcon("search",qe);var ve=1,De=.9,Le=.8,Oe=.17,ce=.1,de=.999,Fe=.9999,Te=.99,ze=/[\\\/_+.#"@\[\(\{&]/,Ve=/[\\\/_+.#"@\[\(\{&]/g,Ke=/[\s-]/,be=/[\s-]/g;function fe(e,n,r,p,i,c,m){if(c===n.length)return i===e.length?ve:Te;var d=`${i},${c}`;if(m[d]!==void 0)return m[d];for(var g=p.charAt(c),o=r.indexOf(g,i),x=0,s,w,R,C;o>=0;)s=fe(e,n,r,p,o+1,c+1,m),s>x&&(o===i?s*=ve:ze.test(e.charAt(o-1))?(s*=Le,R=e.slice(i,o-1).match(Ve),R&&i>0&&(s*=Math.pow(de,R.length))):Ke.test(e.charAt(o-1))?(s*=De,C=e.slice(i,o-1).match(be),C&&i>0&&(s*=Math.pow(de,C.length))):(s*=Oe,i>0&&(s*=Math.pow(de,o-i))),e.charAt(o)!==n.charAt(c)&&(s*=Fe)),(s<ce&&r.charAt(o-1)===p.charAt(c+1)||p.charAt(c+1)===p.charAt(c)&&r.charAt(o-1)!==p.charAt(c))&&(w=fe(e,n,r,p,o+1,c+2,m),w*ce>s&&(s=w*ce)),s>x&&(x=s),o=r.indexOf(g,o+1);return m[d]=x,x}function xe(e){return e.toLowerCase().replace(be," ")}function _e(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,fe(e,n,xe(e),xe(n),0,0,{})}var Z='[cmdk-group=""]',me='[cmdk-group-items=""]',Be='[cmdk-group-heading=""]',ye='[cmdk-item=""]',ge=`${ye}:not([aria-disabled="true"])`,pe="cmdk-item-select",K="data-value",We=(e,n,r)=>_e(e,n,r),je=a.createContext(void 0),te=()=>a.useContext(je),Ee=a.createContext(void 0),he=()=>a.useContext(Ee),Re=a.createContext(void 0),ke=a.forwardRef((e,n)=>{let r=_(()=>{var t,u;return{search:"",value:(u=(t=e.value)!=null?t:e.defaultValue)!=null?u:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),p=_(()=>new Set),i=_(()=>new Map),c=_(()=>new Map),m=_(()=>new Set),d=we(e),{label:g,children:o,value:x,onValueChange:s,filter:w,shouldFilter:R,loop:C,disablePointerSelection:G=!1,vimBindings:q=!0,...y}=e,re=B.useId(),A=B.useId(),z=B.useId(),N=a.useRef(null),j=rt();T(()=>{if(x!==void 0){let t=x.trim();r.current.value=t,k.emit()}},[x]),T(()=>{j(6,X)},[]);let k=a.useMemo(()=>({subscribe:t=>(m.current.add(t),()=>m.current.delete(t)),snapshot:()=>r.current,setState:(t,u,v)=>{var l,b,E,I;if(!Object.is(r.current[t],u)){if(r.current[t]=u,t==="search")J(),V(),j(1,O);else if(t==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let S=document.getElementById(z);S?S.focus():(l=document.getElementById(re))==null||l.focus()}if(j(7,()=>{var S;r.current.selectedItemId=(S=M())==null?void 0:S.id,k.emit()}),v||j(5,X),((b=d.current)==null?void 0:b.value)!==void 0){let S=u??"";(I=(E=d.current).onValueChange)==null||I.call(E,S);return}}k.emit()}},emit:()=>{m.current.forEach(t=>t())}}),[]),U=a.useMemo(()=>({value:(t,u,v)=>{var l;u!==((l=c.current.get(t))==null?void 0:l.value)&&(c.current.set(t,{value:u,keywords:v}),r.current.filtered.items.set(t,H(u,v)),j(2,()=>{V(),k.emit()}))},item:(t,u)=>(p.current.add(t),u&&(i.current.has(u)?i.current.get(u).add(t):i.current.set(u,new Set([t]))),j(3,()=>{J(),V(),r.current.value||O(),k.emit()}),()=>{c.current.delete(t),p.current.delete(t),r.current.filtered.items.delete(t);let v=M();j(4,()=>{J(),v?.getAttribute("id")===t&&O(),k.emit()})}),group:t=>(i.current.has(t)||i.current.set(t,new Set),()=>{c.current.delete(t),i.current.delete(t)}),filter:()=>d.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:re,inputId:z,labelId:A,listInnerRef:N}),[]);function H(t,u){var v,l;let b=(l=(v=d.current)==null?void 0:v.filter)!=null?l:We;return t?b(t,r.current.search,u):0}function V(){if(!r.current.search||d.current.shouldFilter===!1)return;let t=r.current.filtered.items,u=[];r.current.filtered.groups.forEach(l=>{let b=i.current.get(l),E=0;b.forEach(I=>{let S=t.get(I);E=Math.max(S,E)}),u.push([l,E])});let v=N.current;F().sort((l,b)=>{var E,I;let S=l.getAttribute("id"),le=b.getAttribute("id");return((E=t.get(le))!=null?E:0)-((I=t.get(S))!=null?I:0)}).forEach(l=>{let b=l.closest(me);b?b.appendChild(l.parentElement===b?l:l.closest(`${me} > *`)):v.appendChild(l.parentElement===v?l:l.closest(`${me} > *`))}),u.sort((l,b)=>b[1]-l[1]).forEach(l=>{var b;let E=(b=N.current)==null?void 0:b.querySelector(`${Z}[${K}="${encodeURIComponent(l[0])}"]`);E?.parentElement.appendChild(E)})}function O(){let t=F().find(v=>v.getAttribute("aria-disabled")!=="true"),u=t?.getAttribute(K);k.setState("value",u||void 0)}function J(){var t,u,v,l;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=p.current.size;return}r.current.filtered.groups=new Set;let b=0;for(let E of p.current){let I=(u=(t=c.current.get(E))==null?void 0:t.value)!=null?u:"",S=(l=(v=c.current.get(E))==null?void 0:v.keywords)!=null?l:[],le=H(I,S);r.current.filtered.items.set(E,le),le>0&&b++}for(let[E,I]of i.current)for(let S of I)if(r.current.filtered.items.get(S)>0){r.current.filtered.groups.add(E);break}r.current.filtered.count=b}function X(){var t,u,v;let l=M();l&&(((t=l.parentElement)==null?void 0:t.firstChild)===l&&((v=(u=l.closest(Z))==null?void 0:u.querySelector(Be))==null||v.scrollIntoView({block:"nearest"})),l.scrollIntoView({block:"nearest"}))}function M(){var t;return(t=N.current)==null?void 0:t.querySelector(`${ye}[aria-selected="true"]`)}function F(){var t;return Array.from(((t=N.current)==null?void 0:t.querySelectorAll(ge))||[])}function Y(t){let u=F()[t];u&&k.setState("value",u.getAttribute(K))}function Q(t){var u;let v=M(),l=F(),b=l.findIndex(I=>I===v),E=l[b+t];(u=d.current)!=null&&u.loop&&(E=b+t<0?l[l.length-1]:b+t===l.length?l[0]:l[b+t]),E&&k.setState("value",E.getAttribute(K))}function ne(t){let u=M(),v=u?.closest(Z),l;for(;v&&!l;)v=t>0?et(v,Z):tt(v,Z),l=v?.querySelector(ge);l?k.setState("value",l.getAttribute(K)):Q(t)}let ae=()=>Y(F().length-1),f=t=>{t.preventDefault(),t.metaKey?ae():t.altKey?ne(1):Q(1)},P=t=>{t.preventDefault(),t.metaKey?Y(0):t.altKey?ne(-1):Q(-1)};return a.createElement(L.Primitive.div,{ref:n,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:t=>{var u;(u=y.onKeyDown)==null||u.call(y,t);let v=t.nativeEvent.isComposing||t.keyCode===229;if(!(t.defaultPrevented||v))switch(t.key){case"n":case"j":{q&&t.ctrlKey&&f(t);break}case"ArrowDown":{f(t);break}case"p":case"k":{q&&t.ctrlKey&&P(t);break}case"ArrowUp":{P(t);break}case"Home":{t.preventDefault(),Y(0);break}case"End":{t.preventDefault(),ae();break}case"Enter":{t.preventDefault();let l=M();if(l){let b=new Event(pe);l.dispatchEvent(b)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:at},g),ue(e,t=>a.createElement(Ee.Provider,{value:k},a.createElement(je.Provider,{value:U},t))))}),Ge=a.forwardRef((e,n)=>{var r,p;let i=B.useId(),c=a.useRef(null),m=a.useContext(Re),d=te(),g=we(e),o=(p=(r=g.current)==null?void 0:r.forceMount)!=null?p:m?.forceMount;T(()=>{if(!o)return d.item(i,m?.id)},[o]);let x=Se(i,c,[e.value,e.children,c],e.keywords),s=he(),w=D(j=>j.value&&j.value===x.current),R=D(j=>o||d.filter()===!1?!0:j.search?j.filtered.items.get(i)>0:!0);a.useEffect(()=>{let j=c.current;if(!(!j||e.disabled))return j.addEventListener(pe,C),()=>j.removeEventListener(pe,C)},[R,e.onSelect,e.disabled]);function C(){var j,k;G(),(k=(j=g.current).onSelect)==null||k.call(j,x.current)}function G(){s.setState("value",x.current,!0)}if(!R)return null;let{disabled:q,value:y,onSelect:re,forceMount:A,keywords:z,...N}=e;return a.createElement(L.Primitive.div,{ref:ee.composeRefs(c,n),...N,id:i,"cmdk-item":"",role:"option","aria-disabled":!!q,"aria-selected":!!w,"data-disabled":!!q,"data-selected":!!w,onPointerMove:q||d.getDisablePointerSelection()?void 0:G,onClick:q?void 0:C},e.children)}),Ue=a.forwardRef((e,n)=>{let{heading:r,children:p,forceMount:i,...c}=e,m=B.useId(),d=a.useRef(null),g=a.useRef(null),o=B.useId(),x=te(),s=D(R=>i||x.filter()===!1?!0:R.search?R.filtered.groups.has(m):!0);T(()=>x.group(m),[]),Se(m,d,[e.value,e.heading,g]);let w=a.useMemo(()=>({id:m,forceMount:i}),[i]);return a.createElement(L.Primitive.div,{ref:ee.composeRefs(d,n),...c,"cmdk-group":"",role:"presentation",hidden:s?void 0:!0},r&&a.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:o},r),ue(e,R=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?o:void 0},a.createElement(Re.Provider,{value:w},R))))}),He=a.forwardRef((e,n)=>{let{alwaysRender:r,...p}=e,i=a.useRef(null),c=D(m=>!m.search);return!r&&!c?null:a.createElement(L.Primitive.div,{ref:ee.composeRefs(i,n),...p,"cmdk-separator":"",role:"separator"})}),Je=a.forwardRef((e,n)=>{let{onValueChange:r,...p}=e,i=e.value!=null,c=he(),m=D(o=>o.search),d=D(o=>o.selectedItemId),g=te();return a.useEffect(()=>{e.value!=null&&c.setState("search",e.value)},[e.value]),a.createElement(L.Primitive.input,{ref:n,...p,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":d,id:g.inputId,type:"text",value:i?e.value:m,onChange:o=>{i||c.setState("search",o.target.value),r?.(o.target.value)}})}),Xe=a.forwardRef((e,n)=>{let{children:r,label:p="Suggestions",...i}=e,c=a.useRef(null),m=a.useRef(null),d=D(o=>o.selectedItemId),g=te();return a.useEffect(()=>{if(m.current&&c.current){let o=m.current,x=c.current,s,w=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let R=o.offsetHeight;x.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return w.observe(o),()=>{cancelAnimationFrame(s),w.unobserve(o)}}},[]),a.createElement(L.Primitive.div,{ref:ee.composeRefs(c,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":p,id:g.listId},ue(e,o=>a.createElement("div",{ref:ee.composeRefs(m,g.listInnerRef),"cmdk-list-sizer":""},o)))}),Ye=a.forwardRef((e,n)=>{let{open:r,onOpenChange:p,overlayClassName:i,contentClassName:c,container:m,...d}=e;return a.createElement(ie.Root,{open:r,onOpenChange:p},a.createElement(ie.Portal,{container:m},a.createElement(ie.Overlay,{"cmdk-overlay":"",className:i}),a.createElement(ie.Content,{"aria-label":e.label,"cmdk-dialog":"",className:c},a.createElement(ke,{ref:n,...d}))))}),Qe=a.forwardRef((e,n)=>D(r=>r.filtered.count===0)?a.createElement(L.Primitive.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Ze=a.forwardRef((e,n)=>{let{progress:r,children:p,label:i="Loading...",...c}=e;return a.createElement(L.Primitive.div,{ref:n,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ue(e,m=>a.createElement("div",{"aria-hidden":!0},m)))}),W=Object.assign(ke,{List:Xe,Item:Ge,Input:Je,Group:Ue,Separator:He,Dialog:Ye,Empty:Qe,Loading:Ze});function et(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function tt(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(e){let n=a.useRef(e);return T(()=>{n.current=e}),n}var T=typeof window>"u"?a.useEffect:a.useLayoutEffect;function _(e){let n=a.useRef();return n.current===void 0&&(n.current=e()),n}function D(e){let n=he(),r=()=>e(n.snapshot());return a.useSyncExternalStore(n.subscribe,r,r)}function Se(e,n,r,p=[]){let i=a.useRef(),c=te();return T(()=>{var m;let d=(()=>{var o;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(o=x.current.textContent)==null?void 0:o.trim():i.current}})(),g=p.map(o=>o.trim());c.value(e,d,g),(m=n.current)==null||m.setAttribute(K,d),i.current=d}),i}var rt=()=>{let[e,n]=a.useState(),r=_(()=>new Map);return T(()=>{r.current.forEach(p=>p()),r.current=new Map},[e]),(p,i)=>{r.current.set(p,i),n({})}};function nt(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function ue({asChild:e,children:n},r){return e&&a.isValidElement(n)?a.cloneElement(nt(n),{ref:n.ref},r(n.props.children)):r(n)}var at={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function lt({className:e,...n}){return h.jsxRuntimeExports.jsx(W,{"data-slot":"command",className:$.cn(`
|
|
6
|
+
*/const qe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Me=Ne.createLucideIcon("search",qe);var ve=1,Le=.9,$e=.8,De=.17,de=.1,me=.999,Oe=.9999,Fe=.99,Te=/[\\\/_+.#"@\[\(\{&]/,Ve=/[\\\/_+.#"@\[\(\{&]/g,Ke=/[\s-]/,ye=/[\s-]/g;function pe(e,n,r,p,i,c,m){if(c===n.length)return i===e.length?ve:Fe;var d=`${i},${c}`;if(m[d]!==void 0)return m[d];for(var g=p.charAt(c),o=r.indexOf(g,i),v=0,s,I,R,C;o>=0;)s=pe(e,n,r,p,o+1,c+1,m),s>v&&(o===i?s*=ve:Te.test(e.charAt(o-1))?(s*=$e,R=e.slice(i,o-1).match(Ve),R&&i>0&&(s*=Math.pow(me,R.length))):Ke.test(e.charAt(o-1))?(s*=Le,C=e.slice(i,o-1).match(ye),C&&i>0&&(s*=Math.pow(me,C.length))):(s*=De,i>0&&(s*=Math.pow(me,o-i))),e.charAt(o)!==n.charAt(c)&&(s*=Oe)),(s<de&&r.charAt(o-1)===p.charAt(c+1)||p.charAt(c+1)===p.charAt(c)&&r.charAt(o-1)!==p.charAt(c))&&(I=pe(e,n,r,p,o+1,c+2,m),I*de>s&&(s=I*de)),s>v&&(v=s),o=r.indexOf(g,o+1);return m[d]=v,v}function ge(e){return e.toLowerCase().replace(ye," ")}function ze(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,pe(e,n,ge(e),ge(n),0,0,{})}var Z='[cmdk-group=""]',fe='[cmdk-group-items=""]',_e='[cmdk-group-heading=""]',je='[cmdk-item=""]',be=`${je}:not([aria-disabled="true"])`,xe="cmdk-item-select",z="data-value",Be=(e,n,r)=>ze(e,n,r),Ee=a.createContext(void 0),te=()=>a.useContext(Ee),Re=a.createContext(void 0),he=()=>a.useContext(Re),ke=a.createContext(void 0),Ie=a.forwardRef((e,n)=>{let r=_(()=>{var t,u;return{search:"",value:(u=(t=e.value)!=null?t:e.defaultValue)!=null?u:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),p=_(()=>new Set),i=_(()=>new Map),c=_(()=>new Map),m=_(()=>new Set),d=we(e),{label:g,children:o,value:v,onValueChange:s,filter:I,shouldFilter:R,loop:C,disablePointerSelection:G=!1,vimBindings:M=!0,...y}=e,re=B.useId(),A=B.useId(),V=B.useId(),N=a.useRef(null),j=tt();T(()=>{if(v!==void 0){let t=v.trim();r.current.value=t,k.emit()}},[v]),T(()=>{j(6,X)},[]);let k=a.useMemo(()=>({subscribe:t=>(m.current.add(t),()=>m.current.delete(t)),snapshot:()=>r.current,setState:(t,u,h)=>{var l,b,E,S;if(!Object.is(r.current[t],u)){if(r.current[t]=u,t==="search")J(),K(),j(1,O);else if(t==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let w=document.getElementById(V);w?w.focus():(l=document.getElementById(re))==null||l.focus()}if(j(7,()=>{var w;r.current.selectedItemId=(w=L())==null?void 0:w.id,k.emit()}),h||j(5,X),((b=d.current)==null?void 0:b.value)!==void 0){let w=u??"";(S=(E=d.current).onValueChange)==null||S.call(E,w);return}}k.emit()}},emit:()=>{m.current.forEach(t=>t())}}),[]),U=a.useMemo(()=>({value:(t,u,h)=>{var l;u!==((l=c.current.get(t))==null?void 0:l.value)&&(c.current.set(t,{value:u,keywords:h}),r.current.filtered.items.set(t,H(u,h)),j(2,()=>{K(),k.emit()}))},item:(t,u)=>(p.current.add(t),u&&(i.current.has(u)?i.current.get(u).add(t):i.current.set(u,new Set([t]))),j(3,()=>{J(),K(),r.current.value||O(),k.emit()}),()=>{c.current.delete(t),p.current.delete(t),r.current.filtered.items.delete(t);let h=L();j(4,()=>{J(),h?.getAttribute("id")===t&&O(),k.emit()})}),group:t=>(i.current.has(t)||i.current.set(t,new Set),()=>{c.current.delete(t),i.current.delete(t)}),filter:()=>d.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:re,inputId:V,labelId:A,listInnerRef:N}),[]);function H(t,u){var h,l;let b=(l=(h=d.current)==null?void 0:h.filter)!=null?l:Be;return t?b(t,r.current.search,u):0}function K(){if(!r.current.search||d.current.shouldFilter===!1)return;let t=r.current.filtered.items,u=[];r.current.filtered.groups.forEach(l=>{let b=i.current.get(l),E=0;b.forEach(S=>{let w=t.get(S);E=Math.max(w,E)}),u.push([l,E])});let h=N.current;F().sort((l,b)=>{var E,S;let w=l.getAttribute("id"),le=b.getAttribute("id");return((E=t.get(le))!=null?E:0)-((S=t.get(w))!=null?S:0)}).forEach(l=>{let b=l.closest(fe);b?b.appendChild(l.parentElement===b?l:l.closest(`${fe} > *`)):h.appendChild(l.parentElement===h?l:l.closest(`${fe} > *`))}),u.sort((l,b)=>b[1]-l[1]).forEach(l=>{var b;let E=(b=N.current)==null?void 0:b.querySelector(`${Z}[${z}="${encodeURIComponent(l[0])}"]`);E?.parentElement.appendChild(E)})}function O(){let t=F().find(h=>h.getAttribute("aria-disabled")!=="true"),u=t?.getAttribute(z);k.setState("value",u||void 0)}function J(){var t,u,h,l;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=p.current.size;return}r.current.filtered.groups=new Set;let b=0;for(let E of p.current){let S=(u=(t=c.current.get(E))==null?void 0:t.value)!=null?u:"",w=(l=(h=c.current.get(E))==null?void 0:h.keywords)!=null?l:[],le=H(S,w);r.current.filtered.items.set(E,le),le>0&&b++}for(let[E,S]of i.current)for(let w of S)if(r.current.filtered.items.get(w)>0){r.current.filtered.groups.add(E);break}r.current.filtered.count=b}function X(){var t,u,h;let l=L();l&&(((t=l.parentElement)==null?void 0:t.firstChild)===l&&((h=(u=l.closest(Z))==null?void 0:u.querySelector(_e))==null||h.scrollIntoView({block:"nearest"})),l.scrollIntoView({block:"nearest"}))}function L(){var t;return(t=N.current)==null?void 0:t.querySelector(`${je}[aria-selected="true"]`)}function F(){var t;return Array.from(((t=N.current)==null?void 0:t.querySelectorAll(be))||[])}function Y(t){let u=F()[t];u&&k.setState("value",u.getAttribute(z))}function Q(t){var u;let h=L(),l=F(),b=l.findIndex(S=>S===h),E=l[b+t];(u=d.current)!=null&&u.loop&&(E=b+t<0?l[l.length-1]:b+t===l.length?l[0]:l[b+t]),E&&k.setState("value",E.getAttribute(z))}function ne(t){let u=L(),h=u?.closest(Z),l;for(;h&&!l;)h=t>0?Ze(h,Z):et(h,Z),l=h?.querySelector(be);l?k.setState("value",l.getAttribute(z)):Q(t)}let ae=()=>Y(F().length-1),f=t=>{t.preventDefault(),t.metaKey?ae():t.altKey?ne(1):Q(1)},P=t=>{t.preventDefault(),t.metaKey?Y(0):t.altKey?ne(-1):Q(-1)};return a.createElement(D.Primitive.div,{ref:n,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:t=>{var u;(u=y.onKeyDown)==null||u.call(y,t);let h=t.nativeEvent.isComposing||t.keyCode===229;if(!(t.defaultPrevented||h))switch(t.key){case"n":case"j":{M&&t.ctrlKey&&f(t);break}case"ArrowDown":{f(t);break}case"p":case"k":{M&&t.ctrlKey&&P(t);break}case"ArrowUp":{P(t);break}case"Home":{t.preventDefault(),Y(0);break}case"End":{t.preventDefault(),ae();break}case"Enter":{t.preventDefault();let l=L();if(l){let b=new Event(xe);l.dispatchEvent(b)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:nt},g),se(e,t=>a.createElement(Re.Provider,{value:k},a.createElement(Ee.Provider,{value:U},t))))}),We=a.forwardRef((e,n)=>{var r,p;let i=B.useId(),c=a.useRef(null),m=a.useContext(ke),d=te(),g=we(e),o=(p=(r=g.current)==null?void 0:r.forceMount)!=null?p:m?.forceMount;T(()=>{if(!o)return d.item(i,m?.id)},[o]);let v=Se(i,c,[e.value,e.children,c],e.keywords),s=he(),I=$(j=>j.value&&j.value===v.current),R=$(j=>o||d.filter()===!1?!0:j.search?j.filtered.items.get(i)>0:!0);a.useEffect(()=>{let j=c.current;if(!(!j||e.disabled))return j.addEventListener(xe,C),()=>j.removeEventListener(xe,C)},[R,e.onSelect,e.disabled]);function C(){var j,k;G(),(k=(j=g.current).onSelect)==null||k.call(j,v.current)}function G(){s.setState("value",v.current,!0)}if(!R)return null;let{disabled:M,value:y,onSelect:re,forceMount:A,keywords:V,...N}=e;return a.createElement(D.Primitive.div,{ref:ee.composeRefs(c,n),...N,id:i,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!I,"data-disabled":!!M,"data-selected":!!I,onPointerMove:M||d.getDisablePointerSelection()?void 0:G,onClick:M?void 0:C},e.children)}),Ge=a.forwardRef((e,n)=>{let{heading:r,children:p,forceMount:i,...c}=e,m=B.useId(),d=a.useRef(null),g=a.useRef(null),o=B.useId(),v=te(),s=$(R=>i||v.filter()===!1?!0:R.search?R.filtered.groups.has(m):!0);T(()=>v.group(m),[]),Se(m,d,[e.value,e.heading,g]);let I=a.useMemo(()=>({id:m,forceMount:i}),[i]);return a.createElement(D.Primitive.div,{ref:ee.composeRefs(d,n),...c,"cmdk-group":"",role:"presentation",hidden:s?void 0:!0},r&&a.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:o},r),se(e,R=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?o:void 0},a.createElement(ke.Provider,{value:I},R))))}),Ue=a.forwardRef((e,n)=>{let{alwaysRender:r,...p}=e,i=a.useRef(null),c=$(m=>!m.search);return!r&&!c?null:a.createElement(D.Primitive.div,{ref:ee.composeRefs(i,n),...p,"cmdk-separator":"",role:"separator"})}),He=a.forwardRef((e,n)=>{let{onValueChange:r,...p}=e,i=e.value!=null,c=he(),m=$(o=>o.search),d=$(o=>o.selectedItemId),g=te();return a.useEffect(()=>{e.value!=null&&c.setState("search",e.value)},[e.value]),a.createElement(D.Primitive.input,{ref:n,...p,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":d,id:g.inputId,type:"text",value:i?e.value:m,onChange:o=>{i||c.setState("search",o.target.value),r?.(o.target.value)}})}),Je=a.forwardRef((e,n)=>{let{children:r,label:p="Suggestions",...i}=e,c=a.useRef(null),m=a.useRef(null),d=$(o=>o.selectedItemId),g=te();return a.useEffect(()=>{if(m.current&&c.current){let o=m.current,v=c.current,s,I=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let R=o.offsetHeight;v.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return I.observe(o),()=>{cancelAnimationFrame(s),I.unobserve(o)}}},[]),a.createElement(D.Primitive.div,{ref:ee.composeRefs(c,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":p,id:g.listId},se(e,o=>a.createElement("div",{ref:ee.composeRefs(m,g.listInnerRef),"cmdk-list-sizer":""},o)))}),Xe=a.forwardRef((e,n)=>{let{open:r,onOpenChange:p,overlayClassName:i,contentClassName:c,container:m,...d}=e;return a.createElement(ie.Root,{open:r,onOpenChange:p},a.createElement(ie.Portal,{container:m},a.createElement(ie.Overlay,{"cmdk-overlay":"",className:i}),a.createElement(ie.Content,{"aria-label":e.label,"cmdk-dialog":"",className:c},a.createElement(Ie,{ref:n,...d}))))}),Ye=a.forwardRef((e,n)=>$(r=>r.filtered.count===0)?a.createElement(D.Primitive.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Qe=a.forwardRef((e,n)=>{let{progress:r,children:p,label:i="Loading...",...c}=e;return a.createElement(D.Primitive.div,{ref:n,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},se(e,m=>a.createElement("div",{"aria-hidden":!0},m)))}),W=Object.assign(Ie,{List:Je,Item:We,Input:He,Group:Ge,Separator:Ue,Dialog:Xe,Empty:Ye,Loading:Qe});function Ze(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function et(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(e){let n=a.useRef(e);return T(()=>{n.current=e}),n}var T=typeof window>"u"?a.useEffect:a.useLayoutEffect;function _(e){let n=a.useRef();return n.current===void 0&&(n.current=e()),n}function $(e){let n=he(),r=()=>e(n.snapshot());return a.useSyncExternalStore(n.subscribe,r,r)}function Se(e,n,r,p=[]){let i=a.useRef(),c=te();return T(()=>{var m;let d=(()=>{var o;for(let v of r){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(o=v.current.textContent)==null?void 0:o.trim():i.current}})(),g=p.map(o=>o.trim());c.value(e,d,g),(m=n.current)==null||m.setAttribute(z,d),i.current=d}),i}var tt=()=>{let[e,n]=a.useState(),r=_(()=>new Map);return T(()=>{r.current.forEach(p=>p()),r.current=new Map},[e]),(p,i)=>{r.current.set(p,i),n({})}};function rt(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function se({asChild:e,children:n},r){return e&&a.isValidElement(n)?a.cloneElement(rt(n),{ref:n.ref},r(n.props.children)):r(n)}var nt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function at({className:e,...n}){return x.jsxRuntimeExports.jsx(W,{"data-slot":"command",className:q.cn(`
|
|
7
7
|
adm:flex adm:h-full adm:w-full adm:flex-col adm:overflow-hidden
|
|
8
8
|
adm:rounded-md adm:bg-popover adm:text-popover-foreground
|
|
9
|
-
`,e),...n})}function
|
|
9
|
+
`,e),...n})}function lt({className:e,...n}){return x.jsxRuntimeExports.jsxs("div",{"data-slot":"command-input-wrapper",className:`
|
|
10
10
|
adm:flex adm:h-9 adm:items-center adm:gap-2 adm:border-b adm:px-3
|
|
11
|
-
`,children:[
|
|
11
|
+
`,children:[x.jsxRuntimeExports.jsx(Me,{className:"adm:size-4 adm:shrink-0 adm:opacity-50"}),x.jsxRuntimeExports.jsx(W.Input,{"data-slot":"command-input",className:q.cn(`
|
|
12
12
|
adm:flex adm:h-10 adm:w-full adm:rounded-md adm:bg-transparent
|
|
13
13
|
adm:py-3 adm:text-sm adm:outline-hidden
|
|
14
14
|
adm:placeholder:text-muted-foreground
|
|
15
15
|
adm:disabled:cursor-not-allowed adm:disabled:opacity-50
|
|
16
|
-
`,e),...n})]})}function
|
|
16
|
+
`,e),...n})]})}function it({className:e,...n}){return x.jsxRuntimeExports.jsx(W.List,{"data-slot":"command-list",className:q.cn(`
|
|
17
17
|
adm:max-h-[300px] adm:scroll-py-1 adm:overflow-x-hidden
|
|
18
18
|
adm:overflow-y-auto
|
|
19
|
-
`,e),...n})}function
|
|
19
|
+
`,e),...n})}function ot({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Empty,{"data-slot":"command-empty",className:q.cn("adm:py-6 adm:text-center adm:text-sm",e),...n})}function ut({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Group,{"data-slot":"command-group",className:q.cn(`
|
|
20
20
|
adm:overflow-hidden adm:p-1 adm:text-foreground
|
|
21
21
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
|
|
22
22
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
|
|
23
23
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
|
|
24
24
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
|
|
25
25
|
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-muted-foreground
|
|
26
|
-
`,e),...n})}function
|
|
26
|
+
`,e),...n})}function st({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Item,{"data-slot":"command-item",className:q.cn(`
|
|
27
27
|
adm:relative adm:flex adm:cursor-default adm:items-center adm:gap-2
|
|
28
28
|
adm:rounded-sm adm:px-2 adm:py-1.5 adm:text-sm adm:outline-hidden
|
|
29
29
|
adm:select-none
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
|
|
35
35
|
adm:[&_svg:not([class*=size-])]:size-4
|
|
36
36
|
adm:[&_svg:not([class*=text-])]:text-muted-foreground
|
|
37
|
-
`,e),...n})}function
|
|
37
|
+
`,e),...n})}function ct({searchable:e,multiple:n,icon:r,value:p,onValueChange:i,labels:c,options:m,classNames:d,selectedFeedback:g="checkbox",alwaysShowPlaceholder:o=!1,valuePosition:v="right",renders:s}){const I=ue.useRef(null),[R,C]=ue.useState(!1),[G,M]=ue.useState(n?[]:""),y=p!==void 0?p:G,A={...{placeholder:"Select options...",searchPlaceholder:"Search options...",noItemsFound:"No options found.",multipleSelected:f=>`${f} options selected`},...c},V=f=>{i?i(f):M(f)},N=()=>n&&Array.isArray(y)?y.length===0?null:y.length===1?m.find(f=>f.value===y[0])?.label:A.multipleSelected?.(y.length)||`${y.length} options selected`:!n&&typeof y=="string"&&y?m.find(f=>f.value===y)?.label:null,j=()=>n&&Array.isArray(y)?y.length>0:typeof y=="string"&&y!=="",k=f=>n&&Array.isArray(y)?y.includes(f):y===f,U=f=>{if(n){const P=Array.isArray(y)?y:[],t=P.includes(f)?P.filter(u=>u!==f):[...P,f];V(t)}else V(f===y?"":f),C(!1)},H=f=>{const P=k(f),t=m.find(u=>u.value===f);return s?.selectedFeedback?s.selectedFeedback({option:t,isSelected:P,type:g}):g==="check"?x.jsxRuntimeExports.jsx("span",{className:q.cn(`
|
|
38
38
|
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
39
39
|
adm:justify-center
|
|
40
|
-
`,d?.check),children:P&&
|
|
40
|
+
`,d?.check),children:P&&x.jsxRuntimeExports.jsx(oe.Icon,{symbol:"check"})}):x.jsxRuntimeExports.jsx(Ae.Checkbox,{checked:P,className:d?.checkbox})},K=()=>s?.placeholder?s.placeholder({text:A.placeholder||"",hasValue:j()}):x.jsxRuntimeExports.jsx("span",{className:"adm:opacity-70",children:A.placeholder}),O=()=>s?.displayValue?s.displayValue({text:N()??null,value:y}):x.jsxRuntimeExports.jsx("span",{children:N()}),J=()=>o?x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[r&&x.jsxRuntimeExports.jsx(oe.Icon,{symbol:r,className:"adm:opacity-50"}),K(),j()&&v==="left"&&O()]}):x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[r&&x.jsxRuntimeExports.jsx(oe.Icon,{symbol:r,className:"adm:opacity-50"}),j()?O():K()]}),X=()=>s?.triggerIcon?s.triggerIcon({open:R}):x.jsxRuntimeExports.jsx(oe.Icon,{symbol:"expand_more",className:"adm:opacity-50"}),L=()=>o&&j()&&v==="right"?x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[O(),X()]}):x.jsxRuntimeExports.jsx("span",{className:"adm:flex adm:items-center adm:gap-2",children:X()}),F=()=>s?.trigger?s.trigger({open:R,value:y,displayText:N()||"",placeholder:A.placeholder||"",hasValue:j(),icon:r}):x.jsxRuntimeExports.jsxs(Ce.Button,{ref:I,variant:"outline",role:"combobox","aria-expanded":R,className:q.cn("adm:justify-between adm:font-normal",d?.trigger),children:[J(),L()]}),Y=()=>e?s?.searchInput?s.searchInput({placeholder:A.searchPlaceholder||""}):x.jsxRuntimeExports.jsx(lt,{placeholder:A.searchPlaceholder,className:d?.input}):null,Q=()=>s?.empty?s.empty({text:A.noItemsFound||""}):x.jsxRuntimeExports.jsx(x.jsxRuntimeExports.Fragment,{children:A.noItemsFound}),ne=f=>s?.optionLabel?s.optionLabel({option:f}):x.jsxRuntimeExports.jsx(x.jsxRuntimeExports.Fragment,{children:f.label}),ae=f=>s?.option?x.jsxRuntimeExports.jsx("div",{children:s.option({option:f,isSelected:k(f.value),selectedFeedback:g})},f.value):x.jsxRuntimeExports.jsxs(st,{value:f.value,onSelect:U,disabled:f.disabled,className:q.cn(d?.item,g==="check"&&"adm:pr-8"),children:[g==="checkbox"&&H(f.value),ne(f),g==="check"&&H(f.value)]},f.value);return x.jsxRuntimeExports.jsxs(ce.Popover,{open:R,onOpenChange:C,children:[x.jsxRuntimeExports.jsx(ce.PopoverTrigger,{asChild:!0,children:F()}),x.jsxRuntimeExports.jsx(ce.PopoverContent,{align:"start",className:q.cn("adm:p-0",d?.popover),style:{minWidth:I.current?.offsetWidth},children:x.jsxRuntimeExports.jsxs(at,{className:d?.command,children:[Y(),x.jsxRuntimeExports.jsxs(it,{className:d?.list,children:[x.jsxRuntimeExports.jsx(ot,{className:d?.empty,children:Q()}),x.jsxRuntimeExports.jsx(ut,{className:d?.group,children:m.map(f=>ae(f))})]})]})})]})}exports.Combobox=ct;
|
package/dist/combobox.js
CHANGED
|
@@ -3,122 +3,121 @@ import { B as je } from "./button-B7ZP4LZN.js";
|
|
|
3
3
|
import { C as Ce } from "./checkbox-DhBcmKze.js";
|
|
4
4
|
import { c as M } from "./index-CRiPKpXj.js";
|
|
5
5
|
import * as a from "react";
|
|
6
|
-
import { useRef as
|
|
7
|
-
import { R as
|
|
6
|
+
import { useRef as Re, useState as pe } from "react";
|
|
7
|
+
import { R as Ae, P as Ne, O as $e, a as Me } from "./index-DniCthJA.js";
|
|
8
8
|
import { P as F } from "./index-BMWt1NBG.js";
|
|
9
|
-
import { u as
|
|
9
|
+
import { u as _ } from "./index-Cv867SGx.js";
|
|
10
10
|
import { c as ee } from "./index-DLcqcWxM.js";
|
|
11
|
-
import { c as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { C as Oe } from "./chevron-down-CpVS2Z7w.js";
|
|
11
|
+
import { c as Le } from "./createLucideIcon-B_8CJpcQ.js";
|
|
12
|
+
import { I as oe } from "./icon-DmU_SEHC.js";
|
|
13
|
+
import { P as Pe, a as De, b as Fe } from "./popover-DAwH8jUh.js";
|
|
15
14
|
/**
|
|
16
15
|
* @license lucide-react v0.546.0 - ISC
|
|
17
16
|
*
|
|
18
17
|
* This source code is licensed under the ISC license.
|
|
19
18
|
* See the LICENSE file in the root directory of this source tree.
|
|
20
19
|
*/
|
|
21
|
-
const
|
|
20
|
+
const Oe = [
|
|
22
21
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
23
22
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
24
|
-
],
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
if (c === n.length) return o === e.length ?
|
|
23
|
+
], Ve = Le("search", Oe);
|
|
24
|
+
var he = 1, Ke = 0.9, Te = 0.8, qe = 0.17, de = 0.1, ue = 0.999, ze = 0.9999, Be = 0.99, _e = /[\\\/_+.#"@\[\(\{&]/, We = /[\\\/_+.#"@\[\(\{&]/g, Ge = /[\s-]/, be = /[\s-]/g;
|
|
25
|
+
function se(e, n, r, h, o, c, m) {
|
|
26
|
+
if (c === n.length) return o === e.length ? he : Be;
|
|
28
27
|
var s = `${o},${c}`;
|
|
29
28
|
if (m[s] !== void 0) return m[s];
|
|
30
|
-
for (var
|
|
29
|
+
for (var b = h.charAt(c), i = r.indexOf(b, o), g = 0, u, E, S, R; i >= 0; ) u = se(e, n, r, h, i + 1, c + 1, m), u > g && (i === o ? u *= he : _e.test(e.charAt(i - 1)) ? (u *= Te, S = e.slice(o, i - 1).match(We), S && o > 0 && (u *= Math.pow(ue, S.length))) : Ge.test(e.charAt(i - 1)) ? (u *= Ke, R = e.slice(o, i - 1).match(be), R && o > 0 && (u *= Math.pow(ue, R.length))) : (u *= qe, o > 0 && (u *= Math.pow(ue, i - o))), e.charAt(i) !== n.charAt(c) && (u *= ze)), (u < de && r.charAt(i - 1) === h.charAt(c + 1) || h.charAt(c + 1) === h.charAt(c) && r.charAt(i - 1) !== h.charAt(c)) && (E = se(e, n, r, h, i + 1, c + 2, m), E * de > u && (u = E * de)), u > g && (g = u), i = r.indexOf(b, i + 1);
|
|
31
30
|
return m[s] = g, g;
|
|
32
31
|
}
|
|
33
|
-
function
|
|
34
|
-
return e.toLowerCase().replace(
|
|
32
|
+
function ve(e) {
|
|
33
|
+
return e.toLowerCase().replace(be, " ");
|
|
35
34
|
}
|
|
36
|
-
function
|
|
37
|
-
return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e,
|
|
35
|
+
function Ue(e, n, r) {
|
|
36
|
+
return e = r && r.length > 0 ? `${e + " " + r.join(" ")}` : e, se(e, n, ve(e), ve(n), 0, 0, {});
|
|
38
37
|
}
|
|
39
|
-
var Z = '[cmdk-group=""]',
|
|
38
|
+
var Z = '[cmdk-group=""]', ce = '[cmdk-group-items=""]', He = '[cmdk-group-heading=""]', xe = '[cmdk-item=""]', ge = `${xe}:not([aria-disabled="true"])`, me = "cmdk-item-select", z = "data-value", Je = (e, n, r) => Ue(e, n, r), ye = a.createContext(void 0), te = () => a.useContext(ye), ke = a.createContext(void 0), fe = () => a.useContext(ke), we = a.createContext(void 0), Se = a.forwardRef((e, n) => {
|
|
40
39
|
let r = B(() => {
|
|
41
40
|
var t, d;
|
|
42
41
|
return { search: "", value: (d = (t = e.value) != null ? t : e.defaultValue) != null ? d : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
43
|
-
}), h = B(() => /* @__PURE__ */ new Set()), o = B(() => /* @__PURE__ */ new Map()), c = B(() => /* @__PURE__ */ new Map()), m = B(() => /* @__PURE__ */ new Set()), s =
|
|
44
|
-
|
|
42
|
+
}), h = B(() => /* @__PURE__ */ new Set()), o = B(() => /* @__PURE__ */ new Map()), c = B(() => /* @__PURE__ */ new Map()), m = B(() => /* @__PURE__ */ new Set()), s = Ie(e), { label: b, children: i, value: g, onValueChange: u, filter: E, shouldFilter: S, loop: R, disablePointerSelection: G = !1, vimBindings: L = !0, ...y } = e, re = _(), A = _(), T = _(), N = a.useRef(null), k = ot();
|
|
43
|
+
K(() => {
|
|
45
44
|
if (g !== void 0) {
|
|
46
45
|
let t = g.trim();
|
|
47
|
-
r.current.value = t,
|
|
46
|
+
r.current.value = t, I.emit();
|
|
48
47
|
}
|
|
49
|
-
}, [g]),
|
|
48
|
+
}, [g]), K(() => {
|
|
50
49
|
k(6, X);
|
|
51
50
|
}, []);
|
|
52
|
-
let
|
|
53
|
-
var l,
|
|
51
|
+
let I = a.useMemo(() => ({ subscribe: (t) => (m.current.add(t), () => m.current.delete(t)), snapshot: () => r.current, setState: (t, d, v) => {
|
|
52
|
+
var l, x, w, C;
|
|
54
53
|
if (!Object.is(r.current[t], d)) {
|
|
55
|
-
if (r.current[t] = d, t === "search") J(),
|
|
54
|
+
if (r.current[t] = d, t === "search") J(), q(), k(1, O);
|
|
56
55
|
else if (t === "value") {
|
|
57
56
|
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
58
|
-
let
|
|
59
|
-
|
|
57
|
+
let j = document.getElementById(T);
|
|
58
|
+
j ? j.focus() : (l = document.getElementById(re)) == null || l.focus();
|
|
60
59
|
}
|
|
61
60
|
if (k(7, () => {
|
|
62
|
-
var
|
|
63
|
-
r.current.selectedItemId = (
|
|
64
|
-
}), v || k(5, X), ((
|
|
65
|
-
let
|
|
66
|
-
(
|
|
61
|
+
var j;
|
|
62
|
+
r.current.selectedItemId = (j = P()) == null ? void 0 : j.id, I.emit();
|
|
63
|
+
}), v || k(5, X), ((x = s.current) == null ? void 0 : x.value) !== void 0) {
|
|
64
|
+
let j = d ?? "";
|
|
65
|
+
(C = (w = s.current).onValueChange) == null || C.call(w, j);
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
|
|
69
|
+
I.emit();
|
|
71
70
|
}
|
|
72
71
|
}, emit: () => {
|
|
73
72
|
m.current.forEach((t) => t());
|
|
74
73
|
} }), []), U = a.useMemo(() => ({ value: (t, d, v) => {
|
|
75
74
|
var l;
|
|
76
75
|
d !== ((l = c.current.get(t)) == null ? void 0 : l.value) && (c.current.set(t, { value: d, keywords: v }), r.current.filtered.items.set(t, H(d, v)), k(2, () => {
|
|
77
|
-
|
|
76
|
+
q(), I.emit();
|
|
78
77
|
}));
|
|
79
78
|
}, item: (t, d) => (h.current.add(t), d && (o.current.has(d) ? o.current.get(d).add(t) : o.current.set(d, /* @__PURE__ */ new Set([t]))), k(3, () => {
|
|
80
|
-
J(),
|
|
79
|
+
J(), q(), r.current.value || O(), I.emit();
|
|
81
80
|
}), () => {
|
|
82
81
|
c.current.delete(t), h.current.delete(t), r.current.filtered.items.delete(t);
|
|
83
|
-
let v =
|
|
82
|
+
let v = P();
|
|
84
83
|
k(4, () => {
|
|
85
|
-
J(), v?.getAttribute("id") === t && O(),
|
|
84
|
+
J(), v?.getAttribute("id") === t && O(), I.emit();
|
|
86
85
|
});
|
|
87
86
|
}), group: (t) => (o.current.has(t) || o.current.set(t, /* @__PURE__ */ new Set()), () => {
|
|
88
87
|
c.current.delete(t), o.current.delete(t);
|
|
89
|
-
}), filter: () => s.current.shouldFilter, label:
|
|
88
|
+
}), filter: () => s.current.shouldFilter, label: b || e["aria-label"], getDisablePointerSelection: () => s.current.disablePointerSelection, listId: re, inputId: T, labelId: A, listInnerRef: N }), []);
|
|
90
89
|
function H(t, d) {
|
|
91
90
|
var v, l;
|
|
92
|
-
let
|
|
93
|
-
return t ?
|
|
91
|
+
let x = (l = (v = s.current) == null ? void 0 : v.filter) != null ? l : Je;
|
|
92
|
+
return t ? x(t, r.current.search, d) : 0;
|
|
94
93
|
}
|
|
95
|
-
function
|
|
94
|
+
function q() {
|
|
96
95
|
if (!r.current.search || s.current.shouldFilter === !1) return;
|
|
97
96
|
let t = r.current.filtered.items, d = [];
|
|
98
97
|
r.current.filtered.groups.forEach((l) => {
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
w = Math.max(
|
|
98
|
+
let x = o.current.get(l), w = 0;
|
|
99
|
+
x.forEach((C) => {
|
|
100
|
+
let j = t.get(C);
|
|
101
|
+
w = Math.max(j, w);
|
|
103
102
|
}), d.push([l, w]);
|
|
104
103
|
});
|
|
105
104
|
let v = N.current;
|
|
106
|
-
V().sort((l,
|
|
107
|
-
var w,
|
|
108
|
-
let
|
|
109
|
-
return ((w = t.get(le)) != null ? w : 0) - ((
|
|
105
|
+
V().sort((l, x) => {
|
|
106
|
+
var w, C;
|
|
107
|
+
let j = l.getAttribute("id"), le = x.getAttribute("id");
|
|
108
|
+
return ((w = t.get(le)) != null ? w : 0) - ((C = t.get(j)) != null ? C : 0);
|
|
110
109
|
}).forEach((l) => {
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
}), d.sort((l,
|
|
114
|
-
var
|
|
115
|
-
let w = (
|
|
110
|
+
let x = l.closest(ce);
|
|
111
|
+
x ? x.appendChild(l.parentElement === x ? l : l.closest(`${ce} > *`)) : v.appendChild(l.parentElement === v ? l : l.closest(`${ce} > *`));
|
|
112
|
+
}), d.sort((l, x) => x[1] - l[1]).forEach((l) => {
|
|
113
|
+
var x;
|
|
114
|
+
let w = (x = N.current) == null ? void 0 : x.querySelector(`${Z}[${z}="${encodeURIComponent(l[0])}"]`);
|
|
116
115
|
w?.parentElement.appendChild(w);
|
|
117
116
|
});
|
|
118
117
|
}
|
|
119
118
|
function O() {
|
|
120
|
-
let t = V().find((v) => v.getAttribute("aria-disabled") !== "true"), d = t?.getAttribute(
|
|
121
|
-
|
|
119
|
+
let t = V().find((v) => v.getAttribute("aria-disabled") !== "true"), d = t?.getAttribute(z);
|
|
120
|
+
I.setState("value", d || void 0);
|
|
122
121
|
}
|
|
123
122
|
function J() {
|
|
124
123
|
var t, d, v, l;
|
|
@@ -127,43 +126,43 @@ var Z = '[cmdk-group=""]', ue = '[cmdk-group-items=""]', Je = '[cmdk-group-headi
|
|
|
127
126
|
return;
|
|
128
127
|
}
|
|
129
128
|
r.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
130
|
-
let
|
|
129
|
+
let x = 0;
|
|
131
130
|
for (let w of h.current) {
|
|
132
|
-
let
|
|
133
|
-
r.current.filtered.items.set(w, le), le > 0 &&
|
|
131
|
+
let C = (d = (t = c.current.get(w)) == null ? void 0 : t.value) != null ? d : "", j = (l = (v = c.current.get(w)) == null ? void 0 : v.keywords) != null ? l : [], le = H(C, j);
|
|
132
|
+
r.current.filtered.items.set(w, le), le > 0 && x++;
|
|
134
133
|
}
|
|
135
|
-
for (let [w,
|
|
134
|
+
for (let [w, C] of o.current) for (let j of C) if (r.current.filtered.items.get(j) > 0) {
|
|
136
135
|
r.current.filtered.groups.add(w);
|
|
137
136
|
break;
|
|
138
137
|
}
|
|
139
|
-
r.current.filtered.count =
|
|
138
|
+
r.current.filtered.count = x;
|
|
140
139
|
}
|
|
141
140
|
function X() {
|
|
142
141
|
var t, d, v;
|
|
143
|
-
let l =
|
|
144
|
-
l && (((t = l.parentElement) == null ? void 0 : t.firstChild) === l && ((v = (d = l.closest(Z)) == null ? void 0 : d.querySelector(
|
|
142
|
+
let l = P();
|
|
143
|
+
l && (((t = l.parentElement) == null ? void 0 : t.firstChild) === l && ((v = (d = l.closest(Z)) == null ? void 0 : d.querySelector(He)) == null || v.scrollIntoView({ block: "nearest" })), l.scrollIntoView({ block: "nearest" }));
|
|
145
144
|
}
|
|
146
|
-
function
|
|
145
|
+
function P() {
|
|
147
146
|
var t;
|
|
148
147
|
return (t = N.current) == null ? void 0 : t.querySelector(`${xe}[aria-selected="true"]`);
|
|
149
148
|
}
|
|
150
149
|
function V() {
|
|
151
150
|
var t;
|
|
152
|
-
return Array.from(((t = N.current) == null ? void 0 : t.querySelectorAll(
|
|
151
|
+
return Array.from(((t = N.current) == null ? void 0 : t.querySelectorAll(ge)) || []);
|
|
153
152
|
}
|
|
154
153
|
function Y(t) {
|
|
155
154
|
let d = V()[t];
|
|
156
|
-
d &&
|
|
155
|
+
d && I.setState("value", d.getAttribute(z));
|
|
157
156
|
}
|
|
158
157
|
function Q(t) {
|
|
159
158
|
var d;
|
|
160
|
-
let v =
|
|
161
|
-
(d = s.current) != null && d.loop && (w =
|
|
159
|
+
let v = P(), l = V(), x = l.findIndex((C) => C === v), w = l[x + t];
|
|
160
|
+
(d = s.current) != null && d.loop && (w = x + t < 0 ? l[l.length - 1] : x + t === l.length ? l[0] : l[x + t]), w && I.setState("value", w.getAttribute(z));
|
|
162
161
|
}
|
|
163
162
|
function ne(t) {
|
|
164
|
-
let d =
|
|
165
|
-
for (; v && !l; ) v = t > 0 ?
|
|
166
|
-
l ?
|
|
163
|
+
let d = P(), v = d?.closest(Z), l;
|
|
164
|
+
for (; v && !l; ) v = t > 0 ? at(v, Z) : lt(v, Z), l = v?.querySelector(ge);
|
|
165
|
+
l ? I.setState("value", l.getAttribute(z)) : Q(t);
|
|
167
166
|
}
|
|
168
167
|
let ae = () => Y(V().length - 1), f = (t) => {
|
|
169
168
|
t.preventDefault(), t.metaKey ? ae() : t.altKey ? ne(1) : Q(1);
|
|
@@ -203,104 +202,104 @@ var Z = '[cmdk-group=""]', ue = '[cmdk-group-items=""]', Je = '[cmdk-group-headi
|
|
|
203
202
|
}
|
|
204
203
|
case "Enter": {
|
|
205
204
|
t.preventDefault();
|
|
206
|
-
let l =
|
|
205
|
+
let l = P();
|
|
207
206
|
if (l) {
|
|
208
|
-
let
|
|
209
|
-
l.dispatchEvent(
|
|
207
|
+
let x = new Event(me);
|
|
208
|
+
l.dispatchEvent(x);
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
|
-
} }, a.createElement("label", { "cmdk-label": "", htmlFor: U.inputId, id: U.labelId, style:
|
|
214
|
-
}),
|
|
212
|
+
} }, a.createElement("label", { "cmdk-label": "", htmlFor: U.inputId, id: U.labelId, style: dt }, b), ie(e, (t) => a.createElement(ke.Provider, { value: I }, a.createElement(ye.Provider, { value: U }, t))));
|
|
213
|
+
}), Xe = a.forwardRef((e, n) => {
|
|
215
214
|
var r, h;
|
|
216
|
-
let o =
|
|
217
|
-
|
|
215
|
+
let o = _(), c = a.useRef(null), m = a.useContext(we), s = te(), b = Ie(e), i = (h = (r = b.current) == null ? void 0 : r.forceMount) != null ? h : m?.forceMount;
|
|
216
|
+
K(() => {
|
|
218
217
|
if (!i) return s.item(o, m?.id);
|
|
219
218
|
}, [i]);
|
|
220
|
-
let g = Ee(o, c, [e.value, e.children, c], e.keywords), u =
|
|
219
|
+
let g = Ee(o, c, [e.value, e.children, c], e.keywords), u = fe(), E = D((k) => k.value && k.value === g.current), S = D((k) => i || s.filter() === !1 ? !0 : k.search ? k.filtered.items.get(o) > 0 : !0);
|
|
221
220
|
a.useEffect(() => {
|
|
222
221
|
let k = c.current;
|
|
223
|
-
if (!(!k || e.disabled)) return k.addEventListener(
|
|
222
|
+
if (!(!k || e.disabled)) return k.addEventListener(me, R), () => k.removeEventListener(me, R);
|
|
224
223
|
}, [S, e.onSelect, e.disabled]);
|
|
225
224
|
function R() {
|
|
226
|
-
var k,
|
|
227
|
-
G(), (
|
|
225
|
+
var k, I;
|
|
226
|
+
G(), (I = (k = b.current).onSelect) == null || I.call(k, g.current);
|
|
228
227
|
}
|
|
229
228
|
function G() {
|
|
230
229
|
u.setState("value", g.current, !0);
|
|
231
230
|
}
|
|
232
231
|
if (!S) return null;
|
|
233
|
-
let { disabled: L, value: y, onSelect: re, forceMount: A, keywords:
|
|
234
|
-
return a.createElement(F.div, { ref: ee(c, n), ...N, id: o, "cmdk-item": "", role: "option", "aria-disabled": !!L, "aria-selected": !!
|
|
232
|
+
let { disabled: L, value: y, onSelect: re, forceMount: A, keywords: T, ...N } = e;
|
|
233
|
+
return a.createElement(F.div, { ref: ee(c, n), ...N, id: o, "cmdk-item": "", role: "option", "aria-disabled": !!L, "aria-selected": !!E, "data-disabled": !!L, "data-selected": !!E, onPointerMove: L || s.getDisablePointerSelection() ? void 0 : G, onClick: L ? void 0 : R }, e.children);
|
|
234
|
+
}), Ye = a.forwardRef((e, n) => {
|
|
235
|
+
let { heading: r, children: h, forceMount: o, ...c } = e, m = _(), s = a.useRef(null), b = a.useRef(null), i = _(), g = te(), u = D((S) => o || g.filter() === !1 ? !0 : S.search ? S.filtered.groups.has(m) : !0);
|
|
236
|
+
K(() => g.group(m), []), Ee(m, s, [e.value, e.heading, b]);
|
|
237
|
+
let E = a.useMemo(() => ({ id: m, forceMount: o }), [o]);
|
|
238
|
+
return a.createElement(F.div, { ref: ee(s, n), ...c, "cmdk-group": "", role: "presentation", hidden: u ? void 0 : !0 }, r && a.createElement("div", { ref: b, "cmdk-group-heading": "", "aria-hidden": !0, id: i }, r), ie(e, (S) => a.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? i : void 0 }, a.createElement(we.Provider, { value: E }, S))));
|
|
235
239
|
}), Qe = a.forwardRef((e, n) => {
|
|
236
|
-
let {
|
|
237
|
-
z(() => g.group(m), []), Ee(m, s, [e.value, e.heading, x]);
|
|
238
|
-
let j = a.useMemo(() => ({ id: m, forceMount: o }), [o]);
|
|
239
|
-
return a.createElement(F.div, { ref: ee(s, n), ...c, "cmdk-group": "", role: "presentation", hidden: u ? void 0 : !0 }, r && a.createElement("div", { ref: x, "cmdk-group-heading": "", "aria-hidden": !0, id: i }, r), oe(e, (S) => a.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? i : void 0 }, a.createElement(ke.Provider, { value: j }, S))));
|
|
240
|
-
}), Ze = a.forwardRef((e, n) => {
|
|
241
|
-
let { alwaysRender: r, ...h } = e, o = a.useRef(null), c = P((m) => !m.search);
|
|
240
|
+
let { alwaysRender: r, ...h } = e, o = a.useRef(null), c = D((m) => !m.search);
|
|
242
241
|
return !r && !c ? null : a.createElement(F.div, { ref: ee(o, n), ...h, "cmdk-separator": "", role: "separator" });
|
|
243
|
-
}),
|
|
244
|
-
let { onValueChange: r, ...h } = e, o = e.value != null, c =
|
|
242
|
+
}), Ze = a.forwardRef((e, n) => {
|
|
243
|
+
let { onValueChange: r, ...h } = e, o = e.value != null, c = fe(), m = D((i) => i.search), s = D((i) => i.selectedItemId), b = te();
|
|
245
244
|
return a.useEffect(() => {
|
|
246
245
|
e.value != null && c.setState("search", e.value);
|
|
247
|
-
}, [e.value]), a.createElement(F.input, { ref: n, ...h, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls":
|
|
246
|
+
}, [e.value]), a.createElement(F.input, { ref: n, ...h, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": b.listId, "aria-labelledby": b.labelId, "aria-activedescendant": s, id: b.inputId, type: "text", value: o ? e.value : m, onChange: (i) => {
|
|
248
247
|
o || c.setState("search", i.target.value), r?.(i.target.value);
|
|
249
248
|
} });
|
|
250
|
-
}),
|
|
251
|
-
let { children: r, label: h = "Suggestions", ...o } = e, c = a.useRef(null), m = a.useRef(null), s =
|
|
249
|
+
}), et = a.forwardRef((e, n) => {
|
|
250
|
+
let { children: r, label: h = "Suggestions", ...o } = e, c = a.useRef(null), m = a.useRef(null), s = D((i) => i.selectedItemId), b = te();
|
|
252
251
|
return a.useEffect(() => {
|
|
253
252
|
if (m.current && c.current) {
|
|
254
|
-
let i = m.current, g = c.current, u,
|
|
253
|
+
let i = m.current, g = c.current, u, E = new ResizeObserver(() => {
|
|
255
254
|
u = requestAnimationFrame(() => {
|
|
256
255
|
let S = i.offsetHeight;
|
|
257
256
|
g.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
|
|
258
257
|
});
|
|
259
258
|
});
|
|
260
|
-
return
|
|
261
|
-
cancelAnimationFrame(u),
|
|
259
|
+
return E.observe(i), () => {
|
|
260
|
+
cancelAnimationFrame(u), E.unobserve(i);
|
|
262
261
|
};
|
|
263
262
|
}
|
|
264
|
-
}, []), a.createElement(F.div, { ref: ee(c, n), ...o, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": s, "aria-label": h, id:
|
|
265
|
-
}),
|
|
263
|
+
}, []), a.createElement(F.div, { ref: ee(c, n), ...o, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": s, "aria-label": h, id: b.listId }, ie(e, (i) => a.createElement("div", { ref: ee(m, b.listInnerRef), "cmdk-list-sizer": "" }, i)));
|
|
264
|
+
}), tt = a.forwardRef((e, n) => {
|
|
266
265
|
let { open: r, onOpenChange: h, overlayClassName: o, contentClassName: c, container: m, ...s } = e;
|
|
267
|
-
return a.createElement(
|
|
268
|
-
}),
|
|
266
|
+
return a.createElement(Ae, { open: r, onOpenChange: h }, a.createElement(Ne, { container: m }, a.createElement($e, { "cmdk-overlay": "", className: o }), a.createElement(Me, { "aria-label": e.label, "cmdk-dialog": "", className: c }, a.createElement(Se, { ref: n, ...s }))));
|
|
267
|
+
}), rt = a.forwardRef((e, n) => D((r) => r.filtered.count === 0) ? a.createElement(F.div, { ref: n, ...e, "cmdk-empty": "", role: "presentation" }) : null), nt = a.forwardRef((e, n) => {
|
|
269
268
|
let { progress: r, children: h, label: o = "Loading...", ...c } = e;
|
|
270
|
-
return a.createElement(F.div, { ref: n, ...c, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": o },
|
|
271
|
-
}),
|
|
272
|
-
function
|
|
269
|
+
return a.createElement(F.div, { ref: n, ...c, "cmdk-loading": "", role: "progressbar", "aria-valuenow": r, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": o }, ie(e, (m) => a.createElement("div", { "aria-hidden": !0 }, m)));
|
|
270
|
+
}), W = Object.assign(Se, { List: et, Item: Xe, Input: Ze, Group: Ye, Separator: Qe, Dialog: tt, Empty: rt, Loading: nt });
|
|
271
|
+
function at(e, n) {
|
|
273
272
|
let r = e.nextElementSibling;
|
|
274
273
|
for (; r; ) {
|
|
275
274
|
if (r.matches(n)) return r;
|
|
276
275
|
r = r.nextElementSibling;
|
|
277
276
|
}
|
|
278
277
|
}
|
|
279
|
-
function
|
|
278
|
+
function lt(e, n) {
|
|
280
279
|
let r = e.previousElementSibling;
|
|
281
280
|
for (; r; ) {
|
|
282
281
|
if (r.matches(n)) return r;
|
|
283
282
|
r = r.previousElementSibling;
|
|
284
283
|
}
|
|
285
284
|
}
|
|
286
|
-
function
|
|
285
|
+
function Ie(e) {
|
|
287
286
|
let n = a.useRef(e);
|
|
288
|
-
return
|
|
287
|
+
return K(() => {
|
|
289
288
|
n.current = e;
|
|
290
289
|
}), n;
|
|
291
290
|
}
|
|
292
|
-
var
|
|
291
|
+
var K = typeof window > "u" ? a.useEffect : a.useLayoutEffect;
|
|
293
292
|
function B(e) {
|
|
294
293
|
let n = a.useRef();
|
|
295
294
|
return n.current === void 0 && (n.current = e()), n;
|
|
296
295
|
}
|
|
297
|
-
function
|
|
298
|
-
let n =
|
|
296
|
+
function D(e) {
|
|
297
|
+
let n = fe(), r = () => e(n.snapshot());
|
|
299
298
|
return a.useSyncExternalStore(n.subscribe, r, r);
|
|
300
299
|
}
|
|
301
300
|
function Ee(e, n, r, h = []) {
|
|
302
301
|
let o = a.useRef(), c = te();
|
|
303
|
-
return
|
|
302
|
+
return K(() => {
|
|
304
303
|
var m;
|
|
305
304
|
let s = (() => {
|
|
306
305
|
var i;
|
|
@@ -308,32 +307,32 @@ function Ee(e, n, r, h = []) {
|
|
|
308
307
|
if (typeof g == "string") return g.trim();
|
|
309
308
|
if (typeof g == "object" && "current" in g) return g.current ? (i = g.current.textContent) == null ? void 0 : i.trim() : o.current;
|
|
310
309
|
}
|
|
311
|
-
})(),
|
|
312
|
-
c.value(e, s,
|
|
310
|
+
})(), b = h.map((i) => i.trim());
|
|
311
|
+
c.value(e, s, b), (m = n.current) == null || m.setAttribute(z, s), o.current = s;
|
|
313
312
|
}), o;
|
|
314
313
|
}
|
|
315
|
-
var
|
|
314
|
+
var ot = () => {
|
|
316
315
|
let [e, n] = a.useState(), r = B(() => /* @__PURE__ */ new Map());
|
|
317
|
-
return
|
|
316
|
+
return K(() => {
|
|
318
317
|
r.current.forEach((h) => h()), r.current = /* @__PURE__ */ new Map();
|
|
319
318
|
}, [e]), (h, o) => {
|
|
320
319
|
r.current.set(h, o), n({});
|
|
321
320
|
};
|
|
322
321
|
};
|
|
323
|
-
function
|
|
322
|
+
function it(e) {
|
|
324
323
|
let n = e.type;
|
|
325
324
|
return typeof n == "function" ? n(e.props) : "render" in n ? n.render(e.props) : e;
|
|
326
325
|
}
|
|
327
|
-
function
|
|
328
|
-
return e && a.isValidElement(n) ? a.cloneElement(
|
|
326
|
+
function ie({ asChild: e, children: n }, r) {
|
|
327
|
+
return e && a.isValidElement(n) ? a.cloneElement(it(n), { ref: n.ref }, r(n.props.children)) : r(n);
|
|
329
328
|
}
|
|
330
|
-
var
|
|
331
|
-
function
|
|
329
|
+
var dt = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
|
|
330
|
+
function ut({
|
|
332
331
|
className: e,
|
|
333
332
|
...n
|
|
334
333
|
}) {
|
|
335
334
|
return /* @__PURE__ */ p.jsx(
|
|
336
|
-
|
|
335
|
+
W,
|
|
337
336
|
{
|
|
338
337
|
"data-slot": "command",
|
|
339
338
|
className: M(
|
|
@@ -347,7 +346,7 @@ function ct({
|
|
|
347
346
|
}
|
|
348
347
|
);
|
|
349
348
|
}
|
|
350
|
-
function
|
|
349
|
+
function ct({
|
|
351
350
|
className: e,
|
|
352
351
|
...n
|
|
353
352
|
}) {
|
|
@@ -359,9 +358,9 @@ function st({
|
|
|
359
358
|
adm:flex adm:h-9 adm:items-center adm:gap-2 adm:border-b adm:px-3
|
|
360
359
|
`,
|
|
361
360
|
children: [
|
|
362
|
-
/* @__PURE__ */ p.jsx(
|
|
361
|
+
/* @__PURE__ */ p.jsx(Ve, { className: "adm:size-4 adm:shrink-0 adm:opacity-50" }),
|
|
363
362
|
/* @__PURE__ */ p.jsx(
|
|
364
|
-
|
|
363
|
+
W.Input,
|
|
365
364
|
{
|
|
366
365
|
"data-slot": "command-input",
|
|
367
366
|
className: M(
|
|
@@ -380,12 +379,12 @@ function st({
|
|
|
380
379
|
}
|
|
381
380
|
);
|
|
382
381
|
}
|
|
383
|
-
function
|
|
382
|
+
function st({
|
|
384
383
|
className: e,
|
|
385
384
|
...n
|
|
386
385
|
}) {
|
|
387
386
|
return /* @__PURE__ */ p.jsx(
|
|
388
|
-
|
|
387
|
+
W.List,
|
|
389
388
|
{
|
|
390
389
|
"data-slot": "command-list",
|
|
391
390
|
className: M(
|
|
@@ -399,12 +398,12 @@ function mt({
|
|
|
399
398
|
}
|
|
400
399
|
);
|
|
401
400
|
}
|
|
402
|
-
function
|
|
401
|
+
function mt({
|
|
403
402
|
className: e,
|
|
404
403
|
...n
|
|
405
404
|
}) {
|
|
406
405
|
return /* @__PURE__ */ p.jsx(
|
|
407
|
-
|
|
406
|
+
W.Empty,
|
|
408
407
|
{
|
|
409
408
|
"data-slot": "command-empty",
|
|
410
409
|
className: M("adm:py-6 adm:text-center adm:text-sm", e),
|
|
@@ -412,12 +411,12 @@ function ft({
|
|
|
412
411
|
}
|
|
413
412
|
);
|
|
414
413
|
}
|
|
415
|
-
function
|
|
414
|
+
function ft({
|
|
416
415
|
className: e,
|
|
417
416
|
...n
|
|
418
417
|
}) {
|
|
419
418
|
return /* @__PURE__ */ p.jsx(
|
|
420
|
-
|
|
419
|
+
W.Group,
|
|
421
420
|
{
|
|
422
421
|
"data-slot": "command-group",
|
|
423
422
|
className: M(
|
|
@@ -435,12 +434,12 @@ function pt({
|
|
|
435
434
|
}
|
|
436
435
|
);
|
|
437
436
|
}
|
|
438
|
-
function
|
|
437
|
+
function pt({
|
|
439
438
|
className: e,
|
|
440
439
|
...n
|
|
441
440
|
}) {
|
|
442
441
|
return /* @__PURE__ */ p.jsx(
|
|
443
|
-
|
|
442
|
+
W.Item,
|
|
444
443
|
{
|
|
445
444
|
"data-slot": "command-item",
|
|
446
445
|
className: M(
|
|
@@ -462,7 +461,7 @@ function ht({
|
|
|
462
461
|
}
|
|
463
462
|
);
|
|
464
463
|
}
|
|
465
|
-
function
|
|
464
|
+
function Ct({
|
|
466
465
|
searchable: e,
|
|
467
466
|
multiple: n,
|
|
468
467
|
icon: r,
|
|
@@ -471,38 +470,38 @@ function At({
|
|
|
471
470
|
labels: c,
|
|
472
471
|
options: m,
|
|
473
472
|
classNames: s,
|
|
474
|
-
selectedFeedback:
|
|
473
|
+
selectedFeedback: b = "checkbox",
|
|
475
474
|
alwaysShowPlaceholder: i = !1,
|
|
476
475
|
valuePosition: g = "right",
|
|
477
476
|
renders: u
|
|
478
477
|
}) {
|
|
479
|
-
const
|
|
478
|
+
const E = Re(null), [S, R] = pe(!1), [G, L] = pe(n ? [] : ""), y = h !== void 0 ? h : G, A = { ...{
|
|
480
479
|
placeholder: "Select options...",
|
|
481
480
|
searchPlaceholder: "Search options...",
|
|
482
481
|
noItemsFound: "No options found.",
|
|
483
482
|
multipleSelected: (f) => `${f} options selected`
|
|
484
|
-
}, ...c },
|
|
483
|
+
}, ...c }, T = (f) => {
|
|
485
484
|
o ? o(f) : L(f);
|
|
486
|
-
}, N = () => n && Array.isArray(y) ? y.length === 0 ? null : y.length === 1 ? m.find((f) => f.value === y[0])?.label : A.multipleSelected?.(y.length) || `${y.length} options selected` : !n && typeof y == "string" && y ? m.find((f) => f.value === y)?.label : null, k = () => n && Array.isArray(y) ? y.length > 0 : typeof y == "string" && y !== "",
|
|
485
|
+
}, N = () => n && Array.isArray(y) ? y.length === 0 ? null : y.length === 1 ? m.find((f) => f.value === y[0])?.label : A.multipleSelected?.(y.length) || `${y.length} options selected` : !n && typeof y == "string" && y ? m.find((f) => f.value === y)?.label : null, k = () => n && Array.isArray(y) ? y.length > 0 : typeof y == "string" && y !== "", I = (f) => n && Array.isArray(y) ? y.includes(f) : y === f, U = (f) => {
|
|
487
486
|
if (n) {
|
|
488
487
|
const $ = Array.isArray(y) ? y : [], t = $.includes(f) ? $.filter((d) => d !== f) : [...$, f];
|
|
489
|
-
|
|
488
|
+
T(t);
|
|
490
489
|
} else
|
|
491
|
-
|
|
490
|
+
T(f === y ? "" : f), R(!1);
|
|
492
491
|
}, H = (f) => {
|
|
493
|
-
const $ =
|
|
492
|
+
const $ = I(f), t = m.find((d) => d.value === f);
|
|
494
493
|
return u?.selectedFeedback ? u.selectedFeedback({
|
|
495
494
|
option: t,
|
|
496
495
|
isSelected: $,
|
|
497
|
-
type:
|
|
498
|
-
}) :
|
|
496
|
+
type: b
|
|
497
|
+
}) : b === "check" ? /* @__PURE__ */ p.jsx(
|
|
499
498
|
"span",
|
|
500
499
|
{
|
|
501
500
|
className: M(`
|
|
502
501
|
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
503
502
|
adm:justify-center
|
|
504
503
|
`, s?.check),
|
|
505
|
-
children: $ && /* @__PURE__ */ p.jsx(
|
|
504
|
+
children: $ && /* @__PURE__ */ p.jsx(oe, { symbol: "check" })
|
|
506
505
|
}
|
|
507
506
|
) : /* @__PURE__ */ p.jsx(
|
|
508
507
|
Ce,
|
|
@@ -511,48 +510,48 @@ function At({
|
|
|
511
510
|
className: s?.checkbox
|
|
512
511
|
}
|
|
513
512
|
);
|
|
514
|
-
},
|
|
513
|
+
}, q = () => u?.placeholder ? u.placeholder({
|
|
515
514
|
text: A.placeholder || "",
|
|
516
515
|
hasValue: k()
|
|
517
516
|
}) : /* @__PURE__ */ p.jsx("span", { className: "adm:opacity-70", children: A.placeholder }), O = () => u?.displayValue ? u.displayValue({
|
|
518
517
|
text: N() ?? null,
|
|
519
518
|
value: y
|
|
520
519
|
}) : /* @__PURE__ */ p.jsx("span", { children: N() }), J = () => i ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
521
|
-
r && /* @__PURE__ */ p.jsx(
|
|
522
|
-
|
|
520
|
+
r && /* @__PURE__ */ p.jsx(oe, { symbol: r, className: "adm:opacity-50" }),
|
|
521
|
+
q(),
|
|
523
522
|
k() && g === "left" && O()
|
|
524
523
|
] }) : /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
525
|
-
r && /* @__PURE__ */ p.jsx(
|
|
526
|
-
k() ? O() :
|
|
524
|
+
r && /* @__PURE__ */ p.jsx(oe, { symbol: r, className: "adm:opacity-50" }),
|
|
525
|
+
k() ? O() : q()
|
|
527
526
|
] }), X = () => u?.triggerIcon ? u.triggerIcon({
|
|
528
527
|
open: S
|
|
529
|
-
}) : /* @__PURE__ */ p.jsx(
|
|
528
|
+
}) : /* @__PURE__ */ p.jsx(oe, { symbol: "expand_more", className: "adm:opacity-50" }), P = () => i && k() && g === "right" ? /* @__PURE__ */ p.jsxs("span", { className: "adm:flex adm:items-center adm:gap-2", children: [
|
|
530
529
|
O(),
|
|
531
530
|
X()
|
|
532
531
|
] }) : /* @__PURE__ */ p.jsx("span", { className: "adm:flex adm:items-center adm:gap-2", children: X() }), V = () => u?.trigger ? u.trigger({
|
|
533
532
|
open: S,
|
|
534
533
|
value: y,
|
|
535
|
-
displayText: N()
|
|
534
|
+
displayText: N() || "",
|
|
536
535
|
placeholder: A.placeholder || "",
|
|
537
536
|
hasValue: k(),
|
|
538
537
|
icon: r
|
|
539
538
|
}) : /* @__PURE__ */ p.jsxs(
|
|
540
539
|
je,
|
|
541
540
|
{
|
|
542
|
-
ref:
|
|
541
|
+
ref: E,
|
|
543
542
|
variant: "outline",
|
|
544
543
|
role: "combobox",
|
|
545
544
|
"aria-expanded": S,
|
|
546
545
|
className: M("adm:justify-between adm:font-normal", s?.trigger),
|
|
547
546
|
children: [
|
|
548
547
|
J(),
|
|
549
|
-
|
|
548
|
+
P()
|
|
550
549
|
]
|
|
551
550
|
}
|
|
552
551
|
), Y = () => e ? u?.searchInput ? u.searchInput({
|
|
553
552
|
placeholder: A.searchPlaceholder || ""
|
|
554
553
|
}) : /* @__PURE__ */ p.jsx(
|
|
555
|
-
|
|
554
|
+
ct,
|
|
556
555
|
{
|
|
557
556
|
placeholder: A.searchPlaceholder,
|
|
558
557
|
className: s?.input
|
|
@@ -563,39 +562,39 @@ function At({
|
|
|
563
562
|
option: f
|
|
564
563
|
}) : /* @__PURE__ */ p.jsx(p.Fragment, { children: f.label }), ae = (f) => u?.option ? /* @__PURE__ */ p.jsx("div", { children: u.option({
|
|
565
564
|
option: f,
|
|
566
|
-
isSelected:
|
|
567
|
-
selectedFeedback:
|
|
565
|
+
isSelected: I(f.value),
|
|
566
|
+
selectedFeedback: b
|
|
568
567
|
}) }, f.value) : /* @__PURE__ */ p.jsxs(
|
|
569
|
-
|
|
568
|
+
pt,
|
|
570
569
|
{
|
|
571
570
|
value: f.value,
|
|
572
571
|
onSelect: U,
|
|
573
572
|
disabled: f.disabled,
|
|
574
573
|
className: M(
|
|
575
574
|
s?.item,
|
|
576
|
-
|
|
575
|
+
b === "check" && "adm:pr-8"
|
|
577
576
|
),
|
|
578
577
|
children: [
|
|
579
|
-
|
|
578
|
+
b === "checkbox" && H(f.value),
|
|
580
579
|
ne(f),
|
|
581
|
-
|
|
580
|
+
b === "check" && H(f.value)
|
|
582
581
|
]
|
|
583
582
|
},
|
|
584
583
|
f.value
|
|
585
584
|
);
|
|
586
|
-
return /* @__PURE__ */ p.jsxs(
|
|
585
|
+
return /* @__PURE__ */ p.jsxs(Pe, { open: S, onOpenChange: R, children: [
|
|
587
586
|
/* @__PURE__ */ p.jsx(De, { asChild: !0, children: V() }),
|
|
588
587
|
/* @__PURE__ */ p.jsx(
|
|
589
|
-
|
|
588
|
+
Fe,
|
|
590
589
|
{
|
|
591
590
|
align: "start",
|
|
592
591
|
className: M("adm:p-0", s?.popover),
|
|
593
|
-
style: { minWidth:
|
|
594
|
-
children: /* @__PURE__ */ p.jsxs(
|
|
592
|
+
style: { minWidth: E.current?.offsetWidth },
|
|
593
|
+
children: /* @__PURE__ */ p.jsxs(ut, { className: s?.command, children: [
|
|
595
594
|
Y(),
|
|
596
|
-
/* @__PURE__ */ p.jsxs(
|
|
597
|
-
/* @__PURE__ */ p.jsx(
|
|
598
|
-
/* @__PURE__ */ p.jsx(
|
|
595
|
+
/* @__PURE__ */ p.jsxs(st, { className: s?.list, children: [
|
|
596
|
+
/* @__PURE__ */ p.jsx(mt, { className: s?.empty, children: Q() }),
|
|
597
|
+
/* @__PURE__ */ p.jsx(ft, { className: s?.group, children: m.map((f) => ae(f)) })
|
|
599
598
|
] })
|
|
600
599
|
] })
|
|
601
600
|
}
|
|
@@ -603,5 +602,5 @@ function At({
|
|
|
603
602
|
] });
|
|
604
603
|
}
|
|
605
604
|
export {
|
|
606
|
-
|
|
605
|
+
Ct as Combobox
|
|
607
606
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a single option in the combobox.
|
|
4
4
|
*/
|
|
@@ -54,23 +54,21 @@ type ComboboxClassNames = {
|
|
|
54
54
|
*/
|
|
55
55
|
type ComboboxRenderProps = {
|
|
56
56
|
/**
|
|
57
|
-
* Custom renderer for the
|
|
57
|
+
* Custom renderer for the trigger button component.
|
|
58
58
|
* @param props.open - Whether the popover is open
|
|
59
|
-
* @param props.value - Current
|
|
60
|
-
* @param props.displayText -
|
|
59
|
+
* @param props.value - Current value(s)
|
|
60
|
+
* @param props.displayText - Text to display in trigger
|
|
61
61
|
* @param props.placeholder - Placeholder text
|
|
62
62
|
* @param props.hasValue - Whether any value is selected
|
|
63
|
-
* @param props.icon - Optional icon
|
|
63
|
+
* @param props.icon - Optional icon symbol name
|
|
64
64
|
*/
|
|
65
65
|
trigger?: (props: {
|
|
66
66
|
open: boolean;
|
|
67
67
|
value: string | string[];
|
|
68
|
-
displayText: string
|
|
68
|
+
displayText: string;
|
|
69
69
|
placeholder: string;
|
|
70
70
|
hasValue: boolean;
|
|
71
|
-
icon?:
|
|
72
|
-
className?: string;
|
|
73
|
-
}>;
|
|
71
|
+
icon?: string;
|
|
74
72
|
}) => ReactNode;
|
|
75
73
|
/**
|
|
76
74
|
* Custom renderer for the trigger dropdown icon.
|
|
@@ -149,10 +147,8 @@ type ComboboxProps = Readonly<{
|
|
|
149
147
|
searchable?: boolean;
|
|
150
148
|
/** Allow multiple options to be selected simultaneously */
|
|
151
149
|
multiple?: boolean;
|
|
152
|
-
/** Optional icon
|
|
153
|
-
icon?:
|
|
154
|
-
className?: string;
|
|
155
|
-
}>;
|
|
150
|
+
/** Optional icon symbol name to display in the trigger */
|
|
151
|
+
icon?: string;
|
|
156
152
|
/** Controlled value for the combobox. Can be a single value or array of values for multiple selection. */
|
|
157
153
|
value?: string | string[];
|
|
158
154
|
/** Callback fired when the selected value changes */
|
|
@@ -225,5 +221,5 @@ type ComboboxProps = Readonly<{
|
|
|
225
221
|
* />
|
|
226
222
|
* ```
|
|
227
223
|
*/
|
|
228
|
-
declare function Combobox({ searchable, multiple, icon
|
|
224
|
+
declare function Combobox({ searchable, multiple, icon, value: controlledValue, onValueChange, labels, options, classNames, selectedFeedback, alwaysShowPlaceholder, valuePosition, renders, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
229
225
|
export { Combobox };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const a=require("./jsx-runtime-BB_1_6y_.cjs"),m=require("./index-DoxiiusW.cjs");function x({symbol:t,size:n="24",fill:s=0,weight:e=200,grade:i=0,opticalSize:o=24,className:c,style:r,...u}){const l={fontSize:`${n}px`,fontVariationSettings:`
|
|
2
|
+
'FILL' ${s},
|
|
3
|
+
'wght' ${e},
|
|
4
|
+
'GRAD' ${i},
|
|
5
|
+
'opsz' ${o}
|
|
6
|
+
`,...r};return a.jsxRuntimeExports.jsx("span",{className:m.cn("material-symbols-outlined",c),style:l,...u,children:t})}exports.Icon=x;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { j as l } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
+
import { c as p } from "./index-CRiPKpXj.js";
|
|
3
|
+
function x({
|
|
4
|
+
symbol: t,
|
|
5
|
+
size: o = "24",
|
|
6
|
+
fill: s = 0,
|
|
7
|
+
weight: n = 200,
|
|
8
|
+
grade: e = 0,
|
|
9
|
+
opticalSize: i = 24,
|
|
10
|
+
className: r,
|
|
11
|
+
style: a,
|
|
12
|
+
...m
|
|
13
|
+
}) {
|
|
14
|
+
const c = {
|
|
15
|
+
fontSize: `${o}px`,
|
|
16
|
+
fontVariationSettings: `
|
|
17
|
+
'FILL' ${s},
|
|
18
|
+
'wght' ${n},
|
|
19
|
+
'GRAD' ${e},
|
|
20
|
+
'opsz' ${i}
|
|
21
|
+
`,
|
|
22
|
+
...a
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ l.jsx(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
className: p("material-symbols-outlined", r),
|
|
28
|
+
style: c,
|
|
29
|
+
...m,
|
|
30
|
+
children: t
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
x as I
|
|
36
|
+
};
|
package/dist/icon.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
'FILL' ${n},
|
|
3
|
-
'wght' ${o},
|
|
4
|
-
'GRAD' ${s},
|
|
5
|
-
'opsz' ${i}
|
|
6
|
-
`,...c};return a.jsxRuntimeExports.jsx("span",{className:m.cn("material-symbols-outlined",r),style:u,...l,children:t})}exports.Icon=p;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./icon-DTx6Y_mx.cjs");exports.Icon=e.Icon;
|
package/dist/icon.js
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as p } from "./index-CRiPKpXj.js";
|
|
3
|
-
function x({
|
|
4
|
-
symbol: t,
|
|
5
|
-
size: o = "24",
|
|
6
|
-
fill: s = 0,
|
|
7
|
-
weight: n = 200,
|
|
8
|
-
grade: e = 0,
|
|
9
|
-
opticalSize: i = 24,
|
|
10
|
-
className: r,
|
|
11
|
-
style: a,
|
|
12
|
-
...m
|
|
13
|
-
}) {
|
|
14
|
-
const c = {
|
|
15
|
-
fontSize: `${o}px`,
|
|
16
|
-
fontVariationSettings: `
|
|
17
|
-
'FILL' ${s},
|
|
18
|
-
'wght' ${n},
|
|
19
|
-
'GRAD' ${e},
|
|
20
|
-
'opsz' ${i}
|
|
21
|
-
`,
|
|
22
|
-
...a
|
|
23
|
-
};
|
|
24
|
-
return /* @__PURE__ */ l.jsx(
|
|
25
|
-
"span",
|
|
26
|
-
{
|
|
27
|
-
className: p("material-symbols-outlined", r),
|
|
28
|
-
style: c,
|
|
29
|
-
...m,
|
|
30
|
-
children: t
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
}
|
|
1
|
+
import { I } from "./icon-DmU_SEHC.js";
|
|
34
2
|
export {
|
|
35
|
-
|
|
3
|
+
I as Icon
|
|
36
4
|
};
|
|
@@ -33,7 +33,7 @@ import { Combobox } from "@adamosuiteservices/ui/combobox";
|
|
|
33
33
|
| `searchable` | `boolean` | `false` | Habilita input de búsqueda |
|
|
34
34
|
| `multiple` | `boolean` | `false` | Permite selección múltiple |
|
|
35
35
|
| `selectedFeedback` | `"checkbox" \| "check"` | `"checkbox"` | Tipo de indicador visual |
|
|
36
|
-
| `icon` | `
|
|
36
|
+
| `icon` | `string` | - | Icono Material Symbol opcional para mostrar en el trigger |
|
|
37
37
|
| `alwaysShowPlaceholder` | `boolean` | `false` | Mantiene el placeholder visible junto al valor seleccionado |
|
|
38
38
|
| `valuePosition` | `"left" \| "right"` | `"right"` | Posición del valor cuando alwaysShowPlaceholder es true |
|
|
39
39
|
| `labels` | `ComboboxLabels` | - | Textos personalizables (ver tabla abajo) |
|
|
@@ -100,16 +100,16 @@ const frameworks = [
|
|
|
100
100
|
### Con Icono
|
|
101
101
|
|
|
102
102
|
```tsx
|
|
103
|
-
import { CalendarIcon } from "lucide-react";
|
|
104
|
-
|
|
105
103
|
<Combobox
|
|
106
104
|
searchable
|
|
107
|
-
icon=
|
|
105
|
+
icon="event"
|
|
108
106
|
options={frameworks}
|
|
109
107
|
labels={{ placeholder: "Select framework..." }}
|
|
110
|
-
|
|
108
|
+
/>
|
|
111
109
|
```
|
|
112
110
|
|
|
111
|
+
**Nota**: El prop `icon` acepta nombres de Material Symbols (ej: "event", "search", "person"). Ver [Material Icons](https://fonts.google.com/icons) para la lista completa.
|
|
112
|
+
|
|
113
113
|
### Placeholder Persistente
|
|
114
114
|
|
|
115
115
|
Útil para usar el placeholder como etiqueta que permanece visible.
|
|
@@ -163,7 +163,7 @@ Cuando `alwaysShowPlaceholder` es true, puedes controlar dónde aparece el valor
|
|
|
163
163
|
<Combobox
|
|
164
164
|
searchable
|
|
165
165
|
alwaysShowPlaceholder
|
|
166
|
-
icon=
|
|
166
|
+
icon="event"
|
|
167
167
|
options={frameworks}
|
|
168
168
|
value={value}
|
|
169
169
|
onValueChange={setValue}
|