@spark-ui/combobox
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -6,2 +6,9 @@ # Change Log | ||
# [0.9.0](https://github.com/adevinta/spark/compare/@spark-ui/combobox@0.8.0...@spark-ui/combobox@0.9.0) (2024-03-19) | ||
### Features | ||
- **combobox:** isLoading ([1700ee9](https://github.com/adevinta/spark/commit/1700ee9404c8e1d8462c3f4a77950a3a12e35f42)) | ||
- **combobox:** missed dependency ([ae4a0a9](https://github.com/adevinta/spark/commit/ae4a0a9c7b667d3adb21c570574803446b3309d7)) | ||
# [0.8.0](https://github.com/adevinta/spark/compare/@spark-ui/combobox@0.7.1...@spark-ui/combobox@0.8.0) (2024-03-15) | ||
@@ -8,0 +15,0 @@ |
@@ -18,2 +18,3 @@ import { Dispatch, PropsWithChildren, SetStateAction } from 'react'; | ||
triggerAreaRef: React.RefObject<HTMLDivElement>; | ||
isLoading?: boolean; | ||
} | ||
@@ -58,2 +59,6 @@ export type ComboboxContextCommonProps = PropsWithChildren<{ | ||
wrap?: boolean; | ||
/** | ||
* Display a spinner to indicate to the user that the combobox is loading results for . | ||
*/ | ||
isLoading?: boolean; | ||
}>; | ||
@@ -97,4 +102,4 @@ interface ComboboxPropsSingle { | ||
export type ComboboxContextProps = ComboboxContextCommonProps & (ComboboxPropsSingle | ComboboxPropsMultiple); | ||
export declare const ComboboxProvider: ({ children, state: stateProp, allowCustomValue, autoFilter, disabled: disabledProp, multiple, readOnly: readOnlyProp, wrap, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen, onOpenChange, }: ComboboxContextProps) => import("react").JSX.Element; | ||
export declare const ComboboxProvider: ({ children, state: stateProp, allowCustomValue, autoFilter, disabled: disabledProp, multiple, readOnly: readOnlyProp, wrap, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen, onOpenChange, isLoading, }: ComboboxContextProps) => import("react").JSX.Element; | ||
export declare const useComboboxContext: () => ComboboxContextState; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),lt=require("@radix-ui/react-id"),nr=require("@spark-ui/form-field"),it=require("@spark-ui/popover"),D=require("downshift"),ge=require("@spark-ui/icon"),k=require("class-variance-authority"),zr=require("@spark-ui/icon-button"),ze=require("@spark-ui/use-merge-refs"),Pr=require("@spark-ui/visually-hidden");var st=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ar(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ct={exports:{}};(function(r,a){var o="__lodash_hash_undefined__",l=1,u=2,i=9007199254740991,d="[object Arguments]",y="[object Array]",C="[object AsyncFunction]",w="[object Boolean]",j="[object Date]",T="[object Error]",K="[object Function]",V="[object GeneratorFunction]",$="[object Map]",L="[object Number]",pe="[object Null]",M="[object Object]",z="[object Promise]",P="[object Proxy]",E="[object RegExp]",U="[object Set]",J="[object String]",te="[object Symbol]",ut="[object Undefined]",fe="[object WeakMap]",xe="[object ArrayBuffer]",se="[object DataView]",Pe=/^\[object .+?Constructor\]$/,Ie=/^(?:0|[1-9]\d*)$/,f={};f["[object Float32Array]"]=f["[object Float64Array]"]=f["[object Int8Array]"]=f["[object Int16Array]"]=f["[object Int32Array]"]=f["[object Uint8Array]"]=f["[object Uint8ClampedArray]"]=f["[object Uint16Array]"]=f["[object Uint32Array]"]=!0,f[d]=f[y]=f[xe]=f[w]=f[se]=f[j]=f[T]=f[K]=f[$]=f[L]=f[M]=f[E]=f[U]=f[J]=f[fe]=!1;var Ae=typeof st=="object"&&st&&st.Object===Object&&st,dt=typeof self=="object"&&self&&self.Object===Object&&self,H=Ae||dt||Function("return this")(),Ve=a&&!a.nodeType&&a,De=Ve&&r&&!r.nodeType&&r,Ce=De&&De.exports===Ve,we=Ce&&Ae.process,Le=function(){try{return we&&we.binding&&we.binding("util")}catch{}}(),Me=Le&&Le.isTypedArray;function Fe(e,t){for(var s=-1,c=e==null?0:e.length;++s<c;)if(t(e[s],s,e))return!0;return!1}function Be(e){var t=-1,s=Array(e.size);return e.forEach(function(c,v){s[++t]=[v,c]}),s}function _e(e){var t=-1,s=Array(e.size);return e.forEach(function(c){s[++t]=c}),s}var qe,$e,p,N=Array.prototype,g=Function.prototype,x=Object.prototype,F=H["__core-js_shared__"],be=g.toString,A=x.hasOwnProperty,le=(qe=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+qe:"",He=x.toString,Ee=RegExp("^"+be.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),We=Ce?H.Buffer:void 0,Z=H.Symbol,Ke=H.Uint8Array,Ft=x.propertyIsEnumerable,hr=N.splice,ie=Z?Z.toStringTag:void 0,Bt=Object.getOwnPropertySymbols,yr=We?We.isBuffer:void 0,vr=($e=Object.keys,p=Object,function(e){return $e(p(e))}),mt=he(H,"DataView"),Ne=he(H,"Map"),pt=he(H,"Promise"),ft=he(H,"Set"),bt=he(H,"WeakMap"),Oe=he(Object,"create"),gr=de(mt),xr=de(Ne),Ir=de(pt),Cr=de(ft),wr=de(bt),qt=Z?Z.prototype:void 0,ht=qt?qt.valueOf:void 0;function ce(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var c=e[t];this.set(c[0],c[1])}}function Q(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var c=e[t];this.set(c[0],c[1])}}function ue(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var c=e[t];this.set(c[0],c[1])}}function Ze(e){var t=-1,s=e==null?0:e.length;for(this.__data__=new ue;++t<s;)this.add(e[t])}function re(e){var t=this.__data__=new Q(e);this.size=t.size}function _r(e,t){var s=Je(e),c=!s&&jr(e),v=!s&&!c&&yt(e),m=!s&&!c&&!v&&Qt(e),I=s||c||v||m,_=I?function(S,G){for(var X=-1,R=Array(S);++X<S;)R[X]=G(X);return R}(e.length,String):[],W=_.length;for(var O in e)!t&&!A.call(e,O)||I&&(O=="length"||v&&(O=="offset"||O=="parent")||m&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Sr(O,W))||_.push(O);return _}function Ge(e,t){for(var s=e.length;s--;)if(Zt(e[s][0],t))return s;return-1}function Se(e){return e==null?e===void 0?ut:pe:ie&&ie in Object(e)?function(t){var s=A.call(t,ie),c=t[ie];try{t[ie]=void 0;var v=!0}catch{}var m=He.call(t);return v&&(s?t[ie]=c:delete t[ie]),m}(e):function(t){return He.call(t)}(e)}function $t(e){return je(e)&&Se(e)==d}function Ht(e,t,s,c,v){return e===t||(e==null||t==null||!je(e)&&!je(t)?e!=e&&t!=t:function(m,I,_,W,O,S){var G=Je(m),X=Je(I),R=G?y:ne(m),Y=X?y:ne(I),ye=(R=R==d?M:R)==M,Qe=(Y=Y==d?M:Y)==M,ve=R==Y;if(ve&&yt(m)){if(!yt(I))return!1;G=!0,ye=!1}if(ve&&!ye)return S||(S=new re),G||Qt(m)?Wt(m,I,_,W,O,S):function(h,b,Xe,oe,vt,B,ee){switch(Xe){case se:if(h.byteLength!=b.byteLength||h.byteOffset!=b.byteOffset)return!1;h=h.buffer,b=b.buffer;case xe:return!(h.byteLength!=b.byteLength||!B(new Ke(h),new Ke(b)));case w:case j:case L:return Zt(+h,+b);case T:return h.name==b.name&&h.message==b.message;case E:case J:return h==b+"";case $:var ae=Be;case U:var ke=oe&l;if(ae||(ae=_e),h.size!=b.size&&!ke)return!1;var Ye=ee.get(h);if(Ye)return Ye==b;oe|=u,ee.set(h,b);var gt=Wt(ae(h),ae(b),oe,vt,B,ee);return ee.delete(h),gt;case te:if(ht)return ht.call(h)==ht.call(b)}return!1}(m,I,R,_,W,O,S);if(!(_&l)){var Te=ye&&A.call(m,"__wrapped__"),Xt=Qe&&A.call(I,"__wrapped__");if(Te||Xt){var kr=Te?m.value():m,Rr=Xt?I.value():I;return S||(S=new re),O(kr,Rr,_,W,S)}}return ve?(S||(S=new re),function(h,b,Xe,oe,vt,B){var ee=Xe&l,ae=Kt(h),ke=ae.length,Ye=Kt(b),gt=Ye.length;if(ke!=gt&&!ee)return!1;for(var et=ke;et--;){var me=ae[et];if(!(ee?me in b:A.call(b,me)))return!1}var Yt=B.get(h);if(Yt&&B.get(b))return Yt==b;var tt=!0;B.set(h,b),B.set(b,h);for(var xt=ee;++et<ke;){var rt=h[me=ae[et]],nt=b[me];if(oe)var er=ee?oe(nt,rt,me,b,h,B):oe(rt,nt,me,h,b,B);if(!(er===void 0?rt===nt||vt(rt,nt,Xe,oe,B):er)){tt=!1;break}xt||(xt=me=="constructor")}if(tt&&!xt){var ot=h.constructor,at=b.constructor;ot==at||!("constructor"in h)||!("constructor"in b)||typeof ot=="function"&&ot instanceof ot&&typeof at=="function"&&at instanceof at||(tt=!1)}return B.delete(h),B.delete(b),tt}(m,I,_,W,O,S)):!1}(e,t,s,c,Ht,v))}function Er(e){return!(!Jt(e)||function(t){return!!le&&le in t}(e))&&(Gt(e)?Ee:Pe).test(de(e))}function Nr(e){if(s=(t=e)&&t.constructor,c=typeof s=="function"&&s.prototype||x,t!==c)return vr(e);var t,s,c,v=[];for(var m in Object(e))A.call(e,m)&&m!="constructor"&&v.push(m);return v}function Wt(e,t,s,c,v,m){var I=s&l,_=e.length,W=t.length;if(_!=W&&!(I&&W>_))return!1;var O=m.get(e);if(O&&m.get(t))return O==t;var S=-1,G=!0,X=s&u?new Ze:void 0;for(m.set(e,t),m.set(t,e);++S<_;){var R=e[S],Y=t[S];if(c)var ye=I?c(Y,R,S,t,e,m):c(R,Y,S,e,t,m);if(ye!==void 0){if(ye)continue;G=!1;break}if(X){if(!Fe(t,function(Qe,ve){if(Te=ve,!X.has(Te)&&(R===Qe||v(R,Qe,s,c,m)))return X.push(ve);var Te})){G=!1;break}}else if(R!==Y&&!v(R,Y,s,c,m)){G=!1;break}}return m.delete(e),m.delete(t),G}function Kt(e){return function(t,s,c){var v=s(t);return Je(t)?v:function(m,I){for(var _=-1,W=I.length,O=m.length;++_<W;)m[O+_]=I[_];return m}(v,c(t))}(e,Tr,Or)}function Ue(e,t){var s,c,v=e.__data__;return((c=typeof(s=t))=="string"||c=="number"||c=="symbol"||c=="boolean"?s!=="__proto__":s===null)?v[typeof t=="string"?"string":"hash"]:v.map}function he(e,t){var s=function(c,v){return c?.[v]}(e,t);return Er(s)?s:void 0}ce.prototype.clear=function(){this.__data__=Oe?Oe(null):{},this.size=0},ce.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ce.prototype.get=function(e){var t=this.__data__;if(Oe){var s=t[e];return s===o?void 0:s}return A.call(t,e)?t[e]:void 0},ce.prototype.has=function(e){var t=this.__data__;return Oe?t[e]!==void 0:A.call(t,e)},ce.prototype.set=function(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Oe&&t===void 0?o:t,this},Q.prototype.clear=function(){this.__data__=[],this.size=0},Q.prototype.delete=function(e){var t=this.__data__,s=Ge(t,e);return!(s<0)&&(s==t.length-1?t.pop():hr.call(t,s,1),--this.size,!0)},Q.prototype.get=function(e){var t=this.__data__,s=Ge(t,e);return s<0?void 0:t[s][1]},Q.prototype.has=function(e){return Ge(this.__data__,e)>-1},Q.prototype.set=function(e,t){var s=this.__data__,c=Ge(s,e);return c<0?(++this.size,s.push([e,t])):s[c][1]=t,this},ue.prototype.clear=function(){this.size=0,this.__data__={hash:new ce,map:new(Ne||Q),string:new ce}},ue.prototype.delete=function(e){var t=Ue(this,e).delete(e);return this.size-=t?1:0,t},ue.prototype.get=function(e){return Ue(this,e).get(e)},ue.prototype.has=function(e){return Ue(this,e).has(e)},ue.prototype.set=function(e,t){var s=Ue(this,e),c=s.size;return s.set(e,t),this.size+=s.size==c?0:1,this},Ze.prototype.add=Ze.prototype.push=function(e){return this.__data__.set(e,o),this},Ze.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__,s=t.delete(e);return this.size=t.size,s},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 s=this.__data__;if(s instanceof Q){var c=s.__data__;if(!Ne||c.length<199)return c.push([e,t]),this.size=++s.size,this;s=this.__data__=new ue(c)}return s.set(e,t),this.size=s.size,this};var Or=Bt?function(e){return e==null?[]:(e=Object(e),function(t,s){for(var c=-1,v=t==null?0:t.length,m=0,I=[];++c<v;){var _=t[c];s(_,c,t)&&(I[m++]=_)}return I}(Bt(e),function(t){return Ft.call(e,t)}))}:function(){return[]},ne=Se;function Sr(e,t){return!!(t=t??i)&&(typeof e=="number"||Ie.test(e))&&e>-1&&e%1==0&&e<t}function de(e){if(e!=null){try{return be.call(e)}catch{}try{return e+""}catch{}}return""}function Zt(e,t){return e===t||e!=e&&t!=t}(mt&&ne(new mt(new ArrayBuffer(1)))!=se||Ne&&ne(new Ne)!=$||pt&&ne(pt.resolve())!=z||ft&&ne(new ft)!=U||bt&&ne(new bt)!=fe)&&(ne=function(e){var t=Se(e),s=t==M?e.constructor:void 0,c=s?de(s):"";if(c)switch(c){case gr:return se;case xr:return $;case Ir:return z;case Cr:return U;case wr:return fe}return t});var jr=$t(function(){return arguments}())?$t:function(e){return je(e)&&A.call(e,"callee")&&!Ft.call(e,"callee")},Je=Array.isArray,yt=yr||function(){return!1};function Gt(e){if(!Jt(e))return!1;var t=Se(e);return t==K||t==V||t==C||t==P}function Ut(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=i}function Jt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function je(e){return e!=null&&typeof e=="object"}var Qt=Me?function(e){return function(t){return e(t)}}(Me):function(e){return je(e)&&Ut(e.length)&&!!f[Se(e)]};function Tr(e){return(t=e)!=null&&Ut(t.length)&&!Gt(t)?_r(e):Nr(e);var t}r.exports=function(e,t){return Ht(e,t)}})(Ct,Ct.exports);const Vr=Ar(Ct.exports),Dr=({multiselect:r,selectedItems:a,allowCustomValue:o=!1,setSelectedItems:l,triggerAreaRef:u})=>(i,{changes:d,type:y})=>{const C=u.current?.contains?.(document.activeElement);switch(y){case D.useCombobox.stateChangeTypes.InputClick:return{...d,isOpen:!0};case D.useCombobox.stateChangeTypes.InputKeyDownEnter:case D.useCombobox.stateChangeTypes.ItemClick:{const w={...d};if(d.selectedItem!=null){w.inputValue="",w.isOpen=!0,w.highlightedIndex=i.highlightedIndex;const j=r.selectedItems.some(T=>T.value===d.selectedItem?.value)?a.filter(T=>T.value!==d.selectedItem?.value):[...a,d.selectedItem];l(j)}return w}case D.useCombobox.stateChangeTypes.ToggleButtonClick:return{...d,inputValue:o?d.inputValue:""};case D.useCombobox.stateChangeTypes.InputBlur:return{...d,inputValue:o?d.inputValue:"",isOpen:C};default:return d}},Lr=({filteredItems:r,allowCustomValue:a=!1,setSelectedItem:o})=>(l,{changes:u,type:i})=>{const d=r.find(y=>y.text.toLowerCase()===l.inputValue.toLowerCase());switch(i){case D.useCombobox.stateChangeTypes.ItemClick:case D.useCombobox.stateChangeTypes.InputKeyDownEnter:return u.selectedItem&&o(u.selectedItem),u;case D.useCombobox.stateChangeTypes.InputClick:return{...u,isOpen:!0};case D.useCombobox.stateChangeTypes.ToggleButtonClick:case D.useCombobox.stateChangeTypes.InputBlur:return a?u:l.inputValue===""?(o(null),{...u,selectedItem:null}):d?(o(d),{...u,selectedItem:d,inputValue:d.text}):l.selectedItem?{...u,inputValue:l.selectedItem.text}:{...u,inputValue:""};default:return u}},Mr=(r,a)=>{const o=((l,u)=>{let i=0;for(const d of l.keys()){if(i===u)return d;i++}})(r,a);return o!==void 0?r.get(o):void 0},ct=r=>r?r.type.displayName:"",or=(r,a=[])=>(n.Children.forEach(r,o=>{if(n.isValidElement(o)){if(ct(o)==="Combobox.Item"){const l=o.props;a.push({value:l.value,disabled:!!l.disabled,text:wt(l.children)})}o.props.children&&or(o.props.children,a)}}),a),wt=(r,a="")=>typeof r=="string"?r:(n.Children.forEach(r,o=>{n.isValidElement(o)&&(ct(o)==="Combobox.ItemText"&&(a=o.props.children),o.props.children&&wt(o.props.children,a))}),a),tr=r=>{const a=new Map;return or(r).forEach(o=>{a.set(o.value,o)}),a},ar=(r,a)=>n.Children.toArray(r).some(o=>!!n.isValidElement(o)&&(ct(o)===a||!!o.props.children&&ar(o.props.children,a))),Re=(r,a)=>n.Children.toArray(r).filter(n.isValidElement).find(o=>a===ct(o)||""),sr=n.createContext(null),It=(r,a)=>a?new Map(Array.from(r).filter(([o,{text:l}])=>l.toLowerCase().includes(a.toLowerCase()))):r,lr=({children:r,state:a,allowCustomValue:o=!1,autoFilter:l=!0,disabled:u=!1,multiple:i=!1,readOnly:d=!1,wrap:y=!0,value:C,defaultValue:w,onValueChange:j,open:T,defaultOpen:K,onOpenChange:V})=>{const $=n.useRef(!1),[L,pe]=n.useState(""),M=n.useRef(null),z=n.useRef(null),[P]=function(p,N,g){const x=p!==void 0,{current:F}=n.useRef(x?p:N),[be,A]=n.useState(N),le=x?p:be,He=n.useCallback((Ee,We=(Z,Ke)=>!Vr(Z,Ke))=>{const Z=typeof Ee!="function"?Ee:Ee(le);We(le,Z)&&!x&&A(Z),g&&g(Z)},[x,le,g]);return[le,He,x,F]}(C,w),[E,U]=n.useState(tr(r)),[J,te]=n.useState(l?It(E,L):E),[ut,fe]=n.useState(E.get(P)||null),[xe,se]=n.useState(P?[...E.values()].filter(p=>P.includes(p.value)):[]),Pe=p=>{fe(p),setTimeout(()=>{j?.(p?.value)},0)},Ie=p=>{se(p),setTimeout(()=>{j?.(p.map(N=>N.value))},0)};n.useEffect(()=>{if($.current)if(i){const p=P.reduce((N,g)=>{const x=E.get(g);return x?[...N,x]:N},[]);se(P?p:[])}else fe(E.get(P)||null);else $.current=!0},[i?JSON.stringify(P):P]);const f=nr.useFormFieldControl(),Ae=lt.useId(f.id),dt=lt.useId(f.labelId),H=f.state||a,Ve=f.disabled??u,De=f.readOnly??d,[Ce,we]=n.useState(ar(r,"Combobox.Popover")),[Le,Me]=n.useState("mouse");n.useEffect(()=>{te(l?It(E,L):E)},[L,E]);const Fe=D.useMultipleSelection({selectedItems:xe,stateReducer:(p,{type:N,changes:g})=>{const x=D.useMultipleSelection.stateChangeTypes;switch(N){case x.SelectedItemKeyDownBackspace:case x.SelectedItemKeyDownDelete:{let F;return Ie(g.selectedItems||[]),N===x.SelectedItemKeyDownDelete?F=p?.activeIndex===g.selectedItems?.length?-1:p.activeIndex:F=(g?.activeIndex||0)-1>=0?p.activeIndex-1:g?.activeIndex,{...g,activeIndex:F}}case x.SelectedItemClick:return z.current&&z.current.focus(),{...g,activeIndex:-1};case x.FunctionRemoveSelectedItem:return{...g,activeIndex:-1};case x.DropdownKeyDownNavigationPrevious:return _e.closeMenu(),g;default:return g}}}),Be=Array.from(J.values()),_e=D.useCombobox({items:Be,selectedItem:ut,id:Ae,labelId:dt,inputValue:L,...T!=null&&{isOpen:T},onIsOpenChange:p=>{p.isOpen!=null&&V?.(p.isOpen)},initialIsOpen:K,...i&&{selectedItem:void 0},itemToString:p=>p?.text,isItemDisabled:p=>{const N=!!L&&!Be.some(g=>p.value===g.value);return p.disabled||N},onInputValueChange:({inputValue:p})=>{if(pe(p),l){const N=It(E,p||"");te(N)}},stateReducer:i?Dr({multiselect:Fe,selectedItems:xe,allowCustomValue:o,setSelectedItems:Ie,triggerAreaRef:M}):Lr({allowCustomValue:o,setSelectedItem:Pe,filteredItems:[...J.values()]})});n.useEffect(()=>{const p=tr(r),N=[...E.values()],g=[...p.values()];(N.length!==g.length||N.some((x,F)=>{const be=x.value!==g[F]?.value,A=x.text!==g[F]?.text;return be||A}))&&U(p)},[r]);const[qe,$e]=Ce?[it.Popover,{open:!0}]:[n.Fragment,{}];return n.createElement(sr.Provider,{value:{itemsMap:E,filteredItemsMap:J,highlightedItem:Mr(J,_e.highlightedIndex),multiple:i,disabled:Ve,readOnly:De,hasPopover:Ce,setHasPopover:we,state:H,lastInteractionType:Le,setLastInteractionType:Me,wrap:y,innerInputRef:z,triggerAreaRef:M,..._e,...Fe,setInputValue:pe,selectItem:Pe,setSelectedItems:Ie}},n.createElement(qe,{...$e},r))},q=()=>{const r=n.useContext(sr);if(!r)throw Error("useComboboxContext must be used within a Combobox provider");return r},ir=({children:r,...a})=>n.createElement(lr,{...a},r);ir.displayName="Combobox";const cr=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},u)=>n.createElement("svg",{ref:u,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteFill",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</title>`)+'<path fill-rule="evenodd" d="m2,12C2,6.48,6.48,2,12,2s10,4.48,10,10-4.48,10-10,10S2,17.52,2,12Zm7.75-3.67c-.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.41.39.39,1.02.39,1.41,0l2.23-2.23,2.23,2.23c.39.39,1.02.39,1.41,0s.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.23Z"/>'}}));cr.displayName="DeleteFill";const _t=n.forwardRef(({className:r,tabIndex:a=-1,onClick:o,...l},u)=>{const i=q();return n.createElement("button",{ref:u,className:k.cx(r,"h-sz-44 text-neutral hover:text-neutral-hovered"),tabIndex:a,onClick:d=>{d.stopPropagation(),i.multiple?i.setSelectedItems([]):i.selectItem(null),i.setInputValue(""),i.innerInputRef.current&&i.innerInputRef.current.focus(),o&&o(d)},type:"button",...l},n.createElement(ge.Icon,{size:"sm"},n.createElement(cr,null)))});_t.displayName="Combobox.ClearButton";const ur=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},u)=>n.createElement("svg",{ref:u,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"ArrowHorizontalDown",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));ur.displayName="ArrowHorizontalDown";const Et=n.forwardRef(({className:r,closedLabel:a,openedLabel:o,intent:l="neutral",design:u="ghost",size:i="sm",...d},y)=>{const C=q(),{ref:w,...j}=C.getToggleButtonProps({disabled:C.disabled||C.readOnly,onClick:V=>{V.stopPropagation()}}),T=j["aria-expanded"],K=ze.useMergeRefs(y,w);return n.createElement(zr.IconButton,{ref:K,className:k.cx(r,"mt-[calc((44px-32px)/2)]"),intent:l,design:u,size:i,...j,...d,"aria-label":T?o:a,disabled:C.disabled},n.createElement(ge.Icon,null,n.createElement(ge.Icon,{className:"shrink-0",size:"sm"},n.createElement(ur,null))))});Et.displayName="Combobox.Disclosure";const Nt=n.forwardRef(({className:r},a)=>n.createElement("div",{ref:a,role:"separator",className:k.cx("my-md border-b-sm border-outline",r)}));Nt.displayName="Combobox.Divider";const Ot=n.forwardRef(({className:r,children:a},o)=>q().filteredItemsMap.size===0?n.createElement("div",{ref:o,className:r},a):null);Ot.displayName="Combobox.Empty";const dr=n.createContext(null),Fr=({children:r})=>{const a=lt.useId();return n.createElement(dr.Provider,{value:{groupLabelId:a}},r)},mr=()=>{const r=n.useContext(dr);if(!r)throw Error("useComboboxGroupContext must be used within a ComboboxGroup provider");return r},St=n.forwardRef(({children:r,...a},o)=>n.createElement(Fr,null,n.createElement(Br,{ref:o,...a},r))),Br=n.forwardRef(({children:r,className:a},o)=>{const l=q(),u=mr();return n.Children.toArray(r).some(i=>n.isValidElement(i)&&l.filteredItemsMap.get(i.props.value))?n.createElement("div",{ref:o,role:"group","aria-labelledby":u.groupLabelId,className:k.cx(a)},r):null});St.displayName="Combobox.Group";const jt=n.forwardRef(({"aria-label":r,className:a,placeholder:o,...l},u)=>{const i=q();n.useEffect(()=>{!i.multiple&&i.selectedItem&&i.setInputValue(i.selectedItem.text)},[]);const[d,y]=i.hasPopover?[it.Popover.Trigger,{asChild:!0,type:void 0}]:[n.Fragment,{}],C=i.getDropdownProps(),w=ze.useMergeRefs(u,i.innerInputRef,C.ref),j=i.getInputProps({disabled:i.disabled||i.readOnly,...C,onKeyDown:T=>{C.onKeyDown?.(T),i.setLastInteractionType("keyboard")},ref:w});return n.createElement(n.Fragment,null,r&&n.createElement(Pr.VisuallyHidden,null,n.createElement("label",{...i.getLabelProps()},r)),n.createElement(d,{...y},n.createElement("input",{"data-spark-component":"combobox-input",type:"text",placeholder:o,className:k.cx("h-sz-28 shrink-0 flex-grow basis-[80px] text-ellipsis px-sm 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),...l,...j,value:i.inputValue,"aria-label":r,disabled:i.disabled,readOnly:i.readOnly})))});jt.displayName="Combobox.Input";const pr=n.createContext(null),qr=({value:r,disabled:a=!1,children:o})=>{const l=q(),[u,i]=n.useState(void 0),d=function(w,j){let T=0;for(const[K]of w.entries()){if(K===j)return T;T++}return-1}(l.itemsMap,r),y={disabled:a,value:r,text:wt(o)},C=l.multiple?l.selectedItems.some(w=>w.value===r):l.selectedItem?.value===r;return n.createElement(pr.Provider,{value:{textId:u,setTextId:i,isSelected:C,itemData:y,index:d,disabled:a}},o)},Tt=()=>{const r=n.useContext(pr);if(!r)throw Error("useComboboxItemContext must be used within a ComboboxItem provider");return r},kt=n.forwardRef(({children:r,...a},o)=>{const{value:l,disabled:u}=a;return n.createElement(qr,{value:l,disabled:u},n.createElement(Hr,{ref:o,...a},r))}),$r=k.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"}]}),Hr=n.forwardRef(({className:r,disabled:a=!1,value:o,children:l},u)=>{const i=q(),d=Tt(),y=!!i.filteredItemsMap.get(o),{ref:C,...w}=i.getItemProps({item:d.itemData,index:d.index}),j=ze.useMergeRefs(u,C);return y?n.createElement("li",{ref:j,className:k.cx($r({selected:d.isSelected,disabled:a,highlighted:i.highlightedItem?.value===o,interactionType:i.lastInteractionType,className:r})),key:o,...w,"aria-selected":d.isSelected,"aria-labelledby":d.textId},l):null});kt.displayName="Combobox.Item";const fr=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},u)=>n.createElement("svg",{ref:u,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"Check",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));fr.displayName="Check";const Rt=n.forwardRef(({className:r,children:a,label:o},l)=>{const{disabled:u,isSelected:i}=Tt(),d=a||n.createElement(ge.Icon,{size:"sm"},n.createElement(fr,{"aria-label":o}));return n.createElement("span",{ref:l,className:k.cx("flex min-h-sz-16 min-w-sz-16",u&&"opacity-dim-3",r)},i&&d)});Rt.displayName="Combobox.ItemIndicator";const zt=n.forwardRef(({children:r,className:a,...o},l)=>{const u=q(),{ref:i,...d}=u.getMenuProps({onMouseMove:()=>{u.setLastInteractionType("mouse")}}),y=ze.useMergeRefs(l,i);return n.createElement("ul",{ref:y,className:k.cx(a,"flex flex-col",u.isOpen?"block":"pointer-events-none opacity-0",u.hasPopover&&"p-lg"),...o,...d,"data-spark-component":"combobox-items"},r)});zt.displayName="Combobox.Items";const Pt=n.forwardRef(({children:r},a)=>{const o=lt.useId(),{setTextId:l}=Tt();return n.useEffect(()=>(l(o),()=>l(void 0))),n.createElement("span",{id:o,className:k.cx("inline"),ref:a},r)});Pt.displayName="Combobox.ItemText";const At=n.forwardRef(({children:r,className:a},o)=>{const l=mr();return n.createElement("div",{ref:o,id:l.groupLabelId,className:k.cx("px-md py-sm text-body-2 italic text-neutral",a)},r)});At.displayName="Combobox.Label";const Vt=({children:r})=>n.createElement(ge.Icon,{size:"sm",className:"h-sz-44 shrink-0"},r);Vt.displayName="Combobox.LeadingIcon";const Dt=n.forwardRef(({children:r,matchTriggerWidth:a=!0,sideOffset:o=4,className:l,...u},i)=>{const d=q();return n.useEffect(()=>(d.setHasPopover(!0),()=>d.setHasPopover(!1)),[]),n.createElement(it.Popover.Content,{ref:i,inset:!0,asChild:!0,matchTriggerWidth:a,className:k.cx("!z-dropdown",!d.isOpen&&"hidden",l),sideOffset:o,onOpenAutoFocus:y=>{y.preventDefault()},...u,"data-spark-component":"combobox-popover"},r)});Dt.displayName="Combobox.Popover";const br=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},u)=>n.createElement("svg",{ref:u,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteOutline",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));br.displayName="DeleteOutline";const Lt=()=>{const r=q();if(!r.selectedItems.length)return null;const a=!r.disabled&&!r.readOnly;return n.createElement(n.Fragment,null,r.selectedItems.map((o,l)=>{const u=r.getSelectedItemProps({disabled:r.disabled||r.readOnly,selectedItem:o,index:l});return n.createElement("span",{role:"presentation","data-spark-component":"combobox-selected-item",key:`selected-item-${l}`,className:k.cx("flex h-sz-28 items-center rounded-md bg-neutral-container align-middle","text-body-2 text-on-neutral-container",{"px-md":!a,"pl-md":a}),...u,tabIndex:-1,onFocus:i=>{const d=i.target;r.lastInteractionType==="keyboard"&&d.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"})}},n.createElement("span",{className:k.cx("line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal",{"w-max":!r.wrap})},o.text),r.disabled,a&&n.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,className:"h-full cursor-pointer px-md",onClick:i=>{i.stopPropagation();const d=r.selectedItems.filter(y=>y.value!==o.value);r.setSelectedItems(d),r.innerInputRef.current&&r.innerInputRef.current.focus({preventScroll:!0})}},n.createElement(ge.Icon,{size:"sm"},n.createElement(br,null))))}))};Lt.displayName="Combobox.SelectedItems";const Wr=k.cva(["flex items-start gap-md min-h-sz-44","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}}),Mt=n.forwardRef(({className:r,children:a},o)=>{const l=q(),u=nr.useFormFieldControl(),i=Re(a,"Combobox.LeadingIcon"),d=Re(a,"Combobox.SelectedItems"),y=Re(a,"Combobox.Input"),C=Re(a,"Combobox.ClearButton"),w=Re(a,"Combobox.Disclosure"),[j,T]=l.hasPopover?[it.Popover.Anchor,{asChild:!0,type:void 0}]:[n.Fragment,{}],K=ze.useMergeRefs(o,l.triggerAreaRef),V=n.useRef(null),$=u.disabled||l.disabled,L=u.readOnly||l.readOnly,pe=!!C&&!$&&!L,M=()=>{if(V.current&&!l.wrap){const{scrollWidth:z,clientWidth:P}=V.current;V.current.scrollLeft=z-P}};return((z,P)=>{const E=n.useRef(null);n.useEffect(()=>{const U=()=>{const te=z.current?.scrollWidth||null;E.current&&te&&te>E.current&&P(),E.current=te,requestAnimationFrame(U)},J=requestAnimationFrame(U);return()=>cancelAnimationFrame(J)},[z])})(V,M),n.useEffect(()=>{const z=new ResizeObserver(M);return V.current&&z.observe(V.current),()=>{z.disconnect()}},[]),n.createElement(n.Fragment,null,n.createElement(j,{...T},n.createElement("div",{ref:K,className:Wr({className:r,state:l.state,disabled:$,readOnly:L,allowWrap:l.wrap}),onClick:()=>{l.isOpen||$||L||(l.openMenu(),l.innerInputRef.current&&l.innerInputRef.current.focus())}},i,n.createElement("div",{ref:V,className:k.cx("inline-flex grow items-start gap-sm py-md",l.wrap?"flex-wrap":"overflow-x-auto p-[2px] u-no-scrollbar")},d,y),pe&&C,w)))});Mt.displayName="Combobox.Trigger";const rr=Object.assign(ir,{Group:St,Item:kt,Items:zt,ItemText:Pt,ItemIndicator:Rt,Label:At,Popover:Dt,Divider:Nt,Trigger:Mt,LeadingIcon:Vt,Empty:Ot,Input:jt,Disclosure:Et,SelectedItems:Lt,ClearButton:_t});rr.displayName="Combobox",St.displayName="Combobox.Group",zt.displayName="Combobox.Items",kt.displayName="Combobox.Item",Pt.displayName="Combobox.ItemText",Rt.displayName="Combobox.ItemIndicator",At.displayName="Combobox.Label",Dt.displayName="Combobox.Popover",Nt.displayName="Combobox.Divider",Mt.displayName="Combobox.Trigger",Vt.displayName="Combobox.LeadingIcon",Ot.displayName="Combobox.Empty",jt.displayName="Combobox.Input",Et.displayName="Combobox.Disclosure",Lt.displayName="Combobox.SelectedItems",_t.displayName="Combobox.ClearButton",exports.Combobox=rr,exports.ComboboxProvider=lr,exports.useComboboxContext=q; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),lt=require("@radix-ui/react-id"),nr=require("@spark-ui/form-field"),it=require("@spark-ui/popover"),V=require("downshift"),we=require("@spark-ui/icon"),k=require("class-variance-authority"),zr=require("@spark-ui/icon-button"),ze=require("@spark-ui/use-merge-refs"),Pr=require("@spark-ui/visually-hidden"),Ar=require("@spark-ui/spinner");var st=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var wt={exports:{}};(function(r,a){var o="__lodash_hash_undefined__",l=1,c=2,i=9007199254740991,d="[object Arguments]",y="[object Array]",x="[object AsyncFunction]",w="[object Boolean]",j="[object Date]",T="[object Error]",H="[object Function]",A="[object GeneratorFunction]",W="[object Map]",G="[object Number]",U="[object Null]",D="[object Object]",L="[object Promise]",J="[object Proxy]",R="[object RegExp]",_="[object Set]",fe="[object String]",K="[object Symbol]",Pe="[object Undefined]",_e="[object WeakMap]",Ee="[object ArrayBuffer]",le="[object DataView]",Ae=/^\[object .+?Constructor\]$/,Le=/^(?:0|[1-9]\d*)$/,f={};f["[object Float32Array]"]=f["[object Float64Array]"]=f["[object Int8Array]"]=f["[object Int16Array]"]=f["[object Int32Array]"]=f["[object Uint8Array]"]=f["[object Uint8ClampedArray]"]=f["[object Uint16Array]"]=f["[object Uint32Array]"]=!0,f[d]=f[y]=f[Ee]=f[w]=f[le]=f[j]=f[T]=f[H]=f[W]=f[G]=f[D]=f[R]=f[_]=f[fe]=f[_e]=!1;var te=typeof st=="object"&&st&&st.Object===Object&&st,ut=typeof self=="object"&&self&&self.Object===Object&&self,B=te||ut||Function("return this")(),Ve=a&&!a.nodeType&&a,De=Ve&&r&&!r.nodeType&&r,Me=De&&De.exports===Ve,be=Me&&te.process,Fe=function(){try{return be&&be.binding&&be.binding("util")}catch{}}(),Be=Fe&&Fe.isTypedArray;function dt(e,t){for(var s=-1,u=e==null?0:e.length;++s<u;)if(t(e[s],s,e))return!0;return!1}function qe(e){var t=-1,s=Array(e.size);return e.forEach(function(u,v){s[++t]=[v,u]}),s}function $e(e){var t=-1,s=Array(e.size);return e.forEach(function(u){s[++t]=u}),s}var he,He,We,p=Array.prototype,N=Function.prototype,g=Object.prototype,I=B["__core-js_shared__"],q=N.toString,P=g.hasOwnProperty,ge=(he=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+he:"",ie=g.toString,mt=RegExp("^"+q.call(P).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ye=Me?B.Buffer:void 0,ve=B.Symbol,re=B.Uint8Array,Ke=g.propertyIsEnumerable,hr=p.splice,ce=ve?ve.toStringTag:void 0,Bt=Object.getOwnPropertySymbols,gr=ye?ye.isBuffer:void 0,yr=(He=Object.keys,We=Object,function(e){return He(We(e))}),pt=xe(B,"DataView"),Ne=xe(B,"Map"),ft=xe(B,"Promise"),bt=xe(B,"Set"),ht=xe(B,"WeakMap"),Oe=xe(Object,"create"),vr=me(pt),xr=me(Ne),Ir=me(ft),Cr=me(bt),wr=me(ht),qt=ve?ve.prototype:void 0,gt=qt?qt.valueOf:void 0;function ue(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Q(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function de(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t<s;){var u=e[t];this.set(u[0],u[1])}}function Ze(e){var t=-1,s=e==null?0:e.length;for(this.__data__=new de;++t<s;)this.add(e[t])}function ne(e){var t=this.__data__=new Q(e);this.size=t.size}function _r(e,t){var s=Je(e),u=!s&&jr(e),v=!s&&!u&&yt(e),m=!s&&!u&&!v&&Qt(e),C=s||u||v||m,E=C?function(S,Z){for(var X=-1,z=Array(S);++X<S;)z[X]=Z(X);return z}(e.length,String):[],$=E.length;for(var O in e)!t&&!P.call(e,O)||C&&(O=="length"||v&&(O=="offset"||O=="parent")||m&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||Sr(O,$))||E.push(O);return E}function Ge(e,t){for(var s=e.length;s--;)if(Zt(e[s][0],t))return s;return-1}function Se(e){return e==null?e===void 0?Pe:U:ce&&ce in Object(e)?function(t){var s=P.call(t,ce),u=t[ce];try{t[ce]=void 0;var v=!0}catch{}var m=ie.call(t);return v&&(s?t[ce]=u:delete t[ce]),m}(e):function(t){return ie.call(t)}(e)}function $t(e){return je(e)&&Se(e)==d}function Ht(e,t,s,u,v){return e===t||(e==null||t==null||!je(e)&&!je(t)?e!=e&&t!=t:function(m,C,E,$,O,S){var Z=Je(m),X=Je(C),z=Z?y:oe(m),Y=X?y:oe(C),Ie=(z=z==d?D:z)==D,Qe=(Y=Y==d?D:Y)==D,Ce=z==Y;if(Ce&&yt(m)){if(!yt(C))return!1;Z=!0,Ie=!1}if(Ce&&!Ie)return S||(S=new ne),Z||Qt(m)?Wt(m,C,E,$,O,S):function(h,b,Xe,ae,vt,M,ee){switch(Xe){case le:if(h.byteLength!=b.byteLength||h.byteOffset!=b.byteOffset)return!1;h=h.buffer,b=b.buffer;case Ee:return!(h.byteLength!=b.byteLength||!M(new re(h),new re(b)));case w:case j:case G:return Zt(+h,+b);case T:return h.name==b.name&&h.message==b.message;case R:case fe:return h==b+"";case W:var se=qe;case _:var ke=ae&l;if(se||(se=$e),h.size!=b.size&&!ke)return!1;var Ye=ee.get(h);if(Ye)return Ye==b;ae|=c,ee.set(h,b);var xt=Wt(se(h),se(b),ae,vt,M,ee);return ee.delete(h),xt;case K:if(gt)return gt.call(h)==gt.call(b)}return!1}(m,C,z,E,$,O,S);if(!(E&l)){var Te=Ie&&P.call(m,"__wrapped__"),Xt=Qe&&P.call(C,"__wrapped__");if(Te||Xt){var kr=Te?m.value():m,Rr=Xt?C.value():C;return S||(S=new ne),O(kr,Rr,E,$,S)}}return Ce?(S||(S=new ne),function(h,b,Xe,ae,vt,M){var ee=Xe&l,se=Kt(h),ke=se.length,Ye=Kt(b),xt=Ye.length;if(ke!=xt&&!ee)return!1;for(var et=ke;et--;){var pe=se[et];if(!(ee?pe in b:P.call(b,pe)))return!1}var Yt=M.get(h);if(Yt&&M.get(b))return Yt==b;var tt=!0;M.set(h,b),M.set(b,h);for(var It=ee;++et<ke;){var rt=h[pe=se[et]],nt=b[pe];if(ae)var er=ee?ae(nt,rt,pe,b,h,M):ae(rt,nt,pe,h,b,M);if(!(er===void 0?rt===nt||vt(rt,nt,Xe,ae,M):er)){tt=!1;break}It||(It=pe=="constructor")}if(tt&&!It){var ot=h.constructor,at=b.constructor;ot==at||!("constructor"in h)||!("constructor"in b)||typeof ot=="function"&&ot instanceof ot&&typeof at=="function"&&at instanceof at||(tt=!1)}return M.delete(h),M.delete(b),tt}(m,C,E,$,O,S)):!1}(e,t,s,u,Ht,v))}function Er(e){return!(!Jt(e)||function(t){return!!ge&&ge in t}(e))&&(Gt(e)?mt:Ae).test(me(e))}function Nr(e){if(s=(t=e)&&t.constructor,u=typeof s=="function"&&s.prototype||g,t!==u)return yr(e);var t,s,u,v=[];for(var m in Object(e))P.call(e,m)&&m!="constructor"&&v.push(m);return v}function Wt(e,t,s,u,v,m){var C=s&l,E=e.length,$=t.length;if(E!=$&&!(C&&$>E))return!1;var O=m.get(e);if(O&&m.get(t))return O==t;var S=-1,Z=!0,X=s&c?new Ze:void 0;for(m.set(e,t),m.set(t,e);++S<E;){var z=e[S],Y=t[S];if(u)var Ie=C?u(Y,z,S,t,e,m):u(z,Y,S,e,t,m);if(Ie!==void 0){if(Ie)continue;Z=!1;break}if(X){if(!dt(t,function(Qe,Ce){if(Te=Ce,!X.has(Te)&&(z===Qe||v(z,Qe,s,u,m)))return X.push(Ce);var Te})){Z=!1;break}}else if(z!==Y&&!v(z,Y,s,u,m)){Z=!1;break}}return m.delete(e),m.delete(t),Z}function Kt(e){return function(t,s,u){var v=s(t);return Je(t)?v:function(m,C){for(var E=-1,$=C.length,O=m.length;++E<$;)m[O+E]=C[E];return m}(v,u(t))}(e,Tr,Or)}function Ue(e,t){var s,u,v=e.__data__;return((u=typeof(s=t))=="string"||u=="number"||u=="symbol"||u=="boolean"?s!=="__proto__":s===null)?v[typeof t=="string"?"string":"hash"]:v.map}function xe(e,t){var s=function(u,v){return u?.[v]}(e,t);return Er(s)?s:void 0}ue.prototype.clear=function(){this.__data__=Oe?Oe(null):{},this.size=0},ue.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ue.prototype.get=function(e){var t=this.__data__;if(Oe){var s=t[e];return s===o?void 0:s}return P.call(t,e)?t[e]:void 0},ue.prototype.has=function(e){var t=this.__data__;return Oe?t[e]!==void 0:P.call(t,e)},ue.prototype.set=function(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Oe&&t===void 0?o:t,this},Q.prototype.clear=function(){this.__data__=[],this.size=0},Q.prototype.delete=function(e){var t=this.__data__,s=Ge(t,e);return!(s<0)&&(s==t.length-1?t.pop():hr.call(t,s,1),--this.size,!0)},Q.prototype.get=function(e){var t=this.__data__,s=Ge(t,e);return s<0?void 0:t[s][1]},Q.prototype.has=function(e){return Ge(this.__data__,e)>-1},Q.prototype.set=function(e,t){var s=this.__data__,u=Ge(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this},de.prototype.clear=function(){this.size=0,this.__data__={hash:new ue,map:new(Ne||Q),string:new ue}},de.prototype.delete=function(e){var t=Ue(this,e).delete(e);return this.size-=t?1:0,t},de.prototype.get=function(e){return Ue(this,e).get(e)},de.prototype.has=function(e){return Ue(this,e).has(e)},de.prototype.set=function(e,t){var s=Ue(this,e),u=s.size;return s.set(e,t),this.size+=s.size==u?0:1,this},Ze.prototype.add=Ze.prototype.push=function(e){return this.__data__.set(e,o),this},Ze.prototype.has=function(e){return this.__data__.has(e)},ne.prototype.clear=function(){this.__data__=new Q,this.size=0},ne.prototype.delete=function(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s},ne.prototype.get=function(e){return this.__data__.get(e)},ne.prototype.has=function(e){return this.__data__.has(e)},ne.prototype.set=function(e,t){var s=this.__data__;if(s instanceof Q){var u=s.__data__;if(!Ne||u.length<199)return u.push([e,t]),this.size=++s.size,this;s=this.__data__=new de(u)}return s.set(e,t),this.size=s.size,this};var Or=Bt?function(e){return e==null?[]:(e=Object(e),function(t,s){for(var u=-1,v=t==null?0:t.length,m=0,C=[];++u<v;){var E=t[u];s(E,u,t)&&(C[m++]=E)}return C}(Bt(e),function(t){return Ke.call(e,t)}))}:function(){return[]},oe=Se;function Sr(e,t){return!!(t=t??i)&&(typeof e=="number"||Le.test(e))&&e>-1&&e%1==0&&e<t}function me(e){if(e!=null){try{return q.call(e)}catch{}try{return e+""}catch{}}return""}function Zt(e,t){return e===t||e!=e&&t!=t}(pt&&oe(new pt(new ArrayBuffer(1)))!=le||Ne&&oe(new Ne)!=W||ft&&oe(ft.resolve())!=L||bt&&oe(new bt)!=_||ht&&oe(new ht)!=_e)&&(oe=function(e){var t=Se(e),s=t==D?e.constructor:void 0,u=s?me(s):"";if(u)switch(u){case vr:return le;case xr:return W;case Ir:return L;case Cr:return _;case wr:return _e}return t});var jr=$t(function(){return arguments}())?$t:function(e){return je(e)&&P.call(e,"callee")&&!Ke.call(e,"callee")},Je=Array.isArray,yt=gr||function(){return!1};function Gt(e){if(!Jt(e))return!1;var t=Se(e);return t==H||t==A||t==x||t==J}function Ut(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=i}function Jt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function je(e){return e!=null&&typeof e=="object"}var Qt=Be?function(e){return function(t){return e(t)}}(Be):function(e){return je(e)&&Ut(e.length)&&!!f[Se(e)]};function Tr(e){return(t=e)!=null&&Ut(t.length)&&!Gt(t)?_r(e):Nr(e);var t}r.exports=function(e,t){return Ht(e,t)}})(wt,wt.exports);const Vr=Lr(wt.exports),Dr=({multiselect:r,selectedItems:a,allowCustomValue:o=!1,setSelectedItems:l,triggerAreaRef:c})=>(i,{changes:d,type:y})=>{const x=c.current?.contains?.(document.activeElement);switch(y){case V.useCombobox.stateChangeTypes.InputClick:return{...d,isOpen:!0};case V.useCombobox.stateChangeTypes.InputKeyDownEnter:case V.useCombobox.stateChangeTypes.ItemClick:{const w={...d};if(d.selectedItem!=null){w.inputValue="",w.isOpen=!0,w.highlightedIndex=i.highlightedIndex;const j=r.selectedItems.some(T=>T.value===d.selectedItem?.value)?a.filter(T=>T.value!==d.selectedItem?.value):[...a,d.selectedItem];l(j)}return w}case V.useCombobox.stateChangeTypes.ToggleButtonClick:return{...d,inputValue:o?d.inputValue:""};case V.useCombobox.stateChangeTypes.InputBlur:return{...d,inputValue:o?d.inputValue:"",isOpen:x};default:return d}},Mr=({filteredItems:r,allowCustomValue:a=!1,setSelectedItem:o})=>(l,{changes:c,type:i})=>{const d=r.find(y=>y.text.toLowerCase()===l.inputValue.toLowerCase());switch(i){case V.useCombobox.stateChangeTypes.ItemClick:case V.useCombobox.stateChangeTypes.InputKeyDownEnter:return c.selectedItem&&o(c.selectedItem),c;case V.useCombobox.stateChangeTypes.InputClick:return{...c,isOpen:!0};case V.useCombobox.stateChangeTypes.ToggleButtonClick:case V.useCombobox.stateChangeTypes.InputBlur:return a?c:l.inputValue===""?(o(null),{...c,selectedItem:null}):d?(o(d),{...c,selectedItem:d,inputValue:d.text}):l.selectedItem?{...c,inputValue:l.selectedItem.text}:{...c,inputValue:""};default:return c}},Fr=(r,a)=>{const o=((l,c)=>{let i=0;for(const d of l.keys()){if(i===c)return d;i++}})(r,a);return o!==void 0?r.get(o):void 0},ct=r=>r?r.type.displayName:"",or=(r,a=[])=>(n.Children.forEach(r,o=>{if(n.isValidElement(o)){if(ct(o)==="Combobox.Item"){const l=o.props;a.push({value:l.value,disabled:!!l.disabled,text:_t(l.children)})}o.props.children&&or(o.props.children,a)}}),a),_t=(r,a="")=>typeof r=="string"?r:(n.Children.forEach(r,o=>{n.isValidElement(o)&&(ct(o)==="Combobox.ItemText"&&(a=o.props.children),o.props.children&&_t(o.props.children,a))}),a),tr=r=>{const a=new Map;return or(r).forEach(o=>{a.set(o.value,o)}),a},ar=(r,a)=>n.Children.toArray(r).some(o=>!!n.isValidElement(o)&&(ct(o)===a||!!o.props.children&&ar(o.props.children,a))),Re=(r,a)=>n.Children.toArray(r).filter(n.isValidElement).find(o=>a===ct(o)||""),sr=n.createContext(null),Ct=(r,a)=>a?new Map(Array.from(r).filter(([o,{text:l}])=>l.toLowerCase().includes(a.toLowerCase()))):r,lr=({children:r,state:a,allowCustomValue:o=!1,autoFilter:l=!0,disabled:c=!1,multiple:i=!1,readOnly:d=!1,wrap:y=!0,value:x,defaultValue:w,onValueChange:j,open:T,defaultOpen:H,onOpenChange:A,isLoading:W})=>{const G=n.useRef(!1),[U,D]=n.useState(""),L=n.useRef(null),J=n.useRef(null),[R]=function(p,N,g){const I=p!==void 0,{current:q}=n.useRef(I?p:N),[P,ge]=n.useState(N),ie=I?p:P,mt=n.useCallback((ye,ve=(re,Ke)=>!Vr(re,Ke))=>{const re=typeof ye!="function"?ye:ye(ie);ve(ie,re)&&!I&&ge(re),g&&g(re)},[I,ie,g]);return[ie,mt,I,q]}(x,w),[_,fe]=n.useState(tr(r)),[K,Pe]=n.useState(l?Ct(_,U):_),[_e,Ee]=n.useState(_.get(R)||null),[le,Ae]=n.useState(R?[..._.values()].filter(p=>R.includes(p.value)):[]),Le=p=>{Ee(p),setTimeout(()=>{j?.(p?.value)},0)},f=p=>{Ae(p),setTimeout(()=>{j?.(p.map(N=>N.value))},0)};n.useEffect(()=>{if(G.current)if(i){const p=R.reduce((N,g)=>{const I=_.get(g);return I?[...N,I]:N},[]);Ae(R?p:[])}else Ee(_.get(R)||null);else G.current=!0},[i?JSON.stringify(R):R]);const te=nr.useFormFieldControl(),ut=lt.useId(te.id),B=lt.useId(te.labelId),Ve=te.state||a,De=te.disabled??c,Me=te.readOnly??d,[be,Fe]=n.useState(ar(r,"Combobox.Popover")),[Be,dt]=n.useState("mouse");n.useEffect(()=>{Pe(l?Ct(_,U):_)},[U,_]);const qe=V.useMultipleSelection({selectedItems:le,stateReducer:(p,{type:N,changes:g})=>{const I=V.useMultipleSelection.stateChangeTypes;switch(N){case I.SelectedItemKeyDownBackspace:case I.SelectedItemKeyDownDelete:{let q;return f(g.selectedItems||[]),N===I.SelectedItemKeyDownDelete?q=p?.activeIndex===g.selectedItems?.length?-1:p.activeIndex:q=(g?.activeIndex||0)-1>=0?p.activeIndex-1:g?.activeIndex,{...g,activeIndex:q}}case I.SelectedItemClick:return J.current&&J.current.focus(),{...g,activeIndex:-1};case I.FunctionRemoveSelectedItem:return{...g,activeIndex:-1};case I.DropdownKeyDownNavigationPrevious:return he.closeMenu(),g;default:return g}}}),$e=Array.from(K.values()),he=V.useCombobox({items:$e,selectedItem:_e,id:ut,labelId:B,inputValue:U,...T!=null&&{isOpen:T},onIsOpenChange:p=>{p.isOpen!=null&&A?.(p.isOpen)},initialIsOpen:H,...i&&{selectedItem:void 0},itemToString:p=>p?.text,isItemDisabled:p=>{const N=!!U&&!$e.some(g=>p.value===g.value);return p.disabled||N},onInputValueChange:({inputValue:p})=>{if(D(p),l){const N=Ct(_,p||"");Pe(N)}},stateReducer:i?Dr({multiselect:qe,selectedItems:le,allowCustomValue:o,setSelectedItems:f,triggerAreaRef:L}):Mr({allowCustomValue:o,setSelectedItem:Le,filteredItems:[...K.values()]})});n.useEffect(()=>{const p=tr(r),N=[..._.values()],g=[...p.values()];(N.length!==g.length||N.some((I,q)=>{const P=I.value!==g[q]?.value,ge=I.text!==g[q]?.text;return P||ge}))&&fe(p)},[r]);const[He,We]=be?[it.Popover,{open:!0}]:[n.Fragment,{}];return n.createElement(sr.Provider,{value:{itemsMap:_,filteredItemsMap:K,highlightedItem:Fr(K,he.highlightedIndex),multiple:i,disabled:De,readOnly:Me,hasPopover:be,setHasPopover:Fe,state:Ve,lastInteractionType:Be,setLastInteractionType:dt,wrap:y,innerInputRef:J,triggerAreaRef:L,...he,...qe,setInputValue:D,selectItem:Le,setSelectedItems:f,isLoading:W}},n.createElement(He,{...We},r))},F=()=>{const r=n.useContext(sr);if(!r)throw Error("useComboboxContext must be used within a Combobox provider");return r},ir=({children:r,...a})=>n.createElement(lr,{...a},r);ir.displayName="Combobox";const cr=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},c)=>n.createElement("svg",{ref:c,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteFill",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</title>`)+'<path fill-rule="evenodd" d="m2,12C2,6.48,6.48,2,12,2s10,4.48,10,10-4.48,10-10,10S2,17.52,2,12Zm7.75-3.67c-.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.41.39.39,1.02.39,1.41,0l2.23-2.23,2.23,2.23c.39.39,1.02.39,1.41,0s.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.23Z"/>'}}));cr.displayName="DeleteFill";const Et=n.forwardRef(({className:r,tabIndex:a=-1,onClick:o,...l},c)=>{const i=F();return n.createElement("button",{ref:c,className:k.cx(r,"h-sz-44 text-neutral hover:text-neutral-hovered"),tabIndex:a,onClick:d=>{d.stopPropagation(),i.multiple?i.setSelectedItems([]):i.selectItem(null),i.setInputValue(""),i.innerInputRef.current&&i.innerInputRef.current.focus(),o&&o(d)},type:"button",...l},n.createElement(we.Icon,{size:"sm"},n.createElement(cr,null)))});Et.displayName="Combobox.ClearButton";const ur=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},c)=>n.createElement("svg",{ref:c,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"ArrowHorizontalDown",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));ur.displayName="ArrowHorizontalDown";const Nt=n.forwardRef(({className:r,closedLabel:a,openedLabel:o,intent:l="neutral",design:c="ghost",size:i="sm",...d},y)=>{const x=F(),{ref:w,...j}=x.getToggleButtonProps({disabled:x.disabled||x.readOnly,onClick:A=>{A.stopPropagation()}}),T=j["aria-expanded"],H=ze.useMergeRefs(y,w);return n.createElement(zr.IconButton,{ref:H,className:k.cx(r,"mt-[calc((44px-32px)/2)]"),intent:l,design:c,size:i,...j,...d,"aria-label":T?o:a,disabled:x.disabled},n.createElement(we.Icon,null,n.createElement(we.Icon,{className:"shrink-0",size:"sm"},n.createElement(ur,null))))});Nt.displayName="Combobox.Disclosure";const Ot=n.forwardRef(({className:r},a)=>n.createElement("div",{ref:a,role:"separator",className:k.cx("my-md border-b-sm border-outline",r)}));Ot.displayName="Combobox.Divider";const St=n.forwardRef(({className:r,children:a},o)=>F().filteredItemsMap.size===0?n.createElement("div",{ref:o,className:r},a):null);St.displayName="Combobox.Empty";const dr=n.createContext(null),Br=({children:r})=>{const a=lt.useId();return n.createElement(dr.Provider,{value:{groupLabelId:a}},r)},mr=()=>{const r=n.useContext(dr);if(!r)throw Error("useComboboxGroupContext must be used within a ComboboxGroup provider");return r},jt=n.forwardRef(({children:r,...a},o)=>n.createElement(Br,null,n.createElement(qr,{ref:o,...a},r))),qr=n.forwardRef(({children:r,className:a},o)=>{const l=F(),c=mr();return n.Children.toArray(r).some(i=>n.isValidElement(i)&&l.filteredItemsMap.get(i.props.value))?n.createElement("div",{ref:o,role:"group","aria-labelledby":c.groupLabelId,className:k.cx(a)},r):null});jt.displayName="Combobox.Group";const Tt=n.forwardRef(({"aria-label":r,className:a,placeholder:o,...l},c)=>{const i=F();n.useEffect(()=>{!i.multiple&&i.selectedItem&&i.setInputValue(i.selectedItem.text)},[]);const[d,y]=i.hasPopover?[it.Popover.Trigger,{asChild:!0,type:void 0}]:[n.Fragment,{}],x=i.getDropdownProps(),w=ze.useMergeRefs(c,i.innerInputRef,x.ref),j=i.getInputProps({disabled:i.disabled||i.readOnly,...x,onKeyDown:T=>{x.onKeyDown?.(T),i.setLastInteractionType("keyboard")},ref:w});return n.createElement(n.Fragment,null,r&&n.createElement(Pr.VisuallyHidden,null,n.createElement("label",{...i.getLabelProps()},r)),n.createElement(d,{...y},n.createElement("input",{"data-spark-component":"combobox-input",type:"text",placeholder:o,className:k.cx("h-sz-28 shrink-0 flex-grow basis-[80px] text-ellipsis px-sm 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),...l,...j,value:i.inputValue,"aria-label":r,disabled:i.disabled,readOnly:i.readOnly})))});Tt.displayName="Combobox.Input";const pr=n.createContext(null),$r=({value:r,disabled:a=!1,children:o})=>{const l=F(),[c,i]=n.useState(void 0),d=function(w,j){let T=0;for(const[H]of w.entries()){if(H===j)return T;T++}return-1}(l.itemsMap,r),y={disabled:a,value:r,text:_t(o)},x=l.multiple?l.selectedItems.some(w=>w.value===r):l.selectedItem?.value===r;return n.createElement(pr.Provider,{value:{textId:c,setTextId:i,isSelected:x,itemData:y,index:d,disabled:a}},o)},kt=()=>{const r=n.useContext(pr);if(!r)throw Error("useComboboxItemContext must be used within a ComboboxItem provider");return r},Rt=n.forwardRef(({children:r,...a},o)=>{const{value:l,disabled:c}=a;return n.createElement($r,{value:l,disabled:c},n.createElement(Wr,{ref:o,...a},r))}),Hr=k.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"}]}),Wr=n.forwardRef(({className:r,disabled:a=!1,value:o,children:l},c)=>{const i=F(),d=kt(),y=!!i.filteredItemsMap.get(o),{ref:x,...w}=i.getItemProps({item:d.itemData,index:d.index}),j=ze.useMergeRefs(c,x);return y?n.createElement("li",{ref:j,className:k.cx(Hr({selected:d.isSelected,disabled:a,highlighted:i.highlightedItem?.value===o,interactionType:i.lastInteractionType,className:r})),key:o,...w,"aria-selected":d.isSelected,"aria-labelledby":d.textId},l):null});Rt.displayName="Combobox.Item";const fr=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},c)=>n.createElement("svg",{ref:c,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"Check",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));fr.displayName="Check";const zt=n.forwardRef(({className:r,children:a,label:o},l)=>{const{disabled:c,isSelected:i}=kt(),d=a||n.createElement(we.Icon,{size:"sm"},n.createElement(fr,{"aria-label":o}));return n.createElement("span",{ref:l,className:k.cx("flex min-h-sz-16 min-w-sz-16",c&&"opacity-dim-3",r)},i&&d)});zt.displayName="Combobox.ItemIndicator";const Pt=n.forwardRef(({children:r,className:a,...o},l)=>{const c=F(),{ref:i,...d}=c.getMenuProps({onMouseMove:()=>{c.setLastInteractionType("mouse")}}),y=ze.useMergeRefs(l,i),x=!c.hasPopover||c.isOpen;return console.log("isLoading",c.isLoading),n.createElement("ul",{ref:y,className:k.cx(a,"relative flex flex-col",x?"block":"pointer-events-none opacity-0",c.hasPopover&&"p-lg"),...o,...d,"aria-busy":c.isLoading,"data-spark-component":"combobox-items"},c.isLoading&&n.createElement(Ar.Spinner,{size:"sm",className:"absolute right-lg"}),r)});Pt.displayName="Combobox.Items";const At=n.forwardRef(({children:r},a)=>{const o=lt.useId(),{setTextId:l}=kt();return n.useEffect(()=>(l(o),()=>l(void 0))),n.createElement("span",{id:o,className:k.cx("inline"),ref:a},r)});At.displayName="Combobox.ItemText";const Lt=n.forwardRef(({children:r,className:a},o)=>{const l=mr();return n.createElement("div",{ref:o,id:l.groupLabelId,className:k.cx("px-md py-sm text-body-2 italic text-neutral",a)},r)});Lt.displayName="Combobox.Label";const Vt=({children:r})=>n.createElement(we.Icon,{size:"sm",className:"h-sz-44 shrink-0"},r);Vt.displayName="Combobox.LeadingIcon";const Dt=n.forwardRef(({children:r,matchTriggerWidth:a=!0,sideOffset:o=4,className:l,...c},i)=>{const d=F();return n.useEffect(()=>(d.setHasPopover(!0),()=>d.setHasPopover(!1)),[]),n.createElement(it.Popover.Content,{ref:i,inset:!0,asChild:!0,matchTriggerWidth:a,className:k.cx("!z-dropdown",!d.isOpen&&"hidden",l),sideOffset:o,onOpenAutoFocus:y=>{y.preventDefault()},...c,"data-spark-component":"combobox-popover"},r)});Dt.displayName="Combobox.Popover";const br=n.forwardRef(({title:r,fill:a="currentColor",stroke:o="none",...l},c)=>n.createElement("svg",{ref:c,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"DeleteOutline",...r&&{"data-title":r},fill:a,stroke:o,...l,dangerouslySetInnerHTML:{__html:(r===void 0?"":`<title>${r}</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"/>'}}));br.displayName="DeleteOutline";const Mt=()=>{const r=F();if(!r.selectedItems.length)return null;const a=!r.disabled&&!r.readOnly;return n.createElement(n.Fragment,null,r.selectedItems.map((o,l)=>{const c=r.getSelectedItemProps({disabled:r.disabled||r.readOnly,selectedItem:o,index:l});return n.createElement("span",{role:"presentation","data-spark-component":"combobox-selected-item",key:`selected-item-${l}`,className:k.cx("flex h-sz-28 items-center rounded-md bg-neutral-container align-middle","text-body-2 text-on-neutral-container",{"px-md":!a,"pl-md":a}),...c,tabIndex:-1,onFocus:i=>{const d=i.target;r.lastInteractionType==="keyboard"&&d.scrollIntoView({behavior:"instant",block:"nearest",inline:"nearest"})}},n.createElement("span",{className:k.cx("line-clamp-1 overflow-x-hidden text-ellipsis break-all leading-normal",{"w-max":!r.wrap})},o.text),r.disabled,a&&n.createElement("button",{type:"button",tabIndex:-1,"aria-hidden":!0,className:"h-full cursor-pointer px-md",onClick:i=>{i.stopPropagation();const d=r.selectedItems.filter(y=>y.value!==o.value);r.setSelectedItems(d),r.innerInputRef.current&&r.innerInputRef.current.focus({preventScroll:!0})}},n.createElement(we.Icon,{size:"sm"},n.createElement(br,null))))}))};Mt.displayName="Combobox.SelectedItems";const Kr=k.cva(["flex items-start gap-md min-h-sz-44","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}}),Ft=n.forwardRef(({className:r,children:a},o)=>{const l=F(),c=nr.useFormFieldControl(),i=Re(a,"Combobox.LeadingIcon"),d=Re(a,"Combobox.SelectedItems"),y=Re(a,"Combobox.Input"),x=Re(a,"Combobox.ClearButton"),w=Re(a,"Combobox.Disclosure"),[j,T]=l.hasPopover?[it.Popover.Anchor,{asChild:!0,type:void 0}]:[n.Fragment,{}],H=ze.useMergeRefs(o,l.triggerAreaRef),A=n.useRef(null),W=c.disabled||l.disabled,G=c.readOnly||l.readOnly,U=!!x&&!W&&!G,D=()=>{if(A.current&&!l.wrap){const{scrollWidth:L,clientWidth:J}=A.current;A.current.scrollLeft=L-J}};return((L,J)=>{const R=n.useRef(null);n.useEffect(()=>{const _=()=>{const K=L.current?.scrollWidth||null;R.current&&K&&K>R.current&&J(),R.current=K,requestAnimationFrame(_)},fe=requestAnimationFrame(_);return()=>cancelAnimationFrame(fe)},[L])})(A,D),n.useEffect(()=>{const L=new ResizeObserver(D);return A.current&&L.observe(A.current),()=>{L.disconnect()}},[]),n.createElement(n.Fragment,null,n.createElement(j,{...T},n.createElement("div",{ref:H,className:Kr({className:r,state:l.state,disabled:W,readOnly:G,allowWrap:l.wrap}),onClick:()=>{l.isOpen||W||G||(l.openMenu(),l.innerInputRef.current&&l.innerInputRef.current.focus())}},i,n.createElement("div",{ref:A,className:k.cx("inline-flex grow items-start gap-sm py-md",l.wrap?"flex-wrap":"overflow-x-auto p-[2px] u-no-scrollbar")},d,y),U&&x,w)))});Ft.displayName="Combobox.Trigger";const rr=Object.assign(ir,{Group:jt,Item:Rt,Items:Pt,ItemText:At,ItemIndicator:zt,Label:Lt,Popover:Dt,Divider:Ot,Trigger:Ft,LeadingIcon:Vt,Empty:St,Input:Tt,Disclosure:Nt,SelectedItems:Mt,ClearButton:Et});rr.displayName="Combobox",jt.displayName="Combobox.Group",Pt.displayName="Combobox.Items",Rt.displayName="Combobox.Item",At.displayName="Combobox.ItemText",zt.displayName="Combobox.ItemIndicator",Lt.displayName="Combobox.Label",Dt.displayName="Combobox.Popover",Ot.displayName="Combobox.Divider",Ft.displayName="Combobox.Trigger",Vt.displayName="Combobox.LeadingIcon",St.displayName="Combobox.Empty",Tt.displayName="Combobox.Input",Nt.displayName="Combobox.Disclosure",Mt.displayName="Combobox.SelectedItems",Et.displayName="Combobox.ClearButton",exports.Combobox=rr,exports.ComboboxProvider=lr,exports.useComboboxContext=F; |
{ | ||
"name": "@spark-ui/combobox", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "An input that behaves similarly to a select, with the addition of a free text input to filter options.", | ||
@@ -37,2 +37,3 @@ "publishConfig": { | ||
"@spark-ui/popover": "^1.5.5", | ||
"@spark-ui/spinner": "^2.2.2", | ||
"@spark-ui/use-merge-refs": "^0.4.0", | ||
@@ -57,3 +58,3 @@ "@spark-ui/visually-hidden": "^1.2.0", | ||
"license": "MIT", | ||
"gitHead": "d398dea24732ae61d23de3a0e96d7dd5d78edc8d" | ||
"gitHead": "680805136099ce43a2b4ae29980eed38c2df09d9" | ||
} |
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
496751
12044
14
+ Added@spark-ui/spinner@^2.2.2