react-tag-input
Advanced tools
Comparing version 6.10.2 to 6.10.3-next.0
@@ -1,2 +0,2 @@ | ||
var ko=Object.create;var Rt=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var Ko=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var zo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $o=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Wo(t))!Go.call(e,n)&&n!==r&&Rt(e,n,{get:()=>t[n],enumerable:!(o=qo(t,n))||o.enumerable});return e};var Ot=(e,t,r)=>(r=e!=null?ko(Ko(e)):{},$o(t||!e||!e.__esModule?Rt(r,"default",{value:e,enumerable:!0}):r,e));var gt=zo((xd,je)=>{(function(){"use strict";var e={}.hasOwnProperty,t="[native code]";function r(){for(var o=[],n=0;n<arguments.length;n++){var a=arguments[n];if(a){var i=typeof a;if(i==="string"||i==="number")o.push(a);else if(Array.isArray(a)){if(a.length){var l=r.apply(null,a);l&&o.push(l)}}else if(i==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){o.push(a.toString());continue}for(var u in a)e.call(a,u)&&a[u]&&o.push(u)}}}return o.join(" ")}typeof je<"u"&&je.exports?(r.default=r,je.exports=r):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return r}):window.classNames=r})()});import{DndProvider as ti}from"react-dnd";import{HTML5Backend as ri}from"react-dnd-html5-backend";var C={ENTER:[10,13],TAB:9,BACKSPACE:8,UP_ARROW:38,DOWN_ARROW:40,ESCAPE:27,SPACE:32,COMMA:188},N={ENTER:"Enter",TAB:"Tab",COMMA:",",SPACE:" ",SEMICOLON:";"},Lt="Press enter to add new tag",Dt="text",Ze={tags:"ReactTags__tags",tagInput:"ReactTags__tagInput",tagInputField:"ReactTags__tagInputField",selected:"ReactTags__selected",tag:"ReactTags__tag",remove:"ReactTags__remove",suggestions:"ReactTags__suggestions",activeSuggestion:"ReactTags__activeSuggestion",editTagInput:"ReactTags__editTagInput",editTagInputField:"ReactTags__editTagInputField",clearAll:"ReactTags__clearAll"},ae={INLINE:"inline",TOP:"top",BOTTOM:"bottom"},et={TAG_LIMIT:"Tag limit reached!"};import{useEffect as He,createRef as Xf,useRef as Io,useState as $,Fragment as Zf}from"react";var Qo=typeof global=="object"&&global&&global.Object===Object&&global,be=Qo;var Vo=typeof self=="object"&&self&&self.Object===Object&&self,Yo=be||Vo||Function("return this")(),v=Yo;var Jo=v.Symbol,I=Jo;var Pt=Object.prototype,Xo=Pt.hasOwnProperty,Zo=Pt.toString,de=I?I.toStringTag:void 0;function ea(e){var t=Xo.call(e,de),r=e[de];try{e[de]=void 0;var o=!0}catch{}var n=Zo.call(e);return o&&(t?e[de]=r:delete e[de]),n}var Mt=ea;var ta=Object.prototype,ra=ta.toString;function oa(e){return ra.call(e)}var Ft=oa;var aa="[object Null]",na="[object Undefined]",Nt=I?I.toStringTag:void 0;function sa(e){return e==null?e===void 0?na:aa:Nt&&Nt in Object(e)?Mt(e):Ft(e)}var R=sa;function fa(e){return e!=null&&typeof e=="object"}var O=fa;var ia="[object Symbol]";function la(e){return typeof e=="symbol"||O(e)&&R(e)==ia}var jt=la;function ua(e,t){for(var r=-1,o=e==null?0:e.length,n=Array(o);++r<o;)n[r]=t(e[r],r,e);return n}var Ht=ua;var pa=Array.isArray,j=pa;var ma=1/0,Bt=I?I.prototype:void 0,Ut=Bt?Bt.toString:void 0;function kt(e){if(typeof e=="string")return e;if(j(e))return Ht(e,kt)+"";if(jt(e))return Ut?Ut.call(e):"";var t=e+"";return t=="0"&&1/e==-ma?"-0":t}var qt=kt;function da(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Te=da;var ca="[object AsyncFunction]",ga="[object Function]",xa="[object GeneratorFunction]",ha="[object Proxy]";function ya(e){if(!Te(e))return!1;var t=R(e);return t==ga||t==xa||t==ca||t==ha}var ve=ya;var ba=v["__core-js_shared__"],Se=ba;var Wt=function(){var e=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ta(e){return!!Wt&&Wt in e}var Kt=Ta;var va=Function.prototype,Sa=va.toString;function Aa(e){if(e!=null){try{return Sa.call(e)}catch{}try{return e+""}catch{}}return""}var H=Aa;var Ea=/[\\^$.*+?()[\]{}|]/g,_a=/^\[object .+?Constructor\]$/,Ia=Function.prototype,wa=Object.prototype,Ca=Ia.toString,Ra=wa.hasOwnProperty,Oa=RegExp("^"+Ca.call(Ra).replace(Ea,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function La(e){if(!Te(e)||Kt(e))return!1;var t=ve(e)?Oa:_a;return t.test(H(e))}var Gt=La;function Da(e,t){return e?.[t]}var zt=Da;function Pa(e,t){var r=zt(e,t);return Gt(r)?r:void 0}var w=Pa;var Ma=w(v,"WeakMap"),Ae=Ma;function Fa(){}var $t=Fa;function Na(e,t,r,o){for(var n=e.length,a=r+(o?1:-1);o?a--:++a<n;)if(t(e[a],a,e))return a;return-1}var Qt=Na;function ja(e){return e!==e}var Vt=ja;function Ha(e,t,r){for(var o=r-1,n=e.length;++o<n;)if(e[o]===t)return o;return-1}var Yt=Ha;function Ba(e,t,r){return t===t?Yt(e,t,r):Qt(e,Vt,r)}var Jt=Ba;function Ua(e,t){var r=e==null?0:e.length;return!!r&&Jt(e,t,0)>-1}var Xt=Ua;var ka=9007199254740991,qa=/^(?:0|[1-9]\d*)$/;function Wa(e,t){var r=typeof e;return t=t??ka,!!t&&(r=="number"||r!="symbol"&&qa.test(e))&&e>-1&&e%1==0&&e<t}var Zt=Wa;function Ka(e,t){return e===t||e!==e&&t!==t}var Ee=Ka;var Ga=9007199254740991;function za(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ga}var _e=za;function $a(e){return e!=null&&_e(e.length)&&!ve(e)}var er=$a;var Qa=Object.prototype;function Va(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Qa;return e===r}var tr=Va;function Ya(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}var rr=Ya;var Ja="[object Arguments]";function Xa(e){return O(e)&&R(e)==Ja}var tt=Xa;var or=Object.prototype,Za=or.hasOwnProperty,en=or.propertyIsEnumerable,tn=tt(function(){return arguments}())?tt:function(e){return O(e)&&Za.call(e,"callee")&&!en.call(e,"callee")},ar=tn;function rn(){return!1}var nr=rn;var ir=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sr=ir&&typeof module=="object"&&module&&!module.nodeType&&module,on=sr&&sr.exports===ir,fr=on?v.Buffer:void 0,an=fr?fr.isBuffer:void 0,nn=an||nr,ce=nn;var sn="[object Arguments]",fn="[object Array]",ln="[object Boolean]",un="[object Date]",pn="[object Error]",mn="[object Function]",dn="[object Map]",cn="[object Number]",gn="[object Object]",xn="[object RegExp]",hn="[object Set]",yn="[object String]",bn="[object WeakMap]",Tn="[object ArrayBuffer]",vn="[object DataView]",Sn="[object Float32Array]",An="[object Float64Array]",En="[object Int8Array]",_n="[object Int16Array]",In="[object Int32Array]",wn="[object Uint8Array]",Cn="[object Uint8ClampedArray]",Rn="[object Uint16Array]",On="[object Uint32Array]",x={};x[Sn]=x[An]=x[En]=x[_n]=x[In]=x[wn]=x[Cn]=x[Rn]=x[On]=!0;x[sn]=x[fn]=x[Tn]=x[ln]=x[vn]=x[un]=x[pn]=x[mn]=x[dn]=x[cn]=x[gn]=x[xn]=x[hn]=x[yn]=x[bn]=!1;function Ln(e){return O(e)&&_e(e.length)&&!!x[R(e)]}var lr=Ln;function Dn(e){return function(t){return e(t)}}var ur=Dn;var pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ge=pr&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=ge&&ge.exports===pr,rt=Pn&&be.process,Mn=function(){try{var e=ge&&ge.require&&ge.require("util").types;return e||rt&&rt.binding&&rt.binding("util")}catch{}}(),ot=Mn;var mr=ot&&ot.isTypedArray,Fn=mr?ur(mr):lr,Ie=Fn;var Nn=Object.prototype,jn=Nn.hasOwnProperty;function Hn(e,t){var r=j(e),o=!r&&ar(e),n=!r&&!o&&ce(e),a=!r&&!o&&!n&&Ie(e),i=r||o||n||a,l=i?rr(e.length,String):[],u=l.length;for(var f in e)(t||jn.call(e,f))&&!(i&&(f=="length"||n&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Zt(f,u)))&&l.push(f);return l}var dr=Hn;function Bn(e,t){return function(r){return e(t(r))}}var cr=Bn;var Un=cr(Object.keys,Object),gr=Un;var kn=Object.prototype,qn=kn.hasOwnProperty;function Wn(e){if(!tr(e))return gr(e);var t=[];for(var r in Object(e))qn.call(e,r)&&r!="constructor"&&t.push(r);return t}var xr=Wn;function Kn(e){return er(e)?dr(e):xr(e)}var hr=Kn;var Gn=w(Object,"create"),B=Gn;function zn(){this.__data__=B?B(null):{},this.size=0}var yr=zn;function $n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var br=$n;var Qn="__lodash_hash_undefined__",Vn=Object.prototype,Yn=Vn.hasOwnProperty;function Jn(e){var t=this.__data__;if(B){var r=t[e];return r===Qn?void 0:r}return Yn.call(t,e)?t[e]:void 0}var Tr=Jn;var Xn=Object.prototype,Zn=Xn.hasOwnProperty;function es(e){var t=this.__data__;return B?t[e]!==void 0:Zn.call(t,e)}var vr=es;var ts="__lodash_hash_undefined__";function rs(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=B&&t===void 0?ts:t,this}var Sr=rs;function ne(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}ne.prototype.clear=yr;ne.prototype.delete=br;ne.prototype.get=Tr;ne.prototype.has=vr;ne.prototype.set=Sr;var at=ne;function os(){this.__data__=[],this.size=0}var Ar=os;function as(e,t){for(var r=e.length;r--;)if(Ee(e[r][0],t))return r;return-1}var q=as;var ns=Array.prototype,ss=ns.splice;function fs(e){var t=this.__data__,r=q(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():ss.call(t,r,1),--this.size,!0}var Er=fs;function is(e){var t=this.__data__,r=q(t,e);return r<0?void 0:t[r][1]}var _r=is;function ls(e){return q(this.__data__,e)>-1}var Ir=ls;function us(e,t){var r=this.__data__,o=q(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}var wr=us;function se(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}se.prototype.clear=Ar;se.prototype.delete=Er;se.prototype.get=_r;se.prototype.has=Ir;se.prototype.set=wr;var W=se;var ps=w(v,"Map"),K=ps;function ms(){this.size=0,this.__data__={hash:new at,map:new(K||W),string:new at}}var Cr=ms;function ds(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Rr=ds;function cs(e,t){var r=e.__data__;return Rr(t)?r[typeof t=="string"?"string":"hash"]:r.map}var G=cs;function gs(e){var t=G(this,e).delete(e);return this.size-=t?1:0,t}var Or=gs;function xs(e){return G(this,e).get(e)}var Lr=xs;function hs(e){return G(this,e).has(e)}var Dr=hs;function ys(e,t){var r=G(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var Pr=ys;function fe(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}fe.prototype.clear=Cr;fe.prototype.delete=Or;fe.prototype.get=Lr;fe.prototype.has=Dr;fe.prototype.set=Pr;var we=fe;function bs(e){return e==null?"":qt(e)}var Ce=bs;function Ts(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}var Mr=Ts;function vs(e){return function(t){return e?.[t]}}var Fr=vs;function Ss(){this.__data__=new W,this.size=0}var Nr=Ss;function As(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var jr=As;function Es(e){return this.__data__.get(e)}var Hr=Es;function _s(e){return this.__data__.has(e)}var Br=_s;var Is=200;function ws(e,t){var r=this.__data__;if(r instanceof W){var o=r.__data__;if(!K||o.length<Is-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new we(o)}return r.set(e,t),this.size=r.size,this}var Ur=ws;function ie(e){var t=this.__data__=new W(e);this.size=t.size}ie.prototype.clear=Nr;ie.prototype.delete=jr;ie.prototype.get=Hr;ie.prototype.has=Br;ie.prototype.set=Ur;var Re=ie;function Cs(e,t){for(var r=-1,o=e==null?0:e.length,n=0,a=[];++r<o;){var i=e[r];t(i,r,e)&&(a[n++]=i)}return a}var kr=Cs;function Rs(){return[]}var qr=Rs;var Os=Object.prototype,Ls=Os.propertyIsEnumerable,Wr=Object.getOwnPropertySymbols,Ds=Wr?function(e){return e==null?[]:(e=Object(e),kr(Wr(e),function(t){return Ls.call(e,t)}))}:qr,Kr=Ds;function Ps(e,t,r){var o=t(e);return j(e)?o:Mr(o,r(e))}var Gr=Ps;function Ms(e){return Gr(e,hr,Kr)}var nt=Ms;var Fs=w(v,"DataView"),Oe=Fs;var Ns=w(v,"Promise"),Le=Ns;var js=w(v,"Set"),z=js;var zr="[object Map]",Hs="[object Object]",$r="[object Promise]",Qr="[object Set]",Vr="[object WeakMap]",Yr="[object DataView]",Bs=H(Oe),Us=H(K),ks=H(Le),qs=H(z),Ws=H(Ae),J=R;(Oe&&J(new Oe(new ArrayBuffer(1)))!=Yr||K&&J(new K)!=zr||Le&&J(Le.resolve())!=$r||z&&J(new z)!=Qr||Ae&&J(new Ae)!=Vr)&&(J=function(e){var t=R(e),r=t==Hs?e.constructor:void 0,o=r?H(r):"";if(o)switch(o){case Bs:return Yr;case Us:return zr;case ks:return $r;case qs:return Qr;case Ws:return Vr}return t});var st=J;var Ks=v.Uint8Array,ft=Ks;var Gs="__lodash_hash_undefined__";function zs(e){return this.__data__.set(e,Gs),this}var Jr=zs;function $s(e){return this.__data__.has(e)}var Xr=$s;function De(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new we;++t<r;)this.add(e[t])}De.prototype.add=De.prototype.push=Jr;De.prototype.has=Xr;var Pe=De;function Qs(e,t){for(var r=-1,o=e==null?0:e.length;++r<o;)if(t(e[r],r,e))return!0;return!1}var Zr=Qs;function Vs(e,t){return e.has(t)}var Me=Vs;var Ys=1,Js=2;function Xs(e,t,r,o,n,a){var i=r&Ys,l=e.length,u=t.length;if(l!=u&&!(i&&u>l))return!1;var f=a.get(e),c=a.get(t);if(f&&c)return f==t&&c==e;var d=-1,p=!0,T=r&Js?new Pe:void 0;for(a.set(e,t),a.set(t,e);++d<l;){var h=e[d],y=t[d];if(o)var b=i?o(y,h,d,t,e,a):o(h,y,d,e,t,a);if(b!==void 0){if(b)continue;p=!1;break}if(T){if(!Zr(t,function(S,A){if(!Me(T,A)&&(h===S||n(h,S,r,o,a)))return T.push(A)})){p=!1;break}}else if(!(h===y||n(h,y,r,o,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var Fe=Xs;function Zs(e){var t=-1,r=Array(e.size);return e.forEach(function(o,n){r[++t]=[n,o]}),r}var eo=Zs;function ef(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var le=ef;var tf=1,rf=2,of="[object Boolean]",af="[object Date]",nf="[object Error]",sf="[object Map]",ff="[object Number]",lf="[object RegExp]",uf="[object Set]",pf="[object String]",mf="[object Symbol]",df="[object ArrayBuffer]",cf="[object DataView]",to=I?I.prototype:void 0,it=to?to.valueOf:void 0;function gf(e,t,r,o,n,a,i){switch(r){case cf:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case df:return!(e.byteLength!=t.byteLength||!a(new ft(e),new ft(t)));case of:case af:case ff:return Ee(+e,+t);case nf:return e.name==t.name&&e.message==t.message;case lf:case pf:return e==t+"";case sf:var l=eo;case uf:var u=o&tf;if(l||(l=le),e.size!=t.size&&!u)return!1;var f=i.get(e);if(f)return f==t;o|=rf,i.set(e,t);var c=Fe(l(e),l(t),o,n,a,i);return i.delete(e),c;case mf:if(it)return it.call(e)==it.call(t)}return!1}var ro=gf;var xf=1,hf=Object.prototype,yf=hf.hasOwnProperty;function bf(e,t,r,o,n,a){var i=r&xf,l=nt(e),u=l.length,f=nt(t),c=f.length;if(u!=c&&!i)return!1;for(var d=u;d--;){var p=l[d];if(!(i?p in t:yf.call(t,p)))return!1}var T=a.get(e),h=a.get(t);if(T&&h)return T==t&&h==e;var y=!0;a.set(e,t),a.set(t,e);for(var b=i;++d<u;){p=l[d];var S=e[p],A=t[p];if(o)var E=i?o(A,S,p,t,e,a):o(S,A,p,e,t,a);if(!(E===void 0?S===A||n(S,A,r,o,a):E)){y=!1;break}b||(b=p=="constructor")}if(y&&!b){var M=e.constructor,U=t.constructor;M!=U&&"constructor"in e&&"constructor"in t&&!(typeof M=="function"&&M instanceof M&&typeof U=="function"&&U instanceof U)&&(y=!1)}return a.delete(e),a.delete(t),y}var oo=bf;var Tf=1,ao="[object Arguments]",no="[object Array]",Ne="[object Object]",vf=Object.prototype,so=vf.hasOwnProperty;function Sf(e,t,r,o,n,a){var i=j(e),l=j(t),u=i?no:st(e),f=l?no:st(t);u=u==ao?Ne:u,f=f==ao?Ne:f;var c=u==Ne,d=f==Ne,p=u==f;if(p&&ce(e)){if(!ce(t))return!1;i=!0,c=!1}if(p&&!c)return a||(a=new Re),i||Ie(e)?Fe(e,t,r,o,n,a):ro(e,t,u,r,o,n,a);if(!(r&Tf)){var T=c&&so.call(e,"__wrapped__"),h=d&&so.call(t,"__wrapped__");if(T||h){var y=T?e.value():e,b=h?t.value():t;return a||(a=new Re),n(y,b,r,o,a)}}return p?(a||(a=new Re),oo(e,t,r,o,n,a)):!1}var fo=Sf;function io(e,t,r,o,n){return e===t?!0:e==null||t==null||!O(e)&&!O(t)?e!==e&&t!==t:fo(e,t,r,o,io,n)}var lo=io;function Af(e,t,r){for(var o=-1,n=e==null?0:e.length;++o<n;)if(r(t,e[o]))return!0;return!1}var uo=Af;var Ef={"&":"&","<":"<",">":">",'"':""","'":"'"},_f=Fr(Ef),po=_f;var mo=/[&<>"']/g,If=RegExp(mo.source);function wf(e){return e=Ce(e),e&&If.test(e)?e.replace(mo,po):e}var lt=wf;var co=/[\\^$.*+?()[\]{}|]/g,Cf=RegExp(co.source);function Rf(e){return e=Ce(e),e&&Cf.test(e)?e.replace(co,"\\$&"):e}var ut=Rf;function Of(e,t){return lo(e,t)}var pt=Of;var Lf=1/0,Df=z&&1/le(new z([,-0]))[1]==Lf?function(e){return new z(e)}:$t,go=Df;var Pf=200;function Mf(e,t,r){var o=-1,n=Xt,a=e.length,i=!0,l=[],u=l;if(r)i=!1,n=uo;else if(a>=Pf){var f=t?null:go(e);if(f)return le(f);i=!1,n=Me,u=new Pe}else u=t?[]:l;e:for(;++o<a;){var c=e[o],d=t?t(c):c;if(c=r||c!==0?c:0,i&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;t&&u.push(d),l.push(c)}else n(u,d,r)||(u!==l&&u.push(d),l.push(c))}return l}var xo=Mf;function Ff(e){return e&&e.length?xo(e):[]}var mt=Ff;import{jsx as jf}from"react/jsx-runtime";var Nf=e=>jf("button",{className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),ho=Nf;import{createRef as Hf,memo as Bf,useEffect as Uf}from"react";import{jsx as dt,jsxs as Gf}from"react/jsx-runtime";var kf=(e,t)=>{let r=t.offsetHeight,o=e.offsetHeight,n=e.offsetTop-t.scrollTop;n+o>=r?t.scrollTop+=n-r+o:n<0&&(t.scrollTop+=n)},ct=(e,t,r,o)=>typeof o=="function"?o(e):e.length>=t&&r,qf=e=>{let t=Hf(),{labelField:r,minQueryLength:o,isFocused:n,classNames:a,selectedIndex:i,query:l}=e;Uf(()=>{if(!t.current)return;let d=t.current.querySelector(`.${a.activeSuggestion}`);d&&kf(d,t.current)},[i]);let u=(d,p)=>{let T=p.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[r]:h}=d;return{__html:h.replace(RegExp(T,"gi"),y=>`<mark>${lt(y)}</mark>`)}},f=(d,p)=>typeof e.renderSuggestion=="function"?e.renderSuggestion(d,p):dt("span",{dangerouslySetInnerHTML:u(d,p)}),c=e.suggestions.map((d,p)=>dt("li",{onMouseDown:e.handleClick.bind(null,p),onTouchStart:e.handleClick.bind(null,p),onMouseOver:e.handleHover.bind(null,p),className:p===e.selectedIndex?e.classNames.activeSuggestion:"",children:f(d,e.query)},p));return c.length===0||!ct(l,o||2,n,e.shouldRenderSuggestions)?null:dt("div",{ref:t,className:a.suggestions,"data-testid":"suggestions",children:Gf("ul",{children:[" ",c," "]})})},Wf=(e,t)=>{let{query:r,minQueryLength:o=2,isFocused:n,suggestions:a}=t;return!!(e.isFocused===n&&pt(e.suggestions,a)&&ct(r,o,n,t.shouldRenderSuggestions)===ct(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)&&e.selectedIndex===t.selectedIndex)},Kf=Bf(qf,Wf),yo=Kf;var wo=Ot(gt(),1);var Eo=Ot(gt(),1);import{useRef as $f}from"react";import{useDrag as Qf,useDrop as Vf}from"react-dnd";function bo(e){let t=e.map(o=>{let n=o-48*Math.floor(o/48);return String.fromCharCode(96<=o?n:o)}).join(""),r=ut(t);return new RegExp(`[${r}]+`)}function To(e){switch(e){case N.ENTER:return[10,13];case N.TAB:return 9;case N.COMMA:return 188;case N.SPACE:return 32;case N.SEMICOLON:return 186;default:return 0}}function xt(e){let{moveTag:t,readOnly:r,allowDragDrop:o}=e;return t!==void 0&&!r&&o}function vo(e){let{readOnly:t,allowDragDrop:r}=e;return!t&&r}import{jsx as xe}from"react/jsx-runtime";var zf=e=>{let{readOnly:t,removeComponent:r,onRemove:o,className:n,tag:a,index:i}=e,l=f=>{if(C.ENTER.includes(f.keyCode)||f.keyCode===C.SPACE){f.preventDefault(),f.stopPropagation();return}f.keyCode===C.BACKSPACE&&o(f)};if(t)return xe("span",{});let u=`Tag at index ${i} with value ${a.id} focussed. Press backspace to remove`;return r?xe(r,{"data-testid":"remove",onRemove:o,onKeyDown:l,className:n,"aria-label":u,tag:a,index:i}):xe("button",{"data-testid":"remove",onClick:o,onKeyDown:l,className:n,type:"button","aria-label":u,children:xe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:xe("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},So=zf;import{jsx as Yf,jsxs as Jf}from"react/jsx-runtime";var Ao={TAG:"tag"},_o=e=>{let t=$f(null),{readOnly:r=!1,tag:o,classNames:n,index:a,moveTag:i,allowDragDrop:l=!0,labelField:u="text",tags:f}=e,[{isDragging:c},d]=Qf(()=>({type:Ao.TAG,collect:b=>({isDragging:!!b.isDragging()}),item:e,canDrag:()=>xt({moveTag:i,readOnly:r,allowDragDrop:l})}),[f]),[,p]=Vf(()=>({accept:Ao.TAG,drop:b=>{let S=b.index,A=a;S!==A&&e?.moveTag?.(S,A)},canDrop:b=>vo(b)}),[f]);d(p(t));let T=e.tag[u],{className:h=""}=o,y=c?0:1;return Jf("span",{ref:t,className:(0,Eo.default)("tag-wrapper",n.tag,h),style:{opacity:y,cursor:xt({moveTag:i,readOnly:r,allowDragDrop:l})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[T,Yf(So,{tag:e.tag,className:n.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:r,index:a})]})};import{jsx as P,jsxs as Be}from"react/jsx-runtime";var ei=e=>{let{autofocus:t,autoFocus:r,readOnly:o,labelField:n,allowDeleteFromEmptyInput:a,allowAdditionFromPaste:i,allowDragDrop:l,minQueryLength:u,shouldRenderSuggestions:f,removeComponent:c,autocomplete:d,inline:p,maxTags:T,allowUnique:h,editable:y,placeholder:b,delimiters:S,separators:A,tags:E,inputFieldPosition:M,inputProps:U,classNames:Ue,maxLength:ke,inputValue:qe,clearAll:We}=e,[k,he]=$(e.suggestions),[L,X]=$(""),[Ke,ye]=$(!1),[D,F]=$(-1),[Ge,Q]=$(!1),[ze,$e]=$(""),[Z,ee]=$(-1),[yt,te]=$(""),Qe=Xf(),V=Io(null),bt=Io(null);He(()=>{S.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),He(()=>{p||console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[p]),He(()=>{t===!1&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),t&&r&&!o&&ue()},[r,r,o]),He(()=>{Lo()},[L,e.suggestions]);let Tt=s=>{let m=e.suggestions.slice();if(h){let Y=E.map(pe=>pe.id.trim().toLowerCase());m=m.filter(pe=>!Y.includes(pe.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(s,m);let g=m.filter(Y=>vt(s,Y)===0),_=m.filter(Y=>vt(s,Y)>0);return g.concat(_)},vt=(s,m)=>m[n].toLowerCase().indexOf(s.toLowerCase()),ue=()=>{X(""),V.current&&(V.current.value="",V.current.focus())},St=(s,m)=>{m.preventDefault(),m.stopPropagation();let g=E.slice();g.length!==0&&(te(""),e?.handleDelete?.(s,m),Ro(s,g))},Ro=(s,m)=>{if(!Qe?.current)return;let g=Qe.current.querySelectorAll(".ReactTags__remove"),_="";s===0&&m.length>1?(_=`Tag at index ${s} with value ${m[s].id} deleted. Tag at index 0 with value ${m[1].id} focussed. Press backspace to remove`,g[0].focus()):s>0?(_=`Tag at index ${s} with value ${m[s].id} deleted. Tag at index ${s-1} with value ${m[s-1].id} focussed. Press backspace to remove`,g[s-1].focus()):(_=`Tag at index ${s} with value ${m[s].id} deleted. Input focussed. Press enter to add a new tag`,V.current?.focus()),$e(_)},Oo=(s,m,g)=>{o||(y&&(ee(s),X(m[n]),bt.current?.focus()),e.handleTagClick?.(s,g))},At=s=>{e.handleInputChange&&e.handleInputChange(s.target.value,s);let m=s.target.value.trim();X(m)},Lo=()=>{let s=Tt(L);he(s),F(D>=s.length?s.length-1:D)},Et=s=>{let m=s.target.value;e.handleInputFocus&&e.handleInputFocus(m,s),ye(!0)},_t=s=>{let m=s.target.value;e.handleInputBlur&&(e.handleInputBlur(m,s),V.current&&(V.current.value="")),ye(!1),ee(-1)},It=s=>{if(s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),F(-1),Q(!1),he([]),ee(-1)),(A.indexOf(s.key)!==-1||S.indexOf(s.keyCode)!==-1)&&!s.shiftKey){(s.keyCode!==C.TAB||L!=="")&&s.preventDefault();let m=Ge&&D!==-1?k[D]:{id:L.trim(),[n]:L.trim(),className:""};Object.keys(m)&&Ve(m)}s.key==="Backspace"&&L===""&&(a||M===ae.INLINE)&&St(E.length-1,s),s.keyCode===C.UP_ARROW&&(s.preventDefault(),F(D<=0?k.length-1:D-1),Q(!0)),s.keyCode===C.DOWN_ARROW&&(s.preventDefault(),Q(!0),k.length===0?F(-1):F((D+1)%k.length))},wt=()=>T&&E.length>=T,Ct=s=>{if(!i)return;if(wt()){te(et.TAG_LIMIT),ue();return}te(""),s.preventDefault();let m=s.clipboardData||window.clipboardData,g=m.getData("text"),{maxLength:_=g.length}=e,Y=Math.min(_,g.length),pe=m.getData("text").substr(0,Y),me=S;A.length&&(me=[],A.forEach(oe=>{let Xe=To(oe);Array.isArray(Xe)?me=[...me,...Xe]:me.push(Xe)}));let Bo=bo(me),Uo=pe.split(Bo).map(oe=>oe.trim());mt(Uo).forEach(oe=>Ve({id:oe.trim(),[n]:oe.trim(),className:""}))},Ve=s=>{if(!s.id||!s[n])return;if(Z===-1){if(wt()){te(et.TAG_LIMIT),ue();return}te("")}let m=E.map(g=>g.id.toLowerCase());if(!(h&&m.indexOf(s.id.trim().toLowerCase())>=0)){if(d){let g=Tt(s[n]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(d===1&&g.length===1||d===!0&&g.length)&&(s=g[0])}Z!==-1&&e.onTagUpdate?e.onTagUpdate(Z,s):e?.handleAddition?.(s),X(""),Q(!1),F(-1),ee(-1),ue()}},Do=s=>{Ve(k[s])},Po=()=>{e.onClearAll&&e.onClearAll(),te(""),ue()},Mo=s=>{F(s),Q(!0)},Fo=(s,m)=>{let g=E[s];e?.handleDrag?.(g,s,m)},No=(()=>{let s={...Ze,...e.classNames};return E.map((m,g)=>P(Zf,{children:Z===g?P("div",{className:s.editTagInput,children:P("input",{ref:_=>{bt.current=_},onFocus:Et,value:L,onChange:At,onKeyDown:It,onBlur:_t,className:s.editTagInputField,onPaste:Ct,"data-testid":"tag-edit"})}):P(_o,{index:g,tag:m,tags:E,labelField:n,onDelete:_=>St(g,_),moveTag:l?Fo:void 0,removeComponent:c,onTagClicked:_=>Oo(g,m,_),readOnly:o,classNames:s,allowDragDrop:l})},g))})(),re={...Ze,...Ue},{name:jo,id:Ho}=e,Ye=p?M:ae.BOTTOM,Je=o?null:Be("div",{className:re.tagInput,children:[P("input",{...U,ref:s=>{V.current=s},className:re.tagInputField,type:"text",placeholder:b,"aria-label":b,onFocus:Et,onBlur:_t,onChange:At,onKeyDown:It,onPaste:Ct,name:jo,id:Ho,maxLength:ke,value:qe,"data-automation":"input","data-testid":"input"}),P(yo,{query:L.trim(),suggestions:k,labelField:n,selectedIndex:D,handleClick:Do,handleHover:Mo,minQueryLength:u,shouldRenderSuggestions:f,isFocused:Ke,classNames:re,renderSuggestion:e.renderSuggestion}),We&&E.length>0&&P(ho,{classNames:re,onClick:Po}),yt&&Be("div",{"data-testid":"error",className:"ReactTags__error",children:[P("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:P("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),yt]})]});return Be("div",{className:(0,wo.default)(re.tags,"react-tags-wrapper"),ref:Qe,children:[P("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:ze}),Ye===ae.TOP&&Je,Be("div",{className:re.selected,children:[No,Ye===ae.INLINE&&Je]}),Ye===ae.BOTTOM&&Je]})},Co=ei;import{jsx as ht}from"react/jsx-runtime";var oi=e=>{let{placeholder:t=Lt,labelField:r=Dt,suggestions:o=[],delimiters:n=e.separators?.length?[]:[...C.ENTER,C.TAB],separators:a=e.delimiters?.length?[]:[N.ENTER,N.TAB],autofocus:i=!0,autoFocus:l=!0,inline:u=!0,inputFieldPosition:f="inline",allowDeleteFromEmptyInput:c=!1,allowAdditionFromPaste:d=!0,autocomplete:p=!1,readOnly:T=!1,allowUnique:h=!0,allowDragDrop:y=!0,tags:b=[],inputProps:S={},editable:A=!1,clearAll:E=!1,handleDelete:M,handleAddition:U,onTagUpdate:Ue,handleDrag:ke,handleFilterSuggestions:qe,handleTagClick:We,handleInputChange:k,handleInputFocus:he,handleInputBlur:L,minQueryLength:X,shouldRenderSuggestions:Ke,removeComponent:ye,onClearAll:D,classNames:F,name:Ge,id:Q,maxLength:ze,inputValue:$e,maxTags:Z,renderSuggestion:ee}=e;return ht(Co,{placeholder:t,labelField:r,suggestions:o,delimiters:n,separators:a,autofocus:i,autoFocus:l,inline:u,inputFieldPosition:f,allowDeleteFromEmptyInput:c,allowAdditionFromPaste:d,autocomplete:p,readOnly:T,allowUnique:h,allowDragDrop:y,tags:b,inputProps:S,editable:A,clearAll:E,handleDelete:M,handleAddition:U,onTagUpdate:Ue,handleDrag:ke,handleFilterSuggestions:qe,handleTagClick:We,handleInputChange:k,handleInputFocus:he,handleInputBlur:L,minQueryLength:X,shouldRenderSuggestions:Ke,removeComponent:ye,onClearAll:D,classNames:F,name:Ge,id:Q,maxLength:ze,inputValue:$e,maxTags:Z,renderSuggestion:ee})},Gd=({...e})=>ht(ti,{backend:ri,children:ht(oi,{...e})});export{C as KEYS,N as SEPARATORS,Gd as WithContext,oi as WithOutContext}; | ||
var ko=Object.create;var Rt=Object.defineProperty;var qo=Object.getOwnPropertyDescriptor;var Wo=Object.getOwnPropertyNames;var Ko=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var zo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $o=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Wo(t))!Go.call(e,n)&&n!==r&&Rt(e,n,{get:()=>t[n],enumerable:!(o=qo(t,n))||o.enumerable});return e};var Ot=(e,t,r)=>(r=e!=null?ko(Ko(e)):{},$o(t||!e||!e.__esModule?Rt(r,"default",{value:e,enumerable:!0}):r,e));var gt=zo((xd,je)=>{(function(){"use strict";var e={}.hasOwnProperty,t="[native code]";function r(){for(var o=[],n=0;n<arguments.length;n++){var a=arguments[n];if(a){var i=typeof a;if(i==="string"||i==="number")o.push(a);else if(Array.isArray(a)){if(a.length){var l=r.apply(null,a);l&&o.push(l)}}else if(i==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){o.push(a.toString());continue}for(var u in a)e.call(a,u)&&a[u]&&o.push(u)}}}return o.join(" ")}typeof je<"u"&&je.exports?(r.default=r,je.exports=r):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return r}):window.classNames=r})()});import{DndProvider as ti}from"react-dnd";import{HTML5Backend as ri}from"react-dnd-html5-backend";var F={ENTER:[10,13],TAB:9,BACKSPACE:8,UP_ARROW:38,DOWN_ARROW:40,ESCAPE:27,SPACE:32,COMMA:188},N={ENTER:"Enter",TAB:"Tab",COMMA:",",SPACE:" ",SEMICOLON:";"},Lt="Press enter to add new tag",Dt="text",Ze={tags:"ReactTags__tags",tagInput:"ReactTags__tagInput",tagInputField:"ReactTags__tagInputField",selected:"ReactTags__selected",tag:"ReactTags__tag",remove:"ReactTags__remove",suggestions:"ReactTags__suggestions",activeSuggestion:"ReactTags__activeSuggestion",editTagInput:"ReactTags__editTagInput",editTagInputField:"ReactTags__editTagInputField",clearAll:"ReactTags__clearAll"},ae={INLINE:"inline",TOP:"top",BOTTOM:"bottom"},et={TAG_LIMIT:"Tag limit reached!"};import{useEffect as He,createRef as Xf,useRef as Io,useState as $,Fragment as Zf}from"react";var Qo=typeof global=="object"&&global&&global.Object===Object&&global,be=Qo;var Vo=typeof self=="object"&&self&&self.Object===Object&&self,Yo=be||Vo||Function("return this")(),v=Yo;var Jo=v.Symbol,I=Jo;var Pt=Object.prototype,Xo=Pt.hasOwnProperty,Zo=Pt.toString,de=I?I.toStringTag:void 0;function ea(e){var t=Xo.call(e,de),r=e[de];try{e[de]=void 0;var o=!0}catch{}var n=Zo.call(e);return o&&(t?e[de]=r:delete e[de]),n}var Mt=ea;var ta=Object.prototype,ra=ta.toString;function oa(e){return ra.call(e)}var Ft=oa;var aa="[object Null]",na="[object Undefined]",Nt=I?I.toStringTag:void 0;function sa(e){return e==null?e===void 0?na:aa:Nt&&Nt in Object(e)?Mt(e):Ft(e)}var C=sa;function fa(e){return e!=null&&typeof e=="object"}var R=fa;var ia="[object Symbol]";function la(e){return typeof e=="symbol"||R(e)&&C(e)==ia}var jt=la;function ua(e,t){for(var r=-1,o=e==null?0:e.length,n=Array(o);++r<o;)n[r]=t(e[r],r,e);return n}var Ht=ua;var pa=Array.isArray,j=pa;var ma=1/0,Bt=I?I.prototype:void 0,Ut=Bt?Bt.toString:void 0;function kt(e){if(typeof e=="string")return e;if(j(e))return Ht(e,kt)+"";if(jt(e))return Ut?Ut.call(e):"";var t=e+"";return t=="0"&&1/e==-ma?"-0":t}var qt=kt;function da(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Te=da;var ca="[object AsyncFunction]",ga="[object Function]",xa="[object GeneratorFunction]",ha="[object Proxy]";function ya(e){if(!Te(e))return!1;var t=C(e);return t==ga||t==xa||t==ca||t==ha}var ve=ya;var ba=v["__core-js_shared__"],Se=ba;var Wt=function(){var e=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ta(e){return!!Wt&&Wt in e}var Kt=Ta;var va=Function.prototype,Sa=va.toString;function Aa(e){if(e!=null){try{return Sa.call(e)}catch{}try{return e+""}catch{}}return""}var H=Aa;var Ea=/[\\^$.*+?()[\]{}|]/g,_a=/^\[object .+?Constructor\]$/,Ia=Function.prototype,wa=Object.prototype,Ca=Ia.toString,Ra=wa.hasOwnProperty,Oa=RegExp("^"+Ca.call(Ra).replace(Ea,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function La(e){if(!Te(e)||Kt(e))return!1;var t=ve(e)?Oa:_a;return t.test(H(e))}var Gt=La;function Da(e,t){return e?.[t]}var zt=Da;function Pa(e,t){var r=zt(e,t);return Gt(r)?r:void 0}var w=Pa;var Ma=w(v,"WeakMap"),Ae=Ma;function Fa(){}var $t=Fa;function Na(e,t,r,o){for(var n=e.length,a=r+(o?1:-1);o?a--:++a<n;)if(t(e[a],a,e))return a;return-1}var Qt=Na;function ja(e){return e!==e}var Vt=ja;function Ha(e,t,r){for(var o=r-1,n=e.length;++o<n;)if(e[o]===t)return o;return-1}var Yt=Ha;function Ba(e,t,r){return t===t?Yt(e,t,r):Qt(e,Vt,r)}var Jt=Ba;function Ua(e,t){var r=e==null?0:e.length;return!!r&&Jt(e,t,0)>-1}var Xt=Ua;var ka=9007199254740991,qa=/^(?:0|[1-9]\d*)$/;function Wa(e,t){var r=typeof e;return t=t??ka,!!t&&(r=="number"||r!="symbol"&&qa.test(e))&&e>-1&&e%1==0&&e<t}var Zt=Wa;function Ka(e,t){return e===t||e!==e&&t!==t}var Ee=Ka;var Ga=9007199254740991;function za(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ga}var _e=za;function $a(e){return e!=null&&_e(e.length)&&!ve(e)}var er=$a;var Qa=Object.prototype;function Va(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Qa;return e===r}var tr=Va;function Ya(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}var rr=Ya;var Ja="[object Arguments]";function Xa(e){return R(e)&&C(e)==Ja}var tt=Xa;var or=Object.prototype,Za=or.hasOwnProperty,en=or.propertyIsEnumerable,tn=tt(function(){return arguments}())?tt:function(e){return R(e)&&Za.call(e,"callee")&&!en.call(e,"callee")},ar=tn;function rn(){return!1}var nr=rn;var ir=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sr=ir&&typeof module=="object"&&module&&!module.nodeType&&module,on=sr&&sr.exports===ir,fr=on?v.Buffer:void 0,an=fr?fr.isBuffer:void 0,nn=an||nr,ce=nn;var sn="[object Arguments]",fn="[object Array]",ln="[object Boolean]",un="[object Date]",pn="[object Error]",mn="[object Function]",dn="[object Map]",cn="[object Number]",gn="[object Object]",xn="[object RegExp]",hn="[object Set]",yn="[object String]",bn="[object WeakMap]",Tn="[object ArrayBuffer]",vn="[object DataView]",Sn="[object Float32Array]",An="[object Float64Array]",En="[object Int8Array]",_n="[object Int16Array]",In="[object Int32Array]",wn="[object Uint8Array]",Cn="[object Uint8ClampedArray]",Rn="[object Uint16Array]",On="[object Uint32Array]",x={};x[Sn]=x[An]=x[En]=x[_n]=x[In]=x[wn]=x[Cn]=x[Rn]=x[On]=!0;x[sn]=x[fn]=x[Tn]=x[ln]=x[vn]=x[un]=x[pn]=x[mn]=x[dn]=x[cn]=x[gn]=x[xn]=x[hn]=x[yn]=x[bn]=!1;function Ln(e){return R(e)&&_e(e.length)&&!!x[C(e)]}var lr=Ln;function Dn(e){return function(t){return e(t)}}var ur=Dn;var pr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ge=pr&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=ge&&ge.exports===pr,rt=Pn&&be.process,Mn=function(){try{var e=ge&&ge.require&&ge.require("util").types;return e||rt&&rt.binding&&rt.binding("util")}catch{}}(),ot=Mn;var mr=ot&&ot.isTypedArray,Fn=mr?ur(mr):lr,Ie=Fn;var Nn=Object.prototype,jn=Nn.hasOwnProperty;function Hn(e,t){var r=j(e),o=!r&&ar(e),n=!r&&!o&&ce(e),a=!r&&!o&&!n&&Ie(e),i=r||o||n||a,l=i?rr(e.length,String):[],u=l.length;for(var f in e)(t||jn.call(e,f))&&!(i&&(f=="length"||n&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Zt(f,u)))&&l.push(f);return l}var dr=Hn;function Bn(e,t){return function(r){return e(t(r))}}var cr=Bn;var Un=cr(Object.keys,Object),gr=Un;var kn=Object.prototype,qn=kn.hasOwnProperty;function Wn(e){if(!tr(e))return gr(e);var t=[];for(var r in Object(e))qn.call(e,r)&&r!="constructor"&&t.push(r);return t}var xr=Wn;function Kn(e){return er(e)?dr(e):xr(e)}var hr=Kn;var Gn=w(Object,"create"),B=Gn;function zn(){this.__data__=B?B(null):{},this.size=0}var yr=zn;function $n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var br=$n;var Qn="__lodash_hash_undefined__",Vn=Object.prototype,Yn=Vn.hasOwnProperty;function Jn(e){var t=this.__data__;if(B){var r=t[e];return r===Qn?void 0:r}return Yn.call(t,e)?t[e]:void 0}var Tr=Jn;var Xn=Object.prototype,Zn=Xn.hasOwnProperty;function es(e){var t=this.__data__;return B?t[e]!==void 0:Zn.call(t,e)}var vr=es;var ts="__lodash_hash_undefined__";function rs(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=B&&t===void 0?ts:t,this}var Sr=rs;function ne(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}ne.prototype.clear=yr;ne.prototype.delete=br;ne.prototype.get=Tr;ne.prototype.has=vr;ne.prototype.set=Sr;var at=ne;function os(){this.__data__=[],this.size=0}var Ar=os;function as(e,t){for(var r=e.length;r--;)if(Ee(e[r][0],t))return r;return-1}var q=as;var ns=Array.prototype,ss=ns.splice;function fs(e){var t=this.__data__,r=q(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():ss.call(t,r,1),--this.size,!0}var Er=fs;function is(e){var t=this.__data__,r=q(t,e);return r<0?void 0:t[r][1]}var _r=is;function ls(e){return q(this.__data__,e)>-1}var Ir=ls;function us(e,t){var r=this.__data__,o=q(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}var wr=us;function se(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}se.prototype.clear=Ar;se.prototype.delete=Er;se.prototype.get=_r;se.prototype.has=Ir;se.prototype.set=wr;var W=se;var ps=w(v,"Map"),K=ps;function ms(){this.size=0,this.__data__={hash:new at,map:new(K||W),string:new at}}var Cr=ms;function ds(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Rr=ds;function cs(e,t){var r=e.__data__;return Rr(t)?r[typeof t=="string"?"string":"hash"]:r.map}var G=cs;function gs(e){var t=G(this,e).delete(e);return this.size-=t?1:0,t}var Or=gs;function xs(e){return G(this,e).get(e)}var Lr=xs;function hs(e){return G(this,e).has(e)}var Dr=hs;function ys(e,t){var r=G(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var Pr=ys;function fe(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}fe.prototype.clear=Cr;fe.prototype.delete=Or;fe.prototype.get=Lr;fe.prototype.has=Dr;fe.prototype.set=Pr;var we=fe;function bs(e){return e==null?"":qt(e)}var Ce=bs;function Ts(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}var Mr=Ts;function vs(e){return function(t){return e?.[t]}}var Fr=vs;function Ss(){this.__data__=new W,this.size=0}var Nr=Ss;function As(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var jr=As;function Es(e){return this.__data__.get(e)}var Hr=Es;function _s(e){return this.__data__.has(e)}var Br=_s;var Is=200;function ws(e,t){var r=this.__data__;if(r instanceof W){var o=r.__data__;if(!K||o.length<Is-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new we(o)}return r.set(e,t),this.size=r.size,this}var Ur=ws;function ie(e){var t=this.__data__=new W(e);this.size=t.size}ie.prototype.clear=Nr;ie.prototype.delete=jr;ie.prototype.get=Hr;ie.prototype.has=Br;ie.prototype.set=Ur;var Re=ie;function Cs(e,t){for(var r=-1,o=e==null?0:e.length,n=0,a=[];++r<o;){var i=e[r];t(i,r,e)&&(a[n++]=i)}return a}var kr=Cs;function Rs(){return[]}var qr=Rs;var Os=Object.prototype,Ls=Os.propertyIsEnumerable,Wr=Object.getOwnPropertySymbols,Ds=Wr?function(e){return e==null?[]:(e=Object(e),kr(Wr(e),function(t){return Ls.call(e,t)}))}:qr,Kr=Ds;function Ps(e,t,r){var o=t(e);return j(e)?o:Mr(o,r(e))}var Gr=Ps;function Ms(e){return Gr(e,hr,Kr)}var nt=Ms;var Fs=w(v,"DataView"),Oe=Fs;var Ns=w(v,"Promise"),Le=Ns;var js=w(v,"Set"),z=js;var zr="[object Map]",Hs="[object Object]",$r="[object Promise]",Qr="[object Set]",Vr="[object WeakMap]",Yr="[object DataView]",Bs=H(Oe),Us=H(K),ks=H(Le),qs=H(z),Ws=H(Ae),J=C;(Oe&&J(new Oe(new ArrayBuffer(1)))!=Yr||K&&J(new K)!=zr||Le&&J(Le.resolve())!=$r||z&&J(new z)!=Qr||Ae&&J(new Ae)!=Vr)&&(J=function(e){var t=C(e),r=t==Hs?e.constructor:void 0,o=r?H(r):"";if(o)switch(o){case Bs:return Yr;case Us:return zr;case ks:return $r;case qs:return Qr;case Ws:return Vr}return t});var st=J;var Ks=v.Uint8Array,ft=Ks;var Gs="__lodash_hash_undefined__";function zs(e){return this.__data__.set(e,Gs),this}var Jr=zs;function $s(e){return this.__data__.has(e)}var Xr=$s;function De(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new we;++t<r;)this.add(e[t])}De.prototype.add=De.prototype.push=Jr;De.prototype.has=Xr;var Pe=De;function Qs(e,t){for(var r=-1,o=e==null?0:e.length;++r<o;)if(t(e[r],r,e))return!0;return!1}var Zr=Qs;function Vs(e,t){return e.has(t)}var Me=Vs;var Ys=1,Js=2;function Xs(e,t,r,o,n,a){var i=r&Ys,l=e.length,u=t.length;if(l!=u&&!(i&&u>l))return!1;var f=a.get(e),c=a.get(t);if(f&&c)return f==t&&c==e;var d=-1,p=!0,T=r&Js?new Pe:void 0;for(a.set(e,t),a.set(t,e);++d<l;){var h=e[d],y=t[d];if(o)var b=i?o(y,h,d,t,e,a):o(h,y,d,e,t,a);if(b!==void 0){if(b)continue;p=!1;break}if(T){if(!Zr(t,function(S,A){if(!Me(T,A)&&(h===S||n(h,S,r,o,a)))return T.push(A)})){p=!1;break}}else if(!(h===y||n(h,y,r,o,a))){p=!1;break}}return a.delete(e),a.delete(t),p}var Fe=Xs;function Zs(e){var t=-1,r=Array(e.size);return e.forEach(function(o,n){r[++t]=[n,o]}),r}var eo=Zs;function ef(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var le=ef;var tf=1,rf=2,of="[object Boolean]",af="[object Date]",nf="[object Error]",sf="[object Map]",ff="[object Number]",lf="[object RegExp]",uf="[object Set]",pf="[object String]",mf="[object Symbol]",df="[object ArrayBuffer]",cf="[object DataView]",to=I?I.prototype:void 0,it=to?to.valueOf:void 0;function gf(e,t,r,o,n,a,i){switch(r){case cf:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case df:return!(e.byteLength!=t.byteLength||!a(new ft(e),new ft(t)));case of:case af:case ff:return Ee(+e,+t);case nf:return e.name==t.name&&e.message==t.message;case lf:case pf:return e==t+"";case sf:var l=eo;case uf:var u=o&tf;if(l||(l=le),e.size!=t.size&&!u)return!1;var f=i.get(e);if(f)return f==t;o|=rf,i.set(e,t);var c=Fe(l(e),l(t),o,n,a,i);return i.delete(e),c;case mf:if(it)return it.call(e)==it.call(t)}return!1}var ro=gf;var xf=1,hf=Object.prototype,yf=hf.hasOwnProperty;function bf(e,t,r,o,n,a){var i=r&xf,l=nt(e),u=l.length,f=nt(t),c=f.length;if(u!=c&&!i)return!1;for(var d=u;d--;){var p=l[d];if(!(i?p in t:yf.call(t,p)))return!1}var T=a.get(e),h=a.get(t);if(T&&h)return T==t&&h==e;var y=!0;a.set(e,t),a.set(t,e);for(var b=i;++d<u;){p=l[d];var S=e[p],A=t[p];if(o)var E=i?o(A,S,p,t,e,a):o(S,A,p,e,t,a);if(!(E===void 0?S===A||n(S,A,r,o,a):E)){y=!1;break}b||(b=p=="constructor")}if(y&&!b){var P=e.constructor,U=t.constructor;P!=U&&"constructor"in e&&"constructor"in t&&!(typeof P=="function"&&P instanceof P&&typeof U=="function"&&U instanceof U)&&(y=!1)}return a.delete(e),a.delete(t),y}var oo=bf;var Tf=1,ao="[object Arguments]",no="[object Array]",Ne="[object Object]",vf=Object.prototype,so=vf.hasOwnProperty;function Sf(e,t,r,o,n,a){var i=j(e),l=j(t),u=i?no:st(e),f=l?no:st(t);u=u==ao?Ne:u,f=f==ao?Ne:f;var c=u==Ne,d=f==Ne,p=u==f;if(p&&ce(e)){if(!ce(t))return!1;i=!0,c=!1}if(p&&!c)return a||(a=new Re),i||Ie(e)?Fe(e,t,r,o,n,a):ro(e,t,u,r,o,n,a);if(!(r&Tf)){var T=c&&so.call(e,"__wrapped__"),h=d&&so.call(t,"__wrapped__");if(T||h){var y=T?e.value():e,b=h?t.value():t;return a||(a=new Re),n(y,b,r,o,a)}}return p?(a||(a=new Re),oo(e,t,r,o,n,a)):!1}var fo=Sf;function io(e,t,r,o,n){return e===t?!0:e==null||t==null||!R(e)&&!R(t)?e!==e&&t!==t:fo(e,t,r,o,io,n)}var lo=io;function Af(e,t,r){for(var o=-1,n=e==null?0:e.length;++o<n;)if(r(t,e[o]))return!0;return!1}var uo=Af;var Ef={"&":"&","<":"<",">":">",'"':""","'":"'"},_f=Fr(Ef),po=_f;var mo=/[&<>"']/g,If=RegExp(mo.source);function wf(e){return e=Ce(e),e&&If.test(e)?e.replace(mo,po):e}var lt=wf;var co=/[\\^$.*+?()[\]{}|]/g,Cf=RegExp(co.source);function Rf(e){return e=Ce(e),e&&Cf.test(e)?e.replace(co,"\\$&"):e}var ut=Rf;function Of(e,t){return lo(e,t)}var pt=Of;var Lf=1/0,Df=z&&1/le(new z([,-0]))[1]==Lf?function(e){return new z(e)}:$t,go=Df;var Pf=200;function Mf(e,t,r){var o=-1,n=Xt,a=e.length,i=!0,l=[],u=l;if(r)i=!1,n=uo;else if(a>=Pf){var f=t?null:go(e);if(f)return le(f);i=!1,n=Me,u=new Pe}else u=t?[]:l;e:for(;++o<a;){var c=e[o],d=t?t(c):c;if(c=r||c!==0?c:0,i&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;t&&u.push(d),l.push(c)}else n(u,d,r)||(u!==l&&u.push(d),l.push(c))}return l}var xo=Mf;function Ff(e){return e&&e.length?xo(e):[]}var mt=Ff;import{jsx as jf}from"react/jsx-runtime";var Nf=e=>jf("button",{className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),ho=Nf;import{createRef as Hf,memo as Bf,useEffect as Uf}from"react";import{jsx as dt,jsxs as Gf}from"react/jsx-runtime";var kf=(e,t)=>{let r=t.offsetHeight,o=e.offsetHeight,n=e.offsetTop-t.scrollTop;n+o>=r?t.scrollTop+=n-r+o:n<0&&(t.scrollTop+=n)},ct=(e,t,r,o)=>typeof o=="function"?o(e):e.length>=t&&r,qf=e=>{let t=Hf(),{labelField:r,minQueryLength:o,isFocused:n,classNames:a,selectedIndex:i,query:l}=e;Uf(()=>{if(!t.current)return;let d=t.current.querySelector(`.${a.activeSuggestion}`);d&&kf(d,t.current)},[i]);let u=(d,p)=>{let T=p.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[r]:h}=d;return{__html:h.replace(RegExp(T,"gi"),y=>`<mark>${lt(y)}</mark>`)}},f=(d,p)=>typeof e.renderSuggestion=="function"?e.renderSuggestion(d,p):dt("span",{dangerouslySetInnerHTML:u(d,p)}),c=e.suggestions.map((d,p)=>dt("li",{onMouseDown:e.handleClick.bind(null,p),onTouchStart:e.handleClick.bind(null,p),onMouseOver:e.handleHover.bind(null,p),className:p===e.selectedIndex?e.classNames.activeSuggestion:"",children:f(d,e.query)},p));return c.length===0||!ct(l,o||2,n,e.shouldRenderSuggestions)?null:dt("div",{ref:t,className:a.suggestions,"data-testid":"suggestions",children:Gf("ul",{children:[" ",c," "]})})},Wf=(e,t)=>{let{query:r,minQueryLength:o=2,isFocused:n,suggestions:a}=t;return!!(e.isFocused===n&&pt(e.suggestions,a)&&ct(r,o,n,t.shouldRenderSuggestions)===ct(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)&&e.selectedIndex===t.selectedIndex)},Kf=Bf(qf,Wf),yo=Kf;var wo=Ot(gt(),1);var Eo=Ot(gt(),1);import{useRef as $f}from"react";import{useDrag as Qf,useDrop as Vf}from"react-dnd";function bo(e){let t=e.map(o=>{let n=o-48*Math.floor(o/48);return String.fromCharCode(96<=o?n:o)}).join(""),r=ut(t);return new RegExp(`[${r}]+`)}function To(e){switch(e){case N.ENTER:return[10,13];case N.TAB:return 9;case N.COMMA:return 188;case N.SPACE:return 32;case N.SEMICOLON:return 186;default:return 0}}function xt(e){let{moveTag:t,readOnly:r,allowDragDrop:o}=e;return t!==void 0&&!r&&o}function vo(e){let{readOnly:t,allowDragDrop:r}=e;return!t&&r}import{jsx as xe}from"react/jsx-runtime";var zf=e=>{let{readOnly:t,removeComponent:r,onRemove:o,className:n,tag:a,index:i}=e,l=f=>{if(F.ENTER.includes(f.keyCode)||f.keyCode===F.SPACE){f.preventDefault(),f.stopPropagation();return}f.keyCode===F.BACKSPACE&&o(f)};if(t)return xe("span",{});let u=`Tag at index ${i} with value ${a.id} focussed. Press backspace to remove`;return r?xe(r,{"data-testid":"remove",onRemove:o,onKeyDown:l,className:n,"aria-label":u,tag:a,index:i}):xe("button",{"data-testid":"remove",onClick:o,onKeyDown:l,className:n,type:"button","aria-label":u,children:xe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:xe("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},So=zf;import{jsx as Yf,jsxs as Jf}from"react/jsx-runtime";var Ao={TAG:"tag"},_o=e=>{let t=$f(null),{readOnly:r=!1,tag:o,classNames:n,index:a,moveTag:i,allowDragDrop:l=!0,labelField:u="text",tags:f}=e,[{isDragging:c},d]=Qf(()=>({type:Ao.TAG,collect:b=>({isDragging:!!b.isDragging()}),item:e,canDrag:()=>xt({moveTag:i,readOnly:r,allowDragDrop:l})}),[f]),[,p]=Vf(()=>({accept:Ao.TAG,drop:b=>{let S=b.index,A=a;S!==A&&e?.moveTag?.(S,A)},canDrop:b=>vo(b)}),[f]);d(p(t));let T=e.tag[u],{className:h=""}=o,y=c?0:1;return Jf("span",{ref:t,className:(0,Eo.default)("tag-wrapper",n.tag,h),style:{opacity:y,cursor:xt({moveTag:i,readOnly:r,allowDragDrop:l})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[T,Yf(So,{tag:e.tag,className:n.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:r,index:a})]})};import{jsx as D,jsxs as Be}from"react/jsx-runtime";var ei=e=>{let{autofocus:t,autoFocus:r,readOnly:o,labelField:n,allowDeleteFromEmptyInput:a,allowAdditionFromPaste:i,allowDragDrop:l,minQueryLength:u,shouldRenderSuggestions:f,removeComponent:c,autocomplete:d,inline:p,maxTags:T,allowUnique:h,editable:y,placeholder:b,delimiters:S,separators:A,tags:E,inputFieldPosition:P,inputProps:U,classNames:Ue,maxLength:ke,inputValue:qe,clearAll:We}=e,[k,he]=$(e.suggestions),[O,X]=$(""),[Ke,ye]=$(!1),[L,M]=$(-1),[Ge,Q]=$(!1),[ze,$e]=$(""),[Z,ee]=$(-1),[yt,te]=$(""),Qe=Xf(),V=Io(null),bt=Io(null);He(()=>{S.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),He(()=>{typeof p<"u"&&console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[p]),He(()=>{typeof t<"u"&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),(t||r&&t!==!1)&&!o&&ue()},[r,r,o]),He(()=>{Lo()},[O,e.suggestions]);let Tt=s=>{let m=e.suggestions.slice();if(h){let Y=E.map(pe=>pe.id.trim().toLowerCase());m=m.filter(pe=>!Y.includes(pe.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(s,m);let g=m.filter(Y=>vt(s,Y)===0),_=m.filter(Y=>vt(s,Y)>0);return g.concat(_)},vt=(s,m)=>m[n].toLowerCase().indexOf(s.toLowerCase()),ue=()=>{X(""),V.current&&(V.current.value="",V.current.focus())},St=(s,m)=>{m.preventDefault(),m.stopPropagation();let g=E.slice();g.length!==0&&(te(""),e?.handleDelete?.(s,m),Ro(s,g))},Ro=(s,m)=>{if(!Qe?.current)return;let g=Qe.current.querySelectorAll(".ReactTags__remove"),_="";s===0&&m.length>1?(_=`Tag at index ${s} with value ${m[s].id} deleted. Tag at index 0 with value ${m[1].id} focussed. Press backspace to remove`,g[0].focus()):s>0?(_=`Tag at index ${s} with value ${m[s].id} deleted. Tag at index ${s-1} with value ${m[s-1].id} focussed. Press backspace to remove`,g[s-1].focus()):(_=`Tag at index ${s} with value ${m[s].id} deleted. Input focussed. Press enter to add a new tag`,V.current?.focus()),$e(_)},Oo=(s,m,g)=>{o||(y&&(ee(s),X(m[n]),bt.current?.focus()),e.handleTagClick?.(s,g))},At=s=>{e.handleInputChange&&e.handleInputChange(s.target.value,s);let m=s.target.value.trim();X(m)},Lo=()=>{let s=Tt(O);he(s),M(L>=s.length?s.length-1:L)},Et=s=>{let m=s.target.value;e.handleInputFocus&&e.handleInputFocus(m,s),ye(!0)},_t=s=>{let m=s.target.value;e.handleInputBlur&&(e.handleInputBlur(m,s),V.current&&(V.current.value="")),ye(!1),ee(-1)},It=s=>{if(s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),M(-1),Q(!1),he([]),ee(-1)),(A.indexOf(s.key)!==-1||S.indexOf(s.keyCode)!==-1)&&!s.shiftKey){(s.keyCode!==F.TAB||O!=="")&&s.preventDefault();let m=Ge&&L!==-1?k[L]:{id:O.trim(),[n]:O.trim(),className:""};Object.keys(m)&&Ve(m)}s.key==="Backspace"&&O===""&&(a||P===ae.INLINE)&&St(E.length-1,s),s.keyCode===F.UP_ARROW&&(s.preventDefault(),M(L<=0?k.length-1:L-1),Q(!0)),s.keyCode===F.DOWN_ARROW&&(s.preventDefault(),Q(!0),k.length===0?M(-1):M((L+1)%k.length))},wt=()=>T&&E.length>=T,Ct=s=>{if(!i)return;if(wt()){te(et.TAG_LIMIT),ue();return}te(""),s.preventDefault();let m=s.clipboardData||window.clipboardData,g=m.getData("text"),{maxLength:_=g.length}=e,Y=Math.min(_,g.length),pe=m.getData("text").substr(0,Y),me=S;A.length&&(me=[],A.forEach(oe=>{let Xe=To(oe);Array.isArray(Xe)?me=[...me,...Xe]:me.push(Xe)}));let Bo=bo(me),Uo=pe.split(Bo).map(oe=>oe.trim());mt(Uo).forEach(oe=>Ve({id:oe.trim(),[n]:oe.trim(),className:""}))},Ve=s=>{if(!s.id||!s[n])return;if(Z===-1){if(wt()){te(et.TAG_LIMIT),ue();return}te("")}let m=E.map(g=>g.id.toLowerCase());if(!(h&&m.indexOf(s.id.trim().toLowerCase())>=0)){if(d){let g=Tt(s[n]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(d===1&&g.length===1||d===!0&&g.length)&&(s=g[0])}Z!==-1&&e.onTagUpdate?e.onTagUpdate(Z,s):e?.handleAddition?.(s),X(""),Q(!1),M(-1),ee(-1),ue()}},Do=s=>{Ve(k[s])},Po=()=>{e.onClearAll&&e.onClearAll(),te(""),ue()},Mo=s=>{M(s),Q(!0)},Fo=(s,m)=>{let g=E[s];e?.handleDrag?.(g,s,m)},No=(()=>{let s={...Ze,...e.classNames};return E.map((m,g)=>D(Zf,{children:Z===g?D("div",{className:s.editTagInput,children:D("input",{ref:_=>{bt.current=_},onFocus:Et,value:O,onChange:At,onKeyDown:It,onBlur:_t,className:s.editTagInputField,onPaste:Ct,"data-testid":"tag-edit"})}):D(_o,{index:g,tag:m,tags:E,labelField:n,onDelete:_=>St(g,_),moveTag:l?Fo:void 0,removeComponent:c,onTagClicked:_=>Oo(g,m,_),readOnly:o,classNames:s,allowDragDrop:l})},g))})(),re={...Ze,...Ue},{name:jo,id:Ho}=e,Ye=p===!1?ae.BOTTOM:P,Je=o?null:Be("div",{className:re.tagInput,children:[D("input",{...U,ref:s=>{V.current=s},className:re.tagInputField,type:"text",placeholder:b,"aria-label":b,onFocus:Et,onBlur:_t,onChange:At,onKeyDown:It,onPaste:Ct,name:jo,id:Ho,maxLength:ke,value:qe,"data-automation":"input","data-testid":"input"}),D(yo,{query:O.trim(),suggestions:k,labelField:n,selectedIndex:L,handleClick:Do,handleHover:Mo,minQueryLength:u,shouldRenderSuggestions:f,isFocused:Ke,classNames:re,renderSuggestion:e.renderSuggestion}),We&&E.length>0&&D(ho,{classNames:re,onClick:Po}),yt&&Be("div",{"data-testid":"error",className:"ReactTags__error",children:[D("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:D("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),yt]})]});return Be("div",{className:(0,wo.default)(re.tags,"react-tags-wrapper"),ref:Qe,children:[D("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:ze}),Ye===ae.TOP&&Je,Be("div",{className:re.selected,children:[No,Ye===ae.INLINE&&Je]}),Ye===ae.BOTTOM&&Je]})},Co=ei;import{jsx as ht}from"react/jsx-runtime";var oi=e=>{let{placeholder:t=Lt,labelField:r=Dt,suggestions:o=[],delimiters:n=[],separators:a=e.delimiters?.length?[]:[N.ENTER,N.TAB],autofocus:i,autoFocus:l=!0,inline:u,inputFieldPosition:f="inline",allowDeleteFromEmptyInput:c=!1,allowAdditionFromPaste:d=!0,autocomplete:p=!1,readOnly:T=!1,allowUnique:h=!0,allowDragDrop:y=!0,tags:b=[],inputProps:S={},editable:A=!1,clearAll:E=!1,handleDelete:P,handleAddition:U,onTagUpdate:Ue,handleDrag:ke,handleFilterSuggestions:qe,handleTagClick:We,handleInputChange:k,handleInputFocus:he,handleInputBlur:O,minQueryLength:X,shouldRenderSuggestions:Ke,removeComponent:ye,onClearAll:L,classNames:M,name:Ge,id:Q,maxLength:ze,inputValue:$e,maxTags:Z,renderSuggestion:ee}=e;return ht(Co,{placeholder:t,labelField:r,suggestions:o,delimiters:n,separators:a,autofocus:i,autoFocus:l,inline:u,inputFieldPosition:f,allowDeleteFromEmptyInput:c,allowAdditionFromPaste:d,autocomplete:p,readOnly:T,allowUnique:h,allowDragDrop:y,tags:b,inputProps:S,editable:A,clearAll:E,handleDelete:P,handleAddition:U,onTagUpdate:Ue,handleDrag:ke,handleFilterSuggestions:qe,handleTagClick:We,handleInputChange:k,handleInputFocus:he,handleInputBlur:O,minQueryLength:X,shouldRenderSuggestions:Ke,removeComponent:ye,onClearAll:L,classNames:M,name:Ge,id:Q,maxLength:ze,inputValue:$e,maxTags:Z,renderSuggestion:ee})},Gd=({...e})=>ht(ti,{backend:ri,children:ht(oi,{...e})});export{F as KEYS,N as SEPARATORS,Gd as WithContext,oi as WithOutContext}; | ||
/*! Bundled license information: | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "react-tag-input", | ||
"version": "6.10.2", | ||
"version": "6.10.3-next.0", | ||
"type": "module", | ||
@@ -12,6 +12,6 @@ "description": "React tags is a fantastically simple tagging component for your React projects", | ||
"import": "./dist/index.js", | ||
"default": "./dist/index.js", | ||
"development": "./dist/index.js", | ||
"production": "./dist/index.min.js", | ||
"types": "./types/index.d.ts" | ||
"types": "./types/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
@@ -18,0 +18,0 @@ }, |
@@ -271,10 +271,15 @@ # React tags | ||
Install yarn | ||
``` | ||
npm install -g yarn | ||
``` | ||
``` | ||
git clone git@github.com:react-tags/react-tags.git | ||
cd react-tags | ||
npm install | ||
npm run precommit | ||
npm run start | ||
yarn | ||
yarn precommit | ||
yarn start | ||
``` | ||
open [http://localhost:8090/example](http://localhost:8090/example) | ||
open [http://localhost:8090](http://localhost:8090) | ||
@@ -281,0 +286,0 @@ |
@@ -12,5 +12,5 @@ import type { Tag } from './SingleTag'; | ||
separators: Array<string>; | ||
autofocus: boolean; | ||
autofocus?: boolean; | ||
autoFocus: boolean; | ||
inline: boolean; | ||
inline?: boolean; | ||
inputFieldPosition: 'inline' | 'top' | 'bottom'; | ||
@@ -17,0 +17,0 @@ allowDeleteFromEmptyInput: boolean; |
@@ -115,12 +115,13 @@ import { ReactNode } from 'react'; | ||
classNames?: { | ||
root: string; | ||
rootFocused: string; | ||
tags: string; | ||
tagInput: string; | ||
tagInputField: string; | ||
selected: string; | ||
selectedTag: string; | ||
selectedTagName: string; | ||
search: string; | ||
searchInput: string; | ||
tag: string; | ||
remove: string; | ||
suggestions: string; | ||
suggestionActive: string; | ||
suggestionDisabled: string; | ||
activeSuggestion: string; | ||
editTagInput: string; | ||
editTagInputField: string; | ||
clearAll: string; | ||
}; | ||
@@ -127,0 +128,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
2582
703
308211
2