cemtrik-dependencies 1.0.205 → 1.0.206

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 <`+oe+">.")}return G}}function Xl(T,G){{if
118
118
  width: 414px;
119
119
  }
120
120
  }
121
- `}),w.jsx(Fr.Button,{as:"div",onClick:()=>ge(X),"data-testid":`menu-button-${ee}`,ref:$e,children:e}),!Je&&w.jsx("div",{className:se("absolute right-0 z-20",n,X&&"hidden",C&&"w-full"),children:w.jsx(vn,{as:g.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:q,children:w.jsx(Fr.Items,{className:se("mt-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",C?"w-full":f===""&&"w-max",f!==""&&f),children:C?w.jsx("div",{className:"flex justify-center py-4",children:w.jsx(Qn,{})}):w.jsxs("div",{className:se(!_&&"pb-1",r!==""&&r,Oe&&"w-custom"),"data-testid":"dropdown-menu",onScroll:te,children:[w.jsxs("div",{className:"sticky top-0 bg-white w-full",children:[M!==null&&w.jsx("div",{className:se("py-2 w-full",a),children:w.jsx(Lo,{htmlFor:"search",id:`dropdown-search-${ee}`,name:"search",type:"text",placeholder:R,handleChange:V=>M(V,ee),icon:R!==""&&w.jsx(zc,{className:"w-4 h-4 text-primary-4"}),className:"pl-5 pr-4 h-8",classNameContainerInput:"w-full",value:L,onKeyDown:V=>V.key===" "&&V.stopPropagation(),autocomplete:"off"})}),Pe!==null&&w.jsxs("div",{className:se("pt-1.5 justify-end flex items-center",a),children:[w.jsx(Jn,{classNameButton:se("bg-gray-400 hover:bg-gray-400 font-medium px-2 py-1.5 rounded-md",We.size>0?"opacity-1 cursor-pointer":"opacity-0 cursor-default"),outline:"",classNameText:"text-xs text-white text-center",id:"delete",onClick:re,children:"Descartar"}),w.jsx(Jn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 font-medium px-2 py-1.5 rounded-md",outline:We.size===0&&Re?"":"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:We.size===0&&Re,onClick:()=>Pe({id:ee,items:Array.from(tt.values())}),children:Ze})]})]}),be&&w.jsx("div",{className:"flex flex-wrap ml-7 pt-1",children:Array.from(tt).map((V,Ee)=>w.jsx("div",{className:"mr-1",children:w.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:[V[1][x],w.jsx("button",{type:"button",className:"p-0.5 rounded-sm bg-gray-100 hover:bg-gray-300",onClick:()=>st(V[1]),"data-testid":`tag-${V[0]}`,children:w.jsx(qc,{className:"h-2.5 w-2.5 stroke-gray-700/50 group-hover:stroke-gray-700/75"})})]})},V))}),w.jsx("div",{className:"divide-y divide-gray-100",children:o.map((V,Ee)=>w.jsx("div",{className:se(!_&&"py-1",z&&Ee===0&&"sticky top-0"),children:_?w.jsx("div",{onClick:ke=>{ke.preventDefault(),v()},"data-testid":`item-component-${Ee}`,children:V}):w.jsx(Fr.Item,{children:w.jsx("span",{className:se(We.has(V[E])&&"blue text-white",!We.has(V[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-${Ee}`,onClick:ke=>{ke.preventDefault(),Lt(V)},children:Ce(V[x])})})},Ee))})]})})})})]})},Ao=50,bd=({total:e,handleNext:o,handlePrev:r,handleSelectPage:n,page:u=null,pageSize:f=Ao})=>{const[a,m]=g.useState(1),[v,x]=g.useState([]),[E,k]=g.useState([]),[P,C]=g.useState(""),M=Math.ceil(e/f);g.useEffect(()=>{const z=[];for(let X=1;X<=M;X++)z.push(X);k(z)},[M]),g.useEffect(()=>{let z=[];const X="...",ee="... ",ue=" ...";if(E.length<6)z=E;else if(a>=1&&a<=3)z=[1,2,3,4,X,E.length];else if(a===4)z=[...E.slice(0,5),X,E.length];else if(a>4&&a<E.length-2){const we=E.slice(a-2,a),Oe=E.slice(a,a+1);z=[1,ee,...we,...Oe,ue,E.length]}else if(a>E.length-3){const we=E.slice(E.length-4);z=[1,ee,...we]}x(z)},[a,E]),g.useEffect(()=>{u!==null&&u!==a&&m(u)},[u,a]);const R=z=>{C(""),m(z),n(z)},L=()=>{C(""),a>1&&m(a-1),a>1&&r(a-1)},B=()=>{C(""),a<E.length&&m(a+1),a<E.length&&o(a+1)},_=z=>{const{value:X}=z.target;if(!/^\d*$/.test(X))return;const ee=Math.ceil(e/Ao);X>ee||C(X)};return g.useEffect(()=>{const z=setTimeout(()=>{const X=Number(P);!isNaN(X)&&X>=1&&X<=M&&(n(X),m(X))},500);return()=>clearTimeout(z)},[P,M,n]),w.jsxs("nav",{className:"flex items-center justify-between border-t border-gray-200 px-4 sm:px-0",children:[w.jsx("div",{className:"-mt-px flex w-0 flex-1",children:w.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:L,"data-testid":"prev",children:[w.jsx(wc,{className:"mr-3 h-5 w-5 text-gray-400","aria-hidden":"true"}),"Anterior"]})}),w.jsxs("div",{className:"hidden md:-mt-px md:flex",children:[w.jsxs("div",{children:[w.jsx("span",{className:"text-sm text-gray-500 font-medium mr-1",children:"Ir a"}),w.jsx("div",{className:"inline-flex items-center border-t-2 pr-2 pt-1 text-sm font-medium border-transparent text-gray-500",style:{width:"45px"},children:w.jsx(ln.Input,{htmlFor:"",id:"pager",name:"pager",handleChange:_,value:P,className:"pl-1.5 pr-1 h-7"})})]}),v.map((z,X)=>w.jsx(ln.ButtonPagination,{className:ln.classNames("inline-flex items-center border-t-2 px-4 pt-4 text-sm font-medium",a===z?"border-primary-6 text-primary-7":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),"aria-current":"page",onClick:()=>z!=="..."&&z!==" ..."&&z!=="... "&&R(z),id:`page-${X+1}`,children:z},X))]}),w.jsx("div",{className:"-mt-px flex w-0 flex-1 justify-end",children:w.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:B,"data-testid":"next",children:["Siguiente",w.jsx(Sc,{className:"ml-3 h-5 w-5 text-gray-400","aria-hidden":"true"})]})})]})},xd=({setForm:e,setValuesDefault:o,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("."),P=C=>{const{files:M}=C.target,[R]=M,L=new FileReader;L.readAsDataURL(R),L.onload=function(){R.type.startsWith("image/")?(e(_=>({..._,photo:L.result})),o("photo",L.result)):(e(_=>({..._,photo:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png"})),o("photo",L.result))}};return w.jsxs("div",{className:se("col-span-full",n!==""&&n),children:[w.jsx("label",{htmlFor:"cover-photo",className:"block text-sm font-medium leading-6 text-gray-500",children:x}),w.jsxs("div",{className:se("mt-2 flex justify-center rounded-lg border-2 border-dotted border-gray-300 cursor-pointer relative",u!==""&&u),children:[f?w.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:se(r!==""&&r),loading:"lazy",decoding:"async",style:{filter:"blur(5px)",transition:"filter 0.3s",objectFit:"contain",height:v},onLoad:C=>C.currentTarget.style.filter="none","data-testid":"img"}):w.jsxs("div",{className:"text-center",children:[w.jsx(Vc,{"aria-hidden":"true",className:"mx-auto h-12 w-12 text-gray-300"}),w.jsxs("div",{className:"mt-4 flex text-sm leading-6 text-gray-600",children:[w.jsx("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md bg-white font-semibold text-primary-7 focus-within:outline-none focus-within:ring-2 focus-within:ring-primary-7 focus-within:ring-offset-2 hover:text-primary-6",children:w.jsx("span",{children:"Subir un archivo"})}),w.jsx("p",{className:"pl-1",children:"o arrástralo y suéltalo aquí"})]}),w.jsx("p",{className:"text-xs leading-5 text-gray-600",children:E})]}),w.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:P})]})]})},yd=({children:e,openDefault:o=!1,setForm:r,setValuesDefault:n,title:u,type:f,data:a,setData:m,id:v,defaultData:x,showAlert:E,isAdd:k=!0,search:P=null,isPadding:C=!0,isReadOnly:M=!1,isEdit:R=!1,deleteItem:L=null,validateAdd:B=null,loading:_=!1,internalEdit:z=!0,isDataEmpty:X=!0,typeProp:ee="value",setAdd:ue=null,hasNoRecords:we=!0,tabs:Oe=null,selectTab:be=null,className:y="mt-7"})=>{const[Pe,Ze]=g.useState(!1),[Ye,Y]=g.useState(!1),[,Je]=g.useState(!1),[Re,q]=g.useState(""),[te,ve]=g.useState(1);g.useEffect(()=>{Ze(o),Je(M)},[o,M]);const $e=({e:ge,index:st})=>{const re=eo(a),{name:Ce,value:V}=ge.target;!(B===null?!1:B({value:V,copyData:re,index:st}))&&(re[st][Ce]=V),m(re),n(v,re),r(ke=>({...ke,[v]:re}))},We=()=>{if(a.some(st=>Object.values(st).some(V=>V[ee]===-1))||a.length===0)return E({title:"",message:"Todos los campos son requeridos",type:"warning"});r(st=>({...st,data:a})),n(v,a),m([...a,x]),ue&&ue([...a,x])},lt=({index:ge,item:st})=>{if(a.length===1&&!R)return;let re=eo(a);re.length===1&&(re=[x]),re.length>1&&re.splice(ge,1),r(Ce=>({...Ce,data:re})),n(v,re),m(re),L&&L({index:ge,item:st,data:re}),ge===a.length-1&&R&&re.length===0&&(r(Ce=>({...Ce,data:re})),n(v,re),m([...re,x]))},tt=()=>{Y(!Ye),Je(!1)},St=()=>{if(a.length>1)return;if(a.length===0)return!0;const[ge]=a;return!ge||typeof ge!="object"?!0:Object.keys(ge).filter(Ce=>{const V=ge[Ce];return V&&typeof V=="object"&&"value"in V}).every(Ce=>ge[Ce].value===-1)},Lt=({tab:ge})=>{ve(ge.id),be&&be({tab:ge})};return w.jsxs("div",{className:se("divide-y divide-gray-200 rounded-lg bg-white shadow",y),children:[w.jsxs("div",{className:"px-4 py-3.5 sm:px-6 flex justify-between items-center cursor-pointer",onClick:()=>Ze(!Pe),"data-testid":`open-accordion-${v}`,children:[typeof u=="string"?w.jsx("p",{className:"text-gray-500 uppercase text-xs font-bold",children:u}):u,w.jsxs("div",{className:"flex items-center",children:[P&&w.jsx(Lo,{htmlFor:"search",id:"search",name:"search",type:"text",autoComplete:"search",placeholder:"Buscar...",handleChange:ge=>{P(ge),q(ge.target.value)},icon:w.jsx(sd,{className:"w-6 h-6 text-primary-4"}),className:"h-9",classNameContainerInput:"w-52 2xs:w-64 max-w-64 mr-8 hidden sm:block",value:Re,onClick:ge=>ge.stopPropagation(),onFocus:()=>Ze(!0)}),Pe?w.jsx(id,{className:"w-5 h-5 text-default-4"}):w.jsx(al,{className:"w-5 h-5 text-default-4"})]})]}),w.jsx(vn,{as:g.Fragment,show:Pe,enter:"transition duration-[400ms]",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"duration-200 transition ease-in-out",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:w.jsxs("div",{children:[Oe&&w.jsx("nav",{className:"flex justify-center border-b border-gray-200","aria-label":"Tabs",children:Oe.map(ge=>w.jsx("span",{className:se(te===ge.id?"border-primary-6 text-gray-900":"border-gray-300 text-gray-500 hover:border-primary-6","whitespace-nowrap border-b-2 py-2.5 px-2 text-sm font-medium cursor-pointer"),"aria-current":te===ge.id?"page":void 0,onClick:()=>Lt({tab:ge}),"data-testid":`tab-${ge.id}`,children:ge.name},ge.name))}),w.jsxs("div",{className:se("sm:mt-2.5 py-3.5 relative",C&&Oe===null&&"px-4 sm:p-6",C&&Oe!==null&&"px-4 sm:px-6 sm:pb-6 sm:pt-2.5"),children:[z&&!Ye&&w.jsx(Hc,{className:"w-5 h-5 text-gray-400 cursor-pointer absolute right-4",onClick:tt,"data-testid":`edit-role-${v}`}),_&&w.jsx("div",{className:"flex justify-center mt-5",children:w.jsx(Qn,{})}),X&&St()&&we&&!_&&(z?!Ye:!R)&&w.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!_&&a.map((ge,st)=>w.jsxs("div",{className:se("flex flex-col 3xs:flex-row mb-4",C&&"ml-0 3xs:ml-3"),children:[typeof e=="function"?e({item:ge,index:st,handleChange:$e,isEdit:z?Ye:R}):e,k&&(z?Ye:R)&&w.jsx("div",{style:{backgroundColor:"#B0B8BF",width:"25px",height:"25px"},className:se("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&&!R&&"opacity-0"),children:w.jsx(ud,{className:se("w-6 h-4",(a.length>1||R)&&"cursor-pointer"),style:{color:"#637381"},strokeWidth:2.5,onClick:()=>lt({index:st,item:ge}),"data-testid":`delete-item-${st}-${v}`})})]},st)),k&&(z?Ye:R)&&!_&&w.jsx("p",{className:"text-secondary-2 text-sm font-medium ml-3 cursor-pointer",onClick:We,"data-testid":`add-item-${v}`,style:{width:"fit-content"},children:`+ Añadir ${f}`})]})]})})]})},wd=({src:e,alt:o,width:r,height:n,className:u="",priority:f=!1,style:a={},id:m="",onClick:v=null})=>{const[x,E]=g.useState(!1),k={filter:x?"none":"blur(10px)",transition:"filter 0.3s ease-out",objectFit:"cover",...r?{width:r}:{},...n?{height:n}:{},...a};return w.jsx("img",{src:e,alt:o,...r?{width:r}:{},...n?{height:n}:{},className:se(u!==""&&u),loading:f?"eager":"lazy",decoding:"async",style:k,onLoad:()=>E(!0),"data-testid":`image-${m}`,onClick:v})},Ed=["icon-analytics-alt-1","icon-bell-remove","icon-calculator-alt","icon-cart-full","icon-cloud-sun","icon-coding","icon-cottage-alt","icon-flag-alt","icon-gallery","icon-grow","icon-head-idea","icon-idea-share","icon-highlight-alt","icon-invention","icon-Jurisdiction","icon-layout-2","icon-lock","icon-map-alt","icon-megaphone","icon-personal-data","icon-personal-file","icon-phone-ring","icon-pie-chart-dollar","icon-pointer-right","icon-portfolio","icon-presentation-chart-line","icon-pyramid","icon-puzzle","icon-revenue","icon-rocket-growth-2","icon-ruler-pencil","icon-save","icon-search-home","icon-shoe-print","icon-strategy","icon-target","icon-time-settings","icon-vector-1","icon-user-alt-3","icon-world-2","icon-write","icon-website-money","icon-website","icon-alarm-clock","icon-arc","icon-bot","icon-control-panel","icon-corner","icon-dashboard","icon-full-battery","icon-help","icon-networking-startup","icon-share-alt","icon-thumbnail","icon-ux","icon-travel","icon-music","icon-heart","icon-book-mark","icon-map-pin","icon-star","icon-microphone","icon-clipboard-document","icon-arrow-down-tray"];function Sd({value:e,onChange:o,disabled:r,id:n,label:u="",classNameLabel:f="",helperText:a="",isError:m=!1,isReadOnly:v=!1,name:x}){const[E,k]=g.useState(!1),P=g.useRef(null);g.useEffect(()=>{function M(R){E&&P.current&&!P.current.contains(R.target)&&k(!1)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[E]);const C=Zt({"border-red-300 focus:border-red-300 text-red-900":m&&!v,"text-gray-500":!m,"focus:border-primary-7":!m&&!v});return w.jsxs(w.Fragment,{children:[u!==""&&w.jsx("p",{className:ln.classNames("block text-sm font-medium leading-6",f!==""?f:"text-gray-700"),"data-testid":`label-${n}`,children:u}),w.jsxs("div",{style:{position:"relative",width:"100%"},className:ln.classNames("border rounded-md",C),ref:P,children:[w.jsxs("div",{className:"flex items-center gap-2 dropdown-trigger border border-default-2 rounded-md p-1.5",onClick:()=>!r&&k(!E),style:{cursor:r?"not-allowed":"pointer"},title:e||"Selecciona un icono","data-testid":"open",children:[w.jsx("div",{className:"rounded border border-default-2 p-1 h-6 w-6 bg-default-2 flex items-center justify-center",children:e&&w.jsx("i",{className:ln.classNames(e,"text-normal block")})}),w.jsx("div",{className:"truncate",style:{width:"136px"},children:e}),w.jsx(al,{className:ln.classNames("h-5 w-5 ml-auto transition-transform",{"transform rotate-180":E})})]}),E&&w.jsx("div",{className:"openIconSelect absolute z-10 bg-white p-3 rounded-lg",style:{top:48,left:"0",width:"100%",maxWidth:500,border:"1px solid #ccc",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",maxHeight:300,overflowY:"auto"},children:w.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:"repeat(auto-fill, minmax(30px, 1fr))",gap:12},children:Ed.map(M=>w.jsx("button",{type:"button",className:"icon-picker-btn",style:{width:"100%",aspectRatio:"1",borderRadius:4,border:e===M?"2px solid #007bff":"1px solid #eee",background:"#f9f9f9",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,color:e===M?"#007bff":"#333",outline:"none",cursor:"pointer"},onClick:()=>{o({target:{value:M,checked:!1,name:x,id:n}}),k(!1)},title:M,children:w.jsx("i",{className:M})},M))})})]}),a.length>0&&m&&w.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${n}`,children:a})]})}const Dr=(e,o,r)=>{const n=r*o,u=n*(1-Math.abs(e/60%2-1)),f=r-n;let a,m,v;return e<60?[a,m,v]=[n,u,0]:e<120?[a,m,v]=[u,n,0]:e<180?[a,m,v]=[0,n,u]:e<240?[a,m,v]=[0,u,n]:e<300?[a,m,v]=[u,0,n]:[a,m,v]=[n,0,u],[Math.round((a+f)*255),Math.round((m+f)*255),Math.round((v+f)*255)]},Do=(e,o,r)=>{e/=255,o/=255,r/=255;const n=Math.max(e,o,r),u=Math.min(e,o,r),f=n-u;let a;const m=n,v=n===0?0:f/n;if(n===u)a=0;else{switch(n){case e:a=(o-r)/f+(o<r?6:0);break;case o:a=(r-e)/f+2;break;case r:a=(e-o)/f+4;break}a*=60}return[a,v,m]},er=(e,o,r)=>"#"+[e,o,r].map(n=>n.toString(16).padStart(2,"0")).join("").toUpperCase(),dl=e=>/^#[0-9A-Fa-f]{6}$/.test(e)?[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]:[255,0,0];function Cd({value:e,onChange:o,disabled:r,label:n="",classNameLabel:u="",helperText:f="",isError:a=!1,isReadOnly:m=!1,name:v}){const x=g.useRef(!0),E=g.useRef(null),k=g.useRef(null),[P,C]=g.useState(!1),[M,R]=g.useState([182.2,.849,.494]),[L,B]=g.useState(e),_=g.useCallback(q=>{o({target:{value:q,name:v}})},[v,o]);g.useEffect(()=>{if(e&&/^#[0-9A-Fa-f]{6}$/.test(e)){const q=dl(e);R(Do(...q)),B(e.toUpperCase())}},[e]);const[z,X,ee]=M,[ue,we,Oe]=Dr(z,X,ee),be=er(ue,we,Oe);g.useEffect(()=>{B(be)},[be]),g.useEffect(()=>{!x.current||m||(x.current=!1,_(be))},[be,_,m]),g.useEffect(()=>{function q(ve){if(!E.current||!E.current._dragging)return;const $e=E.current.getBoundingClientRect();let We=(ve.touches?ve.touches[0].clientX:ve.clientX)-$e.left,lt=(ve.touches?ve.touches[0].clientY:ve.clientY)-$e.top;We=Math.max(0,Math.min($e.width,We)),lt=Math.max(0,Math.min($e.height,lt));const tt=We/$e.width,St=1-lt/$e.height;R([z,tt,St]);const[Lt,ge,st]=Dr(z,tt,St),re=er(Lt,ge,st);B(re),_(re)}function te(){E.current&&(E.current._dragging=!1),window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",te),window.removeEventListener("touchmove",q),window.removeEventListener("touchend",te)}return E.current&&E.current._dragging&&(window.addEventListener("mousemove",q),window.addEventListener("mouseup",te),window.addEventListener("touchmove",q),window.addEventListener("touchend",te)),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",te),window.removeEventListener("touchmove",q),window.removeEventListener("touchend",te)}},[_,z]),g.useEffect(()=>{function q(te){P&&k.current&&!k.current.contains(te.target)&&C(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[P]);const y=q=>{if(!E.current)return;const te=E.current.getBoundingClientRect();let ve=(q.touches?q.touches[0].clientX:q.clientX)-te.left,$e=(q.touches?q.touches[0].clientY:q.clientY)-te.top;ve=Math.max(0,Math.min(te.width,ve)),$e=Math.max(0,Math.min(te.height,$e));const We=ve/te.width,lt=1-$e/te.height;R([z,We,lt]);const[tt,St,Lt]=Dr(z,We,lt),ge=er(tt,St,Lt);B(ge),_(ge)},he=q=>{r||(E.current&&(E.current._dragging=!0),y(q))},Pe=()=>{E.current&&(E.current._dragging=!1)},Ze=q=>{const te=Number(q.target.value);R([te,X,ee]);const[ve,$e,We]=Dr(te,X,ee),lt=er(ve,$e,We);B(lt),_(lt)},Ye=q=>{const te=q.target.value;if(B(te),/^#[0-9A-Fa-f]{6}$/.test(te)){const ve=dl(te);R(Do(...ve)),_(te.toUpperCase())}},Y=(q,te)=>{const ve=[ue,we,Oe];ve[q]=Math.max(0,Math.min(255,Number(te)||0)),R(Do(...ve));const $e=er(...ve);B($e),_($e)},Je=X*180,Re=(1-ee)*180;return w.jsxs(w.Fragment,{children:[n&&w.jsx("p",{className:Zt("block text-sm font-medium leading-6",u||"text-gray-700"),children:n}),w.jsxs("div",{style:{position:"relative",display:"inline-block"},ref:k,className:"w-full",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-2 dropdown-trigger rounded-md border p-2 border-default-2 w-full",onClick:()=>!r&&C(!P),children:[w.jsx("div",{className:"rounded border border-default-2 flex-shrink-0 w-6 h-6",style:{backgroundColor:m?"":be}}),w.jsx("input",{type:"text",className:"px-2 py-1 border-b border-t-0 border-l-0 border-r-0 border-default-7 text-xs focus:border-default-5 focus:ring-0 w-full",value:m?"":L,disabled:r,onChange:Ye,readOnly:m}),w.jsx(Po,{className:Zt("h-5 w-5 ml-2 transition-transform",{"transform rotate-180":P&&!m})})]}),P&&!m&&w.jsxs("div",{className:"openSketch absolute z-20 top-14 left-0 bg-white border border-default-5 rounded-md p-4 shadow-md w-full",children:[w.jsxs("div",{className:"relative rounded mb-2 cursor-crosshair",ref:E,style:{backgroundColor:`hsl(${z}, 100%, 50%)`,height:"200px"},onMouseDown:he,onMouseMove:q=>E.current&&E.current._dragging&&y(q),onMouseUp:Pe,onMouseLeave:Pe,onTouchStart:he,onTouchMove:q=>E.current&&E.current._dragging&&y(q),onTouchEnd:Pe,children:[w.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, #fff, transparent)",borderRadius:"inherit",pointerEvents:"none"}}),w.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to top, #000, transparent)",borderRadius:"inherit",pointerEvents:"none"}}),w.jsx("div",{className:"absolute w-4 h-4 rounded-full border-2 border-white shadow",style:{left:`calc(${Je}px - 8px)`,top:`calc(${Re}px - 8px)`,background:be,pointerEvents:"none"}})]}),w.jsx("input",{type:"range",min:0,max:359,value:z,onChange:Ze,className:"w-full mb-2",style:{background:"linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)"},disabled:r}),w.jsx("div",{className:"flex gap-2 mb-2",children:["R","G","B"].map((q,te)=>w.jsxs("div",{children:[w.jsx("label",{className:"text-center block",children:q}),w.jsx("input",{type:"number",min:0,max:255,className:"w-14 px-2 py-1 border border-gray-300 rounded text-sm",value:[ue,we,Oe][te],onChange:ve=>Y(te,ve.target.value),disabled:r,placeholder:q})]},te))})]})]}),f&&a&&w.jsx("p",{className:"text-red-600 text-sm text-left mt-1",children:f})]})}const jd=["#FFCEC7","#2ecc71","#3498db","#9b59b6","#34495e","#1abc9c","#e74c3c","#7f8c8d","#f1c40f","#e67e22","#000000"],Td=({className:e="",label:o="",onChange:r,name:n,id:u,value:f="#FFCEC7"})=>{const[a,m]=g.useState(!1),[v,x]=g.useState("#FFCEC7");mi({id:"menu-colors",close:()=>m(!1)}),g.useEffect(()=>{x(f)},[f]);const E=k=>{x(k),m(!1),r({target:{value:k,checked:!1,name:n,type:void 0,id:u}})};return w.jsxs("div",{className:se("relative",e!==""&&e),children:[o&&w.jsx("p",{className:"text-sm font-medium leading-6 text-gray-500 mb-0.5",children:o}),w.jsxs("div",{className:"flex justify-center items-center bg-gray-100 px-3 rounded-md h-10 w-20 gap-4 cursor-pointer",onClick:()=>m(!a),id:"menu-colors","data-testid":"menu-colors",children:[w.jsx("div",{style:{width:"18px",height:"18px",backgroundColor:v},className:"rounded-full"}),w.jsx(Po,{className:se("h-5 w-5 transition-transform",a&&"transform rotate-180")})]}),w.jsx(vn,{show:a,enter:"transition-opacity duration-75",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-150",leaveFrom:"opacity-100",leaveTo:"opacity-0",id:"menu-colors",className:"absolute top-full",children:w.jsx("div",{id:"menu-colors",className:"bg-gray-100 shadow grid gap-2 p-2 mt-2 rounded",style:{gridTemplateColumns:"repeat(auto-fill, minmax(17px, 1fr))",maxWidth:"180px"},children:jd.map((k,P)=>w.jsx("div",{style:{width:"17px",height:"17px",backgroundColor:k},className:"rounded-full cursor-pointer flex justify-center items-center",onClick:()=>E(k),"data-testid":`color-${P}`,children:v===k&&w.jsx(Nc,{className:"w-3 h-3 text-white",stroke:"2"})},P))})})]})};Se.Accordion=yd,Se.Alert=Dc,Se.Avatar=Kc,Se.Bullets=Xc,Se.ButtonOutline=sl,Se.ButtonPagination=Qc,Se.ButtonSolid=Jn,Se.Checkbox=ed,Se.ConfirmationAbandoningCreation=cd,Se.CoverPhoto=xd,Se.Divider=dd,Se.Dropdown=gd,Se.GoBack=fd,Se.IconSelectPicker=Sd,Se.Image=wd,Se.Input=Lo,Se.InputDropdown=md,Se.MESSAGE_ABORT_CONTROLLER=is,Se.MESSAGE_SIGNAL_ABORTED_WITHOUT_REASON=ls,Se.Modal=ul,Se.Pagination=bd,Se.Select=cl,Se.SelectColor=Td,Se.SketchColorPicker=Cd,Se.Spinner=pd,Se.SpinnerIcon=Qn,Se.Switch=hd,Se.Textarea=vd,Se.Tooltip=Ro,Se.classNames=se,Se.copyOptions=eo,Se.generateAvatarInitials=ns,Se.groupBy=rs,Se.isPromise=os,Se.rowsPerPage=Ao,Se.useCloseModal=mi,Se.useForm=ss,Se.useMediaQuery=as,Se.useWindowDimensions=hi,Se.validateEmail=pi,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
121
+ `}),w.jsx(Fr.Button,{as:"div",onClick:()=>ge(X),"data-testid":`menu-button-${ee}`,ref:$e,children:e}),!Je&&w.jsx("div",{className:se("absolute right-0 z-20",n,X&&"hidden",C&&"w-full"),children:w.jsx(vn,{as:g.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:q,children:w.jsx(Fr.Items,{className:se("mt-1 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",C?"w-full":f===""&&"w-max",f!==""&&f),children:C?w.jsx("div",{className:"flex justify-center py-4",children:w.jsx(Qn,{})}):w.jsxs("div",{className:se(!_&&"pb-1",r!==""&&r,Oe&&"w-custom"),"data-testid":"dropdown-menu",onScroll:te,children:[w.jsxs("div",{className:"sticky top-0 bg-white w-full",children:[M!==null&&w.jsx("div",{className:se("py-2 w-full",a),children:w.jsx(Lo,{htmlFor:"search",id:`dropdown-search-${ee}`,name:"search",type:"text",placeholder:R,handleChange:V=>M(V,ee),icon:R!==""&&w.jsx(zc,{className:"w-4 h-4 text-primary-4"}),className:"pl-5 pr-4 h-8",classNameContainerInput:"w-full",value:L,onKeyDown:V=>V.key===" "&&V.stopPropagation(),autocomplete:"off"})}),Pe!==null&&w.jsxs("div",{className:se("pt-1.5 justify-end flex items-center",a),children:[w.jsx(Jn,{classNameButton:se("bg-gray-400 hover:bg-gray-400 font-medium px-2 py-1.5 rounded-md",We.size>0?"opacity-1 cursor-pointer":"opacity-0 cursor-default"),outline:"",classNameText:"text-xs text-white text-center",id:"delete",onClick:re,children:"Descartar"}),w.jsx(Jn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 font-medium px-2 py-1.5 rounded-md",outline:We.size===0&&Re?"":"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:We.size===0&&Re,onClick:()=>Pe({id:ee,items:Array.from(tt.values())}),children:Ze})]})]}),be&&w.jsx("div",{className:"flex flex-wrap ml-7 pt-1",children:Array.from(tt).map((V,Ee)=>w.jsx("div",{className:"mr-1",children:w.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:[V[1][x],w.jsx("button",{type:"button",className:"p-0.5 rounded-sm bg-gray-100 hover:bg-gray-300",onClick:()=>st(V[1]),"data-testid":`tag-${V[0]}`,children:w.jsx(qc,{className:"h-2.5 w-2.5 stroke-gray-700/50 group-hover:stroke-gray-700/75"})})]})},V))}),w.jsx("div",{className:"divide-y divide-gray-100",children:o.map((V,Ee)=>w.jsx("div",{className:se(!_&&"py-1",z&&Ee===0&&"sticky top-0"),children:_?w.jsx("div",{onClick:ke=>{ke.preventDefault(),v()},"data-testid":`item-component-${Ee}`,children:V}):w.jsx(Fr.Item,{children:w.jsx("span",{className:se(We.has(V[E])&&"blue text-white",!We.has(V[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-${Ee}`,onClick:ke=>{ke.preventDefault(),Lt(V)},children:Ce(V[x])})})},Ee))})]})})})})]})},Ao=50,bd=({total:e,handleNext:o,handlePrev:r,handleSelectPage:n,page:u=null,pageSize:f=Ao})=>{const[a,m]=g.useState(1),[v,x]=g.useState([]),[E,k]=g.useState([]),[P,C]=g.useState(""),M=Math.ceil(e/f);g.useEffect(()=>{const z=[];for(let X=1;X<=M;X++)z.push(X);k(z)},[M]),g.useEffect(()=>{let z=[];const X="...",ee="... ",ue=" ...";if(E.length<6)z=E;else if(a>=1&&a<=3)z=[1,2,3,4,X,E.length];else if(a===4)z=[...E.slice(0,5),X,E.length];else if(a>4&&a<E.length-2){const we=E.slice(a-2,a),Oe=E.slice(a,a+1);z=[1,ee,...we,...Oe,ue,E.length]}else if(a>E.length-3){const we=E.slice(E.length-4);z=[1,ee,...we]}x(z)},[a,E]),g.useEffect(()=>{u!==null&&u!==a&&m(u)},[u,a]);const R=z=>{C(""),m(z),n(z)},L=()=>{C(""),a>1&&m(a-1),a>1&&r(a-1)},B=()=>{C(""),a<E.length&&m(a+1),a<E.length&&o(a+1)},_=z=>{const{value:X}=z.target;if(!/^\d*$/.test(X))return;const ee=Math.ceil(e/Ao);X>ee||C(X)};return g.useEffect(()=>{const z=setTimeout(()=>{const X=Number(P);!isNaN(X)&&X>=1&&X<=M&&(n(X),m(X))},500);return()=>clearTimeout(z)},[P,M,n]),w.jsxs("nav",{className:"flex items-center justify-between border-t border-gray-200 px-4 sm:px-0",children:[w.jsx("div",{className:"-mt-px flex w-0 flex-1",children:w.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:L,"data-testid":"prev",children:[w.jsx(wc,{className:"mr-3 h-5 w-5 text-gray-400","aria-hidden":"true"}),"Anterior"]})}),w.jsxs("div",{className:"hidden md:-mt-px md:flex",children:[w.jsxs("div",{children:[w.jsx("span",{className:"text-sm text-gray-500 font-medium mr-1",children:"Ir a"}),w.jsx("div",{className:"inline-flex items-center border-t-2 pr-2 pt-1 text-sm font-medium border-transparent text-gray-500",style:{width:"45px"},children:w.jsx(ln.Input,{htmlFor:"",id:"pager",name:"pager",handleChange:_,value:P,className:"pl-1.5 pr-1 h-7"})})]}),v.map((z,X)=>w.jsx(ln.ButtonPagination,{className:ln.classNames("inline-flex items-center border-t-2 px-4 pt-4 text-sm font-medium",a===z?"border-primary-6 text-primary-7":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),"aria-current":"page",onClick:()=>z!=="..."&&z!==" ..."&&z!=="... "&&R(z),id:`page-${X+1}`,children:z},X))]}),w.jsx("div",{className:"-mt-px flex w-0 flex-1 justify-end",children:w.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:B,"data-testid":"next",children:["Siguiente",w.jsx(Sc,{className:"ml-3 h-5 w-5 text-gray-400","aria-hidden":"true"})]})})]})},xd=({setForm:e,setValuesDefault:o,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("."),P=C=>{const{files:M}=C.target,[R]=M,L=new FileReader;L.readAsDataURL(R),L.onload=function(){R.type.startsWith("image/")?(e(_=>({..._,photo:L.result})),o("photo",L.result)):(e(_=>({..._,photo:"https://cdn.pixabay.com/photo/2017/03/08/21/21/file-2127833_1280.png"})),o("photo",L.result))}};return w.jsxs("div",{className:se("col-span-full",n!==""&&n),children:[w.jsx("label",{htmlFor:"cover-photo",className:"block text-sm font-medium leading-6 text-gray-500",children:x}),w.jsxs("div",{className:se("mt-2 flex justify-center rounded-lg border-2 border-dotted border-gray-300 cursor-pointer relative",u!==""&&u),children:[f?w.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:se(r!==""&&r),loading:"lazy",decoding:"async",style:{filter:"blur(5px)",transition:"filter 0.3s",objectFit:"contain",height:v},onLoad:C=>C.currentTarget.style.filter="none","data-testid":"img"}):w.jsxs("div",{className:"text-center",children:[w.jsx(Vc,{"aria-hidden":"true",className:"mx-auto h-12 w-12 text-gray-300"}),w.jsxs("div",{className:"mt-4 flex text-sm leading-6 text-gray-600",children:[w.jsx("label",{htmlFor:"file-upload",className:"relative cursor-pointer rounded-md bg-white font-semibold text-primary-7 focus-within:outline-none focus-within:ring-2 focus-within:ring-primary-7 focus-within:ring-offset-2 hover:text-primary-6",children:w.jsx("span",{children:"Subir un archivo"})}),w.jsx("p",{className:"pl-1",children:"o arrástralo y suéltalo aquí"})]}),w.jsx("p",{className:"text-xs leading-5 text-gray-600",children:E})]}),w.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:P})]})]})},yd=({children:e,openDefault:o=!1,setForm:r,setValuesDefault:n,title:u,type:f,data:a,setData:m,id:v,defaultData:x,showAlert:E,isAdd:k=!0,search:P=null,isPadding:C=!0,isReadOnly:M=!1,isEdit:R=!1,deleteItem:L=null,validateAdd:B=null,loading:_=!1,internalEdit:z=!0,isDataEmpty:X=!0,typeProp:ee="value",setAdd:ue=null,hasNoRecords:we=!0,tabs:Oe=null,selectTab:be=null,className:y="mt-7"})=>{const[Pe,Ze]=g.useState(!1),[Ye,Y]=g.useState(!1),[,Je]=g.useState(!1),[Re,q]=g.useState(""),[te,ve]=g.useState(1);g.useEffect(()=>{Ze(o),Je(M)},[o,M]);const $e=({e:ge,index:st})=>{const re=eo(a),{name:Ce,value:V}=ge.target;!(B===null?!1:B({value:V,copyData:re,index:st}))&&(re[st][Ce]=V),m(re),n(v,re),r(ke=>({...ke,[v]:re}))},We=()=>{if(a.some(st=>Object.values(st).some(V=>V[ee]===-1))||a.length===0)return E({title:"",message:"Todos los campos son requeridos",type:"warning"});r(st=>({...st,data:a})),n(v,a),m([...a,x]),ue&&ue([...a,x])},lt=({index:ge,item:st})=>{if(a.length===1&&!R)return;let re=eo(a);re.length===1&&(re=[x]),re.length>1&&re.splice(ge,1),r(Ce=>({...Ce,data:re})),n(v,re),m(re),L&&L({index:ge,item:st,data:re}),ge===a.length-1&&R&&re.length===0&&(r(Ce=>({...Ce,data:re})),n(v,re),m([...re,x]))},tt=()=>{Y(!Ye),Je(!1)},St=()=>{if(a.length>1)return;if(a.length===0)return!0;const[ge]=a;return!ge||typeof ge!="object"?!0:Object.keys(ge).filter(Ce=>{const V=ge[Ce];return V&&typeof V=="object"&&"value"in V}).every(Ce=>ge[Ce].value===-1)},Lt=({tab:ge})=>{ve(ge.id),be&&be({tab:ge})};return w.jsxs("div",{className:se("divide-y divide-gray-200 rounded-lg bg-white shadow",y),children:[w.jsxs("div",{className:"px-4 py-3.5 sm:px-6 flex justify-between items-center cursor-pointer",onClick:()=>Ze(!Pe),"data-testid":`open-accordion-${v}`,children:[typeof u=="string"?w.jsx("p",{className:"text-gray-500 uppercase text-xs font-bold",children:u}):u,w.jsxs("div",{className:"flex items-center",children:[P&&w.jsx(Lo,{htmlFor:"search",id:"search",name:"search",type:"text",autoComplete:"search",placeholder:"Buscar...",handleChange:ge=>{P(ge),q(ge.target.value)},icon:w.jsx(sd,{className:"w-6 h-6 text-primary-4"}),className:"h-9",classNameContainerInput:"w-52 2xs:w-64 max-w-64 mr-8 hidden sm:block",value:Re,onClick:ge=>ge.stopPropagation(),onFocus:()=>Ze(!0)}),Pe?w.jsx(id,{className:"w-5 h-5 text-default-4"}):w.jsx(al,{className:"w-5 h-5 text-default-4"})]})]}),w.jsx(vn,{as:g.Fragment,show:Pe,enter:"transition duration-[400ms]",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"duration-200 transition ease-in-out",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:w.jsxs("div",{children:[Oe&&w.jsx("nav",{className:"flex justify-center border-b border-gray-200","aria-label":"Tabs",children:Oe.map(ge=>w.jsx("span",{className:se(te===ge.id?"border-primary-6 text-gray-900":"border-gray-300 text-gray-500 hover:border-primary-6","whitespace-nowrap border-b-2 py-2.5 px-2 text-sm font-medium cursor-pointer"),"aria-current":te===ge.id?"page":void 0,onClick:()=>Lt({tab:ge}),"data-testid":`tab-${ge.id}`,children:ge.name},ge.name))}),w.jsxs("div",{className:se("sm:mt-2.5 py-3.5 relative",C&&Oe===null&&"px-4 sm:p-6",C&&Oe!==null&&"px-4 sm:px-6 sm:pb-6 sm:pt-2.5"),children:[z&&!Ye&&w.jsx(Hc,{className:"w-5 h-5 text-gray-400 cursor-pointer absolute right-4",onClick:tt,"data-testid":`edit-role-${v}`}),_&&w.jsx("div",{className:"flex justify-center mt-5",children:w.jsx(Qn,{})}),X&&St()&&we&&!_&&(z?!Ye:!R)&&w.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!_&&a.map((ge,st)=>w.jsxs("div",{className:se("flex flex-col 3xs:flex-row mb-4",C&&"ml-0 3xs:ml-3"),children:[typeof e=="function"?e({item:ge,index:st,handleChange:$e,isEdit:z?Ye:R}):e,k&&(z?Ye:R)&&w.jsx("div",{style:{backgroundColor:"#B0B8BF",width:"25px",height:"25px"},className:se("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&&!R&&"opacity-0"),children:w.jsx(ud,{className:se("w-6 h-4",(a.length>1||R)&&"cursor-pointer"),style:{color:"#637381"},strokeWidth:2.5,onClick:()=>lt({index:st,item:ge}),"data-testid":`delete-item-${st}-${v}`})})]},st)),k&&(z?Ye:R)&&!_&&w.jsx("p",{className:"text-secondary-2 text-sm font-medium ml-3 cursor-pointer",onClick:We,"data-testid":`add-item-${v}`,style:{width:"fit-content"},children:`+ Añadir ${f}`})]})]})})]})},wd=({src:e,alt:o,width:r,height:n,className:u="",priority:f=!1,style:a={},id:m="",onClick:v=null,objectFit:x="cover"})=>{const[E,k]=g.useState(!1),P={filter:E?"none":"blur(10px)",transition:"filter 0.3s ease-out",objectFit:x,...r?{width:r}:{},...n?{height:n}:{},...a};return w.jsx("img",{src:e,alt:o,...r?{width:r}:{},...n?{height:n}:{},className:se(u!==""&&u),loading:f?"eager":"lazy",decoding:"async",style:P,onLoad:()=>k(!0),"data-testid":`image-${m}`,onClick:v})},Ed=["icon-analytics-alt-1","icon-bell-remove","icon-calculator-alt","icon-cart-full","icon-cloud-sun","icon-coding","icon-cottage-alt","icon-flag-alt","icon-gallery","icon-grow","icon-head-idea","icon-idea-share","icon-highlight-alt","icon-invention","icon-Jurisdiction","icon-layout-2","icon-lock","icon-map-alt","icon-megaphone","icon-personal-data","icon-personal-file","icon-phone-ring","icon-pie-chart-dollar","icon-pointer-right","icon-portfolio","icon-presentation-chart-line","icon-pyramid","icon-puzzle","icon-revenue","icon-rocket-growth-2","icon-ruler-pencil","icon-save","icon-search-home","icon-shoe-print","icon-strategy","icon-target","icon-time-settings","icon-vector-1","icon-user-alt-3","icon-world-2","icon-write","icon-website-money","icon-website","icon-alarm-clock","icon-arc","icon-bot","icon-control-panel","icon-corner","icon-dashboard","icon-full-battery","icon-help","icon-networking-startup","icon-share-alt","icon-thumbnail","icon-ux","icon-travel","icon-music","icon-heart","icon-book-mark","icon-map-pin","icon-star","icon-microphone","icon-clipboard-document","icon-arrow-down-tray"];function Sd({value:e,onChange:o,disabled:r,id:n,label:u="",classNameLabel:f="",helperText:a="",isError:m=!1,isReadOnly:v=!1,name:x}){const[E,k]=g.useState(!1),P=g.useRef(null);g.useEffect(()=>{function M(R){E&&P.current&&!P.current.contains(R.target)&&k(!1)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[E]);const C=Zt({"border-red-300 focus:border-red-300 text-red-900":m&&!v,"text-gray-500":!m,"focus:border-primary-7":!m&&!v});return w.jsxs(w.Fragment,{children:[u!==""&&w.jsx("p",{className:ln.classNames("block text-sm font-medium leading-6",f!==""?f:"text-gray-700"),"data-testid":`label-${n}`,children:u}),w.jsxs("div",{style:{position:"relative",width:"100%"},className:ln.classNames("border rounded-md",C),ref:P,children:[w.jsxs("div",{className:"flex items-center gap-2 dropdown-trigger border border-default-2 rounded-md p-1.5",onClick:()=>!r&&k(!E),style:{cursor:r?"not-allowed":"pointer"},title:e||"Selecciona un icono","data-testid":"open",children:[w.jsx("div",{className:"rounded border border-default-2 p-1 h-6 w-6 bg-default-2 flex items-center justify-center",children:e&&w.jsx("i",{className:ln.classNames(e,"text-normal block")})}),w.jsx("div",{className:"truncate",style:{width:"136px"},children:e}),w.jsx(al,{className:ln.classNames("h-5 w-5 ml-auto transition-transform",{"transform rotate-180":E})})]}),E&&w.jsx("div",{className:"openIconSelect absolute z-10 bg-white p-3 rounded-lg",style:{top:48,left:"0",width:"100%",maxWidth:500,border:"1px solid #ccc",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",maxHeight:300,overflowY:"auto"},children:w.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:"repeat(auto-fill, minmax(30px, 1fr))",gap:12},children:Ed.map(M=>w.jsx("button",{type:"button",className:"icon-picker-btn",style:{width:"100%",aspectRatio:"1",borderRadius:4,border:e===M?"2px solid #007bff":"1px solid #eee",background:"#f9f9f9",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,color:e===M?"#007bff":"#333",outline:"none",cursor:"pointer"},onClick:()=>{o({target:{value:M,checked:!1,name:x,id:n}}),k(!1)},title:M,children:w.jsx("i",{className:M})},M))})})]}),a.length>0&&m&&w.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${n}`,children:a})]})}const Dr=(e,o,r)=>{const n=r*o,u=n*(1-Math.abs(e/60%2-1)),f=r-n;let a,m,v;return e<60?[a,m,v]=[n,u,0]:e<120?[a,m,v]=[u,n,0]:e<180?[a,m,v]=[0,n,u]:e<240?[a,m,v]=[0,u,n]:e<300?[a,m,v]=[u,0,n]:[a,m,v]=[n,0,u],[Math.round((a+f)*255),Math.round((m+f)*255),Math.round((v+f)*255)]},Do=(e,o,r)=>{e/=255,o/=255,r/=255;const n=Math.max(e,o,r),u=Math.min(e,o,r),f=n-u;let a;const m=n,v=n===0?0:f/n;if(n===u)a=0;else{switch(n){case e:a=(o-r)/f+(o<r?6:0);break;case o:a=(r-e)/f+2;break;case r:a=(e-o)/f+4;break}a*=60}return[a,v,m]},er=(e,o,r)=>"#"+[e,o,r].map(n=>n.toString(16).padStart(2,"0")).join("").toUpperCase(),dl=e=>/^#[0-9A-Fa-f]{6}$/.test(e)?[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]:[255,0,0];function Cd({value:e,onChange:o,disabled:r,label:n="",classNameLabel:u="",helperText:f="",isError:a=!1,isReadOnly:m=!1,name:v}){const x=g.useRef(!0),E=g.useRef(null),k=g.useRef(null),[P,C]=g.useState(!1),[M,R]=g.useState([182.2,.849,.494]),[L,B]=g.useState(e),_=g.useCallback(q=>{o({target:{value:q,name:v}})},[v,o]);g.useEffect(()=>{if(e&&/^#[0-9A-Fa-f]{6}$/.test(e)){const q=dl(e);R(Do(...q)),B(e.toUpperCase())}},[e]);const[z,X,ee]=M,[ue,we,Oe]=Dr(z,X,ee),be=er(ue,we,Oe);g.useEffect(()=>{B(be)},[be]),g.useEffect(()=>{!x.current||m||(x.current=!1,_(be))},[be,_,m]),g.useEffect(()=>{function q(ve){if(!E.current||!E.current._dragging)return;const $e=E.current.getBoundingClientRect();let We=(ve.touches?ve.touches[0].clientX:ve.clientX)-$e.left,lt=(ve.touches?ve.touches[0].clientY:ve.clientY)-$e.top;We=Math.max(0,Math.min($e.width,We)),lt=Math.max(0,Math.min($e.height,lt));const tt=We/$e.width,St=1-lt/$e.height;R([z,tt,St]);const[Lt,ge,st]=Dr(z,tt,St),re=er(Lt,ge,st);B(re),_(re)}function te(){E.current&&(E.current._dragging=!1),window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",te),window.removeEventListener("touchmove",q),window.removeEventListener("touchend",te)}return E.current&&E.current._dragging&&(window.addEventListener("mousemove",q),window.addEventListener("mouseup",te),window.addEventListener("touchmove",q),window.addEventListener("touchend",te)),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",te),window.removeEventListener("touchmove",q),window.removeEventListener("touchend",te)}},[_,z]),g.useEffect(()=>{function q(te){P&&k.current&&!k.current.contains(te.target)&&C(!1)}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[P]);const y=q=>{if(!E.current)return;const te=E.current.getBoundingClientRect();let ve=(q.touches?q.touches[0].clientX:q.clientX)-te.left,$e=(q.touches?q.touches[0].clientY:q.clientY)-te.top;ve=Math.max(0,Math.min(te.width,ve)),$e=Math.max(0,Math.min(te.height,$e));const We=ve/te.width,lt=1-$e/te.height;R([z,We,lt]);const[tt,St,Lt]=Dr(z,We,lt),ge=er(tt,St,Lt);B(ge),_(ge)},he=q=>{r||(E.current&&(E.current._dragging=!0),y(q))},Pe=()=>{E.current&&(E.current._dragging=!1)},Ze=q=>{const te=Number(q.target.value);R([te,X,ee]);const[ve,$e,We]=Dr(te,X,ee),lt=er(ve,$e,We);B(lt),_(lt)},Ye=q=>{const te=q.target.value;if(B(te),/^#[0-9A-Fa-f]{6}$/.test(te)){const ve=dl(te);R(Do(...ve)),_(te.toUpperCase())}},Y=(q,te)=>{const ve=[ue,we,Oe];ve[q]=Math.max(0,Math.min(255,Number(te)||0)),R(Do(...ve));const $e=er(...ve);B($e),_($e)},Je=X*180,Re=(1-ee)*180;return w.jsxs(w.Fragment,{children:[n&&w.jsx("p",{className:Zt("block text-sm font-medium leading-6",u||"text-gray-700"),children:n}),w.jsxs("div",{style:{position:"relative",display:"inline-block"},ref:k,className:"w-full",children:[w.jsxs("div",{className:"flex items-center gap-2 mb-2 dropdown-trigger rounded-md border p-2 border-default-2 w-full",onClick:()=>!r&&C(!P),children:[w.jsx("div",{className:"rounded border border-default-2 flex-shrink-0 w-6 h-6",style:{backgroundColor:m?"":be}}),w.jsx("input",{type:"text",className:"px-2 py-1 border-b border-t-0 border-l-0 border-r-0 border-default-7 text-xs focus:border-default-5 focus:ring-0 w-full",value:m?"":L,disabled:r,onChange:Ye,readOnly:m}),w.jsx(Po,{className:Zt("h-5 w-5 ml-2 transition-transform",{"transform rotate-180":P&&!m})})]}),P&&!m&&w.jsxs("div",{className:"openSketch absolute z-20 top-14 left-0 bg-white border border-default-5 rounded-md p-4 shadow-md w-full",children:[w.jsxs("div",{className:"relative rounded mb-2 cursor-crosshair",ref:E,style:{backgroundColor:`hsl(${z}, 100%, 50%)`,height:"200px"},onMouseDown:he,onMouseMove:q=>E.current&&E.current._dragging&&y(q),onMouseUp:Pe,onMouseLeave:Pe,onTouchStart:he,onTouchMove:q=>E.current&&E.current._dragging&&y(q),onTouchEnd:Pe,children:[w.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, #fff, transparent)",borderRadius:"inherit",pointerEvents:"none"}}),w.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to top, #000, transparent)",borderRadius:"inherit",pointerEvents:"none"}}),w.jsx("div",{className:"absolute w-4 h-4 rounded-full border-2 border-white shadow",style:{left:`calc(${Je}px - 8px)`,top:`calc(${Re}px - 8px)`,background:be,pointerEvents:"none"}})]}),w.jsx("input",{type:"range",min:0,max:359,value:z,onChange:Ze,className:"w-full mb-2",style:{background:"linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)"},disabled:r}),w.jsx("div",{className:"flex gap-2 mb-2",children:["R","G","B"].map((q,te)=>w.jsxs("div",{children:[w.jsx("label",{className:"text-center block",children:q}),w.jsx("input",{type:"number",min:0,max:255,className:"w-14 px-2 py-1 border border-gray-300 rounded text-sm",value:[ue,we,Oe][te],onChange:ve=>Y(te,ve.target.value),disabled:r,placeholder:q})]},te))})]})]}),f&&a&&w.jsx("p",{className:"text-red-600 text-sm text-left mt-1",children:f})]})}const jd=["#FFCEC7","#2ecc71","#3498db","#9b59b6","#34495e","#1abc9c","#e74c3c","#7f8c8d","#f1c40f","#e67e22","#000000"],Td=({className:e="",label:o="",onChange:r,name:n,id:u,value:f="#FFCEC7"})=>{const[a,m]=g.useState(!1),[v,x]=g.useState("#FFCEC7");mi({id:"menu-colors",close:()=>m(!1)}),g.useEffect(()=>{x(f)},[f]);const E=k=>{x(k),m(!1),r({target:{value:k,checked:!1,name:n,type:void 0,id:u}})};return w.jsxs("div",{className:se("relative",e!==""&&e),children:[o&&w.jsx("p",{className:"text-sm font-medium leading-6 text-gray-500 mb-0.5",children:o}),w.jsxs("div",{className:"flex justify-center items-center bg-gray-100 px-3 rounded-md h-10 w-20 gap-4 cursor-pointer",onClick:()=>m(!a),id:"menu-colors","data-testid":"menu-colors",children:[w.jsx("div",{style:{width:"18px",height:"18px",backgroundColor:v},className:"rounded-full"}),w.jsx(Po,{className:se("h-5 w-5 transition-transform",a&&"transform rotate-180")})]}),w.jsx(vn,{show:a,enter:"transition-opacity duration-75",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-150",leaveFrom:"opacity-100",leaveTo:"opacity-0",id:"menu-colors",className:"absolute top-full",children:w.jsx("div",{id:"menu-colors",className:"bg-gray-100 shadow grid gap-2 p-2 mt-2 rounded",style:{gridTemplateColumns:"repeat(auto-fill, minmax(17px, 1fr))",maxWidth:"180px"},children:jd.map((k,P)=>w.jsx("div",{style:{width:"17px",height:"17px",backgroundColor:k},className:"rounded-full cursor-pointer flex justify-center items-center",onClick:()=>E(k),"data-testid":`color-${P}`,children:v===k&&w.jsx(Nc,{className:"w-3 h-3 text-white",stroke:"2"})},P))})})]})};Se.Accordion=yd,Se.Alert=Dc,Se.Avatar=Kc,Se.Bullets=Xc,Se.ButtonOutline=sl,Se.ButtonPagination=Qc,Se.ButtonSolid=Jn,Se.Checkbox=ed,Se.ConfirmationAbandoningCreation=cd,Se.CoverPhoto=xd,Se.Divider=dd,Se.Dropdown=gd,Se.GoBack=fd,Se.IconSelectPicker=Sd,Se.Image=wd,Se.Input=Lo,Se.InputDropdown=md,Se.MESSAGE_ABORT_CONTROLLER=is,Se.MESSAGE_SIGNAL_ABORTED_WITHOUT_REASON=ls,Se.Modal=ul,Se.Pagination=bd,Se.Select=cl,Se.SelectColor=Td,Se.SketchColorPicker=Cd,Se.Spinner=pd,Se.SpinnerIcon=Qn,Se.Switch=hd,Se.Textarea=vd,Se.Tooltip=Ro,Se.classNames=se,Se.copyOptions=eo,Se.generateAvatarInitials=ns,Se.groupBy=rs,Se.isPromise=os,Se.rowsPerPage=Ao,Se.useCloseModal=mi,Se.useForm=ss,Se.useMediaQuery=as,Se.useWindowDimensions=hi,Se.validateEmail=pi,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.205",
3
+ "version": "1.0.206",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",