@tech-diefra/fluig-ui 1.2.23 → 1.2.25

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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),S=require("react-hook-form"),X=require("react-imask"),M=require("@fluig-kit/ecm"),L=require("react-datepicker"),E=require("date-fns"),U={cpf:"000.000.000-00",cnpj:"00.000.000/0000-00",telefone:"(00) 00000-0000",cep:"00000-000"};function Y({name:e,label:s="",placeholder:a="",type:c="text",mask:o,className:l="",forceReadOnly:r=!1,forceHidden:n=!1}){const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),N=n||!!m(e),{control:y}=S.useFormContext(),{isView:R}=M.useFluigRuntime(),{field:f}=S.useController({name:e,control:y}),{errors:b}=S.useFormState({name:e}),x=b==null?void 0:b[e],p=u.useMemo(()=>o?U[o]??o:null,[o]),k=u.useCallback(i=>{if(!i)return"";const d=i.replace(/\D/g,"");return(Number(d)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),j=u.useCallback(i=>c==="monetary"?k(i):i,[c,k]);return R?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f.value||"-"})]}):t.jsxs("div",{className:`form-group ${N?"hidden":""}`,children:[t.jsx("label",{children:s}),p?t.jsx(X.IMaskInput,{name:e,mask:p,value:String(f.value??""),unmask:!1,onAccept:i=>f.onChange(j(i)),placeholder:a,readOnly:h,className:`form-control ${x?"border-red":""} ${l}`,inputRef:f.ref,onBlur:f.onBlur}):t.jsx("input",{...f,type:"text",value:f.value??"",onChange:i=>f.onChange(j(i.target.value)),placeholder:a,readOnly:h,className:`form-control ${x?"border-red":""} ${l}`}),x&&t.jsx("p",{className:"text-danger",children:String(x.message)})]})}const G=u.memo(Y);function Q({name:e,label:s="",options:a=[],placeholder:c="",labelKey:o="label",valueKey:l="value",enableSearch:r=!1,searchPlaceholder:n="Buscar...",loading:g=!1,onSearchChange:m,debounceTime:h=300,onSelect:N,forceReadOnly:y=!1,forceHidden:R=!1}){const{isReadOnly:f,isHidden:b}=M.useSection(),x=y||!!f(e),p=R||!!b(e),{control:k,clearErrors:j}=S.useFormContext(),{isView:i}=M.useFluigRuntime(),{field:{onChange:d,value:v,ref:_},fieldState:{error:C}}=S.useController({name:e,control:k}),[P,$]=u.useState(!1),[F,q]=u.useState(""),W=u.useRef(null),T=u.useRef(m);u.useEffect(()=>{T.current=m},[m]),u.useEffect(()=>{const w=A=>{W.current&&!W.current.contains(A.target)&&$(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),u.useEffect(()=>{P||q("")},[P]),u.useEffect(()=>{if(!r)return;const w=setTimeout(()=>{T.current&&T.current(F)},h);return()=>clearTimeout(w)},[F,r,h]);const H=u.useMemo(()=>r&&!m&&F.trim()?a.filter(w=>String((w==null?void 0:w[o])??"").toLowerCase().includes(F.toLowerCase())):a??[],[a,r,m,F,o]),B=u.useMemo(()=>{if(v==null)return"";if(typeof v=="object")return String(v[l]??"");const w=(a||[]).find(A=>String(A==null?void 0:A[l])===String(v));return String(w?(w==null?void 0:w[o])??"":v)},[v,a,l,o]),z=w=>{x||(d(w[l]),N&&N(w),j(e),$(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${p?"hidden":""}`,ref:W,children:[t.jsx("label",{className:"control-label",children:s}),i?t.jsx("span",{className:"form-control",children:B||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${C?"border-red":""} ${x?"readOnly":""}`,onClick:()=>!x&&$(w=>!w),ref:_,children:[t.jsx("span",{className:`select-display ${x?"readOnly":""}`,children:B||c}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),P&&!x&&t.jsxs("div",{className:"select-dropdown",children:[r&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:F,onChange:w=>q(w.target.value),placeholder:g?"Carregando...":n,autoFocus:!0,onClick:w=>w.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:g?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):H.length>0?H.map(w=>t.jsx("li",{onClick:()=>z(w),className:"select-option handleHover",children:w[o]},w[l])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),t.jsx("input",{type:"hidden",name:e,value:v||""}),C&&t.jsx("p",{className:"text-danger",children:String(C.message)})]})}const J=u.memo(Q);function Z({name:e,options:s=[],label:a="",valueKey:c="value",labelKey:o="label",forceReadOnly:l=!1,forceHidden:r=!1}){var v,_;const n=S.useFormContext(),{isView:g,isReadOnly:m}=M.useFluigRuntime(),{isReadOnly:h,isHidden:N}=M.useSection(),y=h?h(e):!1,R=N?N(e):!1,f=l||y,b=r||R,x=f||m||g;if(!n||!e)return console.error("Checkbox requer contexto de formulário e nome."),null;const p=()=>!s||!n?{}:s.reduce((C,P)=>{const $=P[c],F=n.getValues($);return C[$]=F==="on",C},{}),k=n.watch(e),j=u.useMemo(()=>k&&typeof k=="object"?k:p(),[k,s,c]);u.useEffect(()=>{const C=n.getValues(e);(!C||typeof C!="object")&&n.setValue(e,j,{shouldDirty:!1,shouldValidate:!1})},[j,e,n]);const i=(C,P)=>{if(x)return;const $={...j,[C]:P};n.setValue(e,$,{shouldDirty:!0,shouldValidate:!0}),n.setValue(C,P?"on":"",{shouldValidate:!1})},d=(_=(v=n.formState)==null?void 0:v.errors)==null?void 0:_[e];return t.jsxs("div",{className:`form-group ${b?"hidden":""}`,children:[a&&t.jsx("label",{children:a}),t.jsx("div",{className:`checkbox-group-custom ${x?"readOnly":""}`,children:s.map(C=>{const P=String(C[c]),$=j[P]===!0;return t.jsxs("div",{children:[t.jsx("input",{type:"hidden",...n.register(P)}),t.jsxs("label",{className:`custom-checkbox ${$?"checked":""} ${x?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:$,disabled:x,onChange:F=>i(P,F.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:C[o]})]})]},P)})}),d&&t.jsx("p",{className:"text-danger",children:String(d.message)})]})}function K({name:e,label:s="",options:a=[],valueKey:c="value",labelKey:o="label",iconKey:l="icon",forceReadOnly:r=!1,forceHidden:n=!1}){const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),N=n||!!m(e),{control:y}=S.useFormContext(),{isView:R,isReadOnly:f}=M.useFluigRuntime(),{field:b,fieldState:{error:x}}=S.useController({name:e,control:y}),p=h||f||R,k=b.value??"",j=u.useCallback(i=>{p||b.onChange(i)},[p,b]);return t.jsxs("div",{className:`form-group column ${N?"hidden":""}`,children:[s&&t.jsx("label",{className:"control-label",children:s}),t.jsx("div",{className:`btn-group ${p?"view-mode":""}`,"data-field-name":e,children:a.map(i=>{const d=i[c],v=k===d,_=i.color?{"--customColor":i.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${d}`,style:_,className:`btn fs-ellipsis ${v?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${d}`,name:e,value:d,checked:v,className:"hidden",onChange:()=>j(d),disabled:p}),i[l]&&t.jsx("i",{className:`${i[l]} icon-sm`})," ",i[o]]},d)})}),x&&t.jsx("p",{className:"text-danger",children:String(x.message)})]})}const ee=u.memo(K),te=({name:e,label:s="",placeholder:a="",className:c="",rows:o=4,maxLength:l,forceReadOnly:r=!1,forceHidden:n=!1})=>{const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),N=n||!!m(e),{control:y}=S.useFormContext(),{isView:R}=M.useFluigRuntime(),{field:f,fieldState:{error:b}}=S.useController({name:e,control:y});return R?t.jsxs("div",{className:`form-group ${N?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f.value||"-"})]}):t.jsxs("div",{className:`form-group ${N?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("textarea",{...f,rows:o,maxLength:l,value:f.value||"",placeholder:a,readOnly:h,className:`form-control ${b?"border-red":""} ${c}`}),b&&t.jsx("p",{className:"text-danger",children:String(b.message)})]})},ne=u.memo(te);function D(e){return(s={})=>{const a=s.width?String(s.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}function V(e){return(s,a)=>{const c=a!=null&&a.context?String(a.context):"standalone";let o;if(c==="formatting"&&e.formattingValues){const r=e.defaultFormattingWidth||e.defaultWidth,n=a!=null&&a.width?String(a.width):r;o=e.formattingValues[n]||e.formattingValues[r]}else{const r=e.defaultWidth,n=a!=null&&a.width?String(a.width):e.defaultWidth;o=e.values[n]||e.values[r]}const l=e.argumentCallback?e.argumentCallback(s):s;return o[l]}}function O(e){return(s,a={})=>{const c=a.width,o=c&&e.matchPatterns[c]||e.matchPatterns[e.defaultMatchWidth],l=s.match(o);if(!l)return null;const r=l[0],n=c&&e.parsePatterns[c]||e.parsePatterns[e.defaultParseWidth],g=Array.isArray(n)?se(n,N=>N.test(r)):ae(n,N=>N.test(r));let m;m=e.valueCallback?e.valueCallback(g):g,m=a.valueCallback?a.valueCallback(m):m;const h=s.slice(r.length);return{value:m,rest:h}}}function ae(e,s){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&s(e[a]))return a}function se(e,s){for(let a=0;a<e.length;a++)if(s(e[a]))return a}function re(e){return(s,a={})=>{const c=s.match(e.matchPattern);if(!c)return null;const o=c[0],l=s.match(e.parsePattern);if(!l)return null;let r=e.valueCallback?e.valueCallback(l[0]):l[0];r=a.valueCallback?a.valueCallback(r):r;const n=s.slice(o.length);return{value:r,rest:n}}}const oe={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},ie=(e,s,a)=>{let c;const o=oe[e];return typeof o=="string"?c=o:s===1?c=o.one:c=o.other.replace("{{count}}",String(s)),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"em "+c:"há "+c:c},le={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},ce={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},de={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ue={date:D({formats:le,defaultWidth:"full"}),time:D({formats:ce,defaultWidth:"full"}),dateTime:D({formats:de,defaultWidth:"full"})},me={lastWeek:e=>{const s=e.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},he=(e,s,a,c)=>{const o=me[e];return typeof o=="function"?o(s):o},fe={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},ge={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},xe={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},be={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},ve={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},je={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},pe=(e,s)=>{const a=Number(e);return(s==null?void 0:s.unit)==="week"?a+"ª":a+"º"},ye={ordinalNumber:pe,era:V({values:fe,defaultWidth:"wide"}),quarter:V({values:ge,defaultWidth:"wide",argumentCallback:e=>e-1}),month:V({values:xe,defaultWidth:"wide"}),day:V({values:be,defaultWidth:"wide"}),dayPeriod:V({values:ve,defaultWidth:"wide",formattingValues:je,defaultFormattingWidth:"wide"})},Ne=/^(\d+)[ºªo]?/i,Ce=/\d+/i,we={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},ke={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},Re={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Se={any:[/1/i,/2/i,/3/i,/4/i]},Pe={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Me={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},_e={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},$e={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},Fe={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},Ae={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},Ve={ordinalNumber:re({matchPattern:Ne,parsePattern:Ce,valueCallback:e=>parseInt(e,10)}),era:O({matchPatterns:we,defaultMatchWidth:"wide",parsePatterns:ke,defaultParseWidth:"any"}),quarter:O({matchPatterns:Re,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any",valueCallback:e=>e+1}),month:O({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),day:O({matchPatterns:_e,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),dayPeriod:O({matchPatterns:Fe,defaultMatchWidth:"any",parsePatterns:Ae,defaultParseWidth:"any"})},Oe={code:"pt-BR",formatDistance:ie,formatLong:ue,formatRelative:he,localize:ye,match:Ve,options:{weekStartsOn:0,firstWeekContainsDate:1}};L.registerLocale("pt-BR",Oe);const I="dd/MM/yyyy",We=e=>{if(!e)return null;const s=E.parse(e,I,new Date);return E.isValid(s)?s:null},Te=e=>e?E.format(e,I):"",De=u.forwardRef(({shimRef:e,className:s,name:a,...c},o)=>t.jsx("input",{name:a,...c,className:s,ref:l=>{typeof o=="function"?o(l):o&&(o.current=l),e&&e(l)}})),Ee=({name:e,label:s="",placeholder:a="dd/mm/aaaa",className:c="",forceReadOnly:o=!1,forceHidden:l=!1})=>{const{control:r}=S.useFormContext(),{isView:n}=M.useFluigRuntime(),{isReadOnly:g,isHidden:m}=M.useSection(),h=o||!!g(e),N=l||!!m(e),{field:{onChange:y,onBlur:R,value:f,ref:b},fieldState:{error:x}}=S.useController({name:e,control:r}),p=u.useMemo(()=>We(f),[f]),k=u.useCallback(i=>{y(i?Te(i):"")},[y]),j=u.useCallback(i=>{var d,v;if(b(i),i&&((v=(d=r._fields)==null?void 0:d[e])!=null&&v._f)){const _=r._fields[e];_._f.ref={focus:()=>{var C;return(C=i.focus)==null?void 0:C.call(i)},select:()=>{var C;return(C=i.select)==null?void 0:C.call(i)},setCustomValidity:C=>{var P;return(P=i.setCustomValidity)==null?void 0:P.call(i,C)},reportValidity:()=>{var C;return(C=i.reportValidity)==null?void 0:C.call(i)}}}},[b,r,e]);return N?null:n?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f||"-"})]}):t.jsxs("div",{className:`form-group fluig-style-guide ${c}`,children:[s&&t.jsx("label",{className:"control-label",htmlFor:e,children:s}),t.jsx("div",{className:`${x?"border-red":""}`,children:t.jsx(L,{id:e,name:e,selected:p,onChange:k,onBlur:R,dateFormat:I,placeholderText:a,disabled:h,readOnly:h,locale:"pt-BR",className:`form-control ${x?"border-red":""}`,wrapperClassName:"w-100",showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select",isClearable:!h&&!!f,autoComplete:"off",customInput:t.jsx(De,{name:e,shimRef:j})})}),x&&t.jsx("span",{className:"help-block text-danger",children:String(x.message)})]})},Ie=u.memo(Ee);function qe({mapping:e={},defaultLabel:s="Não reconhecido",className:a="",hidden:c=!1,label:o}){const{activityId:l}=M.useFluigRuntime(),r=u.useMemo(()=>!e||l===null||l===void 0?null:e[l],[l,e]);if(!r)return t.jsxs("div",{className:`form-group ${c?"hidden":""}`,children:[o&&t.jsx("label",{children:o}),t.jsx("div",{className:`status-badge default ${a}`,children:s})]});const n={"--customColor":r.color};return t.jsxs("div",{className:`form-group ${c?"hidden":""}`,children:[o&&t.jsx("label",{children:o}),t.jsxs("div",{className:`status-badge ${a}`,style:n,children:[r.icon&&t.jsx("i",{className:r.icon}),t.jsx("span",{children:r.label})]})]})}const He=u.memo(qe);function Be({name:e,control:s,defaultRowValue:a,isView:c,isReadOnly:o,filters:l=[]}){const{field:r}=S.useController({name:e,control:s}),[n,g]=u.useState([]),[m,h]=u.useState([]),N=()=>Date.now()+Math.random(),y=i=>{try{const d=JSON.parse(i);return Array.isArray(d)?d.map(v=>({...v,_uid:v._uid||N()})):[]}catch(d){return console.error(`Erro ao ler dados da tabela "${e}":`,d),[]}};u.useEffect(()=>{if(!(n.length>0&&!c)&&r.value&&typeof r.value=="string"){const i=JSON.stringify(n);if(r.value===i)return;const d=y(r.value);g(d)}},[r.value,c]),u.useEffect(()=>{if(o)return;const i=JSON.stringify(n);r.value!==i&&r.onChange(i)},[n,r,o]);const R=u.useCallback(()=>{const i={_uid:N(),...a};g(d=>[...d,i])},[a]),f=u.useCallback(()=>{g(i=>i.filter(d=>!m.includes(d._uid))),h([])},[m]),b=u.useCallback((i,d,v)=>{g(_=>_.map(C=>C._uid===i?{...C,[d]:v}:C))},[]),x=u.useCallback(i=>{h(d=>d.includes(i)?d.filter(v=>v!==i):[...d,i])},[]),p=u.useCallback(i=>{h(i?n.map(d=>d._uid):[])},[n]),k=n.length>0&&m.length===n.length,j=u.useMemo(()=>!l||l.length===0?n:n.filter(i=>l.every(d=>{if("custom"in d)return d.custom(i);const v=i[d.field];switch(d.operator){case"===":return v===d.value;case"!==":return v!==d.value;case">":return v>d.value;case"<":return v<d.value;case">=":return v>=d.value;case"<=":return v<=d.value;default:return!0}})),[n,l]);return{field:r,tableRows:n,visibleRows:j,selectedRowIds:m,isAllSelected:k,handle:{addRow:R,removeRows:f,updateCellValue:b,toggleSelection:x,toggleSelectAll:p}}}const Le=({name:e,title:s="Tabela Dinâmica",columns:a,defaultRowValue:c={},forceReadOnly:o=!1,layout:l="fluid",actions:r=!0,filters:n=[]})=>{const{control:g}=S.useFormContext(),{isView:m,isReadOnly:h}=M.useFluigRuntime(),{isReadOnly:N}=M.useSection(),y=o||m||h||N&&N(e),{field:R,visibleRows:f,selectedRowIds:b,isAllSelected:x,handle:p}=Be({name:e,control:g,defaultRowValue:c,isView:m,isReadOnly:!!y,filters:n}),k=l==="fixed";return t.jsxs("div",{className:`table-wrapper ${k?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...R}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:s}),!y&&r&&t.jsxs("div",{className:"handle-actions",children:[t.jsxs("button",{type:"button",className:`btn ${b.length>0?"btn-danger":""}`,disabled:b.length===0,onClick:p.removeRows,children:["Remover (",b.length,")"]}),t.jsx("button",{type:"button",className:"btn-add",onClick:p.addRow,children:"Adicionar"})]})]}),t.jsx("div",{className:"table-scroll",children:t.jsxs("table",{className:"table-custom",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[!y&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:x,onChange:j=>p.toggleSelectAll(j.target.checked)})}),a.map(j=>t.jsx("th",{style:j.width?{minWidth:k?j.width:"100%"}:{width:"max-content"},children:j.label},j.key))]})}),t.jsxs("tbody",{children:[f.map((j,i)=>t.jsxs("tr",{children:[!y&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:b.includes(j._uid),onChange:()=>p.toggleSelection(j._uid)})}),a.map(d=>t.jsx("td",{children:d.render?d.render.length<=1?d.render({row:j,index:i,updateRow:(v,_)=>p.updateCellValue(j._uid,v,_),isLocked:!!y,isView:!!m}):d.render(j,i,(v,_)=>p.updateCellValue(j._uid,v,_),!!y,!!m):j[d.key]},`${j._uid}-${d.key}`))]},j._uid)),f.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:y?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ze=e=>{const[s,a]=u.useState(null),{watch:c}=S.useFormContext(),o=c(e),l=u.useCallback(()=>{try{const n=window.top.__REACT_ATTACHMENT_BRIDGE__;if(n){const g=n.getAttachment(e);a(g||(o?{name:o,documentId:0}:null))}else a(o?{name:o,documentId:0}:null)}catch{a(o?{name:o,documentId:0}:null)}},[e,o]);return u.useEffect(()=>{l();const r=setInterval(l,2e3);return()=>clearInterval(r)},[l]),{attachment:s,sync:l}},Xe=({name:e,label:s,help:a})=>{const[c,o]=u.useState(!1),{control:l}=S.useFormContext(),{field:r}=S.useController({name:e,control:l}),{attachment:n,sync:g}=ze(e),m=()=>{var f;try{const b=window.top;return{bridge:b.__REACT_ATTACHMENT_BRIDGE__,toast:(f=b.FLUIGC)==null?void 0:f.toast}}catch{return{bridge:null,toast:null}}},h=u.useCallback(()=>{const f=document.createElement("input");f.type="file",f.onchange=b=>{const x=b.target.files[0];if(!x)return;const{bridge:p,toast:k}=m();o(!0),p?p.upload(x,e,j=>{r.onChange(j.name),setTimeout(()=>{o(!1),g()},1e3),k&&k({title:"Sucesso",message:"Arquivo enviado",type:"success"})}):(r.onChange(x.name),o(!1))},f.click()},[e,r,g]),N=f=>{f.stopPropagation();const b=(n==null?void 0:n.name)||r.value;if(!b)return;const{bridge:x,toast:p}=m();x?x.removeByFileName(b)?(r.onChange(""),g(),p&&p({title:"Sucesso",message:"Anexo removido",type:"success"})):p&&p({title:"Erro",message:"Erro ao remover anexo",type:"danger"}):(r.onChange(""),g())},y=!!n&&!c,R=["fluig-attachment__box",y?"fluig-attachment__box--has-file":"",c?"fluig-attachment__box--uploading":""].join(" ");return t.jsxs("div",{className:"form-group fluig-attachment",children:[s&&t.jsx("label",{className:"fluig-attachment__label",children:s}),t.jsxs("div",{className:R,onClick:y?()=>{var f;return(f=m().bridge)==null?void 0:f.view(n.name)}:h,children:[t.jsxs("span",{className:"fluig-attachment__content",children:[t.jsx("i",{className:`fluigicon icon-sm ${c?"fluigicon-loop-test":y?"fluigicon-file-pdf":"fluigicon-paperclip"} fluig-attachment__icon`}),t.jsx("span",{className:"fluig-attachment__filename",children:c?" Enviando...":y?n.name:a||"Anexar"})]}),y&&t.jsx("button",{type:"button",className:"fluig-attachment__btn-remove btn btn-link text-danger",onClick:N,children:t.jsx("i",{className:"flaticon flaticon-trash icon-sm","aria-hidden":"true"})})]}),t.jsx("input",{type:"hidden",name:e,value:r.value||""})]})},Ue=u.memo(Xe);function Ye({items:e,time:s=0,showNavigation:a=!0,progressBar:c=!0}){const[o,l]=u.useState(0),[r,n]=u.useState(0),g=u.useRef(null),m=u.useRef(null),h=u.useCallback(()=>{l(b=>(b+1)%e.length),n(0)},[e.length]),N=u.useCallback(()=>{l(b=>(b-1+e.length)%e.length),n(0)},[e.length]);if(u.useEffect(()=>{if(s>0&&e.length>1){const x=100/s*100;g.current=setInterval(h,s),m.current=setInterval(()=>{n(p=>p>=100?0:p+x)},100)}return()=>{g.current&&clearInterval(g.current),m.current&&clearInterval(m.current)}},[s,h,e.length,o]),!e||e.length===0)return null;const y=e[o],R=typeof y=="string"?y:y.url,f=/\.(jpg|jpeg|png|gif|webp)$/i.test(R);return t.jsxs("div",{className:"carousel-root",children:[t.jsxs("div",{className:"carousel-viewport",children:[a&&e.length>1&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"nav-btn prev",onClick:N,children:t.jsx("i",{className:"flaticon flaticon-chevron-left"})}),t.jsx("button",{className:"nav-btn next",onClick:h,children:t.jsx("i",{className:"flaticon flaticon-chevron-right"})})]}),t.jsx("div",{className:"carousel-media",children:f?t.jsx("img",{src:R,alt:"Slide",className:"carousel-image"}):t.jsxs("div",{className:"carousel-file-fallback",children:[t.jsx("i",{className:"flaticon flaticon-file icon-xl"}),t.jsx("a",{href:R,target:"_blank",rel:"noreferrer",className:"btn-open",children:"Abrir Arquivo"})]})}),e.length>1&&t.jsx("div",{className:"carousel-dots",children:e.map((b,x)=>t.jsx("div",{className:`dot ${x===o?"active":""}`,onClick:()=>{l(x),n(0)}},x))})]}),c&&s>0&&e.length>1&&t.jsx("div",{className:"carousel-progress-container",children:t.jsx("div",{className:"carousel-progress-bar",style:{width:`${r}%`}})})]})}function Ge({title:e,isOpen:s,onOpen:a,onClose:c,content:o,footer:l,width:r}){const n=u.useCallback(g=>{g.key==="Escape"&&c()},[c]);return u.useEffect(()=>(s&&(document.addEventListener("keydown",n),a==null||a(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",n),document.body.style.overflow="auto"}),[s,n,a]),s?t.jsx("div",{className:"modal-overlay",onClick:c,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:r},className:"modal-container",onClick:g=>g.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:c,role:"button","aria-label":"Fechar modal",children:t.jsx("i",{className:"flaticon flaticon-close icon-md","aria-hidden":"true"})})]}),t.jsx("div",{className:"modal-content",children:o}),l&&t.jsx("div",{className:"modal-footer",children:l})]})}):null}function Qe({logo:e,childs:s,footer:a,contentExternal:c,bg:o,color:l,onSelect:r}){return t.jsxs("div",{className:"main-container dfea",children:[t.jsxs("div",{className:"sidebar-wrapper",style:{backgroundColor:`${o}`},children:[e&&t.jsx("div",{className:"sidebar-logo",children:t.jsx("img",{src:e,alt:"",width:"auto",height:"28px"})}),t.jsx("ul",{className:"sidebar-childs-content",children:s==null?void 0:s.map(n=>{var g,m;return n!=null&&n.options&&((g=n==null?void 0:n.options)==null?void 0:g.length)>0?t.jsx(t.Fragment,{children:t.jsxs("ul",{className:"sidebar-child sidebar-options-content",children:[t.jsxs("li",{className:"sidebar-child",onClick:()=>{var h;(h=n.action)==null||h.call(n),r==null||r(n.id)},style:{color:`${l}`},children:[n.icon&&t.jsx("i",{className:n.icon}),n.label]}),(m=n.options)==null?void 0:m.map(h=>t.jsx("li",{className:"sidebar-option",onClick:()=>{var N;(N=h.action)==null||N.call(h),r==null||r(h.id)},style:{color:`${l}`},children:h.label}))]})}):t.jsxs("li",{className:"sidebar-child",onClick:()=>{var h;(h=n.action)==null||h.call(n),r==null||r(n.id)},style:{color:`${l}`},children:[n.icon&&t.jsx("i",{className:n.icon}),n.label]})})}),a&&t.jsx("div",{className:"sidebar-footer",children:a})]}),t.jsx("div",{className:"sidebar-content-external",children:c})]})}exports.Attachment=Ue;exports.Carousel=Ye;exports.Checkbox=Z;exports.DatePicker=Ie;exports.Input=G;exports.Modal=Ge;exports.RadioBtn=ee;exports.Select=J;exports.Sidebar=Qe;exports.SimpleTable=Le;exports.StatusBadge=He;exports.TextArea=ne;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),S=require("react-hook-form"),X=require("react-imask"),M=require("@fluig-kit/ecm"),L=require("react-datepicker"),E=require("date-fns"),U={cpf:"000.000.000-00",cnpj:"00.000.000/0000-00",telefone:"(00) 00000-0000",cep:"00000-000"};function Y({name:e,label:s="",placeholder:a="",type:c="text",mask:o,className:l="",forceReadOnly:r=!1,forceHidden:n=!1}){const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),y=n||!!m(e),{control:p}=S.useFormContext(),{isView:R}=M.useFluigRuntime(),{field:f}=S.useController({name:e,control:p}),{errors:b}=S.useFormState({name:e}),x=b==null?void 0:b[e],N=u.useMemo(()=>o?U[o]??o:null,[o]),k=u.useCallback(i=>{if(!i)return"";const d=i.replace(/\D/g,"");return(Number(d)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),j=u.useCallback(i=>c==="monetary"?k(i):i,[c,k]);return R?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f.value||"-"})]}):t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:s}),N?t.jsx(X.IMaskInput,{name:e,mask:N,value:String(f.value??""),unmask:!1,onAccept:i=>f.onChange(j(i)),placeholder:a,readOnly:h,className:`form-control ${x?"border-red":""} ${l}`,inputRef:f.ref,onBlur:f.onBlur}):t.jsx("input",{...f,type:"text",value:f.value??"",onChange:i=>f.onChange(j(i.target.value)),placeholder:a,readOnly:h,className:`form-control ${x?"border-red":""} ${l}`}),x&&t.jsx("p",{className:"text-danger",children:String(x.message)})]})}const G=u.memo(Y);function Q({name:e,label:s="",options:a=[],placeholder:c="",labelKey:o="label",valueKey:l="value",enableSearch:r=!1,searchPlaceholder:n="Buscar...",loading:g=!1,onSearchChange:m,debounceTime:h=300,onSelect:y,forceReadOnly:p=!1,forceHidden:R=!1}){const{isReadOnly:f,isHidden:b}=M.useSection(),x=p||!!f(e),N=R||!!b(e),{control:k,clearErrors:j}=S.useFormContext(),{isView:i}=M.useFluigRuntime(),{field:{onChange:d,value:v,ref:_},fieldState:{error:C}}=S.useController({name:e,control:k}),[P,$]=u.useState(!1),[F,q]=u.useState(""),W=u.useRef(null),T=u.useRef(m);u.useEffect(()=>{T.current=m},[m]),u.useEffect(()=>{const w=V=>{W.current&&!W.current.contains(V.target)&&$(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),u.useEffect(()=>{P||q("")},[P]),u.useEffect(()=>{if(!r)return;const w=setTimeout(()=>{T.current&&T.current(F)},h);return()=>clearTimeout(w)},[F,r,h]);const H=u.useMemo(()=>r&&!m&&F.trim()?a.filter(w=>String((w==null?void 0:w[o])??"").toLowerCase().includes(F.toLowerCase())):a??[],[a,r,m,F,o]),B=u.useMemo(()=>{if(v==null)return"";if(typeof v=="object")return String(v[l]??"");const w=(a||[]).find(V=>String(V==null?void 0:V[l])===String(v));return String(w?(w==null?void 0:w[o])??"":v)},[v,a,l,o]),z=w=>{x||(d(w[l]),y&&y(w),j(e),$(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${N?"hidden":""}`,ref:W,children:[t.jsx("label",{className:"control-label",children:s}),i?t.jsx("span",{className:"form-control",children:B||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${C?"border-red":""} ${x?"readOnly":""}`,onClick:()=>!x&&$(w=>!w),ref:_,children:[t.jsx("span",{className:`select-display ${x?"readOnly":""}`,children:B||c}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),P&&!x&&t.jsxs("div",{className:"select-dropdown",children:[r&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:F,onChange:w=>q(w.target.value),placeholder:g?"Carregando...":n,autoFocus:!0,onClick:w=>w.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:g?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):H.length>0?H.map(w=>t.jsx("li",{onClick:()=>z(w),className:"select-option handleHover",children:w[o]},w[l])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),t.jsx("input",{type:"hidden",name:e,value:v||""}),C&&t.jsx("p",{className:"text-danger",children:String(C.message)})]})}const J=u.memo(Q);function Z({name:e,options:s=[],label:a="",valueKey:c="value",labelKey:o="label",forceReadOnly:l=!1,forceHidden:r=!1}){var v,_;const n=S.useFormContext(),{isView:g,isReadOnly:m}=M.useFluigRuntime(),{isReadOnly:h,isHidden:y}=M.useSection(),p=h?h(e):!1,R=y?y(e):!1,f=l||p,b=r||R,x=f||m||g;if(!n||!e)return console.error("Checkbox requer contexto de formulário e nome."),null;const N=()=>!s||!n?{}:s.reduce((C,P)=>{const $=P[c],F=n.getValues($);return C[$]=F==="on",C},{}),k=n.watch(e),j=u.useMemo(()=>k&&typeof k=="object"?k:N(),[k,s,c]);u.useEffect(()=>{const C=n.getValues(e);(!C||typeof C!="object")&&n.setValue(e,j,{shouldDirty:!1,shouldValidate:!1})},[j,e,n]);const i=(C,P)=>{if(x)return;const $={...j,[C]:P};n.setValue(e,$,{shouldDirty:!0,shouldValidate:!0}),n.setValue(C,P?"on":"",{shouldValidate:!1})},d=(_=(v=n.formState)==null?void 0:v.errors)==null?void 0:_[e];return t.jsxs("div",{className:`form-group ${b?"hidden":""}`,children:[a&&t.jsx("label",{children:a}),t.jsx("div",{className:`checkbox-group-custom ${x?"readOnly":""}`,children:s.map(C=>{const P=String(C[c]),$=j[P]===!0;return t.jsxs("div",{children:[t.jsx("input",{type:"hidden",...n.register(P)}),t.jsxs("label",{className:`custom-checkbox ${$?"checked":""} ${x?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:$,disabled:x,onChange:F=>i(P,F.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:C[o]})]})]},P)})}),d&&t.jsx("p",{className:"text-danger",children:String(d.message)})]})}function K({name:e,label:s="",options:a=[],valueKey:c="value",labelKey:o="label",iconKey:l="icon",forceReadOnly:r=!1,forceHidden:n=!1}){const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),y=n||!!m(e),{control:p}=S.useFormContext(),{isView:R,isReadOnly:f}=M.useFluigRuntime(),{field:b,fieldState:{error:x}}=S.useController({name:e,control:p}),N=h||f||R,k=b.value??"",j=u.useCallback(i=>{N||b.onChange(i)},[N,b]);return t.jsxs("div",{className:`form-group column ${y?"hidden":""}`,children:[s&&t.jsx("label",{className:"control-label",children:s}),t.jsx("div",{className:`btn-group ${N?"view-mode":""}`,"data-field-name":e,children:a.map(i=>{const d=i[c],v=k===d,_=i.color?{"--customColor":i.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${d}`,style:_,className:`btn fs-ellipsis ${v?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${d}`,name:e,value:d,checked:v,className:"hidden",onChange:()=>j(d),disabled:N}),i[l]&&t.jsx("i",{className:`${i[l]} icon-sm`})," ",i[o]]},d)})}),x&&t.jsx("p",{className:"text-danger",children:String(x.message)})]})}const ee=u.memo(K),te=({name:e,label:s="",placeholder:a="",className:c="",rows:o=4,maxLength:l,forceReadOnly:r=!1,forceHidden:n=!1})=>{const{isReadOnly:g,isHidden:m}=M.useSection(),h=r||!!g(e),y=n||!!m(e),{control:p}=S.useFormContext(),{isView:R}=M.useFluigRuntime(),{field:f,fieldState:{error:b}}=S.useController({name:e,control:p});return R?t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f.value||"-"})]}):t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("textarea",{...f,rows:o,maxLength:l,value:f.value||"",placeholder:a,readOnly:h,className:`form-control ${b?"border-red":""} ${c}`}),b&&t.jsx("p",{className:"text-danger",children:String(b.message)})]})},ne=u.memo(te);function D(e){return(s={})=>{const a=s.width?String(s.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}function A(e){return(s,a)=>{const c=a!=null&&a.context?String(a.context):"standalone";let o;if(c==="formatting"&&e.formattingValues){const r=e.defaultFormattingWidth||e.defaultWidth,n=a!=null&&a.width?String(a.width):r;o=e.formattingValues[n]||e.formattingValues[r]}else{const r=e.defaultWidth,n=a!=null&&a.width?String(a.width):e.defaultWidth;o=e.values[n]||e.values[r]}const l=e.argumentCallback?e.argumentCallback(s):s;return o[l]}}function O(e){return(s,a={})=>{const c=a.width,o=c&&e.matchPatterns[c]||e.matchPatterns[e.defaultMatchWidth],l=s.match(o);if(!l)return null;const r=l[0],n=c&&e.parsePatterns[c]||e.parsePatterns[e.defaultParseWidth],g=Array.isArray(n)?se(n,y=>y.test(r)):ae(n,y=>y.test(r));let m;m=e.valueCallback?e.valueCallback(g):g,m=a.valueCallback?a.valueCallback(m):m;const h=s.slice(r.length);return{value:m,rest:h}}}function ae(e,s){for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&s(e[a]))return a}function se(e,s){for(let a=0;a<e.length;a++)if(s(e[a]))return a}function re(e){return(s,a={})=>{const c=s.match(e.matchPattern);if(!c)return null;const o=c[0],l=s.match(e.parsePattern);if(!l)return null;let r=e.valueCallback?e.valueCallback(l[0]):l[0];r=a.valueCallback?a.valueCallback(r):r;const n=s.slice(o.length);return{value:r,rest:n}}}const oe={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},ie=(e,s,a)=>{let c;const o=oe[e];return typeof o=="string"?c=o:s===1?c=o.one:c=o.other.replace("{{count}}",String(s)),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"em "+c:"há "+c:c},le={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},ce={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},de={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ue={date:D({formats:le,defaultWidth:"full"}),time:D({formats:ce,defaultWidth:"full"}),dateTime:D({formats:de,defaultWidth:"full"})},me={lastWeek:e=>{const s=e.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},he=(e,s,a,c)=>{const o=me[e];return typeof o=="function"?o(s):o},fe={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},ge={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},xe={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},be={narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},ve={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},je={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},pe=(e,s)=>{const a=Number(e);return(s==null?void 0:s.unit)==="week"?a+"ª":a+"º"},ye={ordinalNumber:pe,era:A({values:fe,defaultWidth:"wide"}),quarter:A({values:ge,defaultWidth:"wide",argumentCallback:e=>e-1}),month:A({values:xe,defaultWidth:"wide"}),day:A({values:be,defaultWidth:"wide"}),dayPeriod:A({values:ve,defaultWidth:"wide",formattingValues:je,defaultFormattingWidth:"wide"})},Ne=/^(\d+)[ºªo]?/i,Ce=/\d+/i,we={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},ke={any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},Re={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Se={any:[/1/i,/2/i,/3/i,/4/i]},Pe={narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Me={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},_e={narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},$e={short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},Fe={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},Ve={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},Ae={ordinalNumber:re({matchPattern:Ne,parsePattern:Ce,valueCallback:e=>parseInt(e,10)}),era:O({matchPatterns:we,defaultMatchWidth:"wide",parsePatterns:ke,defaultParseWidth:"any"}),quarter:O({matchPatterns:Re,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any",valueCallback:e=>e+1}),month:O({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),day:O({matchPatterns:_e,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),dayPeriod:O({matchPatterns:Fe,defaultMatchWidth:"any",parsePatterns:Ve,defaultParseWidth:"any"})},Oe={code:"pt-BR",formatDistance:ie,formatLong:ue,formatRelative:he,localize:ye,match:Ae,options:{weekStartsOn:0,firstWeekContainsDate:1}};L.registerLocale("pt-BR",Oe);const I="dd/MM/yyyy",We=e=>{if(!e)return null;const s=E.parse(e,I,new Date);return E.isValid(s)?s:null},Te=e=>e?E.format(e,I):"",De=u.forwardRef(({shimRef:e,className:s,name:a,...c},o)=>t.jsx("input",{name:a,...c,className:s,ref:l=>{typeof o=="function"?o(l):o&&(o.current=l),e&&e(l)}})),Ee=({name:e,label:s="",placeholder:a="dd/mm/aaaa",className:c="",forceReadOnly:o=!1,forceHidden:l=!1})=>{const{control:r}=S.useFormContext(),{isView:n}=M.useFluigRuntime(),{isReadOnly:g,isHidden:m}=M.useSection(),h=o||!!g(e),y=l||!!m(e),{field:{onChange:p,onBlur:R,value:f,ref:b},fieldState:{error:x}}=S.useController({name:e,control:r}),N=u.useMemo(()=>We(f),[f]),k=u.useCallback(i=>{p(i?Te(i):"")},[p]),j=u.useCallback(i=>{var d,v;if(b(i),i&&((v=(d=r._fields)==null?void 0:d[e])!=null&&v._f)){const _=r._fields[e];_._f.ref={focus:()=>{var C;return(C=i.focus)==null?void 0:C.call(i)},select:()=>{var C;return(C=i.select)==null?void 0:C.call(i)},setCustomValidity:C=>{var P;return(P=i.setCustomValidity)==null?void 0:P.call(i,C)},reportValidity:()=>{var C;return(C=i.reportValidity)==null?void 0:C.call(i)}}}},[b,r,e]);return y?null:n?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:f||"-"})]}):t.jsxs("div",{className:`form-group fluig-style-guide ${c}`,children:[s&&t.jsx("label",{className:"control-label",htmlFor:e,children:s}),t.jsx("div",{className:`${x?"border-red":""}`,children:t.jsx(L,{id:e,name:e,selected:N,onChange:k,onBlur:R,dateFormat:I,placeholderText:a,disabled:h,readOnly:h,locale:"pt-BR",className:`form-control ${x?"border-red":""}`,wrapperClassName:"w-100",showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select",isClearable:!h&&!!f,autoComplete:"off",customInput:t.jsx(De,{name:e,shimRef:j})})}),x&&t.jsx("span",{className:"help-block text-danger",children:String(x.message)})]})},Ie=u.memo(Ee);function qe({mapping:e={},defaultLabel:s="Não reconhecido",className:a="",hidden:c=!1,label:o}){const{activityId:l}=M.useFluigRuntime(),r=u.useMemo(()=>!e||l===null||l===void 0?null:e[l],[l,e]);if(!r)return t.jsxs("div",{className:`form-group ${c?"hidden":""}`,children:[o&&t.jsx("label",{children:o}),t.jsx("div",{className:`status-badge default ${a}`,children:s})]});const n={"--customColor":r.color};return t.jsxs("div",{className:`form-group ${c?"hidden":""}`,children:[o&&t.jsx("label",{children:o}),t.jsxs("div",{className:`status-badge ${a}`,style:n,children:[r.icon&&t.jsx("i",{className:r.icon}),t.jsx("span",{children:r.label})]})]})}const He=u.memo(qe);function Be({name:e,control:s,defaultRowValue:a,isView:c,isReadOnly:o,filters:l=[]}){const{field:r}=S.useController({name:e,control:s}),[n,g]=u.useState([]),[m,h]=u.useState([]),y=()=>Date.now()+Math.random(),p=i=>{try{const d=JSON.parse(i);return Array.isArray(d)?d.map(v=>({...v,_uid:v._uid||y()})):[]}catch(d){return console.error(`Erro ao ler dados da tabela "${e}":`,d),[]}};u.useEffect(()=>{if(!(n.length>0&&!c)&&r.value&&typeof r.value=="string"){const i=JSON.stringify(n);if(r.value===i)return;const d=p(r.value);g(d)}},[r.value,c]),u.useEffect(()=>{if(o)return;const i=JSON.stringify(n);r.value!==i&&r.onChange(i)},[n,r,o]);const R=u.useCallback(()=>{const i={_uid:y(),...a};g(d=>[...d,i])},[a]),f=u.useCallback(()=>{g(i=>i.filter(d=>!m.includes(d._uid))),h([])},[m]),b=u.useCallback((i,d,v)=>{g(_=>_.map(C=>C._uid===i?{...C,[d]:v}:C))},[]),x=u.useCallback(i=>{h(d=>d.includes(i)?d.filter(v=>v!==i):[...d,i])},[]),N=u.useCallback(i=>{h(i?n.map(d=>d._uid):[])},[n]),k=n.length>0&&m.length===n.length,j=u.useMemo(()=>!l||l.length===0?n:n.filter(i=>l.every(d=>{if("custom"in d)return d.custom(i);const v=i[d.field];switch(d.operator){case"===":return v===d.value;case"!==":return v!==d.value;case">":return v>d.value;case"<":return v<d.value;case">=":return v>=d.value;case"<=":return v<=d.value;default:return!0}})),[n,l]);return{field:r,tableRows:n,visibleRows:j,selectedRowIds:m,isAllSelected:k,handle:{addRow:R,removeRows:f,updateCellValue:b,toggleSelection:x,toggleSelectAll:N}}}const Le=({name:e,title:s="Tabela Dinâmica",columns:a,defaultRowValue:c={},forceReadOnly:o=!1,layout:l="fluid",actions:r=!0,filters:n=[]})=>{const{control:g}=S.useFormContext(),{isView:m,isReadOnly:h}=M.useFluigRuntime(),{isReadOnly:y}=M.useSection(),p=o||m||h||y&&y(e),{field:R,visibleRows:f,selectedRowIds:b,isAllSelected:x,handle:N}=Be({name:e,control:g,defaultRowValue:c,isView:m,isReadOnly:!!p,filters:n}),k=l==="fixed";return t.jsxs("div",{className:`table-wrapper ${k?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...R}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:s}),!p&&r&&t.jsxs("div",{className:"handle-actions",children:[t.jsxs("button",{type:"button",className:`btn ${b.length>0?"btn-danger":""}`,disabled:b.length===0,onClick:N.removeRows,children:["Remover (",b.length,")"]}),t.jsx("button",{type:"button",className:"btn-add",onClick:N.addRow,children:"Adicionar"})]})]}),t.jsx("div",{className:"table-scroll",children:t.jsxs("table",{className:"table-custom",children:[t.jsx("thead",{children:t.jsxs("tr",{children:[!p&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:x,onChange:j=>N.toggleSelectAll(j.target.checked)})}),a.map(j=>t.jsx("th",{style:j.width?{minWidth:k?j.width:"100%"}:{width:"max-content"},children:j.label},j.key))]})}),t.jsxs("tbody",{children:[f.map((j,i)=>t.jsxs("tr",{children:[!p&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:b.includes(j._uid),onChange:()=>N.toggleSelection(j._uid)})}),a.map(d=>t.jsx("td",{children:d.render?d.render.length<=1?d.render({row:j,index:i,updateRow:(v,_)=>N.updateCellValue(j._uid,v,_),isLocked:!!p,isView:!!m}):d.render(j,i,(v,_)=>N.updateCellValue(j._uid,v,_),!!p,!!m):j[d.key]},`${j._uid}-${d.key}`))]},j._uid)),f.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:p?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ze=e=>{const[s,a]=u.useState(null),{watch:c}=S.useFormContext(),o=c(e),l=u.useCallback(()=>{try{const n=window.top.__REACT_ATTACHMENT_BRIDGE__;if(n){const g=n.getAttachment(e);a(g||(o?{name:o,documentId:0}:null))}else a(o?{name:o,documentId:0}:null)}catch{a(o?{name:o,documentId:0}:null)}},[e,o]);return u.useEffect(()=>{l();const r=setInterval(l,2e3);return()=>clearInterval(r)},[l]),{attachment:s,sync:l}},Xe=({name:e,label:s,help:a})=>{const[c,o]=u.useState(!1),{control:l}=S.useFormContext(),{field:r}=S.useController({name:e,control:l}),{attachment:n,sync:g}=ze(e),m=()=>{var f;try{const b=window.top;return{bridge:b.__REACT_ATTACHMENT_BRIDGE__,toast:(f=b.FLUIGC)==null?void 0:f.toast}}catch{return{bridge:null,toast:null}}},h=u.useCallback(()=>{const f=document.createElement("input");f.type="file",f.onchange=b=>{const x=b.target.files[0];if(!x)return;const{bridge:N,toast:k}=m();o(!0),N?N.upload(x,e,j=>{r.onChange(j.name),setTimeout(()=>{o(!1),g()},1e3),k&&k({title:"Sucesso",message:"Arquivo enviado",type:"success"})}):(r.onChange(x.name),o(!1))},f.click()},[e,r,g]),y=f=>{f.stopPropagation();const b=(n==null?void 0:n.name)||r.value;if(!b)return;const{bridge:x,toast:N}=m();x?x.removeByFileName(b)?(r.onChange(""),g()):N&&N({title:"Erro",message:"Erro ao remover anexo",type:"danger"}):(r.onChange(""),g())},p=!!n&&!c,R=["fluig-attachment__box",p?"fluig-attachment__box--has-file":"",c?"fluig-attachment__box--uploading":""].join(" ");return t.jsxs("div",{className:"form-group fluig-attachment",children:[s&&t.jsx("label",{className:"fluig-attachment__label",children:s}),t.jsxs("div",{className:R,onClick:p?()=>{var f;return(f=m().bridge)==null?void 0:f.view(n.name)}:h,children:[t.jsxs("span",{className:"fluig-attachment__content",children:[t.jsx("i",{className:`fluigicon icon-sm ${c?"fluigicon-loop-test":p?"fluigicon-file-pdf":"fluigicon-paperclip"} fluig-attachment__icon`}),t.jsx("span",{className:"fluig-attachment__filename",children:c?" Enviando...":p?(n==null?void 0:n.name)||r.value:a||"Anexar"})]}),p&&t.jsx("button",{type:"button",className:"fluig-attachment__btn-remove btn btn-link text-danger",onClick:y,children:t.jsx("i",{className:"flaticon flaticon-trash icon-sm","aria-hidden":"true"})})]}),t.jsx("input",{type:"hidden",name:e,value:r.value||""})]})},Ue=u.memo(Xe);function Ye({items:e,time:s=0,showNavigation:a=!0,progressBar:c=!0}){const[o,l]=u.useState(0),[r,n]=u.useState(0),g=u.useRef(null),m=u.useRef(null),h=u.useCallback(()=>{l(b=>(b+1)%e.length),n(0)},[e.length]),y=u.useCallback(()=>{l(b=>(b-1+e.length)%e.length),n(0)},[e.length]);if(u.useEffect(()=>{if(s>0&&e.length>1){const x=100/s*100;g.current=setInterval(h,s),m.current=setInterval(()=>{n(N=>N>=100?0:N+x)},100)}return()=>{g.current&&clearInterval(g.current),m.current&&clearInterval(m.current)}},[s,h,e.length,o]),!e||e.length===0)return null;const p=e[o],R=typeof p=="string"?p:p.url,f=/\.(jpg|jpeg|png|gif|webp)$/i.test(R);return t.jsxs("div",{className:"carousel-root",children:[t.jsxs("div",{className:"carousel-viewport",children:[a&&e.length>1&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"nav-btn prev",onClick:y,children:t.jsx("i",{className:"flaticon flaticon-chevron-left"})}),t.jsx("button",{className:"nav-btn next",onClick:h,children:t.jsx("i",{className:"flaticon flaticon-chevron-right"})})]}),t.jsx("div",{className:"carousel-media",children:f?t.jsx("img",{src:R,alt:"Slide",className:"carousel-image"}):t.jsxs("div",{className:"carousel-file-fallback",children:[t.jsx("i",{className:"flaticon flaticon-file icon-xl"}),t.jsx("a",{href:R,target:"_blank",rel:"noreferrer",className:"btn-open",children:"Abrir Arquivo"})]})}),e.length>1&&t.jsx("div",{className:"carousel-dots",children:e.map((b,x)=>t.jsx("div",{className:`dot ${x===o?"active":""}`,onClick:()=>{l(x),n(0)}},x))})]}),c&&s>0&&e.length>1&&t.jsx("div",{className:"carousel-progress-container",children:t.jsx("div",{className:"carousel-progress-bar",style:{width:`${r}%`}})})]})}function Ge({title:e,isOpen:s,onOpen:a,onClose:c,content:o,footer:l,width:r}){const n=u.useCallback(g=>{g.key==="Escape"&&c()},[c]);return u.useEffect(()=>(s&&(document.addEventListener("keydown",n),a==null||a(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",n),document.body.style.overflow="auto"}),[s,n,a]),s?t.jsx("div",{className:"modal-overlay",onClick:c,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:r},className:"modal-container",onClick:g=>g.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:c,role:"button","aria-label":"Fechar modal",children:t.jsx("i",{className:"flaticon flaticon-close icon-md","aria-hidden":"true"})})]}),t.jsx("div",{className:"modal-content",children:o}),l&&t.jsx("div",{className:"modal-footer",children:l})]})}):null}function Qe({logo:e,childs:s,footer:a,contentExternal:c,bg:o,color:l,onSelect:r}){return t.jsxs("div",{className:"main-container dfea",children:[t.jsxs("div",{className:"sidebar-wrapper",style:{backgroundColor:`${o}`},children:[e&&t.jsx("div",{className:"sidebar-logo",children:t.jsx("img",{src:e,alt:"",width:"auto",height:"28px"})}),t.jsx("ul",{className:"sidebar-childs-content",children:s==null?void 0:s.map(n=>{var g,m;return n!=null&&n.options&&((g=n==null?void 0:n.options)==null?void 0:g.length)>0?t.jsx(t.Fragment,{children:t.jsxs("ul",{className:"sidebar-child sidebar-options-content",children:[t.jsxs("li",{className:"sidebar-child",onClick:()=>{var h;(h=n.action)==null||h.call(n),r==null||r(n.id)},style:{color:`${l}`},children:[n.icon&&t.jsx("i",{className:n.icon}),n.label]}),(m=n.options)==null?void 0:m.map(h=>t.jsx("li",{className:"sidebar-option",onClick:()=>{var y;(y=h.action)==null||y.call(h),r==null||r(h.id)},style:{color:`${l}`},children:h.label}))]})}):t.jsxs("li",{className:"sidebar-child",onClick:()=>{var h;(h=n.action)==null||h.call(n),r==null||r(n.id)},style:{color:`${l}`},children:[n.icon&&t.jsx("i",{className:n.icon}),n.label]})})}),a&&t.jsx("div",{className:"sidebar-footer",children:a})]}),t.jsx("div",{className:"sidebar-content-external",children:c})]})}exports.Attachment=Ue;exports.Carousel=Ye;exports.Checkbox=Z;exports.DatePicker=Ie;exports.Input=G;exports.Modal=Ge;exports.RadioBtn=ee;exports.Select=J;exports.Sidebar=Qe;exports.SimpleTable=Le;exports.StatusBadge=He;exports.TextArea=ne;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs as b, jsx as t, Fragment as U } from "react/jsx-runtime";
2
- import { memo as T, useMemo as j, useCallback as $, useState as W, useRef as B, useEffect as V, forwardRef as K } from "react";
2
+ import { memo as T, useMemo as j, useCallback as $, useState as W, useRef as B, useEffect as A, forwardRef as K } from "react";
3
3
  import { useFormContext as O, useController as I, useFormState as ee } from "react-hook-form";
4
4
  import { IMaskInput as te } from "react-imask";
5
5
  import { useSection as E, useFluigRuntime as D } from "@fluig-kit/ecm";
@@ -21,7 +21,7 @@ function le({
21
21
  forceReadOnly: s = !1,
22
22
  forceHidden: n = !1
23
23
  }) {
24
- const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), k = n || !!u(e), { control: w } = O(), { isView: P } = D(), { field: h } = I({ name: e, control: w }), { errors: v } = ee({ name: e }), g = v == null ? void 0 : v[e], N = j(
24
+ const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), w = n || !!u(e), { control: N } = O(), { isView: P } = D(), { field: h } = I({ name: e, control: N }), { errors: v } = ee({ name: e }), g = v == null ? void 0 : v[e], k = j(
25
25
  () => o ? ie[o] ?? o : null,
26
26
  [o]
27
27
  ), R = $((i) => {
@@ -38,13 +38,13 @@ function le({
38
38
  return P ? /* @__PURE__ */ b("div", { className: "form-group", children: [
39
39
  /* @__PURE__ */ t("label", { children: r }),
40
40
  /* @__PURE__ */ t("span", { className: "form-control", children: h.value || "-" })
41
- ] }) : /* @__PURE__ */ b("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
41
+ ] }) : /* @__PURE__ */ b("div", { className: `form-group ${w ? "hidden" : ""}`, children: [
42
42
  /* @__PURE__ */ t("label", { children: r }),
43
- N ? /* @__PURE__ */ t(
43
+ k ? /* @__PURE__ */ t(
44
44
  te,
45
45
  {
46
46
  name: e,
47
- mask: N,
47
+ mask: k,
48
48
  value: String(h.value ?? ""),
49
49
  unmask: !1,
50
50
  onAccept: (i) => h.onChange(y(i)),
@@ -82,36 +82,36 @@ function ce({
82
82
  loading: f = !1,
83
83
  onSearchChange: u,
84
84
  debounceTime: m = 300,
85
- onSelect: k,
86
- forceReadOnly: w = !1,
85
+ onSelect: w,
86
+ forceReadOnly: N = !1,
87
87
  forceHidden: P = !1
88
88
  }) {
89
- const { isReadOnly: h, isHidden: v } = E(), g = w || !!h(e), N = P || !!v(e), { control: R, clearErrors: y } = O(), { isView: i } = D(), {
89
+ const { isReadOnly: h, isHidden: v } = E(), g = N || !!h(e), k = P || !!v(e), { control: R, clearErrors: y } = O(), { isView: i } = D(), {
90
90
  field: { onChange: d, value: p, ref: S },
91
91
  fieldState: { error: C }
92
92
  } = I({
93
93
  name: e,
94
94
  control: R
95
- }), [_, M] = W(!1), [A, G] = W(""), L = B(null), z = B(u);
96
- V(() => {
95
+ }), [_, M] = W(!1), [V, G] = W(""), L = B(null), z = B(u);
96
+ A(() => {
97
97
  z.current = u;
98
- }, [u]), V(() => {
98
+ }, [u]), A(() => {
99
99
  const x = (F) => {
100
100
  L.current && !L.current.contains(F.target) && M(!1);
101
101
  };
102
102
  return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
103
- }, []), V(() => {
103
+ }, []), A(() => {
104
104
  _ || G("");
105
- }, [_]), V(() => {
105
+ }, [_]), A(() => {
106
106
  if (!s) return;
107
107
  const x = setTimeout(() => {
108
- z.current && z.current(A);
108
+ z.current && z.current(V);
109
109
  }, m);
110
110
  return () => clearTimeout(x);
111
- }, [A, s, m]);
112
- const Q = j(() => s && !u && A.trim() ? a.filter(
113
- (x) => String((x == null ? void 0 : x[o]) ?? "").toLowerCase().includes(A.toLowerCase())
114
- ) : a ?? [], [a, s, u, A, o]), J = j(() => {
111
+ }, [V, s, m]);
112
+ const Q = j(() => s && !u && V.trim() ? a.filter(
113
+ (x) => String((x == null ? void 0 : x[o]) ?? "").toLowerCase().includes(V.toLowerCase())
114
+ ) : a ?? [], [a, s, u, V, o]), J = j(() => {
115
115
  if (p == null) return "";
116
116
  if (typeof p == "object")
117
117
  return String(p[l] ?? "");
@@ -120,12 +120,12 @@ function ce({
120
120
  );
121
121
  return String(x ? (x == null ? void 0 : x[o]) ?? "" : p);
122
122
  }, [p, a, l, o]), Z = (x) => {
123
- g || (d(x[l]), k && k(x), y(e), M(!1));
123
+ g || (d(x[l]), w && w(x), y(e), M(!1));
124
124
  };
125
125
  return /* @__PURE__ */ b(
126
126
  "div",
127
127
  {
128
- className: `select-wrapper form-group ${N ? "hidden" : ""}`,
128
+ className: `select-wrapper form-group ${k ? "hidden" : ""}`,
129
129
  ref: L,
130
130
  children: [
131
131
  /* @__PURE__ */ t("label", { className: "control-label", children: r }),
@@ -148,7 +148,7 @@ function ce({
148
148
  {
149
149
  type: "text",
150
150
  className: "select-search-input",
151
- value: A,
151
+ value: V,
152
152
  onChange: (x) => G(x.target.value),
153
153
  placeholder: f ? "Carregando..." : n,
154
154
  autoFocus: !0,
@@ -183,14 +183,14 @@ function lt({
183
183
  forceHidden: s = !1
184
184
  }) {
185
185
  var p, S;
186
- const n = O(), { isView: f, isReadOnly: u } = D(), { isReadOnly: m, isHidden: k } = E(), w = m ? m(e) : !1, P = k ? k(e) : !1, h = l || w, v = s || P, g = h || u || f;
186
+ const n = O(), { isView: f, isReadOnly: u } = D(), { isReadOnly: m, isHidden: w } = E(), N = m ? m(e) : !1, P = w ? w(e) : !1, h = l || N, v = s || P, g = h || u || f;
187
187
  if (!n || !e)
188
188
  return console.error("Checkbox requer contexto de formulário e nome."), null;
189
- const N = () => !r || !n ? {} : r.reduce((C, _) => {
190
- const M = _[c], A = n.getValues(M);
191
- return C[M] = A === "on", C;
192
- }, {}), R = n.watch(e), y = j(() => R && typeof R == "object" ? R : N(), [R, r, c]);
193
- V(() => {
189
+ const k = () => !r || !n ? {} : r.reduce((C, _) => {
190
+ const M = _[c], V = n.getValues(M);
191
+ return C[M] = V === "on", C;
192
+ }, {}), R = n.watch(e), y = j(() => R && typeof R == "object" ? R : k(), [R, r, c]);
193
+ A(() => {
194
194
  const C = n.getValues(e);
195
195
  (!C || typeof C != "object") && n.setValue(e, y, {
196
196
  shouldDirty: !1,
@@ -226,7 +226,7 @@ function lt({
226
226
  type: "checkbox",
227
227
  checked: M,
228
228
  disabled: g,
229
- onChange: (A) => i(_, A.target.checked)
229
+ onChange: (V) => i(_, V.target.checked)
230
230
  }
231
231
  ),
232
232
  /* @__PURE__ */ t("span", { className: "checkmark" }),
@@ -251,24 +251,24 @@ function de({
251
251
  forceReadOnly: s = !1,
252
252
  forceHidden: n = !1
253
253
  }) {
254
- const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), k = n || !!u(e), { control: w } = O(), { isView: P, isReadOnly: h } = D(), {
254
+ const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), w = n || !!u(e), { control: N } = O(), { isView: P, isReadOnly: h } = D(), {
255
255
  field: v,
256
256
  fieldState: { error: g }
257
257
  } = I({
258
258
  name: e,
259
- control: w
260
- }), N = m || h || P, R = v.value ?? "", y = $(
259
+ control: N
260
+ }), k = m || h || P, R = v.value ?? "", y = $(
261
261
  (i) => {
262
- N || v.onChange(i);
262
+ k || v.onChange(i);
263
263
  },
264
- [N, v]
264
+ [k, v]
265
265
  );
266
- return /* @__PURE__ */ b("div", { className: `form-group column ${k ? "hidden" : ""}`, children: [
266
+ return /* @__PURE__ */ b("div", { className: `form-group column ${w ? "hidden" : ""}`, children: [
267
267
  r && /* @__PURE__ */ t("label", { className: "control-label", children: r }),
268
268
  /* @__PURE__ */ t(
269
269
  "div",
270
270
  {
271
- className: `btn-group ${N ? "view-mode" : ""}`,
271
+ className: `btn-group ${k ? "view-mode" : ""}`,
272
272
  "data-field-name": e,
273
273
  children: a.map((i) => {
274
274
  const d = i[c], p = R === d, S = i.color ? { "--customColor": i.color } : void 0;
@@ -289,7 +289,7 @@ function de({
289
289
  checked: p,
290
290
  className: "hidden",
291
291
  onChange: () => y(d),
292
- disabled: N
292
+ disabled: k
293
293
  }
294
294
  ),
295
295
  i[l] && /* @__PURE__ */ t("i", { className: `${i[l]} icon-sm` }),
@@ -315,17 +315,17 @@ const ct = T(de), ue = ({
315
315
  forceReadOnly: s = !1,
316
316
  forceHidden: n = !1
317
317
  }) => {
318
- const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), k = n || !!u(e), { control: w } = O(), { isView: P } = D(), {
318
+ const { isReadOnly: f, isHidden: u } = E(), m = s || !!f(e), w = n || !!u(e), { control: N } = O(), { isView: P } = D(), {
319
319
  field: h,
320
320
  fieldState: { error: v }
321
321
  } = I({
322
322
  name: e,
323
- control: w
323
+ control: N
324
324
  });
325
- return P ? /* @__PURE__ */ b("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
325
+ return P ? /* @__PURE__ */ b("div", { className: `form-group ${w ? "hidden" : ""}`, children: [
326
326
  /* @__PURE__ */ t("label", { children: r }),
327
327
  /* @__PURE__ */ t("span", { className: "form-control", children: h.value || "-" })
328
- ] }) : /* @__PURE__ */ b("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
328
+ ] }) : /* @__PURE__ */ b("div", { className: `form-group ${w ? "hidden" : ""}`, children: [
329
329
  /* @__PURE__ */ t("label", { children: r }),
330
330
  /* @__PURE__ */ t(
331
331
  "textarea",
@@ -368,9 +368,9 @@ function q(e) {
368
368
  const c = a.width, o = c && e.matchPatterns[c] || e.matchPatterns[e.defaultMatchWidth], l = r.match(o);
369
369
  if (!l)
370
370
  return null;
371
- const s = l[0], n = c && e.parsePatterns[c] || e.parsePatterns[e.defaultParseWidth], f = Array.isArray(n) ? he(n, (k) => k.test(s)) : (
371
+ const s = l[0], n = c && e.parsePatterns[c] || e.parsePatterns[e.defaultParseWidth], f = Array.isArray(n) ? he(n, (w) => w.test(s)) : (
372
372
  // [TODO] -- I challenge you to fix the type
373
- me(n, (k) => k.test(s))
373
+ me(n, (w) => w.test(s))
374
374
  );
375
375
  let u;
376
376
  u = e.valueCallback ? e.valueCallback(f) : f, u = a.valueCallback ? (
@@ -659,7 +659,7 @@ const ge = {
659
659
  formattingValues: $e,
660
660
  defaultFormattingWidth: "wide"
661
661
  })
662
- }, Ae = /^(\d+)[ºªo]?/i, Ve = /\d+/i, Oe = {
662
+ }, Ve = /^(\d+)[ºªo]?/i, Ae = /\d+/i, Oe = {
663
663
  narrow: /^(ac|dc|a|d)/i,
664
664
  abbreviated: /^(a\.?\s?c\.?|d\.?\s?c\.?)/i,
665
665
  wide: /^(antes de cristo|depois de cristo)/i
@@ -730,8 +730,8 @@ const ge = {
730
730
  }
731
731
  }, Be = {
732
732
  ordinalNumber: fe({
733
- matchPattern: Ae,
734
- parsePattern: Ve,
733
+ matchPattern: Ve,
734
+ parsePattern: Ae,
735
735
  valueCallback: (e) => parseInt(e, 10)
736
736
  }),
737
737
  era: q({
@@ -802,17 +802,17 @@ const Y = "dd/MM/yyyy", ze = (e) => {
802
802
  forceReadOnly: o = !1,
803
803
  forceHidden: l = !1
804
804
  }) => {
805
- const { control: s } = O(), { isView: n } = D(), { isReadOnly: f, isHidden: u } = E(), m = o || !!f(e), k = l || !!u(e), {
806
- field: { onChange: w, onBlur: P, value: h, ref: v },
805
+ const { control: s } = O(), { isView: n } = D(), { isReadOnly: f, isHidden: u } = E(), m = o || !!f(e), w = l || !!u(e), {
806
+ field: { onChange: N, onBlur: P, value: h, ref: v },
807
807
  fieldState: { error: g }
808
808
  } = I({
809
809
  name: e,
810
810
  control: s
811
- }), N = j(() => ze(h), [h]), R = $(
811
+ }), k = j(() => ze(h), [h]), R = $(
812
812
  (i) => {
813
- w(i ? Xe(i) : "");
813
+ N(i ? Xe(i) : "");
814
814
  },
815
- [w]
815
+ [N]
816
816
  ), y = $(
817
817
  (i) => {
818
818
  var d, p;
@@ -840,7 +840,7 @@ const Y = "dd/MM/yyyy", ze = (e) => {
840
840
  },
841
841
  [v, s, e]
842
842
  );
843
- return k ? null : n ? /* @__PURE__ */ b("div", { className: "form-group", children: [
843
+ return w ? null : n ? /* @__PURE__ */ b("div", { className: "form-group", children: [
844
844
  /* @__PURE__ */ t("label", { children: r }),
845
845
  /* @__PURE__ */ t("span", { className: "form-control", children: h || "-" })
846
846
  ] }) : /* @__PURE__ */ b("div", { className: `form-group fluig-style-guide ${c}`, children: [
@@ -850,7 +850,7 @@ const Y = "dd/MM/yyyy", ze = (e) => {
850
850
  {
851
851
  id: e,
852
852
  name: e,
853
- selected: N,
853
+ selected: k,
854
854
  onChange: R,
855
855
  onBlur: P,
856
856
  dateFormat: Y,
@@ -904,31 +904,31 @@ function Qe({
904
904
  isReadOnly: o,
905
905
  filters: l = []
906
906
  }) {
907
- const { field: s } = I({ name: e, control: r }), [n, f] = W([]), [u, m] = W([]), k = () => Date.now() + Math.random(), w = (i) => {
907
+ const { field: s } = I({ name: e, control: r }), [n, f] = W([]), [u, m] = W([]), w = () => Date.now() + Math.random(), N = (i) => {
908
908
  try {
909
909
  const d = JSON.parse(i);
910
910
  return Array.isArray(d) ? d.map((p) => ({
911
911
  ...p,
912
- _uid: p._uid || k()
912
+ _uid: p._uid || w()
913
913
  })) : [];
914
914
  } catch (d) {
915
915
  return console.error(`Erro ao ler dados da tabela "${e}":`, d), [];
916
916
  }
917
917
  };
918
- V(() => {
918
+ A(() => {
919
919
  if (!(n.length > 0 && !c) && s.value && typeof s.value == "string") {
920
920
  const i = JSON.stringify(n);
921
921
  if (s.value === i) return;
922
- const d = w(s.value);
922
+ const d = N(s.value);
923
923
  f(d);
924
924
  }
925
- }, [s.value, c]), V(() => {
925
+ }, [s.value, c]), A(() => {
926
926
  if (o) return;
927
927
  const i = JSON.stringify(n);
928
928
  s.value !== i && s.onChange(i);
929
929
  }, [n, s, o]);
930
930
  const P = $(() => {
931
- const i = { _uid: k(), ...a };
931
+ const i = { _uid: w(), ...a };
932
932
  f((d) => [...d, i]);
933
933
  }, [a]), h = $(() => {
934
934
  f(
@@ -947,7 +947,7 @@ function Qe({
947
947
  m(
948
948
  (d) => d.includes(i) ? d.filter((p) => p !== i) : [...d, i]
949
949
  );
950
- }, []), N = $(
950
+ }, []), k = $(
951
951
  (i) => {
952
952
  m(i ? n.map((d) => d._uid) : []);
953
953
  },
@@ -986,7 +986,7 @@ function Qe({
986
986
  removeRows: h,
987
987
  updateCellValue: v,
988
988
  toggleSelection: g,
989
- toggleSelectAll: N
989
+ toggleSelectAll: k
990
990
  }
991
991
  };
992
992
  }
@@ -1000,26 +1000,26 @@ const ht = ({
1000
1000
  actions: s = !0,
1001
1001
  filters: n = []
1002
1002
  }) => {
1003
- const { control: f } = O(), { isView: u, isReadOnly: m } = D(), { isReadOnly: k } = E(), w = o || u || m || k && k(e), { field: P, visibleRows: h, selectedRowIds: v, isAllSelected: g, handle: N } = Qe({
1003
+ const { control: f } = O(), { isView: u, isReadOnly: m } = D(), { isReadOnly: w } = E(), N = o || u || m || w && w(e), { field: P, visibleRows: h, selectedRowIds: v, isAllSelected: g, handle: k } = Qe({
1004
1004
  name: e,
1005
1005
  control: f,
1006
1006
  defaultRowValue: c,
1007
1007
  isView: u,
1008
- isReadOnly: !!w,
1008
+ isReadOnly: !!N,
1009
1009
  filters: n
1010
1010
  }), R = l === "fixed";
1011
1011
  return /* @__PURE__ */ b("div", { className: `table-wrapper ${R ? "table-fixed" : "table-fluid"}`, children: [
1012
1012
  /* @__PURE__ */ t("input", { type: "hidden", ...P }),
1013
1013
  /* @__PURE__ */ b("div", { className: "header-handle", children: [
1014
1014
  /* @__PURE__ */ t("h3", { children: r }),
1015
- !w && s && /* @__PURE__ */ b("div", { className: "handle-actions", children: [
1015
+ !N && s && /* @__PURE__ */ b("div", { className: "handle-actions", children: [
1016
1016
  /* @__PURE__ */ b(
1017
1017
  "button",
1018
1018
  {
1019
1019
  type: "button",
1020
1020
  className: `btn ${v.length > 0 ? "btn-danger" : ""}`,
1021
1021
  disabled: v.length === 0,
1022
- onClick: N.removeRows,
1022
+ onClick: k.removeRows,
1023
1023
  children: [
1024
1024
  "Remover (",
1025
1025
  v.length,
@@ -1027,17 +1027,17 @@ const ht = ({
1027
1027
  ]
1028
1028
  }
1029
1029
  ),
1030
- /* @__PURE__ */ t("button", { type: "button", className: "btn-add", onClick: N.addRow, children: "Adicionar" })
1030
+ /* @__PURE__ */ t("button", { type: "button", className: "btn-add", onClick: k.addRow, children: "Adicionar" })
1031
1031
  ] })
1032
1032
  ] }),
1033
1033
  /* @__PURE__ */ t("div", { className: "table-scroll", children: /* @__PURE__ */ b("table", { className: "table-custom", children: [
1034
1034
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ b("tr", { children: [
1035
- !w && /* @__PURE__ */ t("th", { style: { width: "50px" }, children: /* @__PURE__ */ t(
1035
+ !N && /* @__PURE__ */ t("th", { style: { width: "50px" }, children: /* @__PURE__ */ t(
1036
1036
  "input",
1037
1037
  {
1038
1038
  type: "checkbox",
1039
1039
  checked: g,
1040
- onChange: (y) => N.toggleSelectAll(y.target.checked)
1040
+ onChange: (y) => k.toggleSelectAll(y.target.checked)
1041
1041
  }
1042
1042
  ) }),
1043
1043
  a.map((y) => /* @__PURE__ */ t(
@@ -1051,29 +1051,29 @@ const ht = ({
1051
1051
  ] }) }),
1052
1052
  /* @__PURE__ */ b("tbody", { children: [
1053
1053
  h.map((y, i) => /* @__PURE__ */ b("tr", { children: [
1054
- !w && /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(
1054
+ !N && /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t(
1055
1055
  "input",
1056
1056
  {
1057
1057
  type: "checkbox",
1058
1058
  checked: v.includes(y._uid),
1059
- onChange: () => N.toggleSelection(y._uid)
1059
+ onChange: () => k.toggleSelection(y._uid)
1060
1060
  }
1061
1061
  ) }),
1062
1062
  a.map((d) => /* @__PURE__ */ t("td", { children: d.render ? d.render.length <= 1 ? d.render({
1063
1063
  row: y,
1064
1064
  index: i,
1065
- updateRow: (p, S) => N.updateCellValue(y._uid, p, S),
1066
- isLocked: !!w,
1065
+ updateRow: (p, S) => k.updateCellValue(y._uid, p, S),
1066
+ isLocked: !!N,
1067
1067
  isView: !!u
1068
1068
  }) : d.render(
1069
1069
  y,
1070
1070
  i,
1071
- (p, S) => N.updateCellValue(y._uid, p, S),
1072
- !!w,
1071
+ (p, S) => k.updateCellValue(y._uid, p, S),
1072
+ !!N,
1073
1073
  !!u
1074
1074
  ) : y[d.key] }, `${y._uid}-${d.key}`))
1075
1075
  ] }, y._uid)),
1076
- h.length === 0 && /* @__PURE__ */ t("tr", { className: "empty-row", children: /* @__PURE__ */ t("td", { colSpan: 100, className: "text-center", children: w ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1076
+ h.length === 0 && /* @__PURE__ */ t("tr", { className: "empty-row", children: /* @__PURE__ */ t("td", { colSpan: 100, className: "text-center", children: N ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1077
1077
  ] })
1078
1078
  ] }) })
1079
1079
  ] });
@@ -1090,7 +1090,7 @@ const ht = ({
1090
1090
  a(o ? { name: o, documentId: 0 } : null);
1091
1091
  }
1092
1092
  }, [e, o]);
1093
- return V(() => {
1093
+ return A(() => {
1094
1094
  l();
1095
1095
  const s = setInterval(l, 2e3);
1096
1096
  return () => clearInterval(s);
@@ -1112,8 +1112,8 @@ const ht = ({
1112
1112
  h.type = "file", h.onchange = (v) => {
1113
1113
  const g = v.target.files[0];
1114
1114
  if (!g) return;
1115
- const { bridge: N, toast: R } = u();
1116
- o(!0), N ? N.upload(g, e, (y) => {
1115
+ const { bridge: k, toast: R } = u();
1116
+ o(!0), k ? k.upload(g, e, (y) => {
1117
1117
  s.onChange(y.name), setTimeout(() => {
1118
1118
  o(!1), f();
1119
1119
  }, 1e3), R && R({
@@ -1123,23 +1123,19 @@ const ht = ({
1123
1123
  });
1124
1124
  }) : (s.onChange(g.name), o(!1));
1125
1125
  }, h.click();
1126
- }, [e, s, f]), k = (h) => {
1126
+ }, [e, s, f]), w = (h) => {
1127
1127
  h.stopPropagation();
1128
1128
  const v = (n == null ? void 0 : n.name) || s.value;
1129
1129
  if (!v) return;
1130
- const { bridge: g, toast: N } = u();
1131
- g ? g.removeByFileName(v) ? (s.onChange(""), f(), N && N({
1132
- title: "Sucesso",
1133
- message: "Anexo removido",
1134
- type: "success"
1135
- })) : N && N({
1130
+ const { bridge: g, toast: k } = u();
1131
+ g ? g.removeByFileName(v) ? (s.onChange(""), f()) : k && k({
1136
1132
  title: "Erro",
1137
1133
  message: "Erro ao remover anexo",
1138
1134
  type: "danger"
1139
1135
  }) : (s.onChange(""), f());
1140
- }, w = !!n && !c, P = [
1136
+ }, N = !!n && !c, P = [
1141
1137
  "fluig-attachment__box",
1142
- w ? "fluig-attachment__box--has-file" : "",
1138
+ N ? "fluig-attachment__box--has-file" : "",
1143
1139
  c ? "fluig-attachment__box--uploading" : ""
1144
1140
  ].join(" ");
1145
1141
  return /* @__PURE__ */ b("div", { className: "form-group fluig-attachment", children: [
@@ -1148,7 +1144,7 @@ const ht = ({
1148
1144
  "div",
1149
1145
  {
1150
1146
  className: P,
1151
- onClick: w ? () => {
1147
+ onClick: N ? () => {
1152
1148
  var h;
1153
1149
  return (h = u().bridge) == null ? void 0 : h.view(n.name);
1154
1150
  } : m,
@@ -1157,17 +1153,17 @@ const ht = ({
1157
1153
  /* @__PURE__ */ t(
1158
1154
  "i",
1159
1155
  {
1160
- className: `fluigicon icon-sm ${c ? "fluigicon-loop-test" : w ? "fluigicon-file-pdf" : "fluigicon-paperclip"} fluig-attachment__icon`
1156
+ className: `fluigicon icon-sm ${c ? "fluigicon-loop-test" : N ? "fluigicon-file-pdf" : "fluigicon-paperclip"} fluig-attachment__icon`
1161
1157
  }
1162
1158
  ),
1163
- /* @__PURE__ */ t("span", { className: "fluig-attachment__filename", children: c ? " Enviando..." : w ? n.name : a || "Anexar" })
1159
+ /* @__PURE__ */ t("span", { className: "fluig-attachment__filename", children: c ? " Enviando..." : N ? (n == null ? void 0 : n.name) || s.value : a || "Anexar" })
1164
1160
  ] }),
1165
- w && /* @__PURE__ */ t(
1161
+ N && /* @__PURE__ */ t(
1166
1162
  "button",
1167
1163
  {
1168
1164
  type: "button",
1169
1165
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1170
- onClick: k,
1166
+ onClick: w,
1171
1167
  children: /* @__PURE__ */ t(
1172
1168
  "i",
1173
1169
  {
@@ -1191,25 +1187,25 @@ function gt({
1191
1187
  }) {
1192
1188
  const [o, l] = W(0), [s, n] = W(0), f = B(null), u = B(null), m = $(() => {
1193
1189
  l((v) => (v + 1) % e.length), n(0);
1194
- }, [e.length]), k = $(() => {
1190
+ }, [e.length]), w = $(() => {
1195
1191
  l((v) => (v - 1 + e.length) % e.length), n(0);
1196
1192
  }, [e.length]);
1197
- if (V(() => {
1193
+ if (A(() => {
1198
1194
  if (r > 0 && e.length > 1) {
1199
1195
  const g = 100 / r * 100;
1200
1196
  f.current = setInterval(m, r), u.current = setInterval(() => {
1201
- n((N) => N >= 100 ? 0 : N + g);
1197
+ n((k) => k >= 100 ? 0 : k + g);
1202
1198
  }, 100);
1203
1199
  }
1204
1200
  return () => {
1205
1201
  f.current && clearInterval(f.current), u.current && clearInterval(u.current);
1206
1202
  };
1207
1203
  }, [r, m, e.length, o]), !e || e.length === 0) return null;
1208
- const w = e[o], P = typeof w == "string" ? w : w.url, h = /\.(jpg|jpeg|png|gif|webp)$/i.test(P);
1204
+ const N = e[o], P = typeof N == "string" ? N : N.url, h = /\.(jpg|jpeg|png|gif|webp)$/i.test(P);
1209
1205
  return /* @__PURE__ */ b("div", { className: "carousel-root", children: [
1210
1206
  /* @__PURE__ */ b("div", { className: "carousel-viewport", children: [
1211
1207
  a && e.length > 1 && /* @__PURE__ */ b(U, { children: [
1212
- /* @__PURE__ */ t("button", { className: "nav-btn prev", onClick: k, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-left" }) }),
1208
+ /* @__PURE__ */ t("button", { className: "nav-btn prev", onClick: w, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-left" }) }),
1213
1209
  /* @__PURE__ */ t("button", { className: "nav-btn next", onClick: m, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-right" }) })
1214
1210
  ] }),
1215
1211
  /* @__PURE__ */ t("div", { className: "carousel-media", children: h ? /* @__PURE__ */ t("img", { src: P, alt: "Slide", className: "carousel-image" }) : /* @__PURE__ */ b("div", { className: "carousel-file-fallback", children: [
@@ -1260,7 +1256,7 @@ function bt({
1260
1256
  },
1261
1257
  [c]
1262
1258
  );
1263
- return V(() => (r && (document.addEventListener("keydown", n), a == null || a(), document.body.style.overflow = "hidden"), () => {
1259
+ return A(() => (r && (document.addEventListener("keydown", n), a == null || a(), document.body.style.overflow = "hidden"), () => {
1264
1260
  document.removeEventListener("keydown", n), document.body.style.overflow = "auto";
1265
1261
  }), [r, n, a]), r ? /* @__PURE__ */ t(
1266
1262
  "div",
@@ -1339,8 +1335,8 @@ function vt({
1339
1335
  {
1340
1336
  className: "sidebar-option",
1341
1337
  onClick: () => {
1342
- var k;
1343
- (k = m.action) == null || k.call(m), s == null || s(m.id);
1338
+ var w;
1339
+ (w = m.action) == null || w.call(m), s == null || s(m.id);
1344
1340
  },
1345
1341
  style: { color: `${l}` },
1346
1342
  children: m.label
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tech-diefra/fluig-ui",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",