UNPKG

rharuow-ds

Version:

Modern React Design System with 20 components and auto color system. Define only 2 colors (primary/secondary) and get automatic variations (hover, light, dark) with proper text contrast (WCAG AA). Includes: Table, Card, Button, Chip, Pagination, Input, Te

1 lines 65.7 kB
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),Z=require("react-hook-form"),me=require("react-dom");function Qe(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const n=Qe(r);function Ie(e){var a,t,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(a=0;a<s;a++)e[a]&&(t=Ie(e[a]))&&(o&&(o+=" "),o+=t)}else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function Xe(){for(var e,a,t=0,o="",s=arguments.length;t<s;t++)(e=arguments[t])&&(a=Ie(e))&&(o&&(o+=" "),o+=a);return o}function l(...e){return Xe(...e)}const Ze=({children:e,variant:a="default",size:t="md",className:o="",...s})=>{const u="rounded font-medium transition disabled:cursor-not-allowed disabled:opacity-50",c={default:"bg-[var(--primary)] text-[var(--primary-text)] hover:bg-[var(--primary-hover)] disabled:hover:bg-[var(--primary)]",outline:"border border-[var(--primary)] text-[var(--primary)] hover:bg-[var(--primary-light)] disabled:hover:bg-white",secondary:"bg-[var(--secondary)] text-[var(--secondary-text)] hover:bg-[var(--secondary-hover)] disabled:hover:bg-[var(--secondary)]",icon:"inline-flex items-center justify-center bg-[var(--primary)] text-[var(--primary-text)] hover:bg-[var(--primary-hover)] disabled:hover:bg-[var(--primary)]"},v={xl:"px-8 py-4 text-xl",lg:"px-6 py-3 text-lg",md:"px-4 py-2 text-base",sm:"px-3 py-1.5 text-sm",xs:"px-2 py-1 text-xs"};return r.createElement("button",{className:l(u,c[a],v[t],o),...s},e)},et=({label:e,active:a=!1,onChange:t,icon:o,disabled:s=!1,className:u="",onClick:c,...v})=>{const m=g=>{s||(t==null||t(!a),c==null||c(g))};return r.createElement("button",{type:"button",role:"switch","aria-checked":a,"aria-label":e,disabled:s,onClick:m,className:l("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium","border transition-all duration-200 select-none cursor-pointer","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-1",a?"bg-[var(--primary)] text-[var(--chip-active-text)] border-[var(--primary)] hover:bg-[var(--primary-hover)] hover:border-[var(--primary-hover)]":"bg-[var(--chip-inactive-bg)] text-[var(--chip-inactive-text)] border-[var(--chip-inactive-border)] hover:bg-[var(--chip-inactive-hover-bg)] hover:border-[var(--primary)]",s&&"opacity-40 cursor-not-allowed pointer-events-none",u),...v},o&&r.createElement("span",{className:"flex items-center"},o),e)};function tt(e,a){if(a<=0)return[];let t=Math.max(1,e-1),o=Math.min(a,t+2);t=Math.max(1,o-2);const s=[];for(let u=t;u<=o;u++)s.push(u);return o<a&&(a-o>1&&s.push("..."),s.push(a)),s}const be=({active:e=!1,disabled:a=!1,onClick:t,children:o,...s})=>r.createElement("button",{type:"button",onClick:t,disabled:a,className:l("min-w-[2rem] h-8 px-2 rounded font-medium text-sm transition-all duration-150","flex items-center justify-center select-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)] focus-visible:ring-offset-1",e?"bg-[var(--primary)] text-[var(--pagination-active-text)] border border-[var(--primary)]":"bg-[var(--pagination-item-bg)] text-[var(--pagination-item-text)] border border-[var(--pagination-item-border)] hover:bg-[var(--pagination-item-hover-bg)] hover:border-[var(--primary)] hover:text-[var(--primary)]",a&&"opacity-40 cursor-not-allowed pointer-events-none"),...s},o),rt=()=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:16,height:16,"aria-hidden":"true"},r.createElement("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})),at=()=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:16,height:16,"aria-hidden":"true"},r.createElement("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})),nt=({totalPages:e,currentPage:a,onPageChange:t,disabled:o=!1,className:s=""})=>{if(e<=0)return null;const u=a<=1,c=a>=e,v=tt(a,e);return r.createElement("nav",{role:"navigation","aria-label":"Paginação",className:l("flex items-center gap-1",s)},!u&&r.createElement(be,{"aria-label":"Página anterior",disabled:o,onClick:()=>t(a-1)},r.createElement(rt,null)),v.map((m,g)=>m==="..."?r.createElement("span",{key:`ellipsis-${g}`,className:"min-w-[2rem] h-8 flex items-center justify-center text-sm text-[var(--pagination-item-text)] select-none","aria-hidden":"true"},"…"):r.createElement(be,{key:m,active:m===a,disabled:o,"aria-label":m===a?`Página atual, página ${m}`:`Ir para página ${m}`,"aria-current":m===a?"page":void 0,onClick:()=>t(m)},m)),!c&&r.createElement(be,{"aria-label":"Próxima página",disabled:o,onClick:()=>t(a+1)},r.createElement(at,null)))},pe=e=>e.replace(/\D/g,""),ot=e=>{const t=pe(e).slice(0,11);return t.length<=3?t:t.length<=6?`${t.slice(0,3)}.${t.slice(3)}`:t.length<=9?`${t.slice(0,3)}.${t.slice(3,6)}.${t.slice(6)}`:`${t.slice(0,3)}.${t.slice(3,6)}.${t.slice(6,9)}-${t.slice(9,11)}`},Te=e=>{const a=pe(e);if(a.length!==11||/^(\d)\1{10}$/.test(a))return!1;let t=0;for(let s=0;s<9;s++)t+=parseInt(a.charAt(s))*(10-s);let o=t*10%11;if((o===10||o===11)&&(o=0),o!==parseInt(a.charAt(9)))return!1;t=0;for(let s=0;s<10;s++)t+=parseInt(a.charAt(s))*(11-s);return o=t*10%11,(o===10||o===11)&&(o=0),o===parseInt(a.charAt(10))},st=e=>{const t=pe(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},Be=e=>{const a=pe(e);return!(a.length!==8||a==="00000000")},he="BRL",xe="pt-BR";function we(e){if(e==null||e==="")return null;if(typeof e=="number")return Number.isFinite(e)?Number(e.toFixed(2)):null;const a=e.replace(/\D/g,"");return a?Number(a)/100:null}function fe(e,a=he,t=xe){const o=we(e);return o===null?"":new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(o)}function lt(e,a="string",t=he,o=xe){const s=we(e);return s===null?a==="number"?void 0:"":a==="number"?s:fe(s,t,o)}const Ae=n.forwardRef(({name:e,className:a,type:t="text",label:o,onFocus:s,onBlur:u,onChange:c,Icon:v,iconClassName:m,iconAction:g,containerClassName:f,cpf:d=!1,cep:i=!1,currency:C=!1,currencyCode:R=he,currencyLocale:S=xe,currencyValueType:h="string",value:E,defaultValue:M,...B},k)=>{var K,ee,F;const[N,L]=n.useState(!1),[I,p]=n.useState(!1),[T,V]=n.useState(null),[A,J]=n.useState(null),_=Z.useFormContext(),U=_==null?void 0:_.control,j=_==null?void 0:_.register,P=U&&e?Z.useWatch({control:U,name:e}):void 0,Q=E??P??M??"",D=C?fe(Q,R,S):Q,$=((F=(ee=(K=_==null?void 0:_.formState)==null?void 0:K.errors)==null?void 0:ee[e])==null?void 0:F.message)||T||A,q=["date","datetime-local","time","month","week"].includes(t),te=N||!!D||q,X=C?"text":t==="password"?I?"text":"password":t,ae=()=>n.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",fill:"currentColor"})),oe=()=>n.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",fill:"currentColor"})),se=()=>{p(!I)},ne=y=>{C&&(y.target.value=fe(y.target.value,R,S))},x=y=>{if(d){const b=y.target.value,O=ot(b);y.target.value=O,O.length===14?Te(O)?V(null):V("CPF inválido"):V(null)}},W=y=>{if(i){const b=y.target.value,O=st(b);y.target.value=O,O.length===9?Be(O)?J(null):J("CEP inválido"):J(null)}},w=y=>{C&&ne(y),d&&x(y),i&&W(y),c&&c(y)},z=C?{setValueAs:y=>lt(y,h,R,S),validate:y=>y==null||y===""?!0:we(y)!==null||"Valor monetário inválido"}:d?{validate:y=>y?y.length<14?"CPF incompleto":Te(y)?!0:"CPF inválido":"CPF é obrigatório"}:i?{validate:y=>y?y.length<9?"CEP incompleto":Be(y)?!0:"CEP inválido":"CEP é obrigatório"}:void 0,G=C&&E===void 0&&_||C&&E!==void 0?D:E,re=C?fe(M,R,S):M;return n.createElement("div",{className:l("relative",f)},n.createElement("input",{id:B.id||e,type:X,className:l("peer flex h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50",t==="password"||v?"pr-12":"",$?"border-red-500":"",a),onFocus:y=>{L(!0),s&&s(y)},maxLength:d?14:i?9:B.maxLength,inputMode:C?"decimal":d||i?"numeric":B.inputMode,..._&&e?(()=>{const y=j(e,z),b=y.onBlur,O=y.onChange;return{...y,ref:H=>{typeof k=="function"?k(H):k&&(k.current=H),y.ref&&y.ref(H)},onBlur:H=>{L(!1),u&&u(H),b&&b(H)},onChange:H=>{w(H),O&&O(H)}}})():{ref:k,onBlur:y=>{L(!1),u&&u(y)},onChange:w},value:G,defaultValue:G===void 0?re:void 0,...B}),o&&n.createElement("label",{htmlFor:B.id||e,style:te?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none text-[var(--foreground)] transition-all duration-200",te?"text-xs p-1 rounded-full bg-white text-[var(--primary)]":"text-sm")},o),t==="password"&&!C&&n.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary)]",onClick:se,"aria-label":I?"Esconder senha":"Mostrar senha",tabIndex:-1},I?n.createElement(oe,null):n.createElement(ae,null)),v&&t!=="password"&&n.createElement("div",{className:l("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary)] transition-colors duration-200",m),onClick:g},n.createElement(v,null)),$&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},$))});Ae.displayName="Input";const Oe=n.forwardRef(({name:e,className:a,label:t,onBlur:o,onChange:s,containerClassName:u,value:c,defaultValue:v,...m},g)=>{var B,k,N;const[f,d]=n.useState(!1),i=Z.useFormContext(),C=i==null?void 0:i.control,R=i==null?void 0:i.register,S=C&&e?Z.useWatch({control:C,name:e}):void 0,h=c??S??v??"#000000",E=(N=(k=(B=i==null?void 0:i.formState)==null?void 0:B.errors)==null?void 0:k[e])==null?void 0:N.message,M=f||!!h;return n.createElement("div",{className:l("relative",u)},n.createElement("div",{className:l("flex h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 pt-6 pb-2 text-sm transition focus-within:outline-none focus-within:border-[var(--primary)]",E?"border-red-500":"",a)},n.createElement("div",{className:"flex items-center gap-2 w-full"},n.createElement("input",{id:m.id||e,type:"color",className:"h-6 w-8 cursor-pointer rounded border-0 bg-transparent p-0 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",...i&&e?(()=>{const L=R(e),I=L.onBlur,p=L.onChange;return{...L,ref:T=>{typeof g=="function"?g(T):g&&(g.current=T),L.ref&&L.ref(T)},onFocus:()=>d(!0),onBlur:T=>{d(!1),o&&o(T),I&&I(T)},onChange:T=>{p&&p(T),s&&s(T)}}})():{ref:g,value:c,defaultValue:c===void 0?v??"#000000":void 0,onFocus:()=>d(!0),onBlur:L=>{d(!1),o&&o(L)},onChange:s},...m}),n.createElement("span",{className:"text-sm text-[var(--foreground)] font-mono select-none"},String(h).toUpperCase()))),t&&n.createElement("label",{htmlFor:m.id||e,style:M?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none text-[var(--foreground)] transition-all duration-200",M?"text-xs p-1 rounded-full bg-white text-[var(--primary)]":"text-sm")},t),E&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},E))});Oe.displayName="ColorInput";const Pe=n.forwardRef(({name:e,label:a,options:t,className:o,containerClassName:s,isClearable:u,searchable:c=!1,filterPlaceholder:v="Digite para filtrar...",caseSensitive:m=!1,filterFunction:g,onFocus:f,onBlur:d,...i},C)=>{var ne,x,W;const[R,S]=n.useState(!1),[h,E]=n.useState(!1),[M,B]=n.useState(""),[k,N]=n.useState({top:0,left:0,width:0}),L=n.useRef(null),I=n.useRef(null),p=Z.useFormContext(),T=p==null?void 0:p.control,V=T&&e?Z.useWatch({control:T,name:e}):void 0,A=i.value??V??"",J=(W=(x=(ne=p==null?void 0:p.formState)==null?void 0:ne.errors)==null?void 0:x[e])==null?void 0:W.message,U=g||((w,z)=>{const G=m?w.label:w.label.toLowerCase(),re=m?z:z.toLowerCase();return G.includes(re)}),j=M.trim()?t.filter(w=>U(w,M.trim())):t,P=t.find(w=>w.value===A),Q=!!P,D=c&&h?M:(P==null?void 0:P.label)||"",$=R||Q||h||c&&!!M,Y=n.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),q=n.useCallback(()=>{if(L.current&&h){const w=L.current.getBoundingClientRect(),z=Y(),G=window.innerHeight,re=window.innerWidth,K=152;let ee=w.bottom+4,F=w.left;if(z){const y=G-w.bottom,b=w.top;y<K&&b>K&&(ee=w.top-K-4);const O=16,H=re-w.width-O;F=Math.min(Math.max(F,O),H)}else G-w.bottom<K&&(ee=w.top-K-4);N({top:ee,left:F,width:w.width})}},[h,Y]);n.useEffect(()=>{if(q(),h){const w=()=>q(),z=()=>q();return window.addEventListener("resize",w),window.addEventListener("scroll",z,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",z,!0)}}},[h,q]),n.useEffect(()=>{const w=z=>{L.current&&!L.current.contains(z.target)&&(E(!1),S(!1))};return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[]);const te=()=>{E(w=>!w),S(!0)},X=w=>{S(!0),f&&f(w)},ae=w=>{d&&d(w)},oe=w=>{B(w.target.value)},se=w=>{if(p&&e&&p.setValue(e,w),i.onChange){const z={target:{value:w}};i.onChange(z)}E(!1),S(!1),B("")};return n.createElement("div",{className:l("relative",s),ref:L},n.createElement("div",{id:i.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":h,className:l("peer flex items-center h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:c?void 0:te,onFocus:c?void 0:X,onBlur:c?void 0:ae,ref:C},c?n.createElement("input",{ref:I,type:"text",value:D,onChange:oe,onFocus:c?w=>{S(!0),E(!0),f&&f(w)}:void 0,onBlur:c?w=>{d&&d(w)}:void 0,placeholder:a?"":v||"Selecione...",className:l("w-full bg-transparent border-none outline-none text-sm",!Q&&!M&&"text-gray-400")}):n.createElement("span",{className:l("block truncate",!Q&&"text-gray-400")},(P==null?void 0:P.label)||!a&&"Selecione..."),u&&A&&n.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:w=>{if(w.stopPropagation(),p&&e&&p.setValue(e,""),i.onChange){const z={target:{value:""}};i.onChange(z)}E(!1),S(!1)}},"✕")),a&&n.createElement("label",{htmlFor:i.id||e,style:$?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none transition-all text-[var(--foreground)] duration-200",$?"text-xs p-1 rounded-full bg-[var(--input-bg)] text-[var(--primary)]":"text-sm")},a),n.createElement("div",{className:l("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--foreground)]",h?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:h?"9.5rem":"0",overflowY:t.length>3?"auto":"hidden",position:"fixed",top:h?`${k.top}px`:"auto",left:h?`${k.left}px`:"auto",width:h?`${k.width}px`:"auto",zIndex:9999,boxShadow:h?"var(--select-dropdown-shadow)":"none"}},j.length===0?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):j.map(w=>n.createElement("div",{key:w.value,className:l("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",A===w.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>se(w.value)},w.label))),J&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});Pe.displayName="Select";const $e=n.forwardRef(({name:e,className:a,label:t,onFocus:o,onBlur:s,Icon:u,iconClassName:c,iconAction:v,containerClassName:m,rows:g=4,...f},d)=>{var N,L,I;const[i,C]=n.useState(!1),R=Z.useFormContext(),S=R==null?void 0:R.control,h=R==null?void 0:R.register,E=S&&e?Z.useWatch({control:S,name:e}):void 0,M=f.value??E??"",B=(I=(L=(N=R==null?void 0:R.formState)==null?void 0:N.errors)==null?void 0:L[e])==null?void 0:I.message,k=i||!!M;return n.createElement("div",{className:l("relative",m)},n.createElement("textarea",{id:f.id||e,rows:g,className:l("peer flex min-h-[80px] w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",u?"pr-12":"",a),onFocus:p=>{C(!0),o&&o(p)},...R&&e?(()=>{const p=h(e),T=p.onBlur;return{...p,ref:V=>{typeof d=="function"?d(V):d&&(d.current=V),p.ref&&p.ref(V)},onBlur:V=>{C(!1),s&&s(V),T&&T(V)}}})():{ref:d,onBlur:p=>{C(!1),s&&s(p)}},...f}),t&&n.createElement("label",{htmlFor:f.id||e,style:k?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none text-[var(--foreground)] transition-all duration-200",k?"text-xs p-1 rounded-full bg-white text-[var(--primary)]":"text-sm")},t),u&&n.createElement("div",{className:l("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary)] transition-colors duration-200",c),onClick:v},n.createElement(u,null)),B&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},B))});$e.displayName="Textarea";const We=n.forwardRef(({name:e,label:a,loadOptions:t,className:o,containerClassName:s,isClearable:u,defaultOptions:c=!1,loadingMessage:v="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:g=!1,debounceMs:f=300,onFocus:d,onBlur:i,...C},R)=>{var re,K,ee;const[S,h]=n.useState(!1),[E,M]=n.useState(!1),[B,k]=n.useState([]),[N,L]=n.useState(!1),[I,p]=n.useState(""),[T,V]=n.useState(""),[A,J]=n.useState({top:0,left:0,width:0}),_=n.useRef(null),U=n.useRef(null),j=Z.useFormContext(),P=j==null?void 0:j.control,Q=P&&e?Z.useWatch({control:P,name:e}):void 0,D=C.value??Q??"",$=(ee=(K=(re=j==null?void 0:j.formState)==null?void 0:re.errors)==null?void 0:K[e])==null?void 0:ee.message,Y=B.find(F=>F.value===D),q=!!Y,te=S||q||E,X=n.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),ae=n.useCallback(()=>{if(_.current&&E){const F=_.current.getBoundingClientRect(),y=X(),b=window.innerHeight,O=window.innerWidth,H=152;let ie=F.bottom+4,le=F.left;if(y){const ce=b-F.bottom,de=F.top;ce<H&&de>H&&(ie=F.top-H-4);const ue=16,ve=O-F.width-ue;le=Math.min(Math.max(le,ue),ve)}else b-F.bottom<H&&(ie=F.top-H-4);J({top:ie,left:le,width:F.width})}},[E,X]);n.useEffect(()=>{if(ae(),E){const F=()=>ae(),y=()=>ae();return window.addEventListener("resize",F),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",y,!0)}}},[E,ae]),n.useEffect(()=>{const F=setTimeout(()=>{V(I)},f);return()=>clearTimeout(F)},[I,f]),n.useEffect(()=>{(E||c&&B.length===0)&&oe(g?T:void 0)},[T,E]),n.useEffect(()=>{c===!0?oe():Array.isArray(c)&&k(c)},[]);const oe=async F=>{try{L(!0);const y=await t(F);k(y)}catch(y){console.error("Error loading options:",y),k([])}finally{L(!1)}};n.useEffect(()=>{const F=y=>{_.current&&!_.current.contains(y.target)&&(M(!1),h(!1),p(""))};return document.addEventListener("mousedown",F),()=>{document.removeEventListener("mousedown",F)}},[]);const se=()=>{E||(M(!0),h(!0),g&&U.current&&setTimeout(()=>{var F;return(F=U.current)==null?void 0:F.focus()},0))},ne=F=>{h(!0),d&&d(F)},x=F=>{i&&i(F)},W=F=>{p(F.target.value)},w=F=>{if(j&&e&&j.setValue(e,F),C.onChange){const y={target:{value:F}};C.onChange(y)}M(!1),h(!1),p("")},z=F=>{if(F.stopPropagation(),j&&e&&j.setValue(e,""),C.onChange){const y={target:{value:""}};C.onChange(y)}M(!1),h(!1),p("")},G=g&&E?I:(Y==null?void 0:Y.label)||"";return n.createElement("div",{className:l("relative",s),ref:_},n.createElement("div",{id:C.id||e,tabIndex:g?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":E,className:l("peer flex items-center h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:se,onFocus:g?void 0:ne,onBlur:g?void 0:x,ref:R},g?n.createElement("input",{ref:U,type:"text",value:G,onChange:W,onFocus:ne,onBlur:x,placeholder:a?"":"Selecione...",className:l("w-full bg-transparent border-none outline-none text-sm",!q&&!I&&"text-gray-400")}):n.createElement("span",{className:l("block truncate",!q&&"text-gray-400")},(Y==null?void 0:Y.label)||!a&&"Selecione..."),N&&n.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},n.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary)]"})),u&&D&&!N&&n.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:z},"✕")),a&&n.createElement("label",{htmlFor:C.id||e,style:te?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none text-[var(--foreground)] transition-all duration-200",te?"text-xs p-1 rounded-full bg-[var(--input-bg)] text-[var(--primary)]":"text-sm")},a),n.createElement("div",{className:l("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--foreground)]",E?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:E?"9.5rem":"0",overflowY:B.length>3?"auto":"hidden",position:"fixed",top:E?`${A.top}px`:"auto",left:E?`${A.left}px`:"auto",width:E?`${A.width}px`:"auto",zIndex:9999,boxShadow:E?"var(--select-dropdown-shadow)":"none"}},N?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):B.length===0?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):B.map(F=>n.createElement("div",{key:F.value,className:l("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",D===F.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>w(F.value)},F.label))),$&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},$))});We.displayName="AsyncSelect";const ze=n.forwardRef(({name:e,label:a,options:t,className:o,containerClassName:s,isClearable:u,searchable:c=!1,filterPlaceholder:v="Digite para filtrar...",caseSensitive:m=!1,filterFunction:g,onFocus:f,onBlur:d,...i},C)=>{var oe,se,ne;const[R,S]=n.useState(!1),[h,E]=n.useState(!1),[M,B]=n.useState(""),[k,N]=n.useState({top:0,left:0,width:0}),L=n.useRef(null),I=n.useRef(null),p=Z.useFormContext(),T=p==null?void 0:p.control,V=T&&e?Z.useWatch({control:T,name:e}):void 0,A=i.value??V??[],J=(ne=(se=(oe=p==null?void 0:p.formState)==null?void 0:oe.errors)==null?void 0:se[e])==null?void 0:ne.message,U=g||((x,W)=>{const w=m?x.label:x.label.toLowerCase(),z=m?W:W.toLowerCase();return w.includes(z)}),j=M.trim()?t.filter(x=>U(x,M.trim())):t,P=R||A&&A.length>0||h||c&&!!M,Q=n.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),D=n.useCallback(()=>{if(L.current&&h){const x=L.current.getBoundingClientRect(),W=Q(),w=window.innerHeight,z=window.innerWidth,G=152;let re=x.bottom+4,K=x.left;if(W){const ee=w-x.bottom,F=x.top;ee<G&&F>G&&(re=x.top-G-4);const y=16,b=z-x.width-y;K=Math.min(Math.max(K,y),b)}else w-x.bottom<G&&(re=x.top-G-4);N({top:re,left:K,width:x.width})}},[h,Q]);n.useEffect(()=>{if(D(),h){const x=()=>D(),W=()=>D();return window.addEventListener("resize",x),window.addEventListener("scroll",W,!0),()=>{window.removeEventListener("resize",x),window.removeEventListener("scroll",W,!0)}}},[h,D]),n.useEffect(()=>{const x=W=>{L.current&&!L.current.contains(W.target)&&(E(!1),S(!1))};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[]);const $=()=>{E(x=>!x),S(!0)},Y=x=>{S(!0),f&&f(x)},q=x=>{d&&d(x)},te=x=>{var w;let W;A.includes(x)?W=A.filter(z=>z!==x):W=[...A,x],p&&e&&p.setValue(e,W),i.onChange&&((w=i.onChange)==null||w.call(i,{target:{value:W}})),S(!0)},X=x=>{var W;x.stopPropagation(),p&&e&&p.setValue(e,[]),i.onChange&&((W=i.onChange)==null||W.call(i,{target:{value:[]}})),E(!1),S(!1)},ae=x=>{B(x.target.value)};return n.createElement("div",{className:l("relative",s),ref:L},n.createElement("div",{id:i.id||e,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":h,className:l("peer flex items-center h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:c?void 0:$,onFocus:c?void 0:Y,onBlur:c?void 0:q,ref:C},n.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},A&&A.length>0?t.filter(x=>A.includes(x.value)).map(x=>n.createElement("span",{key:x.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",style:{maxWidth:"140px"}},n.createElement("span",{className:"truncate",title:x.label},x.label),n.createElement("button",{type:"button",className:"ml-1 text-[var(--primary)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${x.label}`,tabIndex:-1,onClick:W=>{W.stopPropagation();const w=A.filter(z=>z!==x.value);p&&e&&p.setValue(e,w),i.onChange&&i.onChange({target:{value:w}})}},n.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))):!a&&!c&&n.createElement("span",{className:"text-gray-400 text-sm"},"Selecione..."),c&&n.createElement("input",{ref:I,type:"text",value:M,onChange:ae,onFocus:x=>{S(!0),E(!0),f&&f(x)},onBlur:x=>{d&&d(x)},placeholder:a?A&&A.length>0?"":v:v||"Selecione...",className:"flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"})),u&&A&&A.length>0&&n.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:X},"✕")),a&&n.createElement("label",{htmlFor:i.id||e,style:P?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text text-[var(--foreground)] select-none transition-all duration-200",P?"text-xs p-1 rounded-full bg-[var(--input-bg)] text-[var(--primary)]":"text-sm")},a),n.createElement("div",{className:l("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--foreground)]",h?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:h?"9.5rem":"0",overflowY:t.length>3?"auto":"hidden",position:"fixed",top:h?`${k.top}px`:"auto",left:h?`${k.left}px`:"auto",width:h?`${k.width}px`:"auto",zIndex:9999,boxShadow:h?"var(--select-dropdown-shadow)":"none"}},j.length===0?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):j.map(x=>n.createElement("div",{key:x.value,className:l("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",A.includes(x.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>te(x.value)},n.createElement("input",{type:"checkbox",checked:A.includes(x.value),readOnly:!0,className:"accent-blue-500"}),x.label))),J&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});ze.displayName="MultiSelect";const De=n.forwardRef(({name:e,label:a,loadOptions:t,className:o,containerClassName:s,isClearable:u,defaultOptions:c=!1,loadingMessage:v="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:g=!1,debounceMs:f=300,maxSelectedDisplay:d=3,onFocus:i,onBlur:C,...R},S)=>{var ee,F,y;const[h,E]=n.useState(!1),[M,B]=n.useState(!1),[k,N]=n.useState([]),[L,I]=n.useState(!1),[p,T]=n.useState(""),[V,A]=n.useState(""),[J,_]=n.useState({top:0,left:0,width:0}),U=n.useRef(null),j=n.useRef(null),P=Z.useFormContext(),Q=P==null?void 0:P.control,D=Q&&e?Z.useWatch({control:Q,name:e}):void 0,$=R.value??D??[],Y=(y=(F=(ee=P==null?void 0:P.formState)==null?void 0:ee.errors)==null?void 0:F[e])==null?void 0:y.message,q=h||$&&$.length>0||M,te=n.useCallback(()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768,[]),X=n.useCallback(()=>{if(U.current&&M){const b=U.current.getBoundingClientRect(),O=te(),H=window.innerHeight,ie=window.innerWidth,le=152;let ce=b.bottom+4,de=b.left;if(O){const ue=H-b.bottom,ve=b.top;ue<le&&ve>le&&(ce=b.top-le-4);const Le=16,Je=ie-b.width-Le;de=Math.min(Math.max(de,Le),Je)}else H-b.bottom<le&&(ce=b.top-le-4);_({top:ce,left:de,width:b.width})}},[M,te]);n.useEffect(()=>{if(X(),M){const b=()=>X(),O=()=>X();return window.addEventListener("resize",b),window.addEventListener("scroll",O,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",O,!0)}}},[M,X]),n.useEffect(()=>{const b=setTimeout(()=>{A(p)},f);return()=>clearTimeout(b)},[p,f]),n.useEffect(()=>{(M||c&&k.length===0)&&ae(g?V:void 0)},[V,M]),n.useEffect(()=>{c===!0?ae():Array.isArray(c)&&N(c)},[]);const ae=async b=>{try{I(!0);const O=await t(b);N(O)}catch(O){console.error("Error loading options:",O),N([])}finally{I(!1)}};n.useEffect(()=>{const b=O=>{U.current&&!U.current.contains(O.target)&&(B(!1),E(!1),T(""))};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]);const oe=()=>{M||(B(!0),E(!0),g&&j.current&&setTimeout(()=>{var b;return(b=j.current)==null?void 0:b.focus()},0))},se=b=>{E(!0),i&&i(b)},ne=b=>{C&&C(b)},x=b=>{T(b.target.value)},W=b=>{let O;$.includes(b)?O=$.filter(H=>H!==b):O=[...$,b],P&&e&&P.setValue(e,O),R.onChange&&R.onChange({target:{value:O}}),E(!0)},w=(b,O)=>{O.stopPropagation();const H=$.filter(ie=>ie!==b);P&&e&&P.setValue(e,H),R.onChange&&R.onChange({target:{value:H}})},z=b=>{b.stopPropagation(),P&&e&&P.setValue(e,[]),R.onChange&&R.onChange({target:{value:[]}}),B(!1),E(!1),T("")},G=k.filter(b=>$.includes(b.value)),re=G.slice(0,d),K=G.length-d;return n.createElement("div",{className:l("relative",s),ref:U},n.createElement("div",{id:R.id||e,tabIndex:g?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":M,className:l("peer flex items-center min-h-12 w-full border border-[var(--primary)] rounded-md bg-[var(--input-bg)] text-[var(--foreground)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",o),onClick:oe,onFocus:g?void 0:se,onBlur:g?void 0:ne,ref:S},n.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},re.map(b=>n.createElement("span",{key:b.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",style:{maxWidth:"140px"}},n.createElement("span",{className:"truncate",title:b.label},b.label),n.createElement("button",{type:"button",className:"ml-1 text-[var(--primary)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${b.label}`,tabIndex:-1,onClick:O=>w(b.value,O)},n.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))),K>0&&n.createElement("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs"},"+",K," mais"),g?n.createElement("input",{ref:j,type:"text",value:p,onChange:x,onFocus:se,onBlur:ne,placeholder:$.length===0&&!a?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):$.length===0&&!a&&n.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),L&&n.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},n.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary)]"})),u&&$&&$.length>0&&!L&&n.createElement("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:z},"✕")),a&&n.createElement("label",{htmlFor:R.id||e,style:q?{top:"-14px",transform:"scale(0.9)",transformOrigin:"0 0"}:{top:"14px",transform:"scale(1)",transformOrigin:"0 0"},className:l("absolute left-3 z-10 cursor-text select-none transition-all duration-200 text-[var(--foreground)]",q?"text-xs p-1 rounded-full bg-[var(--input-bg)] text-[var(--primary)]":"text-sm")},a),n.createElement("div",{className:l("absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden","bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--foreground)]",M?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:M?"9.5rem":"0",overflowY:k.length>3?"auto":"hidden",position:"fixed",top:M?`${J.top}px`:"auto",left:M?`${J.left}px`:"auto",width:M?`${J.width}px`:"auto",zIndex:9999,boxShadow:M?"var(--select-dropdown-shadow)":"none"}},L?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},v):k.length===0?n.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):k.map(b=>n.createElement("div",{key:b.value,className:l("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",$.includes(b.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>W(b.value)},n.createElement("input",{type:"checkbox",checked:$.includes(b.value),readOnly:!0,className:"accent-blue-500"}),b.label))),Y&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},Y))});De.displayName="MultiAsyncSelect";const it={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},Ve=n.forwardRef(({name:e,label:a,options:t,className:o,containerClassName:s,optionClassName:u,direction:c="row",size:v="md",onFocus:m,onBlur:g,...f},d)=>{var M,B,k;const i=Z.useFormContext(),C=i==null?void 0:i.control,R=C&&e?Z.useWatch({control:C,name:e}):void 0,S=f.value??R??"",h=(k=(B=(M=i==null?void 0:i.formState)==null?void 0:M.errors)==null?void 0:B[e])==null?void 0:k.message,E=N=>{i&&e&&i.setValue(e,N),f.onChange&&f.onChange({target:{value:N}})};return n.createElement("div",{className:l("relative",s),ref:d},a&&n.createElement("label",{htmlFor:e,className:l("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm transition-all duration-200","top-0 scale-90 -translate-y-1 text-xs text-[var(--primary)] p-1 rounded-full")},a),n.createElement("div",{className:l("flex gap-2 w-full pt-6",c==="row"?"flex-row":"flex-col",o),"aria-label":a,tabIndex:-1,onFocus:m,onBlur:g},t.map(N=>n.createElement("button",{key:N.value,type:"button",className:l("relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-light)]",it[v],S===N.value?"border-[var(--primary)] bg-[var(--primary-light)] text-[var(--primary)] ring-2 ring-[var(--primary-light)] shadow-md transform scale-[1.02]":"border-gray-200 bg-white text-[var(--primary)] hover:border-[var(--primary)] hover:bg-[var(--primary-light)] hover:text-[var(--primary)] hover:shadow-md",u),"aria-pressed":S===N.value,"data-selected":S===N.value,tabIndex:0,onClick:()=>E(N.value),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),E(N.value))}},N.icon&&n.createElement("span",{className:"mr-2 text-lg flex items-center"},N.icon),n.createElement("span",{className:"truncate font-medium"},N.label)))),h&&n.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});Ve.displayName="RadioGroup";const ye=r.forwardRef(({children:e,className:a,as:t="div",...o},s)=>r.createElement(t,{ref:s,className:l("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4 border-b","bg-[var(--card-header-bg)]","border-[var(--card-header-border)]","text-[var(--foreground)]",a),...o},e));ye.displayName="CardHeader";const Ee=r.forwardRef(({children:e,className:a,as:t="div",...o},s)=>r.createElement(t,{ref:s,className:l("px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4","flex-1","bg-[var(--card-body-bg)]","text-[var(--foreground)]",a),...o},e));Ee.displayName="CardBody";const Ne=r.forwardRef(({children:e,className:a,as:t="div",...o},s)=>r.createElement(t,{ref:s,className:l("px-6 py-4 border-t","bg-[var(--card-footer-bg)]","border-[var(--card-footer-border)]","text-[var(--foreground)]",a),...o},e));Ne.displayName="CardFooter";const ct=r.forwardRef(({children:e,className:a,variant:t="default",size:o="md",padding:s="none",rounded:u="lg",constrainWidth:c=!1,allowOverflow:v=!1,...m},g)=>{const f={default:"bg-[var(--card-bg)] border border-[var(--card-border)] shadow-[var(--card-shadow-sm)]",outlined:"bg-[var(--card-bg)] border-2 border-[var(--primary)]",elevated:"bg-[var(--card-bg)] border border-[var(--card-border)] shadow-[var(--card-shadow-lg)]",flat:"bg-[var(--card-bg)] border-0",primary:"bg-[var(--primary-light)] border-2 border-[var(--primary)] shadow-[var(--card-shadow-sm)]",secondary:"bg-[var(--secondary-light)] border-2 border-[var(--secondary)] shadow-[var(--card-shadow-sm)]"},d={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},i={none:"",sm:"p-3",md:"p-4",lg:"p-6"},C={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return r.createElement("div",{ref:g,className:l("flex flex-col",!v&&"overflow-hidden",f[t],c&&d[o],i[s],C[u],a),...m},e)}),dt=Object.assign(ct,{Header:ye,Body:Ee,Footer:Ne}),He=r.forwardRef(({children:e,className:a,variant:t="default",size:o="md",responsive:s=!1,stickyHeader:u=!1,...c},v)=>{const m=l("w-full border-collapse bg-[var(--table-bg)] text-[var(--foreground)]",{"border border-[var(--table-border)]":t==="bordered"},{"text-sm":o==="sm","text-base":o==="md","text-lg":o==="lg"},a),g=l({"overflow-x-auto":s,"max-h-96 overflow-y-auto":u}),f=r.createElement("table",{ref:v,className:m,...c},e);return s||u?r.createElement("div",{className:g},f):f}),Ce=r.forwardRef(({children:e,className:a,as:t="thead",...o},s)=>r.createElement(t,{ref:s,className:l("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":t==="thead"},a),...o},e)),ke=r.forwardRef(({children:e,className:a,as:t="tbody",...o},s)=>r.createElement(t,{ref:s,className:l("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",a),...o},e)),Se=r.forwardRef(({children:e,className:a,as:t="tfoot",...o},s)=>r.createElement(t,{ref:s,className:l("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",a),...o},e)),Me=r.forwardRef(({children:e,className:a,variant:t="default",...o},s)=>r.createElement("tr",{ref:s,className:l("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":t==="hover","bg-[var(--table-row-selected)]":t==="selected"},a),...o},e)),Fe=r.forwardRef(({children:e,className:a,as:t="td",align:o="left",scope:s,colSpan:u,rowSpan:c,...v},m)=>r.createElement(t,{ref:m,scope:t==="th"?s:void 0,colSpan:u,rowSpan:c,className:l("px-4 py-3 text-left",{"font-semibold":t==="th","text-sm":t==="td","text-center":o==="center","text-right":o==="right"},a),...v},e));He.displayName="Table";Ce.displayName="TableHeader";ke.displayName="TableBody";Se.displayName="TableFooter";Me.displayName="TableRow";Fe.displayName="TableCell";const ut=Object.assign(He,{Header:Ce,Body:ke,Footer:Se,Row:Me,Cell:Fe}),mt=({content:e,children:a,position:t="top",className:o="",disabled:s=!1,maxWidth:u})=>{const[c,v]=r.useState(!1),[m,g]=r.useState(t),[f,d]=r.useState({}),i=r.useRef(null),C=r.useRef(null);r.useEffect(()=>{if(!c||!C.current)return;const N=C.current.getBoundingClientRect();let L=t,I=0,p=0;switch(t){case"top":I=N.top-8,p=N.left+N.width/2;break;case"bottom":I=N.bottom+8,p=N.left+N.width/2;break;case"left":I=N.top+N.height/2,p=N.left-8;break;case"right":I=N.top+N.height/2,p=N.right+8;break}if(i.current){const T=i.current.getBoundingClientRect(),V=window.innerWidth,A=window.innerHeight;t==="top"&&N.top<T.height+16?(L="bottom",I=N.bottom+8):t==="bottom"&&N.bottom+T.height+16>A?(L="top",I=N.top-8):t==="left"&&N.left<T.width+16?(L="right",p=N.right+8):t==="right"&&N.right+T.width+16>V&&(L="left",p=N.left-8)}g(L),d({position:"fixed",top:`${I}px`,left:`${p}px`,zIndex:9999,...u!==void 0?{maxWidth:typeof u=="number"?`${u}px`:u}:{}})},[c,t,u]);const R=()=>{s||v(!0)},S=()=>{v(!1)},h=()=>{s||v(!0)},E=()=>{v(!1)},M=()=>{const k="pointer-events-none";switch(m){case"top":return`${k} transform -translate-x-1/2 -translate-y-full`;case"bottom":return`${k} transform -translate-x-1/2`;case"left":return`${k} transform -translate-x-full -translate-y-1/2`;case"right":return`${k} transform -translate-y-1/2`;default:return`${k} transform -translate-x-1/2 -translate-y-full`}},B=()=>{const k="absolute w-2 h-2 bg-[var(--tooltip-bg)] transform rotate-45";switch(m){case"top":return`${k} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;case"bottom":return`${k} bottom-full left-1/2 -translate-x-1/2 translate-y-1/2`;case"left":return`${k} left-full top-1/2 -translate-y-1/2 -translate-x-1/2`;case"right":return`${k} right-full top-1/2 -translate-y-1/2 translate-x-1/2`;default:return`${k} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`}};return s||!e?r.createElement(r.Fragment,null,a):r.createElement(r.Fragment,null,r.createElement("div",{className:"relative inline-block",ref:C,onMouseEnter:R,onMouseLeave:S,onFocus:h,onBlur:E},a),c&&typeof document<"u"&&me.createPortal(r.createElement("div",{ref:i,style:f,className:l(M(),`px-2 py-1 text-sm rounded ${u!==void 0?"whitespace-normal":"whitespace-nowrap"}`,"bg-[var(--tooltip-bg)] text-white","shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]","transition-opacity duration-200 ease-in-out",o),role:"tooltip","aria-hidden":!c},e,r.createElement("div",{className:B()})),document.body))},je=({open:e,onClose:a,side:t="right",size:o="md",closeOnOverlayClick:s=!0,children:u,className:c="",...v})=>{const m=typeof document<"u"?document.body:null,g=o==="sm"?"w-64":o==="md"?"w-96":o==="lg"?"w-[36rem]":void 0,f=typeof o=="string"&&!["sm","md","lg"].includes(o)?{width:o}:void 0,d=r.createElement("div",{"aria-hidden":!e,className:l("fixed inset-0 z-50 flex",e?"pointer-events-auto":"pointer-events-none")},r.createElement("div",{className:l("absolute inset-0 bg-black/40 transition-opacity duration-200",e?"opacity-100":"opacity-0"),onMouseDown:i=>{s&&i.target===i.currentTarget&&a()}}),r.createElement("div",{className:l("relative h-full",t==="right"?"ml-auto":"mr-auto","flex-shrink-0"),style:f},r.createElement("aside",{role:"dialog","aria-modal":!0,className:l("h-full bg-[var(--aside-bg)] shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",t==="right"?e?"translate-x-0":"translate-x-full":e?"translate-x-0":"-translate-x-full",g,c),style:f,...v},u)));return m?me.createPortal(d,m):null};je.displayName="AsideSheet";const ft=({open:e,side:a="left",size:t="md",children:o,className:s="",...u})=>{const c=t==="sm"?"w-64":t==="md"?"w-72":t==="lg"?"w-96":void 0,v=typeof t=="string"&&!["sm","md","lg"].includes(t)?{width:t}:void 0;return r.createElement("aside",{role:"navigation","aria-expanded":e,className:l("hidden md:flex md:flex-col","fixed top-0 h-full z-40","bg-[var(--sidebar-bg,var(--aside-bg,#ffffff))]","shadow-lg border-gray-200 overflow-y-auto","transition-transform duration-300 ease-in-out",a==="left"?l("left-0 border-r",e?"translate-x-0":"-translate-x-full"):l("right-0 border-l",e?"translate-x-0":"translate-x-full"),c,s),style:v,...u},o)},pt=({avatar:e=!1,value:a,onUpload:t,onRemove:o,accept:s="image/*",maxSize:u,placeholder:c="Selecionar imagem",loading:v=!1,size:m="md",label:g,error:f,disabled:d,className:i,...C})=>{const[R,S]=r.useState(null),[h,E]=r.useState(""),[M,B]=r.useState(!1),k=r.useRef(null),N=!!a,L=!!R,I=N||L,p=v||M,T={sm:e?"w-16 h-16":"w-24 h-16",md:e?"w-24 h-24":"w-32 h-24",lg:e?"w-32 h-32":"w-40 h-32"},A=c||(e?"Adicionar foto":"Selecionar imagem"),J=D=>{var q;const $=(q=D.target.files)==null?void 0:q[0];if(!$)return;if(u&&$.size>u){alert(`Arquivo muito grande. Tamanho máximo: ${(u/1024/1024).toFixed(1)}MB`);return}const Y=new FileReader;Y.onload=te=>{var X;E((X=te.target)==null?void 0:X.result),S($)},Y.readAsDataURL($)},_=async()=>{if(!(!R||!t))try{B(!0);const D=await t(R);S(null),E(""),k.current&&(k.current.value="")}catch(D){console.error("Erro ao fazer upload:",D),alert("Erro ao fazer upload da imagem")}finally{B(!1)}},U=()=>{S(null),E(""),k.current&&(k.current.value="")},j=async()=>{try{o&&await o(a),S(null),E(""),k.current&&(k.current.value="")}catch(D){console.error("Erro ao remover imagem:",D),alert("Erro ao remover imagem")}},P=()=>{var D;d||p||(D=k.current)==null||D.click()},Q=h||a;return r.createElement("div",{className:l("flex flex-col space-y-2",i)},g&&r.createElement("label",{className:"text-sm font-medium text-gray-700"},g),r.createElement("div",{className:"relative flex flex-col items-center"},r.createElement("input",{ref:k,type:"file",accept:s,onChange:J,disabled:d||p,className:"hidden",...C}),r.createElement("div",{onClick:P,className:l("relative border-2 border-dashed border-gray-300 transition-colors cursor-pointer","hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",e?"rounded-full":"rounded-lg",T[m],d&&"opacity-50 cursor-not-allowed",p&&"cursor-wait",f&&"border-red-300",!I&&"bg-gray-50 hover:bg-gray-100",I&&"border-solid border-gray-200")},I?r.createElement("img",{src:Q,alt:"Preview",className:l("w-full h-full object-cover",e?"rounded-full":"rounded-lg")}):r.createElement("div",{className:"flex flex-col items-center justify-center h-full text-gray-500 text-sm"},e?r.createElement(r.Fragment,null,r.createElement("svg",{className:"w-8 h-8 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})),r.createElement("span",{className:"text-center px-2 text-xs"},A)):r.createElement(r.Fragment,null,r.createElement("svg",{className:"w-6 h-6 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})),r.createElement("span",{className:"text-center px-2"},A))),p&&r.createElement("div",{className:l("absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center",e?"rounded-full":"rounded-lg")},r.createElement("div",{className:"w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin"}))),I&&!p&&r.createElement("div",{className:"flex justify-center space-x-2 mt-3"},L?r.createElement(r.Fragment,null,r.createElement("button",{onClick:_,disabled:!t,className:"px-3 py-1 bg-blue-600 text-white text-sm rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"},"Confirmar"),r.createElement("button",{onClick:U,className:"px-3 py-1 bg-gray-600 text-white text-sm rounded hover:bg-gray-700"},"Cancelar")):r.creat