rharuow-ds 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -3
- package/dist/rharuow-ds.cjs.js +1 -1
- package/dist/rharuow-ds.es.js +696 -642
- package/dist/styles.css +1 -1
- package/dist/types/src/components/MultiSelect.d.ts +4 -0
- package/dist/types/src/components/Select.d.ts +4 -0
- package/dist/types/src/stories/MultiSelect.stories.d.ts +17 -0
- package/dist/types/src/stories/Select.stories.d.ts +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/rharuow-ds)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[ - Digite para encontrar opções
|
|
11
|
+
- ✅ Filtro case-sensitive configurável
|
|
12
|
+
- ✅ Função de filtro customizável
|
|
13
|
+
- ✅ Placeholder personalizado para busca
|
|
14
|
+
- ✅ Validação de valores (só aceita opções válidas)
|
|
15
|
+
- ✅ Botão de limpeza (`isClearable`)
|
|
16
|
+
- ✅ Integração completa com React Hook Form
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
// Select básico
|
|
20
|
+
<Select
|
|
21
|
+
name="fruit"
|
|
22
|
+
label="Escolha uma fruta"
|
|
23
|
+
options={[
|
|
24
|
+
{ label: "Maçã", value: "apple" },
|
|
25
|
+
{ label: "Banana", value: "banana" },
|
|
26
|
+
{ label: "Manga", value: "mango" }
|
|
27
|
+
]}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
// Select com filtro
|
|
31
|
+
<Select
|
|
32
|
+
name="fruit"
|
|
33
|
+
label="Escolha uma fruta"
|
|
34
|
+
searchable
|
|
35
|
+
filterPlaceholder="Digite para filtrar frutas..."
|
|
36
|
+
caseSensitive={false}
|
|
37
|
+
isClearable
|
|
38
|
+
options={fruitOptions}
|
|
39
|
+
/>
|
|
40
|
+
```dge.svg)](https://github.com/Rharuow/rharuow-ds-docs/actions)
|
|
6
41
|
|
|
7
42
|
Um Design System moderno em React com integração completa ao React Hook Form, estilizado com Tailwind CSS e baseado em shadcn/ui.
|
|
8
43
|
|
|
@@ -10,7 +45,8 @@ Um Design System moderno em React com integração completa ao React Hook Form,
|
|
|
10
45
|
|
|
11
46
|
- ⚛️ **React 18+** com TypeScript
|
|
12
47
|
- 🧩 **10 componentes** prontos para uso (Input, Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, RadioGroup, Button, Card, Table)
|
|
13
|
-
-
|
|
48
|
+
- � **Filtro digitável** em componentes Select - Digite para encontrar opções rapidamente
|
|
49
|
+
- �🔗 **Integração nativa** com React Hook Form
|
|
14
50
|
- 🎨 **Customização via CSS Variables** - Mude o tema facilmente
|
|
15
51
|
- 🎯 **Componentes acessíveis** (ARIA)
|
|
16
52
|
- 📱 **Responsivo** por padrão
|
|
@@ -308,7 +344,36 @@ Seletor com carregamento assíncrono de opções:
|
|
|
308
344
|
|
|
309
345
|
### 🎛️ **MultiSelect**
|
|
310
346
|
|
|
311
|
-
Seletor múltiplo para escolha de várias opções
|
|
347
|
+
Seletor múltiplo para escolha de várias opções:
|
|
348
|
+
|
|
349
|
+
- ✅ Seleção múltipla com checkboxes
|
|
350
|
+
- ✅ **Filtro digitável** (`searchable`) - Digite para encontrar opções
|
|
351
|
+
- ✅ Tags visuais para itens selecionados
|
|
352
|
+
- ✅ Remoção individual de itens
|
|
353
|
+
- ✅ Filtro case-sensitive configurável
|
|
354
|
+
- ✅ Função de filtro customizável
|
|
355
|
+
- ✅ Botão de limpeza geral (`isClearable`)
|
|
356
|
+
- ✅ Integração completa com React Hook Form
|
|
357
|
+
|
|
358
|
+
```tsx
|
|
359
|
+
// MultiSelect básico
|
|
360
|
+
<MultiSelect
|
|
361
|
+
name="fruits"
|
|
362
|
+
label="Escolha suas frutas favoritas"
|
|
363
|
+
options={fruitOptions}
|
|
364
|
+
/>
|
|
365
|
+
|
|
366
|
+
// MultiSelect com filtro
|
|
367
|
+
<MultiSelect
|
|
368
|
+
name="fruits"
|
|
369
|
+
label="Escolha suas frutas favoritas"
|
|
370
|
+
searchable
|
|
371
|
+
filterPlaceholder="Digite para filtrar frutas..."
|
|
372
|
+
caseSensitive={false}
|
|
373
|
+
isClearable
|
|
374
|
+
options={fruitOptions}
|
|
375
|
+
/>
|
|
376
|
+
```
|
|
312
377
|
|
|
313
378
|
### 🔄🎛️ **MultiAsyncSelect**
|
|
314
379
|
|
package/dist/rharuow-ds.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),A=require("react-hook-form");function Ne(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(o,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return o.default=t,Object.freeze(o)}const e=Ne(R);function be(t){var o,a,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(o=0;o<i;o++)t[o]&&(a=be(t[o]))&&(n&&(n+=" "),n+=a)}else for(a in t)t[a]&&(n&&(n+=" "),n+=a);return n}function Se(){for(var t,o,a=0,n="",i=arguments.length;a<i;a++)(t=arguments[a])&&(o=be(t))&&(n&&(n+=" "),n+=o);return n}function s(...t){return Se(...t)}const ke=({children:t,variant:o="default",className:a="",...n})=>{const i="px-4 py-2 rounded font-medium transition",N={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 R.createElement("button",{className:s(i,N[o],a),...n},t)},ve=e.forwardRef(({name:t,className:o,type:a="text",label:n,onFocus:i,onBlur:N,Icon:w,iconClassName:L,iconAction:f,containerClassName:E,...C},p)=>{var H,j,M;const[d,y]=e.useState(!1),[m,O]=e.useState(!1),x=A.useFormContext(),l=x==null?void 0:x.control,g=x==null?void 0:x.register,T=l&&t?A.useWatch({control:l,name:t}):void 0,v=C.value??T??"",h=(M=(j=(H=x==null?void 0:x.formState)==null?void 0:H.errors)==null?void 0:j[t])==null?void 0:M.message,_=d||!!v,F=a==="password"?m?"text":"password":a,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"})),P=()=>{O(!m)};return e.createElement("div",{className:s("relative",E)},e.createElement("input",{id:C.id||t,type:F,className:s("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",a==="password"||w?"pr-12":"",o),onFocus:S=>{y(!0),i&&i(S)},...x&&t?(()=>{const S=g(t),c=S.onBlur;return{...S,ref:r=>{typeof p=="function"?p(r):p&&(p.current=r),S.ref&&S.ref(r)},onBlur:r=>{y(!1),N&&N(r),c&&c(r)}}})():{ref:p,onBlur:S=>{y(!1),N&&N(S)}},...C}),n&&e.createElement("label",{htmlFor:C.id||t,className:s("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")},n),a==="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:P,"aria-label":m?"Esconder senha":"Mostrar senha",tabIndex:-1},m?e.createElement(W,null):e.createElement(k,null)),w&&a!=="password"&&e.createElement("div",{className:s("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",L),onClick:f},e.createElement(w,null)),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});ve.displayName="Input";const xe=e.forwardRef(({name:t,label:o,options:a,className:n,containerClassName:i,isClearable:N,onFocus:w,onBlur:L,...f},E)=>{var H,j,M,S;const[C,p]=e.useState(!1),[d,y]=e.useState(!1),[m,O]=e.useState({top:0,left:0,width:0}),x=e.useRef(null),l=A.useFormContext(),g=l==null?void 0:l.control,T=g&&t?A.useWatch({control:g,name:t}):void 0,v=f.value??T??"",h=(M=(j=(H=l==null?void 0:l.formState)==null?void 0:H.errors)==null?void 0:j[t])==null?void 0:M.message,_=C||!!v,F=e.useCallback(()=>{if(x.current&&d){const c=x.current.getBoundingClientRect();O({top:c.bottom+window.scrollY+4,left:c.left+window.scrollX,width:c.width})}},[d]);e.useEffect(()=>{if(F(),d){const c=()=>F(),r=()=>F();return window.addEventListener("resize",c),window.addEventListener("scroll",r,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",r,!0)}}},[d,F]),e.useEffect(()=>{const c=r=>{x.current&&!x.current.contains(r.target)&&(y(!1),p(!1))};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]);const k=()=>{y(c=>!c),p(!0)},W=c=>{p(!0),w&&w(c)},P=c=>{L&&L(c)};return e.createElement("div",{className:s("relative",i),ref:x},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":d,className:s("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",n),onClick:k,onFocus:W,onBlur:P,ref:E},e.createElement("span",{className:s("block truncate",!v&&"text-gray-400")},((S=a.find(c=>c.value===v))==null?void 0:S.label)||!o&&"Selecione..."),N&&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:c=>{if(c.stopPropagation(),l&&t&&l.setValue(t,""),f.onChange){const r={target:{value:""}};f.onChange(r)}y(!1),p(!1)}},"✕")),o&&e.createElement("label",{htmlFor:f.id||t,className:s("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")},o),e.createElement("div",{className:s("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(--select-dropdown-text)]",d?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:d?"9.5rem":"0",overflowY:a.length>3?"auto":"hidden",position:"fixed",top:d?m.top:"auto",left:d?m.left:"auto",width:d?m.width:"auto",zIndex:9999,boxShadow:d?"var(--select-dropdown-shadow)":"none"}},a.map(c=>e.createElement("div",{key:c.value,className:s("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",v===c.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>{if(l&&t&&l.setValue(t,c.value),f.onChange){const r={target:{value:c.value}};f.onChange(r)}p(!0)}},c.label))),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});xe.displayName="Select";const pe=e.forwardRef(({name:t,className:o,label:a,onFocus:n,onBlur:i,Icon:N,iconClassName:w,iconAction:L,containerClassName:f,rows:E=4,...C},p)=>{var h,_,F;const[d,y]=e.useState(!1),m=A.useFormContext(),O=m==null?void 0:m.control,x=m==null?void 0:m.register,l=O&&t?A.useWatch({control:O,name:t}):void 0,g=C.value??l??"",T=(F=(_=(h=m==null?void 0:m.formState)==null?void 0:h.errors)==null?void 0:_[t])==null?void 0:F.message,v=d||!!g;return e.createElement("div",{className:s("relative",f)},e.createElement("textarea",{id:C.id||t,rows:E,className:s("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",N?"pr-12":"",o),onFocus:k=>{y(!0),n&&n(k)},...m&&t?(()=>{const k=x(t),W=k.onBlur;return{...k,ref:P=>{typeof p=="function"?p(P):p&&(p.current=P),k.ref&&k.ref(P)},onBlur:P=>{y(!1),i&&i(P),W&&W(P)}}})():{ref:p,onBlur:k=>{y(!1),i&&i(k)}},...C}),a&&e.createElement("label",{htmlFor:C.id||t,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",v?"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")},a),N&&e.createElement("div",{className:s("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",w),onClick:L},e.createElement(N,null)),T&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},T))});pe.displayName="Textarea";const ge=e.forwardRef(({name:t,label:o,loadOptions:a,className:n,containerClassName:i,isClearable:N,defaultOptions:w=!1,loadingMessage:L="Carregando...",noOptionsMessage:f="Nenhuma opção encontrada",searchable:E=!1,debounceMs:C=300,onFocus:p,onBlur:d,...y},m)=>{var $,ee,K;const[O,x]=e.useState(!1),[l,g]=e.useState(!1),[T,v]=e.useState([]),[h,_]=e.useState(!1),[F,k]=e.useState(""),[W,P]=e.useState(""),[H,j]=e.useState({top:0,left:0,width:0}),M=e.useRef(null),S=e.useRef(null),c=A.useFormContext(),r=c==null?void 0:c.control,B=r&&t?A.useWatch({control:r,name:t}):void 0,D=y.value??B??"",z=(K=(ee=($=c==null?void 0:c.formState)==null?void 0:$.errors)==null?void 0:ee[t])==null?void 0:K.message,J=O||!!D,G=e.useCallback(()=>{if(M.current&&l){const b=M.current.getBoundingClientRect();j({top:b.bottom+window.scrollY+4,left:b.left+window.scrollX,width:b.width})}},[l]);e.useEffect(()=>{if(G(),l){const b=()=>G(),V=()=>G();return window.addEventListener("resize",b),window.addEventListener("scroll",V,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",V,!0)}}},[l,G]),e.useEffect(()=>{const b=setTimeout(()=>{P(F)},C);return()=>clearTimeout(b)},[F,C]),e.useEffect(()=>{(l||w&&T.length===0)&&X(E?W:void 0)},[W,l]),e.useEffect(()=>{w===!0?X():Array.isArray(w)&&v(w)},[]);const X=async b=>{try{_(!0);const V=await a(b);v(V)}catch(V){console.error("Error loading options:",V),v([])}finally{_(!1)}};e.useEffect(()=>{const b=V=>{M.current&&!M.current.contains(V.target)&&(g(!1),x(!1),k(""))};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]);const Q=()=>{l||(g(!0),x(!0),E&&S.current&&setTimeout(()=>{var b;return(b=S.current)==null?void 0:b.focus()},0))},U=b=>{x(!0),p&&p(b)},q=b=>{d&&d(b)},Z=b=>{k(b.target.value)},re=b=>{if(c&&t&&c.setValue(t,b),y.onChange){const V={target:{value:b}};y.onChange(V)}g(!1),x(!1),k("")},ae=b=>{if(b.stopPropagation(),c&&t&&c.setValue(t,""),y.onChange){const V={target:{value:""}};y.onChange(V)}g(!1),x(!1),k("")},Y=T.find(b=>b.value===D),oe=E&&l?F:(Y==null?void 0:Y.label)||"";return e.createElement("div",{className:s("relative",i),ref:M},e.createElement("div",{id:y.id||t,tabIndex:E?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":l,className:s("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",n),onClick:Q,onFocus:E?void 0:U,onBlur:E?void 0:q,ref:m},E?e.createElement("input",{ref:S,type:"text",value:oe,onChange:Z,onFocus:U,onBlur:q,placeholder:o?"":"Selecione...",className:s("w-full bg-transparent border-none outline-none text-sm",!D&&!F&&"text-gray-400")}):e.createElement("span",{className:s("block truncate",!D&&"text-gray-400")},(Y==null?void 0:Y.label)||!o&&"Selecione..."),h&&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)]"})),N&&D&&!h&&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},"✕")),o&&e.createElement("label",{htmlFor:y.id||t,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",J?"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")},o),e.createElement("div",{className:s("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(--select-dropdown-text)]",l?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:l?"9.5rem":"0",overflowY:T.length>3?"auto":"hidden",position:"fixed",top:l?H.top:"auto",left:l?H.left:"auto",width:l?H.width:"auto",zIndex:9999,boxShadow:l?"var(--select-dropdown-shadow)":"none"}},h?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},L):T.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},f):T.map(b=>e.createElement("div",{key:b.value,className:s("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",D===b.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>re(b.value)},b.label))),z&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},z))});ge.displayName="AsyncSelect";const he=e.forwardRef(({name:t,label:o,options:a,className:n,containerClassName:i,isClearable:N,onFocus:w,onBlur:L,...f},E)=>{var M,S,c;const[C,p]=e.useState(!1),[d,y]=e.useState(!1),[m,O]=e.useState({top:0,left:0,width:0}),x=e.useRef(null),l=A.useFormContext(),g=l==null?void 0:l.control,T=g&&t?A.useWatch({control:g,name:t}):void 0,v=f.value??T??[],h=(c=(S=(M=l==null?void 0:l.formState)==null?void 0:M.errors)==null?void 0:S[t])==null?void 0:c.message,_=C||v&&v.length>0,F=e.useCallback(()=>{if(x.current&&d){const r=x.current.getBoundingClientRect();O({top:r.bottom+window.scrollY+4,left:r.left+window.scrollX,width:r.width})}},[d]);e.useEffect(()=>{if(F(),d){const r=()=>F(),B=()=>F();return window.addEventListener("resize",r),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",r),window.removeEventListener("scroll",B,!0)}}},[d,F]),e.useEffect(()=>{const r=B=>{x.current&&!x.current.contains(B.target)&&(y(!1),p(!1))};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[]);const k=()=>{y(r=>!r),p(!0)},W=r=>{p(!0),w&&w(r)},P=r=>{L&&L(r)},H=r=>{var D;let B;v.includes(r)?B=v.filter(z=>z!==r):B=[...v,r],l&&t&&l.setValue(t,B),f.onChange&&((D=f.onChange)==null||D.call(f,{target:{value:B}})),p(!0)},j=r=>{var B;r.stopPropagation(),l&&t&&l.setValue(t,[]),f.onChange&&((B=f.onChange)==null||B.call(f,{target:{value:[]}})),y(!1),p(!1)};return e.createElement("div",{className:s("relative",i),ref:x},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":d,className:s("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",n),onClick:k,onFocus:W,onBlur:P,ref:E},e.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},v&&v.length>0?a.filter(r=>v.includes(r.value)).map(r=>e.createElement("span",{key:r.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:r.label},r.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 ${r.label}`,tabIndex:-1,onClick:B=>{B.stopPropagation();const D=v.filter(z=>z!==r.value);l&&t&&l.setValue(t,D),f.onChange&&f.onChange({target:{value:D}})}},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"}))))):!o&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),N&&v&&v.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:j},"✕")),o&&e.createElement("label",{htmlFor:f.id||t,className:s("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")},o),e.createElement("div",{className:s("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(--select-dropdown-text)]",d?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:d?"9.5rem":"0",overflowY:a.length>3?"auto":"hidden",position:"fixed",top:d?m.top:"auto",left:d?m.left:"auto",width:d?m.width:"auto",zIndex:9999,boxShadow:d?"var(--select-dropdown-shadow)":"none"}},a.map(r=>e.createElement("div",{key:r.value,className:s("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",v.includes(r.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>H(r.value)},e.createElement("input",{type:"checkbox",checked:v.includes(r.value),readOnly:!0,className:"accent-blue-500"}),r.label))),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});he.displayName="MultiSelect";const we=e.forwardRef(({name:t,label:o,loadOptions:a,className:n,containerClassName:i,isClearable:N,defaultOptions:w=!1,loadingMessage:L="Carregando...",noOptionsMessage:f="Nenhuma opção encontrada",searchable:E=!1,debounceMs:C=300,maxSelectedDisplay:p=3,onFocus:d,onBlur:y,...m},O)=>{var b,V,me;const[x,l]=e.useState(!1),[g,T]=e.useState(!1),[v,h]=e.useState([]),[_,F]=e.useState(!1),[k,W]=e.useState(""),[P,H]=e.useState(""),[j,M]=e.useState({top:0,left:0,width:0}),S=e.useRef(null),c=e.useRef(null),r=A.useFormContext(),B=r==null?void 0:r.control,D=B&&t?A.useWatch({control:B,name:t}):void 0,z=m.value??D??[],J=(me=(V=(b=r==null?void 0:r.formState)==null?void 0:b.errors)==null?void 0:V[t])==null?void 0:me.message,G=x||z&&z.length>0,X=e.useCallback(()=>{if(S.current&&g){const u=S.current.getBoundingClientRect();M({top:u.bottom+window.scrollY+4,left:u.left+window.scrollX,width:u.width})}},[g]);e.useEffect(()=>{if(X(),g){const u=()=>X(),I=()=>X();return window.addEventListener("resize",u),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",I,!0)}}},[g,X]),e.useEffect(()=>{const u=setTimeout(()=>{H(k)},C);return()=>clearTimeout(u)},[k,C]),e.useEffect(()=>{(g||w&&v.length===0)&&Q(E?P:void 0)},[P,g]),e.useEffect(()=>{w===!0?Q():Array.isArray(w)&&h(w)},[]);const Q=async u=>{try{F(!0);const I=await a(u);h(I)}catch(I){console.error("Error loading options:",I),h([])}finally{F(!1)}};e.useEffect(()=>{const u=I=>{S.current&&!S.current.contains(I.target)&&(T(!1),l(!1),W(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]);const U=()=>{g||(T(!0),l(!0),E&&c.current&&setTimeout(()=>{var u;return(u=c.current)==null?void 0:u.focus()},0))},q=u=>{l(!0),d&&d(u)},Z=u=>{y&&y(u)},re=u=>{W(u.target.value)},ae=u=>{let I;z.includes(u)?I=z.filter(te=>te!==u):I=[...z,u],r&&t&&r.setValue(t,I),m.onChange&&m.onChange({target:{value:I}}),l(!0)},Y=(u,I)=>{I.stopPropagation();const te=z.filter(Ce=>Ce!==u);r&&t&&r.setValue(t,te),m.onChange&&m.onChange({target:{value:te}})},oe=u=>{u.stopPropagation(),r&&t&&r.setValue(t,[]),m.onChange&&m.onChange({target:{value:[]}}),T(!1),l(!1),W("")},$=v.filter(u=>z.includes(u.value)),ee=$.slice(0,p),K=$.length-p;return e.createElement("div",{className:s("relative",i),ref:S},e.createElement("div",{id:m.id||t,tabIndex:E?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":g,className:s("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",n),onClick:U,onFocus:E?void 0:q,onBlur:E?void 0:Z,ref:O},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},ee.map(u=>e.createElement("span",{key:u.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:u.label},u.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 ${u.label}`,tabIndex:-1,onClick:I=>Y(u.value,I)},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"}))))),K>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"},"+",K," mais"),E?e.createElement("input",{ref:c,type:"text",value:k,onChange:re,onFocus:q,onBlur:Z,placeholder:z.length===0&&!o?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):z.length===0&&!o&&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)]"})),N&&z&&z.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:oe},"✕")),o&&e.createElement("label",{htmlFor:m.id||t,className:s("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",G?"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")},o),e.createElement("div",{className:s("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(--select-dropdown-text)]",g?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:g?"9.5rem":"0",overflowY:v.length>3?"auto":"hidden",position:"fixed",top:g?j.top:"auto",left:g?j.left:"auto",width:g?j.width:"auto",zIndex:9999,boxShadow:g?"var(--select-dropdown-shadow)":"none"}},_?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},L):v.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},f):v.map(u=>e.createElement("div",{key:u.value,className:s("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",z.includes(u.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>ae(u.value)},e.createElement("input",{type:"checkbox",checked:z.includes(u.value),readOnly:!0,className:"accent-blue-500"}),u.label))),J&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},J))});we.displayName="MultiAsyncSelect";const Re={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},ye=e.forwardRef(({name:t,label:o,options:a,className:n,containerClassName:i,optionClassName:N,direction:w="row",size:L="md",onFocus:f,onBlur:E,...C},p)=>{var g,T,v;const d=A.useFormContext(),y=d==null?void 0:d.control,m=y&&t?A.useWatch({control:y,name:t}):void 0,O=C.value??m??"",x=(v=(T=(g=d==null?void 0:d.formState)==null?void 0:g.errors)==null?void 0:T[t])==null?void 0:v.message,l=h=>{d&&t&&d.setValue(t,h),C.onChange&&C.onChange({target:{value:h}})};return e.createElement("div",{className:s("relative",i),ref:p},o&&e.createElement("label",{htmlFor:t,className:s("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")},o),e.createElement("div",{className:s("flex gap-2 w-full pt-6",w==="row"?"flex-row":"flex-col",n),"aria-label":o,tabIndex:-1,onFocus:f,onBlur:E},a.map(h=>e.createElement("button",{key:h.value,type:"button",className:s("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)]",Re[L],O===h.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",N),"aria-pressed":O===h.value,"data-selected":O===h.value,tabIndex:0,onClick:()=>l(h.value),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),l(h.value))}},h.icon&&e.createElement("span",{className:"mr-2 text-lg flex items-center"},h.icon),e.createElement("span",{className:"truncate font-medium"},h.label)))),x&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},x))});ye.displayName="RadioGroup";const ne=R.forwardRef(({children:t,className:o,as:a="div",...n},i)=>R.createElement(a,{ref:i,className:s("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)]",o),...n},t));ne.displayName="CardHeader";const le=R.forwardRef(({children:t,className:o,as:a="div",...n},i)=>R.createElement(a,{ref:i,className:s("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",o),...n},t));le.displayName="CardBody";const se=R.forwardRef(({children:t,className:o,as:a="div",...n},i)=>R.createElement(a,{ref:i,className:s("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)]",o),...n},t));se.displayName="CardFooter";const Fe=R.forwardRef(({children:t,className:o,variant:a="default",size:n="md",padding:i="none",rounded:N="lg",constrainWidth:w=!1,...L},f)=>{const E={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"},C={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},p={none:"",sm:"p-3",md:"p-4",lg:"p-6"},d={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return R.createElement("div",{ref:f,className:s("flex flex-col","overflow-hidden",E[a],w&&C[n],p[i],d[N],o),...L},t)}),Le=Object.assign(Fe,{Header:ne,Body:le,Footer:se}),Ee=R.forwardRef(({children:t,className:o,variant:a="default",size:n="md",responsive:i=!1,stickyHeader:N=!1,...w},L)=>{const f=s("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":a==="bordered"},{"text-sm":n==="sm","text-base":n==="md","text-lg":n==="lg"},o),E=s({"overflow-x-auto":i,"max-h-96 overflow-y-auto":N}),C=R.createElement("table",{ref:L,className:f,...w},t);return i||N?R.createElement("div",{className:E},C):C}),ce=R.forwardRef(({children:t,className:o,as:a="thead",...n},i)=>R.createElement(a,{ref:i,className:s("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":a==="thead"},o),...n},t)),ie=R.forwardRef(({children:t,className:o,as:a="tbody",...n},i)=>R.createElement(a,{ref:i,className:s("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",o),...n},t)),de=R.forwardRef(({children:t,className:o,as:a="tfoot",...n},i)=>R.createElement(a,{ref:i,className:s("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",o),...n},t)),ue=R.forwardRef(({children:t,className:o,variant:a="default",...n},i)=>R.createElement("tr",{ref:i,className:s("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":a==="hover","bg-[var(--table-row-selected)]":a==="selected"},o),...n},t)),fe=R.forwardRef(({children:t,className:o,as:a="td",align:n="left",scope:i,colSpan:N,rowSpan:w,...L},f)=>R.createElement(a,{ref:f,scope:a==="th"?i:void 0,colSpan:N,rowSpan:w,className:s("px-4 py-3 text-left",{"font-semibold":a==="th","text-sm":a==="td","text-center":n==="center","text-right":n==="right"},o),...L},t));Ee.displayName="Table";ce.displayName="TableHeader";ie.displayName="TableBody";de.displayName="TableFooter";ue.displayName="TableRow";fe.displayName="TableCell";const Te=Object.assign(Ee,{Header:ce,Body:ie,Footer:de,Row:ue,Cell:fe});exports.AsyncSelect=ge;exports.Button=ke;exports.Card=Le;exports.CardBody=le;exports.CardFooter=se;exports.CardHeader=ne;exports.Input=ve;exports.MultiAsyncSelect=we;exports.MultiSelect=he;exports.RadioGroup=ye;exports.Select=xe;exports.Table=Te;exports.TableBody=ie;exports.TableCell=fe;exports.TableFooter=de;exports.TableHeader=ce;exports.TableRow=ue;exports.Textarea=pe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Y=require("react-hook-form");function Ne(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const e=Ne(_);function be(t){var a,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var c=t.length;for(a=0;a<c;a++)t[a]&&(r=be(t[a]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Se(){for(var t,a,r=0,n="",c=arguments.length;r<c;r++)(t=arguments[r])&&(a=be(t))&&(n&&(n+=" "),n+=a);return n}function i(...t){return Se(...t)}const ke=({children:t,variant:a="default",className:r="",...n})=>{const c="px-4 py-2 rounded font-medium transition",N={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 _.createElement("button",{className:i(c,N[a],r),...n},t)},ve=e.forwardRef(({name:t,className:a,type:r="text",label:n,onFocus:c,onBlur:N,Icon:b,iconClassName:M,iconAction:O,containerClassName:E,...x},w)=>{var h,j,X;const[f,R]=e.useState(!1),[g,k]=e.useState(!1),s=Y.useFormContext(),m=s==null?void 0:s.control,v=s==null?void 0:s.register,I=m&&t?Y.useWatch({control:m,name:t}):void 0,F=x.value??I??"",y=(X=(j=(h=s==null?void 0:s.formState)==null?void 0:h.errors)==null?void 0:j[t])==null?void 0:X.message,S=f||!!F,A=r==="password"?g?"text":"password":r,u=()=>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"})),V=()=>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"})),W=()=>{k(!g)};return e.createElement("div",{className:i("relative",E)},e.createElement("input",{id:x.id||t,type:A,className:i("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",r==="password"||b?"pr-12":"",a),onFocus:B=>{R(!0),c&&c(B)},...s&&t?(()=>{const B=v(t),T=B.onBlur;return{...B,ref:C=>{typeof w=="function"?w(C):w&&(w.current=C),B.ref&&B.ref(C)},onBlur:C=>{R(!1),N&&N(C),T&&T(C)}}})():{ref:w,onBlur:B=>{R(!1),N&&N(B)}},...x}),n&&e.createElement("label",{htmlFor:x.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",S?"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),r==="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:W,"aria-label":g?"Esconder senha":"Mostrar senha",tabIndex:-1},g?e.createElement(V,null):e.createElement(u,null)),b&&r!=="password"&&e.createElement("div",{className:i("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:O},e.createElement(b,null)),y&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},y))});ve.displayName="Input";const pe=e.forwardRef(({name:t,label:a,options:r,className:n,containerClassName:c,isClearable:N,searchable:b=!1,filterPlaceholder:M="Digite para filtrar...",caseSensitive:O=!1,filterFunction:E,onFocus:x,onBlur:w,...f},R)=>{var K,Q,l,L;const[g,k]=e.useState(!1),[s,m]=e.useState(!1),[v,I]=e.useState(""),[F,y]=e.useState({top:0,left:0,width:0}),S=e.useRef(null),A=e.useRef(null),u=Y.useFormContext(),V=u==null?void 0:u.control,W=V&&t?Y.useWatch({control:V,name:t}):void 0,h=f.value??W??"",j=(l=(Q=(K=u==null?void 0:u.formState)==null?void 0:K.errors)==null?void 0:Q[t])==null?void 0:l.message,B=E||((o,P)=>{const te=O?o.label:o.label.toLowerCase(),re=O?P:P.toLowerCase();return te.includes(re)}),T=v.trim()?r.filter(o=>B(o,v.trim())):r,C=r.find(o=>o.value===h),q=b&&s?v:(C==null?void 0:C.label)||"",G=g||!!h||b&&!!v,z=e.useCallback(()=>{if(S.current&&s){const o=S.current.getBoundingClientRect();y({top:o.bottom+window.scrollY+4,left:o.left+window.scrollX,width:o.width})}},[s]);e.useEffect(()=>{if(z(),s){const o=()=>z(),P=()=>z();return window.addEventListener("resize",o),window.addEventListener("scroll",P,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",P,!0)}}},[s,z]),e.useEffect(()=>{const o=P=>{S.current&&!S.current.contains(P.target)&&(m(!1),k(!1))};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[]);const Z=()=>{m(o=>!o),k(!0)},J=o=>{k(!0),x&&x(o)},$=o=>{w&&w(o)},ee=o=>{I(o.target.value)},U=o=>{if(u&&t&&u.setValue(t,o),f.onChange){const P={target:{value:o}};f.onChange(P)}m(!1),k(!1),I("")};return e.createElement("div",{className:i("relative",c),ref:S},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":s,className:i("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",n),onClick:b?void 0:Z,onFocus:b?void 0:J,onBlur:b?void 0:$,ref:R},b?e.createElement("input",{ref:A,type:"text",value:q,onChange:ee,onFocus:b?o=>{k(!0),m(!0),x&&x(o)}:void 0,onBlur:b?o=>{w&&w(o)}:void 0,placeholder:a?"":M||"Selecione...",className:i("w-full bg-transparent border-none outline-none text-sm",!h&&!v&&"text-gray-400")}):e.createElement("span",{className:i("block truncate",!h&&"text-gray-400")},((L=r.find(o=>o.value===h))==null?void 0:L.label)||!a&&"Selecione..."),N&&h&&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:o=>{if(o.stopPropagation(),u&&t&&u.setValue(t,""),f.onChange){const P={target:{value:""}};f.onChange(P)}m(!1),k(!1)}},"✕")),a&&e.createElement("label",{htmlFor:f.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",G?"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")},a),e.createElement("div",{className:i("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(--select-dropdown-text)]",s?"border 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",position:"fixed",top:s?F.top:"auto",left:s?F.left:"auto",width:s?F.width:"auto",zIndex:9999,boxShadow:s?"var(--select-dropdown-shadow)":"none"}},T.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):T.map(o=>e.createElement("div",{key:o.value,className:i("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",h===o.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>U(o.value)},o.label))),j&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},j))});pe.displayName="Select";const xe=e.forwardRef(({name:t,className:a,label:r,onFocus:n,onBlur:c,Icon:N,iconClassName:b,iconAction:M,containerClassName:O,rows:E=4,...x},w)=>{var y,S,A;const[f,R]=e.useState(!1),g=Y.useFormContext(),k=g==null?void 0:g.control,s=g==null?void 0:g.register,m=k&&t?Y.useWatch({control:k,name:t}):void 0,v=x.value??m??"",I=(A=(S=(y=g==null?void 0:g.formState)==null?void 0:y.errors)==null?void 0:S[t])==null?void 0:A.message,F=f||!!v;return e.createElement("div",{className:i("relative",O)},e.createElement("textarea",{id:x.id||t,rows:E,className:i("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",N?"pr-12":"",a),onFocus:u=>{R(!0),n&&n(u)},...g&&t?(()=>{const u=s(t),V=u.onBlur;return{...u,ref:W=>{typeof w=="function"?w(W):w&&(w.current=W),u.ref&&u.ref(W)},onBlur:W=>{R(!1),c&&c(W),V&&V(W)}}})():{ref:w,onBlur:u=>{R(!1),c&&c(u)}},...x}),r&&e.createElement("label",{htmlFor:x.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",F?"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),N&&e.createElement("div",{className:i("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",b),onClick:M},e.createElement(N,null)),I&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},I))});xe.displayName="Textarea";const ge=e.forwardRef(({name:t,label:a,loadOptions:r,className:n,containerClassName:c,isClearable:N,defaultOptions:b=!1,loadingMessage:M="Carregando...",noOptionsMessage:O="Nenhuma opção encontrada",searchable:E=!1,debounceMs:x=300,onFocus:w,onBlur:f,...R},g)=>{var te,re,ae;const[k,s]=e.useState(!1),[m,v]=e.useState(!1),[I,F]=e.useState([]),[y,S]=e.useState(!1),[A,u]=e.useState(""),[V,W]=e.useState(""),[h,j]=e.useState({top:0,left:0,width:0}),X=e.useRef(null),B=e.useRef(null),T=Y.useFormContext(),C=T==null?void 0:T.control,q=C&&t?Y.useWatch({control:C,name:t}):void 0,G=R.value??q??"",z=(ae=(re=(te=T==null?void 0:T.formState)==null?void 0:te.errors)==null?void 0:re[t])==null?void 0:ae.message,Z=k||!!G,J=e.useCallback(()=>{if(X.current&&m){const p=X.current.getBoundingClientRect();j({top:p.bottom+window.scrollY+4,left:p.left+window.scrollX,width:p.width})}},[m]);e.useEffect(()=>{if(J(),m){const p=()=>J(),H=()=>J();return window.addEventListener("resize",p),window.addEventListener("scroll",H,!0),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",H,!0)}}},[m,J]),e.useEffect(()=>{const p=setTimeout(()=>{W(A)},x);return()=>clearTimeout(p)},[A,x]),e.useEffect(()=>{(m||b&&I.length===0)&&$(E?V:void 0)},[V,m]),e.useEffect(()=>{b===!0?$():Array.isArray(b)&&F(b)},[]);const $=async p=>{try{S(!0);const H=await r(p);F(H)}catch(H){console.error("Error loading options:",H),F([])}finally{S(!1)}};e.useEffect(()=>{const p=H=>{X.current&&!X.current.contains(H.target)&&(v(!1),s(!1),u(""))};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[]);const ee=()=>{m||(v(!0),s(!0),E&&B.current&&setTimeout(()=>{var p;return(p=B.current)==null?void 0:p.focus()},0))},U=p=>{s(!0),w&&w(p)},K=p=>{f&&f(p)},Q=p=>{u(p.target.value)},l=p=>{if(T&&t&&T.setValue(t,p),R.onChange){const H={target:{value:p}};R.onChange(H)}v(!1),s(!1),u("")},L=p=>{if(p.stopPropagation(),T&&t&&T.setValue(t,""),R.onChange){const H={target:{value:""}};R.onChange(H)}v(!1),s(!1),u("")},o=I.find(p=>p.value===G),P=E&&m?A:(o==null?void 0:o.label)||"";return e.createElement("div",{className:i("relative",c),ref:X},e.createElement("div",{id:R.id||t,tabIndex:E?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":m,className:i("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",n),onClick:ee,onFocus:E?void 0:U,onBlur:E?void 0:K,ref:g},E?e.createElement("input",{ref:B,type:"text",value:P,onChange:Q,onFocus:U,onBlur:K,placeholder:a?"":"Selecione...",className:i("w-full bg-transparent border-none outline-none text-sm",!G&&!A&&"text-gray-400")}):e.createElement("span",{className:i("block truncate",!G&&"text-gray-400")},(o==null?void 0:o.label)||!a&&"Selecione..."),y&&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)]"})),N&&G&&!y&&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:L},"✕")),a&&e.createElement("label",{htmlFor:R.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",Z?"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")},a),e.createElement("div",{className:i("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(--select-dropdown-text)]",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:I.length>3?"auto":"hidden",position:"fixed",top:m?h.top:"auto",left:m?h.left:"auto",width:m?h.width:"auto",zIndex:9999,boxShadow:m?"var(--select-dropdown-shadow)":"none"}},y?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):I.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},O):I.map(p=>e.createElement("div",{key:p.value,className:i("px-3 py-2 cursor-pointer text-sm transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",G===p.value&&"bg-[var(--select-dropdown-selected)]"),onMouseDown:()=>l(p.value)},p.label))),z&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},z))});ge.displayName="AsyncSelect";const he=e.forwardRef(({name:t,label:a,options:r,className:n,containerClassName:c,isClearable:N,searchable:b=!1,filterPlaceholder:M="Digite para filtrar...",caseSensitive:O=!1,filterFunction:E,onFocus:x,onBlur:w,...f},R)=>{var U,K,Q;const[g,k]=e.useState(!1),[s,m]=e.useState(!1),[v,I]=e.useState(""),[F,y]=e.useState({top:0,left:0,width:0}),S=e.useRef(null),A=e.useRef(null),u=Y.useFormContext(),V=u==null?void 0:u.control,W=V&&t?Y.useWatch({control:V,name:t}):void 0,h=f.value??W??[],j=(Q=(K=(U=u==null?void 0:u.formState)==null?void 0:U.errors)==null?void 0:K[t])==null?void 0:Q.message,B=E||((l,L)=>{const o=O?l.label:l.label.toLowerCase(),P=O?L:L.toLowerCase();return o.includes(P)}),T=v.trim()?r.filter(l=>B(l,v.trim())):r,C=g||h&&h.length>0||b&&!!v,q=e.useCallback(()=>{if(S.current&&s){const l=S.current.getBoundingClientRect();y({top:l.bottom+window.scrollY+4,left:l.left+window.scrollX,width:l.width})}},[s]);e.useEffect(()=>{if(q(),s){const l=()=>q(),L=()=>q();return window.addEventListener("resize",l),window.addEventListener("scroll",L,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",L,!0)}}},[s,q]),e.useEffect(()=>{const l=L=>{S.current&&!S.current.contains(L.target)&&(m(!1),k(!1))};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]);const G=()=>{m(l=>!l),k(!0)},z=l=>{k(!0),x&&x(l)},Z=l=>{w&&w(l)},J=l=>{var o;let L;h.includes(l)?L=h.filter(P=>P!==l):L=[...h,l],u&&t&&u.setValue(t,L),f.onChange&&((o=f.onChange)==null||o.call(f,{target:{value:L}})),k(!0)},$=l=>{var L;l.stopPropagation(),u&&t&&u.setValue(t,[]),f.onChange&&((L=f.onChange)==null||L.call(f,{target:{value:[]}})),m(!1),k(!1)},ee=l=>{I(l.target.value)};return e.createElement("div",{className:i("relative",c),ref:S},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":s,className:i("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",n),onClick:b?void 0:G,onFocus:b?void 0:z,onBlur:b?void 0:Z,ref:R},e.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},h&&h.length>0?r.filter(l=>h.includes(l.value)).map(l=>e.createElement("span",{key:l.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:l.label},l.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 ${l.label}`,tabIndex:-1,onClick:L=>{L.stopPropagation();const o=h.filter(P=>P!==l.value);u&&t&&u.setValue(t,o),f.onChange&&f.onChange({target:{value:o}})}},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"}))))):!a&&!b&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione..."),b&&e.createElement("input",{ref:A,type:"text",value:v,onChange:ee,onFocus:l=>{k(!0),m(!0),x&&x(l)},onBlur:l=>{w&&w(l)},placeholder:a?h&&h.length>0?"":M:M||"Selecione...",className:"flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"})),N&&h&&h.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:$},"✕")),a&&e.createElement("label",{htmlFor:f.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",C?"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")},a),e.createElement("div",{className:i("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(--select-dropdown-text)]",s?"border 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",position:"fixed",top:s?F.top:"auto",left:s?F.left:"auto",width:s?F.width:"auto",zIndex:9999,boxShadow:s?"var(--select-dropdown-shadow)":"none"}},T.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},"Nenhuma opção encontrada"):T.map(l=>e.createElement("div",{key:l.value,className:i("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",h.includes(l.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>J(l.value)},e.createElement("input",{type:"checkbox",checked:h.includes(l.value),readOnly:!0,className:"accent-blue-500"}),l.label))),j&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},j))});he.displayName="MultiSelect";const we=e.forwardRef(({name:t,label:a,loadOptions:r,className:n,containerClassName:c,isClearable:N,defaultOptions:b=!1,loadingMessage:M="Carregando...",noOptionsMessage:O="Nenhuma opção encontrada",searchable:E=!1,debounceMs:x=300,maxSelectedDisplay:w=3,onFocus:f,onBlur:R,...g},k)=>{var p,H,me;const[s,m]=e.useState(!1),[v,I]=e.useState(!1),[F,y]=e.useState([]),[S,A]=e.useState(!1),[u,V]=e.useState(""),[W,h]=e.useState(""),[j,X]=e.useState({top:0,left:0,width:0}),B=e.useRef(null),T=e.useRef(null),C=Y.useFormContext(),q=C==null?void 0:C.control,G=q&&t?Y.useWatch({control:q,name:t}):void 0,z=g.value??G??[],Z=(me=(H=(p=C==null?void 0:C.formState)==null?void 0:p.errors)==null?void 0:H[t])==null?void 0:me.message,J=s||z&&z.length>0,$=e.useCallback(()=>{if(B.current&&v){const d=B.current.getBoundingClientRect();X({top:d.bottom+window.scrollY+4,left:d.left+window.scrollX,width:d.width})}},[v]);e.useEffect(()=>{if($(),v){const d=()=>$(),D=()=>$();return window.addEventListener("resize",d),window.addEventListener("scroll",D,!0),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",D,!0)}}},[v,$]),e.useEffect(()=>{const d=setTimeout(()=>{h(u)},x);return()=>clearTimeout(d)},[u,x]),e.useEffect(()=>{(v||b&&F.length===0)&&ee(E?W:void 0)},[W,v]),e.useEffect(()=>{b===!0?ee():Array.isArray(b)&&y(b)},[]);const ee=async d=>{try{A(!0);const D=await r(d);y(D)}catch(D){console.error("Error loading options:",D),y([])}finally{A(!1)}};e.useEffect(()=>{const d=D=>{B.current&&!B.current.contains(D.target)&&(I(!1),m(!1),V(""))};return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[]);const U=()=>{v||(I(!0),m(!0),E&&T.current&&setTimeout(()=>{var d;return(d=T.current)==null?void 0:d.focus()},0))},K=d=>{m(!0),f&&f(d)},Q=d=>{R&&R(d)},l=d=>{V(d.target.value)},L=d=>{let D;z.includes(d)?D=z.filter(ne=>ne!==d):D=[...z,d],C&&t&&C.setValue(t,D),g.onChange&&g.onChange({target:{value:D}}),m(!0)},o=(d,D)=>{D.stopPropagation();const ne=z.filter(Ce=>Ce!==d);C&&t&&C.setValue(t,ne),g.onChange&&g.onChange({target:{value:ne}})},P=d=>{d.stopPropagation(),C&&t&&C.setValue(t,[]),g.onChange&&g.onChange({target:{value:[]}}),I(!1),m(!1),V("")},te=F.filter(d=>z.includes(d.value)),re=te.slice(0,w),ae=te.length-w;return e.createElement("div",{className:i("relative",c),ref:B},e.createElement("div",{id:g.id||t,tabIndex:E?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":v,className:i("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",n),onClick:U,onFocus:E?void 0:K,onBlur:E?void 0:Q,ref:k},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},re.map(d=>e.createElement("span",{key:d.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:d.label},d.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 ${d.label}`,tabIndex:-1,onClick:D=>o(d.value,D)},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"}))))),ae>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"},"+",ae," mais"),E?e.createElement("input",{ref:T,type:"text",value:u,onChange:l,onFocus:K,onBlur:Q,placeholder:z.length===0&&!a?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):z.length===0&&!a&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),S&&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)]"})),N&&z&&z.length>0&&!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:P},"✕")),a&&e.createElement("label",{htmlFor:g.id||t,className:i("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",J?"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")},a),e.createElement("div",{className:i("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(--select-dropdown-text)]",v?"border max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:v?"9.5rem":"0",overflowY:F.length>3?"auto":"hidden",position:"fixed",top:v?j.top:"auto",left:v?j.left:"auto",width:v?j.width:"auto",zIndex:9999,boxShadow:v?"var(--select-dropdown-shadow)":"none"}},S?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},M):F.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},O):F.map(d=>e.createElement("div",{key:d.value,className:i("px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150","hover:bg-[var(--select-dropdown-hover)]",z.includes(d.value)&&"bg-[var(--select-dropdown-selected)] font-semibold"),onMouseDown:()=>L(d.value)},e.createElement("input",{type:"checkbox",checked:z.includes(d.value),readOnly:!0,className:"accent-blue-500"}),d.label))),Z&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},Z))});we.displayName="MultiAsyncSelect";const Re={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},ye=e.forwardRef(({name:t,label:a,options:r,className:n,containerClassName:c,optionClassName:N,direction:b="row",size:M="md",onFocus:O,onBlur:E,...x},w)=>{var v,I,F;const f=Y.useFormContext(),R=f==null?void 0:f.control,g=R&&t?Y.useWatch({control:R,name:t}):void 0,k=x.value??g??"",s=(F=(I=(v=f==null?void 0:f.formState)==null?void 0:v.errors)==null?void 0:I[t])==null?void 0:F.message,m=y=>{f&&t&&f.setValue(t,y),x.onChange&&x.onChange({target:{value:y}})};return e.createElement("div",{className:i("relative",c),ref:w},a&&e.createElement("label",{htmlFor:t,className:i("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")},a),e.createElement("div",{className:i("flex gap-2 w-full pt-6",b==="row"?"flex-row":"flex-col",n),"aria-label":a,tabIndex:-1,onFocus:O,onBlur:E},r.map(y=>e.createElement("button",{key:y.value,type:"button",className:i("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)]",Re[M],k===y.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",N),"aria-pressed":k===y.value,"data-selected":k===y.value,tabIndex:0,onClick:()=>m(y.value),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),m(y.value))}},y.icon&&e.createElement("span",{className:"mr-2 text-lg flex items-center"},y.icon),e.createElement("span",{className:"truncate font-medium"},y.label)))),s&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},s))});ye.displayName="RadioGroup";const oe=_.forwardRef(({children:t,className:a,as:r="div",...n},c)=>_.createElement(r,{ref:c,className:i("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)]",a),...n},t));oe.displayName="CardHeader";const le=_.forwardRef(({children:t,className:a,as:r="div",...n},c)=>_.createElement(r,{ref:c,className:i("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",a),...n},t));le.displayName="CardBody";const se=_.forwardRef(({children:t,className:a,as:r="div",...n},c)=>_.createElement(r,{ref:c,className:i("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)]",a),...n},t));se.displayName="CardFooter";const Fe=_.forwardRef(({children:t,className:a,variant:r="default",size:n="md",padding:c="none",rounded:N="lg",constrainWidth:b=!1,...M},O)=>{const E={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"},x={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},w={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 _.createElement("div",{ref:O,className:i("flex flex-col","overflow-hidden",E[r],b&&x[n],w[c],f[N],a),...M},t)}),Le=Object.assign(Fe,{Header:oe,Body:le,Footer:se}),Ee=_.forwardRef(({children:t,className:a,variant:r="default",size:n="md",responsive:c=!1,stickyHeader:N=!1,...b},M)=>{const O=i("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":r==="bordered"},{"text-sm":n==="sm","text-base":n==="md","text-lg":n==="lg"},a),E=i({"overflow-x-auto":c,"max-h-96 overflow-y-auto":N}),x=_.createElement("table",{ref:M,className:O,...b},t);return c||N?_.createElement("div",{className:E},x):x}),ie=_.forwardRef(({children:t,className:a,as:r="thead",...n},c)=>_.createElement(r,{ref:c,className:i("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":r==="thead"},a),...n},t)),ce=_.forwardRef(({children:t,className:a,as:r="tbody",...n},c)=>_.createElement(r,{ref:c,className:i("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",a),...n},t)),de=_.forwardRef(({children:t,className:a,as:r="tfoot",...n},c)=>_.createElement(r,{ref:c,className:i("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",a),...n},t)),ue=_.forwardRef(({children:t,className:a,variant:r="default",...n},c)=>_.createElement("tr",{ref:c,className:i("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":r==="hover","bg-[var(--table-row-selected)]":r==="selected"},a),...n},t)),fe=_.forwardRef(({children:t,className:a,as:r="td",align:n="left",scope:c,colSpan:N,rowSpan:b,...M},O)=>_.createElement(r,{ref:O,scope:r==="th"?c:void 0,colSpan:N,rowSpan:b,className:i("px-4 py-3 text-left",{"font-semibold":r==="th","text-sm":r==="td","text-center":n==="center","text-right":n==="right"},a),...M},t));Ee.displayName="Table";ie.displayName="TableHeader";ce.displayName="TableBody";de.displayName="TableFooter";ue.displayName="TableRow";fe.displayName="TableCell";const Te=Object.assign(Ee,{Header:ie,Body:ce,Footer:de,Row:ue,Cell:fe});exports.AsyncSelect=ge;exports.Button=ke;exports.Card=Le;exports.CardBody=le;exports.CardFooter=se;exports.CardHeader=oe;exports.Input=ve;exports.MultiAsyncSelect=we;exports.MultiSelect=he;exports.RadioGroup=ye;exports.Select=pe;exports.Table=Te;exports.TableBody=ce;exports.TableCell=fe;exports.TableFooter=de;exports.TableHeader=ie;exports.TableRow=ue;exports.Textarea=xe;
|