cemtrik-dependencies 1.0.168 → 1.0.169
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.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ Check the top-level render call using <`+X+">.")}return W}}function Rn(S,W){{if(
|
|
|
32
32
|
Copyright (c) 2018 Jed Watson.
|
|
33
33
|
Licensed under the MIT License (MIT), see
|
|
34
34
|
http://jedwatson.github.io/classnames
|
|
35
|
-
*/(function(t){(function(){var l={}.hasOwnProperty;function r(){for(var f="",a=0;a<arguments.length;a++){var m=arguments[a];m&&(f=u(f,n(m)))}return f}function n(f){if(typeof f=="string"||typeof f=="number")return f;if(typeof f!="object")return"";if(Array.isArray(f))return r.apply(null,f);if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]"))return f.toString();var a="";for(var m in f)l.call(f,m)&&f[m]&&(a=u(a,m));return a}function u(f,a){return a?f?f+" "+a:f+a:f}t.exports?(r.default=r,t.exports=r):window.classNames=r})()})(Ql);var Vc=Ql.exports;const pn=os(Vc),ei=({className:t="text-sm w-full rounded-md",children:l,icon:r=null,edge:n=null,disabled:u=!1,type:f="button",onClick:a,id:m})=>{const v=pn({"ml-2":n==="start"&&r!==null,"mr-2":n==="end"&&r!==null});return j.jsxs("button",{className:ae("flex justify-center items-center bg-white px-3 py-7px font-medium leading-6 text-white shadow-sm ring-1 ring-inset ring-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 bg-gray-50",t),type:f,onClick:a,disabled:u,"data-testid":`button-outline-${m}`,id:`button-outline-${m}`,children:[n==="start"&&r!==null&&j.jsx("span",{children:r}),j.jsx("span",{className:ae("flex",v),id:m,children:l}),n==="end"&&r!==null&&j.jsx("span",{children:r})]})},ti=({children:t,className:l="",icon:r=null,edge:n=null,disabled:u=!1,type:f="button",onClick:a,id:m})=>{const v=pn({"ml-2":n==="start"&&r!==null,"mr-2":n==="end"&&r!==null});return j.jsxs("button",{className:`${l} flex justify-center items-center`,edge:n,type:f,onClick:a,disabled:u,"data-testid":`button-${m}`,children:[n==="start"&&r!==null&&j.jsx("span",{children:r}),j.jsx("span",{className:v,children:t}),n==="end"&&r!==null&&j.jsx("span",{children:r})]})},Xn=({children:t,classNameButton:l="bg-indigo-600 hover:bg-indigo-700 focus-visible:outline-indigo-600 shadow-indigo-500 rounded font-semibold px-3 py-1.5 text-white w-full",classNameText:r="",icon:n=null,edge:u=null,disabled:f=!1,type:a="button",onClick:m,id:v,outline:x="0px 0px 0px 2px #6366F1, 0px 0px 0px 2px #FFF, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",classNameContainer:E=""})=>{const[k,R]=b.useState(!1),T=pn({"ml-2":u==="start"&&n!==null,"mr-2":u==="end"&&n!==null}),M=()=>{m&&m()};return j.jsx("div",{className:ae("rounded-md p-0.5",E!==""&&E),style:{boxShadow:k?x:"0px 0px 0px 0px #6366F1, 0px 0px 0px 0px #FFF, 0px 0px 0px 0px rgba(0, 0, 0, 0.05)",transition:"box-shadow .1s ease-in-out"},"data-testid":"container-button",children:j.jsxs("button",{className:ae("flex justify-center items-center text-sm leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",f&&"text-white bg-gray-300 rounded focus:outline-none cursor-default",f?l.replace(/\bbg-\w+\b/g,""):l),type:a,onClick:M,onFocus:()=>R(!0),onBlur:()=>R(!1),disabled:f,"data-testid":`button-solid-${v}`,children:[u==="start"&&n!==null&&j.jsx("span",{className:"flex",children:n}),j.jsx("span",{className:ae(r.length===0&&T,r.length!==0&&r),children:t}),u==="end"&&n!==null&&j.jsx("span",{children:n})]})})},Zc=({label:t=null,checked:l=!1,onChange:r,id:n,className:u="",classNameCheckbox:f="h-4 w-4",style:a={},disabled:m=!1})=>{const[v,x]=b.useState(!1);return b.useEffect(()=>{x(l)},[l]),j.jsxs("div",{className:"flex items-center",style:a,"data-testid":`container-check-${n}`,children:[j.jsx("input",{checked:v,id:`${t}-${n}`,value:n,"aria-describedby":"comments-description",type:"checkbox",onChange:r,className:ae("cursor-pointer rounded border-gray-300 text-indigo-600 focus:ring-indigo-600",f!==""&&f),"data-testid":`checkbox-${n}`,disabled:m}),t!==null?j.jsx("label",{htmlFor:`${t}-${n}`,className:`ml-2.5 font-normal cursor-pointer ${u}`,id:`label-${n}`,"data-testid":"label",children:t}):null]})};function Yc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const Gc=Y.forwardRef(Yc);function qc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Kc=Y.forwardRef(qc);function Xc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Jc=Y.forwardRef(Xc);function Qc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const ed=Y.forwardRef(Qc);function td({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const nd=Y.forwardRef(td);function ni({children:t,className:l="sm:max-w-sm w-11/12 sm:my-8",classNameContainer:r="",isOpen:n=!1,setIsOpen:u,showIconSuccess:f=!0,showButton:a=!0,style:m={}}){return j.jsx(Cn,{show:n,as:b.Fragment,children:j.jsxs(Hl,{as:"div",className:"relative z-50 relative",onClose:u,"data-testid":"modal",children:[j.jsx(Cn.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-5",leave:"ease-in duration-200",leaveFrom:"opacity-5",leaveTo:"opacity-0",children:j.jsx("div",{className:"fixed inset-0 bg-opacity-40 bg-gray-900 transition-opacity","data-testid":"window-close",onClick:()=>u(!1)})}),j.jsx("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:j.jsx("div",{className:"flex min-h-full items-center justify-center xs:p-2 p-4 text-center sm:items-center sm:p-0",children:j.jsx(Cn.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:j.jsxs(Hl.Panel,{className:ae("relative transform rounded-lg bg-white px-4 pb-3 pt-5 text-left transition-all sm:w-full sm:pt-3 sm:px-3",l!==""&&l),style:m,children:[f&&j.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100",children:j.jsx(Gc,{className:"h-6 w-6 text-green-600","aria-hidden":"true"})}),j.jsx("div",{className:ae(r!==""&&r),"data-testid":"content",children:t}),a&&j.jsx("div",{className:"mt-5 sm:mt-6",children:j.jsx(Xn,{id:"close-modal",onClick:()=>u(!1),children:"Cerrar"})}),j.jsx("button",{className:"opacity-0 absolute"})]})})})})]})})}const rd=({isOpenModalConfirmation:t,setIsOpenModalConfirmation:l,close:r,title:n="¿Estás seguro de abandonar la creación de la acción?",description:u="La información se perderá si no creas la acción",classNameTitle:f="",classNameDescription:a=""})=>{const m=()=>{l(!1),r()};return j.jsxs(ni,{isOpen:t,setIsOpen:()=>l(),showButton:!1,showIconSuccess:!1,children:[j.jsx("p",{className:ae("text-center text-sm",f!==""&&f),children:n}),j.jsx("p",{className:ae("text-center text-sm",a!==""&&a),children:u}),j.jsxs("div",{className:"flex w-full justify-center mt-5",children:[j.jsx(ei,{className:"rounded-md bg-white text-gray-500 text-sm shadow-sm ring-1 ring-inset ring-gray-300 bg-gray-50 w-24 h-9 mr-6",onClick:()=>l(),id:"cancel",children:"Cancelar"}),j.jsx(Xn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 focus-visible:outline-secondary-2 shadow-secondary-2 rounded py-1.5 text-white w-full px-5",outline:"0px 0px 0px 2px #3758F9, 0px 0px 0px 2px #243BBD, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",onClick:m,id:"confirmation",children:"Aceptar"})]})]})},od=({className:t="",style:l={}})=>j.jsx("div",{className:ae("w-px",t!==""&&t),style:l}),ld=({onClick:t,id:l="",className:r=""})=>j.jsxs("div",{className:ae("flex items-center text-default-5",r!==""&&r),"data-testid":l,children:[j.jsx(Fc,{className:"w-3 h-3 3xs:w-4 3xs:h-4 stroke-current cursor-pointer","data-testid":"chevron-left-icon",onClick:t}),j.jsx("span",{onClick:t,className:"text-sm cursor-pointer","data-testid":"go-back",children:"Volver"})]});var Io={exports:{}};(function(t,l){(function(r,n){n(l,b,wr)})(rs,function(r,n,u){function f(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(i,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return i.default=e,Object.freeze(i)}const a=f(n),m=(e,i=!1)=>{function o(s){if(typeof s!="object"||s===null)return s;const c=Array.isArray(s)?[]:{};for(const d in s)s.hasOwnProperty(d)&&!i&&(c[d]=o(s[d]));return c}return e.map(s=>o(s))},v=e=>/^(?:[^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*|"[^\n"]+")@(?:[^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,63}$/i.test(e);function x(...e){return e.filter(Boolean).join(" ")}const E=e=>{const i=e.split(" ");let o=e.slice(0,2);return i.length>1&&(o=`${e.at(0)}${i[i.length-1].slice(0,1)}`),o},k=e=>typeof e!="string"&&Promise.resolve(e)instanceof Promise,R="The user aborted a request.",T="signal is aborted without reason",M=({id:e,close:i,isPathsTest:o=!1,isTest:s=!1})=>{const c=n.useCallback(d=>{d.some(p=>p.getAttribute===void 0?!1:p.getAttribute("id")===e)||i()},[i,e]);n.useEffect(()=>{const d=p=>{const h=p.composedPath();h===void 0||o||(s&&(h[0].getAttribute=()=>e),c(h))};return window.addEventListener("click",d),()=>{window.removeEventListener("click",d)}},[c,o,s,e])},$=()=>{const e=n.useRef({}),[i,o]=n.useState({}),[s,c]=n.useState({}),[d,p]=n.useState([]);n.useEffect(()=>{e.current={}},[]);const h=I=>L=>{L.preventDefault(),L.stopPropagation(),I(i)},g=(I,L,N)=>{const{checked:A,value:F,name:D,type:H,id:z}=I.target,K={radio:z,checkbox:A};e.current={...N,...e.current,[D]:K[H]??F},o({...e.current,[D]:K[H]??F}),L({...e.current,[D]:K[H]??F})},w=n.useCallback((I,L)=>{e.current={...e.current,[I]:L},o(N=>({...N,[I]:L}))},[]),O=n.useCallback((I,L)=>{const N=L.filter(A=>I[A]===""||I[A]===void 0);return N.forEach(A=>c(F=>({...F,[A]:"Este campo es requerido"}))),p(N),N.length>0},[]);return{handleSubmit:h,handleChange:g,setValuesDefault:w,validateFields:O,errors:d,model:i,handleError:(I,L)=>{L.forEach(N=>c(A=>({...A,[N]:I}))),p(L)},messageError:s,setModel:o}},P=e=>{const[i,o]=n.useState(!0),[s,c]=n.useState(!1),d=n.useCallback((p,h)=>{const g=e.match(/[0-9]+/g);if(g===null)return;const[w]=g;h=Math.min(window.innerWidth,window.outerWidth);const O=p?h>=Number(w):h<=Number(w);c(O)},[e]);return n.useEffect(()=>{const p=/\(min-width:\s?[0-9]+px\)/gi.test(e),h=/\(max-width:\s?[0-9]+px\)/gi.test(e);if(!p&&!h&&o(!1),!p&&!h)return;const g=Math.min(window.innerWidth,window.outerWidth);d(p,g)},[e,d]),n.useEffect(()=>{if(!i)return;const p=Math.min(window.innerWidth,window.outerWidth);function h(){const g=/min-width/gi.test(e);d(g,p)}return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[i,e,d]),s},_=()=>{const[e,i]=n.useState({width:0,height:0});return n.useEffect(()=>{const o=()=>{const s=Math.min(window.innerWidth,window.outerWidth),c=Math.min(window.innerHeight,window.outerHeight);i({width:s,height:c})};return requestAnimationFrame(()=>o()),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e};function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}},ne={};/**
|
|
35
|
+
*/(function(t){(function(){var l={}.hasOwnProperty;function r(){for(var f="",a=0;a<arguments.length;a++){var m=arguments[a];m&&(f=u(f,n(m)))}return f}function n(f){if(typeof f=="string"||typeof f=="number")return f;if(typeof f!="object")return"";if(Array.isArray(f))return r.apply(null,f);if(f.toString!==Object.prototype.toString&&!f.toString.toString().includes("[native code]"))return f.toString();var a="";for(var m in f)l.call(f,m)&&f[m]&&(a=u(a,m));return a}function u(f,a){return a?f?f+" "+a:f+a:f}t.exports?(r.default=r,t.exports=r):window.classNames=r})()})(Ql);var Vc=Ql.exports;const pn=os(Vc),ei=({className:t="text-sm w-full rounded-md",children:l,icon:r=null,edge:n=null,disabled:u=!1,type:f="button",onClick:a,id:m})=>{const v=pn({"ml-2":n==="start"&&r!==null,"mr-2":n==="end"&&r!==null});return j.jsxs("button",{className:ae("flex justify-center items-center bg-white px-3 py-7px font-medium leading-6 text-white shadow-sm ring-1 ring-inset ring-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 bg-gray-50",t),type:f,onClick:a,disabled:u,"data-testid":`button-outline-${m}`,id:`button-outline-${m}`,children:[n==="start"&&r!==null&&j.jsx("span",{children:r}),j.jsx("span",{className:ae("flex",v),id:m,children:l}),n==="end"&&r!==null&&j.jsx("span",{children:r})]})},ti=({children:t,className:l="",icon:r=null,edge:n=null,disabled:u=!1,type:f="button",onClick:a,id:m})=>{const v=pn({"ml-2":n==="start"&&r!==null,"mr-2":n==="end"&&r!==null});return j.jsxs("button",{className:`${l} flex justify-center items-center`,edge:n,type:f,onClick:a,disabled:u,"data-testid":`button-${m}`,children:[n==="start"&&r!==null&&j.jsx("span",{children:r}),j.jsx("span",{className:v,children:t}),n==="end"&&r!==null&&j.jsx("span",{children:r})]})},Xn=({children:t,classNameButton:l="bg-indigo-600 hover:bg-indigo-700 focus-visible:outline-indigo-600 shadow-indigo-500 rounded font-semibold px-3 py-1.5 text-white w-full",classNameText:r="",icon:n=null,edge:u=null,disabled:f=!1,type:a="button",onClick:m,id:v,outline:x="0px 0px 0px 2px #6366F1, 0px 0px 0px 2px #FFF, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",classNameContainer:E=""})=>{const[k,R]=b.useState(!1),T=pn({"ml-2":u==="start"&&n!==null,"mr-2":u==="end"&&n!==null}),M=()=>{m&&m()};return j.jsx("div",{className:ae("rounded-md p-0.5",E!==""&&E),style:{boxShadow:k?x:"0px 0px 0px 0px #6366F1, 0px 0px 0px 0px #FFF, 0px 0px 0px 0px rgba(0, 0, 0, 0.05)",transition:"box-shadow .1s ease-in-out"},"data-testid":"container-button",children:j.jsxs("button",{className:ae("flex justify-center items-center text-sm leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",f&&"text-white bg-gray-300 rounded focus:outline-none cursor-default",f?l.replace(/\bbg-\w+\b/g,""):l),type:a,onClick:M,onFocus:()=>R(!0),onBlur:()=>R(!1),disabled:f,"data-testid":`button-solid-${v}`,children:[u==="start"&&n!==null&&j.jsx("span",{className:"flex",children:n}),j.jsx("span",{className:ae(r.length===0&&T,r.length!==0&&r),children:t}),u==="end"&&n!==null&&j.jsx("span",{children:n})]})})},Zc=({label:t=null,checked:l=!1,onChange:r,id:n,className:u="",classNameCheckbox:f="h-4 w-4",style:a={},disabled:m=!1})=>{const[v,x]=b.useState(!1);return b.useEffect(()=>{x(l)},[l]),j.jsxs("div",{className:"flex items-center",style:a,"data-testid":`container-check-${n}`,children:[j.jsx("input",{checked:v,id:`${t}-${n}`,value:n,"aria-describedby":"comments-description",type:"checkbox",onChange:r,className:ae("cursor-pointer rounded border-gray-300 text-indigo-600 focus:ring-indigo-600",f!==""&&f),"data-testid":`checkbox-${n}`,disabled:m}),t!==null?j.jsx("label",{htmlFor:`${t}-${n}`,className:`ml-2.5 font-normal cursor-pointer ${u}`,id:`label-${n}`,"data-testid":"label",children:t}):null]})};function Yc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const Gc=Y.forwardRef(Yc);function qc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Kc=Y.forwardRef(qc);function Xc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Jc=Y.forwardRef(Xc);function Qc({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const ed=Y.forwardRef(Qc);function td({title:t,titleId:l,...r},n){return Y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":l},r),t?Y.createElement("title",{id:l},t):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const nd=Y.forwardRef(td);function ni({children:t,className:l="sm:max-w-sm w-11/12 sm:my-8",classNameContainer:r="",isOpen:n=!1,setIsOpen:u,showIconSuccess:f=!0,showButton:a=!0,style:m={}}){return j.jsx(Cn,{show:n,as:b.Fragment,children:j.jsxs(Hl,{as:"div",className:"z-50 relative",onClose:u,"data-testid":"modal",children:[j.jsx(Cn.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-5",leave:"ease-in duration-200",leaveFrom:"opacity-5",leaveTo:"opacity-0",children:j.jsx("div",{className:"fixed inset-0 bg-opacity-40 bg-gray-900 transition-opacity","data-testid":"window-close",onClick:()=>u(!1)})}),j.jsx("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:j.jsx("div",{className:"flex min-h-full items-center justify-center xs:p-2 p-4 text-center sm:items-center sm:p-0",children:j.jsx(Cn.Child,{as:b.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:j.jsxs(Hl.Panel,{className:ae("relative transform rounded-lg bg-white px-4 pb-3 pt-5 text-left transition-all sm:w-full sm:pt-3 sm:px-3",l!==""&&l),style:m,children:[f&&j.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100",children:j.jsx(Gc,{className:"h-6 w-6 text-green-600","aria-hidden":"true"})}),j.jsx("div",{className:ae(r!==""&&r),"data-testid":"content",children:t}),a&&j.jsx("div",{className:"mt-5 sm:mt-6",children:j.jsx(Xn,{id:"close-modal",onClick:()=>u(!1),children:"Cerrar"})}),j.jsx("button",{className:"opacity-0 absolute"})]})})})})]})})}const rd=({isOpenModalConfirmation:t,setIsOpenModalConfirmation:l,close:r,title:n="¿Estás seguro de abandonar la creación de la acción?",description:u="La información se perderá si no creas la acción",classNameTitle:f="",classNameDescription:a=""})=>{const m=()=>{l(!1),r()};return j.jsxs(ni,{isOpen:t,setIsOpen:()=>l(),showButton:!1,showIconSuccess:!1,children:[j.jsx("p",{className:ae("text-center text-sm",f!==""&&f),children:n}),j.jsx("p",{className:ae("text-center text-sm",a!==""&&a),children:u}),j.jsxs("div",{className:"flex w-full justify-center mt-5",children:[j.jsx(ei,{className:"rounded-md bg-white text-gray-500 text-sm shadow-sm ring-1 ring-inset ring-gray-300 bg-gray-50 w-24 h-9 mr-6",onClick:()=>l(),id:"cancel",children:"Cancelar"}),j.jsx(Xn,{classNameButton:"bg-secondary-2 hover:bg-secondary-3 focus-visible:outline-secondary-2 shadow-secondary-2 rounded py-1.5 text-white w-full px-5",outline:"0px 0px 0px 2px #3758F9, 0px 0px 0px 2px #243BBD, 0px 1px 2px 0px rgba(0, 0, 0, 0.05)",onClick:m,id:"confirmation",children:"Aceptar"})]})]})},od=({className:t="",style:l={}})=>j.jsx("div",{className:ae("w-px",t!==""&&t),style:l}),ld=({onClick:t,id:l="",className:r=""})=>j.jsxs("div",{className:ae("flex items-center text-default-5",r!==""&&r),"data-testid":l,children:[j.jsx(Fc,{className:"w-3 h-3 3xs:w-4 3xs:h-4 stroke-current cursor-pointer","data-testid":"chevron-left-icon",onClick:t}),j.jsx("span",{onClick:t,className:"text-sm cursor-pointer","data-testid":"go-back",children:"Volver"})]});var Io={exports:{}};(function(t,l){(function(r,n){n(l,b,wr)})(rs,function(r,n,u){function f(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(i,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return i.default=e,Object.freeze(i)}const a=f(n),m=(e,i=!1)=>{function o(s){if(typeof s!="object"||s===null)return s;const c=Array.isArray(s)?[]:{};for(const d in s)s.hasOwnProperty(d)&&!i&&(c[d]=o(s[d]));return c}return e.map(s=>o(s))},v=e=>/^(?:[^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*|"[^\n"]+")@(?:[^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,63}$/i.test(e);function x(...e){return e.filter(Boolean).join(" ")}const E=e=>{const i=e.split(" ");let o=e.slice(0,2);return i.length>1&&(o=`${e.at(0)}${i[i.length-1].slice(0,1)}`),o},k=e=>typeof e!="string"&&Promise.resolve(e)instanceof Promise,R="The user aborted a request.",T="signal is aborted without reason",M=({id:e,close:i,isPathsTest:o=!1,isTest:s=!1})=>{const c=n.useCallback(d=>{d.some(p=>p.getAttribute===void 0?!1:p.getAttribute("id")===e)||i()},[i,e]);n.useEffect(()=>{const d=p=>{const h=p.composedPath();h===void 0||o||(s&&(h[0].getAttribute=()=>e),c(h))};return window.addEventListener("click",d),()=>{window.removeEventListener("click",d)}},[c,o,s,e])},$=()=>{const e=n.useRef({}),[i,o]=n.useState({}),[s,c]=n.useState({}),[d,p]=n.useState([]);n.useEffect(()=>{e.current={}},[]);const h=I=>L=>{L.preventDefault(),L.stopPropagation(),I(i)},g=(I,L,N)=>{const{checked:A,value:F,name:D,type:H,id:z}=I.target,K={radio:z,checkbox:A};e.current={...N,...e.current,[D]:K[H]??F},o({...e.current,[D]:K[H]??F}),L({...e.current,[D]:K[H]??F})},w=n.useCallback((I,L)=>{e.current={...e.current,[I]:L},o(N=>({...N,[I]:L}))},[]),O=n.useCallback((I,L)=>{const N=L.filter(A=>I[A]===""||I[A]===void 0);return N.forEach(A=>c(F=>({...F,[A]:"Este campo es requerido"}))),p(N),N.length>0},[]);return{handleSubmit:h,handleChange:g,setValuesDefault:w,validateFields:O,errors:d,model:i,handleError:(I,L)=>{L.forEach(N=>c(A=>({...A,[N]:I}))),p(L)},messageError:s,setModel:o}},P=e=>{const[i,o]=n.useState(!0),[s,c]=n.useState(!1),d=n.useCallback((p,h)=>{const g=e.match(/[0-9]+/g);if(g===null)return;const[w]=g;h=Math.min(window.innerWidth,window.outerWidth);const O=p?h>=Number(w):h<=Number(w);c(O)},[e]);return n.useEffect(()=>{const p=/\(min-width:\s?[0-9]+px\)/gi.test(e),h=/\(max-width:\s?[0-9]+px\)/gi.test(e);if(!p&&!h&&o(!1),!p&&!h)return;const g=Math.min(window.innerWidth,window.outerWidth);d(p,g)},[e,d]),n.useEffect(()=>{if(!i)return;const p=Math.min(window.innerWidth,window.outerWidth);function h(){const g=/min-width/gi.test(e);d(g,p)}return window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[i,e,d]),s},_=()=>{const[e,i]=n.useState({width:0,height:0});return n.useEffect(()=>{const o=()=>{const s=Math.min(window.innerWidth,window.outerWidth),c=Math.min(window.innerHeight,window.outerHeight);i({width:s,height:c})};return requestAnimationFrame(()=>o()),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e};function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}},ne={};/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.production.min.js
|
|
38
38
|
*
|
|
@@ -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(!B&&"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(!B&&"py-1",q&&Q===0&&"sticky top-0"),children:B?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 _=1;_<=R;_++)P.push(_);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,_,E.length];else if(a===4)P=[...E.slice(0,5),_,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,B,...ne,...oe,q,E.length]}else if(a>E.length-3){const ne=E.slice(E.length-4);P=[1,B,...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,_)=>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-${_+1}`,children:P},_))}),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})=>{const x=E=>{const{files:k}=E.target,[R]=k,T=new FileReader;T.readAsDataURL(R),T.onload=function(){t(M=>({...M,photo:T.result})),l("photo",T.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:"Logo (Opcional)"}),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:f,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:E=>E.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:"Upload a file"})}),j.jsx("p",{className:"pl-1",children:"or drag and drop"})]}),j.jsx("p",{className:"text-xs leading-5 text-gray-600",children:"PNG, JPG, GIF up to 10MB"})]}),j.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:x})]})]})},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:_=null,loading:B=!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;!(_===null?!1:_({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}`}),B&&j.jsx("div",{className:"flex justify-center mt-5",children:j.jsx(Jn,{})}),ne&&ft()&&Ne&&!B&&(q?!_e:!$)&&j.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!B&&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:$)&&!B&&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(!B&&"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(!B&&"py-1",q&&Q===0&&"sticky top-0"),children:B?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 _=1;_<=R;_++)P.push(_);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,_,E.length];else if(a===4)P=[...E.slice(0,5),_,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,B,...ne,...oe,q,E.length]}else if(a>E.length-3){const ne=E.slice(E.length-4);P=[1,B,...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,_)=>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-${_+1}`,children:P},_))}),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)"})=>{const E=k=>{const{files:R}=k.target,[T]=R,M=new FileReader;M.readAsDataURL(T),M.onload=function(){t($=>({...$,photo:M.result})),l("photo",M.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:f,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:k=>k.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:"Upload a file"})}),j.jsx("p",{className:"pl-1",children:"or drag and drop"})]}),j.jsx("p",{className:"text-xs leading-5 text-gray-600",children:"PNG, JPG, GIF up to 10MB"})]}),j.jsx("input",{id:"file-upload",name:"file-upload",type:"file",className:"absolute w-full h-full opacity-0 cursor-pointer",onChange:E})]})]})},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:_=null,loading:B=!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;!(_===null?!1:_({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}`}),B&&j.jsx("div",{className:"flex justify-center mt-5",children:j.jsx(Jn,{})}),ne&&ft()&&Ne&&!B&&(q?!_e:!$)&&j.jsx("p",{className:"text-gray-800 text-center","data-testid":"records-empty",children:"No hay registros para mostrar"}),!B&&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:$)&&!B&&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"})});
|