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