cemtrik-dependencies 1.0.113 → 1.0.114
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 +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ Check the top-level render call using <`+O+">.")}return S}}function xr(d,S){{if(
|
|
|
36
36
|
.bg-opacity-35 {
|
|
37
37
|
opacity: .35;
|
|
38
38
|
}
|
|
39
|
-
`}),f.jsx(Re,{show:o,as:u.Fragment,id:a,children:f.jsxs(Yn,{as:"div",className:"relative z-50 relative",onClose:l,"data-testid":"modal",children:[f.jsx(Re.Child,{as:u.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:f.jsx("div",{className:"fixed inset-0 bg-opacity-35 bg-gray-900 transition-opacity","data-testid":"window-close",onClick:()=>l(!1)})}),f.jsx("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:f.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:f.jsx(Re.Child,{as:u.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:f.jsxs(Yn.Panel,{className:k("relative transform rounded-lg bg-white px-4 pb-3 pt-5 text-left shadow-xl transition-all sm:w-full sm:pt-3 sm:px-3",n!==""&&n),style:t,children:[i&&f.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100",children:f.jsx(Ss,{className:"h-6 w-6 text-green-600","aria-hidden":"true"})}),f.jsx("div",{className:k(r!==""&&r),"data-testid":"content",children:e}),s&&f.jsx("div",{className:"mt-5 sm:mt-6",children:f.jsx(lt,{id:"close-modal",onClick:()=>l(!1),children:"Cerrar"})}),f.jsx("button",{className:"opacity-0 absolute"})]})})})})]})})]})}const $s=({isOpenModalConfirmation:e,setIsOpenModalConfirmation:n,close:t,title:r="¿Estás seguro de abandonar la creación de la acción?",description:o="La información se perderá si no creas la acción",classNameTitle:l="",classNameDescription:i=""})=>{const s=()=>{n(!1),t()};return f.jsxs(ir,{isOpen:e,setIsOpen:()=>n(),showButton:!1,showIconSuccess:!1,children:[f.jsx("p",{className:k("text-center text-sm",l!==""&&l),children:r}),f.jsx("p",{className:k("text-center text-sm",i!==""&&i),children:o}),f.jsxs("div",{className:"flex w-full justify-center mt-5",children:[f.jsx(or,{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:()=>n(),id:"cancel",children:"Cancelar"}),f.jsx(lt,{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:s,id:"confirmation",children:"Aceptar"})]})]})},Ps=({className:e="",style:n={}})=>f.jsx("div",{className:k("w-px",e!==""&&e),style:n}),Ms=({onClick:e,id:n="",className:t=""})=>f.jsxs("div",{className:k("flex items-center text-default-5",t!==""&&t),"data-testid":n,children:[f.jsx(ss,{className:"w-3 h-3 3xs:w-4 3xs:h-4 stroke-current cursor-pointer","data-testid":"chevron-left-icon",onClick:e}),f.jsx("span",{onClick:e,className:"text-sm cursor-pointer","data-testid":"go-back",children:"Volver"})]}),rn=({placeholder:e="",label:n="",htmlFor:t,type:r="text",name:o,handleChange:l,onClick:i=()=>{},value:s,isReadOnly:a=!1,isError:c=!1,helperText:m="",autocomplete:h="off",id:x,classNameLabel:p="",classNameContainerInput:v="",classNameContainer:g="",className:b="",icon:y=null,onKeyDown:w,onFocus:C,min:F,max:P})=>{const[A,G]=u.useState(!1),L=Me({"ring-red-300 focus:ring-red-300 text-red-900":c||A,"focus:ring-indigo-600 text-gray-500":!c&&!A}),B=_=>{if(l&&l(_),r!=="email")return;const{value:W}=_.target,J=dn(W);G(!J)};return f.jsxs("div",{"data-testid":`container-input-${x}`,className:g,children:[n!==""&&f.jsx("label",{htmlFor:t,className:k("block text-sm font-medium leading-6",p!==""?p:"text-gray-700"),"data-testid":`label-${x}`,children:n}),f.jsxs("div",{className:k("relative mt-1 rounded-md",v!==""&&v),children:[f.jsx("input",{id:x,name:o,type:r,autoComplete:h,placeholder:e,onChange:B,onClick:i,onKeyDown:w,onFocus:C,value:s,readOnly:a,"data-testid":`input-${x}`,min:F,className:k("block w-full rounded-md border-0 py-1.5 shadow-sm placeholder-gray-300 ring-1 ring-gray-300 ring-inset focus:ring-1 focus:ring-inset text-sm sm:leading-6",L,b!==""&&b)}),y!==null&&f.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:y}),c&&y===null&&f.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:f.jsx(tr,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),m.length===0||!c?null:f.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${x}`,children:m})]})};function it({className:e="w-6 h-6",color:n="#3730a3"}){return f.jsxs("svg",{className:k("fill-current animate-spin",e),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:n,strokeWidth:"4",fill:"none"}),f.jsx("path",{fill:n,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function As(){return f.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-full h-screen overflow-hidden bg-stone-600 opacity-75 flex flex-col items-center justify-center","data-testid":"spinner",style:{zIndex:60},children:[f.jsx("div",{className:"inline-block h-12 w-12 animate-[spinner-grow_0.75s_linear_infinite] rounded-full bg-current align-[-0.125em] opacity-0 motion-reduce:animate-[spinner-grow_1.5s_linear_infinite]",role:"status"}),f.jsx(it,{className:"w-8 h-8 animate-spin"})]})}const sr=({className:e="",classNameContainer:n="",children:t,message:r=""})=>{const[o,l]=u.useState(!1),i=()=>{r!==""&&l(!0)},s=()=>{l(!1)};return f.jsx("div",{className:"relative",children:f.jsxs("div",{onMouseLeave:s.bind(null,o),"data-testid":"container-tooltip",children:[f.jsx("div",{className:k("text-white group bg-orange-700 rounded-md inline-flex items-center text-base font-medium hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75",!o&&"text-opacity-90",n!==""&&n),onMouseEnter:i.bind(null,o),onMouseLeave:s.bind(null,o),"data-testid":"open-tooltip",children:t}),f.jsx(Re,{as:u.Fragment,enter:"transition ease-out duration-200",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-100 translate-y-0",leave:"transition ease-in duration-150",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-1",show:o,children:f.jsx("div",{className:k("absolute z-20 px-4 mt-0 sm:px-0",e!==""&&e),children:f.jsx("div",{className:"bg-white p-2 text-center rounded-lg shadow-lg ring-1 ring-black ring-opacity-5",onMouseEnter:i.bind(null,o),onMouseLeave:s.bind(null,o),"data-testid":"message",children:r})})})]})})},ar=({height:e="36px",style:n={},styleMenu:t={},label:r="",onChange:o,isReadOnly:l=!1,isError:i=!1,helperText:s="",name:a,id:c,className:m="",classNameLabel:h="",classNameInput:x="",options:p,value:v=-1,defaultValue:g={value:-1,label:"",iconStart:null,iconEnd:null},defaultLabel:b="label",defaultId:y="value",bgOptionSelect:w="bg-indigo-600",isSearch:C=!1,loading:F=!1,isTest:P=!1})=>{const[A,G]=u.useState(""),[L,B]=u.useState(g),[_,W]=u.useState(!1),[J,ne]=u.useState(!0);u.useEffect(()=>{if((p==null?void 0:p.length)!==1||!J)return;ne(!1);const[N]=p,I=N[y],H=N[b];B({value:I,label:H}),o({target:{value:N,checked:!1,name:a,type:void 0,id:N[y]}})},[p,y,b,o,a,J]),u.useEffect(()=>{if(v===-1||(p==null?void 0:p.length)===0)return;const N=p==null?void 0:p.find(I=>I[y]===v);N&&B(N)},[v,p,y]),u.useEffect(()=>{v==="clear"&&(L.value!==g.value||L.label!==g.label||P)&&B(g)},[g,P,L,v]);const ie=A===""?p:p.filter(N=>N[b].normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().includes(A.toLowerCase())),T=Me({"ring-red-300 focus:ring-red-300 text-red-900":i&&!l,"text-gray-500":!i,"focus:ring-indigo-600":!i&&!l}),te=Me({"text-red-400":i&&!l,"text-gray-400":!i}),$=N=>{B(N),o({target:{value:N,checked:!1,name:a,type:void 0,id:N[y]}})};return f.jsxs(Ne,{as:"div",value:L,onChange:$,children:[f.jsx(Ne.Label,{className:k("block text-sm font-medium leading-6 text-gray-500 mb-0.5",h!==""&&h),children:r}),f.jsxs("div",{className:k("relative",m!==""&&m),children:[f.jsx(sr,{className:"text-sm",classNameContainer:"w-full",message:L[b],children:f.jsxs(Ne.Button,{className:"w-full","data-testid":`listbox-button-${c}`,children:[L.iconStart&&f.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-2",children:L.iconStart}),f.jsx(Ne.Input,{className:k("w-full rounded-md border-0 bg-white py-1.5 pr-10 text-gray-900 shadow-sm ring-1 ring-gray-300 sm:text-sm sm:leading-6 truncate block",!i&&!l&&"ring-inset focus:ring-inset focus:ring-2 focus:ring-indigo-600",l&&"focus:ring-gray-300",T,x!==""&&x),onChange:N=>G(N.target.value.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),displayValue:N=>{var I;return(I=N[b])==null?void 0:I.trim()},autoComplete:"off",readOnly:!C||l,style:{height:e,...n},"data-testid":"input-search",onClick:()=>W(l?!1:!_),onBlur:()=>W(!1)})]})}),L.iconEnd&&f.jsx("span",{className:"absolute inset-y-0 right-4 flex items-center pr-4",children:L.iconEnd}),!l&&f.jsx(Ne.Button,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none",onClick:()=>W(l?!1:!_),"data-testid":"arrow-button",children:_?f.jsx(Ji,{className:k("h-5 w-5",te),"aria-hidden":"true"}):f.jsx(Zi,{className:k("h-5 w-5",te),"aria-hidden":"true"})}),!l&&f.jsx(f.Fragment,{children:F?f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none flex justify-center items-center py-2",children:f.jsx(it,{})}):(ie??[]).length>0?f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm py-0.5 overflow-x-hidden",style:t,children:ie.map((N,I)=>f.jsx(Ne.Option,{value:N,className:k(N[y]===L[y]?`${w} text-white`:"text-gray-900",`relative cursor-default select-none p-2 hover:text-white hover:${w}`),"data-testid":`select-${c}-${N[y]}`,children:f.jsxs("div",{className:"flex justify-between items-center",children:[f.jsxs("div",{className:"flex items-center",children:[N.iconStart&&f.jsx("span",{className:"mr-2","aria-hidden":"true",children:N.iconStart}),f.jsx("span",{className:"font-normal hyphens-auto break-words overflow-hidden",children:N[b]})]}),N.iconEnd&&f.jsx("span",{className:"ml-2","aria-hidden":"true",children:N.iconEnd})]})},I))}):f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm py-0.5 overflow-x-hidden flex justify-center items-center py-2",children:f.jsx("p",{"data-testid":"empty-options",children:"Sin opciones"})})})]}),s.length>0&&i&&f.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${c}`,children:s})]})},Ds=({placeholder:e="",label:n="",htmlFor:t,name:r,handleChange:o,onClick:l=()=>{},value:i,valueSelect:s,isReadOnly:a=!1,isError:c=!1,helperText:m="",autocomplete:h="on",id:x,classNameLabel:p="",classNameContainer:v="",className:g="",onKeyDown:b,options:y,idSelect:w,isMarginLeft:C=!0,classNameSelect:F="w-20",type:P="text"})=>{const{width:A}=Ot(),G=Me({"ring-red-300 focus:ring-red-300 text-red-900":c,"focus:ring-indigo-600 text-gray-500":!c});return f.jsxs(f.Fragment,{children:[f.jsx("style",{children:`
|
|
39
|
+
`}),f.jsx(Re,{show:o,as:u.Fragment,id:a,children:f.jsxs(Yn,{as:"div",className:"relative z-50 relative",onClose:l,"data-testid":"modal",children:[f.jsx(Re.Child,{as:u.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:f.jsx("div",{className:"fixed inset-0 bg-opacity-35 bg-gray-900 transition-opacity","data-testid":"window-close",onClick:()=>l(!1)})}),f.jsx("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:f.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:f.jsx(Re.Child,{as:u.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:f.jsxs(Yn.Panel,{className:k("relative transform rounded-lg bg-white px-4 pb-3 pt-5 text-left shadow-xl transition-all sm:w-full sm:pt-3 sm:px-3",n!==""&&n),style:t,children:[i&&f.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100",children:f.jsx(Ss,{className:"h-6 w-6 text-green-600","aria-hidden":"true"})}),f.jsx("div",{className:k(r!==""&&r),"data-testid":"content",children:e}),s&&f.jsx("div",{className:"mt-5 sm:mt-6",children:f.jsx(lt,{id:"close-modal",onClick:()=>l(!1),children:"Cerrar"})}),f.jsx("button",{className:"opacity-0 absolute"})]})})})})]})})]})}const $s=({isOpenModalConfirmation:e,setIsOpenModalConfirmation:n,close:t,title:r="¿Estás seguro de abandonar la creación de la acción?",description:o="La información se perderá si no creas la acción",classNameTitle:l="",classNameDescription:i=""})=>{const s=()=>{n(!1),t()};return f.jsxs(ir,{isOpen:e,setIsOpen:()=>n(),showButton:!1,showIconSuccess:!1,children:[f.jsx("p",{className:k("text-center text-sm",l!==""&&l),children:r}),f.jsx("p",{className:k("text-center text-sm",i!==""&&i),children:o}),f.jsxs("div",{className:"flex w-full justify-center mt-5",children:[f.jsx(or,{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:()=>n(),id:"cancel",children:"Cancelar"}),f.jsx(lt,{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:s,id:"confirmation",children:"Aceptar"})]})]})},Ps=({className:e="",style:n={}})=>f.jsx("div",{className:k("w-px",e!==""&&e),style:n}),Ms=({onClick:e,id:n="",className:t=""})=>f.jsxs("div",{className:k("flex items-center text-default-5",t!==""&&t),"data-testid":n,children:[f.jsx(ss,{className:"w-3 h-3 3xs:w-4 3xs:h-4 stroke-current cursor-pointer","data-testid":"chevron-left-icon",onClick:e}),f.jsx("span",{onClick:e,className:"text-sm cursor-pointer","data-testid":"go-back",children:"Volver"})]}),rn=({placeholder:e="",label:n="",htmlFor:t,type:r="text",name:o,handleChange:l,onClick:i=()=>{},value:s,isReadOnly:a=!1,isError:c=!1,helperText:m="",autocomplete:h="off",id:x,classNameLabel:p="",classNameContainerInput:v="",classNameContainer:g="",className:b="",icon:y=null,onKeyDown:w,onFocus:C,min:F,max:P})=>{const[A,G]=u.useState(!1),L=Me({"ring-red-300 focus:ring-red-300 text-red-900":c||A,"focus:ring-indigo-600 text-gray-500":!c&&!A}),B=_=>{if(l&&l(_),r!=="email")return;const{value:W}=_.target,J=dn(W);G(!J)};return f.jsxs("div",{"data-testid":`container-input-${x}`,className:g,children:[n!==""&&f.jsx("label",{htmlFor:t,className:k("block text-sm font-medium leading-6",p!==""?p:"text-gray-700"),"data-testid":`label-${x}`,children:n}),f.jsxs("div",{className:k("relative mt-1 rounded-md",v!==""&&v),children:[f.jsx("input",{id:x,name:o,type:r,autoComplete:h,placeholder:e,onChange:B,onClick:i,onKeyDown:w,onFocus:C,value:s,readOnly:a,"data-testid":`input-${x}`,min:F,className:k("block w-full rounded-md border-0 py-1.5 shadow-sm placeholder-gray-300 ring-1 ring-gray-300 ring-inset focus:ring-1 focus:ring-inset text-sm sm:leading-6",L,b!==""&&b)}),y!==null&&f.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:y}),c&&y===null&&f.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:f.jsx(tr,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})})]}),m.length===0||!c?null:f.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${x}`,children:m})]})};function it({className:e="w-6 h-6",color:n="#3730a3"}){return f.jsxs("svg",{className:k("fill-current animate-spin",e),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[f.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:n,strokeWidth:"4",fill:"none"}),f.jsx("path",{fill:n,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function As(){return f.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-full h-screen overflow-hidden bg-stone-600 opacity-75 flex flex-col items-center justify-center","data-testid":"spinner",style:{zIndex:60},children:[f.jsx("div",{className:"inline-block h-12 w-12 animate-[spinner-grow_0.75s_linear_infinite] rounded-full bg-current align-[-0.125em] opacity-0 motion-reduce:animate-[spinner-grow_1.5s_linear_infinite]",role:"status"}),f.jsx(it,{className:"w-8 h-8 animate-spin"})]})}const sr=({className:e="",classNameContainer:n="",children:t,message:r=""})=>{const[o,l]=u.useState(!1),i=()=>{r!==""&&l(!0)},s=()=>{l(!1)};return f.jsx("div",{className:"relative",children:f.jsxs("div",{onMouseLeave:s.bind(null,o),"data-testid":"container-tooltip",children:[f.jsx("div",{className:k("text-white group bg-orange-700 rounded-md inline-flex items-center text-base font-medium hover:text-opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75",!o&&"text-opacity-90",n!==""&&n),onMouseEnter:i.bind(null,o),onMouseLeave:s.bind(null,o),"data-testid":"open-tooltip",children:t}),f.jsx(Re,{as:u.Fragment,enter:"transition ease-out duration-200",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-100 translate-y-0",leave:"transition ease-in duration-150",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-1",show:o,children:f.jsx("div",{className:k("absolute z-20 px-4 mt-0 sm:px-0",e!==""&&e),children:f.jsx("div",{className:"bg-white p-2 text-center rounded-lg shadow-lg ring-1 ring-black ring-opacity-5",onMouseEnter:i.bind(null,o),onMouseLeave:s.bind(null,o),"data-testid":"message",children:r})})})]})})},ar=({height:e="36px",style:n={},styleMenu:t={},label:r="",onChange:o,isReadOnly:l=!1,isError:i=!1,helperText:s="",name:a,id:c,className:m="",classNameLabel:h="",classNameInput:x="",options:p,value:v=-1,defaultValue:g={value:-1,label:"",iconStart:null,iconEnd:null},defaultLabel:b="label",defaultId:y="value",bgOptionSelect:w="bg-indigo-600",isSearch:C=!1,loading:F=!1,isTest:P=!1})=>{const[A,G]=u.useState(""),[L,B]=u.useState(g),[_,W]=u.useState(!1),[J,ne]=u.useState(!0);u.useEffect(()=>{if((p==null?void 0:p.length)!==1||!J)return;ne(!1);const[N]=p,I=N[y],H=N[b];B({value:I,label:H}),o({target:{value:N,checked:!1,name:a,type:void 0,id:N[y]}})},[p,y,b,o,a,J]),u.useEffect(()=>{if(v===-1||(p==null?void 0:p.length)===0)return;const N=p==null?void 0:p.find(I=>I[y]===v);N&&B(N)},[v,p,y]),u.useEffect(()=>{v==="clear"&&(L.value!==g.value||L.label!==g.label||P)&&B(g)},[g,P,L,v]);const ie=A===""?p:p.filter(N=>N[b].normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().includes(A.toLowerCase())),T=Me({"ring-red-300 focus:ring-red-300 text-red-900":i&&!l,"text-gray-500":!i,"focus:ring-indigo-600":!i&&!l}),te=Me({"text-red-400":i&&!l,"text-gray-400":!i}),$=N=>{B(N),o({target:{value:N,checked:!1,name:a,type:void 0,id:N[y]}})};return f.jsxs(Ne,{as:"div",value:L,children:[f.jsx(Ne.Label,{className:k("block text-sm font-medium leading-6 text-gray-500 mb-0.5",h!==""&&h),children:r}),f.jsxs("div",{className:k("relative",m!==""&&m),children:[f.jsx(sr,{className:"text-sm",classNameContainer:"w-full",message:L[b],children:f.jsxs(Ne.Button,{className:"w-full","data-testid":`listbox-button-${c}`,children:[L.iconStart&&f.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-2",children:L.iconStart}),f.jsx(Ne.Input,{className:k("w-full rounded-md border-0 bg-white py-1.5 pr-10 text-gray-900 shadow-sm ring-1 ring-gray-300 sm:text-sm sm:leading-6 truncate block",!i&&!l&&"ring-inset focus:ring-inset focus:ring-2 focus:ring-indigo-600",l&&"focus:ring-gray-300",T,x!==""&&x),onChange:N=>G(N.target.value.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),displayValue:N=>{var I;return(I=N[b])==null?void 0:I.trim()},autoComplete:"off",readOnly:!C||l,style:{height:e,...n},"data-testid":"input-search",onClick:()=>W(l?!1:!_),onBlur:()=>W(!1)})]})}),L.iconEnd&&f.jsx("span",{className:"absolute inset-y-0 right-4 flex items-center pr-4",children:L.iconEnd}),!l&&f.jsx(Ne.Button,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none",onClick:()=>W(l?!1:!_),"data-testid":"arrow-button",children:_?f.jsx(Ji,{className:k("h-5 w-5",te),"aria-hidden":"true"}):f.jsx(Zi,{className:k("h-5 w-5",te),"aria-hidden":"true"})}),!l&&f.jsx(f.Fragment,{children:F?f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none flex justify-center items-center py-2",children:f.jsx(it,{})}):(ie??[]).length>0?f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm py-0.5 overflow-x-hidden",style:t,children:ie.map((N,I)=>f.jsx(Ne.Option,{value:N,className:k(N[y]===L[y]?`${w} text-white`:"text-gray-900",`relative cursor-default select-none p-2 hover:text-white hover:${w}`),"data-testid":`select-${c}-${N[y]}`,onClick:()=>$(N),children:f.jsxs("div",{className:"flex justify-between items-center",children:[f.jsxs("div",{className:"flex items-center",children:[N.iconStart&&f.jsx("span",{className:"mr-2","aria-hidden":"true",children:N.iconStart}),f.jsx("span",{className:"font-normal hyphens-auto break-words overflow-hidden",children:N[b]})]}),N.iconEnd&&f.jsx("span",{className:"ml-2","aria-hidden":"true",children:N.iconEnd})]})},I))}):f.jsx(Ne.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-white text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm py-0.5 overflow-x-hidden flex justify-center items-center py-2",children:f.jsx("p",{"data-testid":"empty-options",children:"Sin opciones"})})})]}),s.length>0&&i&&f.jsx("p",{className:"text-red-600 text-sm text-left mt-1","data-testid":`helperText-${c}`,children:s})]})},Ds=({placeholder:e="",label:n="",htmlFor:t,name:r,handleChange:o,onClick:l=()=>{},value:i,valueSelect:s,isReadOnly:a=!1,isError:c=!1,helperText:m="",autocomplete:h="on",id:x,classNameLabel:p="",classNameContainer:v="",className:g="",onKeyDown:b,options:y,idSelect:w,isMarginLeft:C=!0,classNameSelect:F="w-20",type:P="text"})=>{const{width:A}=Ot(),G=Me({"ring-red-300 focus:ring-red-300 text-red-900":c,"focus:ring-indigo-600 text-gray-500":!c});return f.jsxs(f.Fragment,{children:[f.jsx("style",{children:`
|
|
40
40
|
input[type="number"]::-webkit-inner-spin-button,
|
|
41
41
|
input[type="number"]::-webkit-outer-spin-button {
|
|
42
42
|
-webkit-appearance: none;
|