@walkover/autosuggest-custom
Advanced tools
Comparing version 0.3.20 to 0.3.21
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var e={649:function(e,t,n){var r=n(81),o=n.n(r),a=n(645),i=n.n(a)()(o());i.push([e.id,"/* COMMON CLASSES FOR BOTH GROUPED AND SIMPLE AUTOSUGGEST */\r\n.suggestionBox::-webkit-scrollbar {\r\n display: none;\r\n}\r\n\r\n.editable-div::-webkit-scrollbar {\r\n display: none;\r\n}\r\n\r\n.suggestionBox {\r\n display: absolute;\r\n width: auto;\r\n border: 1px solid #ccc;\r\n background-color: #f9f9f9;\r\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\r\n max-height: 70vh;\r\n height: auto;\r\n overflow: auto;\r\n}\r\n\r\n.editable-div {\r\n border: 1px solid #ccc;\r\n width: 300px;\r\n height: 100px;\r\n font-family: Helvetica, sans-serif;\r\n font-size: 18px;\r\n margin-bottom: 2px;\r\n padding: 5px;\r\n word-wrap: break-word;\r\n overflow: scroll;\r\n}\r\n.editable-div:empty:not(:focus):before {\r\n\tcontent: attr(data-text);\r\n color: #999999;\r\n}\r\n\r\n.chip {\r\n display: inline-block;\r\n padding: 2px 10px;\r\n background-color: #f1f1f1;\r\n border-radius: 3px;\r\n font-family: Arial, sans-serif;\r\n font-size: 13px;\r\n margin: 2px 3px;\r\n color: #555;\r\n}\r\n\r\n.suggestionMainContainer {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.hoverValueContainer {\r\n min-width: 100px !important;\r\n max-width: 200px !important;\r\n padding: 10px !important;\r\n word-wrap: break-word;\r\n color: white;\r\n background-color: rgb(31, 32, 30);\r\n font-size: 14px !important;\r\n border-radius: 5px;\r\n z-index: 30;\r\n min-height: 20px !important;\r\n max-height: fit-content !important;\r\n}\r\n\r\n.hoverValueContainer::-webkit-scrollbar {\r\n display: none !important;\r\n}\r\n\r\n.suggestionBox\r\n{\r\n background-color: white;\r\n color: black ;\r\n display: none ;\r\n z-index: 9999;\r\n max-width: 20vw;\r\n}\r\n\r\n/* SIMPLE AUTO-SUGGESTIONS CLASSES */\r\n.listSuggestionContainerForSimpleAutosuggest {\r\n list-style-type: none;\r\n font-size: 16px;\r\n padding: 5px;\r\n}\r\n\r\n.listSuggestionContainerForSimpleAutosuggest:hover {\r\n background-color: rgb(128, 128, 128, 0.5);\r\n}\r\n\r\n.listSuggestionTag{\r\n font-size: 16px !important;\r\n}\r\n\r\n.listSuggestionTagContent{\r\n font-size: 12px !important;\r\n}\r\n\r\n/* GROUPED SUGGESTIONS CLASSES */\r\n.listSuggestions {\r\n list-style-type: none;\r\n font-size: 16px !important;\r\n padding: 0px 0px 0px 17px;\r\n}\r\n\r\n.valueContent {\r\n font-size: 12px !important;\r\n list-style-type: none;\r\n margin: 0px 0px 0px 17px;\r\n}\r\n\r\n.ulTag {\r\n font-size: 21px !important;\r\n padding: 5px;\r\n background-color: black;\r\n color: white;\r\n width: 100% !important;\r\n}\r\n\r\n.listSuggestionContainer {\r\n display: flex;\r\n flex-direction: column;\r\n padding: 5px;\r\n}\r\n\r\n.listSuggestionContainer:hover {\r\n background-color: rgb(128, 128, 128, 0.5);\r\n}",""]),t.Z=i},645:function(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var l=0;l<this.length;l++){var s=this[l][0];null!=s&&(i[s]=!0)}for(var u=0;u<e.length;u++){var c=[].concat(e[u]);r&&i[c[0]]||(void 0!==a&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=a),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},81:function(e){e.exports=function(e){return e[1]}},379:function(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],l=0;l<e.length;l++){var s=e[l],u=r.base?s[0]+r.base:s[0],c=a[u]||0,d="".concat(u," ").concat(c);a[u]=c+1;var f=n(d),p={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==f)t[f].references++,t[f].updater(p);else{var g=o(p,r);r.byIndex=l,t.splice(l,0,{identifier:d,updater:g,references:1})}i.push(d)}return i}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var l=n(a[i]);t[l].references--}for(var s=r(e,o),u=0;u<a.length;u++){var c=n(a[u]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}a=s}}},569:function(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},216:function(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:function(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},795:function(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:function(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};!function(){n.r(r),n.d(r,{default:function(){return A}});var e=require("react"),t=n.n(e);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(n){var r=n.id,i=n.editableDivRef,l=n.suggestion,s=n.chipClass,u=n.editableDivClass,c=n.suggestionBoxClass,d=n.onEnterBtnEvent,f=n.getInputValueWithContext,p=n.setHtml,g=n.setText,v=n.defaultValue,m=n.disable,b=n.symbolForSearching,y=n.placeholder,h=n.location,x=void 0===h?"bottom":h,w=l||[],S=(0,e.useRef)(),E=a((0,e.useState)([]),2),C=E[0],T=E[1],N=a((0,e.useState)(-1),2),A=N[0],O=N[1],R=a((0,e.useState)(),2),k=R[0],B=R[1],M=a((0,e.useState)({left:0,top:0}),2),D=M[0],L=M[1];(0,e.useEffect)((function(){i.current&&(i.current.innerHTML=v||"")}),[i]);var j=function(){if(i.current){var e=i.current.innerHTML,t=document.createElement("div");t.innerHTML=e,function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(n.getAttribute("walkover-attribute")){var r=n.getAttribute("data-attribute")+"",o=document.createTextNode(r);n.parentNode.replaceChild(o,n)}}}(t.getElementsByTagName("span"));var n=t.innerHTML.replace(/<br\s*\/?>/gi,"\n");t.innerHTML=n,function(e,t){p&&p((function(){return t})),g&&g(e),f&&f(e,t)}(t.innerText,e)}},I=function(e){var t,n,r,o=window.getSelection(),a=o.anchorNode,l=o.anchorOffset;if(a&&a.nodeType===Node.TEXT_NODE){var u,c,d,f=document.createElement("span");f.className=s||"chip",f.contentEditable="false",f.textContent=e.name,f.setAttribute("walkover-attribute",e.content),f.setAttribute("data-attribute",e.content),f.addEventListener("mouseover",(function(t){return function(e,t,n){var r=e.target,o=r.getBoundingClientRect(),a=(r.getBoundingClientRect(),o.top),i=o.right,l=(o.left,o.Bottom,document.getElementById("suggestionBox"));l.style.border="0.5px black solid",l.style.borderRadius="5px",l.style.padding="0.5px 5px",l.style.fontSize="14px",l.style.position="absolute",l.style.transform="translate(0% , 0%)","bottom"===x&&(l.style.top="".concat(a+o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderTopLeftRadius="0px",l.style.marginLeft="20px"),"right"===x&&(l.style.top="".concat(a,"px"),l.style.left="".concat(i,"px"),l.style.borderTopLeftRadius="0px"),"top"===x&&(l.style.bottom="".concat(a-o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderBottomRightRadius="0px",l.style.margin="0 -50px"),l.style.display="block",l.innerHTML="<span>".concat(t,"</span> <br> <span><b>Compiled Value - </b></span><span >").concat(n||"","</span>")}(t,e.content,e.value)})),f.addEventListener("mouseleave",(function(){document.getElementById("suggestionBox").style.display="none"}));var p=a.nodeValue.substring(0,l),g=a.nodeValue.substring(l,a.nodeValue.length),v=p.lastIndexOf(k),m=a.nodeValue.substring(0,v),b=document.createTextNode(m);a.parentNode.insertBefore(b,a),a.parentNode.insertBefore(f,a),(1===(null===(u=g.substring(0,1))||void 0===u?void 0:u.length)&&" "!==(null===(c=g)||void 0===c?void 0:c.substring(0,1))||0===(null===(d=g.substring(0,1))||void 0===d?void 0:d.length))&&(g=" "+g);var y=document.createTextNode(g);a.parentNode.insertBefore(y,a),t=y,0,e.name.length,n=document.createRange(),r=window.getSelection(),n.setStart(t,0),n.collapse(!0),r.removeAllRanges(),r.addRange(n),a.parentNode.removeChild(a)}j(),T([]),setTimeout((function(){i.current&&i.current.focus()}))},H={ref:S,className:"suggestionMainContainer"},V={"data-text":y,id:r||"",contentEditable:!0!==m,ref:i,className:u||"editable-div",suppressContentEditableWarning:!0,onKeyDown:function(e){"ArrowUp"===e.key?function(e){0!==C.length&&e.preventDefault(),O((function(e){return-1===e?C.length-1:Math.max(0,e-1)}))}(e):"ArrowDown"===e.key?function(e){0!==C.length&&e.preventDefault(),O((function(e){return e===C.length-1?0:Math.min(C.length-1,e+1)}))}(e):"Enter"===e.key&&function(e){-1===A&&T([]);var t=C[A];t?(e.preventDefault(),I(t),O(-1)):d?function(e){e.preventDefault(),d()}(e):function(e){var t=window.getSelection(),n=t.getRangeAt(0),r=i.current.innerHTML;if(!r.endsWith("<br>")&&!r.endsWith("</span> ")&&function(){var e=window.getSelection();if(0===e.rangeCount)return!1;var t=e.getRangeAt(0);return t.startOffset===t.startContainer.textContent.length}()){var o=document.createElement("br");n.insertNode(o),n.setStartAfter(o),n.setEndAfter(o),t.removeAllRanges(),t.addRange(n)}var a=document.createElement("br");n.insertNode(a),n.setStartAfter(a),n.setEndAfter(a),t.removeAllRanges(),t.addRange(n),e.preventDefault()}(e)}(e)},onInput:function(e){!function(e){if(j(),i.current&&0===i.current.innerText.length)return T([]);var t=window.getSelection(),n=t.anchorOffset,r=t.anchorNode.textContent.substring(0,n).trim(),o=function(){if(S.current||i.current){var e=S.current,t=i.current,n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),r.setEnd(n.anchorNode,n.anchorOffset);var o=r.cloneRange();o.collapse(!1);var a=o.getBoundingClientRect(),l=e.getBoundingClientRect(),s=o.getBoundingClientRect().height;return{left:a.left-l.left,top:a.top-l.top+s}}}();L(o);var a=r.split(/ |\u00A0/),l=a[a.length-1],s=l.includes(b);if(" "===b&&(s=!0),l.length>0&&s){var u=l.split(b);u=u[u.length-1],B(b+u);var c=w.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().startsWith(u.trim().toLowerCase())}));T(c),O(0)}else T([]),O(-1)}()},onPaste:function(e){!function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain");t=t.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,t)}(e)}},z={position:"absolute",left:D.left,top:D.top,opacity:Object.entries(C).length>0?1:0,zIndex:100},P=function(e){return{background:A===e?"#D3D3D3":"",cursor:"pointer"}};return t().createElement("div",o({},H,{style:{position:"relative"}}),t().createElement("div",{id:"suggestionBox"}),t().createElement("div",V),t().createElement("div",{className:c||"suggestionBox",style:z},null==C?void 0:C.map((function(e,n){return function(e,n){return t().createElement("div",o({},function(e,t){return{key:t,className:"listSuggestionContainerForSimpleAutosuggest",onMouseDown:function(){return I(e)},onClick:function(){return I(e)}}}(e,n),{style:P(n)}),t().createElement("div",{className:"listSuggestionTag"}," ",e.name," "),t().createElement("div",{className:"listSuggestionTagContent"}," ",e.content," "))}(e,n)}))))}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(n){var r=n.id,o=n.editableDivRef,a=n.suggestion,i=n.chipClass,l=n.editableDivClass,d=n.suggestionBoxClass,f=n.onEnterBtnEvent,p=n.getInputValueWithContext,g=n.setHtml,v=n.setText,m=n.defaultValue,b=n.disable,y=n.symbolForSearching,h=n.placeholder,x=n.location,w=void 0===x?"bottom":x,S=a||[],E=(0,e.useRef)(),C=u((0,e.useState)({}),2),T=C[0],N=C[1],A=u((0,e.useState)(-1),2),O=A[0],R=A[1],k=u((0,e.useState)(),2),B=k[0],M=k[1],D=u((0,e.useState)({left:0,top:0}),2),L=D[0],j=D[1],I=u((0,e.useState)(),2),H=I[0],V=I[1];(0,e.useEffect)((function(){o.current&&(o.current.innerHTML=m||"")}),[o]);var z=function(){if(o.current){var e=o.current.innerHTML,t=document.createElement("div");t.innerHTML=e,function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(n.getAttribute("walkover-attribute")){var r=n.getAttribute("data-attribute")+"",o=document.createTextNode(r);n.parentNode.replaceChild(o,n)}}}(t.getElementsByTagName("span"));var n=t.innerHTML.replace(/<br\s*\/?>/gi,"\n");t.innerHTML=n,function(e,t){g&&g((function(){return t})),v&&v(e),p&&p(e,t)}(t.innerText,e)}};var P=function(e){if(z(),o.current&&0===o.current.innerText.length)return N([]);var t=window.getSelection(),n=t.anchorOffset,r=t.anchorNode.textContent.substring(0,n).trim(),a=function(){if(E.current||o.current){var e=E.current,t=o.current,n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),r.setEnd(n.anchorNode,n.anchorOffset);var a=r.cloneRange();a.collapse(!1);var i=a.getBoundingClientRect(),l=e.getBoundingClientRect(),s=a.getBoundingClientRect().height;return{left:i.left-l.left,top:i.top-l.top+s}}}();j(a);var i=r.split(/ |\u00A0/),l=i[i.length-1],s=l.includes(y);if(" "===y&&(s=!0),l.length>0&&s){var u=l.split(y);u=u[u.length-1],M(y+u);var d=function(e,t){var n,r={},o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;a.name.toLowerCase().includes(t)&&(r[a.groupName]||(r[a.groupName]=[]),r[a.groupName].push(a))}}catch(e){o.e(e)}finally{o.f()}return r}(S,u.trim().toLowerCase());N(d),R(-1)}else N([]),R(-1)},U=function(e){var t,n,r,a=window.getSelection(),l=a.anchorNode,s=a.anchorOffset;if(l&&l.nodeType===Node.TEXT_NODE){var u,c,d,f=document.createElement("span");f.className=i||"chip",f.contentEditable="false",f.textContent=e.name,f.setAttribute("walkover-attribute",e.content),f.setAttribute("data-attribute",e.content),f.addEventListener("mouseover",(function(t){return function(e,t,n){var r=e.target,o=r.getBoundingClientRect(),a=(r.getBoundingClientRect(),o.top),i=o.right,l=(o.left,o.Bottom,document.getElementById("suggestionBox"));l.style.border="0.5px black solid",l.style.borderRadius="5px",l.style.padding="0.5px 5px",l.style.fontSize="14px",l.style.position="absolute",l.style.transform="translate(0% , 0%)","bottom"===w&&(l.style.top="".concat(a+o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderTopLeftRadius="0px",l.style.marginLeft="20px"),"right"===w&&(l.style.top="".concat(a,"px"),l.style.left="".concat(i,"px"),l.style.borderTopLeftRadius="0px"),"top"===w&&(l.style.bottom="".concat(a-o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderBottomRightRadius="0px",l.style.margin="0 -50px"),l.style.display="block",l.innerHTML="<span>".concat(t,"</span> <br> <span><b>Compiled Value - </b></span><span >").concat(n||"","</span>")}(t,e.content,e.value)})),f.addEventListener("mouseleave",(function(){document.getElementById("suggestionBox").style.display="none"}));var p=l.nodeValue.substring(0,s),g=l.nodeValue.substring(s,l.nodeValue.length),v=p.lastIndexOf(B),m=l.nodeValue.substring(0,v),b=document.createTextNode(m);l.parentNode.insertBefore(b,l),l.parentNode.insertBefore(f,l),(1===(null===(u=g.substring(0,1))||void 0===u?void 0:u.length)&&" "!==(null===(c=g)||void 0===c?void 0:c.substring(0,1))||0===(null===(d=g.substring(0,1))||void 0===d?void 0:d.length))&&(g=" "+g);var y=document.createTextNode(g);l.parentNode.insertBefore(y,l),t=y,0,e.name.length,n=document.createRange(),r=window.getSelection(),n.setStart(t,0),n.collapse(!0),r.removeAllRanges(),r.addRange(n),l.parentNode.removeChild(l)}z(),N([]),setTimeout((function(){o.current&&o.current.focus()}))},G={ref:E,className:"suggestionMainContainer"},W={"data-text":h,id:r||"",contentEditable:!0!==b,ref:o,className:l||"editable-div",suppressContentEditableWarning:!0,onKeyDown:function(e){"ArrowUp"===e.key?function(e){0!==Object.entries(T).length&&e.preventDefault();var t=Object.keys(T),n=t.length-1;if(-1===O){var r=t[n],o=T[r];return V({key:r,index:n}),void R((null==o?void 0:o.length)-1)}if(0===O){var a=H.index-1,i=t[a]||t[n],l=T[i];V({key:i,index:a}),R(l.length-1)}else R((function(e){return e-1}))}(e):"ArrowDown"===e.key?function(e){if(0!==Object.entries(T).length&&e.preventDefault(),-1===O){var t=Object.keys(T)[0];V({key:t,index:0}),R(0)}else{var n=T[null==H?void 0:H.key];if((null==n?void 0:n.length)-1===O){var r=H.index+1,o=Object.keys(T)[r];o||(o=Object.keys(T)[0],r=0),V({key:o,index:r}),R(0)}else R((function(e){return e+1}))}}(e):"Enter"===e.key&&function(e){if(-1===O&&N([]),0!==Object.keys(T).length&&-1!==O){e.preventDefault();var t=T[H.key][O];t&&(U(t),R(-1))}else f?function(e){e.preventDefault(),f()}(e):function(e){var t=window.getSelection(),n=t.getRangeAt(0),r=o.current.innerHTML;if(!r.endsWith("<br>")&&!r.endsWith("</span> ")&&function(){var e=window.getSelection();if(0===e.rangeCount)return!1;var t=e.getRangeAt(0);return t.startOffset===t.startContainer.textContent.length}()){var a=document.createElement("br");n.insertNode(a),n.setStartAfter(a),n.setEndAfter(a),t.removeAllRanges(),t.addRange(n)}var i=document.createElement("br");n.insertNode(i),n.setStartAfter(i),n.setEndAfter(i),t.removeAllRanges(),t.addRange(n),e.preventDefault()}(e)}(e)},onInput:function(e){P()},onPaste:function(e){!function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain");t=t.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,t)}(e)}},F={position:"absolute",left:L.left,top:L.top,opacity:Object.entries(T).length>0?1:0,zIndex:100},_=function(e,t){return{key:t,className:"listSuggestionContainer",onMouseDown:function(){return U(e)},onClick:function(){return U(e)}}},Z=function(e,t){return{background:O===e&&t===H.key?"#D3D3D3":"",cursor:"pointer"}};return t().createElement("div",s({},G,{style:{position:"relative"}}),t().createElement("div",{id:"suggestionBox"}),t().createElement("div",W),t().createElement("div",{className:d||"suggestionBox",style:F},Object.entries(T).map((function(e){var n=u(e,2);return function(e,n){return t().createElement("div",{className:"groupBlock",key:e},t().createElement("div",{className:"ulTag"},e),function(e,n){return e.map((function(e,r){return t().createElement("div",s({},_(e,r),{style:Z(r,n)}),t().createElement("span",{className:"listSuggestions"},e.name),t().createElement("span",{className:"valueContent"},e.content))}))}(n,e))}(n[0],n[1])}))))}var p=n(379),g=n.n(p),v=n(795),m=n.n(v),b=n(569),y=n.n(b),h=n(565),x=n.n(h),w=n(216),S=n.n(w),E=n(589),C=n.n(E),T=n(649),N={};N.styleTagTransform=C(),N.setAttributes=x(),N.insert=y().bind(null,"head"),N.domAPI=m(),N.insertStyleElement=S(),g()(T.Z,N),T.Z&&T.Z.locals&&T.Z.locals;var A=function(e){return null!=e&&e.groupByGroupName?t().createElement(f,e):t().createElement(l,e)}}(),module.exports=r}(); | ||
!function(){"use strict";var e={520:function(e,t,n){var r=n(81),o=n.n(r),a=n(645),i=n.n(a)()(o());i.push([e.id,"#tooltip\r\n{\r\n background-color: white;\r\n color: black ;\r\n display: none ;\r\n z-index: 9999;\r\n max-width: 20vw;\r\n}\r\n",""]),t.Z=i},649:function(e,t,n){var r=n(81),o=n.n(r),a=n(645),i=n.n(a)()(o());i.push([e.id,"/* COMMON CLASSES FOR BOTH GROUPED AND SIMPLE AUTOSUGGEST */\r\n.suggestionBox::-webkit-scrollbar {\r\n display: none;\r\n}\r\n\r\n.editable-div::-webkit-scrollbar {\r\n display: none;\r\n}\r\n\r\n.suggestionBox {\r\n display: absolute;\r\n width: auto;\r\n border: 1px solid #ccc;\r\n background-color: #f9f9f9;\r\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\r\n max-height: 70vh;\r\n height: auto;\r\n overflow: auto;\r\n}\r\n\r\n.editable-div {\r\n border: 1px solid #ccc;\r\n width: 300px;\r\n height: 100px;\r\n font-family: Helvetica, sans-serif;\r\n font-size: 18px;\r\n margin-bottom: 2px;\r\n padding: 5px;\r\n word-wrap: break-word;\r\n overflow: scroll;\r\n}\r\n.editable-div:empty:not(:focus):before {\r\n\tcontent: attr(data-text);\r\n color: #999999;\r\n}\r\n\r\n.chip {\r\n display: inline-block;\r\n padding: 2px 10px;\r\n background-color: #f1f1f1;\r\n border-radius: 3px;\r\n font-family: Arial, sans-serif;\r\n font-size: 13px;\r\n margin: 2px 3px;\r\n color: #555;\r\n}\r\n\r\n.suggestionMainContainer {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.hoverValueContainer {\r\n min-width: 100px !important;\r\n max-width: 200px !important;\r\n padding: 10px !important;\r\n word-wrap: break-word;\r\n color: white;\r\n background-color: rgb(31, 32, 30);\r\n font-size: 14px !important;\r\n border-radius: 5px;\r\n z-index: 30;\r\n min-height: 20px !important;\r\n max-height: fit-content !important;\r\n}\r\n\r\n.hoverValueContainer::-webkit-scrollbar {\r\n display: none !important;\r\n}\r\n\r\n/* SIMPLE AUTO-SUGGESTIONS CLASSES */\r\n.listSuggestionContainerForSimpleAutosuggest {\r\n list-style-type: none;\r\n font-size: 16px;\r\n padding: 5px;\r\n}\r\n\r\n.listSuggestionContainerForSimpleAutosuggest:hover {\r\n background-color: rgb(128, 128, 128, 0.5);\r\n}\r\n\r\n.listSuggestionTag{\r\n font-size: 16px !important;\r\n}\r\n\r\n.listSuggestionTagContent{\r\n font-size: 12px !important;\r\n}\r\n\r\n/* GROUPED SUGGESTIONS CLASSES */\r\n.listSuggestions {\r\n list-style-type: none;\r\n font-size: 16px !important;\r\n padding: 0px 0px 0px 17px;\r\n}\r\n\r\n.valueContent {\r\n font-size: 12px !important;\r\n list-style-type: none;\r\n margin: 0px 0px 0px 17px;\r\n}\r\n\r\n.ulTag {\r\n font-size: 21px !important;\r\n padding: 5px;\r\n background-color: black;\r\n color: white;\r\n width: 100% !important;\r\n}\r\n\r\n.listSuggestionContainer {\r\n display: flex;\r\n flex-direction: column;\r\n padding: 5px;\r\n}\r\n\r\n.listSuggestionContainer:hover {\r\n background-color: rgb(128, 128, 128, 0.5);\r\n}",""]),t.Z=i},450:function(e,t,n){var r=n(81),o=n.n(r),a=n(645),i=n.n(a)()(o());i.push([e.id,"#tooltip\r\n{\r\n background-color: white;\r\n color: black ;\r\n display: none ;\r\n z-index: 9999;\r\n max-width: 20vw;\r\n}\r\n",""]),t.Z=i},645:function(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var l=0;l<this.length;l++){var s=this[l][0];null!=s&&(i[s]=!0)}for(var u=0;u<e.length;u++){var c=[].concat(e[u]);r&&i[c[0]]||(void 0!==a&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=a),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},81:function(e){e.exports=function(e){return e[1]}},379:function(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],l=0;l<e.length;l++){var s=e[l],u=r.base?s[0]+r.base:s[0],c=a[u]||0,d="".concat(u," ").concat(c);a[u]=c+1;var f=n(d),p={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==f)t[f].references++,t[f].updater(p);else{var g=o(p,r);r.byIndex=l,t.splice(l,0,{identifier:d,updater:g,references:1})}i.push(d)}return i}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var l=n(a[i]);t[l].references--}for(var s=r(e,o),u=0;u<a.length;u++){var c=n(a[u]);0===t[c].references&&(t[c].updater(),t.splice(c,1))}a=s}}},569:function(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},216:function(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:function(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},795:function(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:function(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};!function(){n.r(r),n.d(r,{default:function(){return M}});var e=require("react"),t=n.n(e),o=n(379),a=n.n(o),i=n(795),l=n.n(i),s=n(569),u=n.n(s),c=n(565),d=n.n(c),f=n(216),p=n.n(f),g=n(589),v=n.n(g),m=n(520),b={};function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(this,arguments)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w(n){var r=n.id,o=n.editableDivRef,a=n.suggestion,i=n.chipClass,l=n.editableDivClass,s=n.suggestionBoxClass,u=n.onEnterBtnEvent,c=n.getInputValueWithContext,d=n.setHtml,f=n.setText,p=n.defaultValue,g=n.disable,v=n.symbolForSearching,m=n.placeholder,b=n.location,x=void 0===b?"bottom":b,w=a||[],S=(0,e.useRef)(),E=h((0,e.useState)([]),2),C=E[0],T=E[1],A=h((0,e.useState)(-1),2),N=A[0],O=A[1],k=h((0,e.useState)(),2),R=k[0],M=k[1],D=h((0,e.useState)({left:0,top:0}),2),L=D[0],B=D[1];(0,e.useEffect)((function(){o.current&&(o.current.innerHTML=p||"")}),[o]);var j=function(){if(o.current){var e=o.current.innerHTML,t=document.createElement("div");t.innerHTML=e,function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(n.getAttribute("walkover-attribute")){var r=n.getAttribute("data-attribute")+"",o=document.createTextNode(r);n.parentNode.replaceChild(o,n)}}}(t.getElementsByTagName("span"));var n=t.innerHTML.replace(/<br\s*\/?>/gi,"\n");t.innerHTML=n,function(e,t){d&&d((function(){return t})),f&&f(e),c&&c(e,t)}(t.innerText,e)}},I=function(e){var t,n,r,a=window.getSelection(),l=a.anchorNode,s=a.anchorOffset;if(l&&l.nodeType===Node.TEXT_NODE){var u,c,d,f=document.createElement("span");f.className=i||"chip",f.contentEditable="false",f.textContent=e.name,f.setAttribute("walkover-attribute",e.content),f.setAttribute("data-attribute",e.content),f.addEventListener("mouseover",(function(t){return function(e,t,n){var r=e.target,o=r.getBoundingClientRect(),a=(r.getBoundingClientRect(),o.top),i=o.right,l=(o.left,o.Bottom,document.getElementById("tooltip"));l.style.border="0.5px black solid",l.style.borderRadius="5px",l.style.padding="0.5px 5px",l.style.fontSize="14px",l.style.position="absolute",l.style.transform="translate(0% , 0%)","bottom"===x&&(l.style.top="".concat(a+o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderTopLeftRadius="0px",l.style.marginLeft="20px"),"right"===x&&(l.style.top="".concat(a,"px"),l.style.left="".concat(i,"px"),l.style.borderTopLeftRadius="0px"),"top"===x&&(l.style.bottom="".concat(a-o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderBottomRightRadius="0px",l.style.margin="0 -50px"),l.style.display="block",l.innerHTML="<span>".concat(t,"</span> <br> <span><b>Compiled Value - </b></span><span >").concat(n||"","</span>")}(t,e.content,e.value)})),f.addEventListener("mouseleave",(function(){document.getElementById("tooltip").style.display="none"}));var p=l.nodeValue.substring(0,s),g=l.nodeValue.substring(s,l.nodeValue.length),v=p.lastIndexOf(R),m=l.nodeValue.substring(0,v),b=document.createTextNode(m);l.parentNode.insertBefore(b,l),l.parentNode.insertBefore(f,l),(1===(null===(u=g.substring(0,1))||void 0===u?void 0:u.length)&&" "!==(null===(c=g)||void 0===c?void 0:c.substring(0,1))||0===(null===(d=g.substring(0,1))||void 0===d?void 0:d.length))&&(g=" "+g);var y=document.createTextNode(g);l.parentNode.insertBefore(y,l),t=y,0,e.name.length,n=document.createRange(),r=window.getSelection(),n.setStart(t,0),n.collapse(!0),r.removeAllRanges(),r.addRange(n),l.parentNode.removeChild(l)}j(),T([]),setTimeout((function(){o.current&&o.current.focus()}))},H={ref:S,className:"suggestionMainContainer"},z={"data-text":m,id:r||"",contentEditable:!0!==g,ref:o,className:l||"editable-div",suppressContentEditableWarning:!0,onKeyDown:function(e){"ArrowUp"===e.key?function(e){0!==C.length&&e.preventDefault(),O((function(e){return-1===e?C.length-1:Math.max(0,e-1)}))}(e):"ArrowDown"===e.key?function(e){0!==C.length&&e.preventDefault(),O((function(e){return e===C.length-1?0:Math.min(C.length-1,e+1)}))}(e):"Enter"===e.key&&function(e){-1===N&&T([]);var t=C[N];t?(e.preventDefault(),I(t),O(-1)):u?function(e){e.preventDefault(),u()}(e):function(e){var t=window.getSelection(),n=t.getRangeAt(0),r=o.current.innerHTML;if(!r.endsWith("<br>")&&!r.endsWith("</span> ")&&function(){var e=window.getSelection();if(0===e.rangeCount)return!1;var t=e.getRangeAt(0);return t.startOffset===t.startContainer.textContent.length}()){var a=document.createElement("br");n.insertNode(a),n.setStartAfter(a),n.setEndAfter(a),t.removeAllRanges(),t.addRange(n)}var i=document.createElement("br");n.insertNode(i),n.setStartAfter(i),n.setEndAfter(i),t.removeAllRanges(),t.addRange(n),e.preventDefault()}(e)}(e)},onInput:function(e){!function(e){if(j(),o.current&&0===o.current.innerText.length)return T([]);var t=window.getSelection(),n=t.anchorOffset,r=t.anchorNode.textContent.substring(0,n).trim(),a=function(){if(S.current||o.current){var e=S.current,t=o.current,n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),r.setEnd(n.anchorNode,n.anchorOffset);var a=r.cloneRange();a.collapse(!1);var i=a.getBoundingClientRect(),l=e.getBoundingClientRect(),s=a.getBoundingClientRect().height;return{left:i.left-l.left,top:i.top-l.top+s}}}();B(a);var i=r.split(/ |\u00A0/),l=i[i.length-1],s=l.includes(v);if(" "===v&&(s=!0),l.length>0&&s){var u=l.split(v);u=u[u.length-1],M(v+u);var c=w.filter((function(e){var t;return null==e||null===(t=e.name)||void 0===t?void 0:t.toLowerCase().startsWith(u.trim().toLowerCase())}));T(c),O(0)}else T([]),O(-1)}()},onPaste:function(e){!function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain");t=t.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,t)}(e)}},P={position:"absolute",left:L.left,top:L.top,opacity:Object.entries(C).length>0?1:0,zIndex:100},V=function(e){return{background:N===e?"#D3D3D3":"",cursor:"pointer"}};return t().createElement("div",null,t().createElement("div",{id:"tooltip"}),t().createElement("div",y({},H,{style:{position:"relative"}}),t().createElement("div",z),t().createElement("div",{className:s||"suggestionBox",style:P},null==C?void 0:C.map((function(e,n){return function(e,n){return t().createElement("div",y({},function(e,t){return{key:t,className:"listSuggestionContainerForSimpleAutosuggest",onMouseDown:function(){return I(e)},onClick:function(){return I(e)}}}(e,n),{style:V(n)}),t().createElement("div",{className:"listSuggestionTag"}," ",e.name," "),t().createElement("div",{className:"listSuggestionTagContent"}," ",e.content," "))}(e,n)})))))}b.styleTagTransform=v(),b.setAttributes=d(),b.insert=u().bind(null,"head"),b.domAPI=l(),b.insertStyleElement=p(),a()(m.Z,b),m.Z&&m.Z.locals&&m.Z.locals;var S=n(450),E={};function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},C.apply(this,arguments)}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(n){var r=n.id,o=n.editableDivRef,a=n.suggestion,i=n.chipClass,l=n.editableDivClass,s=n.suggestionBoxClass,u=n.onEnterBtnEvent,c=n.getInputValueWithContext,d=n.setHtml,f=n.setText,p=n.defaultValue,g=n.disable,v=n.symbolForSearching,m=n.placeholder,b=n.location,y=void 0===b?"bottom":b,h=a||[],x=(0,e.useRef)(),w=T((0,e.useState)({}),2),S=w[0],E=w[1],N=T((0,e.useState)(-1),2),O=N[0],k=N[1],R=T((0,e.useState)(),2),M=R[0],D=R[1],L=T((0,e.useState)({left:0,top:0}),2),B=L[0],j=L[1],I=T((0,e.useState)(),2),H=I[0],z=I[1];(0,e.useEffect)((function(){o.current&&(o.current.innerHTML=p||"")}),[o]);var P=function(){if(o.current){var e=o.current.innerHTML,t=document.createElement("div");t.innerHTML=e,function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(n.getAttribute("walkover-attribute")){var r=n.getAttribute("data-attribute")+"",o=document.createTextNode(r);n.parentNode.replaceChild(o,n)}}}(t.getElementsByTagName("span"));var n=t.innerHTML.replace(/<br\s*\/?>/gi,"\n");t.innerHTML=n,function(e,t){d&&d((function(){return t})),f&&f(e),c&&c(e,t)}(t.innerText,e)}};var V=function(e){if(P(),o.current&&0===o.current.innerText.length)return E([]);var t=window.getSelection(),n=t.anchorOffset,r=t.anchorNode.textContent.substring(0,n).trim(),a=function(){if(x.current||o.current){var e=x.current,t=o.current,n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),r.setEnd(n.anchorNode,n.anchorOffset);var a=r.cloneRange();a.collapse(!1);var i=a.getBoundingClientRect(),l=e.getBoundingClientRect(),s=a.getBoundingClientRect().height;return{left:i.left-l.left,top:i.top-l.top+s}}}();j(a);var i=r.split(/ |\u00A0/),l=i[i.length-1],s=l.includes(v);if(" "===v&&(s=!0),l.length>0&&s){var u=l.split(v);u=u[u.length-1],D(v+u);var c=function(e,t){var n,r={},o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw a}}}}(e);try{for(o.s();!(n=o.n()).done;){var a=n.value;a.name.toLowerCase().includes(t)&&(r[a.groupName]||(r[a.groupName]=[]),r[a.groupName].push(a))}}catch(e){o.e(e)}finally{o.f()}return r}(h,u.trim().toLowerCase());E(c),k(-1)}else E([]),k(-1)},Z=function(e){var t,n,r,a=window.getSelection(),l=a.anchorNode,s=a.anchorOffset;if(l&&l.nodeType===Node.TEXT_NODE){var u,c,d,f=document.createElement("span");f.className=i||"chip",f.contentEditable="false",f.textContent=e.name,f.setAttribute("walkover-attribute",e.content),f.setAttribute("data-attribute",e.content),f.addEventListener("mouseover",(function(t){return function(e,t,n){var r=e.target,o=r.getBoundingClientRect(),a=(r.getBoundingClientRect(),o.top),i=o.right,l=(o.left,o.Bottom,document.getElementById("tooltip"));l.style.border="0.5px black solid",l.style.borderRadius="5px",l.style.padding="0.5px 5px",l.style.fontSize="14px",l.style.position="absolute",l.style.transform="translate(0% , 0%)","bottom"===y&&(l.style.top="".concat(a+o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderTopLeftRadius="0px",l.style.marginLeft="20px"),"right"===y&&(l.style.top="".concat(a,"px"),l.style.left="".concat(i,"px"),l.style.borderTopLeftRadius="0px"),"top"===y&&(l.style.bottom="".concat(a-o.height,"px"),l.style.left="".concat(i-o.width,"px"),l.style.borderBottomRightRadius="0px",l.style.margin="0 -50px"),l.style.display="block",l.innerHTML="<span>".concat(t,"</span> <br> <span><b>Compiled Value - </b></span><span >").concat(n||"","</span>")}(t,e.content,e.value)})),f.addEventListener("mouseleave",(function(){document.getElementById("tooltip").style.display="none"}));var p=l.nodeValue.substring(0,s),g=l.nodeValue.substring(s,l.nodeValue.length),v=p.lastIndexOf(M),m=l.nodeValue.substring(0,v),b=document.createTextNode(m);l.parentNode.insertBefore(b,l),l.parentNode.insertBefore(f,l),(1===(null===(u=g.substring(0,1))||void 0===u?void 0:u.length)&&" "!==(null===(c=g)||void 0===c?void 0:c.substring(0,1))||0===(null===(d=g.substring(0,1))||void 0===d?void 0:d.length))&&(g=" "+g);var h=document.createTextNode(g);l.parentNode.insertBefore(h,l),t=h,0,e.name.length,n=document.createRange(),r=window.getSelection(),n.setStart(t,0),n.collapse(!0),r.removeAllRanges(),r.addRange(n),l.parentNode.removeChild(l)}P(),E([]),setTimeout((function(){o.current&&o.current.focus()}))},U={ref:x,className:"suggestionMainContainer"},G={"data-text":m,id:r||"",contentEditable:!0!==g,ref:o,className:l||"editable-div",suppressContentEditableWarning:!0,onKeyDown:function(e){"ArrowUp"===e.key?function(e){0!==Object.entries(S).length&&e.preventDefault();var t=Object.keys(S),n=t.length-1;if(-1===O){var r=t[n],o=S[r];return z({key:r,index:n}),void k((null==o?void 0:o.length)-1)}if(0===O){var a=H.index-1,i=t[a]||t[n],l=S[i];z({key:i,index:a}),k(l.length-1)}else k((function(e){return e-1}))}(e):"ArrowDown"===e.key?function(e){if(0!==Object.entries(S).length&&e.preventDefault(),-1===O){var t=Object.keys(S)[0];z({key:t,index:0}),k(0)}else{var n=S[null==H?void 0:H.key];if((null==n?void 0:n.length)-1===O){var r=H.index+1,o=Object.keys(S)[r];o||(o=Object.keys(S)[0],r=0),z({key:o,index:r}),k(0)}else k((function(e){return e+1}))}}(e):"Enter"===e.key&&function(e){if(-1===O&&E([]),0!==Object.keys(S).length&&-1!==O){e.preventDefault();var t=S[H.key][O];t&&(Z(t),k(-1))}else u?function(e){e.preventDefault(),u()}(e):function(e){var t=window.getSelection(),n=t.getRangeAt(0),r=o.current.innerHTML;if(!r.endsWith("<br>")&&!r.endsWith("</span> ")&&function(){var e=window.getSelection();if(0===e.rangeCount)return!1;var t=e.getRangeAt(0);return t.startOffset===t.startContainer.textContent.length}()){var a=document.createElement("br");n.insertNode(a),n.setStartAfter(a),n.setEndAfter(a),t.removeAllRanges(),t.addRange(n)}var i=document.createElement("br");n.insertNode(i),n.setStartAfter(i),n.setEndAfter(i),t.removeAllRanges(),t.addRange(n),e.preventDefault()}(e)}(e)},onInput:function(e){V()},onPaste:function(e){!function(e){e.preventDefault();var t=e.clipboardData.getData("text/plain");t=t.replace(/\n/g,"<br>"),document.execCommand("insertHTML",!1,t)}(e)}},W={position:"absolute",left:B.left,top:B.top,opacity:Object.entries(S).length>0?1:0,zIndex:100},F=function(e,t){return{key:t,className:"listSuggestionContainer",onMouseDown:function(){return Z(e)},onClick:function(){return Z(e)}}},_=function(e,t){return{background:O===e&&t===H.key?"#D3D3D3":"",cursor:"pointer"}};return t().createElement("div",null,t().createElement("div",{id:"tooltip"}),t().createElement("div",C({},U,{style:{position:"relative"}}),t().createElement("div",G),t().createElement("div",{className:s||"suggestionBox",style:W},Object.entries(S).map((function(e){var n=T(e,2);return function(e,n){return t().createElement("div",{className:"groupBlock",key:e},t().createElement("div",{className:"ulTag"},e),function(e,n){return e.map((function(e,r){return t().createElement("div",C({},F(e,r),{style:_(r,n)}),t().createElement("span",{className:"listSuggestions"},e.name),t().createElement("span",{className:"valueContent"},e.content))}))}(n,e))}(n[0],n[1])})))))}E.styleTagTransform=v(),E.setAttributes=d(),E.insert=u().bind(null,"head"),E.domAPI=l(),E.insertStyleElement=p(),a()(S.Z,E),S.Z&&S.Z.locals&&S.Z.locals;var k=n(649),R={};R.styleTagTransform=v(),R.setAttributes=d(),R.insert=u().bind(null,"head"),R.domAPI=l(),R.insertStyleElement=p(),a()(k.Z,R),k.Z&&k.Z.locals&&k.Z.locals;var M=function(e){return null!=e&&e.groupByGroupName?t().createElement(O,e):t().createElement(w,e)}}(),module.exports=r}(); |
{ | ||
"name": "@walkover/autosuggest-custom", | ||
"version": "0.3.20", | ||
"version": "0.3.21", | ||
"author": "walkover-web", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
import React, { useState, useEffect, useRef } from 'react' | ||
import "./GroupedSuggestion.css" | ||
export default function GroupedSuggestion({ id, editableDivRef, suggestion, chipClass, editableDivClass, suggestionBoxClass, onEnterBtnEvent, getInputValueWithContext, setHtml, setText, defaultValue, disable, symbolForSearching, placeholder, location = "bottom" }) { | ||
@@ -231,3 +231,3 @@ | ||
const spanBottom = spanRect.Bottom; | ||
const div = document.getElementById('suggestionBox'); | ||
const div = document.getElementById('tooltip'); | ||
div.style.border = "0.5px black solid" | ||
@@ -281,3 +281,3 @@ div.style.borderRadius = "5px" | ||
span.addEventListener('mouseover', (e) => onMouseHover(e, replace.content, replace.value)); | ||
span.addEventListener('mouseleave', () => { const div = document.getElementById('suggestionBox'); div.style.display = 'none'; }); | ||
span.addEventListener('mouseleave', () => { const div = document.getElementById('tooltip'); div.style.display = 'none'; }); | ||
var strwithrepsecttocursor = currentNode.nodeValue.substring(0, caretOffset); | ||
@@ -383,7 +383,9 @@ var strwithrepsecttocursor2 = currentNode.nodeValue.substring(caretOffset, currentNode.nodeValue.length); | ||
return ( | ||
<div {...parentDivProps} style={styleForParentDiv}> | ||
<div id="suggestionBox" ></div> | ||
<div {...editableDivProps} /> | ||
<div className={suggestionBoxClass || 'suggestionBox'} style={styleForSuggestionBox}> | ||
{Object.entries(filteredSuggestions).map(([key, groupSugesstionArray]) => renderGroups(key, groupSugesstionArray))} | ||
<div> | ||
<div id='tooltip' ></div> | ||
<div {...parentDivProps} style={styleForParentDiv}> | ||
<div {...editableDivProps} /> | ||
<div className={suggestionBoxClass || 'suggestionBox'} style={styleForSuggestionBox}> | ||
{Object.entries(filteredSuggestions).map(([key, groupSugesstionArray]) => renderGroups(key, groupSugesstionArray))} | ||
</div> | ||
</div> | ||
@@ -390,0 +392,0 @@ </div> |
import React, { useState, useRef, useEffect } from 'react'; | ||
import "./SimpleAutoSuggest.css" | ||
export default function SimpleAutoSuggest({ id, editableDivRef, suggestion, chipClass, editableDivClass, suggestionBoxClass, onEnterBtnEvent, getInputValueWithContext, setHtml, setText, defaultValue, disable, symbolForSearching ,placeholder ,location ="bottom" }) { | ||
export default function SimpleAutoSuggest({ id, editableDivRef, suggestion, chipClass, editableDivClass, suggestionBoxClass, onEnterBtnEvent, getInputValueWithContext, setHtml, setText, defaultValue, disable, symbolForSearching, placeholder, location = "bottom" }) { | ||
let suggestions = suggestion || []; | ||
@@ -35,3 +35,3 @@ const parentDivRef = useRef(); | ||
const functionForEnterPress = (event) => { | ||
if (selectedSuggestionIndex === -1) setFilteredSuggestions([]); | ||
if(selectedSuggestionIndex === -1) setFilteredSuggestions([]); | ||
const selectedSuggestion = filteredSuggestions[selectedSuggestionIndex]; | ||
@@ -74,3 +74,3 @@ if (selectedSuggestion) { | ||
if (selection.rangeCount === 0) { | ||
return false; // No selection available | ||
return false; // No selection available | ||
} | ||
@@ -81,3 +81,3 @@ const range = selection.getRangeAt(0); | ||
return caretOffset === textContentLength; | ||
} | ||
} | ||
const replaceDataAttributeWithSpanValue = (spanElements) => { | ||
@@ -155,3 +155,3 @@ for (var i = spanElements.length - 1; i >= 0; i--) { | ||
let lastWord = currentWord.includes(symbolForSearching) | ||
if (symbolForSearching === " ") lastWord = true | ||
if(symbolForSearching === " ") lastWord = true | ||
if (currentWord.length > 0 && lastWord) { | ||
@@ -179,3 +179,3 @@ let searchQuery = currentWord.split(symbolForSearching) | ||
const onMouseHover = (event, content, value) => { | ||
const onMouseHover = (event, content , value) => { | ||
const span = event.target; | ||
@@ -188,3 +188,3 @@ const spanRect = span.getBoundingClientRect(); | ||
const spanBottom = spanRect.Bottom; | ||
const div = document.getElementById('suggestionBox'); | ||
const div = document.getElementById('tooltip'); | ||
div.style.border = "0.5px black solid" | ||
@@ -222,6 +222,6 @@ div.style.borderRadius = "5px" | ||
div.style.display = 'block'; | ||
div.innerHTML = `<span>${content}</span> <br> <span><b>Compiled Value - </b></span><span >${value || ""}</span>`; | ||
div.innerHTML = `<span>${content}</span> <br> <span><b>Compiled Value - </b></span><span >${value || ""}</span>`; | ||
}; | ||
const insertSuggestion = (replace) => { | ||
@@ -238,4 +238,4 @@ const sel = window.getSelection(); | ||
span.setAttribute("data-attribute", replace.content); | ||
span.addEventListener('mouseover', (e) => onMouseHover(e, replace.content, replace.value)); | ||
span.addEventListener('mouseleave', () => { const div = document.getElementById('suggestionBox'); div.style.display = 'none'; }); | ||
span.addEventListener('mouseover', (e) => onMouseHover(e, replace.content ,replace.value)); | ||
span.addEventListener('mouseleave', () => {const div = document.getElementById('tooltip'); div.style.display = 'none'; }); | ||
var strwithrepsecttocursor = currentNode.nodeValue.substring(0, caretOffset); | ||
@@ -248,3 +248,3 @@ var strwithrepsecttocursor2 = currentNode.nodeValue.substring(caretOffset, currentNode.nodeValue.length); | ||
currentNode.parentNode.insertBefore(span, currentNode); | ||
if ((strwithrepsecttocursor2.substring(0, 1)?.length === 1 && !(strwithrepsecttocursor2?.substring(0, 1) === " ")) || strwithrepsecttocursor2.substring(0, 1)?.length === 0) { | ||
@@ -272,3 +272,3 @@ strwithrepsecttocursor2 = `\u00A0` + strwithrepsecttocursor2; | ||
let plainText = event.clipboardData.getData('text/plain'); | ||
// replace new line with <br> tag | ||
// replace new line with <br> tag | ||
plainText = plainText.replace(/\n/g, '<br>'); | ||
@@ -335,7 +335,9 @@ document.execCommand('insertHTML', false, plainText); | ||
return ( | ||
<div {...parentDivProps} style={styleForParentDiv}> | ||
<div id="suggestionBox"></div> | ||
<div {...editableDivProps} /> | ||
<div className={suggestionBoxClass || 'suggestionBox'} style={styleForSuggestionBox}> | ||
{filteredSuggestions?.map((suggestion, index) => (renderSuggestions(suggestion, index)))} | ||
<div> | ||
<div id='tooltip' ></div> | ||
<div {...parentDivProps} style={styleForParentDiv}> | ||
<div {...editableDivProps} /> | ||
<div className={suggestionBoxClass || 'suggestionBox'} style={styleForSuggestionBox}> | ||
{filteredSuggestions?.map((suggestion, index) => (renderSuggestions(suggestion, index)))} | ||
</div> | ||
</div> | ||
@@ -342,0 +344,0 @@ </div> |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
91366
17
841