rharuow-ds 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# rharuow-ds
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
- 🧩 **10 componentes** prontos para uso (Input, Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, RadioGroup, Button, Card, Table)
|
|
5
|
-
- 🔗 **Integração n### 🃏 **Card**
|
|
6
|
-
|
|
7
|
-
Componente flexível para exibir conteúdo organizado em seções:
|
|
8
|
-
|
|
9
|
-
- ✅ **Estrutura modular**: Header, Body e Footer independentes
|
|
10
|
-
- ✅ **Múltiplas variantes**: default, outlined, elevated, flat
|
|
11
|
-
- ✅ **Tamanhos configuráveis**: sm, md, lg
|
|
12
|
-
- ✅ **Suporte ao tema dark**: Variáveis CSS para light/dark mode
|
|
13
|
-
- ✅ **Elementos semânticos**: Props `as` para acessibilidade (header, main, footer)
|
|
14
|
-
- ✅ **Flexibilidade total**: Use apenas as seções necessárias
|
|
15
|
-
- ✅ **Customização completa**: Padding, bordas arredondadas e estilos
|
|
16
|
-
|
|
17
|
-
### 📊 **Table**
|
|
18
|
-
|
|
19
|
-
Componente completo para exibição de dados tabulares:
|
|
20
|
-
|
|
21
|
-
- ✅ **Estrutura modular**: Table, Header, Body, Footer, Row, Cell
|
|
22
|
-
- ✅ **Múltiplas variantes**: default, striped, bordered
|
|
23
|
-
- ✅ **Tamanhos configuráveis**: sm, md, lg
|
|
24
|
-
- ✅ **Responsividade**: Scroll horizontal automático
|
|
25
|
-
- ✅ **Header fixo**: Para tabelas com muitos dados
|
|
26
|
-
- ✅ **Suporte ao tema dark**: Variáveis CSS para light/dark mode
|
|
27
|
-
- ✅ **Alinhamento de células**: left, center, right
|
|
28
|
-
- ✅ **Colspan e rowspan**: Células que ocupam múltiplas colunas/linhas
|
|
29
|
-
- ✅ **Elementos semânticos**: Props `as` para acessibilidade (th/td, thead/tbody/tfoot)
|
|
30
|
-
- ✅ **Linhas interativas**: Hover e estados de seleção
|
|
31
|
-
|
|
32
|
-
### 🎯 **Button**eact Hook Form
|
|
33
|
-
- 🎨 **Customização via CSS Variables** - Mude o tema facilmente
|
|
34
|
-
- 🎯 **Componentes acessíveis** (ARIA)
|
|
35
|
-
- 📱 **Responsivo** por padrão
|
|
36
|
-
- 🎭 **Animações suaves** e modernas
|
|
37
|
-
- 📚 **Documentação interativa** com StorybookNPM Version](https://img.shields.io/npm/v/rharuow-ds)](https://www.npmjs.com/package/rharuow-ds)
|
|
3
|
+
[](https://www.npmjs.com/package/rharuow-ds)
|
|
38
4
|
[](https://opensource.org/licenses/MIT)
|
|
39
5
|
[](https://github.com/Rharuow/rharuow-ds-docs/actions)
|
|
40
6
|
|
|
@@ -43,7 +9,8 @@ Um Design System moderno em React com integração completa ao React Hook Form,
|
|
|
43
9
|
## 🌟 Características
|
|
44
10
|
|
|
45
11
|
- ⚛️ **React 18+** com TypeScript
|
|
46
|
-
-
|
|
12
|
+
- 🧩 **10 componentes** prontos para uso (Input, Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, RadioGroup, Button, Card, Table)
|
|
13
|
+
- 🔗 **Integração nativa** com React Hook Form
|
|
47
14
|
- 🎨 **Customização via CSS Variables** - Mude o tema facilmente
|
|
48
15
|
- 🎯 **Componentes acessíveis** (ARIA)
|
|
49
16
|
- 📱 **Responsivo** por padrão
|
|
@@ -273,12 +240,31 @@ Componente flexível para exibir conteúdo organizado em seções:
|
|
|
273
240
|
|
|
274
241
|
- ✅ **Estrutura modular**: Header, Body e Footer independentes
|
|
275
242
|
- ✅ **Múltiplas variantes**: default, outlined, elevated, flat
|
|
276
|
-
- ✅ **
|
|
243
|
+
- ✅ **Largura flexível**: Por padrão, cresce para ocupar largura disponível
|
|
244
|
+
- ✅ **Controle de largura**: Use `constrainWidth=true` para aplicar limitações por tamanho
|
|
245
|
+
- ✅ **Tamanhos configuráveis**: sm, md, lg (aplicados apenas com `constrainWidth`)
|
|
277
246
|
- ✅ **Suporte ao tema dark**: Variáveis CSS para light/dark mode
|
|
278
247
|
- ✅ **Elementos semânticos**: Props `as` para acessibilidade (header, main, footer)
|
|
279
248
|
- ✅ **Flexibilidade total**: Use apenas as seções necessárias
|
|
280
249
|
- ✅ **Customização completa**: Padding, bordas arredondadas e estilos
|
|
281
250
|
|
|
251
|
+
### 📊 **Table**
|
|
252
|
+
|
|
253
|
+
Componente completo para exibição de dados tabulares:
|
|
254
|
+
|
|
255
|
+
- ✅ **Estrutura modular**: Table, Header, Body, Footer, Row, Cell
|
|
256
|
+
- ✅ **Múltiplas variantes**: default, striped, bordered
|
|
257
|
+
- ✅ **Tamanhos configuráveis**: sm, md, lg
|
|
258
|
+
- ✅ **Responsividade**: Scroll horizontal automático
|
|
259
|
+
- ✅ **Header fixo**: Para tabelas com muitos dados
|
|
260
|
+
- ✅ **Suporte ao tema dark**: Variáveis CSS para light/dark mode
|
|
261
|
+
- ✅ **Alinhamento de células**: left, center, right
|
|
262
|
+
- ✅ **Colspan e rowspan**: Células que ocupam múltiplas colunas/linhas
|
|
263
|
+
- ✅ **Elementos semânticos**: Props `as` para acessibilidade (th/td, thead/tbody/tfoot)
|
|
264
|
+
- ✅ **Linhas interativas**: Hover e estados de seleção
|
|
265
|
+
|
|
266
|
+
### �
|
|
267
|
+
|
|
282
268
|
### �🎯 **Button**
|
|
283
269
|
|
|
284
270
|
Botão customizável com diferentes variantes e tamanhos.
|
package/dist/rharuow-ds.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),A=require("react-hook-form");function we(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const e=we(R);function ue(t){var r,a,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(a=ue(t[r]))&&(n&&(n+=" "),n+=a)}else for(a in t)t[a]&&(n&&(n+=" "),n+=a);return n}function Ee(){for(var t,r,a=0,n="",s=arguments.length;a<s;a++)(t=arguments[a])&&(r=ue(t))&&(n&&(n+=" "),n+=r);return n}function o(...t){return Ee(...t)}const Ne=({children:t,variant:r="default",className:a="",...n})=>{const s="px-4 py-2 rounded font-medium transition",N={default:"bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",outline:"border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",secondary:"bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"};return R.createElement("button",{className:o(s,N[r],a),...n},t)},me=e.forwardRef(({name:t,className:r,type:a="text",label:n,onFocus:s,onBlur:N,Icon:p,iconClassName:T,iconAction:i,containerClassName:w,...E},b)=>{var I,v,l;const[C,h]=e.useState(!1),[d,m]=e.useState(!1),y=A.useFormContext(),k=y==null?void 0:y.control,c=y==null?void 0:y.register,F=k&&t?A.useWatch({control:k,name:t}):void 0,_=E.value??F??"",x=(l=(v=(I=y==null?void 0:y.formState)==null?void 0:I.errors)==null?void 0:v[t])==null?void 0:l.message,B=C||!!_,L=a==="password"?d?"text":"password":a,S=()=>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"})),M=()=>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"})),O=()=>{m(!d)};return e.createElement("div",{className:o("relative",w)},e.createElement("input",{id:E.id||t,type:L,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",a==="password"||p?"pr-12":"",r),onFocus:f=>{h(!0),s&&s(f)},...y&&t?(()=>{const f=c(t),H=f.onBlur;return{...f,ref:z=>{typeof b=="function"?b(z):b&&(b.current=z),f.ref&&f.ref(z)},onBlur:z=>{h(!1),N&&N(z),H&&H(z)}}})():{ref:b,onBlur:f=>{h(!1),N&&N(f)}},...E}),n&&e.createElement("label",{htmlFor:E.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",B?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),a==="password"&&e.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:O,"aria-label":d?"Esconder senha":"Mostrar senha",tabIndex:-1},d?e.createElement(M,null):e.createElement(S,null)),p&&a!=="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",T),onClick:i},e.createElement(p,null)),x&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},x))});me.displayName="Input";const fe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,isClearable:N,onFocus:p,onBlur:T,...i},w)=>{var S,M,O,I;const[E,b]=e.useState(!1),[C,h]=e.useState(!1),d=e.useRef(null),m=A.useFormContext(),y=m==null?void 0:m.control,k=y&&t?A.useWatch({control:y,name:t}):void 0,c=i.value??k??"",F=(O=(M=(S=m==null?void 0:m.formState)==null?void 0:S.errors)==null?void 0:M[t])==null?void 0:O.message,_=E||!!c;e.useEffect(()=>{const v=l=>{d.current&&!d.current.contains(l.target)&&(h(!1),b(!1))};return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[]);const x=()=>{h(v=>!v),b(!0)},B=v=>{b(!0),p&&p(v)},L=v=>{T&&T(v)};return e.createElement("div",{className:o("relative",s),ref:d},e.createElement("div",{id:i.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":C,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",n),onClick:x,onFocus:B,onBlur:L,ref:w},e.createElement("span",{className:o("block truncate",!c&&"text-gray-400")},((I=a.find(v=>v.value===c))==null?void 0:I.label)||!r&&"Selecione..."),N&&c&&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:v=>{if(v.stopPropagation(),m&&t&&m.setValue(t,""),i.onChange){const l={target:{value:""}};i.onChange(l)}h(!1),b(!1)}},"✕")),r&&e.createElement("label",{htmlFor:i.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",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:a.length>3?"auto":"hidden"}},a.map(v=>e.createElement("div",{key:v.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",c===v.value&&"bg-blue-100"),onMouseDown:()=>{if(m&&t&&m.setValue(t,v.value),i.onChange){const l={target:{value:v.value}};i.onChange(l)}b(!0)}},v.label))),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});fe.displayName="Select";const be=e.forwardRef(({name:t,className:r,label:a,onFocus:n,onBlur:s,Icon:N,iconClassName:p,iconAction:T,containerClassName:i,rows:w=4,...E},b)=>{var x,B,L;const[C,h]=e.useState(!1),d=A.useFormContext(),m=d==null?void 0:d.control,y=d==null?void 0:d.register,k=m&&t?A.useWatch({control:m,name:t}):void 0,c=E.value??k??"",F=(L=(B=(x=d==null?void 0:d.formState)==null?void 0:x.errors)==null?void 0:B[t])==null?void 0:L.message,_=C||!!c;return e.createElement("div",{className:o("relative",i)},e.createElement("textarea",{id:E.id||t,rows:w,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",N?"pr-12":"",r),onFocus:S=>{h(!0),n&&n(S)},...d&&t?(()=>{const S=y(t),M=S.onBlur;return{...S,ref:O=>{typeof b=="function"?b(O):b&&(b.current=O),S.ref&&S.ref(O)},onBlur:O=>{h(!1),s&&s(O),M&&M(O)}}})():{ref:b,onBlur:S=>{h(!1),s&&s(S)}},...E}),a&&e.createElement("label",{htmlFor:E.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")},a),N&&e.createElement("div",{className:o("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",p),onClick:T},e.createElement(N,null)),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});be.displayName="Textarea";const ve=e.forwardRef(({name:t,label:r,loadOptions:a,className:n,containerClassName:s,isClearable:N,defaultOptions:p=!1,loadingMessage:T="Carregando...",noOptionsMessage:i="Nenhuma opção encontrada",searchable:w=!1,debounceMs:E=300,onFocus:b,onBlur:C,...h},d)=>{var Y,U,G;const[m,y]=e.useState(!1),[k,c]=e.useState(!1),[F,_]=e.useState([]),[x,B]=e.useState(!1),[L,S]=e.useState(""),[M,O]=e.useState(""),I=e.useRef(null),v=e.useRef(null),l=A.useFormContext(),f=l==null?void 0:l.control,H=f&&t?A.useWatch({control:f,name:t}):void 0,z=h.value??H??"",W=(G=(U=(Y=l==null?void 0:l.formState)==null?void 0:Y.errors)==null?void 0:U[t])==null?void 0:G.message,q=m||!!z;e.useEffect(()=>{const g=setTimeout(()=>{O(L)},E);return()=>clearTimeout(g)},[L,E]),e.useEffect(()=>{(k||p&&F.length===0)&&$(w?M:void 0)},[M,k]),e.useEffect(()=>{p===!0?$():Array.isArray(p)&&_(p)},[]);const $=async g=>{try{B(!0);const P=await a(g);_(P)}catch(P){console.error("Error loading options:",P),_([])}finally{B(!1)}};e.useEffect(()=>{const g=P=>{I.current&&!I.current.contains(P.target)&&(c(!1),y(!1),S(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]);const K=()=>{k||(c(!0),y(!0),w&&v.current&&setTimeout(()=>{var g;return(g=v.current)==null?void 0:g.focus()},0))},J=g=>{y(!0),b&&b(g)},D=g=>{C&&C(g)},Q=g=>{S(g.target.value)},Z=g=>{if(l&&t&&l.setValue(t,g),h.onChange){const P={target:{value:g}};h.onChange(P)}c(!1),y(!1),S("")},ee=g=>{if(g.stopPropagation(),l&&t&&l.setValue(t,""),h.onChange){const P={target:{value:""}};h.onChange(P)}c(!1),y(!1),S("")},j=F.find(g=>g.value===z),te=w&&k?L:(j==null?void 0:j.label)||"";return e.createElement("div",{className:o("relative",s),ref:I},e.createElement("div",{id:h.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":k,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",n),onClick:K,onFocus:w?void 0:J,onBlur:w?void 0:D,ref:d},w?e.createElement("input",{ref:v,type:"text",value:te,onChange:Q,onFocus:J,onBlur:D,placeholder:r?"":"Selecione...",className:o("w-full bg-transparent border-none outline-none text-sm",!z&&!L&&"text-gray-400")}):e.createElement("span",{className:o("block truncate",!z&&"text-gray-400")},(j==null?void 0:j.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)]"})),N&&z&&!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:ee},"✕")),r&&e.createElement("label",{htmlFor:h.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",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:F.length>3?"auto":"hidden"}},x?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):F.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},i):F.map(g=>e.createElement("div",{key:g.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",z===g.value&&"bg-blue-100"),onMouseDown:()=>Z(g.value)},g.label))),W&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},W))});ve.displayName="AsyncSelect";const xe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,isClearable:N,onFocus:p,onBlur:T,...i},w)=>{var O,I,v;const[E,b]=e.useState(!1),[C,h]=e.useState(!1),d=e.useRef(null),m=A.useFormContext(),y=m==null?void 0:m.control,k=y&&t?A.useWatch({control:y,name:t}):void 0,c=i.value??k??[],F=(v=(I=(O=m==null?void 0:m.formState)==null?void 0:O.errors)==null?void 0:I[t])==null?void 0:v.message,_=E||c&&c.length>0;e.useEffect(()=>{const l=f=>{d.current&&!d.current.contains(f.target)&&(h(!1),b(!1))};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]);const x=()=>{h(l=>!l),b(!0)},B=l=>{b(!0),p&&p(l)},L=l=>{T&&T(l)},S=l=>{var H;let f;c.includes(l)?f=c.filter(z=>z!==l):f=[...c,l],m&&t&&m.setValue(t,f),i.onChange&&((H=i.onChange)==null||H.call(i,{target:{value:f}})),b(!0)},M=l=>{var f;l.stopPropagation(),m&&t&&m.setValue(t,[]),i.onChange&&((f=i.onChange)==null||f.call(i,{target:{value:[]}})),h(!1),b(!1)};return e.createElement("div",{className:o("relative",s),ref:d},e.createElement("div",{id:i.id||t,tabIndex:0,role:"button","aria-haspopup":"listbox","aria-expanded":C,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",n),onClick:x,onFocus:B,onBlur:L,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"}},c&&c.length>0?a.filter(l=>c.includes(l.value)).map(l=>e.createElement("span",{key:l.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",style:{maxWidth:"140px"}},e.createElement("span",{className:"truncate",title:l.label},l.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${l.label}`,tabIndex:-1,onClick:f=>{f.stopPropagation();const H=c.filter(z=>z!==l.value);m&&t&&m.setValue(t,H),i.onChange&&i.onChange({target:{value:H}})}},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...")),N&&c&&c.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:M},"✕")),r&&e.createElement("label",{htmlFor:i.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",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:a.length>3?"auto":"hidden"}},a.map(l=>e.createElement("div",{key:l.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",c.includes(l.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>S(l.value)},e.createElement("input",{type:"checkbox",checked:c.includes(l.value),readOnly:!0,className:"accent-blue-500"}),l.label))),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});xe.displayName="MultiSelect";const ge=e.forwardRef(({name:t,label:r,loadOptions:a,className:n,containerClassName:s,isClearable:N,defaultOptions:p=!1,loadingMessage:T="Carregando...",noOptionsMessage:i="Nenhuma opção encontrada",searchable:w=!1,debounceMs:E=300,maxSelectedDisplay:b=3,onFocus:C,onBlur:h,...d},m)=>{var g,P,de;const[y,k]=e.useState(!1),[c,F]=e.useState(!1),[_,x]=e.useState([]),[B,L]=e.useState(!1),[S,M]=e.useState(""),[O,I]=e.useState(""),v=e.useRef(null),l=e.useRef(null),f=A.useFormContext(),H=f==null?void 0:f.control,z=H&&t?A.useWatch({control:H,name:t}):void 0,W=d.value??z??[],q=(de=(P=(g=f==null?void 0:f.formState)==null?void 0:g.errors)==null?void 0:P[t])==null?void 0:de.message,$=y||W&&W.length>0;e.useEffect(()=>{const u=setTimeout(()=>{I(S)},E);return()=>clearTimeout(u)},[S,E]),e.useEffect(()=>{(c||p&&_.length===0)&&K(w?O:void 0)},[O,c]),e.useEffect(()=>{p===!0?K():Array.isArray(p)&&x(p)},[]);const K=async u=>{try{L(!0);const V=await a(u);x(V)}catch(V){console.error("Error loading options:",V),x([])}finally{L(!1)}};e.useEffect(()=>{const u=V=>{v.current&&!v.current.contains(V.target)&&(F(!1),k(!1),M(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]);const J=()=>{c||(F(!0),k(!0),w&&l.current&&setTimeout(()=>{var u;return(u=l.current)==null?void 0:u.focus()},0))},D=u=>{k(!0),C&&C(u)},Q=u=>{h&&h(u)},Z=u=>{M(u.target.value)},ee=u=>{let V;W.includes(u)?V=W.filter(X=>X!==u):V=[...W,u],f&&t&&f.setValue(t,V),d.onChange&&d.onChange({target:{value:V}}),k(!0)},j=(u,V)=>{V.stopPropagation();const X=W.filter(ye=>ye!==u);f&&t&&f.setValue(t,X),d.onChange&&d.onChange({target:{value:X}})},te=u=>{u.stopPropagation(),f&&t&&f.setValue(t,[]),d.onChange&&d.onChange({target:{value:[]}}),F(!1),k(!1),M("")},Y=_.filter(u=>W.includes(u.value)),U=Y.slice(0,b),G=Y.length-b;return e.createElement("div",{className:o("relative",s),ref:v},e.createElement("div",{id:d.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":c,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",n),onClick:J,onFocus:w?void 0:D,onBlur:w?void 0:Q,ref:m},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},U.map(u=>e.createElement("span",{key:u.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",style:{maxWidth:"140px"}},e.createElement("span",{className:"truncate",title:u.label},u.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${u.label}`,tabIndex:-1,onClick:V=>j(u.value,V)},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:l,type:"text",value:S,onChange:Z,onFocus:D,onBlur:Q,placeholder:W.length===0&&!r?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):W.length===0&&!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),B&&e.createElement("div",{className:"absolute right-8 top-1/2 -translate-y-1/2"},e.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]"})),N&&W&&W.length>0&&!B&&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:d.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",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:_.length>3?"auto":"hidden"}},B?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):_.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},i):_.map(u=>e.createElement("div",{key:u.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",W.includes(u.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>ee(u.value)},e.createElement("input",{type:"checkbox",checked:W.includes(u.value),readOnly:!0,className:"accent-blue-500"}),u.label))),q&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},q))});ge.displayName="MultiAsyncSelect";const Ce={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},pe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,optionClassName:N,direction:p="row",size:T="md",onFocus:i,onBlur:w,...E},b)=>{var c,F,_;const C=A.useFormContext(),h=C==null?void 0:C.control,d=h&&t?A.useWatch({control:h,name:t}):void 0,m=E.value??d??"",y=(_=(F=(c=C==null?void 0:C.formState)==null?void 0:c.errors)==null?void 0:F[t])==null?void 0:_.message,k=x=>{C&&t&&C.setValue(t,x),E.onChange&&E.onChange({target:{value:x}})};return e.createElement("div",{className:o("relative",s),ref:b},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",p==="row"?"flex-row":"flex-col",n),"aria-label":r,tabIndex:-1,onFocus:i,onBlur:w},a.map(x=>e.createElement("button",{key:x.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)]",Ce[T],m===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",N),"aria-pressed":m===x.value,"data-selected":m===x.value,tabIndex:0,onClick:()=>k(x.value),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),k(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)))),y&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},y))});pe.displayName="RadioGroup";const ae=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,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),...n},t));ae.displayName="CardHeader";const re=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,className:o("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",r),...n},t));re.displayName="CardBody";const ne=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,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),...n},t));ne.displayName="CardFooter";const ke=R.forwardRef(({children:t,className:r,variant:a="default",size:n="md",padding:s="none",rounded:N="lg",...p},T)=>{const i={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"},w={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},E={none:"",sm:"p-3",md:"p-4",lg:"p-6"},b={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return R.createElement("div",{ref:T,className:o("flex flex-col","overflow-hidden",i[a],w[n],E[s],b[N],r),...p},t)}),Se=Object.assign(ke,{Header:ae,Body:re,Footer:ne}),he=R.forwardRef(({children:t,className:r,variant:a="default",size:n="md",responsive:s=!1,stickyHeader:N=!1,...p},T)=>{const i=o("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":a==="bordered"},{"text-sm":n==="sm","text-base":n==="md","text-lg":n==="lg"},r),w=o({"overflow-x-auto":s,"max-h-96 overflow-y-auto":N}),E=R.createElement("table",{ref:T,className:i,...p},t);return s||N?R.createElement("div",{className:w},E):E}),le=R.forwardRef(({children:t,className:r,as:a="thead",...n},s)=>R.createElement(a,{ref:s,className:o("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":a==="thead"},r),...n},t)),oe=R.forwardRef(({children:t,className:r,as:a="tbody",...n},s)=>R.createElement(a,{ref:s,className:o("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",r),...n},t)),se=R.forwardRef(({children:t,className:r,as:a="tfoot",...n},s)=>R.createElement(a,{ref:s,className:o("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",r),...n},t)),ce=R.forwardRef(({children:t,className:r,variant:a="default",...n},s)=>R.createElement("tr",{ref:s,className:o("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":a==="hover","bg-[var(--table-row-selected)]":a==="selected"},r),...n},t)),ie=R.forwardRef(({children:t,className:r,as:a="td",align:n="left",scope:s,colSpan:N,rowSpan:p,...T},i)=>R.createElement(a,{ref:i,scope:a==="th"?s:void 0,colSpan:N,rowSpan:p,className:o("px-4 py-3 text-left",{"font-semibold":a==="th","text-sm":a==="td","text-center":n==="center","text-right":n==="right"},r),...T},t));he.displayName="Table";le.displayName="TableHeader";oe.displayName="TableBody";se.displayName="TableFooter";ce.displayName="TableRow";ie.displayName="TableCell";const Fe=Object.assign(he,{Header:le,Body:oe,Footer:se,Row:ce,Cell:ie});exports.AsyncSelect=ve;exports.Button=Ne;exports.Card=Se;exports.CardBody=re;exports.CardFooter=ne;exports.CardHeader=ae;exports.Input=me;exports.MultiAsyncSelect=ge;exports.MultiSelect=xe;exports.RadioGroup=pe;exports.Select=fe;exports.Table=Fe;exports.TableBody=oe;exports.TableCell=ie;exports.TableFooter=se;exports.TableHeader=le;exports.TableRow=ce;exports.Textarea=be;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),A=require("react-hook-form");function we(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return r.default=t,Object.freeze(r)}const e=we(R);function ue(t){var r,a,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(a=ue(t[r]))&&(n&&(n+=" "),n+=a)}else for(a in t)t[a]&&(n&&(n+=" "),n+=a);return n}function Ee(){for(var t,r,a=0,n="",s=arguments.length;a<s;a++)(t=arguments[a])&&(r=ue(t))&&(n&&(n+=" "),n+=r);return n}function o(...t){return Ee(...t)}const Ne=({children:t,variant:r="default",className:a="",...n})=>{const s="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.createElement("button",{className:o(s,C[r],a),...n},t)},me=e.forwardRef(({name:t,className:r,type:a="text",label:n,onFocus:s,onBlur:C,Icon:p,iconClassName:T,iconAction:i,containerClassName:w,...E},b)=>{var I,v,l;const[N,h]=e.useState(!1),[d,m]=e.useState(!1),y=A.useFormContext(),k=y==null?void 0:y.control,c=y==null?void 0:y.register,F=k&&t?A.useWatch({control:k,name:t}):void 0,_=E.value??F??"",x=(l=(v=(I=y==null?void 0:y.formState)==null?void 0:I.errors)==null?void 0:v[t])==null?void 0:l.message,B=N||!!_,L=a==="password"?d?"text":"password":a,S=()=>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"})),M=()=>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"})),O=()=>{m(!d)};return e.createElement("div",{className:o("relative",w)},e.createElement("input",{id:E.id||t,type:L,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",a==="password"||p?"pr-12":"",r),onFocus:f=>{h(!0),s&&s(f)},...y&&t?(()=>{const f=c(t),H=f.onBlur;return{...f,ref:z=>{typeof b=="function"?b(z):b&&(b.current=z),f.ref&&f.ref(z)},onBlur:z=>{h(!1),C&&C(z),H&&H(z)}}})():{ref:b,onBlur:f=>{h(!1),C&&C(f)}},...E}),n&&e.createElement("label",{htmlFor:E.id||t,className:o("absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",B?"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white":"top-3 scale-100 translate-y-0.5")},n),a==="password"&&e.createElement("button",{type:"button",className:"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",onClick:O,"aria-label":d?"Esconder senha":"Mostrar senha",tabIndex:-1},d?e.createElement(M,null):e.createElement(S,null)),p&&a!=="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",T),onClick:i},e.createElement(p,null)),x&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},x))});me.displayName="Input";const fe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,isClearable:C,onFocus:p,onBlur:T,...i},w)=>{var S,M,O,I;const[E,b]=e.useState(!1),[N,h]=e.useState(!1),d=e.useRef(null),m=A.useFormContext(),y=m==null?void 0:m.control,k=y&&t?A.useWatch({control:y,name:t}):void 0,c=i.value??k??"",F=(O=(M=(S=m==null?void 0:m.formState)==null?void 0:S.errors)==null?void 0:M[t])==null?void 0:O.message,_=E||!!c;e.useEffect(()=>{const v=l=>{d.current&&!d.current.contains(l.target)&&(h(!1),b(!1))};return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[]);const x=()=>{h(v=>!v),b(!0)},B=v=>{b(!0),p&&p(v)},L=v=>{T&&T(v)};return e.createElement("div",{className:o("relative",s),ref:d},e.createElement("div",{id:i.id||t,tabIndex: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",n),onClick:x,onFocus:B,onBlur:L,ref:w},e.createElement("span",{className:o("block truncate",!c&&"text-gray-400")},((I=a.find(v=>v.value===c))==null?void 0:I.label)||!r&&"Selecione..."),C&&c&&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:v=>{if(v.stopPropagation(),m&&t&&m.setValue(t,""),i.onChange){const l={target:{value:""}};i.onChange(l)}h(!1),b(!1)}},"✕")),r&&e.createElement("label",{htmlFor:i.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",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:a.length>3?"auto":"hidden"}},a.map(v=>e.createElement("div",{key:v.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",c===v.value&&"bg-blue-100"),onMouseDown:()=>{if(m&&t&&m.setValue(t,v.value),i.onChange){const l={target:{value:v.value}};i.onChange(l)}b(!0)}},v.label))),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});fe.displayName="Select";const be=e.forwardRef(({name:t,className:r,label:a,onFocus:n,onBlur:s,Icon:C,iconClassName:p,iconAction:T,containerClassName:i,rows:w=4,...E},b)=>{var x,B,L;const[N,h]=e.useState(!1),d=A.useFormContext(),m=d==null?void 0:d.control,y=d==null?void 0:d.register,k=m&&t?A.useWatch({control:m,name:t}):void 0,c=E.value??k??"",F=(L=(B=(x=d==null?void 0:d.formState)==null?void 0:x.errors)==null?void 0:B[t])==null?void 0:L.message,_=N||!!c;return e.createElement("div",{className:o("relative",i)},e.createElement("textarea",{id:E.id||t,rows:w,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",C?"pr-12":"",r),onFocus:S=>{h(!0),n&&n(S)},...d&&t?(()=>{const S=y(t),M=S.onBlur;return{...S,ref:O=>{typeof b=="function"?b(O):b&&(b.current=O),S.ref&&S.ref(O)},onBlur:O=>{h(!1),s&&s(O),M&&M(O)}}})():{ref:b,onBlur:S=>{h(!1),s&&s(S)}},...E}),a&&e.createElement("label",{htmlFor:E.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")},a),C&&e.createElement("div",{className:o("absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",p),onClick:T},e.createElement(C,null)),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});be.displayName="Textarea";const ve=e.forwardRef(({name:t,label:r,loadOptions:a,className:n,containerClassName:s,isClearable:C,defaultOptions:p=!1,loadingMessage:T="Carregando...",noOptionsMessage:i="Nenhuma opção encontrada",searchable:w=!1,debounceMs:E=300,onFocus:b,onBlur:N,...h},d)=>{var Y,U,G;const[m,y]=e.useState(!1),[k,c]=e.useState(!1),[F,_]=e.useState([]),[x,B]=e.useState(!1),[L,S]=e.useState(""),[M,O]=e.useState(""),I=e.useRef(null),v=e.useRef(null),l=A.useFormContext(),f=l==null?void 0:l.control,H=f&&t?A.useWatch({control:f,name:t}):void 0,z=h.value??H??"",W=(G=(U=(Y=l==null?void 0:l.formState)==null?void 0:Y.errors)==null?void 0:U[t])==null?void 0:G.message,q=m||!!z;e.useEffect(()=>{const g=setTimeout(()=>{O(L)},E);return()=>clearTimeout(g)},[L,E]),e.useEffect(()=>{(k||p&&F.length===0)&&$(w?M:void 0)},[M,k]),e.useEffect(()=>{p===!0?$():Array.isArray(p)&&_(p)},[]);const $=async g=>{try{B(!0);const P=await a(g);_(P)}catch(P){console.error("Error loading options:",P),_([])}finally{B(!1)}};e.useEffect(()=>{const g=P=>{I.current&&!I.current.contains(P.target)&&(c(!1),y(!1),S(""))};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]);const K=()=>{k||(c(!0),y(!0),w&&v.current&&setTimeout(()=>{var g;return(g=v.current)==null?void 0:g.focus()},0))},J=g=>{y(!0),b&&b(g)},D=g=>{N&&N(g)},Q=g=>{S(g.target.value)},Z=g=>{if(l&&t&&l.setValue(t,g),h.onChange){const P={target:{value:g}};h.onChange(P)}c(!1),y(!1),S("")},ee=g=>{if(g.stopPropagation(),l&&t&&l.setValue(t,""),h.onChange){const P={target:{value:""}};h.onChange(P)}c(!1),y(!1),S("")},j=F.find(g=>g.value===z),te=w&&k?L:(j==null?void 0:j.label)||"";return e.createElement("div",{className:o("relative",s),ref:I},e.createElement("div",{id:h.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":k,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",n),onClick:K,onFocus:w?void 0:J,onBlur:w?void 0:D,ref:d},w?e.createElement("input",{ref:v,type:"text",value:te,onChange:Q,onFocus:J,onBlur:D,placeholder:r?"":"Selecione...",className:o("w-full bg-transparent border-none outline-none text-sm",!z&&!L&&"text-gray-400")}):e.createElement("span",{className:o("block truncate",!z&&"text-gray-400")},(j==null?void 0:j.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)]"})),C&&z&&!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:ee},"✕")),r&&e.createElement("label",{htmlFor:h.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",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:F.length>3?"auto":"hidden"}},x?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):F.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},i):F.map(g=>e.createElement("div",{key:g.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm",z===g.value&&"bg-blue-100"),onMouseDown:()=>Z(g.value)},g.label))),W&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},W))});ve.displayName="AsyncSelect";const xe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,isClearable:C,onFocus:p,onBlur:T,...i},w)=>{var O,I,v;const[E,b]=e.useState(!1),[N,h]=e.useState(!1),d=e.useRef(null),m=A.useFormContext(),y=m==null?void 0:m.control,k=y&&t?A.useWatch({control:y,name:t}):void 0,c=i.value??k??[],F=(v=(I=(O=m==null?void 0:m.formState)==null?void 0:O.errors)==null?void 0:I[t])==null?void 0:v.message,_=E||c&&c.length>0;e.useEffect(()=>{const l=f=>{d.current&&!d.current.contains(f.target)&&(h(!1),b(!1))};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]);const x=()=>{h(l=>!l),b(!0)},B=l=>{b(!0),p&&p(l)},L=l=>{T&&T(l)},S=l=>{var H;let f;c.includes(l)?f=c.filter(z=>z!==l):f=[...c,l],m&&t&&m.setValue(t,f),i.onChange&&((H=i.onChange)==null||H.call(i,{target:{value:f}})),b(!0)},M=l=>{var f;l.stopPropagation(),m&&t&&m.setValue(t,[]),i.onChange&&((f=i.onChange)==null||f.call(i,{target:{value:[]}})),h(!1),b(!1)};return e.createElement("div",{className:o("relative",s),ref:d},e.createElement("div",{id:i.id||t,tabIndex: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",n),onClick:x,onFocus:B,onBlur:L,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"}},c&&c.length>0?a.filter(l=>c.includes(l.value)).map(l=>e.createElement("span",{key:l.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",style:{maxWidth:"140px"}},e.createElement("span",{className:"truncate",title:l.label},l.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${l.label}`,tabIndex:-1,onClick:f=>{f.stopPropagation();const H=c.filter(z=>z!==l.value);m&&t&&m.setValue(t,H),i.onChange&&i.onChange({target:{value:H}})}},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...")),C&&c&&c.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:M},"✕")),r&&e.createElement("label",{htmlFor:i.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",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:a.length>3?"auto":"hidden"}},a.map(l=>e.createElement("div",{key:l.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",c.includes(l.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>S(l.value)},e.createElement("input",{type:"checkbox",checked:c.includes(l.value),readOnly:!0,className:"accent-blue-500"}),l.label))),F&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},F))});xe.displayName="MultiSelect";const ge=e.forwardRef(({name:t,label:r,loadOptions:a,className:n,containerClassName:s,isClearable:C,defaultOptions:p=!1,loadingMessage:T="Carregando...",noOptionsMessage:i="Nenhuma opção encontrada",searchable:w=!1,debounceMs:E=300,maxSelectedDisplay:b=3,onFocus:N,onBlur:h,...d},m)=>{var g,P,de;const[y,k]=e.useState(!1),[c,F]=e.useState(!1),[_,x]=e.useState([]),[B,L]=e.useState(!1),[S,M]=e.useState(""),[O,I]=e.useState(""),v=e.useRef(null),l=e.useRef(null),f=A.useFormContext(),H=f==null?void 0:f.control,z=H&&t?A.useWatch({control:H,name:t}):void 0,W=d.value??z??[],q=(de=(P=(g=f==null?void 0:f.formState)==null?void 0:g.errors)==null?void 0:P[t])==null?void 0:de.message,$=y||W&&W.length>0;e.useEffect(()=>{const u=setTimeout(()=>{I(S)},E);return()=>clearTimeout(u)},[S,E]),e.useEffect(()=>{(c||p&&_.length===0)&&K(w?O:void 0)},[O,c]),e.useEffect(()=>{p===!0?K():Array.isArray(p)&&x(p)},[]);const K=async u=>{try{L(!0);const V=await a(u);x(V)}catch(V){console.error("Error loading options:",V),x([])}finally{L(!1)}};e.useEffect(()=>{const u=V=>{v.current&&!v.current.contains(V.target)&&(F(!1),k(!1),M(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]);const J=()=>{c||(F(!0),k(!0),w&&l.current&&setTimeout(()=>{var u;return(u=l.current)==null?void 0:u.focus()},0))},D=u=>{k(!0),N&&N(u)},Q=u=>{h&&h(u)},Z=u=>{M(u.target.value)},ee=u=>{let V;W.includes(u)?V=W.filter(X=>X!==u):V=[...W,u],f&&t&&f.setValue(t,V),d.onChange&&d.onChange({target:{value:V}}),k(!0)},j=(u,V)=>{V.stopPropagation();const X=W.filter(ye=>ye!==u);f&&t&&f.setValue(t,X),d.onChange&&d.onChange({target:{value:X}})},te=u=>{u.stopPropagation(),f&&t&&f.setValue(t,[]),d.onChange&&d.onChange({target:{value:[]}}),F(!1),k(!1),M("")},Y=_.filter(u=>W.includes(u.value)),U=Y.slice(0,b),G=Y.length-b;return e.createElement("div",{className:o("relative",s),ref:v},e.createElement("div",{id:d.id||t,tabIndex:w?-1:0,role:"button","aria-haspopup":"listbox","aria-expanded":c,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",n),onClick:J,onFocus:w?void 0:D,onBlur:w?void 0:Q,ref:m},e.createElement("div",{className:"flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full"},U.map(u=>e.createElement("span",{key:u.value,className:"flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",style:{maxWidth:"140px"}},e.createElement("span",{className:"truncate",title:u.label},u.label),e.createElement("button",{type:"button",className:"ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150","aria-label":`Remover ${u.label}`,tabIndex:-1,onClick:V=>j(u.value,V)},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:l,type:"text",value:S,onChange:Z,onFocus:D,onBlur:Q,placeholder:W.length===0&&!r?"Selecione...":"",className:"flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"}):W.length===0&&!r&&e.createElement("span",{className:"text-gray-400 text-sm"},"Selecione...")),B&&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)]"})),C&&W&&W.length>0&&!B&&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:d.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",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:_.length>3?"auto":"hidden"}},B?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},T):_.length===0?e.createElement("div",{className:"px-3 py-2 text-sm text-gray-500 text-center"},i):_.map(u=>e.createElement("div",{key:u.value,className:o("px-3 py-2 cursor-pointer hover:bg-blue-50 text-sm flex items-center gap-2",W.includes(u.value)&&"bg-blue-100 font-semibold"),onMouseDown:()=>ee(u.value)},e.createElement("input",{type:"checkbox",checked:W.includes(u.value),readOnly:!0,className:"accent-blue-500"}),u.label))),q&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},q))});ge.displayName="MultiAsyncSelect";const Ce={sm:"h-10 text-sm px-3",md:"h-12 text-base px-4",lg:"h-16 text-lg px-6"},pe=e.forwardRef(({name:t,label:r,options:a,className:n,containerClassName:s,optionClassName:C,direction:p="row",size:T="md",onFocus:i,onBlur:w,...E},b)=>{var c,F,_;const N=A.useFormContext(),h=N==null?void 0:N.control,d=h&&t?A.useWatch({control:h,name:t}):void 0,m=E.value??d??"",y=(_=(F=(c=N==null?void 0:N.formState)==null?void 0:c.errors)==null?void 0:F[t])==null?void 0:_.message,k=x=>{N&&t&&N.setValue(t,x),E.onChange&&E.onChange({target:{value:x}})};return e.createElement("div",{className:o("relative",s),ref:b},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",p==="row"?"flex-row":"flex-col",n),"aria-label":r,tabIndex:-1,onFocus:i,onBlur:w},a.map(x=>e.createElement("button",{key:x.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)]",Ce[T],m===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",C),"aria-pressed":m===x.value,"data-selected":m===x.value,tabIndex:0,onClick:()=>k(x.value),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),k(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)))),y&&e.createElement("span",{className:"text-red-500 text-xs mt-1 block"},y))});pe.displayName="RadioGroup";const ae=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,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),...n},t));ae.displayName="CardHeader";const re=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,className:o("px-6 py-4","flex-1","bg-[var(--card-bg,#ffffff)]","text-[var(--card-text,#111827)]",r),...n},t));re.displayName="CardBody";const ne=R.forwardRef(({children:t,className:r,as:a="div",...n},s)=>R.createElement(a,{ref:s,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),...n},t));ne.displayName="CardFooter";const ke=R.forwardRef(({children:t,className:r,variant:a="default",size:n="md",padding:s="none",rounded:C="lg",constrainWidth:p=!1,...T},i)=>{const w={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"},E={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},b={none:"",sm:"p-3",md:"p-4",lg:"p-6"},N={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl"};return R.createElement("div",{ref:i,className:o("flex flex-col","overflow-hidden",w[a],p&&E[n],b[s],N[C],r),...T},t)}),Se=Object.assign(ke,{Header:ae,Body:re,Footer:ne}),he=R.forwardRef(({children:t,className:r,variant:a="default",size:n="md",responsive:s=!1,stickyHeader:C=!1,...p},T)=>{const i=o("w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",{"border border-[var(--table-border)]":a==="bordered"},{"text-sm":n==="sm","text-base":n==="md","text-lg":n==="lg"},r),w=o({"overflow-x-auto":s,"max-h-96 overflow-y-auto":C}),E=R.createElement("table",{ref:T,className:i,...p},t);return s||C?R.createElement("div",{className:w},E):E}),le=R.forwardRef(({children:t,className:r,as:a="thead",...n},s)=>R.createElement(a,{ref:s,className:o("border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",{"sticky top-0 z-10":a==="thead"},r),...n},t)),oe=R.forwardRef(({children:t,className:r,as:a="tbody",...n},s)=>R.createElement(a,{ref:s,className:o("[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]","[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",r),...n},t)),se=R.forwardRef(({children:t,className:r,as:a="tfoot",...n},s)=>R.createElement(a,{ref:s,className:o("border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",r),...n},t)),ce=R.forwardRef(({children:t,className:r,variant:a="default",...n},s)=>R.createElement("tr",{ref:s,className:o("border-b border-[var(--table-border)] transition-colors",{"hover:bg-[var(--table-row-hover)]":a==="hover","bg-[var(--table-row-selected)]":a==="selected"},r),...n},t)),ie=R.forwardRef(({children:t,className:r,as:a="td",align:n="left",scope:s,colSpan:C,rowSpan:p,...T},i)=>R.createElement(a,{ref:i,scope:a==="th"?s:void 0,colSpan:C,rowSpan:p,className:o("px-4 py-3 text-left",{"font-semibold":a==="th","text-sm":a==="td","text-center":n==="center","text-right":n==="right"},r),...T},t));he.displayName="Table";le.displayName="TableHeader";oe.displayName="TableBody";se.displayName="TableFooter";ce.displayName="TableRow";ie.displayName="TableCell";const Fe=Object.assign(he,{Header:le,Body:oe,Footer:se,Row:ce,Cell:ie});exports.AsyncSelect=ve;exports.Button=Ne;exports.Card=Se;exports.CardBody=re;exports.CardFooter=ne;exports.CardHeader=ae;exports.Input=me;exports.MultiAsyncSelect=ge;exports.MultiSelect=xe;exports.RadioGroup=pe;exports.Select=fe;exports.Table=Fe;exports.TableBody=oe;exports.TableCell=ie;exports.TableFooter=se;exports.TableHeader=le;exports.TableRow=ce;exports.Textarea=be;
|
package/dist/rharuow-ds.es.js
CHANGED
|
@@ -23,12 +23,12 @@ const Re = ({
|
|
|
23
23
|
className: a = "",
|
|
24
24
|
...n
|
|
25
25
|
}) => {
|
|
26
|
-
const s = "px-4 py-2 rounded font-medium transition",
|
|
26
|
+
const s = "px-4 py-2 rounded font-medium transition", C = {
|
|
27
27
|
default: "bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",
|
|
28
28
|
outline: "border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",
|
|
29
29
|
secondary: "bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"
|
|
30
30
|
};
|
|
31
|
-
return /* @__PURE__ */ F.createElement("button", { className: o(s,
|
|
31
|
+
return /* @__PURE__ */ F.createElement("button", { className: o(s, C[r], a), ...n }, t);
|
|
32
32
|
}, xe = e.forwardRef(
|
|
33
33
|
({
|
|
34
34
|
name: t,
|
|
@@ -36,7 +36,7 @@ const Re = ({
|
|
|
36
36
|
type: a = "text",
|
|
37
37
|
label: n,
|
|
38
38
|
onFocus: s,
|
|
39
|
-
onBlur:
|
|
39
|
+
onBlur: C,
|
|
40
40
|
Icon: p,
|
|
41
41
|
iconClassName: _,
|
|
42
42
|
iconAction: i,
|
|
@@ -44,7 +44,7 @@ const Re = ({
|
|
|
44
44
|
...E
|
|
45
45
|
}, b) => {
|
|
46
46
|
var V, v, l;
|
|
47
|
-
const [
|
|
47
|
+
const [N, h] = e.useState(!1), [d, m] = e.useState(!1), y = j(), k = y == null ? void 0 : y.control, c = y == null ? void 0 : y.register, R = k && t ? D({ control: k, name: t }) : void 0, T = E.value ?? R ?? "", x = (l = (v = (V = y == null ? void 0 : y.formState) == null ? void 0 : V.errors) == null ? void 0 : v[t]) == null ? void 0 : l.message, L = N || !!T, I = a === "password" ? d ? "text" : "password" : a, S = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
|
|
48
48
|
"path",
|
|
49
49
|
{
|
|
50
50
|
d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",
|
|
@@ -81,13 +81,13 @@ const Re = ({
|
|
|
81
81
|
typeof b == "function" ? b(B) : b && (b.current = B), f.ref && f.ref(B);
|
|
82
82
|
},
|
|
83
83
|
onBlur: (B) => {
|
|
84
|
-
h(!1),
|
|
84
|
+
h(!1), C && C(B), A && A(B);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
})() : {
|
|
88
88
|
ref: b,
|
|
89
89
|
onBlur: (f) => {
|
|
90
|
-
h(!1),
|
|
90
|
+
h(!1), C && C(f);
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
...E
|
|
@@ -133,13 +133,13 @@ const ge = e.forwardRef(
|
|
|
133
133
|
options: a,
|
|
134
134
|
className: n,
|
|
135
135
|
containerClassName: s,
|
|
136
|
-
isClearable:
|
|
136
|
+
isClearable: C,
|
|
137
137
|
onFocus: p,
|
|
138
138
|
onBlur: _,
|
|
139
139
|
...i
|
|
140
140
|
}, w) => {
|
|
141
141
|
var S, M, z, V;
|
|
142
|
-
const [E, b] = e.useState(!1), [
|
|
142
|
+
const [E, b] = e.useState(!1), [N, h] = e.useState(!1), d = e.useRef(null), m = j(), y = m == null ? void 0 : m.control, k = y && t ? D({ control: y, name: t }) : void 0, c = i.value ?? k ?? "", R = (z = (M = (S = m == null ? void 0 : m.formState) == null ? void 0 : S.errors) == null ? void 0 : M[t]) == null ? void 0 : z.message, T = E || !!c;
|
|
143
143
|
e.useEffect(() => {
|
|
144
144
|
const v = (l) => {
|
|
145
145
|
d.current && !d.current.contains(l.target) && (h(!1), b(!1));
|
|
@@ -162,7 +162,7 @@ const ge = e.forwardRef(
|
|
|
162
162
|
tabIndex: 0,
|
|
163
163
|
role: "button",
|
|
164
164
|
"aria-haspopup": "listbox",
|
|
165
|
-
"aria-expanded":
|
|
165
|
+
"aria-expanded": N,
|
|
166
166
|
className: o(
|
|
167
167
|
"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",
|
|
168
168
|
n
|
|
@@ -173,7 +173,7 @@ const ge = e.forwardRef(
|
|
|
173
173
|
ref: w
|
|
174
174
|
},
|
|
175
175
|
/* @__PURE__ */ e.createElement("span", { className: o("block truncate", !c && "text-gray-400") }, ((V = a.find((v) => v.value === c)) == null ? void 0 : V.label) || !r && "Selecione..."),
|
|
176
|
-
|
|
176
|
+
C && c && /* @__PURE__ */ e.createElement(
|
|
177
177
|
"button",
|
|
178
178
|
{
|
|
179
179
|
type: "button",
|
|
@@ -207,10 +207,10 @@ const ge = e.forwardRef(
|
|
|
207
207
|
{
|
|
208
208
|
className: o(
|
|
209
209
|
"absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",
|
|
210
|
-
|
|
210
|
+
N ? "border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
211
211
|
),
|
|
212
212
|
style: {
|
|
213
|
-
maxHeight:
|
|
213
|
+
maxHeight: N ? "9.5rem" : "0",
|
|
214
214
|
// 3 options * 2.5rem + padding
|
|
215
215
|
overflowY: a.length > 3 ? "auto" : "hidden"
|
|
216
216
|
}
|
|
@@ -246,7 +246,7 @@ const pe = e.forwardRef(
|
|
|
246
246
|
label: a,
|
|
247
247
|
onFocus: n,
|
|
248
248
|
onBlur: s,
|
|
249
|
-
Icon:
|
|
249
|
+
Icon: C,
|
|
250
250
|
iconClassName: p,
|
|
251
251
|
iconAction: _,
|
|
252
252
|
containerClassName: i,
|
|
@@ -254,7 +254,7 @@ const pe = e.forwardRef(
|
|
|
254
254
|
...E
|
|
255
255
|
}, b) => {
|
|
256
256
|
var x, L, I;
|
|
257
|
-
const [
|
|
257
|
+
const [N, h] = e.useState(!1), d = j(), m = d == null ? void 0 : d.control, y = d == null ? void 0 : d.register, k = m && t ? D({ control: m, name: t }) : void 0, c = E.value ?? k ?? "", R = (I = (L = (x = d == null ? void 0 : d.formState) == null ? void 0 : x.errors) == null ? void 0 : L[t]) == null ? void 0 : I.message, T = N || !!c;
|
|
258
258
|
return /* @__PURE__ */ e.createElement("div", { className: o("relative", i) }, /* @__PURE__ */ e.createElement(
|
|
259
259
|
"textarea",
|
|
260
260
|
{
|
|
@@ -262,7 +262,7 @@ const pe = e.forwardRef(
|
|
|
262
262
|
rows: w,
|
|
263
263
|
className: o(
|
|
264
264
|
"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",
|
|
265
|
-
|
|
265
|
+
C ? "pr-12" : "",
|
|
266
266
|
// espaço extra para ícone customizado
|
|
267
267
|
r
|
|
268
268
|
),
|
|
@@ -298,7 +298,7 @@ const pe = e.forwardRef(
|
|
|
298
298
|
)
|
|
299
299
|
},
|
|
300
300
|
a
|
|
301
|
-
),
|
|
301
|
+
), C && /* @__PURE__ */ e.createElement(
|
|
302
302
|
"div",
|
|
303
303
|
{
|
|
304
304
|
className: o(
|
|
@@ -307,7 +307,7 @@ const pe = e.forwardRef(
|
|
|
307
307
|
),
|
|
308
308
|
onClick: _
|
|
309
309
|
},
|
|
310
|
-
/* @__PURE__ */ e.createElement(
|
|
310
|
+
/* @__PURE__ */ e.createElement(C, null)
|
|
311
311
|
), R && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, R));
|
|
312
312
|
}
|
|
313
313
|
);
|
|
@@ -319,14 +319,14 @@ const he = e.forwardRef(
|
|
|
319
319
|
loadOptions: a,
|
|
320
320
|
className: n,
|
|
321
321
|
containerClassName: s,
|
|
322
|
-
isClearable:
|
|
322
|
+
isClearable: C,
|
|
323
323
|
defaultOptions: p = !1,
|
|
324
324
|
loadingMessage: _ = "Carregando...",
|
|
325
325
|
noOptionsMessage: i = "Nenhuma opção encontrada",
|
|
326
326
|
searchable: w = !1,
|
|
327
327
|
debounceMs: E = 300,
|
|
328
328
|
onFocus: b,
|
|
329
|
-
onBlur:
|
|
329
|
+
onBlur: N,
|
|
330
330
|
...h
|
|
331
331
|
}, d) => {
|
|
332
332
|
var G, X, $;
|
|
@@ -368,7 +368,7 @@ const he = e.forwardRef(
|
|
|
368
368
|
}, Q = (g) => {
|
|
369
369
|
y(!0), b && b(g);
|
|
370
370
|
}, Y = (g) => {
|
|
371
|
-
|
|
371
|
+
N && N(g);
|
|
372
372
|
}, U = (g) => {
|
|
373
373
|
S(g.target.value);
|
|
374
374
|
}, ee = (g) => {
|
|
@@ -422,7 +422,7 @@ const he = e.forwardRef(
|
|
|
422
422
|
}
|
|
423
423
|
) : /* @__PURE__ */ e.createElement("span", { className: o("block truncate", !B && "text-gray-400") }, (P == null ? void 0 : P.label) || !r && "Selecione..."),
|
|
424
424
|
x && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
|
|
425
|
-
|
|
425
|
+
C && B && !x && /* @__PURE__ */ e.createElement(
|
|
426
426
|
"button",
|
|
427
427
|
{
|
|
428
428
|
type: "button",
|
|
@@ -478,13 +478,13 @@ const ye = e.forwardRef(
|
|
|
478
478
|
options: a,
|
|
479
479
|
className: n,
|
|
480
480
|
containerClassName: s,
|
|
481
|
-
isClearable:
|
|
481
|
+
isClearable: C,
|
|
482
482
|
onFocus: p,
|
|
483
483
|
onBlur: _,
|
|
484
484
|
...i
|
|
485
485
|
}, w) => {
|
|
486
486
|
var z, V, v;
|
|
487
|
-
const [E, b] = e.useState(!1), [
|
|
487
|
+
const [E, b] = e.useState(!1), [N, h] = e.useState(!1), d = e.useRef(null), m = j(), y = m == null ? void 0 : m.control, k = y && t ? D({ control: y, name: t }) : void 0, c = i.value ?? k ?? [], R = (v = (V = (z = m == null ? void 0 : m.formState) == null ? void 0 : z.errors) == null ? void 0 : V[t]) == null ? void 0 : v.message, T = E || c && c.length > 0;
|
|
488
488
|
e.useEffect(() => {
|
|
489
489
|
const l = (f) => {
|
|
490
490
|
d.current && !d.current.contains(f.target) && (h(!1), b(!1));
|
|
@@ -518,7 +518,7 @@ const ye = e.forwardRef(
|
|
|
518
518
|
tabIndex: 0,
|
|
519
519
|
role: "button",
|
|
520
520
|
"aria-haspopup": "listbox",
|
|
521
|
-
"aria-expanded":
|
|
521
|
+
"aria-expanded": N,
|
|
522
522
|
className: o(
|
|
523
523
|
"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",
|
|
524
524
|
n
|
|
@@ -579,7 +579,7 @@ const ye = e.forwardRef(
|
|
|
579
579
|
)
|
|
580
580
|
)) : !r && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")
|
|
581
581
|
),
|
|
582
|
-
|
|
582
|
+
C && c && c.length > 0 && /* @__PURE__ */ e.createElement(
|
|
583
583
|
"button",
|
|
584
584
|
{
|
|
585
585
|
type: "button",
|
|
@@ -605,10 +605,10 @@ const ye = e.forwardRef(
|
|
|
605
605
|
{
|
|
606
606
|
className: o(
|
|
607
607
|
"absolute left-0 w-full mt-1 rounded-md shadow-lg bg-white z-20 transition-all duration-200 overflow-hidden",
|
|
608
|
-
|
|
608
|
+
N ? "border border-[var(--primary,#2563eb)] max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
609
609
|
),
|
|
610
610
|
style: {
|
|
611
|
-
maxHeight:
|
|
611
|
+
maxHeight: N ? "9.5rem" : "0",
|
|
612
612
|
overflowY: a.length > 3 ? "auto" : "hidden"
|
|
613
613
|
}
|
|
614
614
|
},
|
|
@@ -644,14 +644,14 @@ const we = e.forwardRef(
|
|
|
644
644
|
loadOptions: a,
|
|
645
645
|
className: n,
|
|
646
646
|
containerClassName: s,
|
|
647
|
-
isClearable:
|
|
647
|
+
isClearable: C,
|
|
648
648
|
defaultOptions: p = !1,
|
|
649
649
|
loadingMessage: _ = "Carregando...",
|
|
650
650
|
noOptionsMessage: i = "Nenhuma opção encontrada",
|
|
651
651
|
searchable: w = !1,
|
|
652
652
|
debounceMs: E = 300,
|
|
653
653
|
maxSelectedDisplay: b = 3,
|
|
654
|
-
onFocus:
|
|
654
|
+
onFocus: N,
|
|
655
655
|
onBlur: h,
|
|
656
656
|
...d
|
|
657
657
|
}, m) => {
|
|
@@ -692,7 +692,7 @@ const we = e.forwardRef(
|
|
|
692
692
|
return (u = l.current) == null ? void 0 : u.focus();
|
|
693
693
|
}, 0));
|
|
694
694
|
}, Y = (u) => {
|
|
695
|
-
k(!0),
|
|
695
|
+
k(!0), N && N(u);
|
|
696
696
|
}, U = (u) => {
|
|
697
697
|
h && h(u);
|
|
698
698
|
}, ee = (u) => {
|
|
@@ -781,7 +781,7 @@ const we = e.forwardRef(
|
|
|
781
781
|
}
|
|
782
782
|
) : O.length === 0 && !r && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")),
|
|
783
783
|
L && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
|
|
784
|
-
|
|
784
|
+
C && O && O.length > 0 && !L && /* @__PURE__ */ e.createElement(
|
|
785
785
|
"button",
|
|
786
786
|
{
|
|
787
787
|
type: "button",
|
|
@@ -850,7 +850,7 @@ const Ee = {
|
|
|
850
850
|
options: a,
|
|
851
851
|
className: n,
|
|
852
852
|
containerClassName: s,
|
|
853
|
-
optionClassName:
|
|
853
|
+
optionClassName: C,
|
|
854
854
|
direction: p = "row",
|
|
855
855
|
size: _ = "md",
|
|
856
856
|
onFocus: i,
|
|
@@ -858,8 +858,8 @@ const Ee = {
|
|
|
858
858
|
...E
|
|
859
859
|
}, b) => {
|
|
860
860
|
var c, R, T;
|
|
861
|
-
const
|
|
862
|
-
|
|
861
|
+
const N = j(), h = N == null ? void 0 : N.control, d = h && t ? D({ control: h, name: t }) : void 0, m = E.value ?? d ?? "", y = (T = (R = (c = N == null ? void 0 : N.formState) == null ? void 0 : c.errors) == null ? void 0 : R[t]) == null ? void 0 : T.message, k = (x) => {
|
|
862
|
+
N && t && N.setValue(t, x), E.onChange && E.onChange({ target: { value: x } });
|
|
863
863
|
};
|
|
864
864
|
return /* @__PURE__ */ e.createElement("div", { className: o("relative", s), ref: b }, r && /* @__PURE__ */ e.createElement(
|
|
865
865
|
"label",
|
|
@@ -894,7 +894,7 @@ const Ee = {
|
|
|
894
894
|
"relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-hover,#dbeafe)]",
|
|
895
895
|
Ee[_],
|
|
896
896
|
m === x.value ? "border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]" : "border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",
|
|
897
|
-
|
|
897
|
+
C
|
|
898
898
|
),
|
|
899
899
|
"aria-pressed": m === x.value,
|
|
900
900
|
"data-selected": m === x.value,
|
|
@@ -974,24 +974,26 @@ const Ce = F.forwardRef(
|
|
|
974
974
|
size: n = "md",
|
|
975
975
|
padding: s = "none",
|
|
976
976
|
// none pois cada seção tem seu próprio padding
|
|
977
|
-
rounded:
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
977
|
+
rounded: C = "lg",
|
|
978
|
+
constrainWidth: p = !1,
|
|
979
|
+
// Por padrão, não aplicar max-width
|
|
980
|
+
..._
|
|
981
|
+
}, i) => {
|
|
982
|
+
const w = {
|
|
981
983
|
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))]",
|
|
982
984
|
outlined: "bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",
|
|
983
985
|
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))]",
|
|
984
986
|
flat: "bg-[var(--card-bg,#ffffff)] border-0"
|
|
985
|
-
},
|
|
987
|
+
}, E = {
|
|
986
988
|
sm: "max-w-sm",
|
|
987
989
|
md: "max-w-md",
|
|
988
990
|
lg: "max-w-lg"
|
|
989
|
-
},
|
|
991
|
+
}, b = {
|
|
990
992
|
none: "",
|
|
991
993
|
sm: "p-3",
|
|
992
994
|
md: "p-4",
|
|
993
995
|
lg: "p-6"
|
|
994
|
-
},
|
|
996
|
+
}, N = {
|
|
995
997
|
none: "rounded-none",
|
|
996
998
|
sm: "rounded-sm",
|
|
997
999
|
md: "rounded-md",
|
|
@@ -1001,19 +1003,20 @@ const Ce = F.forwardRef(
|
|
|
1001
1003
|
return /* @__PURE__ */ F.createElement(
|
|
1002
1004
|
"div",
|
|
1003
1005
|
{
|
|
1004
|
-
ref:
|
|
1006
|
+
ref: i,
|
|
1005
1007
|
className: o(
|
|
1006
1008
|
"flex flex-col",
|
|
1007
1009
|
// Flex column para organizar header, body, footer
|
|
1008
1010
|
"overflow-hidden",
|
|
1009
1011
|
// Para manter os borders radius das seções
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
b[
|
|
1012
|
+
w[a],
|
|
1013
|
+
p && E[n],
|
|
1014
|
+
// Aplicar max-width apenas se constrainWidth for true
|
|
1015
|
+
b[s],
|
|
1016
|
+
N[C],
|
|
1014
1017
|
r
|
|
1015
1018
|
),
|
|
1016
|
-
...
|
|
1019
|
+
..._
|
|
1017
1020
|
},
|
|
1018
1021
|
t
|
|
1019
1022
|
);
|
|
@@ -1029,7 +1032,7 @@ const Ce = F.forwardRef(
|
|
|
1029
1032
|
variant: a = "default",
|
|
1030
1033
|
size: n = "md",
|
|
1031
1034
|
responsive: s = !1,
|
|
1032
|
-
stickyHeader:
|
|
1035
|
+
stickyHeader: C = !1,
|
|
1033
1036
|
...p
|
|
1034
1037
|
}, _) => {
|
|
1035
1038
|
const i = o(
|
|
@@ -1049,7 +1052,7 @@ const Ce = F.forwardRef(
|
|
|
1049
1052
|
), w = o(
|
|
1050
1053
|
{
|
|
1051
1054
|
"overflow-x-auto": s,
|
|
1052
|
-
"max-h-96 overflow-y-auto":
|
|
1055
|
+
"max-h-96 overflow-y-auto": C
|
|
1053
1056
|
}
|
|
1054
1057
|
), E = /* @__PURE__ */ F.createElement(
|
|
1055
1058
|
"table",
|
|
@@ -1060,7 +1063,7 @@ const Ce = F.forwardRef(
|
|
|
1060
1063
|
},
|
|
1061
1064
|
t
|
|
1062
1065
|
);
|
|
1063
|
-
return s ||
|
|
1066
|
+
return s || C ? /* @__PURE__ */ F.createElement("div", { className: w }, E) : E;
|
|
1064
1067
|
}
|
|
1065
1068
|
), ie = F.forwardRef(
|
|
1066
1069
|
({ children: t, className: r, as: a = "thead", ...n }, s) => /* @__PURE__ */ F.createElement(
|
|
@@ -1129,7 +1132,7 @@ const Ce = F.forwardRef(
|
|
|
1129
1132
|
as: a = "td",
|
|
1130
1133
|
align: n = "left",
|
|
1131
1134
|
scope: s,
|
|
1132
|
-
colSpan:
|
|
1135
|
+
colSpan: C,
|
|
1133
1136
|
rowSpan: p,
|
|
1134
1137
|
..._
|
|
1135
1138
|
}, i) => /* @__PURE__ */ F.createElement(
|
|
@@ -1137,7 +1140,7 @@ const Ce = F.forwardRef(
|
|
|
1137
1140
|
{
|
|
1138
1141
|
ref: i,
|
|
1139
1142
|
scope: a === "th" ? s : void 0,
|
|
1140
|
-
colSpan:
|
|
1143
|
+
colSpan: C,
|
|
1141
1144
|
rowSpan: p,
|
|
1142
1145
|
className: o(
|
|
1143
1146
|
"px-4 py-3 text-left",
|
|
@@ -19,6 +19,7 @@ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
19
19
|
size?: 'sm' | 'md' | 'lg';
|
|
20
20
|
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
21
21
|
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
22
|
+
constrainWidth?: boolean;
|
|
22
23
|
}
|
|
23
24
|
declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
25
|
declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { StoryObj } from "@storybook/react";
|
|
2
3
|
declare const meta: {
|
|
3
4
|
title: string;
|
|
4
|
-
component:
|
|
5
|
-
Header:
|
|
6
|
-
Body:
|
|
7
|
-
Footer:
|
|
8
|
-
Row:
|
|
9
|
-
Cell:
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../components/Table").TableProps & React.RefAttributes<HTMLTableElement>> & {
|
|
6
|
+
Header: React.ForwardRefExoticComponent<import("../components/Table").TableHeaderProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
7
|
+
Body: React.ForwardRefExoticComponent<import("../components/Table").TableBodyProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
8
|
+
Footer: React.ForwardRefExoticComponent<import("../components/Table").TableFooterProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
9
|
+
Row: React.ForwardRefExoticComponent<import("../components/Table").TableRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
10
|
+
Cell: React.ForwardRefExoticComponent<import("../components/Table").TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
10
11
|
};
|
|
11
12
|
parameters: {
|
|
12
13
|
layout: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rharuow-ds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Modern React Design System with 10 components: Table (Header, Body, Footer, Row, Cell), Card (Header, Body, Footer), Button, Input (with password support), Textarea, Select, AsyncSelect, MultiSelect, MultiAsyncSelect, and RadioGroup. Full React Hook Form integration, Tailwind CSS styling, CSS Variables for theme customization and dark mode support.",
|
|
5
5
|
"main": "dist/rharuow-ds.cjs.js",
|
|
6
6
|
"module": "dist/rharuow-ds.es.js",
|