@spark-ui/combobox
Advanced tools
Comparing version 5.0.6 to 5.0.7
@@ -6,2 +6,8 @@ # Change Log | ||
## [5.0.7](https://github.com/adevinta/spark/compare/v5.0.6...v5.0.7) (2024-07-26) | ||
### Bug Fixes | ||
- **combobox:** make combobox popover non clickable while closed ([b1a8d54](https://github.com/adevinta/spark/commit/b1a8d5441239e1dad4e86fe571ed08c3984563a2)) | ||
## [5.0.6](https://github.com/adevinta/spark/compare/v5.0.5...v5.0.6) (2024-07-25) | ||
@@ -8,0 +14,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { ReactNode } from 'react'; | ||
interface ItemsProps { | ||
import { ComponentPropsWithoutRef, ReactNode } from 'react'; | ||
interface ItemsProps extends ComponentPropsWithoutRef<'ul'> { | ||
children: ReactNode; | ||
@@ -4,0 +4,0 @@ className?: string; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),on=require("@spark-ui/form-field"),Ve=require("@spark-ui/popover"),A=require("downshift"),Ae=require("@spark-ui/icon"),j=require("class-variance-authority"),An=require("@spark-ui/icon-button"),Le=require("@spark-ui/use-merge-refs"),Ln=require("@spark-ui/visually-hidden"),Mn=require("@spark-ui/spinner");var at=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _t={exports:{}};(function(n,a){var o="__lodash_hash_undefined__",s=1,i=2,u=9007199254740991,p="[object Arguments]",d="[object Array]",m="[object AsyncFunction]",y="[object Boolean]",C="[object Date]",w="[object Error]",k="[object Function]",N="[object GeneratorFunction]",D="[object Map]",H="[object Number]",z="[object Null]",F="[object Object]",L="[object Promise]",te="[object Proxy]",Z="[object RegExp]",K="[object Set]",be="[object String]",le="[object Symbol]",G="[object Undefined]",ie="[object WeakMap]",R="[object ArrayBuffer]",he="[object DataView]",ye=/^\[object .+?Constructor\]$/,Me=/^(?:0|[1-9]\d*)$/,g={};g["[object Float32Array]"]=g["[object Float64Array]"]=g["[object Int8Array]"]=g["[object Int16Array]"]=g["[object Int32Array]"]=g["[object Uint8Array]"]=g["[object Uint8ClampedArray]"]=g["[object Uint16Array]"]=g["[object Uint32Array]"]=!0,g[p]=g[d]=g[R]=g[y]=g[he]=g[C]=g[w]=g[k]=g[D]=g[H]=g[F]=g[Z]=g[K]=g[be]=g[ie]=!1;var _e=typeof at=="object"&&at&&at.Object===Object&&at,De=typeof self=="object"&&self&&self.Object===Object&&self,B=_e||De||Function("return this")(),Ee=a&&!a.nodeType&&a,ge=Ee&&n&&!n.nodeType&&n,ne=ge&&ge.exports===Ee,Ne=ne&&_e.process,Fe=function(){try{return Ne&&Ne.binding&&Ne.binding("util")}catch{}}(),Be=Fe&&Fe.isTypedArray;function it(e,t){for(var l=-1,c=e==null?0:e.length;++l<c;)if(t(e[l],l,e))return!0;return!1}function ct(e){var t=-1,l=Array(e.size);return e.forEach(function(c,x){l[++t]=[x,c]}),l}function ut(e){var t=-1,l=Array(e.size);return e.forEach(function(c){l[++t]=c}),l}var $e,Oe,qe,dt=Array.prototype,mt=Function.prototype,ce=Object.prototype,ve=B["__core-js_shared__"],xe=mt.toString,$=ce.hasOwnProperty,He=($e=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||""))?"Symbol(src)_1."+$e:"",b=ce.toString,P=RegExp("^"+xe.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=ne?B.Buffer:void 0,T=B.Symbol,J=B.Uint8Array,Ke=ce.propertyIsEnumerable,pt=dt.splice,ue=T?T.toStringTag:void 0,$t=Object.getOwnPropertySymbols,xn=_?_.isBuffer:void 0,In=(Oe=Object.keys,qe=Object,function(e){return Oe(qe(e))}),ft=Ie(B,"DataView"),Se=Ie(B,"Map"),bt=Ie(B,"Promise"),ht=Ie(B,"Set"),yt=Ie(B,"WeakMap"),Te=Ie(Object,"create"),Cn=pe(ft),wn=pe(Se),_n=pe(bt),En=pe(ht),Nn=pe(yt),qt=T?T.prototype:void 0,gt=qt?qt.valueOf:void 0;function de(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function Q(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function me(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function We(e){var t=-1,l=e==null?0:e.length;for(this.__data__=new me;++t<l;)this.add(e[t])}function re(e){var t=this.__data__=new Q(e);this.size=t.size}function On(e,t){var l=Ze(e),c=!l&&Rn(e),x=!l&&!c&&vt(e),f=!l&&!c&&!x&&Xt(e),I=l||c||x||f,E=I?function(S,U){for(var X=-1,V=Array(S);++X<S;)V[X]=U(X);return V}(e.length,String):[],W=E.length;for(var O in e)!t&&!$.call(e,O)||I&&(O=="length"||x&&(O=="offset"||O=="parent")||f&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||kn(O,W))||E.push(O);return E}function Ge(e,t){for(var l=e.length;l--;)if(Ut(e[l][0],t))return l;return-1}function je(e){return e==null?e===void 0?G:z:ue&&ue in Object(e)?function(t){var l=$.call(t,ue),c=t[ue];try{t[ue]=void 0;var x=!0}catch{}var f=b.call(t);return x&&(l?t[ue]=c:delete t[ue]),f}(e):function(t){return b.call(t)}(e)}function Ht(e){return ke(e)&&je(e)==p}function Kt(e,t,l,c,x){return e===t||(e==null||t==null||!ke(e)&&!ke(t)?e!=e&&t!=t:function(f,I,E,W,O,S){var U=Ze(f),X=Ze(I),V=U?d:oe(f),Y=X?d:oe(I),Ce=(V=V==p?F:V)==F,Je=(Y=Y==p?F:Y)==F,we=V==Y;if(we&&vt(f)){if(!vt(I))return!1;U=!0,Ce=!1}if(we&&!Ce)return S||(S=new re),U||Xt(f)?Wt(f,I,E,W,O,S):function(v,h,Qe,ae,xt,q,ee){switch(Qe){case he:if(v.byteLength!=h.byteLength||v.byteOffset!=h.byteOffset)return!1;v=v.buffer,h=h.buffer;case R:return!(v.byteLength!=h.byteLength||!q(new J(v),new J(h)));case y:case C:case H:return Ut(+v,+h);case w:return v.name==h.name&&v.message==h.message;case Z:case be:return v==h+"";case D:var se=ct;case K:var Pe=ae&s;if(se||(se=ut),v.size!=h.size&&!Pe)return!1;var Xe=ee.get(v);if(Xe)return Xe==h;ae|=i,ee.set(v,h);var It=Wt(se(v),se(h),ae,xt,q,ee);return ee.delete(v),It;case le:if(gt)return gt.call(v)==gt.call(h)}return!1}(f,I,V,E,W,O,S);if(!(E&s)){var Re=Ce&&$.call(f,"__wrapped__"),Yt=Je&&$.call(I,"__wrapped__");if(Re||Yt){var zn=Re?f.value():f,Vn=Yt?I.value():I;return S||(S=new re),O(zn,Vn,E,W,S)}}return we?(S||(S=new re),function(v,h,Qe,ae,xt,q){var ee=Qe&s,se=Gt(v),Pe=se.length,Xe=Gt(h),It=Xe.length;if(Pe!=It&&!ee)return!1;for(var Ye=Pe;Ye--;){var fe=se[Ye];if(!(ee?fe in h:$.call(h,fe)))return!1}var en=q.get(v);if(en&&q.get(h))return en==h;var et=!0;q.set(v,h),q.set(h,v);for(var Ct=ee;++Ye<Pe;){var tt=v[fe=se[Ye]],nt=h[fe];if(ae)var tn=ee?ae(nt,tt,fe,h,v,q):ae(tt,nt,fe,v,h,q);if(!(tn===void 0?tt===nt||xt(tt,nt,Qe,ae,q):tn)){et=!1;break}Ct||(Ct=fe=="constructor")}if(et&&!Ct){var rt=v.constructor,ot=h.constructor;rt==ot||!("constructor"in v)||!("constructor"in h)||typeof rt=="function"&&rt instanceof rt&&typeof ot=="function"&&ot instanceof ot||(et=!1)}return q.delete(v),q.delete(h),et}(f,I,E,W,O,S)):!1}(e,t,l,c,Kt,x))}function Sn(e){return!(!Qt(e)||function(t){return!!He&&He in t}(e))&&(Zt(e)?P:ye).test(pe(e))}function Tn(e){if(l=(t=e)&&t.constructor,c=typeof l=="function"&&l.prototype||ce,t!==c)return In(e);var t,l,c,x=[];for(var f in Object(e))$.call(e,f)&&f!="constructor"&&x.push(f);return x}function Wt(e,t,l,c,x,f){var I=l&s,E=e.length,W=t.length;if(E!=W&&!(I&&W>E))return!1;var O=f.get(e);if(O&&f.get(t))return O==t;var S=-1,U=!0,X=l&i?new We:void 0;for(f.set(e,t),f.set(t,e);++S<E;){var V=e[S],Y=t[S];if(c)var Ce=I?c(Y,V,S,t,e,f):c(V,Y,S,e,t,f);if(Ce!==void 0){if(Ce)continue;U=!1;break}if(X){if(!it(t,function(Je,we){if(Re=we,!X.has(Re)&&(V===Je||x(V,Je,l,c,f)))return X.push(we);var Re})){U=!1;break}}else if(V!==Y&&!x(V,Y,l,c,f)){U=!1;break}}return f.delete(e),f.delete(t),U}function Gt(e){return function(t,l,c){var x=l(t);return Ze(t)?x:function(f,I){for(var E=-1,W=I.length,O=f.length;++E<W;)f[O+E]=I[E];return f}(x,c(t))}(e,Pn,jn)}function Ue(e,t){var l,c,x=e.__data__;return((c=typeof(l=t))=="string"||c=="number"||c=="symbol"||c=="boolean"?l!=="__proto__":l===null)?x[typeof t=="string"?"string":"hash"]:x.map}function Ie(e,t){var l=function(c,x){return c?.[x]}(e,t);return Sn(l)?l:void 0}de.prototype.clear=function(){this.__data__=Te?Te(null):{},this.size=0},de.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},de.prototype.get=function(e){var t=this.__data__;if(Te){var l=t[e];return l===o?void 0:l}return $.call(t,e)?t[e]:void 0},de.prototype.has=function(e){var t=this.__data__;return Te?t[e]!==void 0:$.call(t,e)},de.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=Te&&t===void 0?o:t,this},Q.prototype.clear=function(){this.__data__=[],this.size=0},Q.prototype.delete=function(e){var t=this.__data__,l=Ge(t,e);return!(l<0)&&(l==t.length-1?t.pop():pt.call(t,l,1),--this.size,!0)},Q.prototype.get=function(e){var t=this.__data__,l=Ge(t,e);return l<0?void 0:t[l][1]},Q.prototype.has=function(e){return Ge(this.__data__,e)>-1},Q.prototype.set=function(e,t){var l=this.__data__,c=Ge(l,e);return c<0?(++this.size,l.push([e,t])):l[c][1]=t,this},me.prototype.clear=function(){this.size=0,this.__data__={hash:new de,map:new(Se||Q),string:new de}},me.prototype.delete=function(e){var t=Ue(this,e).delete(e);return this.size-=t?1:0,t},me.prototype.get=function(e){return Ue(this,e).get(e)},me.prototype.has=function(e){return Ue(this,e).has(e)},me.prototype.set=function(e,t){var l=Ue(this,e),c=l.size;return l.set(e,t),this.size+=l.size==c?0:1,this},We.prototype.add=We.prototype.push=function(e){return this.__data__.set(e,o),this},We.prototype.has=function(e){return this.__data__.has(e)},re.prototype.clear=function(){this.__data__=new Q,this.size=0},re.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},re.prototype.get=function(e){return this.__data__.get(e)},re.prototype.has=function(e){return this.__data__.has(e)},re.prototype.set=function(e,t){var l=this.__data__;if(l instanceof Q){var c=l.__data__;if(!Se||c.length<199)return c.push([e,t]),this.size=++l.size,this;l=this.__data__=new me(c)}return l.set(e,t),this.size=l.size,this};var jn=$t?function(e){return e==null?[]:(e=Object(e),function(t,l){for(var c=-1,x=t==null?0:t.length,f=0,I=[];++c<x;){var E=t[c];l(E,c,t)&&(I[f++]=E)}return I}($t(e),function(t){return Ke.call(e,t)}))}:function(){return[]},oe=je;function kn(e,t){return!!(t=t??u)&&(typeof e=="number"||Me.test(e))&&e>-1&&e%1==0&&e<t}function pe(e){if(e!=null){try{return xe.call(e)}catch{}try{return e+""}catch{}}return""}function Ut(e,t){return e===t||e!=e&&t!=t}(ft&&oe(new ft(new ArrayBuffer(1)))!=he||Se&&oe(new Se)!=D||bt&&oe(bt.resolve())!=L||ht&&oe(new ht)!=K||yt&&oe(new yt)!=ie)&&(oe=function(e){var t=je(e),l=t==F?e.constructor:void 0,c=l?pe(l):"";if(c)switch(c){case Cn:return he;case wn:return D;case _n:return L;case En:return K;case Nn:return ie}return t});var Rn=Ht(function(){return arguments}())?Ht:function(e){return ke(e)&&$.call(e,"callee")&&!Ke.call(e,"callee")},Ze=Array.isArray,vt=xn||function(){return!1};function Zt(e){if(!Qt(e))return!1;var t=je(e);return t==k||t==N||t==m||t==te}function Jt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=u}function Qt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ke(e){return e!=null&&typeof e=="object"}var Xt=Be?function(e){return function(t){return e(t)}}(Be):function(e){return ke(e)&&Jt(e.length)&&!!g[je(e)]};function Pn(e){return(t=e)!=null&&Jt(t.length)&&!Zt(t)?On(e):Tn(e);var t}n.exports=function(e,t){return Kt(e,t)}})(_t,_t.exports);const Fn=Dn(_t.exports);function an(n,a,o){const s=n!==void 0,{current:i}=r.useRef(s?n:a),[u,p]=r.useState(a),d=s?n:u,m=r.useCallback((y,C=(w,k)=>!Fn(w,k))=>{const w=typeof y!="function"?y:y(d);C(d,w)&&!s&&p(w),o&&o(w)},[s,d,o]);return[d,m,s,i]}function sn(n,a){let o=0;for(const[s]of n.entries()){if(s===a)return o;o++}return-1}const Bn=(n,a)=>{const o=((s,i)=>{let u=0;for(const p of s.keys()){if(u===i)return p;u++}})(n,a);return o!==void 0?n.get(o):void 0},lt=n=>n?n.type.displayName:"",ln=(n,a=[])=>(r.Children.forEach(n,o=>{if(r.isValidElement(o)){if(lt(o)==="Combobox.Item"){const s=o.props;a.push({value:s.value,disabled:!!s.disabled,text:un(s.children)})}o.props.children&&ln(o.props.children,a)}}),a),cn=n=>{if(!n)return"";for(const a of r.Children.toArray(n))if(r.isValidElement(a)){const o=a;if(lt(o)==="Combobox.ItemText")return o.props.children;const s=cn(o.props.children);if(s)return s}return""},un=n=>typeof n=="string"?n:cn(n),nn=n=>{const a=new Map;return ln(n).forEach(o=>{a.set(o.value,o)}),a},dn=(n,a)=>r.Children.toArray(n).some(o=>!!r.isValidElement(o)&&(lt(o)===a||!!o.props.children&&dn(o.props.children,a))),ze=(n,a)=>r.Children.toArray(n).filter(r.isValidElement).find(o=>a===lt(o)||""),$n=({multiselect:n,selectedItems:a,allowCustomValue:o=!1,setSelectedItems:s,triggerAreaRef:i,items:u})=>(p,{changes:d,type:m})=>{const y=i.current?.contains?.(document.activeElement);switch(m){case A.useCombobox.stateChangeTypes.InputClick:return{...d,isOpen:!0};case A.useCombobox.stateChangeTypes.InputKeyDownEnter:case A.useCombobox.stateChangeTypes.ItemClick:{const C={...d};if(d.selectedItem!=null){C.inputValue="",C.isOpen=!0;const w=sn(u,d.selectedItem.value);C.highlightedIndex=w;const k=n.selectedItems.some(N=>N.value===d.selectedItem?.value)?a.filter(N=>N.value!==d.selectedItem?.value):[...a,d.selectedItem];s(k)}return C}case A.useCombobox.stateChangeTypes.ToggleButtonClick:return{...d,inputValue:o?d.inputValue:""};case A.useCombobox.stateChangeTypes.InputChange:return{...d,selectedItem:d.highlightedIndex===-1?null:d.selectedItem};case A.useCombobox.stateChangeTypes.InputBlur:return{...d,inputValue:o?d.inputValue:"",isOpen:y};default:return d}},qn=({filteredItems:n,allowCustomValue:a=!1,setSelectedItem:o})=>(s,{changes:i,type:u})=>{const p=n.find(d=>d.text.toLowerCase()===s.inputValue.toLowerCase());switch(u){case A.useCombobox.stateChangeTypes.InputKeyDownEscape:return i.selectedItem||o(null),i;case A.useCombobox.stateChangeTypes.ItemClick:case A.useCombobox.stateChangeTypes.InputKeyDownEnter:return i.selectedItem&&o(i.selectedItem),i;case A.useCombobox.stateChangeTypes.InputClick:return{...i,isOpen:!0};case A.useCombobox.stateChangeTypes.ToggleButtonClick:case A.useCombobox.stateChangeTypes.InputBlur:return a?i:s.inputValue===""?(o(null),{...i,selectedItem:null}):p?(o(p),{...i,selectedItem:p,inputValue:p.text}):s.selectedItem?{...i,inputValue:s.selectedItem.text}:{...i,inputValue:""};default:return i}},mn=r.createContext(null),wt=(n,a)=>a?new Map(Array.from(n).filter(([o,{text:s}])=>s.toLowerCase().includes(a.toLowerCase()))):n,st=":combobox",pn=({children:n,state:a,allowCustomValue:o=!1,filtering:s="auto",disabled:i=!1,multiple:u=!1,readOnly:p=!1,wrap:d=!0,value:m,defaultValue:y,onValueChange:C,open:w,defaultOpen:k,onOpenChange:N,isLoading:D})=>{const H=r.useRef(!1),[z,F]=r.useState(""),[L,te]=r.useState(s==="strict"),Z=r.useRef(null),K=r.useRef(null),[be,le]=r.useState(null),[G]=an(m,y),ie=s==="strict"||s==="auto"&&L,[R,he]=r.useState(nn(n)),[ye,Me]=r.useState(ie?wt(R,z):R),[g,_e]=r.useState(R.get(G)||null),[De,B]=r.useState(G?[...R.values()].filter(b=>G.includes(b.value)):[]),Ee=b=>{te(!1),b?.value!==g?.value&&(_e(b),setTimeout(()=>{C?.(b?.value)},0))},ge=b=>{B(b),setTimeout(()=>{C?.(b.map(P=>P.value))},0)};r.useEffect(()=>{if(H.current)if(u){const b=G.reduce((P,_)=>{const T=R.get(_);return T?[...P,T]:P},[]);B(G?b:[])}else _e(R.get(G)||null);else H.current=!0},[u?JSON.stringify(G):G]);const ne=on.useFormFieldControl(),Ne=`${st}-label-${r.useId()}`,Fe=`${st}-field-${r.useId()}`,Be=ne.id||Fe,it=ne.labelId||Ne,ct=ne.state||a,ut=ne.disabled??i,$e=ne.readOnly??p,[Oe,qe]=r.useState(dn(n,"Combobox.Popover")),[dt,mt]=r.useState("mouse");r.useEffect(()=>{Me(ie?wt(R,z):R)},[z,R]);const ce=A.useMultipleSelection({selectedItems:De,stateReducer:(b,{type:P,changes:_})=>{const T=A.useMultipleSelection.stateChangeTypes;switch(P){case T.SelectedItemKeyDownBackspace:case T.SelectedItemKeyDownDelete:{let J;return ge(_.selectedItems||[]),P===T.SelectedItemKeyDownDelete?J=b?.activeIndex===_.selectedItems?.length?-1:b.activeIndex:J=(_?.activeIndex||0)-1>=0?b.activeIndex-1:_?.activeIndex,{..._,activeIndex:J}}case T.SelectedItemClick:return K.current&&K.current.focus(),{..._,activeIndex:-1};case T.FunctionRemoveSelectedItem:return{..._,activeIndex:-1};case T.DropdownKeyDownNavigationPrevious:return xe.closeMenu(),_;default:return _}}}),ve=Array.from(ye.values());r.useEffect(()=>{be?.(z||"")},[z]);const xe=A.useCombobox({items:ve,selectedItem:u?void 0:g,id:Be,labelId:it,inputValue:z,onInputValueChange:({inputValue:b})=>{if(F(b),ie){const P=wt(R,b||"");Me(P)}},initialIsOpen:k,...w!=null&&{isOpen:w},onIsOpenChange:b=>{b.isOpen!=null&&N?.(b.isOpen)},itemToString:b=>b?.text,isItemDisabled:b=>{const P=!!z&&!ve.some(_=>b.value===_.value);return b.disabled||P},stateReducer:u?$n({multiselect:ce,selectedItems:De,allowCustomValue:o,setSelectedItems:ge,triggerAreaRef:Z,items:R}):qn({allowCustomValue:o,setSelectedItem:Ee,filteredItems:[...ye.values()]}),scrollIntoView:b=>{b&&b.scrollIntoView({block:"nearest"})}});r.useEffect(()=>{const b=nn(n),P=[...R.values()],_=[...b.values()];(P.length!==_.length||P.some((T,J)=>{const Ke=T.value!==_[J]?.value,pt=T.text!==_[J]?.text;return Ke||pt}))&&he(b)},[n]);const[$,He]=Oe?[Ve.Popover,{open:!0}]:[r.Fragment,{}];return r.createElement(mn.Provider,{value:{itemsMap:R,filteredItemsMap:ye,highlightedItem:Bn(ye,xe.highlightedIndex),multiple:u,disabled:ut,readOnly:$e,hasPopover:Oe,setHasPopover:qe,state:ct,lastInteractionType:dt,setLastInteractionType:mt,wrap:d,innerInputRef:K,triggerAreaRef:Z,...xe,...ce,setInputValue:F,selectItem:Ee,setSelectedItems:ge,isLoading:D,setOnInputValueChange:le,isTyping:L,setIsTyping:te}},r.createElement($,{...He},n))},M=()=>{const n=r.useContext(mn);if(!n)throw Error("useComboboxContext must be used within a Combobox provider");return n},fn=({children:n,...a})=>r.createElement(pn,{...a},n);fn.displayName="Combobox";const Et=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteOutline",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path fill-rule="evenodd" d="m12,4c-4.42,0-8,3.58-8,8s3.58,8,8,8,8-3.58,8-8-3.58-8-8-8ZM2,12C2,6.48,6.48,2,12,2s10,4.48,10,10-4.48,10-10,10S2,17.52,2,12Zm6.33-3.67c.39-.39,1.02-.39,1.41,0l2.23,2.23,2.23-2.23c.39-.39,1.02-.39,1.41,0,.39.39.39,1.02,0,1.41l-2.23,2.23,2.23,2.23c.39.39.39,1.02,0,1.41-.39.39-1.02.39-1.41,0l-2.23-2.23-2.23,2.23c-.39.39-1.02.39-1.41,0-.39-.39-.39-1.02,0-1.41l2.23-2.23-2.23-2.23c-.39-.39-.39-1.02,0-1.41Z"/>'}}));Et.displayName="DeleteOutline";const Nt=r.forwardRef(({className:n,tabIndex:a=-1,onClick:o,...s},i)=>{const u=M();return r.createElement("button",{ref:i,className:j.cx(n,"h-sz-44 text-neutral hover:text-neutral-hovered"),tabIndex:a,onClick:p=>{p.stopPropagation(),u.multiple?u.setSelectedItems([]):u.selectItem(null),u.setInputValue(""),u.innerInputRef.current&&u.innerInputRef.current.focus(),o&&o(p)},type:"button",...s},r.createElement(Ae.Icon,{size:"sm"},r.createElement(Et,null)))});Nt.displayName="Combobox.ClearButton";const bn=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"ArrowHorizontalDown",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path fill-rule="evenodd" d="m2.33,7.3c.43-.4,1.14-.4,1.57,0l8.1,7.48,8.1-7.48c.43-.4,1.14-.4,1.57,0,.43.4.43,1.06,0,1.47l-8.34,7.7c-.17.17-.37.3-.6.39-.23.09-.48.14-.73.14s-.5-.05-.73-.14c-.23-.09-.43-.22-.6-.39L2.33,8.77c-.43-.4-.43-1.06,0-1.47Z"/>'}}));bn.displayName="ArrowHorizontalDown";const Ot=r.forwardRef(({className:n,closedLabel:a,openedLabel:o,intent:s="neutral",design:i="ghost",size:u="sm",...p},d)=>{const m=M(),{ref:y,...C}=m.getToggleButtonProps({disabled:m.disabled||m.readOnly,onClick:N=>{N.stopPropagation()}}),w=C["aria-expanded"],k=Le.useMergeRefs(d,y);return r.createElement(An.IconButton,{ref:k,className:j.cx(n,"mt-[calc((44px-32px)/2)]"),intent:s,design:i,size:u,...C,...p,"aria-label":w?o:a,disabled:m.disabled},r.createElement(Ae.Icon,{className:j.cx("shrink-0","rotate-0 transition duration-100 ease-in",{"rotate-180":w}),size:"sm"},r.createElement(bn,null)))});Ot.displayName="Combobox.Disclosure";const St=r.forwardRef(({className:n,children:a},o)=>M().filteredItemsMap.size===0?r.createElement("div",{ref:o,className:j.cx("px-lg py-md text-body-1 text-on-surface/dim-1",n)},a):null);St.displayName="Combobox.Empty";const hn=r.createContext(null),Hn=({children:n})=>{const a=`${st}-group-label-${r.useId()}`;return r.createElement(hn.Provider,{value:{groupLabelId:a}},n)},yn=()=>{const n=r.useContext(hn);if(!n)throw Error("useComboboxGroupContext must be used within a ComboboxGroup provider");return n},Tt=r.forwardRef(({children:n,...a},o)=>r.createElement(Hn,null,r.createElement(Kn,{ref:o,...a},n))),Kn=r.forwardRef(({children:n,className:a},o)=>{const s=M(),i=yn();return r.Children.toArray(n).some(u=>r.isValidElement(u)&&s.filteredItemsMap.get(u.props.value))?r.createElement("div",{ref:o,role:"group","aria-labelledby":i.groupLabelId,className:j.cx(a)},n):null});Tt.displayName="Combobox.Group";const jt=r.forwardRef(({"aria-label":n,className:a,placeholder:o,value:s,defaultValue:i,onValueChange:u,...p},d)=>{const m=M(),[y]=an(s,i);r.useEffect(()=>{y!=null&&m.setInputValue(y)},[y]),r.useEffect(()=>{u&&m.setOnInputValueChange(()=>u),!m.multiple&&m.selectedItem&&m.setInputValue(m.selectedItem.text)},[]);const[C,w]=m.hasPopover?[Ve.Popover.Trigger,{asChild:!0,type:void 0}]:[r.Fragment,{}],k=m.getDropdownProps(),N=Le.useMergeRefs(d,m.innerInputRef,k.ref),D=m.getInputProps({disabled:m.disabled||m.readOnly,...k,onKeyDown:z=>{k.onKeyDown?.(z),m.setLastInteractionType("keyboard"),m.setIsTyping(!0)},onChange:z=>{m.setInputValue(z.target.value)},ref:N}),H=m.multiple?m.selectedItems.length===0:m.selectedItem===null;return r.createElement(r.Fragment,null,n&&r.createElement(Ln.VisuallyHidden,null,r.createElement("label",{...m.getLabelProps()},n)),r.createElement(C,{...w},r.createElement("input",{"data-spark-component":"combobox-input",type:"text",...H&&{placeholder:o},className:j.cx("max-w-full shrink-0 grow basis-[80px]","h-sz-28 text-ellipsis bg-surface px-sm text-body-1 outline-none","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-on-surface/dim-3","read-only:cursor-default read-only:bg-transparent read-only:text-on-surface",a),...p,...D,value:m.inputValue,"aria-label":n,disabled:m.disabled,readOnly:m.readOnly})))});jt.displayName="Combobox.Input";const gn=r.createContext(null),Wn=({value:n,disabled:a=!1,children:o})=>{const s=M(),[i,u]=r.useState(void 0),p=sn(s.filteredItemsMap,n),d={disabled:a,value:n,text:un(o)},m=s.multiple?s.selectedItems.some(y=>y.value===n):s.selectedItem?.value===n;return r.createElement(gn.Provider,{value:{textId:i,setTextId:u,isSelected:m,itemData:d,index:p,disabled:a}},o)},kt=()=>{const n=r.useContext(gn);if(!n)throw Error("useComboboxItemContext must be used within a ComboboxItem provider");return n},Rt=r.forwardRef(({children:n,...a},o)=>{const{value:s,disabled:i}=a;return r.createElement(Wn,{value:s,disabled:i},r.createElement(Un,{ref:o,...a},n))}),Gn=j.cva("px-lg py-md text-body-1",{variants:{selected:{true:"font-bold"},disabled:{true:"opacity-dim-3 cursor-not-allowed",false:"cursor-pointer"},highlighted:{true:""},interactionType:{mouse:"",keyboard:""}},compoundVariants:[{highlighted:!0,interactionType:"mouse",class:"bg-surface-hovered"},{highlighted:!0,interactionType:"keyboard",class:"u-ring"}]}),Un=r.forwardRef(({className:n,disabled:a=!1,value:o,children:s},i)=>{const u=M(),p=kt(),d=!!u.filteredItemsMap.get(o),{ref:m,...y}=u.getItemProps({item:p.itemData,index:p.index}),C=Le.useMergeRefs(i,m);return d?r.createElement("li",{ref:C,className:j.cx(Gn({selected:p.isSelected,disabled:a,highlighted:u.highlightedItem?.value===o,interactionType:u.lastInteractionType,className:n})),key:o,...y,"aria-selected":p.isSelected,"aria-labelledby":p.textId},s):null});Rt.displayName="Combobox.Item";const vn=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"Check",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path d="m8.92,19.08c-.18,0-.36-.03-.53-.1s-.33-.17-.47-.31l-5.49-5.34c-.28-.28-.42-.61-.42-1s.14-.73.42-1c.28-.28.62-.41,1.02-.41s.74.14,1.05.41l4.43,4.3,10.62-10.29c.28-.28.62-.42,1.02-.43.39,0,.73.13,1.02.43.28.28.42.61.42,1s-.14.73-.42,1l-11.65,11.32c-.14.14-.3.24-.47.31-.17.07-.35.1-.53.1Z"/>'}}));vn.displayName="Check";const Pt=r.forwardRef(({className:n,children:a,label:o},s)=>{const{disabled:i,isSelected:u}=kt(),p=a||r.createElement(Ae.Icon,{size:"sm"},r.createElement(vn,{"aria-label":o}));return r.createElement("span",{ref:s,className:j.cx("flex min-h-sz-16 min-w-sz-16",i&&"opacity-dim-3",n)},u&&p)});Pt.displayName="Combobox.ItemIndicator";const zt=r.forwardRef(({children:n,className:a,...o},s)=>{const i=M(),{ref:u,...p}=i.getMenuProps({onMouseMove:()=>{i.setLastInteractionType("mouse")}}),d=r.useRef(null),m=Le.useMergeRefs(s,u,d),y=!i.hasPopover||i.isOpen;return r.useLayoutEffect(()=>{i.hasPopover&&d.current?.parentElement&&(d.current.parentElement.style.pointerEvents=y?"":"none")},[y,i.hasPopover]),r.createElement("ul",{ref:m,className:j.cx(a,"flex flex-col",y?"block":"pointer-events-none invisible opacity-0",i.hasPopover&&"p-lg",i.isLoading&&"items-center overflow-y-auto"),...o,...p,"aria-busy":i.isLoading,"data-spark-component":"combobox-items"},i.isLoading?r.createElement(Mn.Spinner,{size:"sm"}):n)});zt.displayName="Combobox.Items";const Vt=r.forwardRef(({children:n,className:a},o)=>{const s=`${st}-item-text-${r.useId()}`,{setTextId:i}=kt();return r.useEffect(()=>(i(s),()=>i(void 0))),r.createElement("span",{id:s,className:j.cx("inline",a),ref:o},n)});Vt.displayName="Combobox.ItemText";const At=r.forwardRef(({children:n,className:a},o)=>{const s=yn();return r.createElement("div",{ref:o,id:s.groupLabelId,className:j.cx("px-md py-sm text-body-2 italic text-neutral",a)},n)});At.displayName="Combobox.Label";const Lt=({children:n})=>r.createElement(Ae.Icon,{size:"sm",className:"h-sz-44 shrink-0"},n);Lt.displayName="Combobox.LeadingIcon";const Mt=r.forwardRef(({children:n,matchTriggerWidth:a=!0,sideOffset:o=4,className:s,...i},u)=>{const p=M();return r.useEffect(()=>(p.setHasPopover(!0),()=>p.setHasPopover(!1)),[]),r.createElement(Ve.Popover.Content,{ref:u,inset:!0,asChild:!0,matchTriggerWidth:a,className:j.cx("relative !z-dropdown",s),sideOffset:o,onOpenAutoFocus:d=>{d.preventDefault()},...i,"data-spark-component":"combobox-popover"},n)});Mt.displayName="Combobox.Popover";const Dt=({children:n,...a})=>r.createElement(Ve.Popover.Portal,{...a},n);Dt.displayName="Combobox.Portal";const Zn=({item:n,index:a})=>{const o=M(),s=!o.disabled&&!o.readOnly,{disabled:i,...u}=o.getSelectedItemProps({disabled:o.disabled||o.readOnly,selectedItem:n,index:a}),p=i?"button":"span";return r.createElement(p,{role:"presentation","data-spark-component":"combobox-selected-item",key:`selected-item-${a}`,className:j.cx("flex h-sz-28 items-center rounded-md bg-neutral-container align-middle","text-body-2 text-on-neutral-container","disabled:cursor-not-allowed disabled:opacity-dim-3","outline-none focus-visible:u-ring-inset",{"px-md":!s,"pl-md":s}),...u,tabIndex:-1,...i&&{disabled:!0},onFocus:d=>{const m=d.target;o.lastInteractionType==="keyboard"&&m.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},r.createElement("span",{className:j.cx("line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal",{"w-max":!o.wrap})},n.text),o.disabled,s&&r.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,className:"h-full cursor-pointer px-md",onClick:d=>{d.stopPropagation();const m=o.selectedItems.filter(y=>y.value!==n.value);o.setSelectedItems(m),o.innerInputRef.current&&o.innerInputRef.current.focus({preventScroll:!0})}},r.createElement(Ae.Icon,{size:"sm"},r.createElement(Et,null))))},Ft=()=>{const n=M();return n.multiple&&n.selectedItems.length?r.createElement(r.Fragment,null,n.selectedItems.map((a,o)=>r.createElement(Zn,{key:a.value,item:a,index:o}))):null};Ft.displayName="Combobox.SelectedItems";const Jn=j.cva(["flex items-start gap-md min-h-sz-44 text-body-1","h-fit rounded-lg px-lg","ring-1 outline-none ring-inset focus-within:ring-2"],{variants:{allowWrap:{true:"",false:"h-sz-44"},state:{undefined:"ring-outline focus-within:ring-outline-high",error:"ring-error",alert:"ring-alert",success:"ring-success"},disabled:{true:"cursor-not-allowed border-outline bg-on-surface/dim-5 text-on-surface/dim-3"},readOnly:{true:"cursor-default bg-on-surface/dim-5 text-on-surface"}},compoundVariants:[{disabled:!1,state:void 0,class:"hover:ring-outline-high"},{disabled:!1,readOnly:!1,class:"bg-surface text-on-surface cursor-text"}],defaultVariants:{state:void 0,disabled:!1,readOnly:!1}}),Bt=r.forwardRef(({className:n,children:a},o)=>{const s=M(),i=on.useFormFieldControl(),u=ze(a,"Combobox.LeadingIcon"),p=ze(a,"Combobox.SelectedItems"),d=ze(a,"Combobox.Input"),m=ze(a,"Combobox.ClearButton"),y=ze(a,"Combobox.Disclosure"),[C,w]=s.hasPopover?[Ve.Popover.Anchor,{asChild:!0,type:void 0}]:[r.Fragment,{}],k=Le.useMergeRefs(o,s.triggerAreaRef),N=r.useRef(null),D=i.disabled||s.disabled,H=i.readOnly||s.readOnly,z=!!m&&!D&&!H,F=()=>{if(N.current&&!s.wrap){const{scrollWidth:L,clientWidth:te}=N.current;N.current.scrollLeft=L-te}};return((L,te)=>{const Z=r.useRef(null);r.useEffect(()=>{const K=()=>{const le=L.current?.scrollWidth||null;Z.current&&le&&le>Z.current&&te(),Z.current=le,requestAnimationFrame(K)},be=requestAnimationFrame(K);return()=>cancelAnimationFrame(be)},[L])})(N,F),r.useEffect(()=>{const L=new ResizeObserver(F);return N.current&&L.observe(N.current),()=>{L.disconnect()}},[]),r.createElement(r.Fragment,null,r.createElement(C,{...w},r.createElement("div",{ref:k,className:Jn({className:n,state:s.state,disabled:D,readOnly:H,allowWrap:s.wrap}),onClick:()=>{s.isOpen||D||H||(s.openMenu(),s.innerInputRef.current&&s.innerInputRef.current.focus())}},u,r.createElement("div",{ref:N,className:j.cx("inline-flex min-w-none grow items-start gap-sm py-md",s.wrap?"flex-wrap":"overflow-x-auto p-[2px] u-no-scrollbar")},p,d),z&&m,y)))});Bt.displayName="Combobox.Trigger";const rn=Object.assign(fn,{Group:Tt,Item:Rt,Items:zt,ItemText:Vt,ItemIndicator:Pt,Label:At,Popover:Mt,Trigger:Bt,LeadingIcon:Lt,Empty:St,Input:jt,Disclosure:Ot,SelectedItems:Ft,ClearButton:Nt,Portal:Dt});rn.displayName="Combobox",Tt.displayName="Combobox.Group",zt.displayName="Combobox.Items",Rt.displayName="Combobox.Item",Vt.displayName="Combobox.ItemText",Pt.displayName="Combobox.ItemIndicator",At.displayName="Combobox.Label",Mt.displayName="Combobox.Popover",Bt.displayName="Combobox.Trigger",Lt.displayName="Combobox.LeadingIcon",St.displayName="Combobox.Empty",jt.displayName="Combobox.Input",Ot.displayName="Combobox.Disclosure",Ft.displayName="Combobox.SelectedItems",Nt.displayName="Combobox.ClearButton",Dt.displayName="Combobox.Portal",exports.Combobox=rn,exports.ComboboxProvider=pn,exports.useComboboxContext=M; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),on=require("@spark-ui/form-field"),Ve=require("@spark-ui/popover"),A=require("downshift"),Ae=require("@spark-ui/icon"),j=require("class-variance-authority"),An=require("@spark-ui/icon-button"),Le=require("@spark-ui/use-merge-refs"),Ln=require("@spark-ui/visually-hidden"),Mn=require("@spark-ui/spinner");var at=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _t={exports:{}};(function(n,a){var o="__lodash_hash_undefined__",s=1,i=2,u=9007199254740991,p="[object Arguments]",d="[object Array]",m="[object AsyncFunction]",g="[object Boolean]",x="[object Date]",w="[object Error]",k="[object Function]",N="[object GeneratorFunction]",D="[object Map]",H="[object Number]",z="[object Null]",F="[object Object]",L="[object Promise]",te="[object Proxy]",Z="[object RegExp]",K="[object Set]",be="[object String]",le="[object Symbol]",G="[object Undefined]",ie="[object WeakMap]",R="[object ArrayBuffer]",he="[object DataView]",ye=/^\[object .+?Constructor\]$/,Me=/^(?:0|[1-9]\d*)$/,y={};y["[object Float32Array]"]=y["[object Float64Array]"]=y["[object Int8Array]"]=y["[object Int16Array]"]=y["[object Int32Array]"]=y["[object Uint8Array]"]=y["[object Uint8ClampedArray]"]=y["[object Uint16Array]"]=y["[object Uint32Array]"]=!0,y[p]=y[d]=y[R]=y[g]=y[he]=y[x]=y[w]=y[k]=y[D]=y[H]=y[F]=y[Z]=y[K]=y[be]=y[ie]=!1;var _e=typeof at=="object"&&at&&at.Object===Object&&at,De=typeof self=="object"&&self&&self.Object===Object&&self,B=_e||De||Function("return this")(),Ee=a&&!a.nodeType&&a,ge=Ee&&n&&!n.nodeType&&n,ne=ge&&ge.exports===Ee,Ne=ne&&_e.process,Fe=function(){try{return Ne&&Ne.binding&&Ne.binding("util")}catch{}}(),Be=Fe&&Fe.isTypedArray;function it(e,t){for(var l=-1,c=e==null?0:e.length;++l<c;)if(t(e[l],l,e))return!0;return!1}function ct(e){var t=-1,l=Array(e.size);return e.forEach(function(c,I){l[++t]=[I,c]}),l}function ut(e){var t=-1,l=Array(e.size);return e.forEach(function(c){l[++t]=c}),l}var $e,Oe,qe,dt=Array.prototype,mt=Function.prototype,ce=Object.prototype,ve=B["__core-js_shared__"],xe=mt.toString,$=ce.hasOwnProperty,He=($e=/[^.]+$/.exec(ve&&ve.keys&&ve.keys.IE_PROTO||""))?"Symbol(src)_1."+$e:"",b=ce.toString,P=RegExp("^"+xe.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=ne?B.Buffer:void 0,T=B.Symbol,J=B.Uint8Array,Ke=ce.propertyIsEnumerable,pt=dt.splice,ue=T?T.toStringTag:void 0,$t=Object.getOwnPropertySymbols,xn=_?_.isBuffer:void 0,In=(Oe=Object.keys,qe=Object,function(e){return Oe(qe(e))}),ft=Ie(B,"DataView"),Se=Ie(B,"Map"),bt=Ie(B,"Promise"),ht=Ie(B,"Set"),yt=Ie(B,"WeakMap"),Te=Ie(Object,"create"),Cn=pe(ft),wn=pe(Se),_n=pe(bt),En=pe(ht),Nn=pe(yt),qt=T?T.prototype:void 0,gt=qt?qt.valueOf:void 0;function de(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function Q(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function me(e){var t=-1,l=e==null?0:e.length;for(this.clear();++t<l;){var c=e[t];this.set(c[0],c[1])}}function We(e){var t=-1,l=e==null?0:e.length;for(this.__data__=new me;++t<l;)this.add(e[t])}function re(e){var t=this.__data__=new Q(e);this.size=t.size}function On(e,t){var l=Ze(e),c=!l&&Rn(e),I=!l&&!c&&vt(e),f=!l&&!c&&!I&&Xt(e),C=l||c||I||f,E=C?function(S,U){for(var X=-1,V=Array(S);++X<S;)V[X]=U(X);return V}(e.length,String):[],W=E.length;for(var O in e)!t&&!$.call(e,O)||C&&(O=="length"||I&&(O=="offset"||O=="parent")||f&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||kn(O,W))||E.push(O);return E}function Ge(e,t){for(var l=e.length;l--;)if(Ut(e[l][0],t))return l;return-1}function je(e){return e==null?e===void 0?G:z:ue&&ue in Object(e)?function(t){var l=$.call(t,ue),c=t[ue];try{t[ue]=void 0;var I=!0}catch{}var f=b.call(t);return I&&(l?t[ue]=c:delete t[ue]),f}(e):function(t){return b.call(t)}(e)}function Ht(e){return ke(e)&&je(e)==p}function Kt(e,t,l,c,I){return e===t||(e==null||t==null||!ke(e)&&!ke(t)?e!=e&&t!=t:function(f,C,E,W,O,S){var U=Ze(f),X=Ze(C),V=U?d:oe(f),Y=X?d:oe(C),Ce=(V=V==p?F:V)==F,Je=(Y=Y==p?F:Y)==F,we=V==Y;if(we&&vt(f)){if(!vt(C))return!1;U=!0,Ce=!1}if(we&&!Ce)return S||(S=new re),U||Xt(f)?Wt(f,C,E,W,O,S):function(v,h,Qe,ae,xt,q,ee){switch(Qe){case he:if(v.byteLength!=h.byteLength||v.byteOffset!=h.byteOffset)return!1;v=v.buffer,h=h.buffer;case R:return!(v.byteLength!=h.byteLength||!q(new J(v),new J(h)));case g:case x:case H:return Ut(+v,+h);case w:return v.name==h.name&&v.message==h.message;case Z:case be:return v==h+"";case D:var se=ct;case K:var Pe=ae&s;if(se||(se=ut),v.size!=h.size&&!Pe)return!1;var Xe=ee.get(v);if(Xe)return Xe==h;ae|=i,ee.set(v,h);var It=Wt(se(v),se(h),ae,xt,q,ee);return ee.delete(v),It;case le:if(gt)return gt.call(v)==gt.call(h)}return!1}(f,C,V,E,W,O,S);if(!(E&s)){var Re=Ce&&$.call(f,"__wrapped__"),Yt=Je&&$.call(C,"__wrapped__");if(Re||Yt){var zn=Re?f.value():f,Vn=Yt?C.value():C;return S||(S=new re),O(zn,Vn,E,W,S)}}return we?(S||(S=new re),function(v,h,Qe,ae,xt,q){var ee=Qe&s,se=Gt(v),Pe=se.length,Xe=Gt(h),It=Xe.length;if(Pe!=It&&!ee)return!1;for(var Ye=Pe;Ye--;){var fe=se[Ye];if(!(ee?fe in h:$.call(h,fe)))return!1}var en=q.get(v);if(en&&q.get(h))return en==h;var et=!0;q.set(v,h),q.set(h,v);for(var Ct=ee;++Ye<Pe;){var tt=v[fe=se[Ye]],nt=h[fe];if(ae)var tn=ee?ae(nt,tt,fe,h,v,q):ae(tt,nt,fe,v,h,q);if(!(tn===void 0?tt===nt||xt(tt,nt,Qe,ae,q):tn)){et=!1;break}Ct||(Ct=fe=="constructor")}if(et&&!Ct){var rt=v.constructor,ot=h.constructor;rt==ot||!("constructor"in v)||!("constructor"in h)||typeof rt=="function"&&rt instanceof rt&&typeof ot=="function"&&ot instanceof ot||(et=!1)}return q.delete(v),q.delete(h),et}(f,C,E,W,O,S)):!1}(e,t,l,c,Kt,I))}function Sn(e){return!(!Qt(e)||function(t){return!!He&&He in t}(e))&&(Zt(e)?P:ye).test(pe(e))}function Tn(e){if(l=(t=e)&&t.constructor,c=typeof l=="function"&&l.prototype||ce,t!==c)return In(e);var t,l,c,I=[];for(var f in Object(e))$.call(e,f)&&f!="constructor"&&I.push(f);return I}function Wt(e,t,l,c,I,f){var C=l&s,E=e.length,W=t.length;if(E!=W&&!(C&&W>E))return!1;var O=f.get(e);if(O&&f.get(t))return O==t;var S=-1,U=!0,X=l&i?new We:void 0;for(f.set(e,t),f.set(t,e);++S<E;){var V=e[S],Y=t[S];if(c)var Ce=C?c(Y,V,S,t,e,f):c(V,Y,S,e,t,f);if(Ce!==void 0){if(Ce)continue;U=!1;break}if(X){if(!it(t,function(Je,we){if(Re=we,!X.has(Re)&&(V===Je||I(V,Je,l,c,f)))return X.push(we);var Re})){U=!1;break}}else if(V!==Y&&!I(V,Y,l,c,f)){U=!1;break}}return f.delete(e),f.delete(t),U}function Gt(e){return function(t,l,c){var I=l(t);return Ze(t)?I:function(f,C){for(var E=-1,W=C.length,O=f.length;++E<W;)f[O+E]=C[E];return f}(I,c(t))}(e,Pn,jn)}function Ue(e,t){var l,c,I=e.__data__;return((c=typeof(l=t))=="string"||c=="number"||c=="symbol"||c=="boolean"?l!=="__proto__":l===null)?I[typeof t=="string"?"string":"hash"]:I.map}function Ie(e,t){var l=function(c,I){return c?.[I]}(e,t);return Sn(l)?l:void 0}de.prototype.clear=function(){this.__data__=Te?Te(null):{},this.size=0},de.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},de.prototype.get=function(e){var t=this.__data__;if(Te){var l=t[e];return l===o?void 0:l}return $.call(t,e)?t[e]:void 0},de.prototype.has=function(e){var t=this.__data__;return Te?t[e]!==void 0:$.call(t,e)},de.prototype.set=function(e,t){var l=this.__data__;return this.size+=this.has(e)?0:1,l[e]=Te&&t===void 0?o:t,this},Q.prototype.clear=function(){this.__data__=[],this.size=0},Q.prototype.delete=function(e){var t=this.__data__,l=Ge(t,e);return!(l<0)&&(l==t.length-1?t.pop():pt.call(t,l,1),--this.size,!0)},Q.prototype.get=function(e){var t=this.__data__,l=Ge(t,e);return l<0?void 0:t[l][1]},Q.prototype.has=function(e){return Ge(this.__data__,e)>-1},Q.prototype.set=function(e,t){var l=this.__data__,c=Ge(l,e);return c<0?(++this.size,l.push([e,t])):l[c][1]=t,this},me.prototype.clear=function(){this.size=0,this.__data__={hash:new de,map:new(Se||Q),string:new de}},me.prototype.delete=function(e){var t=Ue(this,e).delete(e);return this.size-=t?1:0,t},me.prototype.get=function(e){return Ue(this,e).get(e)},me.prototype.has=function(e){return Ue(this,e).has(e)},me.prototype.set=function(e,t){var l=Ue(this,e),c=l.size;return l.set(e,t),this.size+=l.size==c?0:1,this},We.prototype.add=We.prototype.push=function(e){return this.__data__.set(e,o),this},We.prototype.has=function(e){return this.__data__.has(e)},re.prototype.clear=function(){this.__data__=new Q,this.size=0},re.prototype.delete=function(e){var t=this.__data__,l=t.delete(e);return this.size=t.size,l},re.prototype.get=function(e){return this.__data__.get(e)},re.prototype.has=function(e){return this.__data__.has(e)},re.prototype.set=function(e,t){var l=this.__data__;if(l instanceof Q){var c=l.__data__;if(!Se||c.length<199)return c.push([e,t]),this.size=++l.size,this;l=this.__data__=new me(c)}return l.set(e,t),this.size=l.size,this};var jn=$t?function(e){return e==null?[]:(e=Object(e),function(t,l){for(var c=-1,I=t==null?0:t.length,f=0,C=[];++c<I;){var E=t[c];l(E,c,t)&&(C[f++]=E)}return C}($t(e),function(t){return Ke.call(e,t)}))}:function(){return[]},oe=je;function kn(e,t){return!!(t=t??u)&&(typeof e=="number"||Me.test(e))&&e>-1&&e%1==0&&e<t}function pe(e){if(e!=null){try{return xe.call(e)}catch{}try{return e+""}catch{}}return""}function Ut(e,t){return e===t||e!=e&&t!=t}(ft&&oe(new ft(new ArrayBuffer(1)))!=he||Se&&oe(new Se)!=D||bt&&oe(bt.resolve())!=L||ht&&oe(new ht)!=K||yt&&oe(new yt)!=ie)&&(oe=function(e){var t=je(e),l=t==F?e.constructor:void 0,c=l?pe(l):"";if(c)switch(c){case Cn:return he;case wn:return D;case _n:return L;case En:return K;case Nn:return ie}return t});var Rn=Ht(function(){return arguments}())?Ht:function(e){return ke(e)&&$.call(e,"callee")&&!Ke.call(e,"callee")},Ze=Array.isArray,vt=xn||function(){return!1};function Zt(e){if(!Qt(e))return!1;var t=je(e);return t==k||t==N||t==m||t==te}function Jt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=u}function Qt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ke(e){return e!=null&&typeof e=="object"}var Xt=Be?function(e){return function(t){return e(t)}}(Be):function(e){return ke(e)&&Jt(e.length)&&!!y[je(e)]};function Pn(e){return(t=e)!=null&&Jt(t.length)&&!Zt(t)?On(e):Tn(e);var t}n.exports=function(e,t){return Kt(e,t)}})(_t,_t.exports);const Fn=Dn(_t.exports);function an(n,a,o){const s=n!==void 0,{current:i}=r.useRef(s?n:a),[u,p]=r.useState(a),d=s?n:u,m=r.useCallback((g,x=(w,k)=>!Fn(w,k))=>{const w=typeof g!="function"?g:g(d);x(d,w)&&!s&&p(w),o&&o(w)},[s,d,o]);return[d,m,s,i]}function sn(n,a){let o=0;for(const[s]of n.entries()){if(s===a)return o;o++}return-1}const Bn=(n,a)=>{const o=((s,i)=>{let u=0;for(const p of s.keys()){if(u===i)return p;u++}})(n,a);return o!==void 0?n.get(o):void 0},lt=n=>n?n.type.displayName:"",ln=(n,a=[])=>(r.Children.forEach(n,o=>{if(r.isValidElement(o)){if(lt(o)==="Combobox.Item"){const s=o.props;a.push({value:s.value,disabled:!!s.disabled,text:un(s.children)})}o.props.children&&ln(o.props.children,a)}}),a),cn=n=>{if(!n)return"";for(const a of r.Children.toArray(n))if(r.isValidElement(a)){const o=a;if(lt(o)==="Combobox.ItemText")return o.props.children;const s=cn(o.props.children);if(s)return s}return""},un=n=>typeof n=="string"?n:cn(n),nn=n=>{const a=new Map;return ln(n).forEach(o=>{a.set(o.value,o)}),a},dn=(n,a)=>r.Children.toArray(n).some(o=>!!r.isValidElement(o)&&(lt(o)===a||!!o.props.children&&dn(o.props.children,a))),ze=(n,a)=>r.Children.toArray(n).filter(r.isValidElement).find(o=>a===lt(o)||""),$n=({multiselect:n,selectedItems:a,allowCustomValue:o=!1,setSelectedItems:s,triggerAreaRef:i,items:u})=>(p,{changes:d,type:m})=>{const g=i.current?.contains?.(document.activeElement);switch(m){case A.useCombobox.stateChangeTypes.InputClick:return{...d,isOpen:!0};case A.useCombobox.stateChangeTypes.InputKeyDownEnter:case A.useCombobox.stateChangeTypes.ItemClick:{const x={...d};if(d.selectedItem!=null){x.inputValue="",x.isOpen=!0;const w=sn(u,d.selectedItem.value);x.highlightedIndex=w;const k=n.selectedItems.some(N=>N.value===d.selectedItem?.value)?a.filter(N=>N.value!==d.selectedItem?.value):[...a,d.selectedItem];s(k)}return x}case A.useCombobox.stateChangeTypes.ToggleButtonClick:return{...d,inputValue:o?d.inputValue:""};case A.useCombobox.stateChangeTypes.InputChange:return{...d,selectedItem:d.highlightedIndex===-1?null:d.selectedItem};case A.useCombobox.stateChangeTypes.InputBlur:return{...d,inputValue:o?d.inputValue:"",isOpen:g};default:return d}},qn=({filteredItems:n,allowCustomValue:a=!1,setSelectedItem:o})=>(s,{changes:i,type:u})=>{const p=n.find(d=>d.text.toLowerCase()===s.inputValue.toLowerCase());switch(u){case A.useCombobox.stateChangeTypes.InputKeyDownEscape:return i.selectedItem||o(null),i;case A.useCombobox.stateChangeTypes.ItemClick:case A.useCombobox.stateChangeTypes.InputKeyDownEnter:return i.selectedItem&&o(i.selectedItem),i;case A.useCombobox.stateChangeTypes.InputClick:return{...i,isOpen:!0};case A.useCombobox.stateChangeTypes.ToggleButtonClick:case A.useCombobox.stateChangeTypes.InputBlur:return a?i:s.inputValue===""?(o(null),{...i,selectedItem:null}):p?(o(p),{...i,selectedItem:p,inputValue:p.text}):s.selectedItem?{...i,inputValue:s.selectedItem.text}:{...i,inputValue:""};default:return i}},mn=r.createContext(null),wt=(n,a)=>a?new Map(Array.from(n).filter(([o,{text:s}])=>s.toLowerCase().includes(a.toLowerCase()))):n,st=":combobox",pn=({children:n,state:a,allowCustomValue:o=!1,filtering:s="auto",disabled:i=!1,multiple:u=!1,readOnly:p=!1,wrap:d=!0,value:m,defaultValue:g,onValueChange:x,open:w,defaultOpen:k,onOpenChange:N,isLoading:D})=>{const H=r.useRef(!1),[z,F]=r.useState(""),[L,te]=r.useState(s==="strict"),Z=r.useRef(null),K=r.useRef(null),[be,le]=r.useState(null),[G]=an(m,g),ie=s==="strict"||s==="auto"&&L,[R,he]=r.useState(nn(n)),[ye,Me]=r.useState(ie?wt(R,z):R),[y,_e]=r.useState(R.get(G)||null),[De,B]=r.useState(G?[...R.values()].filter(b=>G.includes(b.value)):[]),Ee=b=>{te(!1),b?.value!==y?.value&&(_e(b),setTimeout(()=>{x?.(b?.value)},0))},ge=b=>{B(b),setTimeout(()=>{x?.(b.map(P=>P.value))},0)};r.useEffect(()=>{if(H.current)if(u){const b=G.reduce((P,_)=>{const T=R.get(_);return T?[...P,T]:P},[]);B(G?b:[])}else _e(R.get(G)||null);else H.current=!0},[u?JSON.stringify(G):G]);const ne=on.useFormFieldControl(),Ne=`${st}-label-${r.useId()}`,Fe=`${st}-field-${r.useId()}`,Be=ne.id||Fe,it=ne.labelId||Ne,ct=ne.state||a,ut=ne.disabled??i,$e=ne.readOnly??p,[Oe,qe]=r.useState(dn(n,"Combobox.Popover")),[dt,mt]=r.useState("mouse");r.useEffect(()=>{Me(ie?wt(R,z):R)},[z,R]);const ce=A.useMultipleSelection({selectedItems:De,stateReducer:(b,{type:P,changes:_})=>{const T=A.useMultipleSelection.stateChangeTypes;switch(P){case T.SelectedItemKeyDownBackspace:case T.SelectedItemKeyDownDelete:{let J;return ge(_.selectedItems||[]),P===T.SelectedItemKeyDownDelete?J=b?.activeIndex===_.selectedItems?.length?-1:b.activeIndex:J=(_?.activeIndex||0)-1>=0?b.activeIndex-1:_?.activeIndex,{..._,activeIndex:J}}case T.SelectedItemClick:return K.current&&K.current.focus(),{..._,activeIndex:-1};case T.FunctionRemoveSelectedItem:return{..._,activeIndex:-1};case T.DropdownKeyDownNavigationPrevious:return xe.closeMenu(),_;default:return _}}}),ve=Array.from(ye.values());r.useEffect(()=>{be?.(z||"")},[z]);const xe=A.useCombobox({items:ve,selectedItem:u?void 0:y,id:Be,labelId:it,inputValue:z,onInputValueChange:({inputValue:b})=>{if(F(b),ie){const P=wt(R,b||"");Me(P)}},initialIsOpen:k,...w!=null&&{isOpen:w},onIsOpenChange:b=>{b.isOpen!=null&&N?.(b.isOpen)},itemToString:b=>b?.text,isItemDisabled:b=>{const P=!!z&&!ve.some(_=>b.value===_.value);return b.disabled||P},stateReducer:u?$n({multiselect:ce,selectedItems:De,allowCustomValue:o,setSelectedItems:ge,triggerAreaRef:Z,items:R}):qn({allowCustomValue:o,setSelectedItem:Ee,filteredItems:[...ye.values()]}),scrollIntoView:b=>{b&&b.scrollIntoView({block:"nearest"})}});r.useEffect(()=>{const b=nn(n),P=[...R.values()],_=[...b.values()];(P.length!==_.length||P.some((T,J)=>{const Ke=T.value!==_[J]?.value,pt=T.text!==_[J]?.text;return Ke||pt}))&&he(b)},[n]);const[$,He]=Oe?[Ve.Popover,{open:!0}]:[r.Fragment,{}];return r.createElement(mn.Provider,{value:{itemsMap:R,filteredItemsMap:ye,highlightedItem:Bn(ye,xe.highlightedIndex),multiple:u,disabled:ut,readOnly:$e,hasPopover:Oe,setHasPopover:qe,state:ct,lastInteractionType:dt,setLastInteractionType:mt,wrap:d,innerInputRef:K,triggerAreaRef:Z,...xe,...ce,setInputValue:F,selectItem:Ee,setSelectedItems:ge,isLoading:D,setOnInputValueChange:le,isTyping:L,setIsTyping:te}},r.createElement($,{...He},n))},M=()=>{const n=r.useContext(mn);if(!n)throw Error("useComboboxContext must be used within a Combobox provider");return n},fn=({children:n,...a})=>r.createElement(pn,{...a},n);fn.displayName="Combobox";const Et=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteOutline",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path fill-rule="evenodd" d="m12,4c-4.42,0-8,3.58-8,8s3.58,8,8,8,8-3.58,8-8-3.58-8-8-8ZM2,12C2,6.48,6.48,2,12,2s10,4.48,10,10-4.48,10-10,10S2,17.52,2,12Zm6.33-3.67c.39-.39,1.02-.39,1.41,0l2.23,2.23,2.23-2.23c.39-.39,1.02-.39,1.41,0,.39.39.39,1.02,0,1.41l-2.23,2.23,2.23,2.23c.39.39.39,1.02,0,1.41-.39.39-1.02.39-1.41,0l-2.23-2.23-2.23,2.23c-.39.39-1.02.39-1.41,0-.39-.39-.39-1.02,0-1.41l2.23-2.23-2.23-2.23c-.39-.39-.39-1.02,0-1.41Z"/>'}}));Et.displayName="DeleteOutline";const Nt=r.forwardRef(({className:n,tabIndex:a=-1,onClick:o,...s},i)=>{const u=M();return r.createElement("button",{ref:i,className:j.cx(n,"h-sz-44 text-neutral hover:text-neutral-hovered"),tabIndex:a,onClick:p=>{p.stopPropagation(),u.multiple?u.setSelectedItems([]):u.selectItem(null),u.setInputValue(""),u.innerInputRef.current&&u.innerInputRef.current.focus(),o&&o(p)},type:"button",...s},r.createElement(Ae.Icon,{size:"sm"},r.createElement(Et,null)))});Nt.displayName="Combobox.ClearButton";const bn=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"ArrowHorizontalDown",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path fill-rule="evenodd" d="m2.33,7.3c.43-.4,1.14-.4,1.57,0l8.1,7.48,8.1-7.48c.43-.4,1.14-.4,1.57,0,.43.4.43,1.06,0,1.47l-8.34,7.7c-.17.17-.37.3-.6.39-.23.09-.48.14-.73.14s-.5-.05-.73-.14c-.23-.09-.43-.22-.6-.39L2.33,8.77c-.43-.4-.43-1.06,0-1.47Z"/>'}}));bn.displayName="ArrowHorizontalDown";const Ot=r.forwardRef(({className:n,closedLabel:a,openedLabel:o,intent:s="neutral",design:i="ghost",size:u="sm",...p},d)=>{const m=M(),{ref:g,...x}=m.getToggleButtonProps({disabled:m.disabled||m.readOnly,onClick:N=>{N.stopPropagation()}}),w=x["aria-expanded"],k=Le.useMergeRefs(d,g);return r.createElement(An.IconButton,{ref:k,className:j.cx(n,"mt-[calc((44px-32px)/2)]"),intent:s,design:i,size:u,...x,...p,"aria-label":w?o:a,disabled:m.disabled},r.createElement(Ae.Icon,{className:j.cx("shrink-0","rotate-0 transition duration-100 ease-in",{"rotate-180":w}),size:"sm"},r.createElement(bn,null)))});Ot.displayName="Combobox.Disclosure";const St=r.forwardRef(({className:n,children:a},o)=>M().filteredItemsMap.size===0?r.createElement("div",{ref:o,className:j.cx("px-lg py-md text-body-1 text-on-surface/dim-1",n)},a):null);St.displayName="Combobox.Empty";const hn=r.createContext(null),Hn=({children:n})=>{const a=`${st}-group-label-${r.useId()}`;return r.createElement(hn.Provider,{value:{groupLabelId:a}},n)},yn=()=>{const n=r.useContext(hn);if(!n)throw Error("useComboboxGroupContext must be used within a ComboboxGroup provider");return n},Tt=r.forwardRef(({children:n,...a},o)=>r.createElement(Hn,null,r.createElement(Kn,{ref:o,...a},n))),Kn=r.forwardRef(({children:n,className:a},o)=>{const s=M(),i=yn();return r.Children.toArray(n).some(u=>r.isValidElement(u)&&s.filteredItemsMap.get(u.props.value))?r.createElement("div",{ref:o,role:"group","aria-labelledby":i.groupLabelId,className:j.cx(a)},n):null});Tt.displayName="Combobox.Group";const jt=r.forwardRef(({"aria-label":n,className:a,placeholder:o,value:s,defaultValue:i,onValueChange:u,...p},d)=>{const m=M(),[g]=an(s,i);r.useEffect(()=>{g!=null&&m.setInputValue(g)},[g]),r.useEffect(()=>{u&&m.setOnInputValueChange(()=>u),!m.multiple&&m.selectedItem&&m.setInputValue(m.selectedItem.text)},[]);const[x,w]=m.hasPopover?[Ve.Popover.Trigger,{asChild:!0,type:void 0}]:[r.Fragment,{}],k=m.getDropdownProps(),N=Le.useMergeRefs(d,m.innerInputRef,k.ref),D=m.getInputProps({disabled:m.disabled||m.readOnly,...k,onKeyDown:z=>{k.onKeyDown?.(z),m.setLastInteractionType("keyboard"),m.setIsTyping(!0)},onChange:z=>{m.setInputValue(z.target.value)},ref:N}),H=m.multiple?m.selectedItems.length===0:m.selectedItem===null;return r.createElement(r.Fragment,null,n&&r.createElement(Ln.VisuallyHidden,null,r.createElement("label",{...m.getLabelProps()},n)),r.createElement(x,{...w},r.createElement("input",{"data-spark-component":"combobox-input",type:"text",...H&&{placeholder:o},className:j.cx("max-w-full shrink-0 grow basis-[80px]","h-sz-28 text-ellipsis bg-surface px-sm text-body-1 outline-none","disabled:cursor-not-allowed disabled:bg-transparent disabled:text-on-surface/dim-3","read-only:cursor-default read-only:bg-transparent read-only:text-on-surface",a),...p,...D,value:m.inputValue,"aria-label":n,disabled:m.disabled,readOnly:m.readOnly})))});jt.displayName="Combobox.Input";const gn=r.createContext(null),Wn=({value:n,disabled:a=!1,children:o})=>{const s=M(),[i,u]=r.useState(void 0),p=sn(s.filteredItemsMap,n),d={disabled:a,value:n,text:un(o)},m=s.multiple?s.selectedItems.some(g=>g.value===n):s.selectedItem?.value===n;return r.createElement(gn.Provider,{value:{textId:i,setTextId:u,isSelected:m,itemData:d,index:p,disabled:a}},o)},kt=()=>{const n=r.useContext(gn);if(!n)throw Error("useComboboxItemContext must be used within a ComboboxItem provider");return n},Rt=r.forwardRef(({children:n,...a},o)=>{const{value:s,disabled:i}=a;return r.createElement(Wn,{value:s,disabled:i},r.createElement(Un,{ref:o,...a},n))}),Gn=j.cva("px-lg py-md text-body-1",{variants:{selected:{true:"font-bold"},disabled:{true:"opacity-dim-3 cursor-not-allowed",false:"cursor-pointer"},highlighted:{true:""},interactionType:{mouse:"",keyboard:""}},compoundVariants:[{highlighted:!0,interactionType:"mouse",class:"bg-surface-hovered"},{highlighted:!0,interactionType:"keyboard",class:"u-ring"}]}),Un=r.forwardRef(({className:n,disabled:a=!1,value:o,children:s},i)=>{const u=M(),p=kt(),d=!!u.filteredItemsMap.get(o),{ref:m,...g}=u.getItemProps({item:p.itemData,index:p.index}),x=Le.useMergeRefs(i,m);return d?r.createElement("li",{ref:x,className:j.cx(Gn({selected:p.isSelected,disabled:a,highlighted:u.highlightedItem?.value===o,interactionType:u.lastInteractionType,className:n})),key:o,...g,"aria-selected":p.isSelected,"aria-labelledby":p.textId},s):null});Rt.displayName="Combobox.Item";const vn=r.forwardRef(({title:n,fill:a="currentColor",stroke:o="none",...s},i)=>r.createElement("svg",{ref:i,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"Check",...n&&{"data-title":n},fill:a,stroke:o,...s,dangerouslySetInnerHTML:{__html:(n===void 0?"":`<title>${n}</title>`)+'<path d="m8.92,19.08c-.18,0-.36-.03-.53-.1s-.33-.17-.47-.31l-5.49-5.34c-.28-.28-.42-.61-.42-1s.14-.73.42-1c.28-.28.62-.41,1.02-.41s.74.14,1.05.41l4.43,4.3,10.62-10.29c.28-.28.62-.42,1.02-.43.39,0,.73.13,1.02.43.28.28.42.61.42,1s-.14.73-.42,1l-11.65,11.32c-.14.14-.3.24-.47.31-.17.07-.35.1-.53.1Z"/>'}}));vn.displayName="Check";const Pt=r.forwardRef(({className:n,children:a,label:o},s)=>{const{disabled:i,isSelected:u}=kt(),p=a||r.createElement(Ae.Icon,{size:"sm"},r.createElement(vn,{"aria-label":o}));return r.createElement("span",{ref:s,className:j.cx("flex min-h-sz-16 min-w-sz-16",i&&"opacity-dim-3",n)},u&&p)});Pt.displayName="Combobox.ItemIndicator";const zt=r.forwardRef(({children:n,className:a,...o},s)=>{const i=M(),{ref:u,...p}=i.getMenuProps({onMouseMove:()=>{i.setLastInteractionType("mouse")}}),d=r.useRef(null),m=Le.useMergeRefs(s,u,d),g=!i.hasPopover||i.isOpen,x=i.hasPopover&&!g;return r.useLayoutEffect(()=>{d.current?.parentElement&&(d.current.parentElement.style.pointerEvents=x?"none":"",d.current.style.pointerEvents=x?"none":"")},[x]),r.createElement("ul",{ref:m,className:j.cx(a,"flex flex-col",g?"block":"pointer-events-none invisible opacity-0",i.hasPopover&&"p-lg",i.isLoading&&"items-center overflow-y-auto"),...o,...p,"aria-busy":i.isLoading,"data-spark-component":"combobox-items"},i.isLoading?r.createElement(Mn.Spinner,{size:"sm"}):n)});zt.displayName="Combobox.Items";const Vt=r.forwardRef(({children:n,className:a},o)=>{const s=`${st}-item-text-${r.useId()}`,{setTextId:i}=kt();return r.useEffect(()=>(i(s),()=>i(void 0))),r.createElement("span",{id:s,className:j.cx("inline",a),ref:o},n)});Vt.displayName="Combobox.ItemText";const At=r.forwardRef(({children:n,className:a},o)=>{const s=yn();return r.createElement("div",{ref:o,id:s.groupLabelId,className:j.cx("px-md py-sm text-body-2 italic text-neutral",a)},n)});At.displayName="Combobox.Label";const Lt=({children:n})=>r.createElement(Ae.Icon,{size:"sm",className:"h-sz-44 shrink-0"},n);Lt.displayName="Combobox.LeadingIcon";const Mt=r.forwardRef(({children:n,matchTriggerWidth:a=!0,sideOffset:o=4,className:s,...i},u)=>{const p=M();return r.useEffect(()=>(p.setHasPopover(!0),()=>p.setHasPopover(!1)),[]),r.createElement(Ve.Popover.Content,{ref:u,inset:!0,asChild:!0,matchTriggerWidth:a,className:j.cx("relative !z-dropdown",s),sideOffset:o,onOpenAutoFocus:d=>{d.preventDefault()},...i,"data-spark-component":"combobox-popover"},n)});Mt.displayName="Combobox.Popover";const Dt=({children:n,...a})=>r.createElement(Ve.Popover.Portal,{...a},n);Dt.displayName="Combobox.Portal";const Zn=({item:n,index:a})=>{const o=M(),s=!o.disabled&&!o.readOnly,{disabled:i,...u}=o.getSelectedItemProps({disabled:o.disabled||o.readOnly,selectedItem:n,index:a}),p=i?"button":"span";return r.createElement(p,{role:"presentation","data-spark-component":"combobox-selected-item",key:`selected-item-${a}`,className:j.cx("flex h-sz-28 items-center rounded-md bg-neutral-container align-middle","text-body-2 text-on-neutral-container","disabled:cursor-not-allowed disabled:opacity-dim-3","outline-none focus-visible:u-ring-inset",{"px-md":!s,"pl-md":s}),...u,tabIndex:-1,...i&&{disabled:!0},onFocus:d=>{const m=d.target;o.lastInteractionType==="keyboard"&&m.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},r.createElement("span",{className:j.cx("line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal",{"w-max":!o.wrap})},n.text),o.disabled,s&&r.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,className:"h-full cursor-pointer px-md",onClick:d=>{d.stopPropagation();const m=o.selectedItems.filter(g=>g.value!==n.value);o.setSelectedItems(m),o.innerInputRef.current&&o.innerInputRef.current.focus({preventScroll:!0})}},r.createElement(Ae.Icon,{size:"sm"},r.createElement(Et,null))))},Ft=()=>{const n=M();return n.multiple&&n.selectedItems.length?r.createElement(r.Fragment,null,n.selectedItems.map((a,o)=>r.createElement(Zn,{key:a.value,item:a,index:o}))):null};Ft.displayName="Combobox.SelectedItems";const Jn=j.cva(["flex items-start gap-md min-h-sz-44 text-body-1","h-fit rounded-lg px-lg","ring-1 outline-none ring-inset focus-within:ring-2"],{variants:{allowWrap:{true:"",false:"h-sz-44"},state:{undefined:"ring-outline focus-within:ring-outline-high",error:"ring-error",alert:"ring-alert",success:"ring-success"},disabled:{true:"cursor-not-allowed border-outline bg-on-surface/dim-5 text-on-surface/dim-3"},readOnly:{true:"cursor-default bg-on-surface/dim-5 text-on-surface"}},compoundVariants:[{disabled:!1,state:void 0,class:"hover:ring-outline-high"},{disabled:!1,readOnly:!1,class:"bg-surface text-on-surface cursor-text"}],defaultVariants:{state:void 0,disabled:!1,readOnly:!1}}),Bt=r.forwardRef(({className:n,children:a},o)=>{const s=M(),i=on.useFormFieldControl(),u=ze(a,"Combobox.LeadingIcon"),p=ze(a,"Combobox.SelectedItems"),d=ze(a,"Combobox.Input"),m=ze(a,"Combobox.ClearButton"),g=ze(a,"Combobox.Disclosure"),[x,w]=s.hasPopover?[Ve.Popover.Anchor,{asChild:!0,type:void 0}]:[r.Fragment,{}],k=Le.useMergeRefs(o,s.triggerAreaRef),N=r.useRef(null),D=i.disabled||s.disabled,H=i.readOnly||s.readOnly,z=!!m&&!D&&!H,F=()=>{if(N.current&&!s.wrap){const{scrollWidth:L,clientWidth:te}=N.current;N.current.scrollLeft=L-te}};return((L,te)=>{const Z=r.useRef(null);r.useEffect(()=>{const K=()=>{const le=L.current?.scrollWidth||null;Z.current&&le&&le>Z.current&&te(),Z.current=le,requestAnimationFrame(K)},be=requestAnimationFrame(K);return()=>cancelAnimationFrame(be)},[L])})(N,F),r.useEffect(()=>{const L=new ResizeObserver(F);return N.current&&L.observe(N.current),()=>{L.disconnect()}},[]),r.createElement(r.Fragment,null,r.createElement(x,{...w},r.createElement("div",{ref:k,className:Jn({className:n,state:s.state,disabled:D,readOnly:H,allowWrap:s.wrap}),onClick:()=>{s.isOpen||D||H||(s.openMenu(),s.innerInputRef.current&&s.innerInputRef.current.focus())}},u,r.createElement("div",{ref:N,className:j.cx("inline-flex min-w-none grow items-start gap-sm py-md",s.wrap?"flex-wrap":"overflow-x-auto p-[2px] u-no-scrollbar")},p,d),z&&m,g)))});Bt.displayName="Combobox.Trigger";const rn=Object.assign(fn,{Group:Tt,Item:Rt,Items:zt,ItemText:Vt,ItemIndicator:Pt,Label:At,Popover:Mt,Trigger:Bt,LeadingIcon:Lt,Empty:St,Input:jt,Disclosure:Ot,SelectedItems:Ft,ClearButton:Nt,Portal:Dt});rn.displayName="Combobox",Tt.displayName="Combobox.Group",zt.displayName="Combobox.Items",Rt.displayName="Combobox.Item",Vt.displayName="Combobox.ItemText",Pt.displayName="Combobox.ItemIndicator",At.displayName="Combobox.Label",Mt.displayName="Combobox.Popover",Bt.displayName="Combobox.Trigger",Lt.displayName="Combobox.LeadingIcon",St.displayName="Combobox.Empty",jt.displayName="Combobox.Input",Ot.displayName="Combobox.Disclosure",Ft.displayName="Combobox.SelectedItems",Nt.displayName="Combobox.ClearButton",Dt.displayName="Combobox.Portal",exports.Combobox=rn,exports.ComboboxProvider=pn,exports.useComboboxContext=M; |
{ | ||
"name": "@spark-ui/combobox", | ||
"version": "5.0.6", | ||
"version": "5.0.7", | ||
"description": "An input that behaves similarly to a select, with the addition of a free text input to filter options.", | ||
@@ -31,13 +31,13 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@spark-ui/dialog": "^5.0.6" | ||
"@spark-ui/dialog": "^5.0.7" | ||
}, | ||
"dependencies": { | ||
"@spark-ui/form-field": "^5.0.6", | ||
"@spark-ui/icon": "^5.0.6", | ||
"@spark-ui/icon-button": "^5.0.6", | ||
"@spark-ui/icons": "^5.0.6", | ||
"@spark-ui/popover": "^5.0.6", | ||
"@spark-ui/spinner": "^5.0.6", | ||
"@spark-ui/use-merge-refs": "^5.0.6", | ||
"@spark-ui/visually-hidden": "^5.0.6", | ||
"@spark-ui/form-field": "^5.0.7", | ||
"@spark-ui/icon": "^5.0.7", | ||
"@spark-ui/icon-button": "^5.0.7", | ||
"@spark-ui/icons": "^5.0.7", | ||
"@spark-ui/popover": "^5.0.7", | ||
"@spark-ui/spinner": "^5.0.7", | ||
"@spark-ui/use-merge-refs": "^5.0.7", | ||
"@spark-ui/visually-hidden": "^5.0.7", | ||
"class-variance-authority": "0.7.0", | ||
@@ -60,3 +60,3 @@ "downshift": "9.0.4" | ||
"license": "MIT", | ||
"gitHead": "8e0732cc7f88600c99675d86d7a400c7d83618fb" | ||
"gitHead": "95ce1a5a790396afb12ac37bbbf173ff3728d2d0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
533706
Updated@spark-ui/form-field@^5.0.7
Updated@spark-ui/icon@^5.0.7
Updated@spark-ui/icon-button@^5.0.7
Updated@spark-ui/icons@^5.0.7
Updated@spark-ui/popover@^5.0.7
Updated@spark-ui/spinner@^5.0.7