diff --git a/.github/workflows/jest.yml b/.github/workflows/jest.yml new file mode 100644 index 00000000..7161e94d --- /dev/null +++ b/.github/workflows/jest.yml @@ -0,0 +1,27 @@ +name: 'Jest unit tests' +on: + push: + paths-ignore: + - '**/dist/**' + - '**/*.md' + - '.github/**' + - '.vscode/**' + pull_request: + branches: + - develop + paths-ignore: + - '**/dist/**' + - '**/*.md' + - '.github/**' + - '.vscode/**' +jobs: + jest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '21.5.0' + cache: 'npm' + - run: npm ci + - run: npm run test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..581edad3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +**/dist diff --git a/README.md b/README.md index 39fc21eb..262c62ef 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Advanced select dropdown [![NPM Downloads](https://img.shields.io/npm/dt/slim-select.svg)](https://www.npmjs.com/package/slim-select) +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/brianvoe/slim-select/jest.yml?logo=jest&label=unit%20tests) ## Support @@ -133,6 +134,7 @@ new SlimSelect({ disabled: false, alwaysOpen: false, showSearch: true, + focusSearch: true, searchPlaceholder: 'Search', searchText: 'No Results', searchingText: 'Searching...', diff --git a/docs/assets/home.css b/docs/assets/home.css index f1d162a3..29572f0d 100644 --- a/docs/assets/home.css +++ b/docs/assets/home.css @@ -1 +1 @@ -#home .samples{display:flex;justify-content:space-between;gap:var(--spacing)}#home .samples .single,#home .samples .multi{flex:1 1 50%}#home .support .links{display:flex;height:50px;flex-direction:row;gap:var(--spacing);overflow:hidden}#home .support .links .github-sponsor{height:100%;width:200px;border:0;color-scheme:dark}#home .support .links .buycoffee img{height:100%;width:auto}#home .ads{display:flex;flex-direction:row;gap:var(--spacing-half)}#home .features{flex:1 1 auto;display:flex;flex-direction:column}#home .features .header{padding:0 0 var(--spacing) 0}#home .features .row{justify-content:space-around}#home .features .row .list{display:flex;flex-direction:column;list-style:none;padding:0;width:200px;margin:0 auto}#home .features .row .list li{display:flex;align-items:center;padding:0 0 5px;font-weight:700;font-size:20px}#home .features .row .list li img{width:20px;padding:0 8px 0 0} +#home .samples{display:flex;justify-content:space-between;gap:var(--spacing)}#home .samples .single,#home .samples .multi{flex:1 1 50%}#home .support .links{display:flex;height:50px;flex-direction:row;gap:var(--spacing);overflow:hidden}#home .support .links .github-sponsor{height:100%;width:200px;border:0;color-scheme:dark}#home .support .links .buycoffee img{height:100%;width:auto}#home .ads{display:flex;flex-direction:row;gap:var(--spacing-half)}#home .features{flex:1 1 auto;display:flex;flex-direction:column}#home .features .header{padding:0 0 var(--spacing) 0}#home .features .row{justify-content:space-around}#home .features .row .list{display:flex;flex-direction:column;list-style:none;padding:0;width:200px;margin:0 auto}#home .features .row .list li{display:flex;align-items:center;padding:0 0 5px;font-weight:700;font-size:20px}#home .features .row .list li img{width:20px;padding:0 8px 0 0}#home .frameworks .framework-items{display:flex;flex-direction:row} diff --git a/docs/assets/home.js b/docs/assets/home.js index ba3e32b8..4ad0e42b 100644 --- a/docs/assets/home.js +++ b/docs/assets/home.js @@ -1 +1 @@ -import{d as o,S as t,_ as c,r as a,o as n,c as r,a as e,b as h,w as d,e as m,f as i}from"./index.js";const p=o({name:"Home",data(){return{single:null,multiple:null}},mounted(){this.single=new t({select:this.$refs.slimSingle}),this.multiple=new t({select:this.$refs.slimMulti}),setTimeout(()=>{this.single&&this.single.open(),setTimeout(()=>{this.single&&this.single.setSelected("best")},500),setTimeout(()=>{this.single&&this.single.setSelected("select")},1e3),setTimeout(()=>{this.single&&this.single.setSelected("ever")},1500),setTimeout(()=>{this.single&&this.single.close()},2e3),this.multiple&&this.multiple.open(),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best"])},500),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best","select"])},1e3),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best","select","ever"])},1500),setTimeout(()=>{this.multiple&&this.multiple.close()},2e3)},500)},unmounted(){this.single&&this.single.destroy(),this.multiple&&this.multiple.destroy()}}),s="data:image/svg+xml,%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20width='45.701px'%20height='45.7px'%20viewBox='0%200%2045.701%2045.7'%20style='enable-background:new%200%200%2045.701%2045.7;'%20xml:space='preserve'%3e%3cpath%20fill='%235897fb'%20d='M20.687,38.332c-2.072,2.072-5.434,2.072-7.505,0L1.554,26.704c-2.072-2.071-2.072-5.433,0-7.504%20c2.071-2.072,5.433-2.072,7.505,0l6.928,6.927c0.523,0.522,1.372,0.522,1.896,0L36.642,7.368c2.071-2.072,5.433-2.072,7.505,0%20c0.995,0.995,1.554,2.345,1.554,3.752c0,1.407-0.559,2.757-1.554,3.752L20.687,38.332z'/%3e%3c/svg%3e",u={id:"home",class:"content"},_={class:"samples row"},g={class:"single"},f=e("h2",{id:"sample-select-header"},"Single Select",-1),v={ref:"slimSingle","aria-labelledby":"sample-select-header"},b=e("option",{"data-placeholder":"true"},null,-1),w=e("option",{value:"best"},"Best",-1),S=e("option",{value:"select"},"Select",-1),k=e("option",{value:"ever"},"Ever",-1),x=[b,w,S,k],y={class:"multi"},T=e("h2",null,"Multi Select",-1),L={ref:"slimMulti",multiple:""},C=e("option",{value:"best"},"Best",-1),B=e("option",{value:"select"},"Select",-1),M=e("option",{value:"ever"},"Ever",-1),H=[C,B,M],$=m('

Support

Help support creators that make development easier!



Features



',9),N={class:"frameworks"},z=e("h2",{class:"header"},"Frameworks",-1),A=e("p",null,[i(" SlimSelect is in the process of adding a few framework integrations."),e("br"),i(" If you are an expert in any specific framework and would like to help out, please reach out! ")],-1),E={class:"row frameworks"},V=e("svg",{viewBox:"0 0 128 128",width:"100",height:"100"},[e("path",{fill:"#42b883",d:"M78.8,10L64,35.4L49.2,10H0l64,110l64-110C128,10,78.8,10,78.8,10z"}),e("path",{fill:"#35495e",d:"M78.8,10L64,35.4L49.2,10H25.6L64,76l38.4-66H78.8z"})],-1);function D(O,F,I,P,j,q){const l=a("router-link");return n(),r("div",u,[e("div",_,[e("div",g,[f,e("select",v,x,512)]),e("div",y,[T,e("select",L,H,512)])]),$,e("div",N,[z,A,e("div",E,[h(l,{to:"frameworks#vue"},{default:d(()=>[V]),_:1})])])])}const J=c(p,[["render",D]]);export{J as default}; +import{d as c,S as t,_ as n,r as a,o as r,c as d,a as e,b as h,w as m,e as p,f as i}from"./index.js";const u=c({name:"Home",data(){return{single:null,multiple:null}},mounted(){this.single=new t({select:this.$refs.slimSingle}),this.multiple=new t({select:this.$refs.slimMulti}),setTimeout(()=>{this.single&&this.single.open(),setTimeout(()=>{this.single&&this.single.setSelected("best")},500),setTimeout(()=>{this.single&&this.single.setSelected("select")},1e3),setTimeout(()=>{this.single&&this.single.setSelected("ever")},1500),setTimeout(()=>{this.single&&this.single.close()},2e3),this.multiple&&this.multiple.open(),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best"])},500),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best","select"])},1e3),setTimeout(()=>{this.multiple&&this.multiple.setSelected(["best","select","ever"])},1500),setTimeout(()=>{this.multiple&&this.multiple.close()},2e3)},500)},unmounted(){this.single&&this.single.destroy(),this.multiple&&this.multiple.destroy()},methods:{handleClick(){window.dispatchEvent(new Event("nav-updated"))}}}),s="data:image/svg+xml,%3csvg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20x='0px'%20y='0px'%20width='45.701px'%20height='45.7px'%20viewBox='0%200%2045.701%2045.7'%20style='enable-background:new%200%200%2045.701%2045.7;'%20xml:space='preserve'%3e%3cpath%20fill='%235897fb'%20d='M20.687,38.332c-2.072,2.072-5.434,2.072-7.505,0L1.554,26.704c-2.072-2.071-2.072-5.433,0-7.504%20c2.071-2.072,5.433-2.072,7.505,0l6.928,6.927c0.523,0.522,1.372,0.522,1.896,0L36.642,7.368c2.071-2.072,5.433-2.072,7.505,0%20c0.995,0.995,1.554,2.345,1.554,3.752c0,1.407-0.559,2.757-1.554,3.752L20.687,38.332z'/%3e%3c/svg%3e",_={id:"home",class:"content"},g={class:"samples row"},f={class:"single"},v=e("h2",{id:"sample-select-header"},"Single Select",-1),b={ref:"slimSingle","aria-labelledby":"sample-select-header"},w=e("option",{"data-placeholder":"true"},null,-1),S=e("option",{value:"best"},"Best",-1),k=e("option",{value:"select"},"Select",-1),x=e("option",{value:"ever"},"Ever",-1),y=[w,S,k,x],C={class:"multi"},T=e("h2",null,"Multi Select",-1),L={ref:"slimMulti",multiple:""},B=e("option",{value:"best"},"Best",-1),M=e("option",{value:"select"},"Select",-1),E=e("option",{value:"ever"},"Ever",-1),H=[B,M,E],$=p('

Support

Help support creators that make development easier!



Features



',9),N={class:"frameworks"},z=e("h2",{class:"header"},"Frameworks",-1),A=e("p",null,[i(" SlimSelect is in the process of adding a few framework integrations."),e("br"),i(" If you are an expert in any specific framework and would like to help out, please reach out! ")],-1),V={class:"framework-items"},D=e("svg",{viewBox:"0 0 128 128",width:"100",height:"100"},[e("path",{fill:"#42b883",d:"M78.8,10L64,35.4L49.2,10H0l64,110l64-110C128,10,78.8,10,78.8,10z"}),e("path",{fill:"#35495e",d:"M78.8,10L64,35.4L49.2,10H25.6L64,76l38.4-66H78.8z"})],-1);function O(l,F,I,P,j,q){const o=a("router-link");return r(),d("div",_,[e("div",g,[e("div",f,[v,e("select",b,y,512)]),e("div",C,[T,e("select",L,H,512)])]),$,e("div",N,[z,A,e("div",V,[h(o,{to:"/vue",onClick:l.handleClick},{default:m(()=>[D]),_:1},8,["onClick"])])])])}const J=n(u,[["render",O]]);export{J as default}; diff --git a/docs/assets/index.js b/docs/assets/index.js index db047fd8..d7d125a1 100644 --- a/docs/assets/index.js +++ b/docs/assets/index.js @@ -45,6 +45,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + */var tp=nt,mt=v1;function F(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),la=Object.prototype.hasOwnProperty,y1=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,yf={},wf={};function w1(e){return la.call(wf,e)?!0:la.call(yf,e)?!1:y1.test(e)?wf[e]=!0:(yf[e]=!0,!1)}function S1(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function x1(e,t,n,r){if(t===null||typeof t>"u"||S1(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qe(e,t,n,r,s,l,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=i}var Be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Be[e]=new qe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Be[t]=new qe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Be[e]=new qe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Be[e]=new qe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Be[e]=new qe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Be[e]=new qe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Be[e]=new qe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Be[e]=new qe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Be[e]=new qe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Au=/[\-:]([a-z])/g;function Ou(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Au,Ou);Be[t]=new qe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!1,!1)});Be.xlinkHref=new qe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Be[e]=new qe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Pu(e,t,n,r){var s=Be.hasOwnProperty(t)?Be[t]:null;(s!==null?s.type!==0:r||!(2_r||(e.current=Ra[_r],Ra[_r]=null,_r--)}function he(e,t){_r++,Ra[_r]=e.current,e.current=t}var Un={},Ke=Hn(Un),lt=Hn(!1),sr=Un;function Qr(e,t){var n=e.type.contextTypes;if(!n)return Un;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},l;for(l in n)s[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function it(e){return e=e.childContextTypes,e!=null}function ci(){me(lt),me(Ke)}function Gf(e,t,n){if(Ke.current!==Un)throw Error(F(168));he(Ke,t),he(lt,n)}function Zp(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(F(108,_1(e)||"Unknown",s));return Ce({},n,r)}function fi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Un,sr=Ke.current,he(Ke,e),he(lt,lt.current),!0}function Yf(e,t,n){var r=e.stateNode;if(!r)throw Error(F(169));n?(e=Zp(e,t,sr),r.__reactInternalMemoizedMergedChildContext=e,me(lt),me(Ke),he(Ke,e)):me(lt),he(lt,n)}var nn=null,Qi=!1,No=!1;function Jp(e){nn===null?nn=[e]:nn.push(e)}function Bw(e){Qi=!0,Jp(e)}function $n(){if(!No&&nn!==null){No=!0;var e=0,t=fe;try{var n=nn;for(fe=1;e>=i,s-=i,sn=1<<32-Dt(t)+s|n<R?(D=k,k=null):D=k.sibling;var U=p(m,k,h[R],y);if(U===null){k===null&&(k=D);break}e&&k&&U.alternate===null&&t(m,k),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U,k=D}if(R===h.length)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;RR?(D=k,k=null):D=k.sibling;var ee=p(m,k,U.value,y);if(ee===null){k===null&&(k=D);break}e&&k&&ee.alternate===null&&t(m,k),f=l(ee,f,R),C===null?S=ee:C.sibling=ee,C=ee,k=D}if(U.done)return n(m,k),we&&Kn(m,R),S;if(k===null){for(;!U.done;R++,U=h.next())U=d(m,U.value,y),U!==null&&(f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return we&&Kn(m,R),S}for(k=r(m,k);!U.done;R++,U=h.next())U=w(k,m,R,U.value,y),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?R:U.key),f=l(U,f,R),C===null?S=U:C.sibling=U,C=U);return e&&k.forEach(function(ke){return t(m,ke)}),we&&Kn(m,R),S}function L(m,f,h,y){if(typeof h=="object"&&h!==null&&h.type===yr&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case pl:e:{for(var S=h.key,C=f;C!==null;){if(C.key===S){if(S=h.type,S===yr){if(C.tag===7){n(m,C.sibling),f=s(C,h.props.children),f.return=m,m=f;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===En&&nd(S)===C.type){n(m,C.sibling),f=s(C,h.props),f.ref=fs(m,C,h),f.return=m,m=f;break e}n(m,C);break}else t(m,C);C=C.sibling}h.type===yr?(f=rr(h.props.children,m.mode,y,h.key),f.return=m,m=f):(y=Kl(h.type,h.key,h.props,null,m.mode,y),y.ref=fs(m,f,h),y.return=m,m=y)}return i(m);case vr:e:{for(C=h.key;f!==null;){if(f.key===C)if(f.tag===4&&f.stateNode.containerInfo===h.containerInfo&&f.stateNode.implementation===h.implementation){n(m,f.sibling),f=s(f,h.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=Bo(h,m.mode,y),f.return=m,m=f}return i(m);case En:return C=h._init,L(m,f,C(h._payload),y)}if(gs(h))return x(m,f,h,y);if(is(h))return _(m,f,h,y);kl(m,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,f!==null&&f.tag===6?(n(m,f.sibling),f=s(f,h),f.return=m,m=f):(n(m,f),f=zo(h,m.mode,y),f.return=m,m=f),i(m)):n(m,f)}return L}var Gr=lm(!0),im=lm(!1),il={},Zt=Hn(il),Zs=Hn(il),Js=Hn(il);function Xn(e){if(e===il)throw Error(F(174));return e}function Zu(e,t){switch(he(Js,t),he(Zs,e),he(Zt,il),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:pa(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=pa(t,e)}me(Zt),he(Zt,t)}function Yr(){me(Zt),me(Zs),me(Js)}function om(e){Xn(Js.current);var t=Xn(Zt.current),n=pa(t,e.type);t!==n&&(he(Zs,e),he(Zt,n))}function Ju(e){Zs.current===e&&(me(Zt),me(Zs))}var Ee=Hn(0);function vi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Mo=[];function Xu(){for(var e=0;en?n:4,e(!0);var r=Fo.transition;Fo.transition={};try{e(!1),t()}finally{fe=n,Fo.transition=r}}function _m(){return kt().memoizedState}function $w(e,t,n){var r=Dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cm(e))km(t,n);else if(n=tm(e,t,n,r),n!==null){var s=Je();bt(n,e,r,s),Am(n,t,r)}}function Ww(e,t,n){var r=Dn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cm(e))km(t,s);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var i=t.lastRenderedState,o=l(i,n);if(s.hasEagerState=!0,s.eagerState=o,zt(o,i)){var a=t.interleaved;a===null?(s.next=s,Gu(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=tm(e,t,s,r),n!==null&&(s=Je(),bt(n,e,r,s),Am(n,t,r))}}function Cm(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function km(e,t){Ts=yi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Am(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fu(e,n)}}var wi={readContext:Ct,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useInsertionEffect:Ue,useLayoutEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useMutableSource:Ue,useSyncExternalStore:Ue,useId:Ue,unstable_isNewReconciler:!1},Qw={readContext:Ct,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:sd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hl(4194308,4,ym.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hl(4,2,e,t)},useMemo:function(e,t){var n=Wt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Wt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=$w.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:rd,useDebugValue:rc,useDeferredValue:function(e){return Wt().memoizedState=e},useTransition:function(){var e=rd(!1),t=e[0];return e=Hw.bind(null,e[1]),Wt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=_e,s=Wt();if(we){if(n===void 0)throw Error(F(407));n=n()}else{if(n=t(),Ie===null)throw Error(F(349));ir&30||cm(r,t,n)}s.memoizedState=n;var l={value:n,getSnapshot:t};return s.queue=l,sd(dm.bind(null,r,l,e),[e]),r.flags|=2048,el(9,fm.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Wt(),t=Ie.identifierPrefix;if(we){var n=ln,r=sn;n=(r&~(1<<32-Dt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Xs++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Gt]=t,e[Ys]=r,Im(e,t,!1,!1),t.stateNode=e;e:{switch(i=ga(n,r),n){case"dialog":pe("cancel",e),pe("close",e),s=r;break;case"iframe":case"object":case"embed":pe("load",e),s=r;break;case"video":case"audio":for(s=0;sJr&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304)}else{if(!r)if(e=vi(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ds(l,!0),l.tail===null&&l.tailMode==="hidden"&&!i.alternate&&!we)return Ve(t),null}else 2*Oe()-l.renderingStartTime>Jr&&n!==1073741824&&(t.flags|=128,r=!0,ds(l,!1),t.lanes=4194304);l.isBackwards?(i.sibling=t.child,t.child=i):(n=l.last,n!==null?n.sibling=i:t.child=i,l.last=i)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Oe(),t.sibling=null,n=Ee.current,he(Ee,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return uc(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function eS(e,t){switch(Hu(t),t.tag){case 1:return it(t.type)&&ci(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yr(),me(lt),me(Ke),Xu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ju(t),null;case 13:if(me(Ee),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));Kr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(Ee),null;case 4:return Yr(),null;case 10:return Ku(t.type._context),null;case 22:case 23:return uc(),null;case 24:return null;default:return null}}var Ol=!1,$e=!1,tS=typeof WeakSet=="function"?WeakSet:Set,$=null;function Or(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ae(e,t,r)}else n.current=null}function Ha(e,t,n){try{n()}catch(r){Ae(e,t,r)}}var hd=!1;function nS(e,t){if(Aa=ii,e=Up(),Uu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var i=0,o=-1,a=-1,u=0,c=0,d=e,p=null;t:for(;;){for(var w;d!==n||s!==0&&d.nodeType!==3||(o=i+s),d!==l||r!==0&&d.nodeType!==3||(a=i+r),d.nodeType===3&&(i+=d.nodeValue.length),(w=d.firstChild)!==null;)p=d,d=w;for(;;){if(d===e)break t;if(p===n&&++u===s&&(o=i),p===l&&++c===r&&(a=i),(w=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=w}n=o===-1||a===-1?null:{start:o,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oa={focusedElem:e,selectionRange:n},ii=!1,$=t;$!==null;)if(t=$,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$=e;else for(;$!==null;){t=$;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var _=x.memoizedProps,L=x.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?_:Tt(t.type,_),L);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(y){Ae(t,t.return,y)}if(e=t.sibling,e!==null){e.return=t.return,$=e;break}$=t.return}return x=hd,hd=!1,x}function Rs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var l=s.destroy;s.destroy=void 0,l!==void 0&&Ha(t,n,l)}s=s.next}while(s!==r)}}function Yi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $a(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function jm(e){var t=e.alternate;t!==null&&(e.alternate=null,jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Gt],delete t[Ys],delete t[Ta],delete t[jw],delete t[zw])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zm(e){return e.tag===5||e.tag===3||e.tag===4}function pd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(Wa(e,t,n),e=e.sibling;e!==null;)Wa(e,t,n),e=e.sibling}function Qa(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qa(e,t,n),e=e.sibling;e!==null;)Qa(e,t,n),e=e.sibling}var De=null,Rt=!1;function yn(e,t,n){for(n=n.child;n!==null;)Bm(e,t,n),n=n.sibling}function Bm(e,t,n){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(Ui,n)}catch{}switch(n.tag){case 5:$e||Or(n,t);case 6:var r=De,s=Rt;De=null,yn(e,t,n),De=r,Rt=s,De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):De.removeChild(n.stateNode));break;case 18:De!==null&&(Rt?(e=De,n=n.stateNode,e.nodeType===8?Ro(e.parentNode,n):e.nodeType===1&&Ro(e,n),$s(e)):Ro(De,n.stateNode));break;case 4:r=De,s=Rt,De=n.stateNode.containerInfo,Rt=!0,yn(e,t,n),De=r,Rt=s;break;case 0:case 11:case 14:case 15:if(!$e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var l=s,i=l.destroy;l=l.tag,i!==void 0&&(l&2||l&4)&&Ha(n,t,i),s=s.next}while(s!==r)}yn(e,t,n);break;case 1:if(!$e&&(Or(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Ae(n,t,o)}yn(e,t,n);break;case 21:yn(e,t,n);break;case 22:n.mode&1?($e=(r=$e)||n.memoizedState!==null,yn(e,t,n),$e=r):yn(e,t,n);break;default:yn(e,t,n)}}function md(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new tS),t.forEach(function(r){var s=fS.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Pt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=i),r&=~l}if(r=s,r=Oe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sS(r/1960))-r,10e?16:e,On===null)var r=!1;else{if(e=On,On=null,Ei=0,oe&6)throw Error(F(331));var s=oe;for(oe|=4,$=e.current;$!==null;){var l=$,i=l.child;if($.flags&16){var o=l.deletions;if(o!==null){for(var a=0;aOe()-oc?nr(e,0):ic|=n),ot(e,t)}function Gm(e,t){t===0&&(e.mode&1?(t=yl,yl<<=1,!(yl&130023424)&&(yl=4194304)):t=1);var n=Je();e=dn(e,t),e!==null&&(rl(e,t,n),ot(e,n))}function cS(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gm(e,n)}function fS(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(t),Gm(e,n)}var Ym;Ym=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||lt.current)st=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return st=!1,Xw(e,t,n);st=!!(e.flags&131072)}else st=!1,we&&t.flags&1048576&&Xp(t,hi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$l(e,t),e=t.pendingProps;var s=Qr(t,Ke.current);jr(t,n),s=ec(null,t,r,e,s,n);var l=tc();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,it(r)?(l=!0,fi(t)):l=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yu(t),s.updater=Ki,t.stateNode=s,s._reactInternals=t,Da(t,r,e,n),t=za(null,t,r,!0,l,n)):(t.tag=0,we&&l&&Vu(t),Ye(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch($l(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=hS(r),e=Tt(r,e),s){case 0:t=ja(null,t,r,e,n);break e;case 1:t=cd(null,t,r,e,n);break e;case 11:t=ad(null,t,r,e,n);break e;case 14:t=ud(null,t,r,Tt(r.type,e),n);break e}throw Error(F(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ja(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),cd(e,t,r,s,n);case 3:e:{if(Nm(t),e===null)throw Error(F(387));r=t.pendingProps,l=t.memoizedState,s=l.element,nm(e,t),gi(t,r,null,n);var i=t.memoizedState;if(r=i.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){s=Zr(Error(F(423)),t),t=fd(e,t,r,n,s);break e}else if(r!==s){s=Zr(Error(F(424)),t),t=fd(e,t,r,n,s);break e}else for(ht=Mn(t.stateNode.containerInfo.firstChild),pt=t,we=!0,Nt=null,n=im(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Kr(),r===s){t=hn(e,t,n);break e}Ye(e,t,r,n)}t=t.child}return t;case 5:return om(t),e===null&&Ma(t),r=t.type,s=t.pendingProps,l=e!==null?e.memoizedProps:null,i=s.children,Pa(r,s)?i=null:l!==null&&Pa(r,l)&&(t.flags|=32),Rm(e,t),Ye(e,t,i,n),t.child;case 6:return e===null&&Ma(t),null;case 13:return Mm(e,t,n);case 4:return Zu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gr(t,null,r,n):Ye(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),ad(e,t,r,s,n);case 7:return Ye(e,t,t.pendingProps,n),t.child;case 8:return Ye(e,t,t.pendingProps.children,n),t.child;case 12:return Ye(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,l=t.memoizedProps,i=s.value,he(pi,r._currentValue),r._currentValue=i,l!==null)if(zt(l.value,i)){if(l.children===s.children&&!lt.current){t=hn(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var o=l.dependencies;if(o!==null){i=l.child;for(var a=o.firstContext;a!==null;){if(a.context===r){if(l.tag===1){a=un(-1,n&-n),a.tag=2;var u=l.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),Fa(l.return,n,t),o.lanes|=n;break}a=a.next}}else if(l.tag===10)i=l.type===t.type?null:l.child;else if(l.tag===18){if(i=l.return,i===null)throw Error(F(341));i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),Fa(i,n,t),i=l.sibling}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===t){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}Ye(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,jr(t,n),s=Ct(s),r=r(s),t.flags|=1,Ye(e,t,r,n),t.child;case 14:return r=t.type,s=Tt(r,t.pendingProps),s=Tt(r.type,s),ud(e,t,r,s,n);case 15:return Lm(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Tt(r,s),$l(e,t),t.tag=1,it(r)?(e=!0,fi(t)):e=!1,jr(t,n),sm(t,r,s),Da(t,r,s,n),za(null,t,r,!0,e,n);case 19:return Fm(e,t,n);case 22:return Tm(e,t,n)}throw Error(F(156,t.tag))};function Zm(e,t){return Ep(e,t)}function dS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Et(e,t,n,r){return new dS(e,t,n,r)}function fc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hS(e){if(typeof e=="function")return fc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Tu)return 11;if(e===Ru)return 14}return 2}function bn(e,t){var n=e.alternate;return n===null?(n=Et(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,s,l){var i=2;if(r=e,typeof e=="function")fc(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case yr:return rr(n.children,s,l,t);case Lu:i=8,s|=8;break;case ia:return e=Et(12,n,t,s|2),e.elementType=ia,e.lanes=l,e;case oa:return e=Et(13,n,t,s),e.elementType=oa,e.lanes=l,e;case aa:return e=Et(19,n,t,s),e.elementType=aa,e.lanes=l,e;case lp:return Ji(n,s,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case rp:i=10;break e;case sp:i=9;break e;case Tu:i=11;break e;case Ru:i=14;break e;case En:i=16,r=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=Et(i,n,t,s),t.elementType=e,t.type=r,t.lanes=l,t}function rr(e,t,n,r){return e=Et(7,e,r,t),e.lanes=n,e}function Ji(e,t,n,r){return e=Et(22,e,r,t),e.elementType=lp,e.lanes=n,e.stateNode={isHidden:!1},e}function zo(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function Bo(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pS(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=So(0),this.expirationTimes=So(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=So(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dc(e,t,n,r,s,l,i,o,a){return e=new pS(e,t,n,o,a),t===1?(t=1,l===!0&&(t|=8)):t=0,l=Et(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yu(l),e}function mS(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eg)}catch(e){console.error(e)}}eg(),Xh.exports=gt;var SS=Xh.exports,_d=SS;sa.createRoot=_d.createRoot,sa.hydrateRoot=_d.hydrateRoot;const xS=(e,t)=>{const{id:n=void 0,modelValue:r,style:s={},multiple:l=!1,data:i,settings:o,events:a,children:u}=e,c=nt.useRef(null),d=nt.useRef(),p=nt.useRef();nt.useEffect(()=>{const x={select:c.current,events:{}};i&&(x.data=i),o&&(x.settings=o),a&&(x.events=a),x.events==null&&(x.events={});const _=x.events.afterChange;return x.events.afterChange=function(m){if(Array.isArray(m)&&m.length>0){const f=l?m.map(h=>h.value):m[0].value;p.current!==f&&(p.current=f),x.events&&_&&typeof _=="function"&&_(m)}},d.current=new zh(x),(l?d.current.getSelected():d.current.getSelected()[0])!==r&&r&&d.current.setSelected(r),()=>{var m;d.current&&((m=d.current)==null||m.destroy())}},[r,l,i,o,a,u]);const w=nt.useCallback(x=>{const _=l;return typeof x=="string"?_?[x]:x:Array.isArray(x)?_?x:x[0]:_?[]:""},[l]);return nt.useEffect(()=>{var x;r&&((x=d.current)==null||x.setSelected(w(r)))},[r,w]),nt.useEffect(()=>{var x;i&&((x=d.current)==null||x.setData(i))},[i]),nt.useImperativeHandle(t,()=>({set(x){var _;(_=d.current)==null||_.setSelected(x)},getSlimSelectInstance(){return d.current}}),[]),z.jsx(z.Fragment,{children:z.jsx("select",{style:s,id:n,"data-testid":n,multiple:l,ref:c,children:u})})},Uo=nt.forwardRef(xS),ES=()=>{const[e,t]=nt.useState("2"),[n,r]=nt.useState(["2","3"]);return z.jsxs("div",{id:"react",className:"content",children:[z.jsx("h2",{className:"header",children:"React"}),z.jsx("h3",{children:"Install"}),z.jsx("p",{children:"The react component is in a sub package under SlimSelect. All functionality still work in the implementation."}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-bash",children:z.jsx("code",{children:"npm install @slim-select/react"})})}),z.jsx("br",{}),z.jsx("h3",{children:"Simple example"}),z.jsxs("div",{style:{display:"flex",flexDirection:"row",width:"100%"},children:[z.jsxs("div",{style:{flex:.5},children:[z.jsx("strong",{children:"Value"})," ",e,z.jsxs(Uo,{modelValue:e,events:{afterChange:s=>t(s[0].value)},style:{marginLeft:"5px"},ref:null,children:[z.jsx("option",{value:"all",children:"All"}),z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Option 3"})]})]}),z.jsxs("div",{style:{flex:.6,marginLeft:15},children:[z.jsxs("div",{children:[z.jsx("strong",{children:"Value"})," ",JSON.stringify(n)]}),z.jsxs(Uo,{modelValue:n,ref:null,multiple:!0,events:{afterChange:s=>r(s.map(l=>l.value))},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]})]})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{})," setSimpleSingle(values[0].value as unknown as string) }}","> ",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})}),z.jsx("br",{}),z.jsx("div",{className:"separator"}),z.jsx("br",{}),z.jsx("h3",{children:"Attributes"}),z.jsx("p",{children:"There are certain attributes that are reactive to changes"}),z.jsx("h4",{children:"disabled"}),z.jsxs(Uo,{settings:{disabled:!0},children:[z.jsx("option",{value:"1",children:"Option 1"}),z.jsx("option",{value:"2",children:"Option 2"}),z.jsx("option",{value:"3",children:"Value 3"})]}),z.jsx("div",{className:"code-toolbar",children:z.jsx("pre",{className:"language-javascript",children:z.jsxs("code",{className:"language-javascript",children:['import React from "react" ',z.jsx("br",{}),'import SlimSelect from "@slim-select/react" ',z.jsx("br",{}),"import ","{"," useState ","}",' from "react"',z.jsx("br",{}),z.jsx("br",{}),"export default MySelect = () ","=>"," ","{",z.jsx("br",{}),'const [simpleSingle, setSimpleSingle] = useState("2") ',z.jsx("br",{}),"return ( ",z.jsx("br",{}),"",z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{}),' ',z.jsx("br",{})," ",z.jsx("br",{})," )","}"]})})})]})},_S=document.getElementById("app")?100:0;(function(){window.setInterval(()=>{document.getElementById("react-root")!=null&&document.getElementById("react-hide")!=null&&sa.createRoot(document.getElementById("react-root")).render(z.jsx(c1.StrictMode,{children:z.jsx(ES,{})}))},_S)})();export{yt as F,He as O,zh as S,by as _,rn as a,be as b,Eh as c,Mi as d,Iv as e,Il as f,pf as g,Su as h,CS as i,AS as j,Gd as k,uh as l,kS as m,nu as n,Di as o,Lc as r,hg as t,Wg as w}; + function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = ["assets/home.js","assets/home.css","assets/index2.js","assets/index2.css"] diff --git a/jest.config.js b/jest.config.js index 8fb6a9c9..54208409 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,4 +5,10 @@ module.exports = { testEnvironment: 'jsdom', testMatch: ['**/*.test.ts'], roots: ['./src/slim-select'], + reporters: process.env.CI ? [['github-actions', {silent: false}], 'summary'] : ['default'], + coverageThreshold: { + global: { + lines: 75, + }, + }, } diff --git a/package.json b/package.json index c823dfcd..56b03d94 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ ".": { "import": "./dist/slimselect.js", "require": "./dist/slimselect.umd.js", + "types": "./dist/index.d.ts" + }, + "./*": { "types": "./dist/*.d.ts" }, "./styles": "./dist/slimselect.css" @@ -47,7 +50,8 @@ "build:library:js": "cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../", "build:library:css": "cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../", "build:frameworks": "npm run build --workspaces", - "test": "jest" + "test": "jest", + "test:coverage": "jest --coverage" }, "devDependencies": { "@jest/globals": "^29.7.0", diff --git a/src/docs/app.vue b/src/docs/app.vue index d74b4ad6..2cb37938 100644 --- a/src/docs/app.vue +++ b/src/docs/app.vue @@ -62,6 +62,7 @@ export default defineComponent({ closable: 'close', options: [ { text: 'select', value: 'settings#select' }, + { text: 'cssClasses', value: 'settings#cssClasses' }, { text: 'alwaysOpen', value: 'settings#alwaysOpen' }, { text: 'contentLocation', value: 'settings#contentLocation' }, { text: 'contentPosition', value: 'settings#contentPosition' }, @@ -77,7 +78,7 @@ export default defineComponent({ { text: 'cssClass', value: 'settings#cssClass' }, { text: 'inlineStyles', value: 'settings#inlineStyles' }, { text: 'html', value: 'settings#html' }, - { text: 'keepOrder', value: 'settings#keepOrder'}, + { text: 'keepOrder', value: 'settings#keepOrder' }, { text: 'search', value: 'settings#search' }, { text: 'closeOnSelect', value: 'settings#closeOnSelect' }, { text: 'showOptionTooltips', value: 'settings#showOptionTooltips' }, @@ -182,9 +183,11 @@ export default defineComponent({ this.setDemensions() window.addEventListener('resize', this.navDebounce) + window.addEventListener('nav-updated', this.updateNav) }, unmounted() { window.removeEventListener('resize', this.navDebounce) + window.removeEventListener('nav-updated', this.updateNav) this.nav?.destroy() }, @@ -230,6 +233,13 @@ export default defineComponent({ }, }) }, + updateNav() { + setTimeout(() => { + if (this.nav) { + this.nav.setSelected(this.$router.currentRoute.value.fullPath.replace('/', '')) + } + }, 0) + }, }, }) diff --git a/src/docs/pages/home.vue b/src/docs/pages/home.vue index 45705225..4503533e 100644 --- a/src/docs/pages/home.vue +++ b/src/docs/pages/home.vue @@ -77,6 +77,11 @@ export default defineComponent({ this.multiple.destroy() } }, + methods: { + handleClick() { + window.dispatchEvent(new Event('nav-updated')) + }, + }, }) @@ -158,6 +163,13 @@ export default defineComponent({ } } } + + .frameworks { + .framework-items { + display: flex; + flex-direction: row; + } + } } @@ -243,8 +255,8 @@ export default defineComponent({ SlimSelect is in the process of adding a few framework integrations.
If you are an expert in any specific framework and would like to help out, please reach out!

-
- +
+ diff --git a/src/docs/pages/settings/css_classes.vue b/src/docs/pages/settings/css_classes.vue new file mode 100644 index 00000000..e85c5c2e --- /dev/null +++ b/src/docs/pages/settings/css_classes.vue @@ -0,0 +1,81 @@ + + + + +
+

cssClasses

+

+ You can override the default CSS classes by setting them during initialization. +

+ +
+ + +
+ +
+          
+          <select id="primary-select">
+            <option value="value1">Value 1</option>
+            <option value="value2">Value 2</option>
+            <option value="value3">Value 3</option>
+          </select>
+          
+      
+ +
+        
+          new SlimSelect({
+            select: '#primary-select',
+            cssClasses: {
+              option: "primary-option" 
+          })
+        
+      
+
+ diff --git a/src/docs/pages/settings/index.vue b/src/docs/pages/settings/index.vue index f971d9f5..e4a18468 100644 --- a/src/docs/pages/settings/index.vue +++ b/src/docs/pages/settings/index.vue @@ -8,6 +8,7 @@ import CloseOnSelect from './close_on_select.vue' import ContentLocation from './content_location.vue' import ContentPosition from './content_position.vue' import Css from './css.vue' +import CssClasses from './css_classes.vue' import DataAttributes from './data_attributes.vue' import Deselect from './deselect.vue' import Disabled from './disabled.vue' @@ -30,6 +31,7 @@ export default defineComponent({ name: 'Settings', components: { Select, + CssClasses, AlwaysOpen, ContentLocation, ContentPosition, @@ -59,6 +61,7 @@ export default defineComponent({