intelicoreact 1.8.65 → 1.8.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,l=Array(n);t<n;t++)l[t]=e[t];return l}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}Object.defineProperty(exports,"__esModule",{value:!0});var l=exports,o={MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH:function(){return w},default:function(){return b}};for(var r in o)Object.defineProperty(l,r,{enumerable:!0,get:o[r]});var i=require("react/jsx-runtime"),u=h(require("classnames")),c=function(e,n){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":t(e))!=="object"&&"function"!=typeof e)return{default:e};var l=g(n);if(l&&l.has(e))return l.get(e);var o={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var u=r?Object.getOwnPropertyDescriptor(e,i):null;u&&(u.get||u.set)?Object.defineProperty(o,i,u):o[i]=e[i]}return o.default=e,l&&l.set(e,o),o}(require("react")),a=require("react-dom"),s=require("react-feather"),d=require("../../../Functions/fieldValueFormatters"),v=h(require("../Input/Input")),f=h(require("../RadioInput/RadioInput")),p=h(require("./components/DropdownLoader")),m=h(require("./useDropdown"));function h(e){return e&&e.__esModule?e:{default:e}}function g(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,t=new WeakMap;return(g=function(e){return e?t:n})(e)}require("./Dropdown.scss");var _="dropdown",w=10,b=function(l){var o,r,h,g,b,y,j,x,C,L,O=l.label,S=l.options,E=l.value,N=l.error,I=l.disabled,k=l.onChange,M=l.placeholder,H=l.className,P=l.isSearchable,A=l.entity,R=l.scrollReactionObj,T=l.isListTop,D=l.isNotValidateASCII,B=void 0!==D&&D,F=l.testId,q=void 0===F?"dropdown":F,W=l.sortAlphabetical,K=l.fieldKey,V=l.id,U=l.noOptionsText,z=void 0===U?"No options available":U,X=l.isDoNotPullOutListOfMainContainer,G=l.withMobileLogic,$=l.withActions,J=l.minItemsForShowMobileSearch,Q=l.customTrigger,Y=l.tabIndex,Z=l.onActionConfirmClick,ee=l.onActionCancelClick,en=l.isDefaultOpened,et=l.isDefaultOpenedMobile,el=l.footerContent,eo=l.closeOnSelect,er=void 0===eo||eo,ei=l.closeOnSelectMobile,eu=void 0===ei||ei,ec=l.withApplyLogic,ea=void 0!==ec&&ec,es=l.cancelButtonRef,ed=l.applyButtonRef,ev=(0,m.default)({id:V,fieldKey:K,value:E,sortAlphabetical:void 0===W||W,withMobileLogic:G,options:S,isSearchable:P,minItemsForShowMobileSearch:void 0===J?w:J,isDoNotPullOutListOfMainContainer:X}),ef=ev.dropdownId,ep=ev.isMobile,em=ev.isOpen,eh=ev.setIsOpen,eg=ev.searchValue,e_=ev.setSearchValue,ew=ev.initListHeight,eb=ev.setInitListHeight,ey=ev.isSearchChanged,ej=ev.setIsSearchChanged,ex=ev.isSearchInputFocused,eC=ev.setIsSearchInputFocused,eL=ev.isScrollableList,eO=ev.setIsScrollableList,eS=ev.isFixedMaxHeight,eE=ev.setIsFixedMaxHeight,eN=ev.scrollTop,eI=ev.setScrollTop,ek=ev.scrollHeight,eM=ev.setScrollHeight,eH=ev.maxListContainerHeight,eP=ev.setMaxListContainerHeight,eA=ev.getListContainer,eR=ev.getListContainerWrapper,eT=ev.getParentNode,eD=ev.getPreparedOptionLabel,eB=ev.getSortedOptions,eF=ev.filteredGroups,eq=ev.filteredItems,eW=ev.filteredOptions,eK=ev.selectedLabel,eV=ev.postfixText,eU=ev.dropdownRef,ez=ev.dropdownListRef,eX=ev.dropdownListWrapperRef,eG=ev.dropdownFooterRef,e$=ev.searchInputRef,eJ=ev.wrapperRef,eQ=ev.isSearchable,eY=ev.valueToApply,eZ=ev.valueToApplyRef,e0=ev.setValueToApply,e1=function(){eh(!1),null==e0||e0(null),null==ee||ee()},e3=function(){(null==eZ?void 0:eZ.current)!==null&&(null==eZ?void 0:eZ.current)!==void 0&&(null==k||k(eZ.current),setTimeout(function(){return null==Z?void 0:Z()},1)),null==e1||e1()},e2=function(e){(ep?eu:er)&&eh(!1),ea&&(null==ed?void 0:ed.current)?null==e0||e0(e.value):null==k||k(e.value)},e6=function(e){return!![9,13].includes(e.keyCode)&&(e1(),!0)},e8=function(e){return!![9,13].includes(e.keyCode)&&(eh(!0),!0)},e9=function(e){var n=e;B||(n=(0,d.formatToOnlyASCIICodeText)(n)),ej(!0),e_(n)},e4=function(e){e.target===(null==eJ?void 0:eJ.current)&&(e.stopPropagation(),e.preventDefault(),e1())},e5=function(e){e9(e)},e7=function(e){var n;(null==(n=eA())?void 0:n.contains(null==e?void 0:e.target))||(null==eU?void 0:eU.current)===null||(null==eU?void 0:eU.current.contains(null==e?void 0:e.target))||e1()},ne=(0,c.useCallback)(function(e){var n=R||{},t=n.callback,l=n.isWithAnyScrolling,o=n.scrollingInaccuracy,r=null==e?void 0:e.target;t&&"function"==typeof t&&(l?t(e):Math.round(r.clientHeight+r.scrollTop+(void 0===o?0:o))>=r.scrollHeight&&t(e))},[eW]),nn=function(){var e=document.createElement("div");e.setAttribute("id",ef),e.classList.add("dropdown__container"),ep&&e.addEventListener("click",function(e){(null==e?void 0:e.target).id===ef&&e1()});try{null==(n=eA())||n.remove()}finally{if(ep){try{null==(o=document.getElementById("mlw-".concat(ef)))||o.remove()}catch(e){}var n,t,l,o,r=document.createElement("div");r.classList.add("dropdown-mobile"),r.setAttribute("id","mlw-".concat(ef)),null==r||r.append(e),null==(l=eT())||l.append(r)}else null==(t=eT())||t.append(e)}},nt=function(){var e,n,t,l,o,r,i,u,c,a,s,d,v,f,p,m,h,g,_,w=eA();if(!w||!em)return!1;var b=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,y=null!=(p=null==eU||null==(e=eU.current)?void 0:e.getBoundingClientRect())?p:{},j=y.width,x=y.height,C=void 0===x?0:x,L=y.left,O=y.top,S=void 0===O?0:O,E=w.getElementsByClassName("dropdown__list")[0],N=null==eX||null==(n=eX.current)?void 0:n.getElementsByClassName("dropdown__list-header")[0],I=Number.parseInt(null!=(m=null==(l=getComputedStyle(null==eX?void 0:eX.current))||null==(t=l.marginTop)?void 0:t.replace("px",""))?m:"0",10),k=null!=ew?ew:Number.parseInt(null!=(h=null==(r=getComputedStyle(E))||null==(o=r.maxHeight)?void 0:o.replace("px",""))?h:"0",10);null===ew&&eb(k);var M=S-I,H=b-S-C-2*I,P=null==E||null==(i=E.getBoundingClientRect())?void 0:i.height,A=(ep?(null==eX||null==(c=eX.current)||null==(u=c.getBoundingClientRect())?void 0:u.height)-(null==N||null==(a=N.getBoundingClientRect())?void 0:a.height):M>=k||H>=k?k-3*I:M>H?M-3*I:H-4*I)-(null!=(g=null==eG||null==(d=eG.current)||null==(s=d.getBoundingClientRect())?void 0:s.height)?g:0);return w.style.minWidth="".concat(j,"px"),w.style.left="".concat(L,"px"),w.style.top="".concat("bottom"==(M<H||H>=P?"bottom":"top")?S+C:S-3*I-Number.parseInt(null!=(_=null==(f=getComputedStyle(null==eX?void 0:eX.current))||null==(v=f.height)?void 0:v.replace("px",""))?_:"0",10),"px"),eH===A||ep||eP(A),E.style.maxHeight="".concat(A,"px"),!0},nl=em?e7:function(){},no=function(n){var t,l=function(e){"open_modal"===e.value?null==k||k("open_modal"):e2(e)},o=[{label:"New ".concat(A),value:"open_modal",className:"dropdown__list-item--modal"}].concat(function(n){if(Array.isArray(n))return e(n)}(t=null!=eW?eW:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(n,t){if(n){if("string"==typeof n)return e(n,void 0);var l=Object.prototype.toString.call(n).slice(8,-1);if("Object"===l&&n.constructor&&(l=n.constructor.name),"Map"===l||"Set"===l)return Array.from(l);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return e(n,t)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return{onChange:function(e){return n?l(e):e2(e)},options:n?o:S}},nr=(0,c.useMemo)(function(){return A&&""!==A&&"string"==typeof A},[A]),ni=(0,c.useMemo)(function(){return no(nr)},[nr,eW]),nu=function(e,t,l){var o,r,c,a;return(0,i.jsxs)("button",{type:"button","data-testid":"".concat(q,"-").concat(l,"-option"),onMouseDown:function(){return ni.onChange(e)},className:(0,u.default)("".concat(_,"__list-item"),(n(a={},"".concat(_,"__list-item_active"),e.value===(null!=eY?eY:E)),n(a,"".concat(_,"__list-item_disabled"),e.disabled),a),e.className),value:null==e?void 0:e.value,children:[!ep&&(0,i.jsx)("span",{className:(0,u.default)("".concat(_,"__active-icon"),n({},"".concat(_,"__active-icon_active"),e.value===E)),children:(0,i.jsx)(s.Check,{})}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-item-label"),e.labelClassName||""),dangerouslySetInnerHTML:{__html:eD(e.label,e.postfix,e.description)}}),(null==e?void 0:e.icon)||"",ep?null!=(c=null==e?void 0:e.customMobileIcon)?c:(0,i.jsx)(f.default,{value:e.value,checked:null!=eY?eY:E}):""]},null==(r=e.value)||null==(o=r.toString())?void 0:o.replace(/ /g,"_"))},nc=function(e){var n,t,l,o,r,c;return(null!=(c=null==(n=e.items)?void 0:n.length)?c:0)>0?(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"-group"),e.className),children:[(0,i.jsx)("div",{className:"".concat(_,"-group__name"),children:e.label}),null==(t=e.items)?void 0:t.map(function(e,n){var t;return nu(e,n,null==(t=(null==e?void 0:e.testId)||n)?void 0:t.toString())})]},null==(r=e.label)||null==(o=r.toString())?void 0:o.replace(/ /g,"_").concat(null==(l=Date.now())?void 0:l.toString())):null};if((0,c.useEffect)(function(){return document.addEventListener("click",e7,!0),function(){var e,n;null==(e=eA())||e.remove(),null==(n=eR())||n.remove(),document.removeEventListener("click",e7,!0)}},[]),(0,c.useEffect)(function(){(!X||eU.current)&&(nn(),(en&&!ep||et)&&eh(!0))},[X,eU.current]),(0,c.useLayoutEffect)(function(){var e;return ep?(window.removeEventListener("resize",nt),window.removeEventListener("mousewheel",nl),window.removeEventListener("scroll",nl),window.removeEventListener("touchmove",nl)):(window.addEventListener("resize",nt),window.addEventListener("mousewheel",nl),window.addEventListener("scroll",nl),window.addEventListener("touchmove",nl)),null==(e=eA())||e.addEventListener("click",nl),function(){var e;window.removeEventListener("resize",nt),window.removeEventListener("mousewheel",nl),window.removeEventListener("scroll",nl),window.removeEventListener("touchmove",nl),null==(e=eA())||e.removeEventListener("click",nl)}},[eA]),(0,c.useLayoutEffect)(function(){nt()},[eH,em,eg,ep,eS,S]),(0,c.useEffect)(function(){var e,n,l=em?"addEventListener":"removeEventListener";return null==es||null==(e=es.current)||e[l]("click",e1,!0),null==ed||null==(n=ed.current)||n[l]("click",e3,!0),!em&&(ej(!1),ep||eP(0)),R&&(void 0===R?"undefined":t(R))==="object"&&em&&ez&&ez.current&&ez.current.addEventListener("scroll",ne),function(){R&&(void 0===R?"undefined":t(R))==="object"&&removeEventListener("scroll",ne)}},[em,ez]),(0,c.useEffect)(function(){var e;return eg||!ex||ep||(e_(eK),e=setTimeout(function(){return e$.current.select()},1)),ex||em||e_(null),function(){clearTimeout(e)}},[ex]),(0,c.useEffect)(function(){if(em&&!ex&&(null==e$?void 0:e$.current)&&!ep&&(null==(e=e$.current)||e.focus()),em?null==(n=eA())||n.classList.add("dropdown__container--opened"):(null==(t=e$.current)||t.blur(),null==(l=eA())||l.classList.remove("dropdown__container--opened")),em&&ep){var e,n,t,l,o,r,i,u,c=null==ez||null==(o=ez.current)?void 0:o.querySelector("button[value='".concat(null!=eY?eY:E,"']"));c&&(null==ez||null==(u=ez.current)||u.scrollTo(0,(null==c||null==(r=c.getBoundingClientRect())?void 0:r.y)-(null==ez||null==(i=ez.current)?void 0:i.getBoundingClientRect().y)-16))}!em&&ep&&e_(null)},[em]),(0,c.useEffect)(function(){if(em&&ep&&(null==ez?void 0:ez.current)&&!eg){var e,n,t,l;eO((null==ez||null==(e=ez.current)?void 0:e.scrollHeight)>(null==ez||null==(n=ez.current)?void 0:n.clientHeight)),eE(eL||(null==ez||null==(t=ez.current)?void 0:t.scrollHeight)>(null==ez||null==(l=ez.current)?void 0:l.clientHeight))}},[em,ep,eL,null==ez?void 0:ez.current,null==ez||null==(j=ez.current)?void 0:j.scrollHeight,null==ez||null==(x=ez.current)?void 0:x.clientHeight]),(0,c.useEffect)(function(){var e,n=function(e){var n,t;eI(Number.parseInt(null==e||null==(t=e.target)||null==(n=t.scrollTop)?void 0:n.toString(),10))};return em&&ep&&(null==ez?void 0:ez.current)&&(null==ez||null==(e=ez.current)||e.addEventListener("scroll",n)),function(){if((null==ez?void 0:ez.current)!==null){var e;null==ez||null==(e=ez.current)||e.removeEventListener("scroll",n)}}},[em,ep,null==ez?void 0:ez.current]),(0,c.useEffect)(function(){if(null==ez?void 0:ez.current){var e,n;eM(Number.parseInt(((null==ez||null==(e=ez.current)?void 0:e.scrollHeight)-(null==ez||null==(n=ez.current)?void 0:n.clientHeight)).toString(),10))}},[eN,null==ez?void 0:ez.current]),!S)return null;return(0,i.jsxs)("div",{className:(0,u.default)(_,H,(n(C={disabled:I},"".concat(_,"-mobile"),ep),n(C,"".concat(_,"--focused"),em&&!ep),n(C,"".concat(_,"--with-custom-trigger"),!!Q),C)),ref:eU,onKeyDown:e6,onKeyUp:e8,children:[(0,i.jsx)("button",{type:"button","data-testid":q,className:(0,u.default)("".concat(_,"__trigger"),"input__wrap",(n(L={},"".concat(_,"__trigger--with-actions"),$),n(L,"placeholder",null==E||""===E),n(L,"error",N),L)),onClick:function(){return eh(!0)},onKeyDown:e6,onKeyUp:e8,tabIndex:Y,children:Q||(0,i.jsxs)(i.Fragment,{children:[eQ&&!ep?(0,i.jsx)("input",{ref:e$,className:"".concat(_,"__input"),value:String(em?null!=eg?eg:"":null!=eK?eK:""),onChange:function(e){return e5(e.target.value)},placeholder:M,onFocus:function(){return eC(!0)},onBlur:function(){return eC(!1)}}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text",children:eK||M||""}),eV&&(0,i.jsx)("span",{className:"dropdown__list-item-postfix",children:eV})]}),(0,i.jsx)("span",{className:(0,u.default)("".concat(_,"__arrow"),n({},"".concat(_,"__arrow_active"),em)),onClick:function(e){null==e||e.stopPropagation(),eh(function(e){return!e})},children:ep?(0,i.jsx)(s.Code,{className:"mobile-icon"}):em?(0,i.jsx)(s.ChevronUp,{}):(0,i.jsx)(s.ChevronDown,{})})]})}),$&&(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__actions")),children:[(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__actions-item")),onClick:Z,children:(0,i.jsx)(s.Check,{})}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__actions-item")),onClick:ee,children:(0,i.jsx)(s.X,{})})]}),em&&((y=eA())?(0,a.createPortal)((0,i.jsx)("div",{"data-testid":"".concat(q,"-container-wrapper"),className:(0,u.default)("".concat(_,"__container-wrapper")),ref:eJ,onClick:ep?e4:function(){},children:(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-wrapper"),(n(r={},"".concat(_,"__list-wrapper--fixed-height"),eS),n(r,"".concat(_,"__list-wrapper--with-bottom-shadow"),eL&&ep&&!el),n(r,"".concat(_,"__list-wrapper--with-bottom-shadow-hidden"),eN===ek&&!el),r)),ref:eX,children:[ep&&(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-header"),(n(h={},"".concat(_,"__list-header-with-shadow"),eL&&ep),n(h,"".concat(_,"__list-header-with-shadow-hidden"),0===eN),h)),children:[(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-header-row")),children:[(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-label")),children:O}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-close-icon")),onClick:e1,children:(0,i.jsx)(s.X,{onClick:e1})})]}),eQ&&(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-header-row")),children:(0,i.jsx)(v.default,{ref:e$,className:"".concat(_,"__input"),value:eg||"",onChange:e5,placeholder:M||"Search",withDelete:!0,onFocus:function(){return eC(!0)},onBlur:function(){return eC(!1)}})})]}),(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list"),(n(g={},"".concat(_,"__list-top"),T),n(g,"".concat(_,"__list--with-footer"),el),g)),ref:ez,children:[ni.options&&(null==(o=eB(ni.options))?void 0:o.map(function(e,t){if(null==e||null==(i=e.items)?void 0:i.length)if(!eQ||!ey)return nc(e);else{var l,o,r,i,u,c,a=null==(c=e.items)?void 0:c.slice().filter(function(e){var n;return(null==e||null==(n=e.label)?void 0:n.toLowerCase().includes((null==eg?void 0:eg.toLowerCase())||""))||!(null==e?void 0:e.value)||(null==e?void 0:e.value)===""});if(null==a?void 0:a.length)return nc((l=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},o=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),o.forEach(function(t){n(e,t,l[t])})}return e}({},e),o=o={items:a},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(o)):(function(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t.push.apply(t,l)}return t})(Object(o)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(o,e))}),l))}else if(!eQ||!ey||(null==e||null==(u=e.label)?void 0:u.toLowerCase().includes((null==eg?void 0:eg.toLowerCase())||""))||!(null==e?void 0:e.value)||(null==e?void 0:e.value)==="")return nu(e,t,null==(r=(null==e?void 0:e.testId)||t)?void 0:r.toString());return null})),!(null==eq?void 0:eq.length)&&!(null==eF?void 0:eF.length)&&(0,i.jsx)("div",{className:"".concat(_,"__list-item ").concat(_,"__list-item--no-options"),children:z}),I&&em&&(0,i.jsx)(p.default,{})]}),el&&(0,i.jsx)("div",{ref:eG,className:(0,u.default)("".concat(_,"__footer"),(n(b={},"".concat(_,"__footer-with-shadow"),ep&&eL),n(b,"".concat(_,"__footer-with-shadow-hidden"),eN===ek),b)),children:el})]})}),y):null)]})};
|
|
1
|
+
function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,l=Array(n);t<n;t++)l[t]=e[t];return l}function n(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function t(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}Object.defineProperty(exports,"__esModule",{value:!0});var l=exports,o={MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH:function(){return w},default:function(){return b}};for(var r in o)Object.defineProperty(l,r,{enumerable:!0,get:o[r]});var i=require("react/jsx-runtime"),u=h(require("classnames")),c=function(e,n){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":t(e))!=="object"&&"function"!=typeof e)return{default:e};var l=g(n);if(l&&l.has(e))return l.get(e);var o={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var u=r?Object.getOwnPropertyDescriptor(e,i):null;u&&(u.get||u.set)?Object.defineProperty(o,i,u):o[i]=e[i]}return o.default=e,l&&l.set(e,o),o}(require("react")),a=require("react-dom"),s=require("react-feather"),d=require("../../../Functions/fieldValueFormatters"),v=h(require("../Input/Input")),f=h(require("../RadioInput/RadioInput")),p=h(require("./components/DropdownLoader")),m=h(require("./useDropdown"));function h(e){return e&&e.__esModule?e:{default:e}}function g(e){if("function"!=typeof WeakMap)return null;var n=new WeakMap,t=new WeakMap;return(g=function(e){return e?t:n})(e)}require("./Dropdown.scss");var _="dropdown",w=10,b=function(l){var o,r,h,g,b,y,j,x,L,C,O=l.label,E=l.options,S=l.value,N=l.error,I=l.disabled,k=l.onChange,H=l.placeholder,M=l.className,P=l.isSearchable,A=l.entity,T=l.scrollReactionObj,D=l.isListTop,R=l.isNotValidateASCII,B=void 0!==R&&R,F=l.testId,q=void 0===F?"dropdown":F,W=l.sortAlphabetical,K=l.fieldKey,V=l.id,U=l.noOptionsText,z=void 0===U?"No options available":U,X=l.isDoNotPullOutListOfMainContainer,Y=l.withMobileLogic,G=l.withActions,$=l.minItemsForShowMobileSearch,J=l.customTrigger,Q=l.tabIndex,Z=l.onActionConfirmClick,ee=l.onActionCancelClick,en=l.isDefaultOpened,et=l.isDefaultOpenedMobile,el=l.footerContent,eo=l.closeOnSelect,er=void 0===eo||eo,ei=l.closeOnSelectMobile,eu=void 0===ei||ei,ec=l.withApplyLogic,ea=void 0!==ec&&ec,es=l.cancelButtonRef,ed=l.applyButtonRef,ev=(0,m.default)({id:V,fieldKey:K,value:S,sortAlphabetical:void 0===W||W,withMobileLogic:Y,options:E,isSearchable:P,minItemsForShowMobileSearch:void 0===$?w:$,isDoNotPullOutListOfMainContainer:X}),ef=ev.dropdownId,ep=ev.isMobile,em=ev.isOpen,eh=ev.setIsOpen,eg=ev.searchValue,e_=ev.setSearchValue,ew=ev.initListHeight,eb=ev.setInitListHeight,ey=ev.isSearchChanged,ej=ev.setIsSearchChanged,ex=ev.isSearchInputFocused,eL=ev.setIsSearchInputFocused,eC=ev.isScrollableList,eO=ev.setIsScrollableList,eE=ev.isFixedMaxHeight,eS=ev.setIsFixedMaxHeight,eN=ev.scrollTop,eI=ev.setScrollTop,ek=ev.scrollHeight,eH=ev.setScrollHeight,eM=ev.maxListContainerHeight,eP=ev.setMaxListContainerHeight,eA=ev.getListContainer,eT=ev.getListContainerWrapper,eD=ev.getParentNode,eR=ev.getPreparedOptionLabel,eB=ev.getSortedOptions,eF=ev.filteredGroups,eq=ev.filteredItems,eW=ev.filteredOptions,eK=ev.selectedLabel,eV=ev.postfixText,eU=ev.dropdownRef,ez=ev.dropdownListRef,eX=ev.dropdownListWrapperRef,eY=ev.dropdownFooterRef,eG=ev.searchInputRef,e$=ev.wrapperRef,eJ=ev.isSearchable,eQ=ev.valueToApply,eZ=ev.valueToApplyRef,e0=ev.setValueToApply,e1=function(){eh(!1),null==e0||e0(null),null==ee||ee()},e3=function(){(null==eZ?void 0:eZ.current)!==null&&(null==eZ?void 0:eZ.current)!==void 0&&(null==k||k(eZ.current),setTimeout(function(){return null==Z?void 0:Z()},1)),null==e1||e1()},e2=function(e){(ep?eu:er)&&eh(!1),ea&&(null==ed?void 0:ed.current)?null==e0||e0(e.value):null==k||k(e.value)},e6=function(e){return!![9,13].includes(e.keyCode)&&(e1(),!0)},e8=function(e){return!![9,13].includes(e.keyCode)&&(eh(!0),!0)},e9=function(e){var n=e;B||(n=(0,d.formatToOnlyASCIICodeText)(n)),ej(!0),e_(n)},e4=function(e){e.target===(null==e$?void 0:e$.current)&&(e.stopPropagation(),e.preventDefault(),e1())},e5=function(e){e9(e)},e7=function(e){var n;(null==(n=eA())?void 0:n.contains(null==e?void 0:e.target))||(null==eU?void 0:eU.current)===null||(null==eU?void 0:eU.current.contains(null==e?void 0:e.target))||e1()},ne=(0,c.useCallback)(function(e){var n=T||{},t=n.callback,l=n.isWithAnyScrolling,o=n.scrollingInaccuracy,r=null==e?void 0:e.target;t&&"function"==typeof t&&(l?t(e):Math.round(r.clientHeight+r.scrollTop+(void 0===o?0:o))>=r.scrollHeight&&t(e))},[eW]),nn=function(){var e=document.createElement("div");e.setAttribute("id",ef),e.classList.add("dropdown__container"),ep&&e.addEventListener("click",function(e){(null==e?void 0:e.target).id===ef&&e1()});try{null==(n=eA())||n.remove()}finally{if(ep){try{null==(o=document.getElementById("mlw-".concat(ef)))||o.remove()}catch(e){}var n,t,l,o,r=document.createElement("div");r.classList.add("dropdown-mobile"),r.setAttribute("id","mlw-".concat(ef)),null==r||r.append(e),null==(l=eD())||l.append(r)}else null==(t=eD())||t.append(e)}},nt=function(){var e,n,t,l,o,r,i,u,c,a,s,d,v,f,p,m,h,g,_,w=eA();if(!w||!em)return!1;var b=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,y=null!=(p=null==eU||null==(e=eU.current)?void 0:e.getBoundingClientRect())?p:{},j=y.width,x=y.height,L=void 0===x?0:x,C=y.left,O=y.top,E=void 0===O?0:O,S=w.getElementsByClassName("dropdown__list")[0],N=null==eX||null==(n=eX.current)?void 0:n.getElementsByClassName("dropdown__list-header")[0],I=Number.parseInt(null!=(m=null==(l=getComputedStyle(null==eX?void 0:eX.current))||null==(t=l.marginTop)?void 0:t.replace("px",""))?m:"0",10),k=null!=ew?ew:Number.parseInt(null!=(h=null==(r=getComputedStyle(S))||null==(o=r.maxHeight)?void 0:o.replace("px",""))?h:"0",10);null===ew&&eb(k);var H=E-I,M=b-E-L-2*I,P=null==S||null==(i=S.getBoundingClientRect())?void 0:i.height,A=(ep?(null==eX||null==(c=eX.current)||null==(u=c.getBoundingClientRect())?void 0:u.height)-(null==N||null==(a=N.getBoundingClientRect())?void 0:a.height):H>=k||M>=k?k-3*I:H>M?H-3*I:M-4*I)-(null!=(g=null==eY||null==(d=eY.current)||null==(s=d.getBoundingClientRect())?void 0:s.height)?g:0);return w.style.minWidth="".concat(j,"px"),w.style.left="".concat(C,"px"),w.style.top="".concat("bottom"==(H<M||M>=P?"bottom":"top")?E+L:E-3*I-Number.parseInt(null!=(_=null==(f=getComputedStyle(null==eX?void 0:eX.current))||null==(v=f.height)?void 0:v.replace("px",""))?_:"0",10),"px"),eM===A||ep||eP(A),S.style.maxHeight="".concat(A,"px"),!0},nl=em?e7:function(){},no=function(n){var t,l=function(e){"open_modal"===e.value?null==k||k("open_modal"):e2(e)},o=[{label:"New ".concat(A),value:"open_modal",className:"dropdown__list-item--modal"}].concat(function(n){if(Array.isArray(n))return e(n)}(t=null!=eW?eW:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(n,t){if(n){if("string"==typeof n)return e(n,void 0);var l=Object.prototype.toString.call(n).slice(8,-1);if("Object"===l&&n.constructor&&(l=n.constructor.name),"Map"===l||"Set"===l)return Array.from(l);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return e(n,t)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return{onChange:function(e){return n?l(e):e2(e)},options:n?o:E}},nr=(0,c.useMemo)(function(){return A&&""!==A&&"string"==typeof A},[A]),ni=(0,c.useMemo)(function(){return no(nr)},[nr,eW]),nu=function(e,t,l){var o,r,c,a;return(0,i.jsxs)("button",{type:"button","data-testid":"".concat(q,"-").concat(l,"-option"),onMouseDown:function(){return ni.onChange(e)},className:(0,u.default)("".concat(_,"__list-item"),(n(a={},"".concat(_,"__list-item_active"),e.value===(null!=eQ?eQ:S)),n(a,"".concat(_,"__list-item_disabled"),e.disabled),a),e.className),value:null==e?void 0:e.value,children:[!ep&&(0,i.jsx)("span",{className:(0,u.default)("".concat(_,"__active-icon"),n({},"".concat(_,"__active-icon_active"),e.value===S)),children:(0,i.jsx)(s.Check,{})}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-item-label"),e.labelClassName||""),dangerouslySetInnerHTML:{__html:eR(e.label,e.postfix,e.description)}}),(null==e?void 0:e.icon)||"",ep?null!=(c=null==e?void 0:e.customMobileIcon)?c:(0,i.jsx)(f.default,{value:e.value,checked:null!=eQ?eQ:S}):""]},null==(r=e.value)||null==(o=r.toString())?void 0:o.replace(/ /g,"_"))},nc=function(e){var n,t,l,o,r,c;return(null!=(c=null==(n=e.items)?void 0:n.length)?c:0)>0?(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"-group"),e.className),children:[(0,i.jsx)("div",{className:"".concat(_,"-group__name"),children:e.label}),null==(t=e.items)?void 0:t.map(function(e,n){var t;return nu(e,n,null==(t=(null==e?void 0:e.testId)||n)?void 0:t.toString())})]},null==(r=e.label)||null==(o=r.toString())?void 0:o.replace(/ /g,"_").concat(null==(l=Date.now())?void 0:l.toString())):null};if((0,c.useEffect)(function(){return document.addEventListener("click",e7,!0),function(){var e,n;null==(e=eA())||e.remove(),null==(n=eT())||n.remove(),document.removeEventListener("click",e7,!0)}},[]),(0,c.useEffect)(function(){(!X||eU.current)&&(nn(),(en&&!ep||et)&&eh(!0))},[X,eU.current]),(0,c.useLayoutEffect)(function(){var e;return ep?(window.removeEventListener("resize",nt),window.removeEventListener("mousewheel",nl),window.removeEventListener("scroll",nl),window.removeEventListener("touchmove",nl)):(window.addEventListener("resize",nt),window.addEventListener("mousewheel",nl),window.addEventListener("scroll",nl),window.addEventListener("touchmove",nl)),null==(e=eA())||e.addEventListener("click",nl),function(){var e;window.removeEventListener("resize",nt),window.removeEventListener("mousewheel",nl),window.removeEventListener("scroll",nl),window.removeEventListener("touchmove",nl),null==(e=eA())||e.removeEventListener("click",nl)}},[eA]),(0,c.useLayoutEffect)(function(){nt()},[eM,em,eg,ep,eE,E]),(0,c.useEffect)(function(){var e,n,l=em?"addEventListener":"removeEventListener";return null==es||null==(e=es.current)||e[l]("click",e1,!0),null==ed||null==(n=ed.current)||n[l]("click",e3,!0),!em&&(ej(!1),ep||eP(0)),T&&(void 0===T?"undefined":t(T))==="object"&&em&&ez&&ez.current&&ez.current.addEventListener("scroll",ne),function(){T&&(void 0===T?"undefined":t(T))==="object"&&removeEventListener("scroll",ne)}},[em,ez]),(0,c.useEffect)(function(){var e;return eg||!ex||ep||(e_(eK),e=setTimeout(function(){return eG.current.select()},1)),ex||em||e_(null),function(){clearTimeout(e)}},[ex]),(0,c.useEffect)(function(){if(em&&!ex&&(null==eG?void 0:eG.current)&&!ep&&(null==(e=eG.current)||e.focus()),em?null==(n=eA())||n.classList.add("dropdown__container--opened"):(null==(t=eG.current)||t.blur(),null==(l=eA())||l.classList.remove("dropdown__container--opened")),em&&ep){var e,n,t,l,o,r,i,u,c=null==ez||null==(o=ez.current)?void 0:o.querySelector("button[value='".concat(null!=eQ?eQ:S,"']"));c&&(null==ez||null==(u=ez.current)||u.scrollTo(0,(null==c||null==(r=c.getBoundingClientRect())?void 0:r.y)-(null==ez||null==(i=ez.current)?void 0:i.getBoundingClientRect().y)-16))}!em&&ep&&e_(null)},[em]),(0,c.useEffect)(function(){var e,n=null==(e=eA())?void 0:e.getElementsByClassName("dropdown__list")[0];if(!ep&&n){var t=function(e){var t=n.scrollTop,l=n.scrollHeight,o=n.clientHeight,r=e.deltaY<0,i=e.deltaY>0;(r&&t<=0||i&&t+o>=l-1)&&e.preventDefault()};return em?null==n||n.addEventListener("wheel",t,{passive:!1}):null==n||n.removeEventListener("wheel",t),function(){null==n||n.removeEventListener("wheel",t)}}return function(){}},[em,ep,eA()]),(0,c.useEffect)(function(){if(em&&ep&&(null==ez?void 0:ez.current)&&!eg){var e,n,t,l;eO((null==ez||null==(e=ez.current)?void 0:e.scrollHeight)>(null==ez||null==(n=ez.current)?void 0:n.clientHeight)),eS(eC||(null==ez||null==(t=ez.current)?void 0:t.scrollHeight)>(null==ez||null==(l=ez.current)?void 0:l.clientHeight))}},[em,ep,eC,null==ez?void 0:ez.current,null==ez||null==(j=ez.current)?void 0:j.scrollHeight,null==ez||null==(x=ez.current)?void 0:x.clientHeight]),(0,c.useEffect)(function(){var e,n=function(e){var n,t;eI(Number.parseInt(null==e||null==(t=e.target)||null==(n=t.scrollTop)?void 0:n.toString(),10))};return em&&ep&&(null==ez?void 0:ez.current)&&(null==ez||null==(e=ez.current)||e.addEventListener("scroll",n)),function(){if((null==ez?void 0:ez.current)!==null){var e;null==ez||null==(e=ez.current)||e.removeEventListener("scroll",n)}}},[em,ep,null==ez?void 0:ez.current]),(0,c.useEffect)(function(){if(null==ez?void 0:ez.current){var e,n;eH(Number.parseInt(((null==ez||null==(e=ez.current)?void 0:e.scrollHeight)-(null==ez||null==(n=ez.current)?void 0:n.clientHeight)).toString(),10))}},[eN,null==ez?void 0:ez.current]),!E)return null;return(0,i.jsxs)("div",{className:(0,u.default)(_,M,(n(L={disabled:I},"".concat(_,"-mobile"),ep),n(L,"".concat(_,"--focused"),em&&!ep),n(L,"".concat(_,"--with-custom-trigger"),!!J),L)),ref:eU,onKeyDown:e6,onKeyUp:e8,children:[(0,i.jsx)("button",{type:"button","data-testid":q,className:(0,u.default)("".concat(_,"__trigger"),"input__wrap",(n(C={},"".concat(_,"__trigger--with-actions"),G),n(C,"placeholder",null==S||""===S),n(C,"error",N),C)),onClick:function(){return eh(!0)},onKeyDown:e6,onKeyUp:e8,tabIndex:Q,children:J||(0,i.jsxs)(i.Fragment,{children:[eJ&&!ep?(0,i.jsx)("input",{ref:eG,className:"".concat(_,"__input"),value:String(em?null!=eg?eg:"":null!=eK?eK:""),onChange:function(e){return e5(e.target.value)},placeholder:H,onFocus:function(){return eL(!0)},onBlur:function(){return eL(!1)}}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"text",children:eK||H||""}),eV&&(0,i.jsx)("span",{className:"dropdown__list-item-postfix",children:eV})]}),(0,i.jsx)("span",{className:(0,u.default)("".concat(_,"__arrow"),n({},"".concat(_,"__arrow_active"),em)),onClick:function(e){null==e||e.stopPropagation(),eh(function(e){return!e})},children:ep?(0,i.jsx)(s.Code,{className:"mobile-icon"}):em?(0,i.jsx)(s.ChevronUp,{}):(0,i.jsx)(s.ChevronDown,{})})]})}),G&&(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__actions")),children:[(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__actions-item")),onClick:Z,children:(0,i.jsx)(s.Check,{})}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__actions-item")),onClick:ee,children:(0,i.jsx)(s.X,{})})]}),em&&((y=eA())?(0,a.createPortal)((0,i.jsx)("div",{"data-testid":"".concat(q,"-container-wrapper"),className:(0,u.default)("".concat(_,"__container-wrapper")),ref:e$,onClick:ep?e4:function(){},children:(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-wrapper"),(n(r={},"".concat(_,"__list-wrapper--fixed-height"),eE),n(r,"".concat(_,"__list-wrapper--with-bottom-shadow"),eC&&ep&&!el),n(r,"".concat(_,"__list-wrapper--with-bottom-shadow-hidden"),eN===ek&&!el),r)),ref:eX,children:[ep&&(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-header"),(n(h={},"".concat(_,"__list-header-with-shadow"),eC&&ep),n(h,"".concat(_,"__list-header-with-shadow-hidden"),0===eN),h)),children:[(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list-header-row")),children:[(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-label")),children:O}),(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-close-icon")),onClick:e1,children:(0,i.jsx)(s.X,{onClick:e1})})]}),eJ&&(0,i.jsx)("div",{className:(0,u.default)("".concat(_,"__list-header-row")),children:(0,i.jsx)(v.default,{ref:eG,className:"".concat(_,"__input"),value:eg||"",onChange:e5,placeholder:H||"Search",withDelete:!0,onFocus:function(){return eL(!0)},onBlur:function(){return eL(!1)}})})]}),(0,i.jsxs)("div",{className:(0,u.default)("".concat(_,"__list"),(n(g={},"".concat(_,"__list-top"),D),n(g,"".concat(_,"__list--with-footer"),el),g)),ref:ez,children:[ni.options&&(null==(o=eB(ni.options))?void 0:o.map(function(e,t){if(null==e||null==(i=e.items)?void 0:i.length)if(!eJ||!ey)return nc(e);else{var l,o,r,i,u,c,a=null==(c=e.items)?void 0:c.slice().filter(function(e){var n;return(null==e||null==(n=e.label)?void 0:n.toLowerCase().includes((null==eg?void 0:eg.toLowerCase())||""))||!(null==e?void 0:e.value)||(null==e?void 0:e.value)===""});if(null==a?void 0:a.length)return nc((l=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},o=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),o.forEach(function(t){n(e,t,l[t])})}return e}({},e),o=o={items:a},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(o)):(function(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t.push.apply(t,l)}return t})(Object(o)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(o,e))}),l))}else if(!eJ||!ey||(null==e||null==(u=e.label)?void 0:u.toLowerCase().includes((null==eg?void 0:eg.toLowerCase())||""))||!(null==e?void 0:e.value)||(null==e?void 0:e.value)==="")return nu(e,t,null==(r=(null==e?void 0:e.testId)||t)?void 0:r.toString());return null})),!(null==eq?void 0:eq.length)&&!(null==eF?void 0:eF.length)&&(0,i.jsx)("div",{className:"".concat(_,"__list-item ").concat(_,"__list-item--no-options"),children:z}),I&&em&&(0,i.jsx)(p.default,{})]}),el&&(0,i.jsx)("div",{ref:eY,className:(0,u.default)("".concat(_,"__footer"),(n(b={},"".concat(_,"__footer-with-shadow"),ep&&eC),n(b,"".concat(_,"__footer-with-shadow-hidden"),eN===ek),b)),children:el})]})}),y):null)]})};
|
|
@@ -18,7 +18,7 @@ export interface ITagProps extends IUniProps {
|
|
|
18
18
|
popupClassName?: string;
|
|
19
19
|
id?: string;
|
|
20
20
|
isNoDismiss?: boolean;
|
|
21
|
-
onClick?: (id?: string) => void;
|
|
21
|
+
onClick?: (id?: string, event?: React.MouseEvent<HTMLDivElement>) => void;
|
|
22
22
|
isFreezed?: boolean;
|
|
23
23
|
readOnly?: boolean;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(u)throw r}}return a}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});var n=require("react/jsx-runtime"),r=i(require("classnames")),o=function(e,t){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(require("react")),a=require("react-dom"),l=require("react-feather"),u=i(require("../../Layout/Spinner"));function i(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function s(){}require("./Tag.scss");var f=function(e){var i,c,f=e.value,d=e.className,p=e.style,v=e.label,m=e.warning,y=e.isWarningHint,g=e.removeItem,b=e.name,h=e.isPopup,j=e.popupInfoContent,w=e.popupClassName,x=e.id,_=e.isNoDismiss,O=e.onClick,M=void 0===O?s:O,P=e.testId,k=(0,o.useRef)(null),N=t((0,o.useState)(!1),2),S=N[0],C=N[1],E=t((0,o.useState)(!1),2),q=E[0],A=E[1],I=null!=(c=null==k||null==(i=k.current)?void 0:i.getBoundingClientRect())?c:{},L=I.x,W=I.y,D=I.height,R=I.width,T=window.scrollY,B=(0,o.useMemo)(function(){if(!q||!(null==k?void 0:k.current))return{};var e,t=null==k||null==(e=k.current)?void 0:e.getBoundingClientRect(),n=t.x,r=t.y,o=t.height,a=t.width;return{left:"".concat(n,"px"),top:"".concat(r+T,"px"),transform:"translate(calc(-1 * calc(100% - ".concat(a/2+22,"px)), ").concat(o+10,"px)")}},[q,L,W,R,D,T]),z=(0,o.useMemo)(function(){var e,t={};return"#242424"===(null!=(e=null==p?void 0:p.backgroundColor)?e:null==p?void 0:p.background)&&(t.color="#fff"),t},[p]),H=function(){h&&A(!q),M(x)},U=function(){A(!1)};return(0,o.useEffect)(function(){return document.addEventListener("click",U,!0),function(){document.removeEventListener("click",U,!0)}},[]),(0,o.useEffect)(function(){var e=function(){A(!1)};return window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}},[]),(0,n.jsxs)("div",{onMouseEnter:function(){return C(!0)},onMouseLeave:function(){return C(!1)},"data-testid":void 0===P?"tag":P,role:"listitem","aria-label":"Tag: ".concat(v||b),className:(0,r.default)("tag",d,{"tag-warn":m}),style:null!=p?p:{},onClick:function(){return H()},ref:k,children:[m&&"string"==typeof m&&(0,n.jsx)(l.AlertTriangle,{className:"advanced-tags--warning-icon mr5","aria-label":"Warning"}),m&&"string"==typeof m&&S&&(void 0===y||y)&&(0,n.jsx)("div",{className:"tag__warn-hint",role:"tooltip",children:m}),(0,n.jsx)("span",{className:"tag__label",style:z,children:v||b}),g&&!(void 0===_||_)&&(0,n.jsx)("button",{type:"button",onClick:function(e){null==e||e.preventDefault(),null==e||e.stopPropagation(),g(f)},"aria-label":"Remove ".concat(v||b),className:"tag__button",children:(0,n.jsx)(l.X,{className:"color--text"})}),q&&(0,a.createPortal)((0,n.jsx)("div",{id:"tagPopup".concat(f),className:(0,r.default)("tag__popup",w),style:B,children:j||(0,n.jsx)(u.default,{size:"small"})}),document.getElementById("root"))]})};
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(u)throw r}}return a}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return f}});var n=require("react/jsx-runtime"),r=i(require("classnames")),o=function(e,t){if(e&&e.__esModule)return e;if(null===e||(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)!="object"&&"function"!=typeof e)return{default:e};var n=c(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(require("react")),a=require("react-dom"),l=require("react-feather"),u=i(require("../../Layout/Spinner"));function i(e){return e&&e.__esModule?e:{default:e}}function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(c=function(e){return e?n:t})(e)}function s(){}require("./Tag.scss");var f=function(e){var i,c,f=e.value,d=e.className,p=e.style,v=e.label,m=e.warning,y=e.isWarningHint,g=e.removeItem,b=e.name,h=e.isPopup,j=e.popupInfoContent,w=e.popupClassName,x=e.id,_=e.isNoDismiss,O=e.onClick,M=void 0===O?s:O,P=e.testId,k=(0,o.useRef)(null),N=t((0,o.useState)(!1),2),S=N[0],C=N[1],E=t((0,o.useState)(!1),2),q=E[0],A=E[1],I=null!=(c=null==k||null==(i=k.current)?void 0:i.getBoundingClientRect())?c:{},L=I.x,W=I.y,D=I.height,R=I.width,T=window.scrollY,B=(0,o.useMemo)(function(){if(!q||!(null==k?void 0:k.current))return{};var e,t=null==k||null==(e=k.current)?void 0:e.getBoundingClientRect(),n=t.x,r=t.y,o=t.height,a=t.width;return{left:"".concat(n,"px"),top:"".concat(r+T,"px"),transform:"translate(calc(-1 * calc(100% - ".concat(a/2+22,"px)), ").concat(o+10,"px)")}},[q,L,W,R,D,T]),z=(0,o.useMemo)(function(){var e,t={};return"#242424"===(null!=(e=null==p?void 0:p.backgroundColor)?e:null==p?void 0:p.background)&&(t.color="#fff"),t},[p]),H=function(e){h&&A(!q),M(x,e)},U=function(){A(!1)};return(0,o.useEffect)(function(){return document.addEventListener("click",U,!0),function(){document.removeEventListener("click",U,!0)}},[]),(0,o.useEffect)(function(){var e=function(){A(!1)};return window.addEventListener("scroll",e,!0),function(){window.removeEventListener("scroll",e,!0)}},[]),(0,n.jsxs)("div",{onMouseEnter:function(){return C(!0)},onMouseLeave:function(){return C(!1)},"data-testid":void 0===P?"tag":P,role:"listitem","aria-label":"Tag: ".concat(v||b),className:(0,r.default)("tag",d,{"tag-warn":m}),style:null!=p?p:{},onClick:function(e){return H(e)},ref:k,children:[m&&"string"==typeof m&&(0,n.jsx)(l.AlertTriangle,{className:"advanced-tags--warning-icon mr5","aria-label":"Warning"}),m&&"string"==typeof m&&S&&(void 0===y||y)&&(0,n.jsx)("div",{className:"tag__warn-hint",role:"tooltip",children:m}),(0,n.jsx)("span",{className:"tag__label",style:z,children:v||b}),g&&!(void 0===_||_)&&(0,n.jsx)("button",{type:"button",onClick:function(e){null==e||e.preventDefault(),null==e||e.stopPropagation(),g(f)},"aria-label":"Remove ".concat(v||b),className:"tag__button",children:(0,n.jsx)(l.X,{className:"color--text"})}),q&&(0,a.createPortal)((0,n.jsx)("div",{id:"tagPopup".concat(f),className:(0,r.default)("tag__popup",w),style:B,children:j||(0,n.jsx)(u.default,{size:"small"})}),document.getElementById("root"))]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var
|
|
1
|
+
function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(e){var r;r=n[e],e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r})}return t}function n(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n.push.apply(n,r)}return n})(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n,r,l=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=l){var i=[],u=!0,o=!1;try{for(l=l.call(t);!(u=(n=l.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){o=!0,r=t}finally{try{u||null==l.return||l.return()}finally{if(o)throw r}}return i}}(t,e)||l(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,n){if(e){if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return d}});var i=require("react/jsx-runtime"),u=f(require("classnames")),o=require("react"),a=require("react-feather"),c=require("../../../Functions/utils"),s=f(require("../Tag/Tag"));function f(t){return t&&t.__esModule?t:{default:t}}require("./TagList.scss");var d=function(f){var d,p,m,v=f.disabled,g=f.className,y=f.onTagClick,b=f.removeItem,h=f.items,w=f.withToggle,j=void 0===w||w,O=f.disableShowMore,S=void 0!==O&&O,N=f.shownItemsCount,_=void 0===N?"auto":N,I=f.testId,P=f.refProp,x=f.renderOrder,k=f.onEditClick,C=f.onToggleRenderAll,E=(0,o.useRef)(null),A=r((0,o.useState)([]),2),R=A[0],T=A[1],q=r((0,o.useState)(-1),2),D=q[0],L=q[1],M=r((0,o.useState)(-1),2),B=M[0],z=M[1],F=r((0,o.useState)(!j),2),U=F[0],W=F[1],$=null!=(m=null==E||null==(p=E.current)||null==(d=p.getBoundingClientRect())?void 0:d.width)?m:-1,G=function(t,e){W(t),null==C||C(t),null==e||e.stopPropagation(),null==e||e.preventDefault()},H=function(e){if("number"==typeof _)return _;var n,r="function"==typeof k?60:32,i=R.reduce(function(n,i,u){var o,a,c,s,f,d,p=i.itemRef;if(n.skip)return n;var m=(null==p?void 0:p.current)&&window.getComputedStyle(p.current),v=[Number.parseInt((null!=(s=null==(c=p.current)||null==(a=c.getBoundingClientRect())?void 0:a.width)?s:0).toString(),10),Number.parseInt((null!=(f=null==m?void 0:m.marginLeft)?f:0).toString(),10),Number.parseInt((null!=(d=null==m?void 0:m.marginRight)?d:0).toString(),10)].reduce(function(t,e){return Number.isNaN(e)||(t+=e),t},0);return!Number.isNaN(v)&&v>0&&v+n.width<e-r||0===u?n={count:n.count+1,width:n.width+v,items:((function(e){if(Array.isArray(e))return t(e)})(o=n.items)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||l(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{w:v,r:null==p?void 0:p.current}])}:n.skip=!0,n},{count:0,width:0,items:[],skip:!1});return(null==i||null==(n=i.items)?void 0:n.length)===1&&i.items[0].r&&R.length>1&&(i.items[0].r.style.maxWidth="".concat(e-r-8,"px")),null==i?void 0:i.count},J=function(t,e){null==e||e()};return(0,o.useEffect)(function(){L(-1),z(-1),G(!1,null),T(h.map(function(t){return n(e({},t),{itemRef:(0,o.createRef)()})}))},[h]),(0,o.useLayoutEffect)(function(){if(j&&-1!==$&&-1===D){var t,e=$;0===e&&(e=Number.parseInt(((null==E?void 0:E.current)?null==(t=window.getComputedStyle(null==E?void 0:E.current))?void 0:t.width:0).toString())),Number.isNaN(e)||L(H(e))}},[R,$,null==E?void 0:E.current]),(0,o.useLayoutEffect)(function(){z(D)},[D]),(0,o.useEffect)(function(){z(U?null==R?void 0:R.length:D)},[U]),(0,o.useEffect)(function(){(null==E?void 0:E.current)&&P&&(P.current=null==E?void 0:E.current)},[null==E?void 0:E.current]),(0,i.jsxs)("div",{"data-testid":void 0===I?"test-taglist":I,className:(0,u.default)("tag-list_wrapper","".concat(B===(null==R?void 0:R.length)&&j&&-1!==D&&D!==(null==R?void 0:R.length)?"tag-list_wrapper--all-items":"tag-list_wrapper--only-static-items"),g,{"tag-list_wrapper--disabled":v}),style:{visibility:-1===D?"hidden":"visible",zIndex:-1===D?"-1":"auto"},ref:E,children:[(null!=x?x:R.map(function(t){var e=t.value,n=t.id;return null!=n?n:e})).map(function(t,r){var l,u,o=R.find(function(e){var n=e.value,r=e.id;return r?r===t:!!n&&n===t});if(!o)return null;var a=-1!==B&&-1!==D&&r>=B;return(0,i.jsx)("div",{className:"tag-list_wrapper_item ".concat(a?"tag-list_wrapper_item--hidden":""),ref:(0,c.checkedRef)(null==o?void 0:o.itemRef),children:(0,i.jsx)(s.default,n(e({testId:"test-taglist-item-".concat(null!=(l=null==o?void 0:o.id)?l:null==o?void 0:o.value)},o),{onClick:y,removeItem:b}))},"tag-list-item-".concat(null!=(u=null==o?void 0:o.id)?u:null==o?void 0:o.value))}),function(){if("number"==typeof _&&(null==R?void 0:R.length)<_||!(null==R?void 0:R.length)||S)return null;var t=R.length-B;return 0!==t&&j&&-1!==D?(0,i.jsx)(s.default,{label:"+".concat(t),className:"tag-list_wrapper_render-more",onClick:S?function(){}:function(t,e){return J(t,function(){return G(!0,e)})}}):null}(),B===(null==R?void 0:R.length)&&j&&-1!==D&&D!==(null==R?void 0:R.length)?(0,i.jsx)(s.default,{label:"...",className:"tag-list_wrapper_hide-more",onClick:function(t,e){return J(t,function(){return G(!1,e)})}}):null,"function"==typeof k&&(0,i.jsx)("div",{className:"tag-list__edit-trigger",children:(0,i.jsx)(a.Edit3,{onClick:k})})]})};
|