polpo 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3577 @@
1
1
  "use client";
2
- import{createContext as hr,useCallback as gr,useContext as br,useMemo as yr,useState as vr}from"react";import{useMemo as Dt}from"react";var h=e=>Dt(()=>Object.entries(e).reduce((o,[t,r])=>r?[...o,t]:o,[]).join(" "),[e]);import{useEffect as zt,useLayoutEffect as Ht,useRef as Bt}from"react";function O(e,o,t,r){let a=Bt(o);zt(()=>{a.current=o},[o]),Ht(()=>{let n=t?.current??window;if(!(n&&n.addEventListener))return;let i=s=>a.current(s);return n.addEventListener(e,i,r),()=>{n.removeEventListener(e,i,r)}},[e,t,r])}var $t=(e,o)=>e.current&&!e.current.contains(o),qe=(e,o)=>{O("keydown",t=>{t.key==="Escape"&&o()}),O("mousedown",t=>{let r=t.target;if(!r?.isConnected)return;(Array.isArray(e)?e:[e]).every(n=>$t(n,r))&&o()})};import{useEffect as Gt,useState as Ut}from"react";var Je=(e,o=500)=>{let[t,r]=Ut(e);return Gt(()=>{let a=setTimeout(()=>r(e),o);return()=>{clearTimeout(a)}},[e,o]),t};import{useEffect as Vt}from"react";var Q=(e,o)=>{Vt(()=>{let t=Array.isArray(e)?e:[e],r=new ResizeObserver(o);return t.forEach(a=>a.current&&r.observe(a.current)),()=>{r.disconnect()}},[e,o])};import{useEffect as _t,useState as Yt}from"react";var eo=e=>{let o=document.getElementById(e);return o===null&&(o=document.createElement("div"),o.setAttribute("id",e),document.body.appendChild(o)),o},oo=e=>{let[o,t]=Yt(()=>eo(e));return _t(()=>{let r=document.getElementById(e);if(o===null||r===null){let a=eo(e);t(a)}return()=>{o&&o.parentNode&&process.env.NODE_ENV==="production"&&document.body.removeChild(o)}},[o,e]),o};var te=(e,o=2)=>{if(e===0)return"0 Bytes";let t=1e3,r=o<0?0:o,a=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,n)).toFixed(r))+" "+a[n]};var to=({c:e,m:o,offset:t,position:r})=>{let a=e.y+e.h+t,n=e.x-(o.w-e.w)*(50/100);switch(r){case"top":case"top center":a=e.y-o.h-t,n=e.x-(o.w-e.w)/2;break;case"top left":a=e.y-o.h-t,n=e.x-o.w+e.w;break;case"top right":a=e.y-o.h-t,n=e.x;break;case"bottom":case"bottom center":a=e.y+e.h+t,n=e.x-(o.w-e.w)/2;break;case"bottom left":a=e.y+e.h+t,n=e.x-o.w+e.w;break;case"bottom right":a=e.y+e.h+t,n=e.x;break;case"left":case"left center":a=e.y-(o.h-e.h)/2,n=e.x-o.w-t;break;case"left top":a=e.y-o.h+e.h,n=e.x-o.w-t;break;case"left bottom":a=e.y,n=e.x-o.w-t;break;case"right":case"right center":a=e.y-(o.h-e.h)/2,n=e.x+e.w+t;break;case"right top":a=e.y-o.h+e.h,n=e.x+e.w+t;break;case"right bottom":a=e.y,n=e.x+e.w+t;break}return{left:Math.round(n),top:Math.round(a)}},jt=({top:e,left:o},t,r,a)=>{let n=t.split(" "),i=[],s=o+a.w+r-window.innerWidth,l=e+a.h+r-window.innerHeight;for(let c of n)c==="top"&&e<r?i.push("bottom"):c==="left"&&o<r?i.push("right"):c==="bottom"&&l>0?i.push("top"):c==="right"&&s>0?i.push("left"):i.push(c);return i.join(" ")},Xt=({top:e,left:o},t,r)=>{let a=o+t.w+r-window.innerWidth,n=e+t.h+r-window.innerHeight;return o=a>0?o-a:o,e=n>0?e-n:e,o=o<r?r:o,e=e<r?r:e,{top:e,left:o}},ro=({c:e,m:o,offset:t,windowOffset:r,position:a})=>{let n={c:e,m:o,offset:t,position:a},i=to(n),s=jt(i,a,r,o);s!==a&&(i=to({...n,position:s}));let l=Xt(i,o,r);return{left:`${l.left}px`,top:`${l.top}px`}};var no=({position:e,windowOffset:o})=>{switch(e){case"center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case"top":case"top center":return{top:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"top left":case"left top":return{top:`${o}px`,left:`${o}px`};case"top right":case"right top":return{top:`${o}px`,right:`${o}px`};case"bottom":case"bottom center":return{bottom:`${o}px`,left:"50%",transform:"translateX(-50%)"};case"left bottom":case"bottom left":return{bottom:`${o}px`,left:`${o}px`};case"right bottom":case"bottom right":return{bottom:`${o}px`,right:`${o}px`};case"left":case"left center":return{top:"50%",left:`${o}px`,transform:"translateY(-50%)"};case"right":case"right center":return{top:"50%",right:`${o}px`,transform:"translateY(-50%)"}}return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}};import{useRef as Qt,useState as Zt}from"react";import{useEffect as Wt}from"react";var ao=(e,o,t={})=>{Wt(()=>{let r=Array.isArray(e)?e:[e],a=new IntersectionObserver(o,t);return r.forEach(n=>n.current&&a.observe(n.current)),()=>{a.disconnect()}},[o,t,e])};var io=(e={})=>{let[o,t]=Zt(!1),r=Qt(null);return ao(r,([a])=>{t(a.isIntersecting)},e),{ref:r,inView:o}};import{useCallback as we,useState as Kt}from"react";var S=({onBlur:e,onFocus:o,onChange:t}={})=>{let[r,a]=Kt(!1),n=we(l=>{a(!0),o&&o(l)},[o]),i=we(l=>{a(!1),e&&e(l)},[e]),s=we(l=>{t&&t(l)},[t]);return{isFocus:r,handlers:{onFocus:n,onBlur:i,onChange:s}}};import{useEffect as qt,useState as Jt}from"react";var ue=e=>{let[o,t]=Jt(!1);return qt(()=>{let r=window.matchMedia(e);r.matches!==o&&t(r.matches);let a=()=>{t(r.matches)};return r.addEventListener("change",a),()=>{r.removeEventListener("change",a)}},[o,e]),o};import{useRef as er,useState as or}from"react";var so=()=>{let e=er(null),[o,t]=or(!1);return{containerRef:e,isOpen:o,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};import{useCallback as lo,useLayoutEffect as tr,useRef as rr}from"react";var co=e=>({x:e.x,y:e.y,w:e.width,h:e.height,top:e.top,left:e.left}),po=({offset:e=0,windowOffset:o=0,position:t="bottom",modalRef:r,containerRef:a,isOpen:n})=>{let i=rr(null),s=lo((c,m)=>{let d=c.current?.getClientRects()[0],p=m.current?.getClientRects()[0];if(!d)return;let u=p?ro({c:co(p),m:co(d),offset:e,windowOffset:o,position:t}):no({position:t,windowOffset:o});Object.keys(u).forEach(g=>{c.current?.style.setProperty(g,u[g])})},[t,o,e]),l=lo(()=>{n&&s(r,a??i)},[s,n,a,r]);tr(l,[l]),Q(a??i,l),Q(r,l),O("resize",l),O("scroll",l,r)};import nr,{useCallback as mo,useEffect as ar,useLayoutEffect as ir,useMemo as sr}from"react";var uo=({transitionDuration:e=0,isOpen:o})=>{let[t,r]=nr.useState("CLOSED"),a=sr(()=>t!=="CLOSED",[t]);ar(()=>{document.documentElement.style.overflow=a?"hidden":"auto"},[a]);let n=mo(()=>{["OPENING","OPEN"].includes(t)&&(e>0?(r("CLOSING"),setTimeout(()=>{r("CLOSED")},e)):r("CLOSED"))},[t,e]),i=mo(()=>{["CLOSING","CLOSED"].includes(t)&&(e>0?(r("OPENING"),setTimeout(()=>{r("OPEN")},e)):r("OPEN"))},[t,e]);return ir(()=>{t==="CLOSED"&&o?i():t==="OPEN"&&!o&&n()},[o,i,n,t]),{isVisible:a,modalState:t}};import{useRef as lr,useState as cr}from"react";var fo=(e,o)=>{let{left:t,top:r}=e,a=t+window.scrollX,n=r+window.scrollY,i=o.pageX-a,s=o.pageY-n;return{x:o.pageX,y:o.pageY,elementX:i,elementY:s,elementPositionX:a,elementPositionY:n}},ho=e=>{let o=lr(null),[t,r]=cr({x:null,y:null,elementX:null,elementY:null,elementPositionX:null,elementPositionY:null});return O("mousemove",n=>{let{clientX:i,clientY:s}=n;if(r(l=>({...l,x:i,y:s})),e?.current instanceof Element){let l=fo(e.current.getBoundingClientRect(),n);r(c=>({...c,...l}))}else if(o.current instanceof Element){let l=fo(o.current.getBoundingClientRect(),n);r(c=>({...c,...l}))}}),{...t,ref:o}};import{useCallback as dr,useState as pr}from"react";var go=(e,o=0)=>{let[t,r]=pr(o),a=dr(n=>{r(n!==void 0?n:i=>(i+1)%e.length)},[e.length]);return[e[t],a]};import{jsx as fr}from"react/jsx-runtime";var mr=(t=>(t.VERTICAL="vertical",t.HORIZONTAL="horizontal",t))(mr||{}),ur=(r=>(r.SOLID="solid",r.DOTTED="dotted",r.DASHED="dashed",r))(ur||{}),fe=({orientation:e="horizontal",className:o="",style:t={},color:r="currentColor",size:a=1,lineStyle:n="solid",dashedSize:i=1,spacing:s=1})=>{let l=h({"custom-line":!0,[e]:!0,[o]:!!o,[n]:!0});return fr("span",{className:l,style:{...t,"--color":r,"--size":`${a}px`,"--spacing":`${s}px`,"--dashSize":`${i}px`}})};import{jsx as Ee}from"react/jsx-runtime";var bo=hr(null),yo=e=>{let o=br(bo);if(!o)throw new Error("You cant use this component out off an Accordion component");let{toggleItem:t,openedItems:r}=o,a=()=>t(e);return[r.includes(e),a]},Ui=({children:e,className:o="",noSeparators:t,multiple:r,style:a={},defaultOpened:n=[]})=>{let[i,s]=vr(()=>(Array.isArray(n)?n:[n]).reduce((d,p)=>typeof p=="string"?{...d,[p]:!0}:d,{})),l=gr(d=>{s(p=>({...r?p:{},[d]:!p[d]}))},[r]),c=yr(()=>Object.keys(i).filter(d=>i[d]),[i]),m=h({accordion:!0,[o]:!!o});return Ee(bo.Provider,{value:{toggleItem:l,openedItems:c},children:Ee("section",{className:m,style:a,children:(Array.isArray(e)?e:[e]).flatMap((d,p)=>p===0?d:[t?null:Ee(fe,{orientation:"horizontal"},`${p}.5`),d])})})};import{useMemo as kr}from"react";import{FaCaretLeft as Rr}from"react-icons/fa";import{jsx as Cr}from"react/jsx-runtime";var vo=({children:e,isOpen:o,className:t="",style:r={}})=>Cr("section",{className:t,style:{overflow:"hidden",height:o?"auto":0,transition:"height 300ms ease",interpolateSize:"allow-keywords",...r},children:e});import{useMemo as Co}from"react";import{jsx as Me,jsxs as xr}from"react/jsx-runtime";var Ji=({cardZIndex:e="auto",flipDirection:o="vertical",flipSpeed:t=500,isFlipped:r=!1,children:a})=>{let n=c=>{if(a.length!==2)throw new Error("Component FlipCard requires 2 children");return a[c]},i=Co(()=>`rotate${o==="horizontal"?"Y":"X"}(${r?180:0}deg)`,[o,r]),s=Co(()=>`rotate${o==="horizontal"?"Y":"X"}(${r?0:-180}deg)`,[o,r]),l=h({"flip-card":!0,"is-flipped":r});return Me("section",{className:l,style:{"--cardZIndex":e,"--flipSpeed":`${t}ms`,"--frontRotate":i,"--backRotate":s},children:xr("section",{className:"flipper",children:[Me("section",{className:"front",children:n(0)}),Me("section",{className:"back",children:n(1)})]})})};import{useCallback as xo,useRef as To}from"react";import{jsx as Po}from"react/jsx-runtime";var cs=({children:e,threshold:o=5,translationZ:t=25,width:r="fit-content",className:a=""})=>{let n=To(null),i=To(null),s=xo(m=>{let d=n.current,p=i.current;if(!d||!p)return;let{clientX:u,clientY:g,currentTarget:y}=m,{clientWidth:f,clientHeight:b}=y,{top:v,left:T}=d.getBoundingClientRect(),x=(u-T)/f,C=(g-v)/b,R=x*2-1,L=((C*2-1)*o).toFixed(2),F=(R*o).toFixed(2);p.style.transform=`perspective(${f}px) rotateX(${-L}deg) rotateY(${F}deg)`,d.style.transform=`perspective(${f}px) translateZ(${t}px)`},[o,t]),l=xo(m=>{let d=n.current,p=i.current;!d||!p||(p.style.transform=`perspective(${m.currentTarget.clientWidth}px) rotateX(0) rotateY(0)`,d.style.transform=`perspective(${m.currentTarget.clientWidth}px) translateZ(0)`)},[]);O("mousemove",s,n),O("mouseleave",l,n);let c=h({"hover-card":!0,[a]:!!a});return Po("span",{ref:n,style:{width:r},className:c,children:Po("span",{className:"card-hover-layer",ref:i,children:e})})};import{createElement as Tr,useMemo as Pr}from"react";var Se={hero:"h1",header1:"h1",header2:"h2",header3:"h3",header4:"h4",body:"p",label:"span","label-form":"label",small:"small"},Ne={hero:"hero",header1:"header1",header2:"header2",header3:"header3",header4:"header4",body:"body",label:"label","label-form":"label",small:"small"};var k=({variant:e="body",nowrap:o=!1,className:t="",style:r={},children:a,as:n,weight:i,family:s="primary",noPadding:l=!1,align:c,color:m,htmlFor:d,recommendedWidth:p=!1,...u})=>{let g=h({typography:!0,[Ne[e]]:Ne[e]!==void 0,[t]:!!t,[i??""]:!!i,[m??""]:!!m,"no-padding":l,"code-family":s==="code","recommended-width":p,"nowrap-max-lines":typeof o=="number","nowrap-max-lines-2":o===2,"nowrap-max-lines-3":o===3,"nowrap-max-lines-4":o===4,"nowrap-max-lines-5":o===5,nowrap:o===!0}),y=Pr(()=>Se[e]??Se.body,[e]);return Tr(n??y,{...u,className:g,htmlFor:d,style:{textAlign:c,...r}},a)};import{jsx as ne,jsxs as Ie}from"react/jsx-runtime";var re=(e,o)=>typeof e=="function"?e(o):e,Is=({title:e,subtitle:o,children:t,icon:r=Rr,startContent:a,content:n,endContent:i,classNames:s={},className:l="",style:c={}})=>{let m=kr(()=>crypto.randomUUID(),[]),[d,p]=yo(m),u=h({"accordion-header":!0,"has-start-content":!!a,[s?.header??""]:!!s?.header,"is-open":d}),g=h({"accordion-header-content":!0,[s?.headerContent??""]:!!s?.headerContent}),y=h({"accordion-toggle-icon":!0,isOpen:d,[s?.toggleIcon??""]:!!s?.toggleIcon}),f=h({"accordion-body":!0,[s?.body??""]:!!s?.body}),b=re(e,d),v=re(o,d),T=re(a,d),x=re(n,d)??Ie("section",{className:g,children:[ne(k,{className:s?.title,variant:"body",noPadding:!0,weight:"bold",children:b}),ne(k,{className:s?.subtitle,variant:"label",noPadding:!0,weight:"light",children:v})]}),C=re(i,d)??ne(r,{className:y}),R=h({"accordion-item":!0,[l]:!!l});return Ie("section",{className:R,style:c,children:[Ie("section",{className:u,onClick:p,children:[T,x,C]}),ne(vo,{isOpen:d,children:ne("section",{className:f,children:t})})]})};import{useEffect as wr,useRef as Er}from"react";import{jsx as Mr}from"react/jsx-runtime";var J=({color:e,duration:o=1e3,timingFunction:t="ease-out",times:r=1,className:a="",style:n={},zIndex:i=1})=>{let s=Er(null);return wr(()=>{if(!s.current?.parentElement)return;let c=getComputedStyle(s.current.parentElement).position;["absolute","fixed","sticky","relative"].includes(c)||(s.current.parentElement.style.position="relative")},[]),Mr("span",{ref:s,onMouseDown:c=>{let{pageX:m,pageY:d,currentTarget:p}=c,u=p.getBoundingClientRect(),g=(m-u.left)*100/u.width,y=(d-u.top)*100/u.height,f=document.createElement("span");f.classList.add("ripple-effect"),f.style.animationDuration=`${o}ms`,f.style.animationTimingFunction=t,f.style.left=`${g}%`,f.style.top=`${y}%`,e&&(f.style.background=e),p.appendChild(f),setTimeout(()=>{f.remove()},Math.max(o,500)*Math.max(r,1))},className:`ripple ${a}`,style:{...n,zIndex:i}})};import{jsx as Sr,jsxs as Nr}from"react/jsx-runtime";var ko=({children:e,color:o="default",variant:t="solid",radius:r="medium",size:a="regular",noWrap:n=!1,forIcon:i=!1,className:s="",...l})=>{let c=h({button:!0,[o]:!!o,[t]:!!t,[`radius-${r}`]:!!r,[`size-${a}`]:!!a,"no-wrap":n,icon:i,[s]:!!s});return Nr("button",{...l,className:c,children:[e,Sr(J,{})]})};import{useEffect as Ir,useState as Or}from"react";import{jsx as Ro,jsxs as Lr}from"react/jsx-runtime";var Js=()=>{let{x:e,y:o,elementX:t,elementY:r,ref:a}=ho(),[n,i]=Or(!1);if(O("mouseover",l=>{let c=getComputedStyle(l.target).cursor;i(c==="pointer")}),Ir(()=>("ontouchstart"in window||navigator.maxTouchPoints||(document.body.style.cursor="none"),()=>{document.body.style.cursor="auto"}),[]),e===null||o===null||"ontouchstart"in window||navigator.maxTouchPoints)return null;let s=`translate3d(${t}px, ${r}px, 0)`;return Lr("section",{className:"cursor-overlay",ref:a,children:[Ro("span",{className:`cursor outer-circle ${n?"cursor-hover":""}`,style:{transform:s}}),Ro("span",{className:`cursor inner-circle ${n?"cursor-hover":""}`,style:{transform:s}})]})};import{useMemo as Dr}from"react";import{IoCheckmarkOutline as zr}from"react-icons/io5";import{Controller as Fr,useFormContext as Ar}from"react-hook-form";import{jsx as wo}from"react/jsx-runtime";var M=({Component:e,inputProps:o,defaultValue:t,rules:r})=>{let{control:a,setValue:n}=Ar(),{name:i,defaultValue:s}=o;return wo(Fr,{name:i,control:a,rules:r,defaultValue:s??t,render:({field:{onBlur:l,value:c},fieldState:m})=>wo(e,{value:c,error:m.error?.message,invalid:m.invalid,isTouched:m.isTouched,isDirty:m.isDirty,setValue:d=>n(i,d),onBlur:l,...o})})};import{jsx as ae,jsxs as Eo}from"react/jsx-runtime";var ee=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,className:n="",style:i={},autoFocus:s=!1,readOnly:l=!1,disabled:c=!1,autoComplete:m="off",icon:d=zr,label:p,color:u="primary",size:g="regular"})=>{let y=Dr(()=>crypto.randomUUID(),[]),{handlers:f}=S({onChange:T=>t(T.target.checked),onBlur:r,onFocus:a}),b=h({"checkbox-container":!0,[n]:!!n,[`color-${u}`]:!!u}),v=h({checkbox:!0,"is-checked":o,[`size-${g}`]:!!g});return Eo("section",{className:b,style:i,onClick:T=>T.stopPropagation(),children:[Eo("section",{className:v,children:[ae("section",{className:"checkbox-fill",children:ae(d,{size:"1.3em",className:"checkbox-icon"})}),ae("input",{id:y,type:"checkbox",name:e,className:"checkbox-input",checked:o,autoFocus:s,autoComplete:m,disabled:c||l,...f})]}),p?ae(k,{variant:"label-form",htmlFor:y,className:"checkbox-label",children:p}):null]})},Hr=({rules:e,...o})=>ae(M,{Component:ee,defaultValue:!1,inputProps:o,rules:e});ee.Controller=Hr;import{useMemo as Ur}from"react";import{ImCross as Gr}from"react-icons/im";var Br=(r=>(r.FULL_BORDER="full-border",r.CONTENT_BORDER="content-border",r.CONTENT_LINE="line",r))(Br||{}),$r=(t=>(t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t))($r||{});import{jsx as Z,jsxs as Oe}from"react/jsx-runtime";var Mo=({icon:e,className:o,onClick:t})=>e?Z(e,{className:o,onClick:t}):Z("span",{}),z=({id:e,label:o,leftIcon:t,rightIcon:r,errorIcon:a=Gr,error:n,onClickLeftIcon:i,onClickRightIcon:s,fieldOrientation:l="vertical",children:c,isFocus:m=!1,variant:d,ref:p})=>{let u=h({"form-field":!0,focus:m,error:!!n,"variant-content-border":d==="content-border","variant-content-line":d==="line","variant-full-border":d==="full-border","variant-inline":l==="horizontal"}),g=y=>f=>{f.stopPropagation();let b=document.getElementById(e);b?.focus(),b?.click(),y&&y()};return Oe("section",{className:u,ref:p,children:[o?Z(k,{className:"field-label",noPadding:!0,variant:"label-form",htmlFor:e,children:o}):null,Oe("section",{className:"field-content",children:[Mo({className:"field-left-icon",icon:t,onClick:g(i)}),Z("section",{className:"field-children",children:c}),Mo({className:"field-right-icon",icon:r,onClick:g(s)})]}),!!n&&Oe("section",{className:"field-message",children:[a?Z(a,{size:10}):Z("span",{}),Z(k,{noPadding:!0,variant:"small",children:n})]})]})};import{jsx as Le}from"react/jsx-runtime";var So=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,type:n="date",className:i="",style:s={},autoFocus:l=!1,readOnly:c=!1,disabled:m=!1,placeholder:d="",autoComplete:p="off",isDirty:u=!1,isTouched:g=!1,invalid:y=!1,error:f,...b})=>{let v=Ur(()=>crypto.randomUUID(),[]),{isFocus:T,handlers:x}=S({onBlur:r,onChange:C=>t(C.target.value),onFocus:a});return Le(z,{id:v,error:f,isFocus:T,...b,children:Le("input",{id:v,type:n,name:e,className:i,style:s,value:o,autoFocus:l,autoComplete:p,placeholder:d,disabled:m,readOnly:c,...x})})},Vr=({rules:e,...o})=>Le(M,{Component:So,defaultValue:"",inputProps:o,rules:e});So.Controller=Vr;import{useMemo as _r}from"react";import{jsx as Fe}from"react/jsx-runtime";var No=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,pattern:n,type:i="text",className:s="",style:l={},autoFocus:c=!1,readOnly:m=!1,disabled:d=!1,placeholder:p="",autoComplete:u="off",isDirty:g=!1,isTouched:y=!1,invalid:f=!1,error:b,min:v,max:T,...x})=>{let C=_r(()=>crypto.randomUUID(),[]),{handlers:R,isFocus:w}=S({onChange:L=>t(L.target.value),onBlur:r,onFocus:a});return Fe(z,{id:C,error:b,isFocus:w,...x,children:Fe("input",{id:C,type:i,name:e,className:s,style:l,value:o,pattern:n,autoFocus:c,autoComplete:u,placeholder:p,disabled:d,readOnly:m,min:v,max:T,...R})})},Yr=({rules:e,...o})=>Fe(M,{Component:No,defaultValue:"",inputProps:o,rules:e});No.Controller=Yr;import{useMemo as Io}from"react";import{FiEye as jr,FiEyeOff as Xr}from"react-icons/fi";import{IoIosWarning as Wr}from"react-icons/io";import{jsx as Ae}from"react/jsx-runtime";var Oo=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,className:n="",style:i={},autoFocus:s=!1,readOnly:l=!1,disabled:c=!1,placeholder:m="",autoComplete:d="off",isDirty:p=!1,isTouched:u=!1,invalid:g=!1,error:y,...f})=>{let b=Io(()=>crypto.randomUUID(),[]),[v,T]=go(["password","text"]),{isFocus:x,handlers:C}=S({onBlur:r,onChange:w=>t(w.target.value),onFocus:a}),R=Io(()=>v==="password"?jr:v==="text"?Xr:Wr,[v]);return Ae(z,{id:b,error:y,isFocus:x,...f,rightIcon:R,onClickRightIcon:()=>T(),children:Ae("input",{id:b,type:v,name:e,className:n,style:i,value:o,autoFocus:s,autoComplete:d,placeholder:m,disabled:c,readOnly:l,...C})})},Qr=({rules:e,...o})=>Ae(M,{Component:Oo,defaultValue:"",inputProps:o,rules:e});Oo.Controller=Qr;import Cn from"color";import{useCallback as xn,useEffect as Tn,useMemo as Go,useRef as Pn,useState as Uo}from"react";import{HexAlphaColorPicker as kn,HexColorInput as Rn}from"react-colorful";import{FaEyeDropper as wn}from"react-icons/fa6";import En from"use-eye-dropper";import{createContext as nn,useCallback as Ao,useContext as an,useRef as sn,useState as Do}from"react";import{ImCross as ln}from"react-icons/im";import{useMemo as on,useRef as tn}from"react";import{createPortal as Zr}from"react-dom";var Lo=({children:e,id:o})=>{let t=oo(o);return t===null?null:Zr(e,t)};import{useMemo as qr}from"react";import{jsx as en}from"react/jsx-runtime";var Jr=(a=>(a.OPAQUE="opaque",a.TRANSPARENT="transparent",a.BLUR="blur",a.NONE="none",a))(Jr||{}),Fo=({opacity:e=.6,backdrop:o="blur",zIndex:t,backdropOnClick:r,modalState:a})=>{let n=h({"modal-backdrop":!0,"backdrop-close":a==="CLOSING"||a==="CLOSED"}),i=qr(()=>({opaque:{background:`hsl(from var(--background-paper) h s l / ${e*100}%)`},transparent:{background:"transparent"},blur:{background:`hsl(from var(--background-paper) h s l / ${e*100}%)`,backdropFilter:"blur(5px)"},none:{display:"none"}})[o]??{},[o,e]);return o==="none"?null:en("section",{tabIndex:-1,onClick:r,className:n,style:{zIndex:t,...i}})};import{jsx as De,jsxs as rn}from"react/jsx-runtime";var U=({id:e,children:o,isOpen:t,onClose:r,className:a="",style:n={},rootStyle:i={},animation:s="fade-down",closeAnimationClassName:l="modal-close",modalRef:c,closeOnClickOutside:m=!0,transitionDuration:d=300,windowOffset:p=10,offset:u=20,position:g,containerRef:y,zIndex:f=1e3,...b})=>{let v=on(()=>crypto.randomUUID(),[]),T=tn(null),{modalState:x,isVisible:C}=uo({transitionDuration:d,isOpen:t});po({modalRef:c??T,containerRef:y,offset:u,windowOffset:p,position:g,isOpen:C}),qe(c??T,()=>{t&&m&&r()});let R=h({"modal-content":!0,[a]:!!a,[`animation-${s}`]:!!s&&s!=="none",[l]:x==="CLOSING"||x==="CLOSED"});return C?rn(Lo,{id:`modal-${e}-${v}`,children:[De(Fo,{...b,modalState:x,zIndex:f}),De("section",{className:"modal",ref:c??T,style:{maxWidth:`calc(100dvw - ${p*2}px)`,maxHeight:`calc(100dvh - ${p*2}px)`,...i,zIndex:+f+1},children:De("section",{style:{...n,animationDuration:`${d}ms`},className:R,children:o})})]}):null};import{jsx as V,jsxs as pn}from"react/jsx-runtime";var zo=nn(null),cn=()=>{let e=an(zo);if(!e)throw new Error("useActionModalContext must be used within a ActionModal");return e},ie=({children:e,isOpen:o,onClose:t,actionRequired:r,icon:a,noCloseButton:n,lineOnTop:i=!1,backCard:s=!1,noPadding:l=!1,className:c="",style:m={},...d})=>{let[p,u]=Do(!1),g=sn(null),y=Ao(()=>{g.current?.classList.add("shake-animation"),setTimeout(()=>{g.current?.classList.remove("shake-animation")},500)},[]),f=h({"action-modal-content":!0,"back-card":s,"line-on-top":i,"no-padding":l});return V(zo.Provider,{value:{onClose:t,isActionInProgress:p,setIsActionInProgress:u},children:V(U,{className:"action-modal",id:"action-modal",animation:"bounce",opacity:.8,isOpen:o,onClose:t,...d,backdropOnClick:r?y:t,position:"center",children:V("section",{ref:g,className:"modal-content",children:pn("section",{className:f,children:[!n&&!r&&V("section",{className:"close-modal-button",onClick:()=>t(),children:V(ln,{})}),a?V(k,{variant:"header4",className:"action-modal-icon",children:V(a,{})}):null,V("section",{className:"action-modal-body",children:V("section",{className:`action-modal-content ${c}`,style:m,children:e})})]})})})})},dn=({onClick:e,children:o,isLoading:t,...r})=>{let{onClose:a,isActionInProgress:n,setIsActionInProgress:i}=cn(),[s,l]=Do(!1),c=Ao(()=>{l(!0),i(!0);let m=e();m instanceof Promise?m.then(()=>{a(),l(!1),i(!1)}):(a(),l(!1),i(!1))},[e,a,i]);return!s&&n?null:V(ko,{...r,onClick:c,isLoading:t||s,children:o})};ie.ActionButton=dn;import{useMemo as mn}from"react";import{ImCross as un}from"react-icons/im";import{jsx as ze,jsxs as fn}from"react/jsx-runtime";var zc=({children:e,isOpen:o,onClose:t,position:r="left",size:a,className:n="",...i})=>{let s=mn(()=>({top:{height:a,width:"100%"},left:{height:"100%",width:a},right:{height:"100%",width:a},bottom:{height:a,width:"100%"}})[r],[r,a]);return fn(U,{id:"aside",isOpen:o,onClose:t,opacity:.6,windowOffset:0,animation:"none",className:`aside-modal ${n} ${r}`,rootStyle:s,backdropOnClick:t,position:r,...i,children:[ze("span",{className:"close-modal-button",onClick:t,children:ze(un,{})}),ze("section",{className:"aside-modal-content",children:e})]})};import{jsx as se,jsxs as Ho}from"react/jsx-runtime";var jc=({title:e,onAccept:o,onReject:t=()=>null,acceptText:r,rejectText:a,children:n,isLoading:i,...s})=>se(ie,{...s,backCard:!0,children:Ho("section",{className:"confirmation-modal",children:[se(k,{variant:"header4",children:e}),se("section",{children:n}),Ho("section",{className:"confirmation-modal-actions",children:[!i&&se(ie.ActionButton,{variant:"flat",onClick:t,children:a}),se(ie.ActionButton,{isLoading:i,onClick:o,children:r})]})]})});import{useCallback as hn,useMemo as gn}from"react";import{Fragment as Bo,jsx as $,jsxs as he}from"react/jsx-runtime";var _=({children:e,isOpen:o,onClose:t,id:r,menuContentRef:a,contentClassName:n="",contentStyle:i={},className:s="",...l})=>{let c=h({"menu-modal":!0,[s]:!!s});return $(U,{className:c,...l,id:`menu-${r}`,isOpen:o,onClose:t,children:$("ul",{className:`menu-content ${n}`,role:"listbox",style:i,ref:a,children:e})})},bn=({children:e,label:o="",asCheckbox:t,icon:r,id:a,disabled:n=!1,selected:i=!1,className:s="",style:l={},onClick:c=()=>null,...m})=>{let d=h({"menu-option":!0,[s]:!0,"is-disabled":n,"is-selected":i}),p=hn(g=>{g.stopPropagation(),n||c(!i)},[n,c,i]),u=gn(()=>e||(t?$(ee,{className:"menu-checkbox",disabled:n,value:i,setValue:g=>c(g),name:"option",style:{pointerEvents:"none"},size:"small",label:he(Bo,{children:[r!==void 0&&$(r,{className:"option-icon"}),$(k,{variant:"label",children:o})]})}):he(Bo,{children:[r!==void 0&&$(r,{className:"option-icon"}),typeof o=="string"?$(k,{variant:"label",children:o}):o]})),[t,e,n,r,o,c,i]);return he("li",{...m,id:a,role:"option",tabIndex:-1,"aria-selected":i,"aria-disabled":n,onClick:p,className:d,style:l,children:[$(J,{zIndex:10}),u]})},yn=()=>$("li",{children:$(fe,{className:"divider"})}),$o=({children:e,className:o="",...t})=>$("li",{tabIndex:-1,className:"menu-label",children:$(k,{...t,variant:"small",className:`menu-group-label ${o}`,children:e})}),vn=({children:e,label:o,className:t="",style:r={},contentClassName:a="",contentStyle:n={},...i})=>{let s=h({"menu-group":!0,[t]:!!t});return he("li",{tabIndex:-1,...i,className:s,style:r,children:[o&&$($o,{children:o}),$("ul",{className:`menu-group-content ${a}`,role:"listbox",style:n,children:e})]})};_.Option=bn;_.Divider=yn;_.GroupLabel=$o;_.Group=vn;import{jsx as W,jsxs as ge}from"react/jsx-runtime";var Vo=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,showValueText:n=!1,className:i="",style:s={},autoFocus:l=!1,readOnly:c=!1,disabled:m=!1,placeholder:d="",autoComplete:p="off",isDirty:u=!1,isTouched:g=!1,invalid:y=!1,error:f,...b})=>{let{open:v,isSupported:T}=En(),[x,C]=Uo(o),R=Go(()=>crypto.randomUUID(),[]),w=Pn(null),[L,F]=Uo(!1),{handlers:B,isFocus:H}=S({onChange:I=>C(I.target.value),onBlur:I=>{D(),r&&r(I)},onFocus:I=>{D(),a&&a(I)}}),P=Go(()=>{let I=Cn(o===""?"#000000":o);return I.isLight()||I.alpha()<.5?"#000000":"#FFFFFF"},[o]),E=async()=>{let{sRGBHex:I}=await v();t(I)};Tn(()=>{C(o)},[o]);let D=xn(()=>{x.match(/^#(?:(?:[\da-f]{3}){1,2}|(?:[\da-f]{4}){1,2})$/i)?t(x):C(o)},[x,t,o]),j=h({"input-color-box":!0,[i]:!!i});return ge(z,{id:R,error:f,isFocus:H,...b,children:[ge("section",{className:"input-color",onClick:I=>{I.stopPropagation(),F(!0)},ref:w,children:[W("section",{className:j,style:{borderColor:P,background:o,color:o,...s}}),n?W("input",{id:R,name:e,value:x,placeholder:d,readOnly:c,autoFocus:l,disabled:m,autoComplete:p,className:"color-input",...B}):null]}),ge(U,{id:"input-color",isOpen:L,onClose:()=>F(!1),position:"bottom right",offset:5,backdrop:"transparent",containerRef:w,className:"input-color-selector",children:[W(kn,{id:R,color:o,onChange:t}),ge("section",{className:"color-input-container",children:[T()?W(wn,{onClick:()=>{E()}}):W("span",{}),W(Rn,{className:"color-input",id:R,name:e,color:o,placeholder:"Type a color",prefixed:!0,alpha:!0,onChange:t}),W("span",{})]})]})]})},Mn=({rules:e,...o})=>W(M,{Component:Vo,defaultValue:"#147EFB",inputProps:o,rules:e});Vo.Controller=Mn;import{useCallback as Nn,useEffect as In,useMemo as _o,useState as On}from"react";import{FaMagnifyingGlass as Ln,FaRegTrashCan as Yo}from"react-icons/fa6";import{IoIosWarning as Fn}from"react-icons/io";import{PiFilePdfFill as An,PiFilePngFill as Dn}from"react-icons/pi";import{createElement as Sn}from"react";var le=({tag:e="section",children:o,className:t,style:r,flow:a,columnSize:n,rowSize:i,column:s,row:l,pc:c,pi:m,ps:d,jc:p,ji:u,js:g,ac:y,ai:f,as:b,gtc:v,gtr:T,gta:x,gt:C,gap:R,...w})=>Sn(e,{className:t,...w,style:{...r,...a?{gridAutoFlow:a}:{},...n?{gridAutoColumns:n}:{},...i?{gridAutoRows:i}:{},...s?{gridColumn:s}:{},...l?{gridRow:l}:{},...c?{placeContent:c}:{},...m?{placeItems:m}:{},...d?{placeSelf:d}:{},...p?{justifyContent:p}:{},...u?{justifyItems:u}:{},...g?{justifySelf:g}:{},...y?{alignContent:y}:{},...f?{alignItems:f}:{},...b?{alignSelf:b}:{},...v?{gridTemplateColumns:v}:{},...T?{gridTemplateRows:T}:{},...x?{gridTemplateAreas:x}:{},...C?{gridTemplate:C}:{},...R?{gap:R}:{},display:"grid"}},o);import{Fragment as Hn,jsx as A,jsxs as Y}from"react/jsx-runtime";var jo=({name:e,value:o={},setValue:t,onBlur:r,onFocus:a,className:n="",style:i={},autoFocus:s=!1,readOnly:l=!1,disabled:c=!1,placeholder:m="Click to upload or drag and drop",autoComplete:d="off",accept:p,multiple:u=!1,limitSize:g=5e6,errorTimeout:y=3e3,label:f})=>{let[b,v]=On(null),T=_o(()=>crypto.randomUUID(),[]),{handlers:x}=S({onBlur:r,onFocus:a,onChange:P=>{let{files:E}=P.target;E&&C(E)}});In(()=>{let P=null;return b!==null&&(P=setTimeout(()=>{v(null)},y)),()=>{P!==null&&clearTimeout(P)}},[b,y]);let C=P=>{let E=u?{...o}:{},D=u?P.length:1;for(let j=0;j<D;j++){let I=P.item(j);I&&(I.size<g?E[I.name]=I:v(`File '${I.name}' size is larger than ${te(g)}`))}t(E)},R=P=>{P.preventDefault(),P.stopPropagation(),P.dataTransfer.files&&P.dataTransfer.files.length&&C(P.dataTransfer.files)},w=Nn(P=>({"image/png":Dn,"application/pdf":An})[P]??Fn,[]),L=P=>{let E={...o};delete E[P.name],t(E)},F=()=>{t({})},B=_o(()=>Object.values(o).reduce((P,{size:E})=>P+E,0),[o]),H=(P,E)=>{let D=w(P.type);return Y("section",{className:"input-file-card",children:[A("section",{className:"file-card--image",children:A(D,{})}),Y(le,{children:[A(k,{variant:"label",noPadding:!0,nowrap:!0,children:P.name}),A(k,{noPadding:!0,variant:"small",children:te(P.size)})]}),A("section",{className:"file-card--delete",onClick:()=>L(P),children:A(Yo,{})})]},E)};return Y("section",{className:"input-file-container",children:[!!f&&A(k,{variant:"label-form",htmlFor:T,noPadding:!0,children:f}),Y("section",{className:"input-file--box",onDrop:R,children:[A("section",{className:"input-file--box--icon",children:A(Ln,{})}),Y(le,{children:[A(k,{variant:"label-form",htmlFor:T,noPadding:!0,weight:"bold",children:m}),Y(k,{variant:"small",noPadding:!0,children:["Max size (",te(g),")"]})]}),A("input",{id:T,type:"file",name:e,value:"",placeholder:m,readOnly:l,autoFocus:s,disabled:c,autoComplete:d,className:n,style:i,accept:p,multiple:u,title:"",...x})]}),b!==null&&A(k,{variant:"small",noPadding:!0,className:"error",children:b}),Object.keys(o).length>0&&Y(Hn,{children:[u&&Y("span",{className:"total-info",children:[Y(k,{variant:"small",noPadding:!0,children:[Object.keys(o).length," files - ",te(B)]}),A("span",{className:"total-info--delete",onClick:F,children:A(Yo,{})})]}),A("section",{className:"input-file--files",children:A("section",{className:"input-file--files--content",children:Object.values(o).map(H)})})]})]})},zn=({rules:e,...o})=>A(M,{Component:jo,defaultValue:{},inputProps:o,rules:e});jo.Controller=zn;import{useEffect as Bn,useMemo as Xo,useState as $n}from"react";import{jsx as He}from"react/jsx-runtime";var Wo={comma:/(?!^-)[^0-9,]/g,dot:/(?!^-)[^0-9.]/g},Qo=(e,o=".")=>{let t=o==="."?Wo.dot:Wo.comma,r=e.replace(t,"").replace(",",".");return r||""},be=(e,o)=>!e||Number.isNaN(e)?o(0):o(e),Zo=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,pattern:n,className:i="",style:s={},autoFocus:l=!1,readOnly:c=!1,disabled:m=!1,placeholder:d="",autoComplete:p="off",isDirty:u=!1,isTouched:g=!1,invalid:y=!1,error:f,min:b,max:v,decimalSeparator:T,format:x={locales:"en-US",style:"decimal",minimumFractionDigits:0,maximumFractionDigits:2},...C})=>{let R=Xo(()=>crypto.randomUUID(),[]),w=Xo(()=>{if(typeof x=="function")return x;let{locales:P,...E}=x;return Intl.NumberFormat(P,E).format},[x]),[L,F]=$n(be(o,w)),{handlers:B,isFocus:H}=S({onChange:P=>{let E=Qo(P.target.value,T);E.endsWith(".")?F(P.target.value):(F(be(Number(E),w)),t(Number(E)))},onBlur:P=>{let E=Qo(P.target.value,T);F(be(Number(E),w)),t(Number(E)),r&&r(P)},onFocus:a});return Bn(()=>{let P=be(o,w);L!==P&&F(P)},[w,L,o]),He(z,{id:R,error:f,isFocus:H,...C,children:He("input",{id:R,type:"text",name:e,className:i,style:s,value:L,pattern:n,autoFocus:l,autoComplete:p,placeholder:d,disabled:m,readOnly:c,min:b,max:v,...B})})},Gn=({rules:e,...o})=>He(M,{Component:Zo,defaultValue:0,inputProps:o,rules:e});Zo.Controller=Gn;import{useMemo as Un}from"react";import{jsx as ye,jsxs as Ko}from"react/jsx-runtime";var qo=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,className:n="",style:i={},autoFocus:s=!1,readOnly:l=!1,disabled:c=!1,autoComplete:m="off",radioValue:d,label:p,color:u="primary",size:g="regular"})=>{let y=Un(()=>crypto.randomUUID(),[]),{handlers:f}=S({onChange:T=>t(T.target.value),onBlur:r,onFocus:a}),b=h({"radio-container":!0,[n]:!!n,[`color-${u}`]:!!u}),v=h({radio:!0,"is-checked":d===o,[`size-${g}`]:!!g});return Ko("section",{className:b,style:i,children:[Ko("section",{className:v,children:[ye("section",{className:"radio-fill"}),ye("input",{id:y,type:"radio",name:e,className:`radio-input ${n}`,style:i,value:d,checked:d===o,autoFocus:s,autoComplete:m,disabled:c||l,...f})]}),p?ye(k,{variant:"label-form",htmlFor:y,className:"radio-label",children:p}):null]})},Vn=({rules:e,...o})=>ye(M,{Component:qo,defaultValue:"",inputProps:o,rules:e});qo.Controller=Vn;import{createContext as Wn,useCallback as it,useContext as Qn,useMemo as Ce,useRef as st,useState as Zn}from"react";import{ImCross as Kn}from"react-icons/im";import{PiCaretDown as qn}from"react-icons/pi";import{useEffect as _n}from"react";import{Fragment as Yn,jsx as Be,jsxs as Jo}from"react/jsx-runtime";var et=({isLoading:e=!1,hasNextPage:o=!1,loadMore:t,customLoadMoreElement:r,emptyMessage:a,children:n})=>{let{ref:i,inView:s}=io(),l=Je(e,100);_n(()=>{o&&s&&!l&&t()},[o,l,t,s]);let c=Array.isArray(n)?n.length>0:!!n;return Jo(Yn,{children:[n,Jo("section",{className:"infinity-scroll",children:[!!a&&!c&&!l&&Be("p",{className:"empty-message",children:a}),(o||l)&&(r?r(i):Be("section",{ref:i,className:"loading",children:l&&Be("span",{className:"loading--icon",children:":D"})}))]})]})};import{useCallback as $e,useMemo as ot}from"react";import{jsx as tt}from"react/jsx-runtime";var rt=({children:e,value:o})=>{let{multiselect:t,isEqualComparator:r,maxOptions:a,selectedValue:n,setValue:i,setIsOpen:s}=nt(),l=$e((u,g)=>["number","string"].includes(typeof u)?u===g:!!r&&r(u,g),[r]),c=$e(u=>{if(u)if(t){if(a&&Array.isArray(n)&&n.length>=a)return;i([...n,o])}else i(o),s(!1);else t?i(n.filter(g=>!l(g,o))):(i(null),s(!1))},[t,a,n,i,o,s,l]),m=ot(()=>n===""||n===null?!1:Array.isArray(n)?["number","string"].includes(typeof o)?n.includes(o):n.some(u=>!!r&&r(o,u)):l(o,n),[l,r,n,o]),d=$e(u=>{["Enter"," "].includes(u.key)&&(u.preventDefault(),c(!(m&&t)))},[c,m,t]),p=ot(()=>typeof e=="string"?tt(k,{"data-value":o,variant:"label",nowrap:!0,children:e}):e,[e,o]);return tt(_.Option,{label:p,onKeyDown:d,asCheckbox:t,selected:m,onClick:u=>c(t?u:!0)})};import{useCallback as Ue,useEffect as Ve,useRef as Ge,useState as _e}from"react";import{jsx as ve,jsxs as Xn}from"react/jsx-runtime";var jn=({height:e,minHeight:o,containerRef:t,offset:r,windowOffset:a})=>{let[n,i]=_e(void 0),s=Ue(()=>{let l=t.current?.getBoundingClientRect().bottom??0,c=window.innerHeight-l-a-r-5,m=window.innerHeight-a*3,d=c<o?m:c,p=Math.min(d,e),u=Math.max(p,o);i(`${Math.round(u)}px`)},[t,a,r,o,e]);return Ve(()=>{s()},[s]),Q(t,s),O("resize",s),{h:n}},at=({children:e,searchQueryValue:o,searchQueryPlaceholder:t="Search option",searchQueryClassName:r="",searchQueryStyle:a={},onSearchQuery:n,containerRef:i,height:s=300})=>{let l=Ge(null),c=Ge(null),[m,d]=_e(""),p=Ge(null),u=ue("(max-width: 480px)");O("keydown",x=>{if(["ArrowDown","ArrowUp"].includes(x.code)){x.preventDefault();let C=document.activeElement;if(C?.tagName==="LI")switch(x.code){case"ArrowDown":C?.nextSibling?.focus();break;case"ArrowUp":C?.previousElementSibling?.focus();break}}});let g=Ue(x=>{let{value:C}=x.target;n&&n(C),d(C)},[n]);Ve(()=>{p.current&&p.current.focus()},[]);let{h:y}=jn({height:s,minHeight:150,containerRef:i,offset:5,windowOffset:10}),[f,b]=_e(!1),v=Ue(()=>{let x=Math.round(l.current?.getBoundingClientRect().height??0)+2,C=Math.round(c.current?.scrollHeight??0);b(x>=C)},[]);Ve(v,[v]),Q(l,v),Q(c,v),O("resize",v);let T=h({"select-options-header":!0,[r]:!!r});return Xn("section",{className:`select-options ${n?"with-search-query":""}`,style:u?{maxHeight:window.innerHeight-100,width:window.innerWidth-100}:{height:f?"auto":y,maxHeight:s,width:i.current?.offsetWidth??"auto"},children:[n&&ve("section",{className:T,style:a,children:ve("input",{name:"query",className:"input-search",value:o??m,onChange:g,placeholder:t,onClick:x=>x.stopPropagation(),ref:p,autoFocus:!0})}),ve("section",{className:"select-options-list-container",ref:l,children:ve("ul",{className:"select-options-list",ref:c,children:e})})]})};import{jsx as N,jsxs as lt}from"react/jsx-runtime";var ct=Wn(null),nt=()=>{let e=Qn(ct);if(!e)throw new Error("useSelectContext must be used within a Select component");return e},Jn=({children:e})=>{let o=Ce(()=>typeof e=="string"?N(k,{noPadding:!0,variant:"label",nowrap:!0,children:e}):e,[e]);return N(_.GroupLabel,{children:o})},ea=({value:e})=>N(k,{variant:"label",nowrap:!0,children:typeof e=="string"||typeof e=="number"?e:JSON.stringify(e)}),oa=({value:e,multiselect:o})=>o?N(k,{noPadding:!0,nowrap:!0,variant:"label",children:`${e.length} item${e.length===1?"":"s"} selected`}):e===null?null:N(k,{noPadding:!0,variant:"label",nowrap:!0,children:typeof e=="string"||typeof e=="number"?e:JSON.stringify(e)}),K=({options:e,isEqualComparator:o,searchQueryValue:t,searchQueryPlaceholder:r,onSearchQuery:a,loadMore:n=()=>null,isLoading:i=!1,hasNextPage:s=!1,emptyMessage:l="No options to select",multiselect:c,optionComponent:m=ea,valueComponent:d=oa,maxOptions:p,children:u,name:g,value:y,setValue:f,onBlur:b,onFocus:v,className:T="",style:x={},showClearOption:C=!1,height:R,searchQueryStyle:w,searchQueryClassName:L,autoFocus:F=!1,readOnly:B=!1,disabled:H=!1,placeholder:P="",autoComplete:E="off",isDirty:D=!1,isTouched:j=!1,invalid:I=!1,error:Te,...It})=>{let Ot=st(null),pe=ue("(max-width: 480px)"),Ze=Ce(()=>crypto.randomUUID(),[]),Pe=st(null),[me,Ke]=Zn(!1),ke=it(X=>{Ke(X&&!H)},[H]),Lt=it(X=>{X.stopPropagation(),f(c?[]:null)},[c,f]),Re=Ce(()=>c?y.length>0:!!y,[c,y]),Ft=Ce(()=>u||e.map((X,At)=>N(K.Option,{value:X,children:N(m,{value:X})},At)),[m,u,e]);return N(ct.Provider,{value:{selectedValue:y,setValue:f,multiselect:c??!1,isEqualComparator:o,maxOptions:p??null,setIsOpen:Ke},children:N(z,{id:Ze,error:Te,isFocus:me,ref:Pe,...It,children:lt("section",{id:g,style:x,onBlur:b,className:`select ${H?"disabled":""} ${T}`,children:[lt("section",{id:Ze,className:`select-container ${Re&&C?"three-columns":""}`,onClick:()=>ke(!0),children:[N("button",{type:"button",className:`input-button ${(Array.isArray(y)?y.length>0:y)?"":"placeholder"}`,"aria-haspopup":"listbox","aria-expanded":me,onFocus:X=>{ke(!0),v&&v(X)},children:Re?N(d,{...c?{value:y,multiselect:c}:{value:y}}):N(k,{variant:"label",noPadding:!0,nowrap:!0,children:P})}),Re&&C&&N("section",{className:"icon-close",onClick:Lt,children:N(Kn,{})}),N(qn,{className:`select-caret-icon ${me&&"is-select-open"}`})]}),N(_,{id:"form-select",isOpen:me,onClose:()=>ke(!1),backdrop:pe?"blur":"transparent",opacity:pe?.8:.4,position:pe?"center":"bottom",offset:5,modalRef:Ot,windowOffset:10,transitionDuration:200,containerRef:pe?void 0:Pe,contentClassName:"select-menu-content",className:"select-options-menu",children:N(at,{containerRef:Pe,onSearchQuery:a,searchQueryValue:t,searchQueryPlaceholder:r,searchQueryClassName:L,searchQueryStyle:w,height:R,children:N(et,{isLoading:i,hasNextPage:s,loadMore:n,emptyMessage:l,children:Ft})})})]})})})},ta=({rules:e,...o})=>N(M,{Component:K,defaultValue:[],inputProps:{...o,multiselect:!0},rules:e}),ra=({rules:e,...o})=>N(M,{Component:K,defaultValue:null,inputProps:{...o,multiselect:!1},rules:e}),na=e=>{let{multiselect:o}=e;return o?N(ta,{...e,multiselect:!0}):N(ra,{...e,multiselect:!1})};K.Controller=na;K.Option=rt;K.OptionLabel=Jn;import{useMemo as aa}from"react";import{jsx as xe,jsxs as sa}from"react/jsx-runtime";var dt=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,min:n,max:i,step:s,onlySlider:l=!1,className:c="",style:m={},autoFocus:d=!1,readOnly:p=!1,disabled:u=!1,placeholder:g="",autoComplete:y="off",isDirty:f=!1,isTouched:b=!1,invalid:v=!1,error:T,...x})=>{let C=aa(()=>crypto.randomUUID(),[]),R=B=>{r&&r(B);let H=parseInt(`${o}`);n!==void 0&&H<n&&t(n),i!==void 0&&H>i&&t(i),t(H)},{isFocus:w,handlers:L}=S({onBlur:R,onChange:B=>t(+B.target.value),onFocus:a}),F=h({"input-slider":!0,"is-focus":w});return xe(z,{id:C,error:T,isFocus:w,...x,children:sa("section",{className:F,children:[xe("input",{id:C,type:"range",name:e,className:`slider ${c}`,style:m,value:o,autoFocus:d,autoComplete:y,placeholder:g,disabled:u,readOnly:p,min:n,max:i,step:s,...L}),!l&&xe("input",{id:C,type:"number",name:e,className:`slider-number ${c}`,style:m,value:o,autoComplete:y,disabled:u,readOnly:p,min:n,max:i,step:s,...L})]})})},ia=({rules:e,...o})=>xe(M,{Component:dt,defaultValue:0,inputProps:o,rules:e});dt.Controller=ia;import{useMemo as la}from"react";import{jsx as Ye}from"react/jsx-runtime";var pt=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,rows:n=4,resize:i="vertical",className:s="",style:l={},autoFocus:c=!1,readOnly:m=!1,disabled:d=!1,placeholder:p="",autoComplete:u="off",isDirty:g=!1,isTouched:y=!1,invalid:f=!1,error:b,...v})=>{let T=la(()=>crypto.randomUUID(),[]),{handlers:x,isFocus:C}=S({onBlur:r,onChange:w=>t(w.target.value),onFocus:a}),R=h({textarea:!0,[s]:!!s});return Ye(z,{id:T,error:b,isFocus:C,...v,children:Ye("textarea",{id:T,name:e,className:R,style:{resize:i,...l},value:o,rows:n,...x,autoFocus:c,autoComplete:u,placeholder:p,disabled:d,readOnly:m})})},ca=({rules:e,...o})=>Ye(M,{Component:pt,defaultValue:"",inputProps:o,rules:e});pt.Controller=ca;import{useMemo as fa}from"react";import{useState as ua}from"react";import{cloneElement as da}from"react";import{Fragment as pa,jsx as mt,jsxs as ma}from"react/jsx-runtime";var ce=({position:e="top",children:o,content:t,offset:r=5,disabled:a=!1})=>{let{containerRef:n,openModal:i,closeModal:s,isOpen:l}=so(),c=h({tooltip:!0,[e]:!0});return O("mouseenter",()=>i(),n),O("mouseleave",()=>s(),n),a?o:ma(pa,{children:[da(o,{ref:n}),mt(U,{backdrop:"none",id:"tooltip",isOpen:l,containerRef:n,onClose:s,position:e,className:c,closeOnClickOutside:!1,offset:6+ +r,windowOffset:10,transitionDuration:100,closeAnimationClassName:"close-animation",children:mt("span",{className:"tooltip-content",children:t})})]})};import{jsx as ut}from"react/jsx-runtime";var Em=({children:e,value:o,position:t,offset:r,tooltipText:a,tooltipCopiedText:n,copiedTextTimeout:i=500})=>{let[s,l]=ua(!1);return ut(ce,{content:s&&n?n:a,position:t,offset:r,children:ut("span",{onClick:()=>{l(!0),navigator.clipboard.writeText(o),setTimeout(()=>l(!1),i)},children:e})})};import{jsx as G,jsxs as gt}from"react/jsx-runtime";var ft={small:1,regular:1.2,large:1.4},ht={small:2,regular:2.5,large:3},bt=({name:e,value:o,setValue:t,onBlur:r,onFocus:a,className:n="",style:i={},autoFocus:s=!1,readOnly:l=!1,disabled:c=!1,placeholder:m="",autoComplete:d="off",label:p,leftLabel:u,rightLabel:g,width:y="regular",size:f="regular",dotHoverSize:b=1.3,padding:v=.25,leftIcon:T,rightIcon:x,internalLeftIcon:C,internalRightIcon:R,leftIconTooltip:w,rightIconTooltip:L,color:F})=>{let B=fa(()=>crypto.randomUUID(),[]),{handlers:H}=S({onChange:Te=>t(Te.target.checked),onBlur:r,onFocus:a}),P=h({"switch-container":!0,[n]:!!n,[`color-${F}`]:!!F}),E=h({switch:!0,"is-checked":o,"is-readonly":!c&&l}),D=ft[f]??ft.regular,j=(ht[y]??ht.regular)*D,I=Math.min(v,D);return gt("section",{className:P,style:{...i,"--width":`${j}em`,"--dot-size":`${D}em`,"--dot-hover-size":`${D*Math.min(Math.max(b,1),2)}em`,"--padding":`${I}em`},children:[u?G(k,{variant:"label-form",className:"switch-label",htmlFor:B,children:u}):null,T!==void 0&&G(ce,{content:w,disabled:!w,offset:10,children:G(T,{size:`${D*.7}em`,className:"switch-icon",onClick:()=>t(!o)})}),gt("section",{className:E,children:[C!==void 0&&G("span",{className:"switch-internal-left-icon",children:G(C,{size:`${D*.7}em`})}),R!==void 0&&G("span",{className:"switch-internal-right-icon",children:G(R,{size:`${D*.7}em`})}),G("span",{className:"switch-dot"}),G("input",{id:B,type:"checkbox",name:e,className:`switch-checkbox ${n}`,style:i,checked:o,autoFocus:s,autoComplete:d,placeholder:m,disabled:c||l,...H})]}),x!==void 0&&G(ce,{content:L,disabled:!L,offset:10,children:G(x,{size:`${D*.7}em`,className:"switch-icon",onClick:()=>t(!o)})}),p||g?G(k,{variant:"label-form",className:"switch-label",htmlFor:B,children:p||g}):null]})},ha=({rules:e,...o})=>G(M,{Component:bt,defaultValue:!1,inputProps:o,rules:e});bt.Controller=ha;import{jsx as ga}from"react/jsx-runtime";var $m=({alt:e="",loading:o="eager",...t})=>ga("img",{loading:o,alt:e,...t,width:"100%"});import{useMemo as kt,useState as ka}from"react";import{useMemo as ba}from"react";import{MdArrowDownward as ya,MdArrowUpward as va}from"react-icons/md";import{jsx as oe,jsxs as yt}from"react/jsx-runtime";var vt=({header:e,sortBy:o,icon:t,width:r,field:a,toggleSortField:n,sortField:i,orderField:s,hidden:l})=>{let c=o!==void 0?o:a,m=h({"sort-on-click":!!c}),d=c?()=>n(c):void 0,p=ba(()=>c?oe("span",{className:"sort-icon",children:!!i&&i===c&&(s==="asc"?oe(va,{}):oe(ya,{}))}):null,[c,i,s]);return l?null:yt("th",{style:{width:r},className:m,onClick:d,children:[yt(le,{flow:"column",gap:"0.5em",jc:"space-between",ai:"center",children:[t?oe(t,{}):null,oe(k,{variant:"label",noPadding:!0,children:e}),p]}),oe(J,{color:"var(--primary-700)"})]})};import{jsx as je}from"react/jsx-runtime";var Ca=(e,{field:o,render:t,Component:r},a)=>{if(o&&e[o])return je(k,{noPadding:!0,nowrap:!0,children:e[o]});if(t)return t(e,a);if(r)return je(r,{data:e,rowKey:a})},Ct=(e,o,t)=>o.map((r,a)=>r.hidden?null:je("td",{children:Ca(e,r,t)},a)),xt=(e,o,t)=>o?e.toSorted((r,a)=>{let n=r[o],i=a[o];return["number","boolean","string"].includes(typeof n)&&["number","boolean","string"].includes(typeof i)?n===i?0:t==="asc"?n>i?1:-1:n>i?-1:1:0}):e;import{useCallback as xa,useState as Ta}from"react";var Tt=()=>{let[[e,o],t]=Ta([null,null]),r=xa(a=>{t(([n,i])=>a!==n?[a,"asc"]:i==="asc"?[a,"desc"]:[null,null])},[]);return{sortBy:e,order:o,toggleSortField:r}};import{jsx as Pa}from"react/jsx-runtime";var Pt=({data:e,columns:o,isSelected:t=!1,selectable:r=!1,rowKey:a})=>{let n=h({"row-selected":r&&t});return Pa("tr",{className:n,children:Ct(e,o,a)})};import{jsx as q,jsxs as Ra}from"react/jsx-runtime";var gu=({columns:e,data:o,width:t,selectable:r=!1,rowId:a,className:n="",tableClassName:i=""})=>{let[s,l]=ka({}),c=h({"smart-table":!0,[i]:!!i,"layout-fixed":t==="content","layout-scrollable":t==="scroll"}),m=h({"smart-table-container":!0,[n]:!!n}),{sortBy:d,order:p,toggleSortField:u}=Tt(),g=kt(()=>{let f=[...e];return r&&(f=[{header:`${Object.values(s).length}`,render:(b,v)=>q(ee,{name:`selected-${v}`,value:`${v}`in s,setValue:T=>{l(x=>{let C={...x};return T?C[`${v}`]=b:delete C[`${v}`],C})}})},...f]),f},[e,r,s]),y=kt(()=>xt(o,d,p),[o,d,p]);return q("section",{className:m,children:Ra("table",{className:c,children:[q("thead",{children:q("tr",{children:g.map((f,b)=>q(vt,{toggleSortField:u,sortField:d,orderField:p,...f},b))})}),q("tbody",{children:y.map(f=>q(Pt,{rowKey:f[a],data:f,columns:g,isSelected:`${f[a]}`in s,selectable:r},f[a]))})]})})};import{createContext as Ma,useContext as St,useEffect as Sa,useState as Na}from"react";import{useEffect as wa,useRef as Rt,useState as wt}from"react";import{jsx as Et,jsxs as Ea}from"react/jsx-runtime";var Xe={top:0,left:0,width:0,height:0};var Mt=({tabs:e=[],variant:o="solid",radius:t="full",direction:r="horizontal",color:a,children:n,openTab:i,size:s="medium",className:l="",style:c={}})=>{let m=Rt(null),d=Rt(null),[p,u]=wt(!1),[g,y]=wt(Xe),f=h({"tab-list":!0,[`variant-${o}`]:!!o,[`size-${s}`]:!!s,[`radius-${t}`]:!!t,[`color-${a}`]:!!a,"vertical-direction":r==="vertical",[l]:!!l});return wa(()=>{let b=d.current?.getBoundingClientRect()??Xe,v=m.current?.getBoundingClientRect()??Xe,T=b.width,x=o==="line"?2:b.height,C=b.left-v.left,R=o==="line"?b.top+b.height-v.top:b.top-v.top;y({left:C,top:R,width:T,height:x}),p||setTimeout(()=>{u(!0)},100)},[p,o,i]),Ea("section",{className:f,ref:m,style:c,children:[!!o&&Et("span",{className:`tabs-selector ${p?"active":""}`,style:g}),e.map(({id:b,label:v})=>Et(de.Tab,{id:b,ref:b===i?d:void 0,children:v},b)),n]})};import{jsx as Qe}from"react/jsx-runtime";var We=Ma(null),Nt=e=>{let o=St(We);if(!o)throw new Error("You cant use this component out off an Tabs component");let{openTab:t,changeOpenTab:r}=o;return[t===e,()=>r(e)]},Ia=()=>{let e=St(We);if(!e)throw new Error("You cant use this component out off an Tabs component");return e},de=({children:e,defaultOpenTab:o,onChange:t})=>{let[r,a]=Na(o);return Sa(()=>{t&&t(r)},[r,t]),Qe(We.Provider,{value:{openTab:r,changeOpenTab:n=>a(n)},children:e})},Oa=({id:e,children:o,className:t="",style:r={},onClick:a,ref:n})=>{let[i,s]=Nt(e),l=h({tab:!0,[t]:!!t,"is-open":i});return Qe("span",{className:l,style:r,onClick:m=>{s(),a&&a(m)},ref:n,children:o})},La=({id:e,children:o})=>{let[t]=Nt(e);return t?o:null},Fa=({children:e,...o})=>{let{openTab:t}=Ia();return Qe(Mt,{...o,openTab:t,children:e})};de.Tab=Oa;de.TabPanel=La;de.TabList=Fa;import{jsx as Da}from"react/jsx-runtime";var Aa=(n=>(n.NONE="none",n.SMALL="small",n.MEDIUM="medium",n.LARGE="large",n.FULL="full",n))(Aa||{}),Bu=({children:e,rounded:o="medium",selected:t=!1,noWrap:r=!1,ref:a})=>{let n=h({tag:!0,[`rounded-${o}`]:!!o,"is-selected":t,"no-wrap":r});return Da("span",{className:n,ref:a,children:e})};export{Ui as Accordion,Is as AccordionItem,ie as ActionModal,zc as AsideModal,Fo as Backdrop,ko as Button,ee as Checkbox,Em as ClickToCopy,jc as ConfirmationModal,Js as Cursor,So as DatePicker,z as Field,$r as FieldOrientation,Br as FieldVariant,Ji as FlipCard,cs as HoverCard,$m as Image,et as InfinityScroll,No as Input,Vo as InputColor,jo as InputFile,Zo as InputNumber,Oo as InputPassword,fe as Line,mr as LineOrientation,ur as LineStyle,_ as Menu,U as Modal,Jr as ModalBackdrop,Lo as Portal,qo as Radio,J as Ripple,K as Select,vo as SlideCard,dt as Slider,gu as SmartTable,bt as Switch,de as Tabs,Bu as Tag,Aa as TagRounded,pt as Textarea,ce as Tooltip,k as Typography,yo as useAccordionItem};
2
+
3
+ // src/components/accordion/accordion.component.tsx
4
+ import { createContext, useCallback as useCallback5, useContext, useMemo as useMemo3, useState as useState9 } from "react";
5
+
6
+ // src/hooks/use-classnames.ts
7
+ import { useMemo } from "react";
8
+ var useClassNames = (classes) => useMemo(
9
+ () => Object.entries(classes).reduce(
10
+ (compiledClassNames, [classname, value]) => value ? [...compiledClassNames, classname] : compiledClassNames,
11
+ []
12
+ ).join(" "),
13
+ [classes]
14
+ );
15
+
16
+ // src/hooks/use-event-listener.ts
17
+ import { useEffect, useLayoutEffect, useRef } from "react";
18
+ function useEventListener(eventName, callback, element, options) {
19
+ const callbackRef = useRef(callback);
20
+ useEffect(() => {
21
+ callbackRef.current = callback;
22
+ }, [callback]);
23
+ useLayoutEffect(() => {
24
+ const targetElement = element?.current ?? window;
25
+ if (!(targetElement && targetElement.addEventListener)) return;
26
+ const listener = (event) => callbackRef.current(event);
27
+ targetElement.addEventListener(eventName, listener, options);
28
+ return () => {
29
+ targetElement.removeEventListener(eventName, listener, options);
30
+ };
31
+ }, [eventName, element, options]);
32
+ }
33
+
34
+ // src/hooks/use-click-outside.ts
35
+ var checkIsOutside = (ref, target) => {
36
+ return ref.current && !ref.current.contains(target);
37
+ };
38
+ var useClickOutside = (ref, callback) => {
39
+ useEventListener("keydown", (e) => {
40
+ if (e.key === "Escape") {
41
+ callback();
42
+ }
43
+ });
44
+ useEventListener("mousedown", (event) => {
45
+ const target = event.target;
46
+ if (!target?.isConnected) {
47
+ return;
48
+ }
49
+ const isOutside = (Array.isArray(ref) ? ref : [ref]).every((r) => checkIsOutside(r, target));
50
+ if (isOutside) {
51
+ callback();
52
+ }
53
+ });
54
+ };
55
+
56
+ // src/hooks/use-debounce.ts
57
+ import { useEffect as useEffect2, useState } from "react";
58
+ var useDebounce = (value, delay = 500) => {
59
+ const [debouncedValue, setDebouncedValue] = useState(value);
60
+ useEffect2(() => {
61
+ const timer = setTimeout(() => setDebouncedValue(value), delay);
62
+ return () => {
63
+ clearTimeout(timer);
64
+ };
65
+ }, [value, delay]);
66
+ return debouncedValue;
67
+ };
68
+
69
+ // src/hooks/use-resize-observer.ts
70
+ import { useEffect as useEffect3 } from "react";
71
+ var useResizeObserver = (ref, callback) => {
72
+ useEffect3(() => {
73
+ const refs = Array.isArray(ref) ? ref : [ref];
74
+ const observer = new ResizeObserver(callback);
75
+ refs.forEach((r) => r.current && observer.observe(r.current));
76
+ return () => {
77
+ observer.disconnect();
78
+ };
79
+ }, [ref, callback]);
80
+ };
81
+
82
+ // src/hooks/use-dom-container.ts
83
+ import { useEffect as useEffect4, useState as useState2 } from "react";
84
+ var createContainer = (containerID) => {
85
+ let domContainer = document.getElementById(containerID);
86
+ if (domContainer === null) {
87
+ domContainer = document.createElement("div");
88
+ domContainer.setAttribute("id", containerID);
89
+ document.body.appendChild(domContainer);
90
+ }
91
+ return domContainer;
92
+ };
93
+ var useDomContainer = (containerID) => {
94
+ const [container, setContainer] = useState2(() => createContainer(containerID));
95
+ useEffect4(() => {
96
+ const domContainer = document.getElementById(containerID);
97
+ if (container === null || domContainer === null) {
98
+ const domContainer2 = createContainer(containerID);
99
+ setContainer(domContainer2);
100
+ }
101
+ return () => {
102
+ if (container && container.parentNode && process.env.NODE_ENV === "production") {
103
+ document.body.removeChild(container);
104
+ }
105
+ };
106
+ }, [container, containerID]);
107
+ return container;
108
+ };
109
+
110
+ // src/helpers/format-bytes.ts
111
+ var formatBytes = (bytes, decimals = 2) => {
112
+ if (bytes === 0) return "0 Bytes";
113
+ const k = 1e3;
114
+ const dm = decimals < 0 ? 0 : decimals;
115
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
116
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
117
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i];
118
+ };
119
+
120
+ // src/helpers/get-modal-position.ts
121
+ var getModalPosition = ({ c, m, offset, position }) => {
122
+ let top = c.y + c.h + offset;
123
+ let left = c.x - (m.w - c.w) * (50 / 100);
124
+ switch (position) {
125
+ case "top" /* TOP */:
126
+ case "top center" /* TOP_CENTER */:
127
+ top = c.y - m.h - offset;
128
+ left = c.x - (m.w - c.w) / 2;
129
+ break;
130
+ case "top left" /* TOP_LEFT */:
131
+ top = c.y - m.h - offset;
132
+ left = c.x - m.w + c.w;
133
+ break;
134
+ case "top right" /* TOP_RIGHT */:
135
+ top = c.y - m.h - offset;
136
+ left = c.x;
137
+ break;
138
+ case "bottom" /* BOTTOM */:
139
+ case "bottom center" /* BOTTOM_CENTER */:
140
+ top = c.y + c.h + offset;
141
+ left = c.x - (m.w - c.w) / 2;
142
+ break;
143
+ case "bottom left" /* BOTTOM_LEFT */:
144
+ top = c.y + c.h + offset;
145
+ left = c.x - m.w + c.w;
146
+ break;
147
+ case "bottom right" /* BOTTOM_RIGHT */:
148
+ top = c.y + c.h + offset;
149
+ left = c.x;
150
+ break;
151
+ case "left" /* LEFT */:
152
+ case "left center" /* LEFT_CENTER */:
153
+ top = c.y - (m.h - c.h) / 2;
154
+ left = c.x - m.w - offset;
155
+ break;
156
+ case "left top" /* LEFT_TOP */:
157
+ top = c.y - m.h + c.h;
158
+ left = c.x - m.w - offset;
159
+ break;
160
+ case "left bottom" /* LEFT_BOTTOM */:
161
+ top = c.y;
162
+ left = c.x - m.w - offset;
163
+ break;
164
+ case "right" /* RIGHT */:
165
+ case "right center" /* RIGHT_CENTER */:
166
+ top = c.y - (m.h - c.h) / 2;
167
+ left = c.x + c.w + offset;
168
+ break;
169
+ case "right top" /* RIGHT_TOP */:
170
+ top = c.y - m.h + c.h;
171
+ left = c.x + c.w + offset;
172
+ break;
173
+ case "right bottom" /* RIGHT_BOTTOM */:
174
+ top = c.y;
175
+ left = c.x + c.w + offset;
176
+ break;
177
+ }
178
+ return {
179
+ left: Math.round(left),
180
+ top: Math.round(top)
181
+ };
182
+ };
183
+ var getOppositePosition = ({ top, left }, position, windowOffset, m) => {
184
+ const positions = position.split(" ");
185
+ const newPosition = [];
186
+ const rightOffset = left + m.w + windowOffset - window.innerWidth;
187
+ const bottomOffset = top + m.h + windowOffset - window.innerHeight;
188
+ for (const p of positions) {
189
+ if (p === "top" /* TOP */ && top < windowOffset) {
190
+ newPosition.push("bottom" /* BOTTOM */);
191
+ } else if (p === "left" /* LEFT */ && left < windowOffset) {
192
+ newPosition.push("right" /* RIGHT */);
193
+ } else if (p === "bottom" /* BOTTOM */ && bottomOffset > 0) {
194
+ newPosition.push("top" /* TOP */);
195
+ } else if (p === "right" /* RIGHT */ && rightOffset > 0) {
196
+ newPosition.push("left" /* LEFT */);
197
+ } else {
198
+ newPosition.push(p);
199
+ }
200
+ }
201
+ return newPosition.join(" ");
202
+ };
203
+ var fixModalPosition = ({ top, left }, m, windowOffset) => {
204
+ const rightOffset = left + m.w + windowOffset - window.innerWidth;
205
+ const bottomOffset = top + m.h + windowOffset - window.innerHeight;
206
+ left = rightOffset > 0 ? left - rightOffset : left;
207
+ top = bottomOffset > 0 ? top - bottomOffset : top;
208
+ left = left < windowOffset ? windowOffset : left;
209
+ top = top < windowOffset ? windowOffset : top;
210
+ return { top, left };
211
+ };
212
+ var getModalPositionRelativeToContainer = ({
213
+ c,
214
+ m,
215
+ offset,
216
+ windowOffset,
217
+ position
218
+ }) => {
219
+ const params = { c, m, offset, position };
220
+ let modalContainerStyle = getModalPosition(params);
221
+ const oppositePosition = getOppositePosition(modalContainerStyle, position, windowOffset, m);
222
+ if (oppositePosition !== position) {
223
+ modalContainerStyle = getModalPosition({
224
+ ...params,
225
+ position: oppositePosition
226
+ });
227
+ }
228
+ const fixedPosition = fixModalPosition(modalContainerStyle, m, windowOffset);
229
+ return {
230
+ left: `${fixedPosition.left}px`,
231
+ top: `${fixedPosition.top}px`
232
+ };
233
+ };
234
+
235
+ // src/helpers/get-modal-position-relative-to-screen.ts
236
+ var getModalPositionRelativeToScreen = ({
237
+ position,
238
+ windowOffset
239
+ }) => {
240
+ switch (position) {
241
+ case "center" /* CENTER */:
242
+ return {
243
+ top: "50%",
244
+ left: "50%",
245
+ transform: "translate(-50%, -50%)"
246
+ };
247
+ case "top" /* TOP */:
248
+ case "top center" /* TOP_CENTER */:
249
+ return {
250
+ top: `${windowOffset}px`,
251
+ left: "50%",
252
+ transform: "translateX(-50%)"
253
+ };
254
+ case "top left" /* TOP_LEFT */:
255
+ case "left top" /* LEFT_TOP */:
256
+ return {
257
+ top: `${windowOffset}px`,
258
+ left: `${windowOffset}px`
259
+ };
260
+ case "top right" /* TOP_RIGHT */:
261
+ case "right top" /* RIGHT_TOP */:
262
+ return {
263
+ top: `${windowOffset}px`,
264
+ right: `${windowOffset}px`
265
+ };
266
+ case "bottom" /* BOTTOM */:
267
+ case "bottom center" /* BOTTOM_CENTER */:
268
+ return {
269
+ bottom: `${windowOffset}px`,
270
+ left: "50%",
271
+ transform: "translateX(-50%)"
272
+ };
273
+ case "left bottom" /* LEFT_BOTTOM */:
274
+ case "bottom left" /* BOTTOM_LEFT */:
275
+ return {
276
+ bottom: `${windowOffset}px`,
277
+ left: `${windowOffset}px`
278
+ };
279
+ case "right bottom" /* RIGHT_BOTTOM */:
280
+ case "bottom right" /* BOTTOM_RIGHT */:
281
+ return {
282
+ bottom: `${windowOffset}px`,
283
+ right: `${windowOffset}px`
284
+ };
285
+ case "left" /* LEFT */:
286
+ case "left center" /* LEFT_CENTER */:
287
+ return {
288
+ top: "50%",
289
+ left: `${windowOffset}px`,
290
+ transform: "translateY(-50%)"
291
+ };
292
+ case "right" /* RIGHT */:
293
+ case "right center" /* RIGHT_CENTER */:
294
+ return {
295
+ top: "50%",
296
+ right: `${windowOffset}px`,
297
+ transform: "translateY(-50%)"
298
+ };
299
+ }
300
+ return {
301
+ top: "50%",
302
+ left: "50%",
303
+ transform: "translate(-50%, -50%)"
304
+ };
305
+ };
306
+
307
+ // src/hooks/use-in-view.ts
308
+ import { useRef as useRef2, useState as useState3 } from "react";
309
+
310
+ // src/hooks/use-intersection-observer.ts
311
+ import { useEffect as useEffect5 } from "react";
312
+ var useIntersectionObserver = (ref, callback, initOptions = {}) => {
313
+ useEffect5(() => {
314
+ const refs = Array.isArray(ref) ? ref : [ref];
315
+ const observer = new IntersectionObserver(callback, initOptions);
316
+ refs.forEach((r) => r.current && observer.observe(r.current));
317
+ return () => {
318
+ observer.disconnect();
319
+ };
320
+ }, [callback, initOptions, ref]);
321
+ };
322
+
323
+ // src/hooks/use-in-view.ts
324
+ var useInView = (initOptions = {}) => {
325
+ const [inView, setInView] = useState3(false);
326
+ const ref = useRef2(null);
327
+ useIntersectionObserver(
328
+ ref,
329
+ ([entry]) => {
330
+ setInView(entry.isIntersecting);
331
+ },
332
+ initOptions
333
+ );
334
+ return { ref, inView };
335
+ };
336
+
337
+ // src/hooks/use-input-handlers.ts
338
+ import { useCallback, useState as useState4 } from "react";
339
+ var useInputHandlers = ({
340
+ onBlur,
341
+ onFocus,
342
+ onChange
343
+ } = {}) => {
344
+ const [isFocus, setIsFocus] = useState4(false);
345
+ const handleFocus = useCallback(
346
+ (e) => {
347
+ setIsFocus(true);
348
+ onFocus && onFocus(e);
349
+ },
350
+ [onFocus]
351
+ );
352
+ const handleBlur = useCallback(
353
+ (e) => {
354
+ setIsFocus(false);
355
+ onBlur && onBlur(e);
356
+ },
357
+ [onBlur]
358
+ );
359
+ const handleChange = useCallback(
360
+ (e) => {
361
+ onChange && onChange(e);
362
+ },
363
+ [onChange]
364
+ );
365
+ return {
366
+ isFocus,
367
+ handlers: {
368
+ onFocus: handleFocus,
369
+ onBlur: handleBlur,
370
+ onChange: handleChange
371
+ }
372
+ };
373
+ };
374
+
375
+ // src/hooks/use-media-query.ts
376
+ import { useEffect as useEffect6, useState as useState5 } from "react";
377
+ var useMediaQuery = (query) => {
378
+ const [matches, setMatches] = useState5(false);
379
+ useEffect6(() => {
380
+ const media = window.matchMedia(query);
381
+ if (media.matches !== matches) {
382
+ setMatches(media.matches);
383
+ }
384
+ const listener = () => {
385
+ setMatches(media.matches);
386
+ };
387
+ media.addEventListener("change", listener);
388
+ return () => {
389
+ media.removeEventListener("change", listener);
390
+ };
391
+ }, [matches, query]);
392
+ return matches;
393
+ };
394
+
395
+ // src/hooks/use-modal.ts
396
+ import { useRef as useRef3, useState as useState6 } from "react";
397
+ var useModal = () => {
398
+ const containerRef = useRef3(null);
399
+ const [isOpen, setIsOpen] = useState6(false);
400
+ const openModal = () => {
401
+ setIsOpen(true);
402
+ };
403
+ const closeModal = () => {
404
+ setIsOpen(false);
405
+ };
406
+ return {
407
+ containerRef,
408
+ isOpen,
409
+ openModal,
410
+ closeModal
411
+ };
412
+ };
413
+
414
+ // src/hooks/use-modal-in-container.ts
415
+ import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "react";
416
+ var convertDOMRectToPosition = (rect) => ({
417
+ x: rect.x,
418
+ y: rect.y,
419
+ w: rect.width,
420
+ h: rect.height,
421
+ top: rect.top,
422
+ left: rect.left
423
+ });
424
+ var useModalInContainer = ({
425
+ offset = 0,
426
+ windowOffset = 0,
427
+ position = "bottom" /* BOTTOM */,
428
+ modalRef,
429
+ containerRef,
430
+ isOpen
431
+ }) => {
432
+ const containerTemporalRef = useRef4(null);
433
+ const getPosition = useCallback2(
434
+ (modalRef2, containerRef2) => {
435
+ const modal = modalRef2.current?.getClientRects()[0];
436
+ const container = containerRef2.current?.getClientRects()[0];
437
+ if (!modal) {
438
+ return;
439
+ }
440
+ const modalStyle = !container ? getModalPositionRelativeToScreen({ position, windowOffset }) : getModalPositionRelativeToContainer({
441
+ c: convertDOMRectToPosition(container),
442
+ m: convertDOMRectToPosition(modal),
443
+ offset,
444
+ windowOffset,
445
+ position
446
+ });
447
+ Object.keys(modalStyle).forEach((key) => {
448
+ modalRef2.current?.style.setProperty(key, modalStyle[key]);
449
+ });
450
+ },
451
+ [position, windowOffset, offset]
452
+ );
453
+ const callback = useCallback2(() => {
454
+ if (isOpen) {
455
+ getPosition(modalRef, containerRef ?? containerTemporalRef);
456
+ }
457
+ }, [getPosition, isOpen, containerRef, modalRef]);
458
+ useLayoutEffect2(callback, [callback]);
459
+ useResizeObserver(containerRef ?? containerTemporalRef, callback);
460
+ useResizeObserver(modalRef, callback);
461
+ useEventListener("resize", callback);
462
+ useEventListener("scroll", callback, modalRef);
463
+ };
464
+
465
+ // src/hooks/use-modal-transition.ts
466
+ import React2, { useCallback as useCallback3, useEffect as useEffect7, useLayoutEffect as useLayoutEffect3, useMemo as useMemo2 } from "react";
467
+ var useModalTransition = ({ transitionDuration = 0, isOpen }) => {
468
+ const [modalState, setModalState] = React2.useState("CLOSED" /* CLOSED */);
469
+ const isVisible = useMemo2(() => {
470
+ return modalState !== "CLOSED" /* CLOSED */;
471
+ }, [modalState]);
472
+ useEffect7(() => {
473
+ document.documentElement.style.overflow = isVisible ? "hidden" : "auto";
474
+ }, [isVisible]);
475
+ const closeModal = useCallback3(() => {
476
+ if (["OPENING" /* OPENING */, "OPEN" /* OPEN */].includes(modalState)) {
477
+ if (transitionDuration > 0) {
478
+ setModalState("CLOSING" /* CLOSING */);
479
+ setTimeout(() => {
480
+ setModalState("CLOSED" /* CLOSED */);
481
+ }, transitionDuration);
482
+ } else {
483
+ setModalState("CLOSED" /* CLOSED */);
484
+ }
485
+ }
486
+ }, [modalState, transitionDuration]);
487
+ const openModal = useCallback3(() => {
488
+ if (["CLOSING" /* CLOSING */, "CLOSED" /* CLOSED */].includes(modalState)) {
489
+ if (transitionDuration > 0) {
490
+ setModalState("OPENING" /* OPENING */);
491
+ setTimeout(() => {
492
+ setModalState("OPEN" /* OPEN */);
493
+ }, transitionDuration);
494
+ } else {
495
+ setModalState("OPEN" /* OPEN */);
496
+ }
497
+ }
498
+ }, [modalState, transitionDuration]);
499
+ useLayoutEffect3(() => {
500
+ if (modalState === "CLOSED" /* CLOSED */ && isOpen) {
501
+ openModal();
502
+ } else if (modalState === "OPEN" /* OPEN */ && !isOpen) {
503
+ closeModal();
504
+ }
505
+ }, [isOpen, openModal, closeModal, modalState]);
506
+ return {
507
+ isVisible,
508
+ modalState
509
+ };
510
+ };
511
+
512
+ // src/hooks/use-mouse-position.ts
513
+ import { useRef as useRef5, useState as useState7 } from "react";
514
+ var getMousePosition = (domRect, e) => {
515
+ const { left, top } = domRect;
516
+ const containerPositionX = left + window.scrollX;
517
+ const containerPositionY = top + window.scrollY;
518
+ const containerX = e.pageX - containerPositionX;
519
+ const containerY = e.pageY - containerPositionY;
520
+ return {
521
+ x: e.pageX,
522
+ y: e.pageY,
523
+ elementX: containerX,
524
+ elementY: containerY,
525
+ elementPositionX: containerPositionX,
526
+ elementPositionY: containerPositionY
527
+ };
528
+ };
529
+ var useMousePosition = (containerRef) => {
530
+ const ref = useRef5(null);
531
+ const [position, setPosition] = useState7({
532
+ x: null,
533
+ y: null,
534
+ elementX: null,
535
+ elementY: null,
536
+ elementPositionX: null,
537
+ elementPositionY: null
538
+ });
539
+ const mouseMove = (e) => {
540
+ const { clientX, clientY } = e;
541
+ setPosition((prev) => ({ ...prev, x: clientX, y: clientY }));
542
+ if (containerRef?.current instanceof Element) {
543
+ const newState = getMousePosition(containerRef.current.getBoundingClientRect(), e);
544
+ setPosition((prev) => ({
545
+ ...prev,
546
+ ...newState
547
+ }));
548
+ } else if (ref.current instanceof Element) {
549
+ const newState = getMousePosition(ref.current.getBoundingClientRect(), e);
550
+ setPosition((prev) => ({
551
+ ...prev,
552
+ ...newState
553
+ }));
554
+ }
555
+ };
556
+ useEventListener("mousemove", mouseMove);
557
+ return { ...position, ref };
558
+ };
559
+
560
+ // src/hooks/use-toggle-values.ts
561
+ import { useCallback as useCallback4, useState as useState8 } from "react";
562
+ var useToggleValues = (values, defaultIndex = 0) => {
563
+ const [index, setIndex] = useState8(defaultIndex);
564
+ const toggle = useCallback4(
565
+ (index2) => {
566
+ setIndex(index2 !== void 0 ? index2 : (prev) => (prev + 1) % values.length);
567
+ },
568
+ [values.length]
569
+ );
570
+ return [values[index], toggle];
571
+ };
572
+
573
+ // src/components/line/line.component.tsx
574
+ import { jsx } from "react/jsx-runtime";
575
+ var LineOrientation = /* @__PURE__ */ ((LineOrientation2) => {
576
+ LineOrientation2["VERTICAL"] = "vertical";
577
+ LineOrientation2["HORIZONTAL"] = "horizontal";
578
+ return LineOrientation2;
579
+ })(LineOrientation || {});
580
+ var LineStyle = /* @__PURE__ */ ((LineStyle2) => {
581
+ LineStyle2["SOLID"] = "solid";
582
+ LineStyle2["DOTTED"] = "dotted";
583
+ LineStyle2["DASHED"] = "dashed";
584
+ return LineStyle2;
585
+ })(LineStyle || {});
586
+ var Line = ({
587
+ orientation = "horizontal" /* HORIZONTAL */,
588
+ className = "",
589
+ style = {},
590
+ color = "currentColor",
591
+ size = 1,
592
+ lineStyle = "solid" /* SOLID */,
593
+ dashedSize = 1,
594
+ spacing = 1
595
+ }) => {
596
+ const classNames = useClassNames({
597
+ "custom-line": true,
598
+ [orientation]: true,
599
+ [className]: !!className,
600
+ [lineStyle]: true
601
+ });
602
+ return /* @__PURE__ */ jsx(
603
+ "span",
604
+ {
605
+ className: classNames,
606
+ style: {
607
+ ...style,
608
+ "--color": color,
609
+ "--size": `${size}px`,
610
+ "--spacing": `${spacing}px`,
611
+ "--dashSize": `${dashedSize}px`
612
+ }
613
+ }
614
+ );
615
+ };
616
+
617
+ // src/components/accordion/accordion.component.tsx
618
+ import { jsx as jsx2 } from "react/jsx-runtime";
619
+ var AccordionContext = createContext(null);
620
+ var useAccordionItem = (id) => {
621
+ const context = useContext(AccordionContext);
622
+ if (!context) {
623
+ throw new Error("You cant use this component out off an Accordion component");
624
+ }
625
+ const { toggleItem, openedItems } = context;
626
+ const toggle = () => toggleItem(id);
627
+ return [openedItems.includes(id), toggle];
628
+ };
629
+ var Accordion = ({
630
+ children,
631
+ className = "",
632
+ noSeparators,
633
+ multiple,
634
+ style = {},
635
+ defaultOpened = []
636
+ }) => {
637
+ const [openedItems, setOpenedItems] = useState9(() => {
638
+ return (Array.isArray(defaultOpened) ? defaultOpened : [defaultOpened]).reduce((acc, id) => {
639
+ return typeof id === "string" ? { ...acc, [id]: true } : acc;
640
+ }, {});
641
+ });
642
+ const toggleItem = useCallback5(
643
+ (id) => {
644
+ setOpenedItems((prev) => ({ ...multiple ? prev : {}, [id]: !prev[id] }));
645
+ },
646
+ [multiple]
647
+ );
648
+ const openedItemsIDs = useMemo3(() => Object.keys(openedItems).filter((id) => openedItems[id]), [openedItems]);
649
+ const accordionClassName = useClassNames({
650
+ accordion: true,
651
+ [className]: Boolean(className)
652
+ });
653
+ return /* @__PURE__ */ jsx2(
654
+ AccordionContext.Provider,
655
+ {
656
+ value: {
657
+ toggleItem,
658
+ openedItems: openedItemsIDs
659
+ },
660
+ children: /* @__PURE__ */ jsx2("section", { className: accordionClassName, style, children: (Array.isArray(children) ? children : [children]).flatMap((child, key) => {
661
+ return key === 0 ? child : [noSeparators ? null : /* @__PURE__ */ jsx2(Line, { orientation: "horizontal" }, `${key}.5`), child];
662
+ }) })
663
+ }
664
+ );
665
+ };
666
+
667
+ // src/components/accordion/accordion-item.tsx
668
+ import { useMemo as useMemo6 } from "react";
669
+ import { FaCaretLeft } from "react-icons/fa";
670
+
671
+ // src/components/cards/slide-card/slide-card.component.tsx
672
+ import { jsx as jsx3 } from "react/jsx-runtime";
673
+ var SlideCard = ({ children, isOpen, className = "", style = {} }) => {
674
+ return /* @__PURE__ */ jsx3(
675
+ "section",
676
+ {
677
+ className,
678
+ style: {
679
+ overflow: "hidden",
680
+ height: isOpen ? "auto" : 0,
681
+ transition: "height 300ms ease",
682
+ interpolateSize: "allow-keywords",
683
+ ...style
684
+ },
685
+ children
686
+ }
687
+ );
688
+ };
689
+
690
+ // src/components/cards/flip-card/flip-card.component.tsx
691
+ import { useMemo as useMemo4 } from "react";
692
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
693
+ var FlipCard = ({
694
+ cardZIndex = "auto",
695
+ flipDirection = "vertical",
696
+ flipSpeed = 500,
697
+ isFlipped = false,
698
+ children
699
+ }) => {
700
+ const getComponent = (key) => {
701
+ if (children.length !== 2) {
702
+ throw new Error("Component FlipCard requires 2 children");
703
+ }
704
+ return children[key];
705
+ };
706
+ const frontRotate = useMemo4(() => {
707
+ const deg = isFlipped ? 180 : 0;
708
+ return `rotate${flipDirection === "horizontal" ? "Y" : "X"}(${deg}deg)`;
709
+ }, [flipDirection, isFlipped]);
710
+ const backRotate = useMemo4(() => {
711
+ const deg = isFlipped ? 0 : -180;
712
+ return `rotate${flipDirection === "horizontal" ? "Y" : "X"}(${deg}deg)`;
713
+ }, [flipDirection, isFlipped]);
714
+ const className = useClassNames({
715
+ "flip-card": true,
716
+ "is-flipped": isFlipped
717
+ });
718
+ return /* @__PURE__ */ jsx4(
719
+ "section",
720
+ {
721
+ className,
722
+ style: {
723
+ "--cardZIndex": cardZIndex,
724
+ "--flipSpeed": `${flipSpeed}ms`,
725
+ "--frontRotate": frontRotate,
726
+ "--backRotate": backRotate
727
+ },
728
+ children: /* @__PURE__ */ jsxs("section", { className: "flipper", children: [
729
+ /* @__PURE__ */ jsx4("section", { className: "front", children: getComponent(0) }),
730
+ /* @__PURE__ */ jsx4("section", { className: "back", children: getComponent(1) })
731
+ ] })
732
+ }
733
+ );
734
+ };
735
+
736
+ // src/components/cards/hover-card/hover-card.component.tsx
737
+ import { useCallback as useCallback6, useRef as useRef6 } from "react";
738
+ import { jsx as jsx5 } from "react/jsx-runtime";
739
+ var HoverCard = ({
740
+ children,
741
+ threshold = 5,
742
+ translationZ = 25,
743
+ width = "fit-content",
744
+ className = ""
745
+ }) => {
746
+ const refCard = useRef6(null);
747
+ const refLayer = useRef6(null);
748
+ const mouseMoveCallback = useCallback6(
749
+ (e) => {
750
+ const card = refCard.current;
751
+ const layer = refLayer.current;
752
+ if (!card || !layer) return;
753
+ const { clientX, clientY, currentTarget } = e;
754
+ const { clientWidth, clientHeight } = currentTarget;
755
+ const { top, left } = card.getBoundingClientRect();
756
+ const horizontal = (clientX - left) / clientWidth;
757
+ const vertical = (clientY - top) / clientHeight;
758
+ const relativePercentageX = horizontal * 2 - 1;
759
+ const relativePercentageY = vertical * 2 - 1;
760
+ const rotateY = (relativePercentageY * threshold).toFixed(2);
761
+ const rotateX = (relativePercentageX * threshold).toFixed(2);
762
+ layer.style.transform = `perspective(${clientWidth}px) rotateX(${-rotateY}deg) rotateY(${rotateX}deg)`;
763
+ card.style.transform = `perspective(${clientWidth}px) translateZ(${translationZ}px)`;
764
+ },
765
+ [threshold, translationZ]
766
+ );
767
+ const mouseLeaveCallback = useCallback6((e) => {
768
+ const card = refCard.current;
769
+ const layer = refLayer.current;
770
+ if (!card || !layer) return;
771
+ layer.style.transform = `perspective(${e.currentTarget.clientWidth}px) rotateX(0) rotateY(0)`;
772
+ card.style.transform = `perspective(${e.currentTarget.clientWidth}px) translateZ(0)`;
773
+ }, []);
774
+ useEventListener("mousemove", mouseMoveCallback, refCard);
775
+ useEventListener("mouseleave", mouseLeaveCallback, refCard);
776
+ const cardClassName = useClassNames({
777
+ "hover-card": true,
778
+ [className]: Boolean(className)
779
+ });
780
+ return /* @__PURE__ */ jsx5("span", { ref: refCard, style: { width }, className: cardClassName, children: /* @__PURE__ */ jsx5("span", { className: "card-hover-layer", ref: refLayer, children }) });
781
+ };
782
+
783
+ // src/components/typography/typography.component.tsx
784
+ import { createElement, useMemo as useMemo5 } from "react";
785
+
786
+ // src/components/typography/typography.constants.ts
787
+ var TypographyVariantsElements = {
788
+ ["hero" /* HERO */]: "h1",
789
+ ["header1" /* HEADER1 */]: "h1",
790
+ ["header2" /* HEADER2 */]: "h2",
791
+ ["header3" /* HEADER3 */]: "h3",
792
+ ["header4" /* HEADER4 */]: "h4",
793
+ ["body" /* BODY */]: "p",
794
+ ["label" /* LABEL */]: "span",
795
+ ["label-form" /* LABEL_FORM */]: "label",
796
+ ["small" /* SMALL */]: "small"
797
+ };
798
+ var TypographyVariantsClassNames = {
799
+ ["hero" /* HERO */]: "hero",
800
+ ["header1" /* HEADER1 */]: "header1",
801
+ ["header2" /* HEADER2 */]: "header2",
802
+ ["header3" /* HEADER3 */]: "header3",
803
+ ["header4" /* HEADER4 */]: "header4",
804
+ ["body" /* BODY */]: "body",
805
+ ["label" /* LABEL */]: "label",
806
+ ["label-form" /* LABEL_FORM */]: "label",
807
+ ["small" /* SMALL */]: "small"
808
+ };
809
+
810
+ // src/components/typography/typography.component.tsx
811
+ var Typography = ({
812
+ variant = "body" /* BODY */,
813
+ nowrap = false,
814
+ className: customClassname = "",
815
+ style = {},
816
+ children,
817
+ as,
818
+ weight,
819
+ family = "primary",
820
+ noPadding = false,
821
+ align,
822
+ color,
823
+ htmlFor,
824
+ recommendedWidth = false,
825
+ ...props
826
+ }) => {
827
+ const className = useClassNames({
828
+ typography: true,
829
+ [TypographyVariantsClassNames[variant]]: TypographyVariantsClassNames[variant] !== void 0,
830
+ [customClassname]: !!customClassname,
831
+ [weight ?? ""]: !!weight,
832
+ [color ?? ""]: Boolean(color),
833
+ "no-padding": noPadding,
834
+ "code-family": family === "code",
835
+ "recommended-width": recommendedWidth,
836
+ "nowrap-max-lines": typeof nowrap === "number",
837
+ "nowrap-max-lines-2": nowrap === 2,
838
+ "nowrap-max-lines-3": nowrap === 3,
839
+ "nowrap-max-lines-4": nowrap === 4,
840
+ "nowrap-max-lines-5": nowrap === 5,
841
+ nowrap: nowrap === true
842
+ });
843
+ const component = useMemo5(
844
+ () => TypographyVariantsElements[variant] ?? TypographyVariantsElements["body" /* BODY */],
845
+ [variant]
846
+ );
847
+ return createElement(
848
+ as ?? component,
849
+ {
850
+ ...props,
851
+ className,
852
+ htmlFor,
853
+ style: {
854
+ textAlign: align,
855
+ ...style
856
+ }
857
+ },
858
+ children
859
+ );
860
+ };
861
+
862
+ // src/components/accordion/accordion-item.tsx
863
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
864
+ var getContent = (content, isOpen) => {
865
+ if (typeof content === "function") {
866
+ return content(isOpen);
867
+ }
868
+ return content;
869
+ };
870
+ var AccordionItem = ({
871
+ title,
872
+ subtitle,
873
+ children,
874
+ icon: Icon = FaCaretLeft,
875
+ startContent,
876
+ content,
877
+ endContent,
878
+ classNames = {},
879
+ className = "",
880
+ style = {}
881
+ }) => {
882
+ const id = useMemo6(() => crypto.randomUUID(), []);
883
+ const [isOpen, toggle] = useAccordionItem(id);
884
+ const headerClassName = useClassNames({
885
+ "accordion-header": true,
886
+ "has-start-content": !!startContent,
887
+ [classNames?.header ?? ""]: !!classNames?.header,
888
+ "is-open": isOpen
889
+ });
890
+ const headerContentClassName = useClassNames({
891
+ "accordion-header-content": true,
892
+ [classNames?.headerContent ?? ""]: !!classNames?.headerContent
893
+ });
894
+ const toggleIconClassName = useClassNames({
895
+ "accordion-toggle-icon": true,
896
+ isOpen,
897
+ [classNames?.toggleIcon ?? ""]: !!classNames?.toggleIcon
898
+ });
899
+ const bodyContentClassName = useClassNames({
900
+ "accordion-body": true,
901
+ [classNames?.body ?? ""]: !!classNames?.body
902
+ });
903
+ const titleContent = getContent(title, isOpen);
904
+ const subtitleContent = getContent(subtitle, isOpen);
905
+ const headerStart = getContent(startContent, isOpen);
906
+ const headerMiddle = getContent(content, isOpen) ?? /* @__PURE__ */ jsxs2("section", { className: headerContentClassName, children: [
907
+ /* @__PURE__ */ jsx6(Typography, { className: classNames?.title, variant: "body", noPadding: true, weight: "bold", children: titleContent }),
908
+ /* @__PURE__ */ jsx6(Typography, { className: classNames?.subtitle, variant: "label", noPadding: true, weight: "light", children: subtitleContent })
909
+ ] });
910
+ const headerEnd = getContent(endContent, isOpen) ?? /* @__PURE__ */ jsx6(Icon, { className: toggleIconClassName });
911
+ const accordionItemClassName = useClassNames({
912
+ "accordion-item": true,
913
+ [className]: Boolean(className)
914
+ });
915
+ return /* @__PURE__ */ jsxs2("section", { className: accordionItemClassName, style, children: [
916
+ /* @__PURE__ */ jsxs2("section", { className: headerClassName, onClick: toggle, children: [
917
+ headerStart,
918
+ headerMiddle,
919
+ headerEnd
920
+ ] }),
921
+ /* @__PURE__ */ jsx6(SlideCard, { isOpen, children: /* @__PURE__ */ jsx6("section", { className: bodyContentClassName, children }) })
922
+ ] });
923
+ };
924
+
925
+ // src/components/ripple/ripple.component.tsx
926
+ import { useEffect as useEffect8, useRef as useRef7 } from "react";
927
+ import { jsx as jsx7 } from "react/jsx-runtime";
928
+ var Ripple = ({
929
+ color,
930
+ duration = 1e3,
931
+ timingFunction = "ease-out",
932
+ times = 1,
933
+ className = "",
934
+ style = {},
935
+ zIndex = 1
936
+ }) => {
937
+ const ref = useRef7(null);
938
+ useEffect8(() => {
939
+ if (!ref.current?.parentElement) {
940
+ return;
941
+ }
942
+ const computedPosition = getComputedStyle(ref.current.parentElement).position;
943
+ if (!["absolute", "fixed", "sticky", "relative"].includes(computedPosition)) {
944
+ ref.current.parentElement.style.position = "relative";
945
+ }
946
+ }, []);
947
+ const handleClick = (e) => {
948
+ const { pageX, pageY, currentTarget } = e;
949
+ const rect = currentTarget.getBoundingClientRect();
950
+ const x = (pageX - rect.left) * 100 / rect.width;
951
+ const y = (pageY - rect.top) * 100 / rect.height;
952
+ const ripple = document.createElement("span");
953
+ ripple.classList.add("ripple-effect");
954
+ ripple.style.animationDuration = `${duration}ms`;
955
+ ripple.style.animationTimingFunction = timingFunction;
956
+ ripple.style.left = `${x}%`;
957
+ ripple.style.top = `${y}%`;
958
+ if (color) {
959
+ ripple.style.background = color;
960
+ }
961
+ currentTarget.appendChild(ripple);
962
+ setTimeout(
963
+ () => {
964
+ ripple.remove();
965
+ },
966
+ Math.max(duration, 500) * Math.max(times, 1)
967
+ );
968
+ };
969
+ return /* @__PURE__ */ jsx7("span", { ref, onMouseDown: handleClick, className: `ripple ${className}`, style: { ...style, zIndex } });
970
+ };
971
+
972
+ // src/components/button/button.component.tsx
973
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
974
+ var Button = ({
975
+ children,
976
+ color = "default" /* DEFAULT */,
977
+ variant = "solid" /* SOLID */,
978
+ radius = "medium" /* MEDIUM */,
979
+ size = "regular" /* REGULAR */,
980
+ noWrap = false,
981
+ forIcon = false,
982
+ className = "",
983
+ ...props
984
+ }) => {
985
+ const classNames = useClassNames({
986
+ button: true,
987
+ [color]: Boolean(color),
988
+ [variant]: Boolean(variant),
989
+ [`radius-${radius}`]: Boolean(radius),
990
+ [`size-${size}`]: Boolean(size),
991
+ "no-wrap": noWrap,
992
+ icon: forIcon,
993
+ [className]: Boolean(className)
994
+ });
995
+ return /* @__PURE__ */ jsxs3("button", { ...props, className: classNames, children: [
996
+ children,
997
+ /* @__PURE__ */ jsx8(Ripple, {})
998
+ ] });
999
+ };
1000
+
1001
+ // src/components/cursor/cursor.component.tsx
1002
+ import { useEffect as useEffect9, useState as useState10 } from "react";
1003
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1004
+ var Cursor = () => {
1005
+ const { x, y, elementX, elementY, ref } = useMousePosition();
1006
+ const [isCursorHover, setIsCursorHover] = useState10(false);
1007
+ useEventListener("mouseover", (e) => {
1008
+ const computedCursor = getComputedStyle(e.target).cursor;
1009
+ setIsCursorHover(computedCursor === "pointer");
1010
+ });
1011
+ useEffect9(() => {
1012
+ if (!("ontouchstart" in window || navigator.maxTouchPoints)) {
1013
+ document.body.style.cursor = "none";
1014
+ }
1015
+ return () => {
1016
+ document.body.style.cursor = "auto";
1017
+ };
1018
+ }, []);
1019
+ if (x === null || y === null || "ontouchstart" in window || navigator.maxTouchPoints) {
1020
+ return null;
1021
+ }
1022
+ const translate3d = `translate3d(${elementX}px, ${elementY}px, 0)`;
1023
+ return /* @__PURE__ */ jsxs4("section", { className: "cursor-overlay", ref, children: [
1024
+ /* @__PURE__ */ jsx9(
1025
+ "span",
1026
+ {
1027
+ className: `cursor outer-circle ${isCursorHover ? "cursor-hover" : ""}`,
1028
+ style: {
1029
+ transform: translate3d
1030
+ }
1031
+ }
1032
+ ),
1033
+ /* @__PURE__ */ jsx9(
1034
+ "span",
1035
+ {
1036
+ className: `cursor inner-circle ${isCursorHover ? "cursor-hover" : ""}`,
1037
+ style: {
1038
+ transform: translate3d
1039
+ }
1040
+ }
1041
+ )
1042
+ ] });
1043
+ };
1044
+
1045
+ // src/components/form/checkbox/checkbox.component.tsx
1046
+ import { useMemo as useMemo7 } from "react";
1047
+ import { IoCheckmarkOutline } from "react-icons/io5";
1048
+
1049
+ // src/components/form/controller/controller.component.tsx
1050
+ import { Controller as RHFController, useFormContext } from "react-hook-form";
1051
+ import { jsx as jsx10 } from "react/jsx-runtime";
1052
+ var Controller = ({
1053
+ Component,
1054
+ inputProps,
1055
+ defaultValue: fieldDefaultValue,
1056
+ rules
1057
+ }) => {
1058
+ const { control, setValue } = useFormContext();
1059
+ const { name, defaultValue } = inputProps;
1060
+ return /* @__PURE__ */ jsx10(
1061
+ RHFController,
1062
+ {
1063
+ name,
1064
+ control,
1065
+ rules,
1066
+ defaultValue: defaultValue ?? fieldDefaultValue,
1067
+ render: ({ field: { onBlur, value }, fieldState }) => /* @__PURE__ */ jsx10(
1068
+ Component,
1069
+ {
1070
+ value,
1071
+ error: fieldState.error?.message,
1072
+ invalid: fieldState.invalid,
1073
+ isTouched: fieldState.isTouched,
1074
+ isDirty: fieldState.isDirty,
1075
+ setValue: (value2) => setValue(name, value2),
1076
+ onBlur,
1077
+ ...inputProps
1078
+ }
1079
+ )
1080
+ }
1081
+ );
1082
+ };
1083
+
1084
+ // src/components/form/checkbox/checkbox.component.tsx
1085
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1086
+ var Checkbox = ({
1087
+ name,
1088
+ value,
1089
+ setValue,
1090
+ onBlur,
1091
+ onFocus,
1092
+ className = "",
1093
+ style = {},
1094
+ autoFocus = false,
1095
+ readOnly = false,
1096
+ disabled = false,
1097
+ autoComplete = "off",
1098
+ icon: Icon = IoCheckmarkOutline,
1099
+ label,
1100
+ color = "primary" /* PRIMARY */,
1101
+ size = "regular" /* REGULAR */
1102
+ /*
1103
+ * isDirty = false,
1104
+ * isTouched = false,
1105
+ * invalid = false,
1106
+ * error,
1107
+ */
1108
+ }) => {
1109
+ const id = useMemo7(() => crypto.randomUUID(), []);
1110
+ const { handlers } = useInputHandlers({
1111
+ onChange: (e) => setValue(e.target.checked),
1112
+ onBlur,
1113
+ onFocus
1114
+ });
1115
+ const checkboxContainerClassName = useClassNames({
1116
+ "checkbox-container": true,
1117
+ [className]: Boolean(className),
1118
+ [`color-${color}`]: Boolean(color)
1119
+ });
1120
+ const checkboxClassName = useClassNames({
1121
+ checkbox: true,
1122
+ "is-checked": value,
1123
+ [`size-${size}`]: Boolean(size)
1124
+ });
1125
+ return /* @__PURE__ */ jsxs5("section", { className: checkboxContainerClassName, style, onClick: (e) => e.stopPropagation(), children: [
1126
+ /* @__PURE__ */ jsxs5("section", { className: checkboxClassName, children: [
1127
+ /* @__PURE__ */ jsx11("section", { className: "checkbox-fill", children: /* @__PURE__ */ jsx11(Icon, { size: "1.3em", className: "checkbox-icon" }) }),
1128
+ /* @__PURE__ */ jsx11(
1129
+ "input",
1130
+ {
1131
+ id,
1132
+ type: "checkbox",
1133
+ name,
1134
+ className: "checkbox-input",
1135
+ checked: value,
1136
+ autoFocus,
1137
+ autoComplete,
1138
+ disabled: disabled || readOnly,
1139
+ ...handlers
1140
+ }
1141
+ )
1142
+ ] }),
1143
+ label ? /* @__PURE__ */ jsx11(Typography, { variant: "label-form", htmlFor: id, className: "checkbox-label", children: label }) : null
1144
+ ] });
1145
+ };
1146
+ var CheckboxController = ({ rules, ...props }) => {
1147
+ return /* @__PURE__ */ jsx11(Controller, { Component: Checkbox, defaultValue: false, inputProps: props, rules });
1148
+ };
1149
+ Checkbox.Controller = CheckboxController;
1150
+
1151
+ // src/components/form/date-picker/date-picker.component.tsx
1152
+ import { useMemo as useMemo8 } from "react";
1153
+
1154
+ // src/components/form/field/field.component.tsx
1155
+ import { ImCross } from "react-icons/im";
1156
+
1157
+ // src/components/form/field/field.types.ts
1158
+ var FieldVariant = /* @__PURE__ */ ((FieldVariant2) => {
1159
+ FieldVariant2["FULL_BORDER"] = "full-border";
1160
+ FieldVariant2["CONTENT_BORDER"] = "content-border";
1161
+ FieldVariant2["CONTENT_LINE"] = "line";
1162
+ return FieldVariant2;
1163
+ })(FieldVariant || {});
1164
+ var FieldOrientation = /* @__PURE__ */ ((FieldOrientation2) => {
1165
+ FieldOrientation2["HORIZONTAL"] = "horizontal";
1166
+ FieldOrientation2["VERTICAL"] = "vertical";
1167
+ return FieldOrientation2;
1168
+ })(FieldOrientation || {});
1169
+
1170
+ // src/components/form/field/field.component.tsx
1171
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1172
+ var getIcon = ({ icon: Icon, className, onClick }) => Icon ? /* @__PURE__ */ jsx12(Icon, { className, onClick }) : /* @__PURE__ */ jsx12("span", {});
1173
+ var Field = ({
1174
+ id,
1175
+ label,
1176
+ leftIcon,
1177
+ rightIcon,
1178
+ errorIcon: ErrorIcon = ImCross,
1179
+ error,
1180
+ onClickLeftIcon,
1181
+ onClickRightIcon,
1182
+ fieldOrientation = "vertical" /* VERTICAL */,
1183
+ children,
1184
+ isFocus = false,
1185
+ variant,
1186
+ ref
1187
+ }) => {
1188
+ const fieldClassName = useClassNames({
1189
+ "form-field": true,
1190
+ focus: isFocus,
1191
+ error: !!error,
1192
+ "variant-content-border": variant === "content-border" /* CONTENT_BORDER */,
1193
+ "variant-content-line": variant === "line" /* CONTENT_LINE */,
1194
+ "variant-full-border": variant === "full-border" /* FULL_BORDER */,
1195
+ "variant-inline": fieldOrientation === "horizontal" /* HORIZONTAL */
1196
+ });
1197
+ const handleClick = (callback) => (e) => {
1198
+ e.stopPropagation();
1199
+ const input = document.getElementById(id);
1200
+ input?.focus();
1201
+ input?.click();
1202
+ if (callback) callback();
1203
+ };
1204
+ return /* @__PURE__ */ jsxs6("section", { className: fieldClassName, ref, children: [
1205
+ label ? /* @__PURE__ */ jsx12(Typography, { className: "field-label", noPadding: true, variant: "label-form", htmlFor: id, children: label }) : null,
1206
+ /* @__PURE__ */ jsxs6("section", { className: "field-content", children: [
1207
+ getIcon({
1208
+ className: "field-left-icon",
1209
+ icon: leftIcon,
1210
+ onClick: handleClick(onClickLeftIcon)
1211
+ }),
1212
+ /* @__PURE__ */ jsx12("section", { className: "field-children", children }),
1213
+ getIcon({
1214
+ className: "field-right-icon",
1215
+ icon: rightIcon,
1216
+ onClick: handleClick(onClickRightIcon)
1217
+ })
1218
+ ] }),
1219
+ Boolean(error) && /* @__PURE__ */ jsxs6("section", { className: "field-message", children: [
1220
+ ErrorIcon ? /* @__PURE__ */ jsx12(ErrorIcon, { size: 10 }) : /* @__PURE__ */ jsx12("span", {}),
1221
+ /* @__PURE__ */ jsx12(Typography, { noPadding: true, variant: "small", children: error })
1222
+ ] })
1223
+ ] });
1224
+ };
1225
+
1226
+ // src/components/form/date-picker/date-picker.component.tsx
1227
+ import { jsx as jsx13 } from "react/jsx-runtime";
1228
+ var DatePicker = ({
1229
+ name,
1230
+ value,
1231
+ setValue,
1232
+ onBlur,
1233
+ onFocus,
1234
+ type = "date",
1235
+ className = "",
1236
+ style = {},
1237
+ autoFocus = false,
1238
+ readOnly = false,
1239
+ disabled = false,
1240
+ placeholder = "",
1241
+ autoComplete = "off",
1242
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1243
+ isDirty = false,
1244
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1245
+ isTouched = false,
1246
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1247
+ invalid = false,
1248
+ error,
1249
+ ...fieldProps
1250
+ }) => {
1251
+ const id = useMemo8(() => crypto.randomUUID(), []);
1252
+ const { isFocus, handlers } = useInputHandlers({
1253
+ onBlur,
1254
+ onChange: (e) => setValue(e.target.value),
1255
+ onFocus
1256
+ });
1257
+ return /* @__PURE__ */ jsx13(Field, { id, error, isFocus, ...fieldProps, children: /* @__PURE__ */ jsx13(
1258
+ "input",
1259
+ {
1260
+ id,
1261
+ type,
1262
+ name,
1263
+ className,
1264
+ style,
1265
+ value,
1266
+ autoFocus,
1267
+ autoComplete,
1268
+ placeholder,
1269
+ disabled,
1270
+ readOnly,
1271
+ ...handlers
1272
+ }
1273
+ ) });
1274
+ };
1275
+ var DatePickerController = ({ rules, ...props }) => {
1276
+ return /* @__PURE__ */ jsx13(Controller, { Component: DatePicker, defaultValue: "", inputProps: props, rules });
1277
+ };
1278
+ DatePicker.Controller = DatePickerController;
1279
+
1280
+ // src/components/form/input/input.component.tsx
1281
+ import { useMemo as useMemo9 } from "react";
1282
+ import { jsx as jsx14 } from "react/jsx-runtime";
1283
+ var Input = ({
1284
+ name,
1285
+ value,
1286
+ setValue,
1287
+ onBlur,
1288
+ onFocus,
1289
+ pattern,
1290
+ type = "text",
1291
+ className = "",
1292
+ style = {},
1293
+ autoFocus = false,
1294
+ readOnly = false,
1295
+ disabled = false,
1296
+ placeholder = "",
1297
+ autoComplete = "off",
1298
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1299
+ isDirty = false,
1300
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1301
+ isTouched = false,
1302
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1303
+ invalid = false,
1304
+ error,
1305
+ min,
1306
+ max,
1307
+ ...fieldProps
1308
+ }) => {
1309
+ const id = useMemo9(() => crypto.randomUUID(), []);
1310
+ const { handlers, isFocus } = useInputHandlers({
1311
+ onChange: (e) => setValue(e.target.value),
1312
+ onBlur,
1313
+ onFocus
1314
+ });
1315
+ return /* @__PURE__ */ jsx14(Field, { id, error, isFocus, ...fieldProps, children: /* @__PURE__ */ jsx14(
1316
+ "input",
1317
+ {
1318
+ id,
1319
+ type,
1320
+ name,
1321
+ className,
1322
+ style,
1323
+ value,
1324
+ pattern,
1325
+ autoFocus,
1326
+ autoComplete,
1327
+ placeholder,
1328
+ disabled,
1329
+ readOnly,
1330
+ min,
1331
+ max,
1332
+ ...handlers
1333
+ }
1334
+ ) });
1335
+ };
1336
+ var InputController = ({ rules, ...props }) => {
1337
+ return /* @__PURE__ */ jsx14(Controller, { Component: Input, defaultValue: "", inputProps: props, rules });
1338
+ };
1339
+ Input.Controller = InputController;
1340
+
1341
+ // src/components/form/input-password/input-password.component.tsx
1342
+ import { useMemo as useMemo10 } from "react";
1343
+ import { FiEye, FiEyeOff } from "react-icons/fi";
1344
+ import { IoIosWarning } from "react-icons/io";
1345
+ import { jsx as jsx15 } from "react/jsx-runtime";
1346
+ var InputPassword = ({
1347
+ name,
1348
+ value,
1349
+ setValue,
1350
+ onBlur,
1351
+ onFocus,
1352
+ className = "",
1353
+ style = {},
1354
+ autoFocus = false,
1355
+ readOnly = false,
1356
+ disabled = false,
1357
+ placeholder = "",
1358
+ autoComplete = "off",
1359
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1360
+ isDirty = false,
1361
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1362
+ isTouched = false,
1363
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1364
+ invalid = false,
1365
+ error,
1366
+ ...fieldProps
1367
+ }) => {
1368
+ const id = useMemo10(() => crypto.randomUUID(), []);
1369
+ const [type, toggle] = useToggleValues(["password", "text"]);
1370
+ const { isFocus, handlers } = useInputHandlers({
1371
+ onBlur,
1372
+ onChange: (e) => setValue(e.target.value),
1373
+ onFocus
1374
+ });
1375
+ const icon = useMemo10(() => {
1376
+ if (type === "password") return FiEye;
1377
+ if (type === "text") return FiEyeOff;
1378
+ return IoIosWarning;
1379
+ }, [type]);
1380
+ return /* @__PURE__ */ jsx15(Field, { id, error, isFocus, ...fieldProps, rightIcon: icon, onClickRightIcon: () => toggle(), children: /* @__PURE__ */ jsx15(
1381
+ "input",
1382
+ {
1383
+ id,
1384
+ type,
1385
+ name,
1386
+ className,
1387
+ style,
1388
+ value,
1389
+ autoFocus,
1390
+ autoComplete,
1391
+ placeholder,
1392
+ disabled,
1393
+ readOnly,
1394
+ ...handlers
1395
+ }
1396
+ ) });
1397
+ };
1398
+ var InputPasswordController = ({ rules, ...props }) => {
1399
+ return /* @__PURE__ */ jsx15(Controller, { Component: InputPassword, defaultValue: "", inputProps: props, rules });
1400
+ };
1401
+ InputPassword.Controller = InputPasswordController;
1402
+
1403
+ // src/components/form/input-color/input-color.component.tsx
1404
+ import Color from "color";
1405
+ import { useCallback as useCallback9, useEffect as useEffect10, useMemo as useMemo15, useRef as useRef10, useState as useState12 } from "react";
1406
+ import { HexAlphaColorPicker, HexColorInput } from "react-colorful";
1407
+ import { FaEyeDropper } from "react-icons/fa6";
1408
+ import useEyeDropper from "use-eye-dropper";
1409
+
1410
+ // src/components/modals/action-modal/action-modal.component.tsx
1411
+ import { createContext as createContext2, useCallback as useCallback7, useContext as useContext2, useRef as useRef9, useState as useState11 } from "react";
1412
+ import { ImCross as ImCross2 } from "react-icons/im";
1413
+
1414
+ // src/components/modals/modal/modal.component.tsx
1415
+ import { useMemo as useMemo12, useRef as useRef8 } from "react";
1416
+
1417
+ // src/components/modals/portal/portal.component.tsx
1418
+ import { createPortal } from "react-dom";
1419
+ var Portal = ({ children, id }) => {
1420
+ const root = useDomContainer(id);
1421
+ if (root === null) {
1422
+ return null;
1423
+ }
1424
+ return createPortal(children, root);
1425
+ };
1426
+
1427
+ // src/components/modals/modal/modal.backdrop.tsx
1428
+ import { useMemo as useMemo11 } from "react";
1429
+ import { jsx as jsx16 } from "react/jsx-runtime";
1430
+ var ModalBackdrop = /* @__PURE__ */ ((ModalBackdrop2) => {
1431
+ ModalBackdrop2["OPAQUE"] = "opaque";
1432
+ ModalBackdrop2["TRANSPARENT"] = "transparent";
1433
+ ModalBackdrop2["BLUR"] = "blur";
1434
+ ModalBackdrop2["NONE"] = "none";
1435
+ return ModalBackdrop2;
1436
+ })(ModalBackdrop || {});
1437
+ var Backdrop = ({
1438
+ opacity = 0.6,
1439
+ backdrop = "blur" /* BLUR */,
1440
+ zIndex,
1441
+ backdropOnClick,
1442
+ modalState
1443
+ }) => {
1444
+ const backdropClassName = useClassNames({
1445
+ "modal-backdrop": true,
1446
+ "backdrop-close": modalState === "CLOSING" /* CLOSING */ || modalState === "CLOSED" /* CLOSED */
1447
+ });
1448
+ const backgroundStyles = useMemo11(() => {
1449
+ const backdropStyles = {
1450
+ ["opaque" /* OPAQUE */]: {
1451
+ background: `hsl(from var(--background-paper) h s l / ${opacity * 100}%)`
1452
+ },
1453
+ ["transparent" /* TRANSPARENT */]: {
1454
+ background: "transparent"
1455
+ },
1456
+ ["blur" /* BLUR */]: {
1457
+ background: `hsl(from var(--background-paper) h s l / ${opacity * 100}%)`,
1458
+ backdropFilter: "blur(5px)"
1459
+ },
1460
+ ["none" /* NONE */]: {
1461
+ display: "none"
1462
+ }
1463
+ };
1464
+ return backdropStyles[backdrop] ?? {};
1465
+ }, [backdrop, opacity]);
1466
+ if (backdrop === "none" /* NONE */) {
1467
+ return null;
1468
+ }
1469
+ return /* @__PURE__ */ jsx16(
1470
+ "section",
1471
+ {
1472
+ tabIndex: -1,
1473
+ onClick: backdropOnClick,
1474
+ className: backdropClassName,
1475
+ style: {
1476
+ zIndex,
1477
+ ...backgroundStyles
1478
+ }
1479
+ }
1480
+ );
1481
+ };
1482
+
1483
+ // src/components/modals/modal/modal.component.tsx
1484
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
1485
+ var Modal = ({
1486
+ id,
1487
+ children,
1488
+ isOpen,
1489
+ onClose,
1490
+ className = "",
1491
+ style = {},
1492
+ rootStyle = {},
1493
+ animation = "fade-down",
1494
+ closeAnimationClassName = "modal-close",
1495
+ modalRef: modalRefProp,
1496
+ closeOnClickOutside = true,
1497
+ transitionDuration = 300,
1498
+ windowOffset = 10,
1499
+ offset = 20,
1500
+ position,
1501
+ containerRef,
1502
+ zIndex = 1e3,
1503
+ ...backdropProps
1504
+ }) => {
1505
+ const uuid = useMemo12(() => crypto.randomUUID(), []);
1506
+ const modalRef = useRef8(null);
1507
+ const { modalState, isVisible } = useModalTransition({
1508
+ transitionDuration,
1509
+ isOpen
1510
+ });
1511
+ useModalInContainer({
1512
+ modalRef: modalRefProp ?? modalRef,
1513
+ containerRef,
1514
+ offset,
1515
+ windowOffset,
1516
+ position,
1517
+ isOpen: isVisible
1518
+ });
1519
+ useClickOutside(modalRefProp ?? modalRef, () => {
1520
+ if (isOpen && closeOnClickOutside) {
1521
+ onClose();
1522
+ }
1523
+ });
1524
+ const modalContentClassName = useClassNames({
1525
+ "modal-content": true,
1526
+ [className]: Boolean(className),
1527
+ [`animation-${animation}`]: Boolean(animation) && animation !== "none",
1528
+ [closeAnimationClassName]: modalState === "CLOSING" /* CLOSING */ || modalState === "CLOSED" /* CLOSED */
1529
+ });
1530
+ if (!isVisible) {
1531
+ return null;
1532
+ }
1533
+ return /* @__PURE__ */ jsxs7(Portal, { id: `modal-${id}-${uuid}`, children: [
1534
+ /* @__PURE__ */ jsx17(Backdrop, { ...backdropProps, modalState, zIndex }),
1535
+ /* @__PURE__ */ jsx17(
1536
+ "section",
1537
+ {
1538
+ className: "modal",
1539
+ ref: modalRefProp ?? modalRef,
1540
+ style: {
1541
+ maxWidth: `calc(100dvw - ${windowOffset * 2}px)`,
1542
+ maxHeight: `calc(100dvh - ${windowOffset * 2}px)`,
1543
+ ...rootStyle,
1544
+ zIndex: +zIndex + 1
1545
+ },
1546
+ children: /* @__PURE__ */ jsx17("section", { style: { ...style, animationDuration: `${transitionDuration}ms` }, className: modalContentClassName, children })
1547
+ }
1548
+ )
1549
+ ] });
1550
+ };
1551
+
1552
+ // src/components/modals/action-modal/action-modal.component.tsx
1553
+ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
1554
+ var ActionModalContext = createContext2(null);
1555
+ var useActionModalContext = () => {
1556
+ const context = useContext2(ActionModalContext);
1557
+ if (!context) {
1558
+ throw new Error("useActionModalContext must be used within a ActionModal");
1559
+ }
1560
+ return context;
1561
+ };
1562
+ var ActionModal = ({
1563
+ children,
1564
+ isOpen,
1565
+ onClose,
1566
+ actionRequired,
1567
+ icon: Icon,
1568
+ noCloseButton,
1569
+ lineOnTop = false,
1570
+ backCard = false,
1571
+ noPadding = false,
1572
+ className = "",
1573
+ style = {},
1574
+ ...modalProps
1575
+ }) => {
1576
+ const [isActionInProgress, setIsActionInProgress] = useState11(false);
1577
+ const ref = useRef9(null);
1578
+ const remainAction = useCallback7(() => {
1579
+ ref.current?.classList.add("shake-animation");
1580
+ setTimeout(() => {
1581
+ ref.current?.classList.remove("shake-animation");
1582
+ }, 500);
1583
+ }, []);
1584
+ const actionModalClassName = useClassNames({
1585
+ "action-modal-content": true,
1586
+ "back-card": backCard,
1587
+ "line-on-top": lineOnTop,
1588
+ "no-padding": noPadding
1589
+ });
1590
+ return /* @__PURE__ */ jsx18(ActionModalContext.Provider, { value: { onClose, isActionInProgress, setIsActionInProgress }, children: /* @__PURE__ */ jsx18(
1591
+ Modal,
1592
+ {
1593
+ className: "action-modal",
1594
+ id: "action-modal",
1595
+ animation: "bounce",
1596
+ opacity: 0.8,
1597
+ isOpen,
1598
+ onClose,
1599
+ ...modalProps,
1600
+ backdropOnClick: actionRequired ? remainAction : onClose,
1601
+ position: "center" /* CENTER */,
1602
+ children: /* @__PURE__ */ jsx18("section", { ref, className: "modal-content", children: /* @__PURE__ */ jsxs8("section", { className: actionModalClassName, children: [
1603
+ !noCloseButton && !actionRequired && /* @__PURE__ */ jsx18("section", { className: "close-modal-button", onClick: () => onClose(), children: /* @__PURE__ */ jsx18(ImCross2, {}) }),
1604
+ Icon ? /* @__PURE__ */ jsx18(Typography, { variant: "header4", className: "action-modal-icon", children: /* @__PURE__ */ jsx18(Icon, {}) }) : null,
1605
+ /* @__PURE__ */ jsx18("section", { className: "action-modal-body", children: /* @__PURE__ */ jsx18("section", { className: `action-modal-content ${className}`, style, children }) })
1606
+ ] }) })
1607
+ }
1608
+ ) });
1609
+ };
1610
+ var ActionButton = ({ onClick, children, isLoading: manualIsLoading, ...buttonProps }) => {
1611
+ const { onClose, isActionInProgress, setIsActionInProgress } = useActionModalContext();
1612
+ const [isLoading, setIsLoading] = useState11(false);
1613
+ const handleAction = useCallback7(() => {
1614
+ setIsLoading(true);
1615
+ setIsActionInProgress(true);
1616
+ const result = onClick();
1617
+ if (result instanceof Promise) {
1618
+ result.then(() => {
1619
+ onClose();
1620
+ setIsLoading(false);
1621
+ setIsActionInProgress(false);
1622
+ });
1623
+ } else {
1624
+ onClose();
1625
+ setIsLoading(false);
1626
+ setIsActionInProgress(false);
1627
+ }
1628
+ }, [onClick, onClose, setIsActionInProgress]);
1629
+ if (!isLoading && isActionInProgress) {
1630
+ return null;
1631
+ }
1632
+ return /* @__PURE__ */ jsx18(Button, { ...buttonProps, onClick: handleAction, isLoading: manualIsLoading || isLoading, children });
1633
+ };
1634
+ ActionModal.ActionButton = ActionButton;
1635
+
1636
+ // src/components/modals/aside-modal/aside-modal.component.tsx
1637
+ import { useMemo as useMemo13 } from "react";
1638
+ import { ImCross as ImCross3 } from "react-icons/im";
1639
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
1640
+ var AsideModal = ({
1641
+ children,
1642
+ isOpen,
1643
+ onClose,
1644
+ position = "left" /* LEFT */,
1645
+ size,
1646
+ className = "",
1647
+ ...modalProps
1648
+ }) => {
1649
+ const modalRootStyles = useMemo13(() => {
1650
+ const computedSize = {
1651
+ ["top" /* TOP */]: { height: size, width: "100%" },
1652
+ ["left" /* LEFT */]: { height: "100%", width: size },
1653
+ ["right" /* RIGHT */]: { height: "100%", width: size },
1654
+ ["bottom" /* BOTTOM */]: { height: size, width: "100%" }
1655
+ };
1656
+ return computedSize[position];
1657
+ }, [position, size]);
1658
+ return /* @__PURE__ */ jsxs9(
1659
+ Modal,
1660
+ {
1661
+ id: "aside",
1662
+ isOpen,
1663
+ onClose,
1664
+ opacity: 0.6,
1665
+ windowOffset: 0,
1666
+ animation: "none",
1667
+ className: `aside-modal ${className} ${position}`,
1668
+ rootStyle: modalRootStyles,
1669
+ backdropOnClick: onClose,
1670
+ position,
1671
+ ...modalProps,
1672
+ children: [
1673
+ /* @__PURE__ */ jsx19("span", { className: "close-modal-button", onClick: onClose, children: /* @__PURE__ */ jsx19(ImCross3, {}) }),
1674
+ /* @__PURE__ */ jsx19("section", { className: "aside-modal-content", children })
1675
+ ]
1676
+ }
1677
+ );
1678
+ };
1679
+
1680
+ // src/components/modals/confirmation-modal/confirmation-modal.component.tsx
1681
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1682
+ var ConfirmationModal = ({
1683
+ title,
1684
+ onAccept,
1685
+ onReject = () => null,
1686
+ acceptText,
1687
+ rejectText,
1688
+ children,
1689
+ isLoading,
1690
+ ...actionModalProps
1691
+ }) => {
1692
+ return /* @__PURE__ */ jsx20(ActionModal, { ...actionModalProps, backCard: true, children: /* @__PURE__ */ jsxs10("section", { className: "confirmation-modal", children: [
1693
+ /* @__PURE__ */ jsx20(Typography, { variant: "header4", children: title }),
1694
+ /* @__PURE__ */ jsx20("section", { children }),
1695
+ /* @__PURE__ */ jsxs10("section", { className: "confirmation-modal-actions", children: [
1696
+ !isLoading && /* @__PURE__ */ jsx20(ActionModal.ActionButton, { variant: "flat", onClick: onReject, children: rejectText }),
1697
+ /* @__PURE__ */ jsx20(ActionModal.ActionButton, { isLoading, onClick: onAccept, children: acceptText })
1698
+ ] })
1699
+ ] }) });
1700
+ };
1701
+
1702
+ // src/components/modals/menu/menu.component.tsx
1703
+ import { useCallback as useCallback8, useMemo as useMemo14 } from "react";
1704
+ import { Fragment, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
1705
+ var Menu = ({
1706
+ children,
1707
+ isOpen,
1708
+ onClose,
1709
+ id,
1710
+ menuContentRef,
1711
+ contentClassName = "",
1712
+ contentStyle = {},
1713
+ className = "",
1714
+ ...modalProps
1715
+ }) => {
1716
+ const modalClassName = useClassNames({
1717
+ "menu-modal": true,
1718
+ [className]: Boolean(className)
1719
+ });
1720
+ return /* @__PURE__ */ jsx21(Modal, { className: modalClassName, ...modalProps, id: `menu-${id}`, isOpen, onClose, children: /* @__PURE__ */ jsx21("ul", { className: `menu-content ${contentClassName}`, role: "listbox", style: contentStyle, ref: menuContentRef, children }) });
1721
+ };
1722
+ var MenuOption = ({
1723
+ children,
1724
+ label = "",
1725
+ asCheckbox,
1726
+ icon: Icon,
1727
+ id,
1728
+ disabled = false,
1729
+ selected = false,
1730
+ className = "",
1731
+ style = {},
1732
+ onClick = () => null,
1733
+ ...liProps
1734
+ }) => {
1735
+ const menuOptionClassName = useClassNames({
1736
+ "menu-option": true,
1737
+ [className]: true,
1738
+ "is-disabled": disabled,
1739
+ "is-selected": selected
1740
+ });
1741
+ const handleClick = useCallback8(
1742
+ (e) => {
1743
+ e.stopPropagation();
1744
+ if (!disabled) {
1745
+ onClick(!selected);
1746
+ }
1747
+ },
1748
+ [disabled, onClick, selected]
1749
+ );
1750
+ const menuOptionContent = useMemo14(() => {
1751
+ if (children) {
1752
+ return children;
1753
+ }
1754
+ if (asCheckbox) {
1755
+ return /* @__PURE__ */ jsx21(
1756
+ Checkbox,
1757
+ {
1758
+ className: "menu-checkbox",
1759
+ disabled,
1760
+ value: selected,
1761
+ setValue: (n) => onClick(n),
1762
+ name: "option",
1763
+ style: { pointerEvents: "none" },
1764
+ size: "small",
1765
+ label: /* @__PURE__ */ jsxs11(Fragment, { children: [
1766
+ Icon !== void 0 && /* @__PURE__ */ jsx21(Icon, { className: "option-icon" }),
1767
+ /* @__PURE__ */ jsx21(Typography, { variant: "label", children: label })
1768
+ ] })
1769
+ }
1770
+ );
1771
+ }
1772
+ return /* @__PURE__ */ jsxs11(Fragment, { children: [
1773
+ Icon !== void 0 && /* @__PURE__ */ jsx21(Icon, { className: "option-icon" }),
1774
+ typeof label === "string" ? /* @__PURE__ */ jsx21(Typography, { variant: "label", children: label }) : label
1775
+ ] });
1776
+ }, [asCheckbox, children, disabled, Icon, label, onClick, selected]);
1777
+ return /* @__PURE__ */ jsxs11(
1778
+ "li",
1779
+ {
1780
+ ...liProps,
1781
+ id,
1782
+ role: "option",
1783
+ tabIndex: -1,
1784
+ "aria-selected": selected,
1785
+ "aria-disabled": disabled,
1786
+ onClick: handleClick,
1787
+ className: menuOptionClassName,
1788
+ style,
1789
+ children: [
1790
+ /* @__PURE__ */ jsx21(Ripple, { zIndex: 10 }),
1791
+ menuOptionContent
1792
+ ]
1793
+ }
1794
+ );
1795
+ };
1796
+ var Divider = () => {
1797
+ return /* @__PURE__ */ jsx21("li", { children: /* @__PURE__ */ jsx21(Line, { className: "divider" }) });
1798
+ };
1799
+ var Label = ({ children, className = "", ...props }) => {
1800
+ return /* @__PURE__ */ jsx21("li", { tabIndex: -1, className: "menu-label", children: /* @__PURE__ */ jsx21(Typography, { ...props, variant: "small", className: `menu-group-label ${className}`, children }) });
1801
+ };
1802
+ var Group = ({
1803
+ children,
1804
+ label,
1805
+ className = "",
1806
+ style = {},
1807
+ contentClassName = "",
1808
+ contentStyle = {},
1809
+ ...props
1810
+ }) => {
1811
+ const groupClassName = useClassNames({
1812
+ "menu-group": true,
1813
+ [className]: Boolean(className)
1814
+ });
1815
+ return /* @__PURE__ */ jsxs11("li", { tabIndex: -1, ...props, className: groupClassName, style, children: [
1816
+ label && /* @__PURE__ */ jsx21(Label, { children: label }),
1817
+ /* @__PURE__ */ jsx21("ul", { className: `menu-group-content ${contentClassName}`, role: "listbox", style: contentStyle, children })
1818
+ ] });
1819
+ };
1820
+ Menu.Option = MenuOption;
1821
+ Menu.Divider = Divider;
1822
+ Menu.GroupLabel = Label;
1823
+ Menu.Group = Group;
1824
+
1825
+ // src/components/form/input-color/input-color.component.tsx
1826
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1827
+ var InputColor = ({
1828
+ name,
1829
+ value,
1830
+ setValue,
1831
+ onBlur,
1832
+ onFocus,
1833
+ showValueText = false,
1834
+ className = "",
1835
+ style = {},
1836
+ autoFocus = false,
1837
+ readOnly = false,
1838
+ disabled = false,
1839
+ placeholder = "",
1840
+ autoComplete = "off",
1841
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1842
+ isDirty = false,
1843
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1844
+ isTouched = false,
1845
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1846
+ invalid = false,
1847
+ error,
1848
+ ...fieldProps
1849
+ }) => {
1850
+ const { open, isSupported } = useEyeDropper();
1851
+ const [inputValue, setInputValue] = useState12(value);
1852
+ const id = useMemo15(() => crypto.randomUUID(), []);
1853
+ const containerRef = useRef10(null);
1854
+ const [isOpen, setIsOpen] = useState12(false);
1855
+ const { handlers, isFocus } = useInputHandlers({
1856
+ onChange: (e) => setInputValue(e.target.value),
1857
+ onBlur: (e) => {
1858
+ setInputColor();
1859
+ if (onBlur) onBlur(e);
1860
+ },
1861
+ onFocus: (e) => {
1862
+ setInputColor();
1863
+ if (onFocus) onFocus(e);
1864
+ }
1865
+ });
1866
+ const borderColor = useMemo15(() => {
1867
+ const color = Color(value === "" ? "#000000" : value);
1868
+ if (color.isLight() || color.alpha() < 0.5) {
1869
+ return "#000000";
1870
+ }
1871
+ return "#FFFFFF";
1872
+ }, [value]);
1873
+ const openEyeDropper = async () => {
1874
+ const { sRGBHex } = await open();
1875
+ setValue(sRGBHex);
1876
+ };
1877
+ useEffect10(() => {
1878
+ setInputValue(value);
1879
+ }, [value]);
1880
+ const setInputColor = useCallback9(() => {
1881
+ if (inputValue.match(/^#(?:(?:[\da-f]{3}){1,2}|(?:[\da-f]{4}){1,2})$/i)) {
1882
+ setValue(inputValue);
1883
+ } else {
1884
+ setInputValue(value);
1885
+ }
1886
+ }, [inputValue, setValue, value]);
1887
+ const inputBoxClassName = useClassNames({
1888
+ "input-color-box": true,
1889
+ [className]: Boolean(className)
1890
+ });
1891
+ return /* @__PURE__ */ jsxs12(Field, { id, error, isFocus, ...fieldProps, children: [
1892
+ /* @__PURE__ */ jsxs12(
1893
+ "section",
1894
+ {
1895
+ className: "input-color",
1896
+ onClick: (e) => {
1897
+ e.stopPropagation();
1898
+ setIsOpen(true);
1899
+ },
1900
+ ref: containerRef,
1901
+ children: [
1902
+ /* @__PURE__ */ jsx22(
1903
+ "section",
1904
+ {
1905
+ className: inputBoxClassName,
1906
+ style: {
1907
+ borderColor,
1908
+ background: value,
1909
+ color: value,
1910
+ ...style
1911
+ }
1912
+ }
1913
+ ),
1914
+ showValueText ? /* @__PURE__ */ jsx22(
1915
+ "input",
1916
+ {
1917
+ id,
1918
+ name,
1919
+ value: inputValue,
1920
+ placeholder,
1921
+ readOnly,
1922
+ autoFocus,
1923
+ disabled,
1924
+ autoComplete,
1925
+ className: "color-input",
1926
+ ...handlers
1927
+ }
1928
+ ) : null
1929
+ ]
1930
+ }
1931
+ ),
1932
+ /* @__PURE__ */ jsxs12(
1933
+ Modal,
1934
+ {
1935
+ id: "input-color",
1936
+ isOpen,
1937
+ onClose: () => setIsOpen(false),
1938
+ position: "bottom right",
1939
+ offset: 5,
1940
+ backdrop: "transparent",
1941
+ containerRef,
1942
+ className: "input-color-selector",
1943
+ children: [
1944
+ /* @__PURE__ */ jsx22(HexAlphaColorPicker, { id, color: value, onChange: setValue }),
1945
+ /* @__PURE__ */ jsxs12("section", { className: "color-input-container", children: [
1946
+ isSupported() ? /* @__PURE__ */ jsx22(
1947
+ FaEyeDropper,
1948
+ {
1949
+ onClick: () => {
1950
+ void openEyeDropper();
1951
+ }
1952
+ }
1953
+ ) : /* @__PURE__ */ jsx22("span", {}),
1954
+ /* @__PURE__ */ jsx22(
1955
+ HexColorInput,
1956
+ {
1957
+ className: "color-input",
1958
+ id,
1959
+ name,
1960
+ color: value,
1961
+ placeholder: "Type a color",
1962
+ prefixed: true,
1963
+ alpha: true,
1964
+ onChange: setValue
1965
+ }
1966
+ ),
1967
+ /* @__PURE__ */ jsx22("span", {})
1968
+ ] })
1969
+ ]
1970
+ }
1971
+ )
1972
+ ] });
1973
+ };
1974
+ var InputColorController = ({ rules, ...props }) => {
1975
+ return /* @__PURE__ */ jsx22(Controller, { Component: InputColor, defaultValue: "#147EFB", inputProps: props, rules });
1976
+ };
1977
+ InputColor.Controller = InputColorController;
1978
+
1979
+ // src/components/form/input-file/input-file.component.tsx
1980
+ import { useCallback as useCallback10, useEffect as useEffect11, useMemo as useMemo16, useState as useState13 } from "react";
1981
+ import { FaMagnifyingGlass, FaRegTrashCan } from "react-icons/fa6";
1982
+ import { IoIosWarning as IoIosWarning2 } from "react-icons/io";
1983
+ import { PiFilePdfFill, PiFilePngFill } from "react-icons/pi";
1984
+
1985
+ // src/layouts/grid/grid.component.tsx
1986
+ import { createElement as createElement2 } from "react";
1987
+ var Grid = ({
1988
+ tag = "section",
1989
+ children,
1990
+ className,
1991
+ style,
1992
+ flow,
1993
+ columnSize,
1994
+ rowSize,
1995
+ column,
1996
+ row,
1997
+ pc,
1998
+ pi,
1999
+ ps,
2000
+ jc,
2001
+ ji,
2002
+ js,
2003
+ ac,
2004
+ ai,
2005
+ as,
2006
+ gtc,
2007
+ gtr,
2008
+ gta,
2009
+ gt,
2010
+ gap,
2011
+ ...props
2012
+ }) => {
2013
+ return createElement2(
2014
+ tag,
2015
+ {
2016
+ className,
2017
+ ...props,
2018
+ style: {
2019
+ ...style,
2020
+ ...flow ? { gridAutoFlow: flow } : {},
2021
+ ...columnSize ? { gridAutoColumns: columnSize } : {},
2022
+ ...rowSize ? { gridAutoRows: rowSize } : {},
2023
+ ...column ? { gridColumn: column } : {},
2024
+ ...row ? { gridRow: row } : {},
2025
+ ...pc ? { placeContent: pc } : {},
2026
+ ...pi ? { placeItems: pi } : {},
2027
+ ...ps ? { placeSelf: ps } : {},
2028
+ ...jc ? { justifyContent: jc } : {},
2029
+ ...ji ? { justifyItems: ji } : {},
2030
+ ...js ? { justifySelf: js } : {},
2031
+ ...ac ? { alignContent: ac } : {},
2032
+ ...ai ? { alignItems: ai } : {},
2033
+ ...as ? { alignSelf: as } : {},
2034
+ ...gtc ? { gridTemplateColumns: gtc } : {},
2035
+ ...gtr ? { gridTemplateRows: gtr } : {},
2036
+ ...gta ? { gridTemplateAreas: gta } : {},
2037
+ ...gt ? { gridTemplate: gt } : {},
2038
+ ...gap ? { gap } : {},
2039
+ display: "grid"
2040
+ }
2041
+ },
2042
+ children
2043
+ );
2044
+ };
2045
+
2046
+ // src/components/form/input-file/input-file.component.tsx
2047
+ import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
2048
+ var InputFile = ({
2049
+ name,
2050
+ value = {},
2051
+ setValue,
2052
+ onBlur,
2053
+ onFocus,
2054
+ className = "",
2055
+ style = {},
2056
+ autoFocus = false,
2057
+ readOnly = false,
2058
+ disabled = false,
2059
+ placeholder = "Click to upload or drag and drop",
2060
+ autoComplete = "off",
2061
+ accept,
2062
+ multiple = false,
2063
+ limitSize = 5e6,
2064
+ errorTimeout = 3e3,
2065
+ label
2066
+ /*
2067
+ * isDirty = false,
2068
+ * isTouched = false,
2069
+ * invalid = false,
2070
+ * error,
2071
+ */
2072
+ }) => {
2073
+ const [error, setError] = useState13(null);
2074
+ const id = useMemo16(() => crypto.randomUUID(), []);
2075
+ const { handlers } = useInputHandlers({
2076
+ onBlur,
2077
+ onFocus,
2078
+ onChange: (e) => {
2079
+ const { files } = e.target;
2080
+ if (files) saveFiles(files);
2081
+ }
2082
+ });
2083
+ useEffect11(() => {
2084
+ let intervalId = null;
2085
+ if (error !== null) {
2086
+ intervalId = setTimeout(() => {
2087
+ setError(null);
2088
+ }, errorTimeout);
2089
+ }
2090
+ return () => {
2091
+ if (intervalId !== null) {
2092
+ clearTimeout(intervalId);
2093
+ }
2094
+ };
2095
+ }, [error, errorTimeout]);
2096
+ const saveFiles = (files) => {
2097
+ const finalFiles = multiple ? { ...value } : {};
2098
+ const filesToCheck = multiple ? files.length : 1;
2099
+ for (let i = 0; i < filesToCheck; i++) {
2100
+ const file = files.item(i);
2101
+ if (!file) {
2102
+ continue;
2103
+ }
2104
+ if (file.size < limitSize) {
2105
+ finalFiles[file.name] = file;
2106
+ } else {
2107
+ setError(`File '${file.name}' size is larger than ${formatBytes(limitSize)}`);
2108
+ }
2109
+ }
2110
+ setValue(finalFiles);
2111
+ };
2112
+ const handleDrop = (e) => {
2113
+ e.preventDefault();
2114
+ e.stopPropagation();
2115
+ if (e.dataTransfer.files && e.dataTransfer.files.length) {
2116
+ saveFiles(e.dataTransfer.files);
2117
+ }
2118
+ };
2119
+ const getIconType = useCallback10((type) => {
2120
+ const iconTypes = {
2121
+ ["image/png" /* PNG */]: PiFilePngFill,
2122
+ ["application/pdf" /* PDF */]: PiFilePdfFill
2123
+ };
2124
+ return iconTypes[type] ?? IoIosWarning2;
2125
+ }, []);
2126
+ const deleteFile = (file) => {
2127
+ const prevValue = { ...value };
2128
+ delete prevValue[file.name];
2129
+ setValue(prevValue);
2130
+ };
2131
+ const deleteAll = () => {
2132
+ setValue({});
2133
+ };
2134
+ const totalSize = useMemo16(() => Object.values(value).reduce((prev, { size }) => prev + size, 0), [value]);
2135
+ const renderFileToCard = (file, key) => {
2136
+ const Icon = getIconType(file.type);
2137
+ return /* @__PURE__ */ jsxs13("section", { className: "input-file-card", children: [
2138
+ /* @__PURE__ */ jsx23("section", { className: "file-card--image", children: /* @__PURE__ */ jsx23(Icon, {}) }),
2139
+ /* @__PURE__ */ jsxs13(Grid, { children: [
2140
+ /* @__PURE__ */ jsx23(Typography, { variant: "label", noPadding: true, nowrap: true, children: file.name }),
2141
+ /* @__PURE__ */ jsx23(Typography, { noPadding: true, variant: "small", children: formatBytes(file.size) })
2142
+ ] }),
2143
+ /* @__PURE__ */ jsx23("section", { className: "file-card--delete", onClick: () => deleteFile(file), children: /* @__PURE__ */ jsx23(FaRegTrashCan, {}) })
2144
+ ] }, key);
2145
+ };
2146
+ return /* @__PURE__ */ jsxs13("section", { className: "input-file-container", children: [
2147
+ Boolean(label) && /* @__PURE__ */ jsx23(Typography, { variant: "label-form", htmlFor: id, noPadding: true, children: label }),
2148
+ /* @__PURE__ */ jsxs13("section", { className: "input-file--box", onDrop: handleDrop, children: [
2149
+ /* @__PURE__ */ jsx23("section", { className: "input-file--box--icon", children: /* @__PURE__ */ jsx23(FaMagnifyingGlass, {}) }),
2150
+ /* @__PURE__ */ jsxs13(Grid, { children: [
2151
+ /* @__PURE__ */ jsx23(Typography, { variant: "label-form", htmlFor: id, noPadding: true, weight: "bold", children: placeholder }),
2152
+ /* @__PURE__ */ jsxs13(Typography, { variant: "small", noPadding: true, children: [
2153
+ "Max size (",
2154
+ formatBytes(limitSize),
2155
+ ")"
2156
+ ] })
2157
+ ] }),
2158
+ /* @__PURE__ */ jsx23(
2159
+ "input",
2160
+ {
2161
+ id,
2162
+ type: "file",
2163
+ name,
2164
+ value: "",
2165
+ placeholder,
2166
+ readOnly,
2167
+ autoFocus,
2168
+ disabled,
2169
+ autoComplete,
2170
+ className,
2171
+ style,
2172
+ accept,
2173
+ multiple,
2174
+ title: "",
2175
+ ...handlers
2176
+ }
2177
+ )
2178
+ ] }),
2179
+ error !== null && /* @__PURE__ */ jsx23(Typography, { variant: "small", noPadding: true, className: "error", children: error }),
2180
+ Object.keys(value).length > 0 && /* @__PURE__ */ jsxs13(Fragment2, { children: [
2181
+ multiple && /* @__PURE__ */ jsxs13("span", { className: "total-info", children: [
2182
+ /* @__PURE__ */ jsxs13(Typography, { variant: "small", noPadding: true, children: [
2183
+ Object.keys(value).length,
2184
+ " files - ",
2185
+ formatBytes(totalSize)
2186
+ ] }),
2187
+ /* @__PURE__ */ jsx23("span", { className: "total-info--delete", onClick: deleteAll, children: /* @__PURE__ */ jsx23(FaRegTrashCan, {}) })
2188
+ ] }),
2189
+ /* @__PURE__ */ jsx23("section", { className: "input-file--files", children: /* @__PURE__ */ jsx23("section", { className: "input-file--files--content", children: Object.values(value).map(renderFileToCard) }) })
2190
+ ] })
2191
+ ] });
2192
+ };
2193
+ var InputFileController = ({ rules, ...props }) => {
2194
+ return /* @__PURE__ */ jsx23(Controller, { Component: InputFile, defaultValue: {}, inputProps: props, rules });
2195
+ };
2196
+ InputFile.Controller = InputFileController;
2197
+
2198
+ // src/components/form/input-number/input-number.component.tsx
2199
+ import { useEffect as useEffect12, useMemo as useMemo17, useState as useState14 } from "react";
2200
+ import { jsx as jsx24 } from "react/jsx-runtime";
2201
+ var RegexDecimal = {
2202
+ comma: /(?!^-)[^0-9,]/g,
2203
+ dot: /(?!^-)[^0-9.]/g
2204
+ };
2205
+ var getCleanedValue = (input, decimalSeparator = ".") => {
2206
+ const regex = decimalSeparator === "." ? RegexDecimal.dot : RegexDecimal.comma;
2207
+ const cleaned = input.replace(regex, "").replace(",", ".");
2208
+ if (!cleaned) {
2209
+ return "";
2210
+ }
2211
+ return cleaned;
2212
+ };
2213
+ var getFormattedValue = (value, format) => {
2214
+ if (!value || Number.isNaN(value)) {
2215
+ return format(0);
2216
+ }
2217
+ return format(value);
2218
+ };
2219
+ var InputNumber = ({
2220
+ name,
2221
+ value,
2222
+ setValue,
2223
+ onBlur,
2224
+ onFocus,
2225
+ pattern,
2226
+ className = "",
2227
+ style = {},
2228
+ autoFocus = false,
2229
+ readOnly = false,
2230
+ disabled = false,
2231
+ placeholder = "",
2232
+ autoComplete = "off",
2233
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2234
+ isDirty = false,
2235
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2236
+ isTouched = false,
2237
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2238
+ invalid = false,
2239
+ error,
2240
+ min,
2241
+ max,
2242
+ decimalSeparator,
2243
+ format = {
2244
+ locales: "en-US",
2245
+ style: "decimal",
2246
+ minimumFractionDigits: 0,
2247
+ maximumFractionDigits: 2
2248
+ },
2249
+ ...fieldProps
2250
+ }) => {
2251
+ const id = useMemo17(() => crypto.randomUUID(), []);
2252
+ const formatFunction = useMemo17(() => {
2253
+ if (typeof format === "function") return format;
2254
+ const { locales, ...formatConfig } = format;
2255
+ return Intl.NumberFormat(locales, formatConfig).format;
2256
+ }, [format]);
2257
+ const [formattedValue, setFormattedValue] = useState14(getFormattedValue(value, formatFunction));
2258
+ const { handlers, isFocus } = useInputHandlers({
2259
+ onChange: (e) => {
2260
+ const cleaned = getCleanedValue(e.target.value, decimalSeparator);
2261
+ if (cleaned.endsWith(".")) {
2262
+ setFormattedValue(e.target.value);
2263
+ } else {
2264
+ setFormattedValue(getFormattedValue(Number(cleaned), formatFunction));
2265
+ setValue(Number(cleaned));
2266
+ }
2267
+ },
2268
+ onBlur: (e) => {
2269
+ const cleaned = getCleanedValue(e.target.value, decimalSeparator);
2270
+ setFormattedValue(getFormattedValue(Number(cleaned), formatFunction));
2271
+ setValue(Number(cleaned));
2272
+ if (onBlur) onBlur(e);
2273
+ },
2274
+ onFocus
2275
+ });
2276
+ useEffect12(() => {
2277
+ const formatted = getFormattedValue(value, formatFunction);
2278
+ if (formattedValue !== formatted) {
2279
+ setFormattedValue(formatted);
2280
+ }
2281
+ }, [formatFunction, formattedValue, value]);
2282
+ return /* @__PURE__ */ jsx24(Field, { id, error, isFocus, ...fieldProps, children: /* @__PURE__ */ jsx24(
2283
+ "input",
2284
+ {
2285
+ id,
2286
+ type: "text",
2287
+ name,
2288
+ className,
2289
+ style,
2290
+ value: formattedValue,
2291
+ pattern,
2292
+ autoFocus,
2293
+ autoComplete,
2294
+ placeholder,
2295
+ disabled,
2296
+ readOnly,
2297
+ min,
2298
+ max,
2299
+ ...handlers
2300
+ }
2301
+ ) });
2302
+ };
2303
+ var InputController2 = ({ rules, ...props }) => {
2304
+ return /* @__PURE__ */ jsx24(Controller, { Component: InputNumber, defaultValue: 0, inputProps: props, rules });
2305
+ };
2306
+ InputNumber.Controller = InputController2;
2307
+
2308
+ // src/components/form/radio/radio.component.tsx
2309
+ import { useMemo as useMemo18 } from "react";
2310
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
2311
+ var Radio = ({
2312
+ name,
2313
+ value,
2314
+ setValue,
2315
+ onBlur,
2316
+ onFocus,
2317
+ className = "",
2318
+ style = {},
2319
+ autoFocus = false,
2320
+ readOnly = false,
2321
+ disabled = false,
2322
+ autoComplete = "off",
2323
+ radioValue,
2324
+ label,
2325
+ color = "primary" /* PRIMARY */,
2326
+ size = "regular" /* REGULAR */
2327
+ /*
2328
+ * isDirty = false,
2329
+ * isTouched = false,
2330
+ * invalid = false,
2331
+ * error,
2332
+ */
2333
+ }) => {
2334
+ const id = useMemo18(() => crypto.randomUUID(), []);
2335
+ const { handlers } = useInputHandlers({
2336
+ onChange: (e) => setValue(e.target.value),
2337
+ onBlur,
2338
+ onFocus
2339
+ });
2340
+ const radioContainerClassName = useClassNames({
2341
+ "radio-container": true,
2342
+ [className]: Boolean(className),
2343
+ [`color-${color}`]: Boolean(color)
2344
+ });
2345
+ const radioClassName = useClassNames({
2346
+ radio: true,
2347
+ "is-checked": radioValue === value,
2348
+ [`size-${size}`]: Boolean(size)
2349
+ });
2350
+ return /* @__PURE__ */ jsxs14("section", { className: radioContainerClassName, style, children: [
2351
+ /* @__PURE__ */ jsxs14("section", { className: radioClassName, children: [
2352
+ /* @__PURE__ */ jsx25("section", { className: "radio-fill" }),
2353
+ /* @__PURE__ */ jsx25(
2354
+ "input",
2355
+ {
2356
+ id,
2357
+ type: "radio",
2358
+ name,
2359
+ className: `radio-input ${className}`,
2360
+ style,
2361
+ value: radioValue,
2362
+ checked: radioValue === value,
2363
+ autoFocus,
2364
+ autoComplete,
2365
+ disabled: disabled || readOnly,
2366
+ ...handlers
2367
+ }
2368
+ )
2369
+ ] }),
2370
+ label ? /* @__PURE__ */ jsx25(Typography, { variant: "label-form", htmlFor: id, className: "radio-label", children: label }) : null
2371
+ ] });
2372
+ };
2373
+ var RadioController = ({ rules, ...props }) => {
2374
+ return /* @__PURE__ */ jsx25(Controller, { Component: Radio, defaultValue: "", inputProps: props, rules });
2375
+ };
2376
+ Radio.Controller = RadioController;
2377
+
2378
+ // src/components/form/select/select.component.tsx
2379
+ import { createContext as createContext3, useCallback as useCallback13, useContext as useContext3, useMemo as useMemo20, useRef as useRef12, useState as useState16 } from "react";
2380
+ import { ImCross as ImCross4 } from "react-icons/im";
2381
+ import { PiCaretDown } from "react-icons/pi";
2382
+
2383
+ // src/components/infinity-scroll/infinity-scroll.component.tsx
2384
+ import { useEffect as useEffect13 } from "react";
2385
+ import { Fragment as Fragment3, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
2386
+ var InfinityScroll = ({
2387
+ isLoading: isLoadingProp = false,
2388
+ hasNextPage = false,
2389
+ loadMore,
2390
+ customLoadMoreElement,
2391
+ emptyMessage,
2392
+ children
2393
+ }) => {
2394
+ const { ref, inView } = useInView();
2395
+ const isLoading = useDebounce(isLoadingProp, 100);
2396
+ useEffect13(() => {
2397
+ if (hasNextPage && inView && !isLoading) {
2398
+ loadMore();
2399
+ }
2400
+ }, [hasNextPage, isLoading, loadMore, inView]);
2401
+ const childrenExists = Array.isArray(children) ? children.length > 0 : Boolean(children);
2402
+ return /* @__PURE__ */ jsxs15(Fragment3, { children: [
2403
+ children,
2404
+ /* @__PURE__ */ jsxs15("section", { className: "infinity-scroll", children: [
2405
+ Boolean(emptyMessage) && !childrenExists && !isLoading && /* @__PURE__ */ jsx26("p", { className: "empty-message", children: emptyMessage }),
2406
+ (hasNextPage || isLoading) && (customLoadMoreElement ? customLoadMoreElement(ref) : /* @__PURE__ */ jsx26("section", { ref, className: "loading", children: isLoading && /* @__PURE__ */ jsx26("span", { className: "loading--icon", children: ":D" }) }))
2407
+ ] })
2408
+ ] });
2409
+ };
2410
+
2411
+ // src/components/form/select/option.tsx
2412
+ import { useCallback as useCallback11, useMemo as useMemo19 } from "react";
2413
+ import { jsx as jsx27 } from "react/jsx-runtime";
2414
+ var Option = ({ children, value }) => {
2415
+ const { multiselect, isEqualComparator, maxOptions, selectedValue, setValue, setIsOpen } = useSelectContext();
2416
+ const compareValuesIsEqual = useCallback11(
2417
+ (a, b) => {
2418
+ if (["number", "string"].includes(typeof a)) {
2419
+ return a === b;
2420
+ }
2421
+ return !!isEqualComparator && isEqualComparator(a, b);
2422
+ },
2423
+ [isEqualComparator]
2424
+ );
2425
+ const toggleOption = useCallback11(
2426
+ (isSelected2) => {
2427
+ if (isSelected2) {
2428
+ if (multiselect) {
2429
+ if (maxOptions && Array.isArray(selectedValue) && selectedValue.length >= maxOptions) {
2430
+ return;
2431
+ }
2432
+ setValue([...selectedValue, value]);
2433
+ } else {
2434
+ setValue(value);
2435
+ setIsOpen(false);
2436
+ }
2437
+ } else {
2438
+ if (multiselect) {
2439
+ setValue(selectedValue.filter((item) => !compareValuesIsEqual(item, value)));
2440
+ } else {
2441
+ setValue(null);
2442
+ setIsOpen(false);
2443
+ }
2444
+ }
2445
+ },
2446
+ [multiselect, maxOptions, selectedValue, setValue, value, setIsOpen, compareValuesIsEqual]
2447
+ );
2448
+ const isSelected = useMemo19(() => {
2449
+ if (selectedValue === "" || selectedValue === null) {
2450
+ return false;
2451
+ }
2452
+ if (!Array.isArray(selectedValue)) {
2453
+ return compareValuesIsEqual(value, selectedValue);
2454
+ }
2455
+ if (["number", "string"].includes(typeof value)) {
2456
+ return selectedValue.includes(value);
2457
+ }
2458
+ return selectedValue.some((item) => !!isEqualComparator && isEqualComparator(value, item));
2459
+ }, [compareValuesIsEqual, isEqualComparator, selectedValue, value]);
2460
+ const handleKeyDown = useCallback11(
2461
+ (e) => {
2462
+ if (["Enter", " "].includes(e.key)) {
2463
+ e.preventDefault();
2464
+ toggleOption(!(isSelected && multiselect));
2465
+ }
2466
+ },
2467
+ [toggleOption, isSelected, multiselect]
2468
+ );
2469
+ const optionLabel = useMemo19(() => {
2470
+ if (typeof children === "string") {
2471
+ return /* @__PURE__ */ jsx27(Typography, { "data-value": value, variant: "label", nowrap: true, children });
2472
+ }
2473
+ return children;
2474
+ }, [children, value]);
2475
+ return /* @__PURE__ */ jsx27(
2476
+ Menu.Option,
2477
+ {
2478
+ label: optionLabel,
2479
+ onKeyDown: handleKeyDown,
2480
+ asCheckbox: multiselect,
2481
+ selected: isSelected,
2482
+ onClick: (selected) => toggleOption(multiselect ? selected : true)
2483
+ }
2484
+ );
2485
+ };
2486
+
2487
+ // src/components/form/select/options.tsx
2488
+ import { useCallback as useCallback12, useEffect as useEffect14, useRef as useRef11, useState as useState15 } from "react";
2489
+ import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
2490
+ var useDynamicHeight = ({
2491
+ height,
2492
+ minHeight: defaultMinHeight,
2493
+ containerRef,
2494
+ offset,
2495
+ windowOffset
2496
+ }) => {
2497
+ const [h, setH] = useState15(void 0);
2498
+ const getMaxHeight = useCallback12(() => {
2499
+ const containerBottom = containerRef.current?.getBoundingClientRect().bottom ?? 0;
2500
+ const heightBottom = window.innerHeight - containerBottom - windowOffset - offset - 5;
2501
+ const heightTop = window.innerHeight - windowOffset * 3;
2502
+ const heightCalculated = heightBottom < defaultMinHeight ? heightTop : heightBottom;
2503
+ const maxHeight = Math.min(heightCalculated, height);
2504
+ const minHeight = Math.max(maxHeight, defaultMinHeight);
2505
+ setH(`${Math.round(minHeight)}px`);
2506
+ }, [containerRef, windowOffset, offset, defaultMinHeight, height]);
2507
+ useEffect14(() => {
2508
+ getMaxHeight();
2509
+ }, [getMaxHeight]);
2510
+ useResizeObserver(containerRef, getMaxHeight);
2511
+ useEventListener("resize", getMaxHeight);
2512
+ return { h };
2513
+ };
2514
+ var Options = ({
2515
+ children,
2516
+ searchQueryValue,
2517
+ searchQueryPlaceholder = "Search option",
2518
+ searchQueryClassName = "",
2519
+ searchQueryStyle = {},
2520
+ onSearchQuery,
2521
+ containerRef,
2522
+ height = 300
2523
+ }) => {
2524
+ const optionsGroupContainerRef = useRef11(null);
2525
+ const optionsGroupRef = useRef11(null);
2526
+ const [internalSearchQuery, setInternalSearchQuery] = useState15("");
2527
+ const searchInputRef = useRef11(null);
2528
+ const isMobile = useMediaQuery("(max-width: 480px)");
2529
+ useEventListener("keydown", (e) => {
2530
+ if (["ArrowDown", "ArrowUp"].includes(e.code)) {
2531
+ e.preventDefault();
2532
+ const focusedItem = document.activeElement;
2533
+ const isListItem = focusedItem?.tagName === "LI";
2534
+ if (isListItem) {
2535
+ switch (e.code) {
2536
+ case "ArrowDown":
2537
+ focusedItem?.nextSibling?.focus();
2538
+ break;
2539
+ case "ArrowUp":
2540
+ focusedItem?.previousElementSibling?.focus();
2541
+ break;
2542
+ }
2543
+ }
2544
+ }
2545
+ });
2546
+ const handleSearchQuery = useCallback12(
2547
+ (e) => {
2548
+ const { value } = e.target;
2549
+ if (onSearchQuery) onSearchQuery(value);
2550
+ setInternalSearchQuery(value);
2551
+ },
2552
+ [onSearchQuery]
2553
+ );
2554
+ useEffect14(() => {
2555
+ if (searchInputRef.current) {
2556
+ searchInputRef.current.focus();
2557
+ }
2558
+ }, []);
2559
+ const { h } = useDynamicHeight({
2560
+ height,
2561
+ minHeight: 150,
2562
+ containerRef,
2563
+ offset: 5,
2564
+ windowOffset: 10
2565
+ });
2566
+ const [shouldUseAuto, setShouldUseAuto] = useState15(false);
2567
+ const calculateHeight = useCallback12(() => {
2568
+ const optionsContainerHeight = Math.round(optionsGroupContainerRef.current?.getBoundingClientRect().height ?? 0) + 2;
2569
+ const optionsHeight = Math.round(optionsGroupRef.current?.scrollHeight ?? 0);
2570
+ setShouldUseAuto(optionsContainerHeight >= optionsHeight);
2571
+ }, []);
2572
+ useEffect14(calculateHeight, [calculateHeight]);
2573
+ useResizeObserver(optionsGroupContainerRef, calculateHeight);
2574
+ useResizeObserver(optionsGroupRef, calculateHeight);
2575
+ useEventListener("resize", calculateHeight);
2576
+ const selectOptionsHeader = useClassNames({
2577
+ "select-options-header": true,
2578
+ [searchQueryClassName]: Boolean(searchQueryClassName)
2579
+ });
2580
+ return /* @__PURE__ */ jsxs16(
2581
+ "section",
2582
+ {
2583
+ className: `select-options ${onSearchQuery ? "with-search-query" : ""}`,
2584
+ style: isMobile ? {
2585
+ maxHeight: window.innerHeight - 100,
2586
+ width: window.innerWidth - 100
2587
+ } : {
2588
+ height: shouldUseAuto ? "auto" : h,
2589
+ maxHeight: height,
2590
+ width: containerRef.current?.offsetWidth ?? "auto"
2591
+ },
2592
+ children: [
2593
+ onSearchQuery && /* @__PURE__ */ jsx28("section", { className: selectOptionsHeader, style: searchQueryStyle, children: /* @__PURE__ */ jsx28(
2594
+ "input",
2595
+ {
2596
+ name: "query",
2597
+ className: "input-search",
2598
+ value: searchQueryValue ?? internalSearchQuery,
2599
+ onChange: handleSearchQuery,
2600
+ placeholder: searchQueryPlaceholder,
2601
+ onClick: (e) => e.stopPropagation(),
2602
+ ref: searchInputRef,
2603
+ autoFocus: true
2604
+ }
2605
+ ) }),
2606
+ /* @__PURE__ */ jsx28("section", { className: "select-options-list-container", ref: optionsGroupContainerRef, children: /* @__PURE__ */ jsx28("ul", { className: "select-options-list", ref: optionsGroupRef, children }) })
2607
+ ]
2608
+ }
2609
+ );
2610
+ };
2611
+
2612
+ // src/components/form/select/select.component.tsx
2613
+ import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
2614
+ var SelectContext = createContext3(null);
2615
+ var useSelectContext = () => {
2616
+ const context = useContext3(SelectContext);
2617
+ if (!context) {
2618
+ throw new Error("useSelectContext must be used within a Select component");
2619
+ }
2620
+ return context;
2621
+ };
2622
+ var OptionLabel = ({ children }) => {
2623
+ const labelComponent = useMemo20(() => {
2624
+ if (typeof children === "string") {
2625
+ return /* @__PURE__ */ jsx29(Typography, { noPadding: true, variant: "label", nowrap: true, children });
2626
+ }
2627
+ return children;
2628
+ }, [children]);
2629
+ return /* @__PURE__ */ jsx29(Menu.GroupLabel, { children: labelComponent });
2630
+ };
2631
+ var DefaultOption = ({ value }) => {
2632
+ return /* @__PURE__ */ jsx29(Typography, { variant: "label", nowrap: true, children: typeof value === "string" || typeof value === "number" ? value : JSON.stringify(value) });
2633
+ };
2634
+ var DefaultValue = ({ value, multiselect }) => {
2635
+ if (multiselect) {
2636
+ return /* @__PURE__ */ jsx29(Typography, { noPadding: true, nowrap: true, variant: "label", children: `${value.length} item${value.length === 1 ? "" : "s"} selected` });
2637
+ }
2638
+ if (value === null) {
2639
+ return null;
2640
+ }
2641
+ return /* @__PURE__ */ jsx29(Typography, { noPadding: true, variant: "label", nowrap: true, children: typeof value === "string" || typeof value === "number" ? value : JSON.stringify(value) });
2642
+ };
2643
+ var Select = ({
2644
+ // Select props
2645
+ options,
2646
+ isEqualComparator,
2647
+ searchQueryValue,
2648
+ searchQueryPlaceholder,
2649
+ onSearchQuery,
2650
+ loadMore = () => null,
2651
+ isLoading = false,
2652
+ hasNextPage = false,
2653
+ emptyMessage = "No options to select",
2654
+ multiselect,
2655
+ optionComponent: OptionComponent = DefaultOption,
2656
+ valueComponent: ValueComponent = DefaultValue,
2657
+ maxOptions,
2658
+ children,
2659
+ // Shared props
2660
+ name,
2661
+ value,
2662
+ setValue,
2663
+ onBlur,
2664
+ onFocus,
2665
+ className = "",
2666
+ style = {},
2667
+ showClearOption = false,
2668
+ height,
2669
+ searchQueryStyle,
2670
+ searchQueryClassName,
2671
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2672
+ autoFocus = false,
2673
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2674
+ readOnly = false,
2675
+ disabled = false,
2676
+ placeholder = "",
2677
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2678
+ autoComplete = "off",
2679
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2680
+ isDirty = false,
2681
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2682
+ isTouched = false,
2683
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2684
+ invalid = false,
2685
+ error,
2686
+ // Field props
2687
+ ...fieldProps
2688
+ }) => {
2689
+ const modalRef = useRef12(null);
2690
+ const isMobile = useMediaQuery("(max-width: 480px)");
2691
+ const id = useMemo20(() => crypto.randomUUID(), []);
2692
+ const containerRef = useRef12(null);
2693
+ const [isOpen, setIsOpen] = useState16(false);
2694
+ const openSelect = useCallback13(
2695
+ (open) => {
2696
+ setIsOpen(open && !disabled);
2697
+ },
2698
+ [disabled]
2699
+ );
2700
+ const clearOption = useCallback13(
2701
+ (e) => {
2702
+ e.stopPropagation();
2703
+ if (multiselect) {
2704
+ setValue([]);
2705
+ } else {
2706
+ setValue(null);
2707
+ }
2708
+ },
2709
+ [multiselect, setValue]
2710
+ );
2711
+ const valueNonEmpty = useMemo20(() => {
2712
+ if (multiselect) {
2713
+ return value.length > 0;
2714
+ } else {
2715
+ return Boolean(value);
2716
+ }
2717
+ }, [multiselect, value]);
2718
+ const renderedOptions = useMemo20(() => {
2719
+ if (!children)
2720
+ return options.map((value2, key) => /* @__PURE__ */ jsx29(Select.Option, { value: value2, children: /* @__PURE__ */ jsx29(OptionComponent, { value: value2 }) }, key));
2721
+ return children;
2722
+ }, [OptionComponent, children, options]);
2723
+ return /* @__PURE__ */ jsx29(
2724
+ SelectContext.Provider,
2725
+ {
2726
+ value: {
2727
+ selectedValue: value,
2728
+ setValue,
2729
+ multiselect: multiselect ?? false,
2730
+ isEqualComparator,
2731
+ maxOptions: maxOptions ?? null,
2732
+ setIsOpen
2733
+ },
2734
+ children: /* @__PURE__ */ jsx29(Field, { id, error, isFocus: isOpen, ref: containerRef, ...fieldProps, children: /* @__PURE__ */ jsxs17(
2735
+ "section",
2736
+ {
2737
+ id: name,
2738
+ style,
2739
+ onBlur,
2740
+ className: `select ${disabled ? "disabled" : ""} ${className}`,
2741
+ children: [
2742
+ /* @__PURE__ */ jsxs17(
2743
+ "section",
2744
+ {
2745
+ id,
2746
+ className: `select-container ${valueNonEmpty && showClearOption ? "three-columns" : ""}`,
2747
+ onClick: () => openSelect(true),
2748
+ children: [
2749
+ /* @__PURE__ */ jsx29(
2750
+ "button",
2751
+ {
2752
+ type: "button",
2753
+ className: `input-button ${(Array.isArray(value) ? value.length > 0 : value) ? "" : "placeholder"}`,
2754
+ "aria-haspopup": "listbox",
2755
+ "aria-expanded": isOpen,
2756
+ onFocus: (e) => {
2757
+ openSelect(true);
2758
+ if (onFocus) onFocus(e);
2759
+ },
2760
+ children: valueNonEmpty ? /* @__PURE__ */ jsx29(ValueComponent, { ...multiselect ? { value, multiselect } : { value } }) : /* @__PURE__ */ jsx29(Typography, { variant: "label", noPadding: true, nowrap: true, children: placeholder })
2761
+ }
2762
+ ),
2763
+ valueNonEmpty && showClearOption && /* @__PURE__ */ jsx29("section", { className: "icon-close", onClick: clearOption, children: /* @__PURE__ */ jsx29(ImCross4, {}) }),
2764
+ /* @__PURE__ */ jsx29(PiCaretDown, { className: `select-caret-icon ${isOpen && "is-select-open"}` })
2765
+ ]
2766
+ }
2767
+ ),
2768
+ /* @__PURE__ */ jsx29(
2769
+ Menu,
2770
+ {
2771
+ id: "form-select",
2772
+ isOpen,
2773
+ onClose: () => openSelect(false),
2774
+ backdrop: isMobile ? "blur" : "transparent",
2775
+ opacity: isMobile ? 0.8 : 0.4,
2776
+ position: isMobile ? "center" : "bottom",
2777
+ offset: 5,
2778
+ modalRef,
2779
+ windowOffset: 10,
2780
+ transitionDuration: 200,
2781
+ containerRef: isMobile ? void 0 : containerRef,
2782
+ contentClassName: "select-menu-content",
2783
+ className: "select-options-menu",
2784
+ children: /* @__PURE__ */ jsx29(
2785
+ Options,
2786
+ {
2787
+ containerRef,
2788
+ onSearchQuery,
2789
+ searchQueryValue,
2790
+ searchQueryPlaceholder,
2791
+ searchQueryClassName,
2792
+ searchQueryStyle,
2793
+ height,
2794
+ children: /* @__PURE__ */ jsx29(
2795
+ InfinityScroll,
2796
+ {
2797
+ isLoading,
2798
+ hasNextPage,
2799
+ loadMore,
2800
+ emptyMessage,
2801
+ children: renderedOptions
2802
+ }
2803
+ )
2804
+ }
2805
+ )
2806
+ }
2807
+ )
2808
+ ]
2809
+ }
2810
+ ) })
2811
+ }
2812
+ );
2813
+ };
2814
+ var MultiSelectController = ({
2815
+ rules,
2816
+ ...props
2817
+ }) => {
2818
+ return /* @__PURE__ */ jsx29(
2819
+ Controller,
2820
+ {
2821
+ Component: Select,
2822
+ defaultValue: [],
2823
+ inputProps: {
2824
+ ...props,
2825
+ multiselect: true
2826
+ },
2827
+ rules
2828
+ }
2829
+ );
2830
+ };
2831
+ var SingleSelectController = ({
2832
+ rules,
2833
+ ...props
2834
+ }) => {
2835
+ return /* @__PURE__ */ jsx29(
2836
+ Controller,
2837
+ {
2838
+ Component: Select,
2839
+ defaultValue: null,
2840
+ inputProps: {
2841
+ ...props,
2842
+ multiselect: false
2843
+ },
2844
+ rules
2845
+ }
2846
+ );
2847
+ };
2848
+ var SelectController = (props) => {
2849
+ const { multiselect } = props;
2850
+ if (multiselect) {
2851
+ return /* @__PURE__ */ jsx29(MultiSelectController, { ...props, multiselect: true });
2852
+ }
2853
+ return /* @__PURE__ */ jsx29(SingleSelectController, { ...props, multiselect: false });
2854
+ };
2855
+ Select.Controller = SelectController;
2856
+ Select.Option = Option;
2857
+ Select.OptionLabel = OptionLabel;
2858
+
2859
+ // src/components/form/slider/slider.component.tsx
2860
+ import { useMemo as useMemo21 } from "react";
2861
+ import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
2862
+ var Slider = ({
2863
+ name,
2864
+ value,
2865
+ setValue,
2866
+ onBlur,
2867
+ onFocus,
2868
+ min,
2869
+ max,
2870
+ step,
2871
+ onlySlider = false,
2872
+ className = "",
2873
+ style = {},
2874
+ autoFocus = false,
2875
+ readOnly = false,
2876
+ disabled = false,
2877
+ placeholder = "",
2878
+ autoComplete = "off",
2879
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2880
+ isDirty = false,
2881
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2882
+ isTouched = false,
2883
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2884
+ invalid = false,
2885
+ error,
2886
+ ...fieldProps
2887
+ }) => {
2888
+ const id = useMemo21(() => crypto.randomUUID(), []);
2889
+ const onBlurInput = (e) => {
2890
+ if (onBlur) onBlur(e);
2891
+ const parsedValue = parseInt(`${value}`);
2892
+ if (min !== void 0 && parsedValue < min) {
2893
+ setValue(min);
2894
+ }
2895
+ if (max !== void 0 && parsedValue > max) {
2896
+ setValue(max);
2897
+ }
2898
+ setValue(parsedValue);
2899
+ };
2900
+ const { isFocus, handlers } = useInputHandlers({
2901
+ onBlur: onBlurInput,
2902
+ onChange: (e) => setValue(+e.target.value),
2903
+ onFocus
2904
+ });
2905
+ const inputSliderClassName = useClassNames({
2906
+ "input-slider": true,
2907
+ "is-focus": isFocus
2908
+ });
2909
+ return /* @__PURE__ */ jsx30(Field, { id, error, isFocus, ...fieldProps, children: /* @__PURE__ */ jsxs18("section", { className: inputSliderClassName, children: [
2910
+ /* @__PURE__ */ jsx30(
2911
+ "input",
2912
+ {
2913
+ id,
2914
+ type: "range",
2915
+ name,
2916
+ className: `slider ${className}`,
2917
+ style,
2918
+ value,
2919
+ autoFocus,
2920
+ autoComplete,
2921
+ placeholder,
2922
+ disabled,
2923
+ readOnly,
2924
+ min,
2925
+ max,
2926
+ step,
2927
+ ...handlers
2928
+ }
2929
+ ),
2930
+ !onlySlider && /* @__PURE__ */ jsx30(
2931
+ "input",
2932
+ {
2933
+ id,
2934
+ type: "number",
2935
+ name,
2936
+ className: `slider-number ${className}`,
2937
+ style,
2938
+ value,
2939
+ autoComplete,
2940
+ disabled,
2941
+ readOnly,
2942
+ min,
2943
+ max,
2944
+ step,
2945
+ ...handlers
2946
+ }
2947
+ )
2948
+ ] }) });
2949
+ };
2950
+ var SliderController = ({ rules, ...props }) => {
2951
+ return /* @__PURE__ */ jsx30(Controller, { Component: Slider, defaultValue: 0, inputProps: props, rules });
2952
+ };
2953
+ Slider.Controller = SliderController;
2954
+
2955
+ // src/components/form/textarea/textarea.component.tsx
2956
+ import { useMemo as useMemo22 } from "react";
2957
+ import { jsx as jsx31 } from "react/jsx-runtime";
2958
+ var Textarea = ({
2959
+ name,
2960
+ value,
2961
+ setValue,
2962
+ onBlur,
2963
+ onFocus,
2964
+ rows = 4,
2965
+ resize = "vertical",
2966
+ className = "",
2967
+ style = {},
2968
+ autoFocus = false,
2969
+ readOnly = false,
2970
+ disabled = false,
2971
+ placeholder = "",
2972
+ autoComplete = "off",
2973
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2974
+ isDirty = false,
2975
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2976
+ isTouched = false,
2977
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2978
+ invalid = false,
2979
+ error,
2980
+ ...fieldProps
2981
+ }) => {
2982
+ const id = useMemo22(() => crypto.randomUUID(), []);
2983
+ const { handlers, isFocus } = useInputHandlers({
2984
+ onBlur,
2985
+ onChange: (e) => setValue(e.target.value),
2986
+ onFocus
2987
+ });
2988
+ const textareaClassName = useClassNames({
2989
+ textarea: true,
2990
+ [className]: Boolean(className)
2991
+ });
2992
+ return /* @__PURE__ */ jsx31(Field, { id, error, isFocus, ...fieldProps, children: /* @__PURE__ */ jsx31(
2993
+ "textarea",
2994
+ {
2995
+ id,
2996
+ name,
2997
+ className: textareaClassName,
2998
+ style: {
2999
+ resize,
3000
+ ...style
3001
+ },
3002
+ value,
3003
+ rows,
3004
+ ...handlers,
3005
+ autoFocus,
3006
+ autoComplete,
3007
+ placeholder,
3008
+ disabled,
3009
+ readOnly
3010
+ }
3011
+ ) });
3012
+ };
3013
+ var TextareaController = ({ rules, ...props }) => {
3014
+ return /* @__PURE__ */ jsx31(Controller, { Component: Textarea, defaultValue: "", inputProps: props, rules });
3015
+ };
3016
+ Textarea.Controller = TextareaController;
3017
+
3018
+ // src/components/form/switch/switch.component.tsx
3019
+ import { useMemo as useMemo23 } from "react";
3020
+
3021
+ // src/components/tooltips/click-to-copy/click-to-copy.component.tsx
3022
+ import { useState as useState17 } from "react";
3023
+
3024
+ // src/components/tooltips/tooltip/tooltip.component.tsx
3025
+ import { cloneElement } from "react";
3026
+ import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
3027
+ var Tooltip = ({
3028
+ position = "top" /* TOP */,
3029
+ children,
3030
+ content,
3031
+ offset = 5,
3032
+ disabled = false
3033
+ }) => {
3034
+ const { containerRef, openModal, closeModal, isOpen } = useModal();
3035
+ const classNames = useClassNames({
3036
+ tooltip: true,
3037
+ [position]: true
3038
+ });
3039
+ useEventListener("mouseenter", () => openModal(), containerRef);
3040
+ useEventListener("mouseleave", () => closeModal(), containerRef);
3041
+ if (disabled) return children;
3042
+ return /* @__PURE__ */ jsxs19(Fragment4, { children: [
3043
+ cloneElement(children, { ref: containerRef }),
3044
+ /* @__PURE__ */ jsx32(
3045
+ Modal,
3046
+ {
3047
+ backdrop: "none",
3048
+ id: "tooltip",
3049
+ isOpen,
3050
+ containerRef,
3051
+ onClose: closeModal,
3052
+ position,
3053
+ className: classNames,
3054
+ closeOnClickOutside: false,
3055
+ offset: 6 + +offset,
3056
+ windowOffset: 10,
3057
+ transitionDuration: 100,
3058
+ closeAnimationClassName: "close-animation",
3059
+ children: /* @__PURE__ */ jsx32("span", { className: "tooltip-content", children: content })
3060
+ }
3061
+ )
3062
+ ] });
3063
+ };
3064
+
3065
+ // src/components/tooltips/click-to-copy/click-to-copy.component.tsx
3066
+ import { jsx as jsx33 } from "react/jsx-runtime";
3067
+ var ClickToCopy = ({
3068
+ children,
3069
+ value,
3070
+ position,
3071
+ offset,
3072
+ tooltipText,
3073
+ tooltipCopiedText,
3074
+ copiedTextTimeout = 500
3075
+ }) => {
3076
+ const [justCopied, setJustCopied] = useState17(false);
3077
+ const handleCopy = () => {
3078
+ setJustCopied(true);
3079
+ navigator.clipboard.writeText(value);
3080
+ setTimeout(() => setJustCopied(false), copiedTextTimeout);
3081
+ };
3082
+ return /* @__PURE__ */ jsx33(
3083
+ Tooltip,
3084
+ {
3085
+ content: justCopied && tooltipCopiedText ? tooltipCopiedText : tooltipText,
3086
+ position,
3087
+ offset,
3088
+ children: /* @__PURE__ */ jsx33("span", { onClick: handleCopy, children })
3089
+ }
3090
+ );
3091
+ };
3092
+
3093
+ // src/components/form/switch/switch.component.tsx
3094
+ import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
3095
+ var DotSizeMap = {
3096
+ ["small" /* SMALL */]: 1,
3097
+ ["regular" /* REGULAR */]: 1.2,
3098
+ ["large" /* LARGE */]: 1.4
3099
+ };
3100
+ var WidthMap = {
3101
+ ["small" /* SMALL */]: 2,
3102
+ ["regular" /* REGULAR */]: 2.5,
3103
+ ["large" /* LARGE */]: 3
3104
+ };
3105
+ var Switch = ({
3106
+ name,
3107
+ value,
3108
+ setValue,
3109
+ onBlur,
3110
+ onFocus,
3111
+ className = "",
3112
+ style = {},
3113
+ autoFocus = false,
3114
+ readOnly = false,
3115
+ disabled = false,
3116
+ placeholder = "",
3117
+ autoComplete = "off",
3118
+ label,
3119
+ leftLabel,
3120
+ rightLabel,
3121
+ width = "regular" /* REGULAR */,
3122
+ size = "regular" /* REGULAR */,
3123
+ dotHoverSize = 1.3,
3124
+ padding = 0.25,
3125
+ leftIcon: LeftIcon,
3126
+ rightIcon: RightIcon,
3127
+ internalLeftIcon: InternalLeftIcon,
3128
+ internalRightIcon: InternalRightIcon,
3129
+ leftIconTooltip,
3130
+ rightIconTooltip,
3131
+ color
3132
+ /*
3133
+ * isDirty = false,
3134
+ * isTouched = false,
3135
+ * invalid = false,
3136
+ * error,
3137
+ */
3138
+ }) => {
3139
+ const id = useMemo23(() => crypto.randomUUID(), []);
3140
+ const { handlers } = useInputHandlers({
3141
+ onChange: (e) => setValue(e.target.checked),
3142
+ onBlur,
3143
+ onFocus
3144
+ });
3145
+ const switchContainerClassName = useClassNames({
3146
+ "switch-container": true,
3147
+ [className]: Boolean(className),
3148
+ [`color-${color}`]: Boolean(color)
3149
+ });
3150
+ const switchClassName = useClassNames({
3151
+ switch: true,
3152
+ "is-checked": value,
3153
+ "is-readonly": !disabled && readOnly
3154
+ });
3155
+ const dotSize = DotSizeMap[size] ?? DotSizeMap["regular" /* REGULAR */];
3156
+ const _width = (WidthMap[width] ?? WidthMap["regular" /* REGULAR */]) * dotSize;
3157
+ const _padding = Math.min(padding, dotSize);
3158
+ return /* @__PURE__ */ jsxs20(
3159
+ "section",
3160
+ {
3161
+ className: switchContainerClassName,
3162
+ style: {
3163
+ ...style,
3164
+ "--width": `${_width}em`,
3165
+ "--dot-size": `${dotSize}em`,
3166
+ "--dot-hover-size": `${dotSize * Math.min(Math.max(dotHoverSize, 1), 2)}em`,
3167
+ "--padding": `${_padding}em`
3168
+ },
3169
+ children: [
3170
+ leftLabel ? /* @__PURE__ */ jsx34(Typography, { variant: "label-form", className: "switch-label", htmlFor: id, children: leftLabel }) : null,
3171
+ LeftIcon !== void 0 && /* @__PURE__ */ jsx34(Tooltip, { content: leftIconTooltip, disabled: !leftIconTooltip, offset: 10, children: /* @__PURE__ */ jsx34(LeftIcon, { size: `${dotSize * 0.7}em`, className: "switch-icon", onClick: () => setValue(!value) }) }),
3172
+ /* @__PURE__ */ jsxs20("section", { className: switchClassName, children: [
3173
+ InternalLeftIcon !== void 0 && /* @__PURE__ */ jsx34("span", { className: "switch-internal-left-icon", children: /* @__PURE__ */ jsx34(InternalLeftIcon, { size: `${dotSize * 0.7}em` }) }),
3174
+ InternalRightIcon !== void 0 && /* @__PURE__ */ jsx34("span", { className: "switch-internal-right-icon", children: /* @__PURE__ */ jsx34(InternalRightIcon, { size: `${dotSize * 0.7}em` }) }),
3175
+ /* @__PURE__ */ jsx34("span", { className: "switch-dot" }),
3176
+ /* @__PURE__ */ jsx34(
3177
+ "input",
3178
+ {
3179
+ id,
3180
+ type: "checkbox",
3181
+ name,
3182
+ className: `switch-checkbox ${className}`,
3183
+ style,
3184
+ checked: value,
3185
+ autoFocus,
3186
+ autoComplete,
3187
+ placeholder,
3188
+ disabled: disabled || readOnly,
3189
+ ...handlers
3190
+ }
3191
+ )
3192
+ ] }),
3193
+ RightIcon !== void 0 && /* @__PURE__ */ jsx34(Tooltip, { content: rightIconTooltip, disabled: !rightIconTooltip, offset: 10, children: /* @__PURE__ */ jsx34(RightIcon, { size: `${dotSize * 0.7}em`, className: "switch-icon", onClick: () => setValue(!value) }) }),
3194
+ label || rightLabel ? /* @__PURE__ */ jsx34(Typography, { variant: "label-form", className: "switch-label", htmlFor: id, children: label || rightLabel }) : null
3195
+ ]
3196
+ }
3197
+ );
3198
+ };
3199
+ var SwitchController = ({ rules, ...props }) => {
3200
+ return /* @__PURE__ */ jsx34(Controller, { Component: Switch, defaultValue: false, inputProps: props, rules });
3201
+ };
3202
+ Switch.Controller = SwitchController;
3203
+
3204
+ // src/components/image/image.tsx
3205
+ import { jsx as jsx35 } from "react/jsx-runtime";
3206
+ var Image = ({ alt = "", loading = "eager", ...props }) => {
3207
+ return /* @__PURE__ */ jsx35("img", { loading, alt, ...props, width: "100%" });
3208
+ };
3209
+
3210
+ // src/components/smart-table/smart-table.component.tsx
3211
+ import { useMemo as useMemo25, useState as useState19 } from "react";
3212
+
3213
+ // src/components/smart-table/smart-table.column.tsx
3214
+ import { useMemo as useMemo24 } from "react";
3215
+ import { MdArrowDownward, MdArrowUpward } from "react-icons/md";
3216
+ import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
3217
+ var SmartTableColumn = ({
3218
+ header,
3219
+ sortBy,
3220
+ icon: Icon,
3221
+ width,
3222
+ field,
3223
+ toggleSortField,
3224
+ sortField,
3225
+ orderField,
3226
+ hidden
3227
+ }) => {
3228
+ const sortByKey = sortBy !== void 0 ? sortBy : field;
3229
+ const columnClassName = useClassNames({
3230
+ "sort-on-click": Boolean(sortByKey)
3231
+ });
3232
+ const columnOnClick = sortByKey ? () => toggleSortField(sortByKey) : void 0;
3233
+ const sortIcon = useMemo24(() => {
3234
+ if (!sortByKey) return null;
3235
+ return /* @__PURE__ */ jsx36("span", { className: "sort-icon", children: Boolean(sortField) && sortField === sortByKey && (orderField === "asc" ? /* @__PURE__ */ jsx36(MdArrowUpward, {}) : /* @__PURE__ */ jsx36(MdArrowDownward, {})) });
3236
+ }, [sortByKey, sortField, orderField]);
3237
+ if (hidden) return null;
3238
+ return /* @__PURE__ */ jsxs21("th", { style: { width }, className: columnClassName, onClick: columnOnClick, children: [
3239
+ /* @__PURE__ */ jsxs21(Grid, { flow: "column", gap: "0.5em", jc: "space-between", ai: "center", children: [
3240
+ Icon ? /* @__PURE__ */ jsx36(Icon, {}) : null,
3241
+ /* @__PURE__ */ jsx36(Typography, { variant: "label", noPadding: true, children: header }),
3242
+ sortIcon
3243
+ ] }),
3244
+ /* @__PURE__ */ jsx36(Ripple, { color: "var(--primary-700)" })
3245
+ ] });
3246
+ };
3247
+
3248
+ // src/components/smart-table/smart-table.helpers.tsx
3249
+ import { jsx as jsx37 } from "react/jsx-runtime";
3250
+ var renderRowColumn = (data, { field, render, Component }, rowKey) => {
3251
+ if (field && data[field])
3252
+ return /* @__PURE__ */ jsx37(Typography, { noPadding: true, nowrap: true, children: data[field] });
3253
+ if (render) return render(data, rowKey);
3254
+ if (Component) return /* @__PURE__ */ jsx37(Component, { data, rowKey });
3255
+ };
3256
+ var renderRow = (data, columns, rowKey) => columns.map((column, key) => column.hidden ? null : /* @__PURE__ */ jsx37("td", { children: renderRowColumn(data, column, rowKey) }, key));
3257
+ var sortData = (data, sortBy, order) => {
3258
+ if (sortBy) {
3259
+ return data.toSorted((a, b) => {
3260
+ const fieldA = a[sortBy];
3261
+ const fieldB = b[sortBy];
3262
+ if (["number", "boolean", "string"].includes(typeof fieldA) && ["number", "boolean", "string"].includes(typeof fieldB)) {
3263
+ if (fieldA === fieldB) return 0;
3264
+ if (order === "asc") {
3265
+ return fieldA > fieldB ? 1 : -1;
3266
+ }
3267
+ return fieldA > fieldB ? -1 : 1;
3268
+ }
3269
+ return 0;
3270
+ });
3271
+ }
3272
+ return data;
3273
+ };
3274
+
3275
+ // src/components/smart-table/smart-table.hooks.ts
3276
+ import { useCallback as useCallback14, useState as useState18 } from "react";
3277
+ var useSort = () => {
3278
+ const [[sortBy, order], setSortField] = useState18([null, null]);
3279
+ const toggleSortField = useCallback14((sortByField) => {
3280
+ setSortField(([sortBy2, order2]) => {
3281
+ if (sortByField !== sortBy2) {
3282
+ return [sortByField, "asc"];
3283
+ }
3284
+ if (order2 === "asc") {
3285
+ return [sortByField, "desc"];
3286
+ }
3287
+ return [null, null];
3288
+ });
3289
+ }, []);
3290
+ return {
3291
+ sortBy,
3292
+ order,
3293
+ toggleSortField
3294
+ };
3295
+ };
3296
+
3297
+ // src/components/smart-table/smart-table.row.tsx
3298
+ import { jsx as jsx38 } from "react/jsx-runtime";
3299
+ var SmartTableRow = ({
3300
+ data,
3301
+ columns,
3302
+ isSelected = false,
3303
+ selectable = false,
3304
+ rowKey
3305
+ }) => {
3306
+ const rowClassName = useClassNames({
3307
+ "row-selected": selectable && isSelected
3308
+ });
3309
+ return /* @__PURE__ */ jsx38("tr", { className: rowClassName, children: renderRow(data, columns, rowKey) });
3310
+ };
3311
+
3312
+ // src/components/smart-table/smart-table.component.tsx
3313
+ import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
3314
+ var SmartTable = ({
3315
+ columns: initialColumns,
3316
+ data,
3317
+ width,
3318
+ selectable = false,
3319
+ rowId,
3320
+ className = "",
3321
+ tableClassName: _tableClassName = ""
3322
+ }) => {
3323
+ const [selected, setSelected] = useState19({});
3324
+ const tableClassName = useClassNames({
3325
+ "smart-table": true,
3326
+ [_tableClassName]: Boolean(_tableClassName),
3327
+ "layout-fixed": width === "content",
3328
+ "layout-scrollable": width === "scroll"
3329
+ });
3330
+ const tableContainerClassName = useClassNames({
3331
+ "smart-table-container": true,
3332
+ [className]: Boolean(className)
3333
+ });
3334
+ const { sortBy, order, toggleSortField } = useSort();
3335
+ const columns = useMemo25(() => {
3336
+ let finalColumns = [...initialColumns];
3337
+ if (selectable) {
3338
+ finalColumns = [
3339
+ {
3340
+ header: `${Object.values(selected).length}`,
3341
+ render: (data2, rowKey) => /* @__PURE__ */ jsx39(
3342
+ Checkbox,
3343
+ {
3344
+ name: `selected-${rowKey}`,
3345
+ value: `${rowKey}` in selected,
3346
+ setValue: (isSelected) => {
3347
+ setSelected((prev) => {
3348
+ const copy = { ...prev };
3349
+ if (isSelected) {
3350
+ copy[`${rowKey}`] = data2;
3351
+ } else {
3352
+ delete copy[`${rowKey}`];
3353
+ }
3354
+ return copy;
3355
+ });
3356
+ }
3357
+ }
3358
+ )
3359
+ },
3360
+ ...finalColumns
3361
+ ];
3362
+ }
3363
+ return finalColumns;
3364
+ }, [initialColumns, selectable, selected]);
3365
+ const rows = useMemo25(() => sortData(data, sortBy, order), [data, sortBy, order]);
3366
+ return /* @__PURE__ */ jsx39("section", { className: tableContainerClassName, children: /* @__PURE__ */ jsxs22("table", { className: tableClassName, children: [
3367
+ /* @__PURE__ */ jsx39("thead", { children: /* @__PURE__ */ jsx39("tr", { children: columns.map((column, key) => /* @__PURE__ */ jsx39(
3368
+ SmartTableColumn,
3369
+ {
3370
+ toggleSortField,
3371
+ sortField: sortBy,
3372
+ orderField: order,
3373
+ ...column
3374
+ },
3375
+ key
3376
+ )) }) }),
3377
+ /* @__PURE__ */ jsx39("tbody", { children: rows.map((row) => /* @__PURE__ */ jsx39(
3378
+ SmartTableRow,
3379
+ {
3380
+ rowKey: row[rowId],
3381
+ data: row,
3382
+ columns,
3383
+ isSelected: `${row[rowId]}` in selected,
3384
+ selectable
3385
+ },
3386
+ row[rowId]
3387
+ )) })
3388
+ ] }) });
3389
+ };
3390
+
3391
+ // src/components/tabs/tabs.tsx
3392
+ import { createContext as createContext4, useContext as useContext4, useEffect as useEffect16, useState as useState21 } from "react";
3393
+
3394
+ // src/components/tabs/tabs-list.tsx
3395
+ import { useEffect as useEffect15, useRef as useRef13, useState as useState20 } from "react";
3396
+ import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
3397
+ var DefaultRect = {
3398
+ top: 0,
3399
+ left: 0,
3400
+ width: 0,
3401
+ height: 0
3402
+ };
3403
+ var TabsList = ({
3404
+ tabs = [],
3405
+ variant = "solid" /* SOLID */,
3406
+ radius = "full" /* Full */,
3407
+ direction = "horizontal" /* HORIZONTAL */,
3408
+ color,
3409
+ children,
3410
+ openTab,
3411
+ size = "medium" /* Medium */,
3412
+ className = "",
3413
+ style = {}
3414
+ }) => {
3415
+ const containerRef = useRef13(null);
3416
+ const selectedTabRef = useRef13(null);
3417
+ const [isSelectorActive, setIsSelectorActive] = useState20(false);
3418
+ const [selector, setSelector] = useState20(DefaultRect);
3419
+ const containerClassNames = useClassNames({
3420
+ "tab-list": true,
3421
+ [`variant-${variant}`]: Boolean(variant),
3422
+ [`size-${size}`]: Boolean(size),
3423
+ [`radius-${radius}`]: Boolean(radius),
3424
+ [`color-${color}`]: Boolean(color),
3425
+ "vertical-direction": direction === "vertical" /* VERTICAL */,
3426
+ [className]: Boolean(className)
3427
+ });
3428
+ useEffect15(() => {
3429
+ const selectedRect = selectedTabRef.current?.getBoundingClientRect() ?? DefaultRect;
3430
+ const containerRect = containerRef.current?.getBoundingClientRect() ?? DefaultRect;
3431
+ const width = selectedRect.width;
3432
+ const height = variant === "line" /* LINE */ ? 2 : selectedRect.height;
3433
+ const left = selectedRect.left - containerRect.left;
3434
+ const top = variant === "line" /* LINE */ ? selectedRect.top + selectedRect.height - containerRect.top : selectedRect.top - containerRect.top;
3435
+ setSelector({ left, top, width, height });
3436
+ if (!isSelectorActive) {
3437
+ setTimeout(() => {
3438
+ setIsSelectorActive(true);
3439
+ }, 100);
3440
+ }
3441
+ }, [isSelectorActive, variant, openTab]);
3442
+ return /* @__PURE__ */ jsxs23("section", { className: containerClassNames, ref: containerRef, style, children: [
3443
+ Boolean(variant) && /* @__PURE__ */ jsx40("span", { className: `tabs-selector ${isSelectorActive ? "active" : ""}`, style: selector }),
3444
+ tabs.map(({ id, label }) => /* @__PURE__ */ jsx40(Tabs.Tab, { id, ref: id === openTab ? selectedTabRef : void 0, children: label }, id)),
3445
+ children
3446
+ ] });
3447
+ };
3448
+
3449
+ // src/components/tabs/tabs.tsx
3450
+ import { jsx as jsx41 } from "react/jsx-runtime";
3451
+ var TabsContext = createContext4(null);
3452
+ var useTab = (id) => {
3453
+ const context = useContext4(TabsContext);
3454
+ if (!context) {
3455
+ throw new Error("You cant use this component out off an Tabs component");
3456
+ }
3457
+ const { openTab, changeOpenTab } = context;
3458
+ return [openTab === id, () => changeOpenTab(id)];
3459
+ };
3460
+ var useTabsContext = () => {
3461
+ const context = useContext4(TabsContext);
3462
+ if (!context) {
3463
+ throw new Error("You cant use this component out off an Tabs component");
3464
+ }
3465
+ return context;
3466
+ };
3467
+ var Tabs = ({ children, defaultOpenTab, onChange }) => {
3468
+ const [openTab, setOpenTab] = useState21(defaultOpenTab);
3469
+ useEffect16(() => {
3470
+ if (onChange) {
3471
+ onChange(openTab);
3472
+ }
3473
+ }, [openTab, onChange]);
3474
+ return /* @__PURE__ */ jsx41(
3475
+ TabsContext.Provider,
3476
+ {
3477
+ value: {
3478
+ openTab,
3479
+ changeOpenTab: (id) => setOpenTab(id)
3480
+ },
3481
+ children
3482
+ }
3483
+ );
3484
+ };
3485
+ var Tab = ({ id, children, className = "", style = {}, onClick, ref }) => {
3486
+ const [isOpen, openTab] = useTab(id);
3487
+ const tabClassNames = useClassNames({
3488
+ tab: true,
3489
+ [className]: !!className,
3490
+ "is-open": isOpen
3491
+ });
3492
+ const handleClick = (e) => {
3493
+ openTab();
3494
+ if (onClick) {
3495
+ onClick(e);
3496
+ }
3497
+ };
3498
+ return /* @__PURE__ */ jsx41("span", { className: tabClassNames, style, onClick: handleClick, ref, children });
3499
+ };
3500
+ var TabPanel = ({ id, children }) => {
3501
+ const [isOpen] = useTab(id);
3502
+ return isOpen ? children : null;
3503
+ };
3504
+ var TabList = ({ children, ...props }) => {
3505
+ const { openTab } = useTabsContext();
3506
+ return /* @__PURE__ */ jsx41(TabsList, { ...props, openTab, children });
3507
+ };
3508
+ Tabs.Tab = Tab;
3509
+ Tabs.TabPanel = TabPanel;
3510
+ Tabs.TabList = TabList;
3511
+
3512
+ // src/components/tag/tag.component.tsx
3513
+ import { jsx as jsx42 } from "react/jsx-runtime";
3514
+ var TagRounded = /* @__PURE__ */ ((TagRounded2) => {
3515
+ TagRounded2["NONE"] = "none";
3516
+ TagRounded2["SMALL"] = "small";
3517
+ TagRounded2["MEDIUM"] = "medium";
3518
+ TagRounded2["LARGE"] = "large";
3519
+ TagRounded2["FULL"] = "full";
3520
+ return TagRounded2;
3521
+ })(TagRounded || {});
3522
+ var Tag = ({ children, rounded = "medium" /* MEDIUM */, selected = false, noWrap = false, ref }) => {
3523
+ const className = useClassNames({
3524
+ tag: true,
3525
+ [`rounded-${rounded}`]: Boolean(rounded),
3526
+ "is-selected": selected,
3527
+ "no-wrap": noWrap
3528
+ });
3529
+ return /* @__PURE__ */ jsx42("span", { className, ref, children });
3530
+ };
3531
+ export {
3532
+ Accordion,
3533
+ AccordionItem,
3534
+ ActionModal,
3535
+ AsideModal,
3536
+ Backdrop,
3537
+ Button,
3538
+ Checkbox,
3539
+ ClickToCopy,
3540
+ ConfirmationModal,
3541
+ Cursor,
3542
+ DatePicker,
3543
+ Field,
3544
+ FieldOrientation,
3545
+ FieldVariant,
3546
+ FlipCard,
3547
+ HoverCard,
3548
+ Image,
3549
+ InfinityScroll,
3550
+ Input,
3551
+ InputColor,
3552
+ InputFile,
3553
+ InputNumber,
3554
+ InputPassword,
3555
+ Line,
3556
+ LineOrientation,
3557
+ LineStyle,
3558
+ Menu,
3559
+ Modal,
3560
+ ModalBackdrop,
3561
+ Portal,
3562
+ Radio,
3563
+ Ripple,
3564
+ Select,
3565
+ SlideCard,
3566
+ Slider,
3567
+ SmartTable,
3568
+ Switch,
3569
+ Tabs,
3570
+ Tag,
3571
+ TagRounded,
3572
+ Textarea,
3573
+ Tooltip,
3574
+ Typography,
3575
+ useAccordionItem
3576
+ };
3
3577
  //# sourceMappingURL=components.js.map