rharuow-ds 1.0.9 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +279 -8
- package/dist/rharuow-ds.cjs.js +4 -4
- package/dist/rharuow-ds.es.js +855 -360
- package/dist/styles.css +1 -1
- package/dist/types/src/components/AsyncSelect.d.ts +16 -0
- package/dist/types/src/components/MultiAsyncSelect.d.ts +17 -0
- package/dist/types/src/components/RadioGroup.d.ts +27 -0
- package/dist/types/src/components/Select.d.ts +1 -4
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/types.d.ts +4 -0
- package/dist/types/src/stories/AsyncSelect.stories.d.ts +14 -0
- package/dist/types/src/stories/Input.stories.d.ts +3 -0
- package/dist/types/src/stories/MultiAsyncSelect.stories.d.ts +14 -0
- package/dist/types/src/stories/MultiSelect.stories.d.ts +13 -0
- package/dist/types/src/stories/RadioGroup.stories.d.ts +15 -0
- package/dist/types/src/stories/ThemeCustomization.stories.d.ts +7 -0
- package/package.json +41 -9
package/README.md
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
# rharuow-ds
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/rharuow-ds)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/Rharuow/rharuow-ds-docs/actions)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Um Design System moderno em React com integração completa ao React Hook Form, estilizado com Tailwind CSS e baseado em shadcn/ui.
|
|
8
|
+
|
|
9
|
+
## 🌟 Características
|
|
10
|
+
|
|
11
|
+
- ⚛️ **React 18+** com TypeScript
|
|
12
|
+
- � **Integração nativa** com React Hook Form
|
|
13
|
+
- 🎨 **Customização via CSS Variables** - Mude o tema facilmente
|
|
14
|
+
- 🎯 **Componentes acessíveis** (ARIA)
|
|
15
|
+
- 📱 **Responsivo** por padrão
|
|
16
|
+
- 🎭 **Animações suaves** e modernas
|
|
17
|
+
- 📚 **Documentação interativa** com Storybook
|
|
18
|
+
|
|
19
|
+
## 📚 Documentação
|
|
20
|
+
|
|
21
|
+
Acesse a documentação interativa dos componentes em:
|
|
22
|
+
**[https://rharuow.github.io/rharuow-ds-docs/](https://rharuow.github.io/rharuow-ds-docs/)**
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🚀 Instalação
|
|
6
27
|
|
|
7
28
|
Adicione o pacote ao seu projeto:
|
|
8
29
|
|
|
@@ -10,12 +31,26 @@ Adicione o pacote ao seu projeto:
|
|
|
10
31
|
npm install rharuow-ds
|
|
11
32
|
```
|
|
12
33
|
|
|
13
|
-
|
|
34
|
+
### Dependências necessárias
|
|
35
|
+
|
|
36
|
+
Se você for usar componentes com formulários, instale também:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install react-hook-form
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
> **💡 Atenção:**
|
|
14
43
|
> Não é necessário instalar ou configurar Tailwind CSS no seu projeto consumidor para usar os estilos do rharuow-ds. O CSS já vem pronto no pacote!
|
|
15
44
|
|
|
45
|
+
### Compatibilidade
|
|
46
|
+
|
|
47
|
+
- ⚛️ React 16.8+ (hooks)
|
|
48
|
+
- 📋 React Hook Form 7.0+
|
|
49
|
+
- 🌐 Navegadores modernos (ES2018+)
|
|
50
|
+
|
|
16
51
|
---
|
|
17
52
|
|
|
18
|
-
## Como usar
|
|
53
|
+
## 📖 Como usar
|
|
19
54
|
|
|
20
55
|
1. **Importe o CSS do design system**
|
|
21
56
|
No seu arquivo de entrada (ex: `src/main.tsx`, `src/index.tsx` ou `_app.tsx` no Next.js):
|
|
@@ -27,18 +62,206 @@ npm install rharuow-ds
|
|
|
27
62
|
2. **Use os componentes normalmente**
|
|
28
63
|
|
|
29
64
|
```tsx
|
|
30
|
-
import { Button, Input } from "rharuow-ds";
|
|
65
|
+
import { Button, Input, Select, AsyncSelect, MultiSelect, RadioGroup } from "rharuow-ds";
|
|
31
66
|
|
|
32
67
|
function App() {
|
|
33
68
|
return (
|
|
34
69
|
<div>
|
|
35
|
-
<Input label="E-mail" name="email" />
|
|
70
|
+
<Input label="E-mail" name="email" type="email" />
|
|
71
|
+
<Input label="Senha" name="password" type="password" />
|
|
72
|
+
<Select
|
|
73
|
+
label="País"
|
|
74
|
+
name="country"
|
|
75
|
+
options={[
|
|
76
|
+
{ label: "Brasil", value: "br" },
|
|
77
|
+
{ label: "Estados Unidos", value: "us" }
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
<RadioGroup
|
|
81
|
+
label="Tamanho"
|
|
82
|
+
name="size"
|
|
83
|
+
options={[
|
|
84
|
+
{ label: "Pequeno", value: "sm" },
|
|
85
|
+
{ label: "Médio", value: "md" },
|
|
86
|
+
{ label: "Grande", value: "lg" }
|
|
87
|
+
]}
|
|
88
|
+
/>
|
|
36
89
|
<Button variant="default">Enviar</Button>
|
|
37
90
|
</div>
|
|
38
91
|
);
|
|
39
92
|
}
|
|
40
93
|
```
|
|
41
94
|
|
|
95
|
+
3. **Para componentes com React Hook Form**
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { useForm, FormProvider } from "react-hook-form";
|
|
99
|
+
import { Input, Select, AsyncSelect, MultiAsyncSelect, RadioGroup } from "rharuow-ds";
|
|
100
|
+
|
|
101
|
+
function FormExample() {
|
|
102
|
+
const methods = useForm();
|
|
103
|
+
|
|
104
|
+
const loadCountries = async (search?: string) => {
|
|
105
|
+
// Simular chamada à API
|
|
106
|
+
const countries = [
|
|
107
|
+
{ label: "Brasil", value: "br" },
|
|
108
|
+
{ label: "Argentina", value: "ar" },
|
|
109
|
+
{ label: "Estados Unidos", value: "us" },
|
|
110
|
+
{ label: "Chile", value: "cl" },
|
|
111
|
+
{ label: "Peru", value: "pe" }
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
if (!search) return countries;
|
|
115
|
+
return countries.filter(c =>
|
|
116
|
+
c.label.toLowerCase().includes(search.toLowerCase())
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<FormProvider {...methods}>
|
|
122
|
+
<form onSubmit={methods.handleSubmit(console.log)}>
|
|
123
|
+
<Input label="Nome" name="name" />
|
|
124
|
+
<Input label="E-mail" name="email" type="email" />
|
|
125
|
+
<Input label="Senha" name="password" type="password" />
|
|
126
|
+
|
|
127
|
+
<AsyncSelect
|
|
128
|
+
label="País"
|
|
129
|
+
name="country"
|
|
130
|
+
loadOptions={loadCountries}
|
|
131
|
+
searchable
|
|
132
|
+
isClearable
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
<MultiAsyncSelect
|
|
136
|
+
label="Países favoritos"
|
|
137
|
+
name="favoriteCountries"
|
|
138
|
+
loadOptions={loadCountries}
|
|
139
|
+
searchable
|
|
140
|
+
isClearable
|
|
141
|
+
maxVisibleItems={2}
|
|
142
|
+
/>
|
|
143
|
+
|
|
144
|
+
<RadioGroup
|
|
145
|
+
label="Tamanho"
|
|
146
|
+
name="size"
|
|
147
|
+
options={[
|
|
148
|
+
{ label: "Pequeno", value: "sm" },
|
|
149
|
+
{ label: "Médio", value: "md" },
|
|
150
|
+
{ label: "Grande", value: "lg" }
|
|
151
|
+
]}
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<Button type="submit">Enviar</Button>
|
|
155
|
+
</form>
|
|
156
|
+
</FormProvider>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Componentes Disponíveis
|
|
164
|
+
|
|
165
|
+
### 🎯 **Button**
|
|
166
|
+
Botão customizável com diferentes variantes e tamanhos.
|
|
167
|
+
|
|
168
|
+
### 📝 **Input**
|
|
169
|
+
Campo de texto versátil com label flutuante e integração com React Hook Form:
|
|
170
|
+
- ✅ Label flutuante animada
|
|
171
|
+
- ✅ Suporte a múltiplos tipos (text, email, password, number, tel, url)
|
|
172
|
+
- ✅ Funcionalidade de password com botão mostrar/ocultar
|
|
173
|
+
- ✅ Ícones customizados opcionais
|
|
174
|
+
- ✅ Estados de erro integrados
|
|
175
|
+
- ✅ Totalmente acessível (ARIA)
|
|
176
|
+
|
|
177
|
+
### 📋 **Select**
|
|
178
|
+
Seletor customizado com opções estáticas e suporte a busca.
|
|
179
|
+
|
|
180
|
+
### 🔄 **AsyncSelect**
|
|
181
|
+
Seletor com carregamento assíncrono de opções:
|
|
182
|
+
- ✅ Carregamento de dados via API
|
|
183
|
+
- ✅ Busca em tempo real (searchable)
|
|
184
|
+
- ✅ Debounce configurável
|
|
185
|
+
- ✅ Estados de loading e "sem opções"
|
|
186
|
+
- ✅ Integração completa com React Hook Form
|
|
187
|
+
|
|
188
|
+
### 🎛️ **MultiSelect**
|
|
189
|
+
Seletor múltiplo para escolha de várias opções.
|
|
190
|
+
|
|
191
|
+
### 🔄🎛️ **MultiAsyncSelect**
|
|
192
|
+
Seletor múltiplo com carregamento assíncrono:
|
|
193
|
+
- ✅ Todas as funcionalidades do AsyncSelect
|
|
194
|
+
- ✅ Seleção múltipla com tags visuais
|
|
195
|
+
- ✅ Remoção individual de itens selecionados
|
|
196
|
+
- ✅ Limite configurável de itens exibidos
|
|
197
|
+
- ✅ Contador de itens extras (+X mais)
|
|
198
|
+
|
|
199
|
+
### 🎯 **RadioGroup**
|
|
200
|
+
Radio buttons modernos e criativos:
|
|
201
|
+
- ✅ Design de botões estilizados (não radio tradicional)
|
|
202
|
+
- ✅ Ícones customizados opcionais
|
|
203
|
+
- ✅ Layout horizontal ou vertical
|
|
204
|
+
- ✅ Diferentes tamanhos (sm, md, lg)
|
|
205
|
+
- ✅ Animações ao selecionar
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 🎨 Customização de Tema
|
|
210
|
+
|
|
211
|
+
O rharuow-ds utiliza **CSS Variables** para permitir customização fácil do tema. Você pode modificar as cores primárias do design system definindo as seguintes variáveis CSS:
|
|
212
|
+
|
|
213
|
+
### Variáveis Disponíveis
|
|
214
|
+
|
|
215
|
+
```css
|
|
216
|
+
:root {
|
|
217
|
+
--primary: #2563eb; /* Cor primária principal */
|
|
218
|
+
--primary-hover: #dbeafe; /* Cor para hover/background */
|
|
219
|
+
--primary-text: #fff; /* Cor do texto em backgrounds primários */
|
|
220
|
+
--input-bg: #fff; /* Background dos inputs */
|
|
221
|
+
--input-text: #222; /* Cor do texto dos inputs */
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Exemplo de Customização
|
|
226
|
+
|
|
227
|
+
```css
|
|
228
|
+
/* Tema vermelho */
|
|
229
|
+
:root {
|
|
230
|
+
--primary: #dc2626;
|
|
231
|
+
--primary-hover: #fecaca;
|
|
232
|
+
--primary-text: #fff;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Tema verde */
|
|
236
|
+
:root {
|
|
237
|
+
--primary: #059669;
|
|
238
|
+
--primary-hover: #d1fae5;
|
|
239
|
+
--primary-text: #fff;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Tema roxo */
|
|
243
|
+
:root {
|
|
244
|
+
--primary: #7c3aed;
|
|
245
|
+
--primary-hover: #e9d5ff;
|
|
246
|
+
--primary-text: #fff;
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### No Storybook
|
|
251
|
+
|
|
252
|
+
Na documentação do Storybook, você pode testar diferentes temas usando os controles na toolbar:
|
|
253
|
+
- 🎨 **Primary Color**: Muda a cor principal
|
|
254
|
+
- 🌈 **Primary Hover**: Muda a cor de hover/background
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 🛠️ Desenvolvimento
|
|
259
|
+
- ✅ Ícones customizados opcionais
|
|
260
|
+
- ✅ Três tamanhos: sm, md, lg
|
|
261
|
+
- ✅ Layout horizontal ou vertical
|
|
262
|
+
- ✅ Animações e estados visuais
|
|
263
|
+
- ✅ Label flutuante integrada
|
|
264
|
+
|
|
42
265
|
---
|
|
43
266
|
|
|
44
267
|
## Documentação
|
|
@@ -52,12 +275,60 @@ Acesse a documentação interativa dos componentes em [GitHub Pages](#) _(link s
|
|
|
52
275
|
Para contribuir ou rodar localmente:
|
|
53
276
|
|
|
54
277
|
```bash
|
|
55
|
-
git clone https://github.com/
|
|
56
|
-
cd rharuow-ds
|
|
278
|
+
git clone https://github.com/Rharuow/rharuow-ds-docs.git
|
|
279
|
+
cd rharuow-ds-docs
|
|
57
280
|
npm install
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Comandos disponíveis:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Iniciar Storybook para desenvolvimento
|
|
58
287
|
npm run storybook
|
|
288
|
+
|
|
289
|
+
# Build dos componentes
|
|
290
|
+
npm run build
|
|
291
|
+
|
|
292
|
+
# Gerar CSS do Tailwind
|
|
293
|
+
npm run build:css
|
|
294
|
+
|
|
295
|
+
# Executar testes
|
|
296
|
+
npm test
|
|
297
|
+
|
|
298
|
+
# Build do Storybook para produção
|
|
299
|
+
npm run build-storybook
|
|
59
300
|
```
|
|
60
301
|
|
|
302
|
+
### Estrutura do projeto:
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
src/
|
|
306
|
+
├── components/ # Componentes React
|
|
307
|
+
│ ├── Button.tsx
|
|
308
|
+
│ ├── Input.tsx
|
|
309
|
+
│ ├── Select.tsx
|
|
310
|
+
│ ├── AsyncSelect.tsx
|
|
311
|
+
│ ├── MultiSelect.tsx
|
|
312
|
+
│ ├── types.ts # Tipos compartilhados
|
|
313
|
+
│ └── index.ts # Exportações
|
|
314
|
+
├── lib/
|
|
315
|
+
│ └── utils.ts # Utilitários (cn, etc.)
|
|
316
|
+
├── stories/ # Stories do Storybook
|
|
317
|
+
└── styles/
|
|
318
|
+
└── ds.css # Estilos Tailwind
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Tecnologias
|
|
324
|
+
|
|
325
|
+
- ⚛️ **React 18** - Biblioteca base
|
|
326
|
+
- 📋 **React Hook Form** - Gerenciamento de formulários
|
|
327
|
+
- 🎨 **Tailwind CSS** - Estilização
|
|
328
|
+
- 📚 **Storybook** - Documentação interativa
|
|
329
|
+
- 📦 **Vite** - Build tool
|
|
330
|
+
- 🔷 **TypeScript** - Tipagem estática
|
|
331
|
+
|
|
61
332
|
---
|
|
62
333
|
|
|
63
334
|
Desenvolvido por Harysson.
|
package/dist/rharuow-ds.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("react"),H=require("react-hook-form");function ge(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(a,o,u.get?u:{enumerable:!0,get:()=>t[o]})}}return a.default=t,Object.freeze(a)}const i=ge(ce);var ae={exports:{}},te={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var oe;function pe(){if(oe)return te;oe=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function o(u,v,C){var R=null;if(C!==void 0&&(R=""+C),v.key!==void 0&&(R=""+v.key),"key"in v){C={};for(var I in v)I!=="key"&&(C[I]=v[I])}else C=v;return v=C.ref,{$$typeof:t,type:u,key:R,ref:v!==void 0?v:null,props:C}}return te.Fragment=a,te.jsx=o,te.jsxs=o,te}var re={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var le;function ye(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case d:return"Fragment";case k:return"Profiler";case p:return"StrictMode";case y:return"Suspense";case M:return"SuspenseList";case D:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case E:return"Portal";case T:return(e.displayName||"Context")+".Provider";case c:return(e._context.displayName||"Context")+".Consumer";case F:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return s=e.displayName||null,s!==null?s:t(e.type)||"Memo";case W:s=e._payload,e=e._init;try{return t(e(s))}catch{}}return null}function a(e){return""+e}function o(e){try{a(e);var s=!1}catch{s=!0}if(s){s=console;var w=s.error,P=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return w.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",P),a(e)}}function u(e){if(e===d)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===W)return"<...>";try{var s=t(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function v(){var e=z.A;return e===null?null:e.getOwner()}function C(){return Error("react-stack-top-frame")}function R(e){if(x.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function I(e,s){function w(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s))}w.isReactWarning=!0,Object.defineProperty(e,"key",{get:w,configurable:!0})}function b(){var e=t(this.type);return _[e]||(_[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function S(e,s,w,P,q,B,G,ee){return w=B.ref,e={$$typeof:N,type:e,key:s,props:B,_owner:q},(w!==void 0?w:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ee}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function A(e,s,w,P,q,B,G,ee){var O=s.children;if(O!==void 0)if(P)if(n(O)){for(P=0;P<O.length;P++)j(O[P]);Object.freeze&&Object.freeze(O)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(O);if(x.call(s,"key")){O=t(e);var X=Object.keys(s).filter(function(m){return m!=="key"});P=0<X.length?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}",K[O+P]||(X=0<X.length?"{"+X.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,g,p,V,p),K[p+g]=!0)}if(p=null,b!==void 0&&(a(b),p=""+b),E(r)&&(a(r.key),p=""+r.key),"key"in r){b={};for(var X in r)X!=="key"&&(b[X]=r[X])}else b=r;return p&&_(b,typeof e=="function"?e.displayName||e.name||"Unknown":e),W(e,p,O,M,u(),b,G,H)}function v(e){typeof e=="object"&&e!==null&&e.$$typeof===j&&e._store&&(e._store.validated=1)}var R=ne,j=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),S=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),A=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,d=Object.prototype.hasOwnProperty,n=Array.isArray,w=console.createTask?console.createTask:function(){return null};R={"react-stack-bottom-frame":function(e){return e()}};var L,z={},Z=R["react-stack-bottom-frame"].bind(R,m)(),Q=w(o(m)),K={};B.Fragment=s,B.jsx=function(e,r,b,g,M){var O=1e4>A.recentlyCreatedOwnerStacks++;return T(e,r,b,!1,g,M,O?Error("react-stack-top-frame"):Z,O?w(o(e)):Q)},B.jsxs=function(e,r,b,g,M){var O=1e4>A.recentlyCreatedOwnerStacks++;return T(e,r,b,!0,g,M,O?Error("react-stack-top-frame"):Z,O?w(o(e)):Q)}}()),B}var re;function fe(){return re||(re=1,process.env.NODE_ENV==="production"?J.exports=ue():J.exports=de()),J.exports}var l=fe();function ae(t){var i,a,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var u=t.length;for(i=0;i<u;i++)t[i]&&(a=ae(t[i]))&&(o&&(o+=" "),o+=a)}else for(a in t)t[a]&&(o&&(o+=" "),o+=a);return o}function be(){for(var t,i,a=0,o="",u=arguments.length;a<u;a++)(t=arguments[a])&&(i=ae(t))&&(o&&(o+=" "),o+=i);return o}function y(...t){return be(...t)}const me=({children:t,variant:i="default",className:a="",...o})=>{const u="px-4 py-2 rounded font-medium transition",m={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 l.jsx("button",{className:y(u,m[i],a),...o,children:t})},oe=N.forwardRef(({name:t,className:i,type:a="text",label:o,onFocus:u,onBlur:m,Icon:E,iconClassName:_,iconAction:c,containerClassName:W,...T},v)=>{var F,I,Y;const[R,j]=N.useState(!1),x=U.useFormContext(),s=x==null?void 0:x.control,C=x==null?void 0:x.register,D=s&&t?U.useWatch({control:s,name:t}):void 0,f=T.value??D??"",S=(Y=(I=(F=x==null?void 0:x.formState)==null?void 0:F.errors)==null?void 0:I[t])==null?void 0:Y.message,$=R||!!f;return l.jsxs("div",{className:y("relative",W),children:[l.jsx("input",{id:T.id||t,type:a,className:y("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",i),onFocus:h=>{j(!0),u&&u(h)},...x&&t?(()=>{const h=C(t),P=h.onBlur;return{...h,ref:k=>{typeof v=="function"?v(k):v&&(v.current=k),h.ref&&h.ref(k)},onBlur:k=>{j(!1),m&&m(k),P&&P(k)}}})():{ref:v,onBlur:h=>{j(!1),m&&m(h)}},...T}),o&&l.jsx("label",{htmlFor:T.id||t,className:y("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-blue-400 p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5"),children:o}),E&&l.jsx("div",{className:y("absolute top-1/2 right-3 -translate-y-1/2 text-white",_),onClick:c,children:l.jsx(E,{})}),S&&l.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:S})]})});oe.displayName="Input";const se=N.forwardRef(({name:t,label:i,options:a,className:o,containerClassName:u,isClearable:m,onFocus:E,onBlur:_,...c},W)=>{var h,P,k,A;const[T,v]=N.useState(!1),[R,j]=N.useState(!1),x=N.useRef(null),s=U.useFormContext(),C=s==null?void 0:s.control,D=C&&t?U.useWatch({control:C,name:t}):void 0,f=c.value??D??"",S=(k=(P=(h=s==null?void 0:s.formState)==null?void 0:h.errors)==null?void 0:P[t])==null?void 0:k.message,$=T||!!f;N.useEffect(()=>{const d=n=>{x.current&&!x.current.contains(n.target)&&(j(!1),v(!1))};return document.addEventListener("mousedown",d),()=>{document.removeEventListener("mousedown",d)}},[]);const F=()=>{j(d=>!d),v(!0)},I=d=>{v(!0),E&&E(d)},Y=d=>{_&&_(d)};return l.jsxs("div",{className:y("relative",u),ref:x,children:[l.jsxs("div",{id:c.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":R,className:y("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",o),onClick:F,onFocus:I,onBlur:Y,ref:W,children:[l.jsx("span",{className:y("block truncate",!f&&"text-gray-400"),children:((A=a.find(d=>d.value===f))==null?void 0:A.label)||!i&&"Selecione..."}),m&&f&&l.jsx("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:d=>{if(d.stopPropagation(),s&&t&&s.setValue(t,""),c.onChange){const n={target:{value:""}};c.onChange(n)}j(!1),v(!1)},children:"✕"})]}),i&&l.jsx("label",{htmlFor:c.id||t,className:y("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-blue-400 p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5"),children:i}),l.jsx("div",{className:y("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",R?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:R?"9.5rem":"0",overflowY:a.length>3?"auto":"hidden"},children:a.map(d=>l.jsx("div",{className:y("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",f===d.value&&"bg-blue-100"),onMouseDown:()=>{if(s&&t&&s.setValue(t,d.value),c.onChange){const n={target:{value:d.value}};c.onChange(n)}v(!0)},children:d.label},d.value))}),S&&l.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:S})]})});se.displayName="Select";const le=N.forwardRef(({name:t,label:i,options:a,className:o,containerClassName:u,isClearable:m,onFocus:E,onBlur:_,...c},W)=>{var k,A,d;const[T,v]=N.useState(!1),[R,j]=N.useState(!1),x=N.useRef(null),s=U.useFormContext(),C=s==null?void 0:s.control,D=C&&t?U.useWatch({control:C,name:t}):void 0,f=c.value??D??[],S=(d=(A=(k=s==null?void 0:s.formState)==null?void 0:k.errors)==null?void 0:A[t])==null?void 0:d.message,$=T||f&&f.length>0;N.useEffect(()=>{const n=w=>{x.current&&!x.current.contains(w.target)&&(j(!1),v(!1))};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[]);const F=()=>{j(n=>!n),v(!0)},I=n=>{v(!0),E&&E(n)},Y=n=>{_&&_(n)},h=n=>{var L;let w;f.includes(n)?w=f.filter(z=>z!==n):w=[...f,n],s&&t&&s.setValue(t,w),c.onChange&&((L=c.onChange)==null||L.call(c,{target:{value:w}})),v(!0)},P=n=>{var w;n.stopPropagation(),s&&t&&s.setValue(t,[]),c.onChange&&((w=c.onChange)==null||w.call(c,{target:{value:[]}})),j(!1),v(!1)};return l.jsxs("div",{className:y("relative",u),ref:x,children:[l.jsxs("div",{id:c.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":R,className:y("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",o),onClick:F,onFocus:I,onBlur:Y,ref:W,children:[l.jsx("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"},children:f&&f.length>0?a.filter(n=>f.includes(n.value)).map(n=>l.jsxs("span",{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"},children:[l.jsx("span",{className:"truncate",title:n.label,children:n.label}),l.jsx("button",{type:"button",className:"ml-1 text-blue-400 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 ${n.label}`,tabIndex:-1,onClick:w=>{w.stopPropagation();const L=f.filter(z=>z!==n.value);s&&t&&s.setValue(t,L),c.onChange&&c.onChange({target:{value:L}})},children:l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]},n.value)):!i&&l.jsx("span",{className:"text-gray-400 text-sm",children:"Selecione..."})}),m&&f&&f.length>0&&l.jsx("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,children:"✕"})]}),i&&l.jsx("label",{htmlFor:c.id||t,className:y("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-blue-400 p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5"),children:i}),l.jsx("div",{className:y("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",R?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:R?"9.5rem":"0",overflowY:a.length>3?"auto":"hidden"},children:a.map(n=>l.jsxs("div",{className:y("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",f.includes(n.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>h(n.value),children:[l.jsx("input",{type:"checkbox",checked:f.includes(n.value),readOnly:!0,className:"accent-blue-500"}),n.label]},n.value))}),S&&l.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:S})]})});le.displayName="MultiSelect";exports.Button=me;exports.Input=oe;exports.MultiSelect=le;exports.Select=se;
|
|
22
|
+
<%s key={someKey} {...props} />`,P,O,X,O),K[O+P]=!0)}if(O=null,w!==void 0&&(o(w),O=""+w),R(s)&&(o(s.key),O=""+s.key),"key"in s){w={};for(var Z in s)Z!=="key"&&(w[Z]=s[Z])}else w=s;return O&&I(w,typeof e=="function"?e.displayName||e.name||"Unknown":e),S(e,O,B,q,v(),w,G,ee)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===N&&e._store&&(e._store.validated=1)}var g=ce,N=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),T=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),z=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,x=Object.prototype.hasOwnProperty,n=Array.isArray,l=console.createTask?console.createTask:function(){return null};g={"react-stack-bottom-frame":function(e){return e()}};var Y,_={},L=g["react-stack-bottom-frame"].bind(g,C)(),Q=l(u(C)),K={};re.Fragment=d,re.jsx=function(e,s,w,P,q){var B=1e4>z.recentlyCreatedOwnerStacks++;return A(e,s,w,!1,P,q,B?Error("react-stack-top-frame"):L,B?l(u(e)):Q)},re.jsxs=function(e,s,w,P,q){var B=1e4>z.recentlyCreatedOwnerStacks++;return A(e,s,w,!0,P,q,B?Error("react-stack-top-frame"):L,B?l(u(e)):Q)}}()),re}var ie;function we(){return ie||(ie=1,process.env.NODE_ENV==="production"?ae.exports=pe():ae.exports=ye()),ae.exports}var r=we();function ue(t){var a,o,u="";if(typeof t=="string"||typeof t=="number")u+=t;else if(typeof t=="object")if(Array.isArray(t)){var v=t.length;for(a=0;a<v;a++)t[a]&&(o=ue(t[a]))&&(u&&(u+=" "),u+=o)}else for(o in t)t[o]&&(u&&(u+=" "),u+=o);return u}function je(){for(var t,a,o=0,u="",v=arguments.length;o<v;o++)(t=arguments[o])&&(a=ue(t))&&(u&&(u+=" "),u+=a);return u}function h(...t){return je(...t)}const Ne=({children:t,variant:a="default",className:o="",...u})=>{const v="px-4 py-2 rounded font-medium transition",C={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.jsx("button",{className:h(v,C[a],o),...u,children:t})},de=i.forwardRef(({name:t,className:a,type:o="text",label:u,onFocus:v,onBlur:C,Icon:R,iconClassName:I,iconAction:b,containerClassName:S,...A},j)=>{var z,x,n;const[g,N]=i.useState(!1),[E,d]=i.useState(!1),p=H.useFormContext(),k=p==null?void 0:p.control,c=p==null?void 0:p.register,T=k&&t?H.useWatch({control:k,name:t}):void 0,F=A.value??T??"",y=(n=(x=(z=p==null?void 0:p.formState)==null?void 0:z.errors)==null?void 0:x[t])==null?void 0:n.message,M=g||!!F,V=o==="password"?E?"text":"password":o,W=()=>r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("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"})}),D=()=>r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("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"})}),$=()=>{d(!E)};return r.jsxs("div",{className:h("relative",S),children:[r.jsx("input",{id:A.id||t,type:V,className:h("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",o==="password"||R?"pr-12":"",a),onFocus:l=>{N(!0),v&&v(l)},...p&&t?(()=>{const l=c(t),Y=l.onBlur;return{...l,ref:_=>{typeof j=="function"?j(_):j&&(j.current=_),l.ref&&l.ref(_)},onBlur:_=>{N(!1),C&&C(_),Y&&Y(_)}}})():{ref:j,onBlur:l=>{N(!1),C&&C(l)}},...A}),u&&r.jsx("label",{htmlFor:A.id||t,className:h("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",M?"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"),children:u}),o==="password"&&r.jsx("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:$,"aria-label":E?"Esconder senha":"Mostrar senha",tabIndex:-1,children:E?r.jsx(D,{}):r.jsx(W,{})}),R&&o!=="password"&&r.jsx("div",{className:h("absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",I),onClick:b,children:r.jsx(R,{})}),y&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:y})]})});de.displayName="Input";const fe=i.forwardRef(({name:t,label:a,options:o,className:u,containerClassName:v,isClearable:C,onFocus:R,onBlur:I,...b},S)=>{var W,D,$,z;const[A,j]=i.useState(!1),[g,N]=i.useState(!1),E=i.useRef(null),d=H.useFormContext(),p=d==null?void 0:d.control,k=p&&t?H.useWatch({control:p,name:t}):void 0,c=b.value??k??"",T=($=(D=(W=d==null?void 0:d.formState)==null?void 0:W.errors)==null?void 0:D[t])==null?void 0:$.message,F=A||!!c;i.useEffect(()=>{const x=n=>{E.current&&!E.current.contains(n.target)&&(N(!1),j(!1))};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[]);const y=()=>{N(x=>!x),j(!0)},M=x=>{j(!0),R&&R(x)},V=x=>{I&&I(x)};return r.jsxs("div",{className:h("relative",v),ref:E,children:[r.jsxs("div",{id:b.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":g,className:h("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",u),onClick:y,onFocus:M,onBlur:V,ref:S,children:[r.jsx("span",{className:h("block truncate",!c&&"text-gray-400"),children:((z=o.find(x=>x.value===c))==null?void 0:z.label)||!a&&"Selecione..."}),C&&c&&r.jsx("button",{type:"button",tabIndex:-1,"aria-label":"Limpar seleção",className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",onClick:x=>{if(x.stopPropagation(),d&&t&&d.setValue(t,""),b.onChange){const n={target:{value:""}};b.onChange(n)}N(!1),j(!1)},children:"✕"})]}),a&&r.jsx("label",{htmlFor:b.id||t,className:h("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"),children:a}),r.jsx("div",{className:h("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",g?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:g?"9.5rem":"0",overflowY:o.length>3?"auto":"hidden"},children:o.map(x=>r.jsx("div",{className:h("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",c===x.value&&"bg-blue-100"),onMouseDown:()=>{if(d&&t&&d.setValue(t,x.value),b.onChange){const n={target:{value:x.value}};b.onChange(n)}j(!0)},children:x.label},x.value))}),T&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:T})]})});fe.displayName="Select";const xe=i.forwardRef(({name:t,label:a,loadOptions:o,className:u,containerClassName:v,isClearable:C,defaultOptions:R=!1,loadingMessage:I="Carregando...",noOptionsMessage:b="Nenhuma opção encontrada",searchable:S=!1,debounceMs:A=300,onFocus:j,onBlur:g,...N},E)=>{var O,X,Z;const[d,p]=i.useState(!1),[k,c]=i.useState(!1),[T,F]=i.useState([]),[y,M]=i.useState(!1),[V,W]=i.useState(""),[D,$]=i.useState(""),z=i.useRef(null),x=i.useRef(null),n=H.useFormContext(),l=n==null?void 0:n.control,Y=l&&t?H.useWatch({control:l,name:t}):void 0,_=N.value??Y??"",L=(Z=(X=(O=n==null?void 0:n.formState)==null?void 0:O.errors)==null?void 0:X[t])==null?void 0:Z.message,Q=d||!!_;i.useEffect(()=>{const m=setTimeout(()=>{$(V)},A);return()=>clearTimeout(m)},[V,A]),i.useEffect(()=>{(k||R&&T.length===0)&&K(S?D:void 0)},[D,k]),i.useEffect(()=>{R===!0?K():Array.isArray(R)&&F(R)},[]);const K=async m=>{try{M(!0);const J=await o(m);F(J)}catch(J){console.error("Error loading options:",J),F([])}finally{M(!1)}};i.useEffect(()=>{const m=J=>{z.current&&!z.current.contains(J.target)&&(c(!1),p(!1),W(""))};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]);const e=()=>{k||(c(!0),p(!0),S&&x.current&&setTimeout(()=>{var m;return(m=x.current)==null?void 0:m.focus()},0))},s=m=>{p(!0),j&&j(m)},w=m=>{g&&g(m)},P=m=>{W(m.target.value)},q=m=>{if(n&&t&&n.setValue(t,m),N.onChange){const J={target:{value:m}};N.onChange(J)}c(!1),p(!1),W("")},B=m=>{if(m.stopPropagation(),n&&t&&n.setValue(t,""),N.onChange){const J={target:{value:""}};N.onChange(J)}c(!1),p(!1),W("")},G=T.find(m=>m.value===_),ee=S&&k?V:(G==null?void 0:G.label)||"";return r.jsxs("div",{className:h("relative",v),ref:z,children:[r.jsxs("div",{id:N.id||t,tabIndex:S?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":k,className:h("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",u),onClick:e,onFocus:S?void 0:s,onBlur:S?void 0:w,ref:E,children:[S?r.jsx("input",{ref:x,type:"text",value:ee,onChange:P,onFocus:s,onBlur:w,placeholder:a?"":"Selecione...",className:h("w-full bg-transparent border-none outline-none text-sm",!_&&!V&&"text-gray-400")}):r.jsx("span",{className:h("block truncate",!_&&"text-gray-400"),children:(G==null?void 0:G.label)||!a&&"Selecione..."}),y&&r.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2",children:r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})}),C&&_&&!y&&r.jsx("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,children:"✕"})]}),a&&r.jsx("label",{htmlFor:N.id||t,className:h("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"),children:a}),r.jsx("div",{className:h("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",k?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:k?"9.5rem":"0",overflowY:T.length>3?"auto":"hidden"},children:y?r.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 text-center",children:I}):T.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 text-center",children:b}):T.map(m=>r.jsx("div",{className:h("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",_===m.value&&"bg-blue-100"),onMouseDown:()=>q(m.value),children:m.label},m.value))}),L&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:L})]})});xe.displayName="AsyncSelect";const me=i.forwardRef(({name:t,label:a,options:o,className:u,containerClassName:v,isClearable:C,onFocus:R,onBlur:I,...b},S)=>{var $,z,x;const[A,j]=i.useState(!1),[g,N]=i.useState(!1),E=i.useRef(null),d=H.useFormContext(),p=d==null?void 0:d.control,k=p&&t?H.useWatch({control:p,name:t}):void 0,c=b.value??k??[],T=(x=(z=($=d==null?void 0:d.formState)==null?void 0:$.errors)==null?void 0:z[t])==null?void 0:x.message,F=A||c&&c.length>0;i.useEffect(()=>{const n=l=>{E.current&&!E.current.contains(l.target)&&(N(!1),j(!1))};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[]);const y=()=>{N(n=>!n),j(!0)},M=n=>{j(!0),R&&R(n)},V=n=>{I&&I(n)},W=n=>{var Y;let l;c.includes(n)?l=c.filter(_=>_!==n):l=[...c,n],d&&t&&d.setValue(t,l),b.onChange&&((Y=b.onChange)==null||Y.call(b,{target:{value:l}})),j(!0)},D=n=>{var l;n.stopPropagation(),d&&t&&d.setValue(t,[]),b.onChange&&((l=b.onChange)==null||l.call(b,{target:{value:[]}})),N(!1),j(!1)};return r.jsxs("div",{className:h("relative",v),ref:E,children:[r.jsxs("div",{id:b.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":g,className:h("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",u),onClick:y,onFocus:M,onBlur:V,ref:S,children:[r.jsx("div",{className:"flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",style:{scrollbarWidth:"none"},children:c&&c.length>0?o.filter(n=>c.includes(n.value)).map(n=>r.jsxs("span",{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"},children:[r.jsx("span",{className:"truncate",title:n.label,children:n.label}),r.jsx("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 ${n.label}`,tabIndex:-1,onClick:l=>{l.stopPropagation();const Y=c.filter(_=>_!==n.value);d&&t&&d.setValue(t,Y),b.onChange&&b.onChange({target:{value:Y}})},children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]},n.value)):!a&&r.jsx("span",{className:"text-gray-400 text-sm",children:"Selecione..."})}),C&&c&&c.length>0&&r.jsx("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:D,children:"✕"})]}),a&&r.jsx("label",{htmlFor:b.id||t,className:h("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"),children:a}),r.jsx("div",{className:h("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",g?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:g?"9.5rem":"0",overflowY:o.length>3?"auto":"hidden"},children:o.map(n=>r.jsxs("div",{className:h("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",c.includes(n.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>W(n.value),children:[r.jsx("input",{type:"checkbox",checked:c.includes(n.value),readOnly:!0,className:"accent-blue-500"}),n.label]},n.value))}),T&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:T})]})});me.displayName="MultiSelect";const he=i.forwardRef(({name:t,label:a,loadOptions:o,className:u,containerClassName:v,isClearable:C,defaultOptions:R=!1,loadingMessage:I="Carregando...",noOptionsMessage:b="Nenhuma opção encontrada",searchable:S=!1,debounceMs:A=300,maxSelectedDisplay:j=3,onFocus:g,onBlur:N,...E},d)=>{var m,J,se;const[p,k]=i.useState(!1),[c,T]=i.useState(!1),[F,y]=i.useState([]),[M,V]=i.useState(!1),[W,D]=i.useState(""),[$,z]=i.useState(""),x=i.useRef(null),n=i.useRef(null),l=H.useFormContext(),Y=l==null?void 0:l.control,_=Y&&t?H.useWatch({control:Y,name:t}):void 0,L=E.value??_??[],Q=(se=(J=(m=l==null?void 0:l.formState)==null?void 0:m.errors)==null?void 0:J[t])==null?void 0:se.message,K=p||L&&L.length>0;i.useEffect(()=>{const f=setTimeout(()=>{z(W)},A);return()=>clearTimeout(f)},[W,A]),i.useEffect(()=>{(c||R&&F.length===0)&&e(S?$:void 0)},[$,c]),i.useEffect(()=>{R===!0?e():Array.isArray(R)&&y(R)},[]);const e=async f=>{try{V(!0);const U=await o(f);y(U)}catch(U){console.error("Error loading options:",U),y([])}finally{V(!1)}};i.useEffect(()=>{const f=U=>{x.current&&!x.current.contains(U.target)&&(T(!1),k(!1),D(""))};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[]);const s=()=>{c||(T(!0),k(!0),S&&n.current&&setTimeout(()=>{var f;return(f=n.current)==null?void 0:f.focus()},0))},w=f=>{k(!0),g&&g(f)},P=f=>{N&&N(f)},q=f=>{D(f.target.value)},B=f=>{let U;L.includes(f)?U=L.filter(ne=>ne!==f):U=[...L,f],l&&t&&l.setValue(t,U),E.onChange&&E.onChange({target:{value:U}}),k(!0)},G=(f,U)=>{U.stopPropagation();const ne=L.filter(ve=>ve!==f);l&&t&&l.setValue(t,ne),E.onChange&&E.onChange({target:{value:ne}})},ee=f=>{f.stopPropagation(),l&&t&&l.setValue(t,[]),E.onChange&&E.onChange({target:{value:[]}}),T(!1),k(!1),D("")},O=F.filter(f=>L.includes(f.value)),X=O.slice(0,j),Z=O.length-j;return r.jsxs("div",{className:h("relative",v),ref:x,children:[r.jsxs("div",{id:E.id||t,tabIndex:S?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":c,className:h("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",u),onClick:s,onFocus:S?void 0:w,onBlur:S?void 0:P,ref:d,children:[r.jsxs("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full",children:[X.map(f=>r.jsxs("span",{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"},children:[r.jsx("span",{className:"truncate",title:f.label,children:f.label}),r.jsx("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 ${f.label}`,tabIndex:-1,onClick:U=>G(f.value,U),children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M3 3L9 9M9 3L3 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]},f.value)),Z>0&&r.jsxs("span",{className:"flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs",children:["+",Z," mais"]}),S?r.jsx("input",{ref:n,type:"text",value:W,onChange:q,onFocus:w,onBlur:P,placeholder:L.length===0&&!a?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):L.length===0&&!a&&r.jsx("span",{className:"text-gray-400 text-sm",children:"Selecione..."})]}),M&&r.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2",children:r.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})}),C&&L&&L.length>0&&!M&&r.jsx("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,children:"✕"})]}),a&&r.jsx("label",{htmlFor:E.id||t,className:h("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",K?"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"),children:a}),r.jsx("div",{className:h("absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",c?"border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100":"max-h-0 opacity-0 scale-95 pointer-events-none"),style:{maxHeight:c?"9.5rem":"0",overflowY:F.length>3?"auto":"hidden"},children:M?r.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 text-center",children:I}):F.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-gray-500 text-center",children:b}):F.map(f=>r.jsxs("div",{className:h("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",L.includes(f.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>B(f.value),children:[r.jsx("input",{type:"checkbox",checked:L.includes(f.value),readOnly:!0,className:"accent-blue-500"}),f.label]},f.value))}),Q&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:Q})]})});he.displayName="MultiAsyncSelect";const Ee={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},be=i.forwardRef(({name:t,label:a,options:o,className:u,containerClassName:v,optionClassName:C,direction:R="row",size:I="md",onFocus:b,onBlur:S,...A},j)=>{var c,T,F;const g=H.useFormContext(),N=g==null?void 0:g.control,E=N&&t?H.useWatch({control:N,name:t}):void 0,d=A.value??E??"",p=(F=(T=(c=g==null?void 0:g.formState)==null?void 0:c.errors)==null?void 0:T[t])==null?void 0:F.message,k=y=>{g&&t&&g.setValue(t,y),A.onChange&&A.onChange({target:{value:y}})};return r.jsxs("div",{className:h("relative",v),ref:j,children:[a&&r.jsx("label",{htmlFor:t,className:h("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"),children:a}),r.jsx("div",{className:h("flex gap-2 w-full pt-6",R==="row"?"flex-row":"flex-col",u),"aria-label":a,tabIndex:-1,onFocus:b,onBlur:S,children:o.map(y=>r.jsxs("button",{type:"button",className:h("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)]",Ee[I],d===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",C),"aria-pressed":d===y.value,"data-selected":d===y.value,tabIndex:0,onClick:()=>k(y.value),onKeyDown:M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),k(y.value))},children:[y.icon&&r.jsx("span",{className:"mr-2 text-lg flex items-center",children:y.icon}),r.jsx("span",{className:"truncate font-medium",children:y.label})]},y.value))}),p&&r.jsx("span",{className:"text-red-500 text-xs mt-1 block",children:p})]})});be.displayName="RadioGroup";exports.AsyncSelect=xe;exports.Button=Ne;exports.Input=de;exports.MultiAsyncSelect=he;exports.MultiSelect=me;exports.RadioGroup=be;exports.Select=fe;
|