rharuow-ds 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),V=require("react-hook-form");function ge(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const e=ge(j);function se(t){var r,n,l="";if(typeof t=="string"||typeof t=="number")l+=t;else if(typeof t=="object")if(Array.isArray(t)){var x=t.length;for(r=0;r<x;r++)t[r]&&(n=se(t[r]))&&(l&&(l+=" "),l+=n)}else for(n in t)t[n]&&(l&&(l+=" "),l+=n);return l}function pe(){for(var t,r,n=0,l="",x=arguments.length;n<x;n++)(t=arguments[n])&&(r=se(t))&&(l&&(l+=" "),l+=r);return l}function o(...t){return pe(...t)}const he=({children:t,variant:r="default",className:n="",...l})=>{const x="px-4 py-2 rounded font-medium transition",F={default:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",outline:"border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"};return j.createElement("button",{className:o(x,F[r],n),...l},t)},ce=e.forwardRef(({name:t,className:r,type:n="text",label:l,onFocus:x,onBlur:F,Icon:E,iconClassName:M,iconAction:m,containerClassName:y,...C},f)=>{var I,b,a;const[w,p]=e.useState(!1),[c,u]=e.useState(!1),h=V.useFormContext(),N=h==null?void 0:h.control,s=h==null?void 0:h.register,S=N&&t?V.useWatch({control:N,name:t}):void 0,R=C.value??S??"",v=(a=(b=(I=h==null?void 0:h.formState)==null?void 0:I.errors)==null?void 0:b[t])==null?void 0:a.message,_=w||!!R,O=n==="password"?c?"text":"password":n,k=()=>e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.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"})),W=()=>e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.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"})),z=()=>{u(!c)};return e.createElement("div",{className:o("relative",y)},e.createElement("input",{id:C.id||t,type:O,className:o("peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",n==="password"||E?"pr-12":"",r),onFocus:d=>{p(!0),x&&x(d)},...h&&t?(()=>{const d=s(t),A=d.onBlur;return{...d,ref:L=>{typeof f=="function"?f(L):f&&(f.current=L),d.ref&&d.ref(L)},onBlur:L=>{p(!1),F&&F(L),A&&A(L)}}})():{ref:f,onBlur:d=>{p(!1),F&&F(d)}},...C}),l&&e.createElement("label",{htmlFor:C.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",_?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},l),n==="password"&&e.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:z,"aria-label":c?"Esconder senha":"Mostrar senha",tabIndex:-1},c?e.createElement(W,null):e.createElement(k,null)),E&&n!=="password"&&e.createElement("div",{className:o("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",M),onClick:m},e.createElement(E,null)),v&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},v))});ce.displayName="Input";const ie=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,isClearable:F,onFocus:E,onBlur:M,...m},y)=>{var k,W,z,I;const[C,f]=e.useState(!1),[w,p]=e.useState(!1),c=e.useRef(null),u=V.useFormContext(),h=u==null?void 0:u.control,N=h&&t?V.useWatch({control:h,name:t}):void 0,s=m.value??N??"",S=(z=(W=(k=u==null?void 0:u.formState)==null?void 0:k.errors)==null?void 0:W[t])==null?void 0:z.message,R=C||!!s;e.useEffect(()=>{const b=a=>{c.current&&!c.current.contains(a.target)&&(p(!1),f(!1))};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]);const v=()=>{p(b=>!b),f(!0)},_=b=>{f(!0),E&&E(b)},O=b=>{M&&M(b)};return e.createElement("div",{className:o("relative",x),ref:c},e.createElement("div",{id:m.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:v,onFocus:_,onBlur:O,ref:y},e.createElement("span",{className:o("block truncate",!s&&"text-gray-400")},((I=n.find(b=>b.value===s))==null?void 0:I.label)||!r&&"Selecione..."),F&&s&&e.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:b=>{if(b.stopPropagation(),u&&t&&u.setValue(t,""),m.onChange){const a={target:{value:""}};m.onChange(a)}p(!1),f(!1)}},"✕")),r&&e.createElement("label",{htmlFor:m.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",w?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(b=>e.createElement("div",{key:b.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",s===b.value&&"bg-blue-100"),onMouseDown:()=>{if(u&&t&&u.setValue(t,b.value),m.onChange){const a={target:{value:b.value}};m.onChange(a)}f(!0)}},b.label))),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});ie.displayName="Select";const ue=e.forwardRef(({name:t,className:r,label:n,onFocus:l,onBlur:x,Icon:F,iconClassName:E,iconAction:M,containerClassName:m,rows:y=4,...C},f)=>{var v,_,O;const[w,p]=e.useState(!1),c=V.useFormContext(),u=c==null?void 0:c.control,h=c==null?void 0:c.register,N=u&&t?V.useWatch({control:u,name:t}):void 0,s=C.value??N??"",S=(O=(_=(v=c==null?void 0:c.formState)==null?void 0:v.errors)==null?void 0:_[t])==null?void 0:O.message,R=w||!!s;return e.createElement("div",{className:o("relative",m)},e.createElement("textarea",{id:C.id||t,rows:y,className:o("peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",F?"pr-12":"",r),onFocus:k=>{p(!0),l&&l(k)},...c&&t?(()=>{const k=h(t),W=k.onBlur;return{...k,ref:z=>{typeof f=="function"?f(z):f&&(f.current=z),k.ref&&k.ref(z)},onBlur:z=>{p(!1),x&&x(z),W&&W(z)}}})():{ref:f,onBlur:k=>{p(!1),x&&x(k)}},...C}),n&&e.createElement("label",{htmlFor:C.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),F&&e.createElement("div",{className:o("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",E),onClick:M},e.createElement(F,null)),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});ue.displayName="Textarea";const de=e.forwardRef(({name:t,label:r,loadOptions:n,className:l,containerClassName:x,isClearable:F,defaultOptions:E=!1,loadingMessage:M="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:y=!1,debounceMs:C=300,onFocus:f,onBlur:w,...p},c)=>{var Y,U,G;const[u,h]=e.useState(!1),[N,s]=e.useState(!1),[S,R]=e.useState([]),[v,_]=e.useState(!1),[O,k]=e.useState(""),[W,z]=e.useState(""),I=e.useRef(null),b=e.useRef(null),a=V.useFormContext(),d=a==null?void 0:a.control,A=d&&t?V.useWatch({control:d,name:t}):void 0,L=p.value??A??"",B=(G=(U=(Y=a==null?void 0:a.formState)==null?void 0:Y.errors)==null?void 0:U[t])==null?void 0:G.message,q=u||!!L;e.useEffect(()=>{const g=setTimeout(()=>{z(O)},C);return()=>clearTimeout(g)},[O,C]),e.useEffect(()=>{(N||E&&S.length===0)&&$(y?W:void 0)},[W,N]),e.useEffect(()=>{E===!0?$():Array.isArray(E)&&R(E)},[]);const $=async g=>{try{_(!0);const P=await n(g);R(P)}catch(P){console.error("Error loading options:",P),R([])}finally{_(!1)}};e.useEffect(()=>{const g=P=>{I.current&&!I.current.contains(P.target)&&(s(!1),h(!1),k(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]);const K=()=>{N||(s(!0),h(!0),y&&b.current&&setTimeout(()=>{var g;return(g=b.current)==null?void 0:g.focus()},0))},J=g=>{h(!0),f&&f(g)},D=g=>{w&&w(g)},Q=g=>{k(g.target.value)},ee=g=>{if(a&&t&&a.setValue(t,g),p.onChange){const P={target:{value:g}};p.onChange(P)}s(!1),h(!1),k("")},te=g=>{if(g.stopPropagation(),a&&t&&a.setValue(t,""),p.onChange){const P={target:{value:""}};p.onChange(P)}s(!1),h(!1),k("")},H=S.find(g=>g.value===L),ae=y&&N?O:(H==null?void 0:H.label)||"";return e.createElement("div",{className:o("relative",x),ref:I},e.createElement("div",{id:p.id||t,tabIndex:y?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":N,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:K,onFocus:y?void 0:J,onBlur:y?void 0:D,ref:c},y?e.createElement("input",{ref:b,type:"text",value:ae,onChange:Q,onFocus:J,onBlur:D,placeholder:r?"":"Selecione...",className:o("w-full bg-transparent border-none outline-none text-sm",!L&&!O&&"text-gray-400")}):e.createElement("span",{className:o("block truncate",!L&&"text-gray-400")},(H==null?void 0:H.label)||!r&&"Selecione..."),v&&e.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),F&&L&&!v&&e.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:te},"✕")),r&&e.createElement("label",{htmlFor:p.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",q?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",N?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:N?"9.5rem":"0",overflowY:S.length>3?"auto":"hidden"}},v?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):S.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):S.map(g=>e.createElement("div",{key:g.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",L===g.value&&"bg-blue-100"),onMouseDown:()=>ee(g.value)},g.label))),B&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},B))});de.displayName="AsyncSelect";const me=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,isClearable:F,onFocus:E,onBlur:M,...m},y)=>{var z,I,b;const[C,f]=e.useState(!1),[w,p]=e.useState(!1),c=e.useRef(null),u=V.useFormContext(),h=u==null?void 0:u.control,N=h&&t?V.useWatch({control:h,name:t}):void 0,s=m.value??N??[],S=(b=(I=(z=u==null?void 0:u.formState)==null?void 0:z.errors)==null?void 0:I[t])==null?void 0:b.message,R=C||s&&s.length>0;e.useEffect(()=>{const a=d=>{c.current&&!c.current.contains(d.target)&&(p(!1),f(!1))};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[]);const v=()=>{p(a=>!a),f(!0)},_=a=>{f(!0),E&&E(a)},O=a=>{M&&M(a)},k=a=>{var A;let d;s.includes(a)?d=s.filter(L=>L!==a):d=[...s,a],u&&t&&u.setValue(t,d),m.onChange&&((A=m.onChange)==null||A.call(m,{target:{value:d}})),f(!0)},W=a=>{var d;a.stopPropagation(),u&&t&&u.setValue(t,[]),m.onChange&&((d=m.onChange)==null||d.call(m,{target:{value:[]}})),p(!1),f(!1)};return e.createElement("div",{className:o("relative",x),ref:c},e.createElement("div",{id:m.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:v,onFocus:_,onBlur:O,ref:y},e.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},s&&s.length>0?n.filter(a=>s.includes(a.value)).map(a=>e.createElement("span",{key:a.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"}},e.createElement("span",{className:"truncate",title:a.label},a.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] 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 ${a.label}`,tabIndex:-1,onClick:d=>{d.stopPropagation();const A=s.filter(L=>L!==a.value);u&&t&&u.setValue(t,A),m.onChange&&m.onChange({target:{value:A}})}},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))):!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),F&&s&&s.length>0&&e.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},"✕")),r&&e.createElement("label",{htmlFor:m.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",w?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(a=>e.createElement("div",{key:a.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",s.includes(a.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>k(a.value)},e.createElement("input",{type:"checkbox",checked:s.includes(a.value),readOnly:!0,className:"accent-blue-500"}),a.label))),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});me.displayName="MultiSelect";const fe=e.forwardRef(({name:t,label:r,loadOptions:n,className:l,containerClassName:x,isClearable:F,defaultOptions:E=!1,loadingMessage:M="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:y=!1,debounceMs:C=300,maxSelectedDisplay:f=3,onFocus:w,onBlur:p,...c},u)=>{var g,P,oe;const[h,N]=e.useState(!1),[s,S]=e.useState(!1),[R,v]=e.useState([]),[_,O]=e.useState(!1),[k,W]=e.useState(""),[z,I]=e.useState(""),b=e.useRef(null),a=e.useRef(null),d=V.useFormContext(),A=d==null?void 0:d.control,L=A&&t?V.useWatch({control:A,name:t}):void 0,B=c.value??L??[],q=(oe=(P=(g=d==null?void 0:d.formState)==null?void 0:g.errors)==null?void 0:P[t])==null?void 0:oe.message,$=h||B&&B.length>0;e.useEffect(()=>{const i=setTimeout(()=>{I(k)},C);return()=>clearTimeout(i)},[k,C]),e.useEffect(()=>{(s||E&&R.length===0)&&K(y?z:void 0)},[z,s]),e.useEffect(()=>{E===!0?K():Array.isArray(E)&&v(E)},[]);const K=async i=>{try{O(!0);const T=await n(i);v(T)}catch(T){console.error("Error loading options:",T),v([])}finally{O(!1)}};e.useEffect(()=>{const i=T=>{b.current&&!b.current.contains(T.target)&&(S(!1),N(!1),W(""))};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const J=()=>{s||(S(!0),N(!0),y&&a.current&&setTimeout(()=>{var i;return(i=a.current)==null?void 0:i.focus()},0))},D=i=>{N(!0),w&&w(i)},Q=i=>{p&&p(i)},ee=i=>{W(i.target.value)},te=i=>{let T;B.includes(i)?T=B.filter(X=>X!==i):T=[...B,i],d&&t&&d.setValue(t,T),c.onChange&&c.onChange({target:{value:T}}),N(!0)},H=(i,T)=>{T.stopPropagation();const X=B.filter(ve=>ve!==i);d&&t&&d.setValue(t,X),c.onChange&&c.onChange({target:{value:X}})},ae=i=>{i.stopPropagation(),d&&t&&d.setValue(t,[]),c.onChange&&c.onChange({target:{value:[]}}),S(!1),N(!1),W("")},Y=R.filter(i=>B.includes(i.value)),U=Y.slice(0,f),G=Y.length-f;return e.createElement("div",{className:o("relative",x),ref:b},e.createElement("div",{id:c.id||t,tabIndex:y?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":s,className:o("peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:J,onFocus:y?void 0:D,onBlur:y?void 0:Q,ref:u},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},U.map(i=>e.createElement("span",{key:i.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"}},e.createElement("span",{className:"truncate",title:i.label},i.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] 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 ${i.label}`,tabIndex:-1,onClick:T=>H(i.value,T)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))),G>0&&e.createElement("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs"},"+",G," mais"),y?e.createElement("input",{ref:a,type:"text",value:k,onChange:ee,onFocus:D,onBlur:Q,placeholder:B.length===0&&!r?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):B.length===0&&!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),_&&e.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),F&&B&&B.length>0&&!_&&e.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:ae},"✕")),r&&e.createElement("label",{htmlFor:c.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",$?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",s?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:s?"9.5rem":"0",overflowY:R.length>3?"auto":"hidden"}},_?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):R.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):R.map(i=>e.createElement("div",{key:i.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",B.includes(i.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>te(i.value)},e.createElement("input",{type:"checkbox",checked:B.includes(i.value),readOnly:!0,className:"accent-blue-500"}),i.label))),q&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},q))});fe.displayName="MultiAsyncSelect";const ye={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},be=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,optionClassName:F,direction:E="row",size:M="md",onFocus:m,onBlur:y,...C},f)=>{var s,S,R;const w=V.useFormContext(),p=w==null?void 0:w.control,c=p&&t?V.useWatch({control:p,name:t}):void 0,u=C.value??c??"",h=(R=(S=(s=w==null?void 0:w.formState)==null?void 0:s.errors)==null?void 0:S[t])==null?void 0:R.message,N=v=>{w&&t&&w.setValue(t,v),C.onChange&&C.onChange({target:{value:v}})};return e.createElement("div",{className:o("relative",x),ref:f},r&&e.createElement("label",{htmlFor:t,className:o("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,#2563eb)] p-1 rounded-full bg-white")},r),e.createElement("div",{className:o("flex gap-2 w-full pt-6",E==="row"?"flex-row":"flex-col",l),"aria-label":r,tabIndex:-1,onFocus:m,onBlur:y},n.map(v=>e.createElement("button",{key:v.value,type:"button",className:o("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-hover,#dbeafe)]",ye[M],u===v.value?"border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]":"border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",F),"aria-pressed":u===v.value,"data-selected":u===v.value,tabIndex:0,onClick:()=>N(v.value),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),N(v.value))}},v.icon&&e.createElement("span",{className:"mr-2 text-lg flex items-center"},v.icon),e.createElement("span",{className:"truncate font-medium"},v.label)))),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});be.displayName="RadioGroup";const re=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4 border-b","bg-[var(--card-header-bg,rgba(249,250,251,0.5))]","border-[var(--card-header-border,#e5e7eb)]","text-[var(--card-text,#111827)]",r),...l},t));re.displayName="CardHeader";const ne=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",r),...l},t));ne.displayName="CardBody";const le=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4 border-t","bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]","border-[var(--card-footer-border,#e5e7eb)]","text-[var(--card-text,#111827)]",r),...l},t));le.displayName="CardFooter";const xe=j.forwardRef(({children:t,className:r,variant:n="default",size:l="md",padding:x="none",rounded:F="lg",...E},M)=>{const m={default:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",outlined:"bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",elevated:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",flat:"bg-[var(--card-bg,#ffffff)] border-0"},y={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},C={none:"",sm:"p-3",md:"p-4",lg:"p-6"},f={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return j.createElement("div",{ref:M,className:o("flex flex-col","overflow-hidden",m[n],y[l],C[x],f[F],r),...E},t)});xe.displayName="Card";const Z=xe;Z.Header=re;Z.Body=ne;Z.Footer=le;exports.AsyncSelect=de;exports.Button=he;exports.Card=Z;exports.CardBody=ne;exports.CardFooter=le;exports.CardHeader=re;exports.Input=ce;exports.MultiAsyncSelect=fe;exports.MultiSelect=me;exports.RadioGroup=be;exports.Select=ie;exports.Textarea=ue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),V=require("react-hook-form");function xe(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const e=xe(j);function oe(t){var r,n,l="";if(typeof t=="string"||typeof t=="number")l+=t;else if(typeof t=="object")if(Array.isArray(t)){var x=t.length;for(r=0;r<x;r++)t[r]&&(n=oe(t[r]))&&(l&&(l+=" "),l+=n)}else for(n in t)t[n]&&(l&&(l+=" "),l+=n);return l}function ve(){for(var t,r,n=0,l="",x=arguments.length;n<x;n++)(t=arguments[n])&&(r=oe(t))&&(l&&(l+=" "),l+=r);return l}function o(...t){return ve(...t)}const ge=({children:t,variant:r="default",className:n="",...l})=>{const x="px-4 py-2 rounded font-medium transition",F={default:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",outline:"border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"};return j.createElement("button",{className:o(x,F[r],n),...l},t)},se=e.forwardRef(({name:t,className:r,type:n="text",label:l,onFocus:x,onBlur:F,Icon:E,iconClassName:M,iconAction:m,containerClassName:y,...C},f)=>{var I,b,a;const[w,p]=e.useState(!1),[c,u]=e.useState(!1),h=V.useFormContext(),N=h==null?void 0:h.control,s=h==null?void 0:h.register,S=N&&t?V.useWatch({control:N,name:t}):void 0,R=C.value??S??"",v=(a=(b=(I=h==null?void 0:h.formState)==null?void 0:I.errors)==null?void 0:b[t])==null?void 0:a.message,_=w||!!R,O=n==="password"?c?"text":"password":n,k=()=>e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.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"})),W=()=>e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.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"})),z=()=>{u(!c)};return e.createElement("div",{className:o("relative",y)},e.createElement("input",{id:C.id||t,type:O,className:o("peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",n==="password"||E?"pr-12":"",r),onFocus:d=>{p(!0),x&&x(d)},...h&&t?(()=>{const d=s(t),A=d.onBlur;return{...d,ref:L=>{typeof f=="function"?f(L):f&&(f.current=L),d.ref&&d.ref(L)},onBlur:L=>{p(!1),F&&F(L),A&&A(L)}}})():{ref:f,onBlur:d=>{p(!1),F&&F(d)}},...C}),l&&e.createElement("label",{htmlFor:C.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",_?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},l),n==="password"&&e.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:z,"aria-label":c?"Esconder senha":"Mostrar senha",tabIndex:-1},c?e.createElement(W,null):e.createElement(k,null)),E&&n!=="password"&&e.createElement("div",{className:o("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",M),onClick:m},e.createElement(E,null)),v&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},v))});se.displayName="Input";const ce=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,isClearable:F,onFocus:E,onBlur:M,...m},y)=>{var k,W,z,I;const[C,f]=e.useState(!1),[w,p]=e.useState(!1),c=e.useRef(null),u=V.useFormContext(),h=u==null?void 0:u.control,N=h&&t?V.useWatch({control:h,name:t}):void 0,s=m.value??N??"",S=(z=(W=(k=u==null?void 0:u.formState)==null?void 0:k.errors)==null?void 0:W[t])==null?void 0:z.message,R=C||!!s;e.useEffect(()=>{const b=a=>{c.current&&!c.current.contains(a.target)&&(p(!1),f(!1))};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]);const v=()=>{p(b=>!b),f(!0)},_=b=>{f(!0),E&&E(b)},O=b=>{M&&M(b)};return e.createElement("div",{className:o("relative",x),ref:c},e.createElement("div",{id:m.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:v,onFocus:_,onBlur:O,ref:y},e.createElement("span",{className:o("block truncate",!s&&"text-gray-400")},((I=n.find(b=>b.value===s))==null?void 0:I.label)||!r&&"Selecione..."),F&&s&&e.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:b=>{if(b.stopPropagation(),u&&t&&u.setValue(t,""),m.onChange){const a={target:{value:""}};m.onChange(a)}p(!1),f(!1)}},"✕")),r&&e.createElement("label",{htmlFor:m.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",w?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(b=>e.createElement("div",{key:b.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",s===b.value&&"bg-blue-100"),onMouseDown:()=>{if(u&&t&&u.setValue(t,b.value),m.onChange){const a={target:{value:b.value}};m.onChange(a)}f(!0)}},b.label))),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});ce.displayName="Select";const ie=e.forwardRef(({name:t,className:r,label:n,onFocus:l,onBlur:x,Icon:F,iconClassName:E,iconAction:M,containerClassName:m,rows:y=4,...C},f)=>{var v,_,O;const[w,p]=e.useState(!1),c=V.useFormContext(),u=c==null?void 0:c.control,h=c==null?void 0:c.register,N=u&&t?V.useWatch({control:u,name:t}):void 0,s=C.value??N??"",S=(O=(_=(v=c==null?void 0:c.formState)==null?void 0:v.errors)==null?void 0:_[t])==null?void 0:O.message,R=w||!!s;return e.createElement("div",{className:o("relative",m)},e.createElement("textarea",{id:C.id||t,rows:y,className:o("peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",F?"pr-12":"",r),onFocus:k=>{p(!0),l&&l(k)},...c&&t?(()=>{const k=h(t),W=k.onBlur;return{...k,ref:z=>{typeof f=="function"?f(z):f&&(f.current=z),k.ref&&k.ref(z)},onBlur:z=>{p(!1),x&&x(z),W&&W(z)}}})():{ref:f,onBlur:k=>{p(!1),x&&x(k)}},...C}),n&&e.createElement("label",{htmlFor:C.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),F&&e.createElement("div",{className:o("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",E),onClick:M},e.createElement(F,null)),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});ie.displayName="Textarea";const ue=e.forwardRef(({name:t,label:r,loadOptions:n,className:l,containerClassName:x,isClearable:F,defaultOptions:E=!1,loadingMessage:M="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:y=!1,debounceMs:C=300,onFocus:f,onBlur:w,...p},c)=>{var Y,U,G;const[u,h]=e.useState(!1),[N,s]=e.useState(!1),[S,R]=e.useState([]),[v,_]=e.useState(!1),[O,k]=e.useState(""),[W,z]=e.useState(""),I=e.useRef(null),b=e.useRef(null),a=V.useFormContext(),d=a==null?void 0:a.control,A=d&&t?V.useWatch({control:d,name:t}):void 0,L=p.value??A??"",B=(G=(U=(Y=a==null?void 0:a.formState)==null?void 0:Y.errors)==null?void 0:U[t])==null?void 0:G.message,q=u||!!L;e.useEffect(()=>{const g=setTimeout(()=>{z(O)},C);return()=>clearTimeout(g)},[O,C]),e.useEffect(()=>{(N||E&&S.length===0)&&$(y?W:void 0)},[W,N]),e.useEffect(()=>{E===!0?$():Array.isArray(E)&&R(E)},[]);const $=async g=>{try{_(!0);const P=await n(g);R(P)}catch(P){console.error("Error loading options:",P),R([])}finally{_(!1)}};e.useEffect(()=>{const g=P=>{I.current&&!I.current.contains(P.target)&&(s(!1),h(!1),k(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]);const K=()=>{N||(s(!0),h(!0),y&&b.current&&setTimeout(()=>{var g;return(g=b.current)==null?void 0:g.focus()},0))},J=g=>{h(!0),f&&f(g)},D=g=>{w&&w(g)},Q=g=>{k(g.target.value)},Z=g=>{if(a&&t&&a.setValue(t,g),p.onChange){const P={target:{value:g}};p.onChange(P)}s(!1),h(!1),k("")},ee=g=>{if(g.stopPropagation(),a&&t&&a.setValue(t,""),p.onChange){const P={target:{value:""}};p.onChange(P)}s(!1),h(!1),k("")},H=S.find(g=>g.value===L),te=y&&N?O:(H==null?void 0:H.label)||"";return e.createElement("div",{className:o("relative",x),ref:I},e.createElement("div",{id:p.id||t,tabIndex:y?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":N,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:K,onFocus:y?void 0:J,onBlur:y?void 0:D,ref:c},y?e.createElement("input",{ref:b,type:"text",value:te,onChange:Q,onFocus:J,onBlur:D,placeholder:r?"":"Selecione...",className:o("w-full bg-transparent border-none outline-none text-sm",!L&&!O&&"text-gray-400")}):e.createElement("span",{className:o("block truncate",!L&&"text-gray-400")},(H==null?void 0:H.label)||!r&&"Selecione..."),v&&e.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),F&&L&&!v&&e.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:ee},"✕")),r&&e.createElement("label",{htmlFor:p.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",q?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",N?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:N?"9.5rem":"0",overflowY:S.length>3?"auto":"hidden"}},v?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):S.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):S.map(g=>e.createElement("div",{key:g.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",L===g.value&&"bg-blue-100"),onMouseDown:()=>Z(g.value)},g.label))),B&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},B))});ue.displayName="AsyncSelect";const de=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,isClearable:F,onFocus:E,onBlur:M,...m},y)=>{var z,I,b;const[C,f]=e.useState(!1),[w,p]=e.useState(!1),c=e.useRef(null),u=V.useFormContext(),h=u==null?void 0:u.control,N=h&&t?V.useWatch({control:h,name:t}):void 0,s=m.value??N??[],S=(b=(I=(z=u==null?void 0:u.formState)==null?void 0:z.errors)==null?void 0:I[t])==null?void 0:b.message,R=C||s&&s.length>0;e.useEffect(()=>{const a=d=>{c.current&&!c.current.contains(d.target)&&(p(!1),f(!1))};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[]);const v=()=>{p(a=>!a),f(!0)},_=a=>{f(!0),E&&E(a)},O=a=>{M&&M(a)},k=a=>{var A;let d;s.includes(a)?d=s.filter(L=>L!==a):d=[...s,a],u&&t&&u.setValue(t,d),m.onChange&&((A=m.onChange)==null||A.call(m,{target:{value:d}})),f(!0)},W=a=>{var d;a.stopPropagation(),u&&t&&u.setValue(t,[]),m.onChange&&((d=m.onChange)==null||d.call(m,{target:{value:[]}})),p(!1),f(!1)};return e.createElement("div",{className:o("relative",x),ref:c},e.createElement("div",{id:m.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":w,className:o("peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:v,onFocus:_,onBlur:O,ref:y},e.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},s&&s.length>0?n.filter(a=>s.includes(a.value)).map(a=>e.createElement("span",{key:a.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"}},e.createElement("span",{className:"truncate",title:a.label},a.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] 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 ${a.label}`,tabIndex:-1,onClick:d=>{d.stopPropagation();const A=s.filter(L=>L!==a.value);u&&t&&u.setValue(t,A),m.onChange&&m.onChange({target:{value:A}})}},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))):!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),F&&s&&s.length>0&&e.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},"✕")),r&&e.createElement("label",{htmlFor:m.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",R?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",w?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:w?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(a=>e.createElement("div",{key:a.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",s.includes(a.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>k(a.value)},e.createElement("input",{type:"checkbox",checked:s.includes(a.value),readOnly:!0,className:"accent-blue-500"}),a.label))),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});de.displayName="MultiSelect";const me=e.forwardRef(({name:t,label:r,loadOptions:n,className:l,containerClassName:x,isClearable:F,defaultOptions:E=!1,loadingMessage:M="Carregando...",noOptionsMessage:m="Nenhuma opção encontrada",searchable:y=!1,debounceMs:C=300,maxSelectedDisplay:f=3,onFocus:w,onBlur:p,...c},u)=>{var g,P,le;const[h,N]=e.useState(!1),[s,S]=e.useState(!1),[R,v]=e.useState([]),[_,O]=e.useState(!1),[k,W]=e.useState(""),[z,I]=e.useState(""),b=e.useRef(null),a=e.useRef(null),d=V.useFormContext(),A=d==null?void 0:d.control,L=A&&t?V.useWatch({control:A,name:t}):void 0,B=c.value??L??[],q=(le=(P=(g=d==null?void 0:d.formState)==null?void 0:g.errors)==null?void 0:P[t])==null?void 0:le.message,$=h||B&&B.length>0;e.useEffect(()=>{const i=setTimeout(()=>{I(k)},C);return()=>clearTimeout(i)},[k,C]),e.useEffect(()=>{(s||E&&R.length===0)&&K(y?z:void 0)},[z,s]),e.useEffect(()=>{E===!0?K():Array.isArray(E)&&v(E)},[]);const K=async i=>{try{O(!0);const T=await n(i);v(T)}catch(T){console.error("Error loading options:",T),v([])}finally{O(!1)}};e.useEffect(()=>{const i=T=>{b.current&&!b.current.contains(T.target)&&(S(!1),N(!1),W(""))};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const J=()=>{s||(S(!0),N(!0),y&&a.current&&setTimeout(()=>{var i;return(i=a.current)==null?void 0:i.focus()},0))},D=i=>{N(!0),w&&w(i)},Q=i=>{p&&p(i)},Z=i=>{W(i.target.value)},ee=i=>{let T;B.includes(i)?T=B.filter(X=>X!==i):T=[...B,i],d&&t&&d.setValue(t,T),c.onChange&&c.onChange({target:{value:T}}),N(!0)},H=(i,T)=>{T.stopPropagation();const X=B.filter(be=>be!==i);d&&t&&d.setValue(t,X),c.onChange&&c.onChange({target:{value:X}})},te=i=>{i.stopPropagation(),d&&t&&d.setValue(t,[]),c.onChange&&c.onChange({target:{value:[]}}),S(!1),N(!1),W("")},Y=R.filter(i=>B.includes(i.value)),U=Y.slice(0,f),G=Y.length-f;return e.createElement("div",{className:o("relative",x),ref:b},e.createElement("div",{id:c.id||t,tabIndex:y?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":s,className:o("peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",l),onClick:J,onFocus:y?void 0:D,onBlur:y?void 0:Q,ref:u},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},U.map(i=>e.createElement("span",{key:i.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"}},e.createElement("span",{className:"truncate",title:i.label},i.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] 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 ${i.label}`,tabIndex:-1,onClick:T=>H(i.value,T)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))),G>0&&e.createElement("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs"},"+",G," mais"),y?e.createElement("input",{ref:a,type:"text",value:k,onChange:Z,onFocus:D,onBlur:Q,placeholder:B.length===0&&!r?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):B.length===0&&!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),_&&e.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),F&&B&&B.length>0&&!_&&e.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:te},"✕")),r&&e.createElement("label",{htmlFor:c.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",$?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},r),e.createElement("div",{className:o("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",s?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:s?"9.5rem":"0",overflowY:R.length>3?"auto":"hidden"}},_?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):R.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},m):R.map(i=>e.createElement("div",{key:i.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",B.includes(i.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>ee(i.value)},e.createElement("input",{type:"checkbox",checked:B.includes(i.value),readOnly:!0,className:"accent-blue-500"}),i.label))),q&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},q))});me.displayName="MultiAsyncSelect";const pe={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},fe=e.forwardRef(({name:t,label:r,options:n,className:l,containerClassName:x,optionClassName:F,direction:E="row",size:M="md",onFocus:m,onBlur:y,...C},f)=>{var s,S,R;const w=V.useFormContext(),p=w==null?void 0:w.control,c=p&&t?V.useWatch({control:p,name:t}):void 0,u=C.value??c??"",h=(R=(S=(s=w==null?void 0:w.formState)==null?void 0:s.errors)==null?void 0:S[t])==null?void 0:R.message,N=v=>{w&&t&&w.setValue(t,v),C.onChange&&C.onChange({target:{value:v}})};return e.createElement("div",{className:o("relative",x),ref:f},r&&e.createElement("label",{htmlFor:t,className:o("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,#2563eb)] p-1 rounded-full bg-white")},r),e.createElement("div",{className:o("flex gap-2 w-full pt-6",E==="row"?"flex-row":"flex-col",l),"aria-label":r,tabIndex:-1,onFocus:m,onBlur:y},n.map(v=>e.createElement("button",{key:v.value,type:"button",className:o("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-hover,#dbeafe)]",pe[M],u===v.value?"border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]":"border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",F),"aria-pressed":u===v.value,"data-selected":u===v.value,tabIndex:0,onClick:()=>N(v.value),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),N(v.value))}},v.icon&&e.createElement("span",{className:"mr-2 text-lg flex items-center"},v.icon),e.createElement("span",{className:"truncate font-medium"},v.label)))),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});fe.displayName="RadioGroup";const ae=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4 border-b","bg-[var(--card-header-bg,rgba(249,250,251,0.5))]","border-[var(--card-header-border,#e5e7eb)]","text-[var(--card-text,#111827)]",r),...l},t));ae.displayName="CardHeader";const re=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",r),...l},t));re.displayName="CardBody";const ne=j.forwardRef(({children:t,className:r,as:n="div",...l},x)=>j.createElement(n,{ref:x,className:o("px-6 py-4 border-t","bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]","border-[var(--card-footer-border,#e5e7eb)]","text-[var(--card-text,#111827)]",r),...l},t));ne.displayName="CardFooter";const he=j.forwardRef(({children:t,className:r,variant:n="default",size:l="md",padding:x="none",rounded:F="lg",...E},M)=>{const m={default:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",outlined:"bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",elevated:"bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",flat:"bg-[var(--card-bg,#ffffff)] border-0"},y={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},C={none:"",sm:"p-3",md:"p-4",lg:"p-6"},f={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return j.createElement("div",{ref:M,className:o("flex flex-col","overflow-hidden",m[n],y[l],C[x],f[F],r),...E},t)}),ye=Object.assign(he,{Header:ae,Body:re,Footer:ne});exports.AsyncSelect=ue;exports.Button=ge;exports.Card=ye;exports.CardBody=re;exports.CardFooter=ne;exports.CardHeader=ae;exports.Input=se;exports.MultiAsyncSelect=me;exports.MultiSelect=de;exports.RadioGroup=fe;exports.Select=ce;exports.Textarea=ie;
@@ -1,23 +1,23 @@
1
1
  import * as e from "react";
2
2
  import P from "react";
3
- import { useFormContext as D, useWatch as j } from "react-hook-form";
4
- function le(t) {
3
+ import { useFormContext as j, useWatch as D } from "react-hook-form";
4
+ function ne(t) {
5
5
  var r, n, o = "";
6
6
  if (typeof t == "string" || typeof t == "number") o += t;
7
7
  else if (typeof t == "object") if (Array.isArray(t)) {
8
8
  var v = t.length;
9
- for (r = 0; r < v; r++) t[r] && (n = le(t[r])) && (o && (o += " "), o += n);
9
+ for (r = 0; r < v; r++) t[r] && (n = ne(t[r])) && (o && (o += " "), o += n);
10
10
  } else for (n in t) t[n] && (o && (o += " "), o += n);
11
11
  return o;
12
12
  }
13
- function de() {
14
- for (var t, r, n = 0, o = "", v = arguments.length; n < v; n++) (t = arguments[n]) && (r = le(t)) && (o && (o += " "), o += r);
13
+ function ie() {
14
+ for (var t, r, n = 0, o = "", v = arguments.length; n < v; n++) (t = arguments[n]) && (r = ne(t)) && (o && (o += " "), o += r);
15
15
  return o;
16
16
  }
17
17
  function l(...t) {
18
- return de(...t);
18
+ return ie(...t);
19
19
  }
20
- const Ee = ({
20
+ const we = ({
21
21
  children: t,
22
22
  variant: r = "default",
23
23
  className: n = "",
@@ -29,7 +29,7 @@ const Ee = ({
29
29
  secondary: "bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"
30
30
  };
31
31
  return /* @__PURE__ */ P.createElement("button", { className: l(v, R[r], n), ...o }, t);
32
- }, me = e.forwardRef(
32
+ }, ue = e.forwardRef(
33
33
  ({
34
34
  name: t,
35
35
  className: r,
@@ -44,7 +44,7 @@ const Ee = ({
44
44
  ...N
45
45
  }, f) => {
46
46
  var O, b, a;
47
- const [w, p] = e.useState(!1), [c, u] = e.useState(!1), h = D(), C = h == null ? void 0 : h.control, s = h == null ? void 0 : h.register, S = C && t ? j({ control: C, name: t }) : void 0, F = N.value ?? S ?? "", x = (a = (b = (O = h == null ? void 0 : h.formState) == null ? void 0 : O.errors) == null ? void 0 : b[t]) == null ? void 0 : a.message, _ = w || !!F, M = n === "password" ? c ? "text" : "password" : n, k = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
47
+ const [w, p] = e.useState(!1), [c, u] = e.useState(!1), h = j(), C = h == null ? void 0 : h.control, s = h == null ? void 0 : h.register, S = C && t ? D({ control: C, name: t }) : void 0, F = N.value ?? S ?? "", x = (a = (b = (O = h == null ? void 0 : h.formState) == null ? void 0 : O.errors) == null ? void 0 : b[t]) == null ? void 0 : a.message, _ = w || !!F, M = n === "password" ? c ? "text" : "password" : n, k = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
48
48
  "path",
49
49
  {
50
50
  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",
@@ -125,8 +125,8 @@ const Ee = ({
125
125
  ), x && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, x));
126
126
  }
127
127
  );
128
- me.displayName = "Input";
129
- const fe = e.forwardRef(
128
+ ue.displayName = "Input";
129
+ const de = e.forwardRef(
130
130
  ({
131
131
  name: t,
132
132
  label: r,
@@ -139,7 +139,7 @@ const fe = e.forwardRef(
139
139
  ...m
140
140
  }, y) => {
141
141
  var k, B, z, O;
142
- const [N, f] = e.useState(!1), [w, p] = e.useState(!1), c = e.useRef(null), u = D(), h = u == null ? void 0 : u.control, C = h && t ? j({ control: h, name: t }) : void 0, s = m.value ?? C ?? "", S = (z = (B = (k = u == null ? void 0 : u.formState) == null ? void 0 : k.errors) == null ? void 0 : B[t]) == null ? void 0 : z.message, F = N || !!s;
142
+ const [N, f] = e.useState(!1), [w, p] = e.useState(!1), c = e.useRef(null), u = j(), h = u == null ? void 0 : u.control, C = h && t ? D({ control: h, name: t }) : void 0, s = m.value ?? C ?? "", S = (z = (B = (k = u == null ? void 0 : u.formState) == null ? void 0 : k.errors) == null ? void 0 : B[t]) == null ? void 0 : z.message, F = N || !!s;
143
143
  e.useEffect(() => {
144
144
  const b = (a) => {
145
145
  c.current && !c.current.contains(a.target) && (p(!1), f(!1));
@@ -238,8 +238,8 @@ const fe = e.forwardRef(
238
238
  ), S && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, S));
239
239
  }
240
240
  );
241
- fe.displayName = "Select";
242
- const be = e.forwardRef(
241
+ de.displayName = "Select";
242
+ const me = e.forwardRef(
243
243
  ({
244
244
  name: t,
245
245
  className: r,
@@ -254,7 +254,7 @@ const be = e.forwardRef(
254
254
  ...N
255
255
  }, f) => {
256
256
  var x, _, M;
257
- const [w, p] = e.useState(!1), c = D(), u = c == null ? void 0 : c.control, h = c == null ? void 0 : c.register, C = u && t ? j({ control: u, name: t }) : void 0, s = N.value ?? C ?? "", S = (M = (_ = (x = c == null ? void 0 : c.formState) == null ? void 0 : x.errors) == null ? void 0 : _[t]) == null ? void 0 : M.message, F = w || !!s;
257
+ const [w, p] = e.useState(!1), c = j(), u = c == null ? void 0 : c.control, h = c == null ? void 0 : c.register, C = u && t ? D({ control: u, name: t }) : void 0, s = N.value ?? C ?? "", S = (M = (_ = (x = c == null ? void 0 : c.formState) == null ? void 0 : x.errors) == null ? void 0 : _[t]) == null ? void 0 : M.message, F = w || !!s;
258
258
  return /* @__PURE__ */ e.createElement("div", { className: l("relative", m) }, /* @__PURE__ */ e.createElement(
259
259
  "textarea",
260
260
  {
@@ -311,8 +311,8 @@ const be = e.forwardRef(
311
311
  ), S && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, S));
312
312
  }
313
313
  );
314
- be.displayName = "Textarea";
315
- const ve = e.forwardRef(
314
+ me.displayName = "Textarea";
315
+ const fe = e.forwardRef(
316
316
  ({
317
317
  name: t,
318
318
  label: r,
@@ -330,7 +330,7 @@ const ve = e.forwardRef(
330
330
  ...p
331
331
  }, c) => {
332
332
  var G, X, $;
333
- const [u, h] = e.useState(!1), [C, s] = e.useState(!1), [S, F] = e.useState([]), [x, _] = e.useState(!1), [M, k] = e.useState(""), [B, z] = e.useState(""), O = e.useRef(null), b = e.useRef(null), a = D(), d = a == null ? void 0 : a.control, W = d && t ? j({ control: d, name: t }) : void 0, L = p.value ?? W ?? "", V = ($ = (X = (G = a == null ? void 0 : a.formState) == null ? void 0 : G.errors) == null ? void 0 : X[t]) == null ? void 0 : $.message, K = u || !!L;
333
+ const [u, h] = e.useState(!1), [C, s] = e.useState(!1), [S, F] = e.useState([]), [x, _] = e.useState(!1), [M, k] = e.useState(""), [B, z] = e.useState(""), O = e.useRef(null), b = e.useRef(null), a = j(), d = a == null ? void 0 : a.control, W = d && t ? D({ control: d, name: t }) : void 0, L = p.value ?? W ?? "", V = ($ = (X = (G = a == null ? void 0 : a.formState) == null ? void 0 : G.errors) == null ? void 0 : X[t]) == null ? void 0 : $.message, K = u || !!L;
334
334
  e.useEffect(() => {
335
335
  const g = setTimeout(() => {
336
336
  z(M);
@@ -470,8 +470,8 @@ const ve = e.forwardRef(
470
470
  ), V && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, V));
471
471
  }
472
472
  );
473
- ve.displayName = "AsyncSelect";
474
- const xe = e.forwardRef(
473
+ fe.displayName = "AsyncSelect";
474
+ const be = e.forwardRef(
475
475
  ({
476
476
  name: t,
477
477
  label: r,
@@ -484,7 +484,7 @@ const xe = e.forwardRef(
484
484
  ...m
485
485
  }, y) => {
486
486
  var z, O, b;
487
- const [N, f] = e.useState(!1), [w, p] = e.useState(!1), c = e.useRef(null), u = D(), h = u == null ? void 0 : u.control, C = h && t ? j({ control: h, name: t }) : void 0, s = m.value ?? C ?? [], S = (b = (O = (z = u == null ? void 0 : u.formState) == null ? void 0 : z.errors) == null ? void 0 : O[t]) == null ? void 0 : b.message, F = N || s && s.length > 0;
487
+ const [N, f] = e.useState(!1), [w, p] = e.useState(!1), c = e.useRef(null), u = j(), h = u == null ? void 0 : u.control, C = h && t ? D({ control: h, name: t }) : void 0, s = m.value ?? C ?? [], S = (b = (O = (z = u == null ? void 0 : u.formState) == null ? void 0 : z.errors) == null ? void 0 : O[t]) == null ? void 0 : b.message, F = N || s && s.length > 0;
488
488
  e.useEffect(() => {
489
489
  const a = (d) => {
490
490
  c.current && !c.current.contains(d.target) && (p(!1), f(!1));
@@ -636,8 +636,8 @@ const xe = e.forwardRef(
636
636
  ), S && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, S));
637
637
  }
638
638
  );
639
- xe.displayName = "MultiSelect";
640
- const ge = e.forwardRef(
639
+ be.displayName = "MultiSelect";
640
+ const ve = e.forwardRef(
641
641
  ({
642
642
  name: t,
643
643
  label: r,
@@ -655,8 +655,8 @@ const ge = e.forwardRef(
655
655
  onBlur: p,
656
656
  ...c
657
657
  }, u) => {
658
- var g, A, ne;
659
- const [h, C] = e.useState(!1), [s, S] = e.useState(!1), [F, x] = e.useState([]), [_, M] = e.useState(!1), [k, B] = e.useState(""), [z, O] = e.useState(""), b = e.useRef(null), a = e.useRef(null), d = D(), W = d == null ? void 0 : d.control, L = W && t ? j({ control: W, name: t }) : void 0, V = c.value ?? L ?? [], K = (ne = (A = (g = d == null ? void 0 : d.formState) == null ? void 0 : g.errors) == null ? void 0 : A[t]) == null ? void 0 : ne.message, q = h || V && V.length > 0;
658
+ var g, A, re;
659
+ const [h, C] = e.useState(!1), [s, S] = e.useState(!1), [F, x] = e.useState([]), [_, M] = e.useState(!1), [k, B] = e.useState(""), [z, O] = e.useState(""), b = e.useRef(null), a = e.useRef(null), d = j(), W = d == null ? void 0 : d.control, L = W && t ? D({ control: W, name: t }) : void 0, V = c.value ?? L ?? [], K = (re = (A = (g = d == null ? void 0 : d.formState) == null ? void 0 : g.errors) == null ? void 0 : A[t]) == null ? void 0 : re.message, q = h || V && V.length > 0;
660
660
  e.useEffect(() => {
661
661
  const i = setTimeout(() => {
662
662
  O(k);
@@ -704,7 +704,7 @@ const ge = e.forwardRef(
704
704
  }), C(!0);
705
705
  }, H = (i, T) => {
706
706
  T.stopPropagation();
707
- const Z = V.filter((ue) => ue !== i);
707
+ const Z = V.filter((ce) => ce !== i);
708
708
  d && t && d.setValue(t, Z), c.onChange && c.onChange({
709
709
  target: { value: Z }
710
710
  });
@@ -838,12 +838,12 @@ const ge = e.forwardRef(
838
838
  ), K && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, K));
839
839
  }
840
840
  );
841
- ge.displayName = "MultiAsyncSelect";
842
- const pe = {
841
+ ve.displayName = "MultiAsyncSelect";
842
+ const xe = {
843
843
  sm: "h-10 text-sm px-3",
844
844
  md: "h-12 text-base px-4",
845
845
  lg: "h-16 text-lg px-6"
846
- }, he = e.forwardRef(
846
+ }, ge = e.forwardRef(
847
847
  ({
848
848
  name: t,
849
849
  label: r,
@@ -858,7 +858,7 @@ const pe = {
858
858
  ...N
859
859
  }, f) => {
860
860
  var s, S, F;
861
- const w = D(), p = w == null ? void 0 : w.control, c = p && t ? j({ control: p, name: t }) : void 0, u = N.value ?? c ?? "", h = (F = (S = (s = w == null ? void 0 : w.formState) == null ? void 0 : s.errors) == null ? void 0 : S[t]) == null ? void 0 : F.message, C = (x) => {
861
+ const w = j(), p = w == null ? void 0 : w.control, c = p && t ? D({ control: p, name: t }) : void 0, u = N.value ?? c ?? "", h = (F = (S = (s = w == null ? void 0 : w.formState) == null ? void 0 : s.errors) == null ? void 0 : S[t]) == null ? void 0 : F.message, C = (x) => {
862
862
  w && t && w.setValue(t, x), N.onChange && N.onChange({ target: { value: x } });
863
863
  };
864
864
  return /* @__PURE__ */ e.createElement("div", { className: l("relative", v), ref: f }, r && /* @__PURE__ */ e.createElement(
@@ -892,7 +892,7 @@ const pe = {
892
892
  type: "button",
893
893
  className: l(
894
894
  "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-hover,#dbeafe)]",
895
- pe[I],
895
+ xe[I],
896
896
  u === x.value ? "border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]" : "border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",
897
897
  R
898
898
  ),
@@ -910,8 +910,8 @@ const pe = {
910
910
  ), h && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, h));
911
911
  }
912
912
  );
913
- he.displayName = "RadioGroup";
914
- const oe = P.forwardRef(
913
+ ge.displayName = "RadioGroup";
914
+ const le = P.forwardRef(
915
915
  ({ children: t, className: r, as: n = "div", ...o }, v) => /* @__PURE__ */ P.createElement(
916
916
  n,
917
917
  {
@@ -928,8 +928,8 @@ const oe = P.forwardRef(
928
928
  t
929
929
  )
930
930
  );
931
- oe.displayName = "CardHeader";
932
- const se = P.forwardRef(
931
+ le.displayName = "CardHeader";
932
+ const oe = P.forwardRef(
933
933
  ({ children: t, className: r, as: n = "div", ...o }, v) => /* @__PURE__ */ P.createElement(
934
934
  n,
935
935
  {
@@ -947,8 +947,8 @@ const se = P.forwardRef(
947
947
  t
948
948
  )
949
949
  );
950
- se.displayName = "CardBody";
951
- const ce = P.forwardRef(
950
+ oe.displayName = "CardBody";
951
+ const se = P.forwardRef(
952
952
  ({ children: t, className: r, as: n = "div", ...o }, v) => /* @__PURE__ */ P.createElement(
953
953
  n,
954
954
  {
@@ -965,8 +965,8 @@ const ce = P.forwardRef(
965
965
  t
966
966
  )
967
967
  );
968
- ce.displayName = "CardFooter";
969
- const ie = P.forwardRef(
968
+ se.displayName = "CardFooter";
969
+ const pe = P.forwardRef(
970
970
  ({
971
971
  children: t,
972
972
  className: r,
@@ -1018,23 +1018,22 @@ const ie = P.forwardRef(
1018
1018
  t
1019
1019
  );
1020
1020
  }
1021
- );
1022
- ie.displayName = "Card";
1023
- const re = ie;
1024
- re.Header = oe;
1025
- re.Body = se;
1026
- re.Footer = ce;
1021
+ ), Ee = Object.assign(pe, {
1022
+ Header: le,
1023
+ Body: oe,
1024
+ Footer: se
1025
+ });
1027
1026
  export {
1028
- ve as AsyncSelect,
1029
- Ee as Button,
1030
- re as Card,
1031
- se as CardBody,
1032
- ce as CardFooter,
1033
- oe as CardHeader,
1034
- me as Input,
1035
- ge as MultiAsyncSelect,
1036
- xe as MultiSelect,
1037
- he as RadioGroup,
1038
- fe as Select,
1039
- be as Textarea
1027
+ fe as AsyncSelect,
1028
+ we as Button,
1029
+ Ee as Card,
1030
+ oe as CardBody,
1031
+ se as CardFooter,
1032
+ le as CardHeader,
1033
+ ue as Input,
1034
+ ve as MultiAsyncSelect,
1035
+ be as MultiSelect,
1036
+ ge as RadioGroup,
1037
+ de as Select,
1038
+ me as Textarea
1040
1039
  };
@@ -24,9 +24,10 @@ declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & Reac
24
24
  declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
25
25
  declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
26
26
  declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
27
- declare const CardComponent: typeof Card & {
27
+ type CardComponent = typeof Card & {
28
28
  Header: typeof CardHeader;
29
29
  Body: typeof CardBody;
30
30
  Footer: typeof CardFooter;
31
31
  };
32
- export { CardComponent as Card, CardHeader, CardBody, CardFooter };
32
+ declare const CompoundCard: CardComponent;
33
+ export { CompoundCard as Card, CardHeader, CardBody, CardFooter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rharuow-ds",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Modern React Design System with 9 components: Card (Header, Body, Footer), Button, Input (with password support), Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, and RadioGroup. Full React Hook Form integration, Tailwind CSS styling, CSS Variables for theme customization and dark mode support.",
5
5
  "main": "dist/rharuow-ds.cjs.js",
6
6
  "module": "dist/rharuow-ds.es.js",