cemtrik-dependencies 1.0.176 → 1.0.178

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -118,4 +118,4 @@ Check the top-level render call using <`+ee+">.")}return V}}function Vi(C,V){{if
118
118
  width: 414px;
119
119
  }
120
120
  }
121
- `}),j.jsx(Pr.Button,{as:"div",onClick:()=>je(ne),"data-testid":`menu-button-${oe}`,ref:Je,children:t}),j.jsx("div",{className:ae("absolute right-0 z-20",n,ne&&"hidden",T&&"w-full"),children:j.jsx(Cn,{as:b.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",show:ce,children:j.jsx(Pr.Items,{className:ae("mt-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",T?"w-full":f===""&&"w-max",f!==""&&f),children:T?j.jsx("div",{className:"flex justify-center py-4",children:j.jsx(Jn,{})}):j.jsxs("div",{className:ae(!_&&"pb-1",r!==""&&r,Oe&&"w-custom"),"data-testid":"dropdown-menu",children:[j.jsxs("div",{className:"sticky top-0 bg-white w-full",children:[M!==null&&j.jsx("div",{className:ae("py-2 w-full",a),children:j.jsx(Po,{htmlFor:"search",id:`dropdown-search-${oe}`,name:"search",type:"text",placeholder:$,handleChange:G=>M(G,oe),icon:$!==""&&j.jsx(Rc,{className:"w-4 h-4 text-indigo-300"}),className:"pl-5 pr-4 h-8",classNameContainerInput:"w-full",value:P,onKeyDown:G=>G.key===" "&&G.stopPropagation(),autocomplete:"off"})}),Ie!==null&&j.jsxs("div",{className:ae("pt-1.5 justify-end flex items-center",a),children:[j.jsx(Xn,{classNameButton:ae("bg-gray-400 hover:bg-gray-400 font-medium px-2 py-1.5 rounded-md",Qe.size>0?"opacity-1 cursor-pointer":"opacity-0 cursor-default"),outline:"",classNameText:"text-xs text-white text-center",id:"delete",onClick:Ve,children:"Descartar"}),j.jsx(Xn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 font-medium px-2 py-1.5 rounded-md",outline:Qe.size===0&&De?"":"0px 0px 0px 2px #3758F9, 0px 0px 0px 2px #243BBD, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",classNameText:"text-xs text-white text-center",id:"apply",disabled:Qe.size===0&&De,onClick:()=>Ie({id:oe,items:Array.from(kt.values())}),children:_e})]})]}),Ce&&!Xe&&j.jsx("div",{className:"flex flex-wrap ml-7 pt-1",children:Array.from(kt).map((G,Q)=>j.jsx("div",{className:"mr-1",children:j.jsxs("span",{className:"inline-flex items-center gap-x-0.5 rounded-md bg-gray-100 px-2 py-1 text-xs font-medium text-gray-600 mb-1",children:[G[1][x],j.jsx("button",{type:"button",className:"p-0.5 rounded-sm bg-gray-100 hover:bg-gray-300",onClick:()=>ot(G[1]),"data-testid":`tag-${G[0]}`,children:j.jsx(Wc,{className:"h-2.5 w-2.5 stroke-gray-700/50 group-hover:stroke-gray-700/75"})})]})},G))}),j.jsx("div",{className:"divide-y divide-gray-100",children:(Xe?[]:l).map((G,Q)=>j.jsx("div",{className:ae(!_&&"py-1",q&&Q===0&&"sticky top-0"),children:_?j.jsx("div",{onClick:Re=>{Re.preventDefault(),v()},"data-testid":`item-component-${Q}`,children:G}):j.jsx(Pr.Item,{children:j.jsx("span",{className:ae(Qe.has(G[E])&&"blue text-white",!Qe.has(G[E])&&"text-gray-700 hover:bg-gray-100 hover:text-gray-900","block px-4 py-2 text-13 lg:text-sm cursor-pointer font-normal"),"data-testid":`item-${Q}`,onClick:Re=>{Re.preventDefault(),Wt(G)},children:ie(G[x])})})},Q))})]})})})})]})},li=50,dd=({total:t,handleNext:l,handlePrev:r,handleSelectPage:n,page:u=null,pageSize:f=li})=>{const[a,m]=b.useState(1),[v,x]=b.useState([]),[E,k]=b.useState([]),R=Math.ceil(t/f);b.useEffect(()=>{const P=[];for(let B=1;B<=R;B++)P.push(B);k(P)},[R]),b.useEffect(()=>{let P=[];const B="...",_="... ",q=" ...";if(E.length<6)P=E;else if(a>=1&&a<=3)P=[1,2,3,4,B,E.length];else if(a===4)P=[...E.slice(0,5),B,E.length];else if(a>4&&a<E.length-2){const ne=E.slice(a-2,a),oe=E.slice(a,a+1);P=[1,_,...ne,...oe,q,E.length]}else if(a>E.length-3){const ne=E.slice(E.length-4);P=[1,_,...ne]}x(P)},[a,E]),b.useEffect(()=>{u!==null&&u!==a&&m(u)},[u,a]);const T=P=>{m(P),n(P)},M=()=>{m(a===1?a:a-1),a>1&&r(a-1)},$=()=>{a===E.length?m(a):m(a+1),a<E.length&&l(a+1)};return j.jsxs("nav",{className:"flex items-center justify-between border-t border-gray-200 px-4 sm:px-0",children:[j.jsx("div",{className:"-mt-px flex w-0 flex-1",children:j.jsxs("span",{className:"inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 cursor-pointer",onClick:M,"data-testid":"prev",children:[j.jsx(hc,{className:"mr-3 h-5 w-5 text-gray-400","aria-hidden":"true"}),"Anterior"]})}),j.jsx("div",{className:"hidden md:-mt-px md:flex",children:v.map((P,B)=>j.jsx(ti,{className:ae("inline-flex items-center border-t-2 px-4 pt-4 text-sm font-medium",a===P?"border-indigo-500 text-indigo-600":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),"aria-current":"page",onClick:()=>P!=="..."&&P!==" ..."&&P!=="... "&&T(P),id:`page-${B+1}`,children:P},B))}),j.jsx("div",{className:"-mt-px flex w-0 flex-1 justify-end",children:j.jsxs("span",{className:"inline-flex items-center border-t-2 border-transparent pl-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 cursor-pointer",onClick:$,"data-testid":"next",children:["Siguiente",j.jsx(gc,{className:"ml-3 h-5 w-5 text-gray-400","aria-hidden":"true"})]})})]})},fd=({setForm:t,setValuesDefault:l,className:r="",classNameContainer:n="",classNameContainerImg:u="",src:f=null,alt:a=null,width:m,height:v,title:x="Logo (Opcional)",fileFormatsDescription:E="PNG, JPG, GIF up to 10MB"})=>{const k=f.split("."),R=T=>{const{files:M}=T.target,[$]=M,P=new FileReader;P.readAsDataURL($),P.onload=function(){$.type.startsWith("image/")?(t(_=>({..._,photo:P.result})),l("photo",P.result)):(t(_=>({..._,photo:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png"})),l("photo",P.result))}};return j.jsxs("div",{className:ae("col-span-full",n!==""&&n),children:[j.jsx("label",{htmlFor:"cover-photo",className:"block text-sm font-medium leading-6 text-gray-500",children:x}),j.jsxs("div",{className:ae("mt-2 flex justify-center rounded-lg border-2 border-dotted border-gray-300 cursor-pointer relative",f===null&&"px-9 pt-6 pb-2.5",u!==""&&u),children:[f?j.jsx("img",{src:/(jpg|png|jpe?g|gif|webp|svg)$/i.test(k[k.length-1])||f.startsWith("data:image/")?f:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png",alt:a,width:m,height:v,className:ae(r!==""&&r),loading:"lazy",decoding:"async",style:{filter:"blur(5px)",transition:"filter 0.3s",objectFit:"contain",height:v},onLoad:T=>T.currentTarget.style.filter="none","data-testid":"img"}):j.jsxs("div",{className:"text-center",children:[j.jsx($c,{"aria-hidden":"true",className:"mx-auto h-12 w-12 text-gray-300"}),j.jsxs("div",{className:"mt-4 flex text-sm leading-6 text-gray-600",children:[j.jsx("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md bg-white font-semibold text-indigo-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-indigo-600 focus-within:ring-offset-2 hover:text-indigo-500",children:j.jsx("span",{children:"Subir un archivo"})}),j.jsx("p",{className:"pl-1",children:"o arrástralo y suéltalo aquí"})]}),j.jsx("p",{className:"text-xs leading-5 text-gray-600",children:E})]}),j.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:R})]})]})},pd=({children:t,openDefault:l=!1,setForm:r,setValuesDefault:n,title:u,type:f,data:a,setData:m,id:v,defaultData:x,showAlert:E,isAdd:k=!0,search:R=null,isPadding:T=!0,isReadOnly:M=!1,isEdit:$=!1,deleteItem:P=null,validateAdd:B=null,loading:_=!1,internalEdit:q=!0,isDataEmpty:ne=!0,typeProp:oe="value",setAdd:me=null,hasNoRecords:Ne=!0,tabs:Oe=null,selectTab:Ce=null})=>{const[he,Ie]=b.useState(!1),[_e,st]=b.useState(!1),[,U]=b.useState(!1),[Xe,De]=b.useState(""),[ce,Te]=b.useState(1);b.useEffect(()=>{Ie(l),U(M)},[l,M]);const Je=({e:je,index:ot})=>{const Ve=Xr(a),{name:ie,value:G}=je.target;!(B===null?!1:B({value:G,copyData:Ve,index:ot}))&&(Ve[ot][ie]=G),m(Ve),n(v,Ve),r(Re=>({...Re,[v]:Ve}))},Qe=()=>{if(a.some(ot=>Object.values(ot).some(G=>G[oe]===-1))||a.length===0)return E({title:"",message:"Todos los campos son requeridos",type:"warning"});r(ot=>({...ot,data:a})),n(v,a),m([...a,x]),me&&me([...a,x])},yt=({index:je,item:ot})=>{if(a.length===1&&!$)return;let Ve=Xr(a);Ve.length===1&&(Ve=[x]),Ve.length>1&&Ve.splice(je,1),r(ie=>({...ie,data:Ve})),n(v,Ve),m(Ve),P&&P({index:je,item:ot,data:Ve}),je===a.length-1&&$&&Ve.length===0&&(r(ie=>({...ie,data:Ve})),n(v,Ve),m([...Ve,x]))},kt=()=>{st(!_e),U(!1)},ft=()=>{if(a.length>1)return;if(a.length===0)return!0;const[je]=a;return!je||typeof je!="object"?!0:Object.keys(je).filter(ie=>{const G=je[ie];return G&&typeof G=="object"&&"value"in G}).every(ie=>je[ie].value===-1)},Wt=({tab:je})=>{Te(je.id),Ce&&Ce({tab:je})};return j.jsxs("div",{className:"divide-y divide-gray-200 rounded-lg bg-white shadow mt-7",children:[j.jsxs("div",{className:"px-4 py-3.5 sm:px-6 flex justify-between items-center cursor-pointer",onClick:()=>Ie(!he),"data-testid":`open-accordion-${v}`,children:[j.jsx("p",{className:"text-gray-500 uppercase text-xs font-bold",children:u}),j.jsxs("div",{className:"flex items-center",children:[R&&j.jsx(Po,{htmlFor:"search",id:"search",name:"search",type:"text",autoComplete:"search",placeholder:"Buscar...",handleChange:je=>{R(je),De(je.target.value)},icon:j.jsx(ed,{className:"w-6 h-6 text-indigo-300"}),className:"h-9",classNameContainerInput:"w-52 2xs:w-64 max-w-64 mr-8 hidden sm:block",value:Xe,onClick:je=>je.stopPropagation(),onFocus:()=>Ie(!0)}),he?j.jsx(Jc,{className:"w-5 h-5 text-default-5"}):j.jsx(Kc,{className:"w-5 h-5 text-default-5"})]})]}),j.jsx(Cn,{as:b.Fragment,show:he,enter:"transition duration-[400ms]",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"duration-200 transition ease-in-out",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:j.jsxs("div",{children:[Oe&&j.jsx("nav",{className:"flex justify-center border-b border-gray-200","aria-label":"Tabs",children:Oe.map(je=>j.jsx("span",{className:ae(ce===je.id?"border-indigo-500 text-gray-900":"border-gray-300 text-gray-500 hover:border-indigo-500","whitespace-nowrap border-b-2 py-2.5 px-2 text-sm font-medium cursor-pointer"),"aria-current":ce===je.id?"page":void 0,onClick:()=>Wt({tab:je}),"data-testid":`tab-${je.id}`,children:je.name},je.name))}),j.jsxs("div",{className:ae("sm:mt-2.5 py-3.5 relative",T&&Oe===null&&"px-4 sm:p-6",T&&Oe!==null&&"px-4 sm:px-6 sm:pb-6 sm:pt-2.5"),children:[q&&!_e&&j.jsx(Ac,{className:"w-5 h-5 text-gray-400 cursor-pointer absolute right-4",onClick:kt,"data-testid":`edit-role-${v}`}),_&&j.jsx("div",{className:"flex justify-center mt-5",children:j.jsx(Jn,{})}),ne&&ft()&&Ne&&!_&&(q?!_e:!$)&&j.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!_&&a.map((je,ot)=>j.jsxs("div",{className:ae("flex flex-col 3xs:flex-row mb-4",T&&"ml-0 3xs:ml-3"),children:[typeof t=="function"?t({item:je,index:ot,handleChange:Je,isEdit:q?_e:$}):t,k&&(q?_e:$)&&j.jsx("div",{style:{backgroundColor:"#B0B8BF",width:"25px",height:"25px"},className:ae("rounded-full flex justify-center items-center mt-4 3xs:mt-7 ml-2 3xs:ml-5 self-start 3xs:self-center",a.length===1&&!$&&"opacity-0"),children:j.jsx(nd,{className:ae("w-6 h-4",(a.length>1||$)&&"cursor-pointer"),style:{color:"#637381"},strokeWidth:2.5,onClick:()=>yt({index:ot,item:je}),"data-testid":`delete-item-${ot}-${v}`})})]},ot)),k&&(q?_e:$)&&!_&&j.jsx("p",{className:"text-secondary-2 text-sm font-medium ml-3 cursor-pointer",onClick:Qe,"data-testid":`add-item-${v}`,style:{width:"fit-content"},children:`+ Añadir ${f}`})]})]})})]})},md=({src:t,alt:l,width:r,height:n,className:u="",priority:f=!1,style:a={},id:m=""})=>{const[v,x]=b.useState(!1),E={filter:v?"none":"blur(10px)",transition:"filter 0.3s ease-out",objectFit:"cover",...r?{width:r}:{},...n?{height:n}:{},...a};return j.jsx("img",{src:t,alt:l,...r?{width:r}:{},...n?{height:n}:{},className:ae(u!==""&&u),loading:f?"eager":"lazy",decoding:"async",style:E,onLoad:()=>x(!0),"data-testid":`image-${m}`})};Se.Accordion=pd,Se.Alert=kc,Se.Avatar=Hc,Se.Bullets=Uc,Se.ButtonOutline=ei,Se.ButtonPagination=ti,Se.ButtonSolid=Xn,Se.Checkbox=Zc,Se.ConfirmationAbandoningCreation=rd,Se.CoverPhoto=fd,Se.Divider=od,Se.Dropdown=cd,Se.GoBack=ld,Se.Image=md,Se.Input=Po,Se.InputDropdown=sd,Se.MESSAGE_ABORT_CONTROLLER=Ji,Se.MESSAGE_SIGNAL_ABORTED_WITHOUT_REASON=Qi,Se.Modal=ni,Se.Pagination=dd,Se.Select=oi,Se.Spinner=id,Se.SpinnerIcon=Jn,Se.Switch=ad,Se.Textarea=ud,Se.Tooltip=ko,Se.classNames=ae,Se.copyOptions=Xr,Se.generateAvatarInitials=Ki,Se.isPromise=Xi,Se.rowsPerPage=li,Se.useCloseModal=es,Se.useForm=ts,Se.useMediaQuery=ns,Se.useWindowDimensions=al,Se.validateEmail=sl,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
121
+ `}),j.jsx(Pr.Button,{as:"div",onClick:()=>je(ne),"data-testid":`menu-button-${oe}`,ref:Je,children:t}),j.jsx("div",{className:ae("absolute right-0 z-20",n,ne&&"hidden",T&&"w-full"),children:j.jsx(Cn,{as:b.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",show:ce,children:j.jsx(Pr.Items,{className:ae("mt-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",T?"w-full":f===""&&"w-max",f!==""&&f),children:T?j.jsx("div",{className:"flex justify-center py-4",children:j.jsx(Jn,{})}):j.jsxs("div",{className:ae(!_&&"pb-1",r!==""&&r,Oe&&"w-custom"),"data-testid":"dropdown-menu",children:[j.jsxs("div",{className:"sticky top-0 bg-white w-full",children:[M!==null&&j.jsx("div",{className:ae("py-2 w-full",a),children:j.jsx(Po,{htmlFor:"search",id:`dropdown-search-${oe}`,name:"search",type:"text",placeholder:$,handleChange:G=>M(G,oe),icon:$!==""&&j.jsx(Rc,{className:"w-4 h-4 text-indigo-300"}),className:"pl-5 pr-4 h-8",classNameContainerInput:"w-full",value:P,onKeyDown:G=>G.key===" "&&G.stopPropagation(),autocomplete:"off"})}),Ie!==null&&j.jsxs("div",{className:ae("pt-1.5 justify-end flex items-center",a),children:[j.jsx(Xn,{classNameButton:ae("bg-gray-400 hover:bg-gray-400 font-medium px-2 py-1.5 rounded-md",Qe.size>0?"opacity-1 cursor-pointer":"opacity-0 cursor-default"),outline:"",classNameText:"text-xs text-white text-center",id:"delete",onClick:Ve,children:"Descartar"}),j.jsx(Xn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 font-medium px-2 py-1.5 rounded-md",outline:Qe.size===0&&De?"":"0px 0px 0px 2px #3758F9, 0px 0px 0px 2px #243BBD, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",classNameText:"text-xs text-white text-center",id:"apply",disabled:Qe.size===0&&De,onClick:()=>Ie({id:oe,items:Array.from(kt.values())}),children:_e})]})]}),Ce&&!Xe&&j.jsx("div",{className:"flex flex-wrap ml-7 pt-1",children:Array.from(kt).map((G,Q)=>j.jsx("div",{className:"mr-1",children:j.jsxs("span",{className:"inline-flex items-center gap-x-0.5 rounded-md bg-gray-100 px-2 py-1 text-xs font-medium text-gray-600 mb-1",children:[G[1][x],j.jsx("button",{type:"button",className:"p-0.5 rounded-sm bg-gray-100 hover:bg-gray-300",onClick:()=>ot(G[1]),"data-testid":`tag-${G[0]}`,children:j.jsx(Wc,{className:"h-2.5 w-2.5 stroke-gray-700/50 group-hover:stroke-gray-700/75"})})]})},G))}),j.jsx("div",{className:"divide-y divide-gray-100",children:(Xe?[]:l).map((G,Q)=>j.jsx("div",{className:ae(!_&&"py-1",q&&Q===0&&"sticky top-0"),children:_?j.jsx("div",{onClick:Re=>{Re.preventDefault(),v()},"data-testid":`item-component-${Q}`,children:G}):j.jsx(Pr.Item,{children:j.jsx("span",{className:ae(Qe.has(G[E])&&"blue text-white",!Qe.has(G[E])&&"text-gray-700 hover:bg-gray-100 hover:text-gray-900","block px-4 py-2 text-13 lg:text-sm cursor-pointer font-normal"),"data-testid":`item-${Q}`,onClick:Re=>{Re.preventDefault(),Wt(G)},children:ie(G[x])})})},Q))})]})})})})]})},li=50,dd=({total:t,handleNext:l,handlePrev:r,handleSelectPage:n,page:u=null,pageSize:f=li})=>{const[a,m]=b.useState(1),[v,x]=b.useState([]),[E,k]=b.useState([]),R=Math.ceil(t/f);b.useEffect(()=>{const P=[];for(let B=1;B<=R;B++)P.push(B);k(P)},[R]),b.useEffect(()=>{let P=[];const B="...",_="... ",q=" ...";if(E.length<6)P=E;else if(a>=1&&a<=3)P=[1,2,3,4,B,E.length];else if(a===4)P=[...E.slice(0,5),B,E.length];else if(a>4&&a<E.length-2){const ne=E.slice(a-2,a),oe=E.slice(a,a+1);P=[1,_,...ne,...oe,q,E.length]}else if(a>E.length-3){const ne=E.slice(E.length-4);P=[1,_,...ne]}x(P)},[a,E]),b.useEffect(()=>{u!==null&&u!==a&&m(u)},[u,a]);const T=P=>{m(P),n(P)},M=()=>{m(a===1?a:a-1),a>1&&r(a-1)},$=()=>{a===E.length?m(a):m(a+1),a<E.length&&l(a+1)};return j.jsxs("nav",{className:"flex items-center justify-between border-t border-gray-200 px-4 sm:px-0",children:[j.jsx("div",{className:"-mt-px flex w-0 flex-1",children:j.jsxs("span",{className:"inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 cursor-pointer",onClick:M,"data-testid":"prev",children:[j.jsx(hc,{className:"mr-3 h-5 w-5 text-gray-400","aria-hidden":"true"}),"Anterior"]})}),j.jsx("div",{className:"hidden md:-mt-px md:flex",children:v.map((P,B)=>j.jsx(ti,{className:ae("inline-flex items-center border-t-2 px-4 pt-4 text-sm font-medium",a===P?"border-indigo-500 text-indigo-600":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),"aria-current":"page",onClick:()=>P!=="..."&&P!==" ..."&&P!=="... "&&T(P),id:`page-${B+1}`,children:P},B))}),j.jsx("div",{className:"-mt-px flex w-0 flex-1 justify-end",children:j.jsxs("span",{className:"inline-flex items-center border-t-2 border-transparent pl-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700 cursor-pointer",onClick:$,"data-testid":"next",children:["Siguiente",j.jsx(gc,{className:"ml-3 h-5 w-5 text-gray-400","aria-hidden":"true"})]})})]})},fd=({setForm:t,setValuesDefault:l,className:r="",classNameContainer:n="",classNameContainerImg:u="",src:f=null,alt:a=null,width:m,height:v,title:x="Logo (Opcional)",fileFormatsDescription:E="PNG, JPG, GIF up to 10MB"})=>{const k=f===null?"":f.split("."),R=T=>{const{files:M}=T.target,[$]=M,P=new FileReader;P.readAsDataURL($),P.onload=function(){$.type.startsWith("image/")?(t(_=>({..._,photo:P.result})),l("photo",P.result)):(t(_=>({..._,photo:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png"})),l("photo",P.result))}};return j.jsxs("div",{className:ae("col-span-full",n!==""&&n),children:[j.jsx("label",{htmlFor:"cover-photo",className:"block text-sm font-medium leading-6 text-gray-500",children:x}),j.jsxs("div",{className:ae("mt-2 flex justify-center rounded-lg border-2 border-dotted border-gray-300 cursor-pointer relative",u!==""&&u),children:[f?j.jsx("img",{src:/(jpg|png|jpe?g|gif|webp|svg)$/i.test(k[k.length-1])||f.startsWith("data:image/")?f:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png",alt:a,width:m,height:v,className:ae(r!==""&&r),loading:"lazy",decoding:"async",style:{filter:"blur(5px)",transition:"filter 0.3s",objectFit:"contain",height:v},onLoad:T=>T.currentTarget.style.filter="none","data-testid":"img"}):j.jsxs("div",{className:"text-center",children:[j.jsx($c,{"aria-hidden":"true",className:"mx-auto h-12 w-12 text-gray-300"}),j.jsxs("div",{className:"mt-4 flex text-sm leading-6 text-gray-600",children:[j.jsx("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md bg-white font-semibold text-indigo-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-indigo-600 focus-within:ring-offset-2 hover:text-indigo-500",children:j.jsx("span",{children:"Subir un archivo"})}),j.jsx("p",{className:"pl-1",children:"o arrástralo y suéltalo aquí"})]}),j.jsx("p",{className:"text-xs leading-5 text-gray-600",children:E})]}),j.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:R})]})]})},pd=({children:t,openDefault:l=!1,setForm:r,setValuesDefault:n,title:u,type:f,data:a,setData:m,id:v,defaultData:x,showAlert:E,isAdd:k=!0,search:R=null,isPadding:T=!0,isReadOnly:M=!1,isEdit:$=!1,deleteItem:P=null,validateAdd:B=null,loading:_=!1,internalEdit:q=!0,isDataEmpty:ne=!0,typeProp:oe="value",setAdd:me=null,hasNoRecords:Ne=!0,tabs:Oe=null,selectTab:Ce=null})=>{const[he,Ie]=b.useState(!1),[_e,st]=b.useState(!1),[,U]=b.useState(!1),[Xe,De]=b.useState(""),[ce,Te]=b.useState(1);b.useEffect(()=>{Ie(l),U(M)},[l,M]);const Je=({e:je,index:ot})=>{const Ve=Xr(a),{name:ie,value:G}=je.target;!(B===null?!1:B({value:G,copyData:Ve,index:ot}))&&(Ve[ot][ie]=G),m(Ve),n(v,Ve),r(Re=>({...Re,[v]:Ve}))},Qe=()=>{if(a.some(ot=>Object.values(ot).some(G=>G[oe]===-1))||a.length===0)return E({title:"",message:"Todos los campos son requeridos",type:"warning"});r(ot=>({...ot,data:a})),n(v,a),m([...a,x]),me&&me([...a,x])},yt=({index:je,item:ot})=>{if(a.length===1&&!$)return;let Ve=Xr(a);Ve.length===1&&(Ve=[x]),Ve.length>1&&Ve.splice(je,1),r(ie=>({...ie,data:Ve})),n(v,Ve),m(Ve),P&&P({index:je,item:ot,data:Ve}),je===a.length-1&&$&&Ve.length===0&&(r(ie=>({...ie,data:Ve})),n(v,Ve),m([...Ve,x]))},kt=()=>{st(!_e),U(!1)},ft=()=>{if(a.length>1)return;if(a.length===0)return!0;const[je]=a;return!je||typeof je!="object"?!0:Object.keys(je).filter(ie=>{const G=je[ie];return G&&typeof G=="object"&&"value"in G}).every(ie=>je[ie].value===-1)},Wt=({tab:je})=>{Te(je.id),Ce&&Ce({tab:je})};return j.jsxs("div",{className:"divide-y divide-gray-200 rounded-lg bg-white shadow mt-7",children:[j.jsxs("div",{className:"px-4 py-3.5 sm:px-6 flex justify-between items-center cursor-pointer",onClick:()=>Ie(!he),"data-testid":`open-accordion-${v}`,children:[j.jsx("p",{className:"text-gray-500 uppercase text-xs font-bold",children:u}),j.jsxs("div",{className:"flex items-center",children:[R&&j.jsx(Po,{htmlFor:"search",id:"search",name:"search",type:"text",autoComplete:"search",placeholder:"Buscar...",handleChange:je=>{R(je),De(je.target.value)},icon:j.jsx(ed,{className:"w-6 h-6 text-indigo-300"}),className:"h-9",classNameContainerInput:"w-52 2xs:w-64 max-w-64 mr-8 hidden sm:block",value:Xe,onClick:je=>je.stopPropagation(),onFocus:()=>Ie(!0)}),he?j.jsx(Jc,{className:"w-5 h-5 text-default-5"}):j.jsx(Kc,{className:"w-5 h-5 text-default-5"})]})]}),j.jsx(Cn,{as:b.Fragment,show:he,enter:"transition duration-[400ms]",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"duration-200 transition ease-in-out",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:j.jsxs("div",{children:[Oe&&j.jsx("nav",{className:"flex justify-center border-b border-gray-200","aria-label":"Tabs",children:Oe.map(je=>j.jsx("span",{className:ae(ce===je.id?"border-indigo-500 text-gray-900":"border-gray-300 text-gray-500 hover:border-indigo-500","whitespace-nowrap border-b-2 py-2.5 px-2 text-sm font-medium cursor-pointer"),"aria-current":ce===je.id?"page":void 0,onClick:()=>Wt({tab:je}),"data-testid":`tab-${je.id}`,children:je.name},je.name))}),j.jsxs("div",{className:ae("sm:mt-2.5 py-3.5 relative",T&&Oe===null&&"px-4 sm:p-6",T&&Oe!==null&&"px-4 sm:px-6 sm:pb-6 sm:pt-2.5"),children:[q&&!_e&&j.jsx(Ac,{className:"w-5 h-5 text-gray-400 cursor-pointer absolute right-4",onClick:kt,"data-testid":`edit-role-${v}`}),_&&j.jsx("div",{className:"flex justify-center mt-5",children:j.jsx(Jn,{})}),ne&&ft()&&Ne&&!_&&(q?!_e:!$)&&j.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!_&&a.map((je,ot)=>j.jsxs("div",{className:ae("flex flex-col 3xs:flex-row mb-4",T&&"ml-0 3xs:ml-3"),children:[typeof t=="function"?t({item:je,index:ot,handleChange:Je,isEdit:q?_e:$}):t,k&&(q?_e:$)&&j.jsx("div",{style:{backgroundColor:"#B0B8BF",width:"25px",height:"25px"},className:ae("rounded-full flex justify-center items-center mt-4 3xs:mt-7 ml-2 3xs:ml-5 self-start 3xs:self-center",a.length===1&&!$&&"opacity-0"),children:j.jsx(nd,{className:ae("w-6 h-4",(a.length>1||$)&&"cursor-pointer"),style:{color:"#637381"},strokeWidth:2.5,onClick:()=>yt({index:ot,item:je}),"data-testid":`delete-item-${ot}-${v}`})})]},ot)),k&&(q?_e:$)&&!_&&j.jsx("p",{className:"text-secondary-2 text-sm font-medium ml-3 cursor-pointer",onClick:Qe,"data-testid":`add-item-${v}`,style:{width:"fit-content"},children:`+ Añadir ${f}`})]})]})})]})},md=({src:t,alt:l,width:r,height:n,className:u="",priority:f=!1,style:a={},id:m=""})=>{const[v,x]=b.useState(!1),E={filter:v?"none":"blur(10px)",transition:"filter 0.3s ease-out",objectFit:"cover",...r?{width:r}:{},...n?{height:n}:{},...a};return j.jsx("img",{src:t,alt:l,...r?{width:r}:{},...n?{height:n}:{},className:ae(u!==""&&u),loading:f?"eager":"lazy",decoding:"async",style:E,onLoad:()=>x(!0),"data-testid":`image-${m}`})};Se.Accordion=pd,Se.Alert=kc,Se.Avatar=Hc,Se.Bullets=Uc,Se.ButtonOutline=ei,Se.ButtonPagination=ti,Se.ButtonSolid=Xn,Se.Checkbox=Zc,Se.ConfirmationAbandoningCreation=rd,Se.CoverPhoto=fd,Se.Divider=od,Se.Dropdown=cd,Se.GoBack=ld,Se.Image=md,Se.Input=Po,Se.InputDropdown=sd,Se.MESSAGE_ABORT_CONTROLLER=Ji,Se.MESSAGE_SIGNAL_ABORTED_WITHOUT_REASON=Qi,Se.Modal=ni,Se.Pagination=dd,Se.Select=oi,Se.Spinner=id,Se.SpinnerIcon=Jn,Se.Switch=ad,Se.Textarea=ud,Se.Tooltip=ko,Se.classNames=ae,Se.copyOptions=Xr,Se.generateAvatarInitials=Ki,Se.isPromise=Xi,Se.rowsPerPage=li,Se.useCloseModal=es,Se.useForm=ts,Se.useMediaQuery=ns,Se.useWindowDimensions=al,Se.validateEmail=sl,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cemtrik-dependencies",
3
- "version": "1.0.176",
3
+ "version": "1.0.178",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",