rharuow-ds 1.0.18 → 1.1.2

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 CHANGED
@@ -1,6 +1,13 @@
1
- # rharuow-ds
1
+ # rharuo## 🌟 Características
2
2
 
3
- [![NPM Version](https://img.shields.io/npm/v/rharuow-ds)](https://www.npmjs.com/package/rharuow-ds)
3
+ - ⚛️ **React 18+** com TypeScript
4
+ - 🧩 **9 componentes** prontos para uso (Input, Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, RadioGroup, Button, Card)
5
+ - 🔗 **Integração nativa** com React Hook Form
6
+ - 🎨 **Customização via CSS Variables** - Mude o tema facilmente
7
+ - 🎯 **Componentes acessíveis** (ARIA)
8
+ - 📱 **Responsivo** por padrão
9
+ - 🎭 **Animações suaves** e modernas
10
+ - 📚 **Documentação interativa** com StorybookNPM Version](https://img.shields.io/npm/v/rharuow-ds)](https://www.npmjs.com/package/rharuow-ds)
4
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
12
  [![Build Status](https://github.com/Rharuow/rharuow-ds-docs/workflows/CI/badge.svg)](https://github.com/Rharuow/rharuow-ds-docs/actions)
6
13
 
@@ -63,6 +70,7 @@ npm install react-hook-form
63
70
 
64
71
  ```tsx
65
72
  import {
73
+ Card,
66
74
  Button,
67
75
  Input,
68
76
  Textarea,
@@ -75,6 +83,21 @@ npm install react-hook-form
75
83
  function App() {
76
84
  return (
77
85
  <div>
86
+ {/* Exemplo básico do Card */}
87
+ <Card variant="default">
88
+ <Card.Header>
89
+ <h3>Título do Card</h3>
90
+ <p>Subtítulo ou descrição</p>
91
+ </Card.Header>
92
+ <Card.Body>
93
+ <p>Conteúdo principal do card</p>
94
+ </Card.Body>
95
+ <Card.Footer>
96
+ <Button>Ação Principal</Button>
97
+ </Card.Footer>
98
+ </Card>
99
+
100
+ {/* Outros componentes */}
78
101
  <Input label="E-mail" name="email" type="email" />
79
102
  <Input label="Senha" name="password" type="password" />
80
103
  <Textarea label="Comentários" name="comments" rows={4} />
@@ -106,12 +129,14 @@ npm install react-hook-form
106
129
  ```tsx
107
130
  import { useForm, FormProvider } from "react-hook-form";
108
131
  import {
132
+ Card,
109
133
  Input,
110
134
  Textarea,
111
135
  Select,
112
136
  AsyncSelect,
113
137
  MultiAsyncSelect,
114
138
  RadioGroup,
139
+ Button,
115
140
  } from "rharuow-ds";
116
141
 
117
142
  function FormExample() {
@@ -134,43 +159,57 @@ npm install react-hook-form
134
159
  };
135
160
 
136
161
  return (
137
- <FormProvider {...methods}>
138
- <form onSubmit={methods.handleSubmit(console.log)}>
139
- <Input label="Nome" name="name" />
140
- <Input label="E-mail" name="email" type="email" />
141
- <Input label="Senha" name="password" type="password" />
142
- <Textarea label="Observações" name="notes" rows={3} />
143
-
144
- <AsyncSelect
145
- label="País"
146
- name="country"
147
- loadOptions={loadCountries}
148
- searchable
149
- isClearable
150
- />
151
-
152
- <MultiAsyncSelect
153
- label="Países favoritos"
154
- name="favoriteCountries"
155
- loadOptions={loadCountries}
156
- searchable
157
- isClearable
158
- maxVisibleItems={2}
159
- />
160
-
161
- <RadioGroup
162
- label="Tamanho"
163
- name="size"
164
- options={[
165
- { label: "Pequeno", value: "sm" },
166
- { label: "Médio", value: "md" },
167
- { label: "Grande", value: "lg" },
168
- ]}
169
- />
170
-
171
- <Button type="submit">Enviar</Button>
172
- </form>
173
- </FormProvider>
162
+ <Card variant="default" size="lg">
163
+ <Card.Header>
164
+ <h2>Formulário de Cadastro</h2>
165
+ <p>Preencha os dados abaixo</p>
166
+ </Card.Header>
167
+
168
+ <Card.Body>
169
+ <FormProvider {...methods}>
170
+ <form onSubmit={methods.handleSubmit(console.log)}>
171
+ <Input label="Nome" name="name" />
172
+ <Input label="E-mail" name="email" type="email" />
173
+ <Input label="Senha" name="password" type="password" />
174
+ <Textarea label="Observações" name="notes" rows={3} />
175
+
176
+ <AsyncSelect
177
+ label="País"
178
+ name="country"
179
+ loadOptions={loadCountries}
180
+ searchable
181
+ isClearable
182
+ />
183
+
184
+ <MultiAsyncSelect
185
+ label="Países favoritos"
186
+ name="favoriteCountries"
187
+ loadOptions={loadCountries}
188
+ searchable
189
+ isClearable
190
+ maxVisibleItems={2}
191
+ />
192
+
193
+ <RadioGroup
194
+ label="Tamanho"
195
+ name="size"
196
+ options={[
197
+ { label: "Pequeno", value: "sm" },
198
+ { label: "Médio", value: "md" },
199
+ { label: "Grande", value: "lg" },
200
+ ]}
201
+ />
202
+ </form>
203
+ </FormProvider>
204
+ </Card.Body>
205
+
206
+ <Card.Footer>
207
+ <div className="flex space-x-2">
208
+ <Button variant="outline">Cancelar</Button>
209
+ <Button type="submit">Enviar</Button>
210
+ </div>
211
+ </Card.Footer>
212
+ </Card>
174
213
  );
175
214
  }
176
215
  ```
@@ -179,7 +218,19 @@ npm install react-hook-form
179
218
 
180
219
  ## Componentes Disponíveis
181
220
 
182
- ### 🎯 **Button**
221
+ ### **Card**
222
+
223
+ Componente flexível para exibir conteúdo organizado em seções:
224
+
225
+ - ✅ **Estrutura modular**: Header, Body e Footer independentes
226
+ - ✅ **Múltiplas variantes**: default, outlined, elevated, flat
227
+ - ✅ **Tamanhos configuráveis**: sm, md, lg
228
+ - ✅ **Suporte ao tema dark**: Variáveis CSS para light/dark mode
229
+ - ✅ **Elementos semânticos**: Props `as` para acessibilidade (header, main, footer)
230
+ - ✅ **Flexibilidade total**: Use apenas as seções necessárias
231
+ - ✅ **Customização completa**: Padding, bordas arredondadas e estilos
232
+
233
+ ### �🎯 **Button**
183
234
 
184
235
  Botão customizável com diferentes variantes e tamanhos.
185
236
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("react"),B=require("react-hook-form");function me(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const d=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,d.get?d:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const e=me(ae);function re(t){var r,n,d="";if(typeof t=="string"||typeof t=="number")d+=t;else if(typeof t=="object")if(Array.isArray(t)){var N=t.length;for(r=0;r<N;r++)t[r]&&(n=re(t[r]))&&(d&&(d+=" "),d+=n)}else for(n in t)t[n]&&(d&&(d+=" "),d+=n);return d}function fe(){for(var t,r,n=0,d="",N=arguments.length;n<N;n++)(t=arguments[n])&&(r=re(t))&&(d&&(d+=" "),d+=r);return d}function u(...t){return fe(...t)}const ve=({children:t,variant:r="default",className:n="",...d})=>{const N="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 ae.createElement("button",{className:u(N,F[r],n),...d},t)},ne=e.forwardRef(({name:t,className:r,type:n="text",label:d,onFocus:N,onBlur:F,Icon:C,iconClassName:T,iconAction:f,containerClassName:w,...k},v)=>{var V,m,a;const[p,g]=e.useState(!1),[o,c]=e.useState(!1),h=B.useFormContext(),y=h==null?void 0:h.control,l=h==null?void 0:h.register,S=y&&t?B.useWatch({control:y,name:t}):void 0,R=k.value??S??"",x=(a=(m=(V=h==null?void 0:h.formState)==null?void 0:V.errors)==null?void 0:m[t])==null?void 0:a.message,z=p||!!R,O=n==="password"?o?"text":"password":n,E=()=>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"})),L=()=>{c(!o)};return e.createElement("div",{className:u("relative",w)},e.createElement("input",{id:k.id||t,type:O,className:u("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"||C?"pr-12":"",r),onFocus:i=>{g(!0),N&&N(i)},...h&&t?(()=>{const i=l(t),P=i.onBlur;return{...i,ref:M=>{typeof v=="function"?v(M):v&&(v.current=M),i.ref&&i.ref(M)},onBlur:M=>{g(!1),F&&F(M),P&&P(M)}}})():{ref:v,onBlur:i=>{g(!1),F&&F(i)}},...k}),d&&e.createElement("label",{htmlFor:k.id||t,className:u("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")},d),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:L,"aria-label":o?"Esconder senha":"Mostrar senha",tabIndex:-1},o?e.createElement(W,null):e.createElement(E,null)),C&&n!=="password"&&e.createElement("div",{className:u("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",T),onClick:f},e.createElement(C,null)),x&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},x))});ne.displayName="Input";const le=e.forwardRef(({name:t,label:r,options:n,className:d,containerClassName:N,isClearable:F,onFocus:C,onBlur:T,...f},w)=>{var E,W,L,V;const[k,v]=e.useState(!1),[p,g]=e.useState(!1),o=e.useRef(null),c=B.useFormContext(),h=c==null?void 0:c.control,y=h&&t?B.useWatch({control:h,name:t}):void 0,l=f.value??y??"",S=(L=(W=(E=c==null?void 0:c.formState)==null?void 0:E.errors)==null?void 0:W[t])==null?void 0:L.message,R=k||!!l;e.useEffect(()=>{const m=a=>{o.current&&!o.current.contains(a.target)&&(g(!1),v(!1))};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]);const x=()=>{g(m=>!m),v(!0)},z=m=>{v(!0),C&&C(m)},O=m=>{T&&T(m)};return e.createElement("div",{className:u("relative",N),ref:o},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":p,className:u("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",d),onClick:x,onFocus:z,onBlur:O,ref:w},e.createElement("span",{className:u("block truncate",!l&&"text-gray-400")},((V=n.find(m=>m.value===l))==null?void 0:V.label)||!r&&"Selecione..."),F&&l&&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:m=>{if(m.stopPropagation(),c&&t&&c.setValue(t,""),f.onChange){const a={target:{value:""}};f.onChange(a)}g(!1),v(!1)}},"✕")),r&&e.createElement("label",{htmlFor:f.id||t,className:u("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:u("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",p?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:p?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(m=>e.createElement("div",{key:m.value,className:u("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",l===m.value&&"bg-blue-100"),onMouseDown:()=>{if(c&&t&&c.setValue(t,m.value),f.onChange){const a={target:{value:m.value}};f.onChange(a)}v(!0)}},m.label))),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});le.displayName="Select";const oe=e.forwardRef(({name:t,className:r,label:n,onFocus:d,onBlur:N,Icon:F,iconClassName:C,iconAction:T,containerClassName:f,rows:w=4,...k},v)=>{var x,z,O;const[p,g]=e.useState(!1),o=B.useFormContext(),c=o==null?void 0:o.control,h=o==null?void 0:o.register,y=c&&t?B.useWatch({control:c,name:t}):void 0,l=k.value??y??"",S=(O=(z=(x=o==null?void 0:o.formState)==null?void 0:x.errors)==null?void 0:z[t])==null?void 0:O.message,R=p||!!l;return e.createElement("div",{className:u("relative",f)},e.createElement("textarea",{id:k.id||t,rows:w,className:u("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:E=>{g(!0),d&&d(E)},...o&&t?(()=>{const E=h(t),W=E.onBlur;return{...E,ref:L=>{typeof v=="function"?v(L):v&&(v.current=L),E.ref&&E.ref(L)},onBlur:L=>{g(!1),N&&N(L),W&&W(L)}}})():{ref:v,onBlur:E=>{g(!1),N&&N(E)}},...k}),n&&e.createElement("label",{htmlFor:k.id||t,className:u("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:u("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",C),onClick:T},e.createElement(F,null)),S&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},S))});oe.displayName="Textarea";const se=e.forwardRef(({name:t,label:r,loadOptions:n,className:d,containerClassName:N,isClearable:F,defaultOptions:C=!1,loadingMessage:T="Carregando...",noOptionsMessage:f="Nenhuma opção encontrada",searchable:w=!1,debounceMs:k=300,onFocus:v,onBlur:p,...g},o)=>{var Y,Q,G;const[c,h]=e.useState(!1),[y,l]=e.useState(!1),[S,R]=e.useState([]),[x,z]=e.useState(!1),[O,E]=e.useState(""),[W,L]=e.useState(""),V=e.useRef(null),m=e.useRef(null),a=B.useFormContext(),i=a==null?void 0:a.control,P=i&&t?B.useWatch({control:i,name:t}):void 0,M=g.value??P??"",I=(G=(Q=(Y=a==null?void 0:a.formState)==null?void 0:Y.errors)==null?void 0:Q[t])==null?void 0:G.message,_=c||!!M;e.useEffect(()=>{const b=setTimeout(()=>{L(O)},k);return()=>clearTimeout(b)},[O,k]),e.useEffect(()=>{(y||C&&S.length===0)&&q(w?W:void 0)},[W,y]),e.useEffect(()=>{C===!0?q():Array.isArray(C)&&R(C)},[]);const q=async b=>{try{z(!0);const j=await n(b);R(j)}catch(j){console.error("Error loading options:",j),R([])}finally{z(!1)}};e.useEffect(()=>{const b=j=>{V.current&&!V.current.contains(j.target)&&(l(!1),h(!1),E(""))};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[]);const $=()=>{y||(l(!0),h(!0),w&&m.current&&setTimeout(()=>{var b;return(b=m.current)==null?void 0:b.focus()},0))},K=b=>{h(!0),v&&v(b)},H=b=>{p&&p(b)},J=b=>{E(b.target.value)},X=b=>{if(a&&t&&a.setValue(t,b),g.onChange){const j={target:{value:b}};g.onChange(j)}l(!1),h(!1),E("")},Z=b=>{if(b.stopPropagation(),a&&t&&a.setValue(t,""),g.onChange){const j={target:{value:""}};g.onChange(j)}l(!1),h(!1),E("")},D=S.find(b=>b.value===M),ee=w&&y?O:(D==null?void 0:D.label)||"";return e.createElement("div",{className:u("relative",N),ref:V},e.createElement("div",{id:g.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":y,className:u("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",d),onClick:$,onFocus:w?void 0:K,onBlur:w?void 0:H,ref:o},w?e.createElement("input",{ref:m,type:"text",value:ee,onChange:J,onFocus:K,onBlur:H,placeholder:r?"":"Selecione...",className:u("w-full bg-transparent border-none outline-none text-sm",!M&&!O&&"text-gray-400")}):e.createElement("span",{className:u("block truncate",!M&&"text-gray-400")},(D==null?void 0:D.label)||!r&&"Selecione..."),x&&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&&M&&!x&&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:Z},"✕")),r&&e.createElement("label",{htmlFor:g.id||t,className:u("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:u("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",y?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:y?"9.5rem":"0",overflowY:S.length>3?"auto":"hidden"}},x?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):S.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},f):S.map(b=>e.createElement("div",{key:b.value,className:u("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",M===b.value&&"bg-blue-100"),onMouseDown:()=>X(b.value)},b.label))),I&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},I))});se.displayName="AsyncSelect";const ce=e.forwardRef(({name:t,label:r,options:n,className:d,containerClassName:N,isClearable:F,onFocus:C,onBlur:T,...f},w)=>{var L,V,m;const[k,v]=e.useState(!1),[p,g]=e.useState(!1),o=e.useRef(null),c=B.useFormContext(),h=c==null?void 0:c.control,y=h&&t?B.useWatch({control:h,name:t}):void 0,l=f.value??y??[],S=(m=(V=(L=c==null?void 0:c.formState)==null?void 0:L.errors)==null?void 0:V[t])==null?void 0:m.message,R=k||l&&l.length>0;e.useEffect(()=>{const a=i=>{o.current&&!o.current.contains(i.target)&&(g(!1),v(!1))};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[]);const x=()=>{g(a=>!a),v(!0)},z=a=>{v(!0),C&&C(a)},O=a=>{T&&T(a)},E=a=>{var P;let i;l.includes(a)?i=l.filter(M=>M!==a):i=[...l,a],c&&t&&c.setValue(t,i),f.onChange&&((P=f.onChange)==null||P.call(f,{target:{value:i}})),v(!0)},W=a=>{var i;a.stopPropagation(),c&&t&&c.setValue(t,[]),f.onChange&&((i=f.onChange)==null||i.call(f,{target:{value:[]}})),g(!1),v(!1)};return e.createElement("div",{className:u("relative",N),ref:o},e.createElement("div",{id:f.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":p,className:u("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",d),onClick:x,onFocus:z,onBlur:O,ref:w},e.createElement("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"}},l&&l.length>0?n.filter(a=>l.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:i=>{i.stopPropagation();const P=l.filter(M=>M!==a.value);c&&t&&c.setValue(t,P),f.onChange&&f.onChange({target:{value:P}})}},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&&l&&l.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:f.id||t,className:u("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:u("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",p?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:p?"9.5rem":"0",overflowY:n.length>3?"auto":"hidden"}},n.map(a=>e.createElement("div",{key:a.value,className:u("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",l.includes(a.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>E(a.value)},e.createElement("input",{type:"checkbox",checked:l.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))});ce.displayName="MultiSelect";const ie=e.forwardRef(({name:t,label:r,loadOptions:n,className:d,containerClassName:N,isClearable:F,defaultOptions:C=!1,loadingMessage:T="Carregando...",noOptionsMessage:f="Nenhuma opção encontrada",searchable:w=!1,debounceMs:k=300,maxSelectedDisplay:v=3,onFocus:p,onBlur:g,...o},c)=>{var b,j,te;const[h,y]=e.useState(!1),[l,S]=e.useState(!1),[R,x]=e.useState([]),[z,O]=e.useState(!1),[E,W]=e.useState(""),[L,V]=e.useState(""),m=e.useRef(null),a=e.useRef(null),i=B.useFormContext(),P=i==null?void 0:i.control,M=P&&t?B.useWatch({control:P,name:t}):void 0,I=o.value??M??[],_=(te=(j=(b=i==null?void 0:i.formState)==null?void 0:b.errors)==null?void 0:j[t])==null?void 0:te.message,q=h||I&&I.length>0;e.useEffect(()=>{const s=setTimeout(()=>{V(E)},k);return()=>clearTimeout(s)},[E,k]),e.useEffect(()=>{(l||C&&R.length===0)&&$(w?L:void 0)},[L,l]),e.useEffect(()=>{C===!0?$():Array.isArray(C)&&x(C)},[]);const $=async s=>{try{O(!0);const A=await n(s);x(A)}catch(A){console.error("Error loading options:",A),x([])}finally{O(!1)}};e.useEffect(()=>{const s=A=>{m.current&&!m.current.contains(A.target)&&(S(!1),y(!1),W(""))};return document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s)}},[]);const K=()=>{l||(S(!0),y(!0),w&&a.current&&setTimeout(()=>{var s;return(s=a.current)==null?void 0:s.focus()},0))},H=s=>{y(!0),p&&p(s)},J=s=>{g&&g(s)},X=s=>{W(s.target.value)},Z=s=>{let A;I.includes(s)?A=I.filter(U=>U!==s):A=[...I,s],i&&t&&i.setValue(t,A),o.onChange&&o.onChange({target:{value:A}}),y(!0)},D=(s,A)=>{A.stopPropagation();const U=I.filter(de=>de!==s);i&&t&&i.setValue(t,U),o.onChange&&o.onChange({target:{value:U}})},ee=s=>{s.stopPropagation(),i&&t&&i.setValue(t,[]),o.onChange&&o.onChange({target:{value:[]}}),S(!1),y(!1),W("")},Y=R.filter(s=>I.includes(s.value)),Q=Y.slice(0,v),G=Y.length-v;return e.createElement("div",{className:u("relative",N),ref:m},e.createElement("div",{id:o.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":l,className:u("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",d),onClick:K,onFocus:w?void 0:H,onBlur:w?void 0:J,ref:c},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},Q.map(s=>e.createElement("span",{key:s.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:s.label},s.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 ${s.label}`,tabIndex:-1,onClick:A=>D(s.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"}))))),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"),w?e.createElement("input",{ref:a,type:"text",value:E,onChange:X,onFocus:H,onBlur:J,placeholder:I.length===0&&!r?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):I.length===0&&!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),z&&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&&I&&I.length>0&&!z&&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:o.id||t,className:u("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:u("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",l?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:l?"9.5rem":"0",overflowY:R.length>3?"auto":"hidden"}},z?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):R.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},f):R.map(s=>e.createElement("div",{key:s.value,className:u("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",I.includes(s.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>Z(s.value)},e.createElement("input",{type:"checkbox",checked:I.includes(s.value),readOnly:!0,className:"accent-blue-500"}),s.label))),_&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},_))});ie.displayName="MultiAsyncSelect";const xe={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},ue=e.forwardRef(({name:t,label:r,options:n,className:d,containerClassName:N,optionClassName:F,direction:C="row",size:T="md",onFocus:f,onBlur:w,...k},v)=>{var l,S,R;const p=B.useFormContext(),g=p==null?void 0:p.control,o=g&&t?B.useWatch({control:g,name:t}):void 0,c=k.value??o??"",h=(R=(S=(l=p==null?void 0:p.formState)==null?void 0:l.errors)==null?void 0:S[t])==null?void 0:R.message,y=x=>{p&&t&&p.setValue(t,x),k.onChange&&k.onChange({target:{value:x}})};return e.createElement("div",{className:u("relative",N),ref:v},r&&e.createElement("label",{htmlFor:t,className:u("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:u("flex gap-2 w-full pt-6",C==="row"?"flex-row":"flex-col",d),"aria-label":r,tabIndex:-1,onFocus:f,onBlur:w},n.map(x=>e.createElement("button",{key:x.value,type:"button",className:u("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)]",xe[T],c===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",F),"aria-pressed":c===x.value,"data-selected":c===x.value,tabIndex:0,onClick:()=>y(x.value),onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),y(x.value))}},x.icon&&e.createElement("span",{className:"mr-2 text-lg flex items-center"},x.icon),e.createElement("span",{className:"truncate font-medium"},x.label)))),h&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},h))});ue.displayName="RadioGroup";exports.AsyncSelect=se;exports.Button=ve;exports.Input=ne;exports.MultiAsyncSelect=ie;exports.MultiSelect=ce;exports.RadioGroup=ue;exports.Select=le;exports.Textarea=oe;
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;