@tech-diefra/fluig-ui 1.2.16 → 1.2.17

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"),$=require("@fluig-kit/ecm"),B=require("react-datepicker"),I=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:n="",type:d="text",mask:i,className:c="",forceReadOnly:o=!1,forceHidden:a=!1}){const{isReadOnly:x,isHidden:h}=$.useSection(),f=o||!!x(e),y=a||!!h(e),{control:w}=S.useFormContext(),{isView:b}=$.useFluigRuntime(),{field:j}=S.useController({name:e,control:w}),{errors:p}=S.useFormState({name:e}),v=p==null?void 0:p[e],N=u.useMemo(()=>i?U[i]??i:null,[i]),R=u.useCallback(r=>{if(!r)return"";const l=r.replace(/\D/g,"");return(Number(l)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),m=u.useCallback(r=>d==="monetary"?R(r):r,[d,R]);return b?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:j.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(j.value??""),unmask:!1,onAccept:r=>j.onChange(m(r)),placeholder:n,readOnly:f,className:`form-control ${v?"border-red":""} ${c}`,inputRef:j.ref,onBlur:j.onBlur}):t.jsx("input",{...j,type:"text",value:j.value??"",onChange:r=>j.onChange(m(r.target.value)),placeholder:n,readOnly:f,className:`form-control ${v?"border-red":""} ${c}`}),v&&t.jsx("p",{className:"text-danger",children:String(v.message)})]})}const G=u.memo(Y);function Q({name:e,label:s="",options:n=[],placeholder:d="",labelKey:i="label",valueKey:c="value",enableSearch:o=!1,searchPlaceholder:a="Buscar...",loading:x=!1,onSearchChange:h,debounceTime:f=300,onSelect:y,forceReadOnly:w=!1,forceHidden:b=!1}){const{isReadOnly:j,isHidden:p}=$.useSection(),v=w||!!j(e),N=b||!!p(e),{control:R,clearErrors:m}=S.useFormContext(),{isView:r}=$.useFluigRuntime(),{field:{onChange:l,value:g,ref:P},fieldState:{error:C}}=S.useController({name:e,control:R}),[M,F]=u.useState(!1),[O,q]=u.useState(""),W=u.useRef(null),D=u.useRef(h);u.useEffect(()=>{D.current=h},[h]),u.useEffect(()=>{const k=A=>{W.current&&!W.current.contains(A.target)&&F(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]),u.useEffect(()=>{M||q("")},[M]),u.useEffect(()=>{if(!o)return;const k=setTimeout(()=>{D.current&&D.current(O)},f);return()=>clearTimeout(k)},[O,o,f]);const H=u.useMemo(()=>o&&!h&&O.trim()?n.filter(k=>String((k==null?void 0:k[i])??"").toLowerCase().includes(O.toLowerCase())):n??[],[n,o,h,O,i]),L=u.useMemo(()=>{if(g==null)return"";if(typeof g=="object")return String(g[c]??"");const k=(n||[]).find(A=>String(A==null?void 0:A[c])===String(g));return String(k?(k==null?void 0:k[i])??"":g)},[g,n,c,i]),z=k=>{v||(l(k[c]),y&&y(k),m(e),F(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${N?"hidden":""}`,ref:W,children:[t.jsx("label",{className:"control-label",children:s}),r?t.jsx("span",{className:"form-control",children:L||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${C?"border-red":""} ${v?"readOnly":""}`,onClick:()=>!v&&F(k=>!k),ref:P,children:[t.jsx("span",{className:`select-display ${v?"readOnly":""}`,children:L||d}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),M&&!v&&t.jsxs("div",{className:"select-dropdown",children:[o&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:O,onChange:k=>q(k.target.value),placeholder:x?"Carregando...":a,autoFocus:!0,onClick:k=>k.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:x?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):H.length>0?H.map(k=>t.jsx("li",{onClick:()=>z(k),className:"select-option handleHover",children:k[i]},k[c])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),t.jsx("input",{type:"hidden",name:e,value:g||""}),C&&t.jsx("p",{className:"text-danger",children:String(C.message)})]})}const J=u.memo(Q);function Z({name:e,options:s=[],label:n="",valueKey:d="value",labelKey:i="label",forceReadOnly:c=!1,forceHidden:o=!1}){var g,P;const a=S.useFormContext(),{isView:x,isReadOnly:h}=$.useFluigRuntime(),{isReadOnly:f,isHidden:y}=$.useSection(),w=f?f(e):!1,b=y?y(e):!1,j=c||w,p=o||b,v=j||h||x;if(!a||!e)return console.error("Checkbox requer contexto de formulário e nome."),null;const N=()=>!s||!a?{}:s.reduce((C,M)=>{const F=M[d],O=a.getValues(F);return C[F]=O==="on",C},{}),R=a.watch(e),m=u.useMemo(()=>R&&typeof R=="object"?R:N(),[R,s,d]);u.useEffect(()=>{const C=a.getValues(e);(!C||typeof C!="object")&&a.setValue(e,m,{shouldDirty:!1,shouldValidate:!1})},[m,e,a]);const r=(C,M)=>{if(v)return;const F={...m,[C]:M};a.setValue(e,F,{shouldDirty:!0,shouldValidate:!0}),a.setValue(C,M?"on":"",{shouldValidate:!1})},l=(P=(g=a.formState)==null?void 0:g.errors)==null?void 0:P[e];return t.jsxs("div",{className:`form-group ${p?"hidden":""}`,children:[n&&t.jsx("label",{children:n}),t.jsx("div",{className:`checkbox-group-custom ${v?"readOnly":""}`,children:s.map(C=>{const M=String(C[d]),F=m[M]===!0;return t.jsxs("div",{children:[t.jsx("input",{type:"hidden",...a.register(M)}),t.jsxs("label",{className:`custom-checkbox ${F?"checked":""} ${v?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:F,disabled:v,onChange:O=>r(M,O.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:C[i]})]})]},M)})}),l&&t.jsx("p",{className:"text-danger",children:String(l.message)})]})}function K({name:e,label:s="",options:n=[],valueKey:d="value",labelKey:i="label",iconKey:c="icon",forceReadOnly:o=!1,forceHidden:a=!1}){const{isReadOnly:x,isHidden:h}=$.useSection(),f=o||!!x(e),y=a||!!h(e),{control:w}=S.useFormContext(),{isView:b,isReadOnly:j}=$.useFluigRuntime(),{field:p,fieldState:{error:v}}=S.useController({name:e,control:w}),N=f||j||b,R=p.value??"",m=u.useCallback(r=>{N||p.onChange(r)},[N,p]);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:n.map(r=>{const l=r[d],g=R===l,P=r.color?{"--customColor":r.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${l}`,style:P,className:`btn fs-ellipsis ${g?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${l}`,name:e,value:l,checked:g,className:"hidden",onChange:()=>m(l),disabled:N}),r[c]&&t.jsx("i",{className:`${r[c]} icon-sm`})," ",r[i]]},l)})}),v&&t.jsx("p",{className:"text-danger",children:String(v.message)})]})}const ee=u.memo(K),te=({name:e,label:s="",placeholder:n="",className:d="",rows:i=4,maxLength:c,forceReadOnly:o=!1,forceHidden:a=!1})=>{const{isReadOnly:x,isHidden:h}=$.useSection(),f=o||!!x(e),y=a||!!h(e),{control:w}=S.useFormContext(),{isView:b}=$.useFluigRuntime(),{field:j,fieldState:{error:p}}=S.useController({name:e,control:w});return b?t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:j.value||"-"})]}):t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:s}),t.jsx("textarea",{...j,rows:i,maxLength:c,value:j.value||"",placeholder:n,readOnly:f,className:`form-control ${p?"border-red":""} ${d}`}),p&&t.jsx("p",{className:"text-danger",children:String(p.message)})]})},ne=u.memo(te);function _(e){return(s={})=>{const n=s.width?String(s.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function V(e){return(s,n)=>{const d=n!=null&&n.context?String(n.context):"standalone";let i;if(d==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):o;i=e.formattingValues[a]||e.formattingValues[o]}else{const o=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[o]}const c=e.argumentCallback?e.argumentCallback(s):s;return i[c]}}function T(e){return(s,n={})=>{const d=n.width,i=d&&e.matchPatterns[d]||e.matchPatterns[e.defaultMatchWidth],c=s.match(i);if(!c)return null;const o=c[0],a=d&&e.parsePatterns[d]||e.parsePatterns[e.defaultParseWidth],x=Array.isArray(a)?se(a,y=>y.test(o)):ae(a,y=>y.test(o));let h;h=e.valueCallback?e.valueCallback(x):x,h=n.valueCallback?n.valueCallback(h):h;const f=s.slice(o.length);return{value:h,rest:f}}}function ae(e,s){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&s(e[n]))return n}function se(e,s){for(let n=0;n<e.length;n++)if(s(e[n]))return n}function re(e){return(s,n={})=>{const d=s.match(e.matchPattern);if(!d)return null;const i=d[0],c=s.match(e.parsePattern);if(!c)return null;let o=e.valueCallback?e.valueCallback(c[0]):c[0];o=n.valueCallback?n.valueCallback(o):o;const a=s.slice(i.length);return{value:o,rest:a}}}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,n)=>{let d;const i=oe[e];return typeof i=="string"?d=i:s===1?d=i.one:d=i.other.replace("{{count}}",String(s)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+d:"há "+d:d},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:_({formats:le,defaultWidth:"full"}),time:_({formats:ce,defaultWidth:"full"}),dateTime:_({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,n,d)=>{const i=me[e];return typeof i=="function"?i(s):i},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"]},pe={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"}},ve={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"}},je=(e,s)=>{const n=Number(e);return(s==null?void 0:s.unit)==="week"?n+"ª":n+"º"},ye={ordinalNumber:je,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:pe,defaultWidth:"wide",formattingValues:ve,defaultFormattingWidth:"wide"})},we=/^(\d+)[ºªo]?/i,Ce=/\d+/i,Ne={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]},$e={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},Pe={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]},Me={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},Fe={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]},Oe={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:we,parsePattern:Ce,valueCallback:e=>parseInt(e,10)}),era:T({matchPatterns:Ne,defaultMatchWidth:"wide",parsePatterns:ke,defaultParseWidth:"any"}),quarter:T({matchPatterns:Re,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any",valueCallback:e=>e+1}),month:T({matchPatterns:$e,defaultMatchWidth:"wide",parsePatterns:Pe,defaultParseWidth:"any"}),day:T({matchPatterns:Me,defaultMatchWidth:"wide",parsePatterns:Fe,defaultParseWidth:"any"}),dayPeriod:T({matchPatterns:Oe,defaultMatchWidth:"any",parsePatterns:Ae,defaultParseWidth:"any"})},Te={code:"pt-BR",formatDistance:ie,formatLong:ue,formatRelative:he,localize:ye,match:Ve,options:{weekStartsOn:0,firstWeekContainsDate:1}};B.registerLocale("pt-BR",Te);const E="dd/MM/yyyy",We=e=>{if(!e)return null;const s=I.parse(e,E,new Date);return I.isValid(s)?s:null},De=e=>e?I.format(e,E):"",_e=u.forwardRef(({shimRef:e,className:s,name:n,...d},i)=>t.jsx("input",{name:n,...d,className:s,ref:c=>{typeof i=="function"?i(c):i&&(i.current=c),e&&e(c)}})),Ie=({name:e,label:s="",placeholder:n="dd/mm/aaaa",className:d="",forceReadOnly:i=!1,forceHidden:c=!1})=>{const{control:o}=S.useFormContext(),{isView:a}=$.useFluigRuntime(),{isReadOnly:x,isHidden:h}=$.useSection(),f=i||!!x(e),y=c||!!h(e),{field:{onChange:w,onBlur:b,value:j,ref:p},fieldState:{error:v}}=S.useController({name:e,control:o}),N=u.useMemo(()=>We(j),[j]),R=u.useCallback(r=>{w(r?De(r):"")},[w]),m=u.useCallback(r=>{var l,g;if(p(r),r&&((g=(l=o._fields)==null?void 0:l[e])!=null&&g._f)){const P=o._fields[e];P._f.ref={focus:()=>{var C;return(C=r.focus)==null?void 0:C.call(r)},select:()=>{var C;return(C=r.select)==null?void 0:C.call(r)},setCustomValidity:C=>{var M;return(M=r.setCustomValidity)==null?void 0:M.call(r,C)},reportValidity:()=>{var C;return(C=r.reportValidity)==null?void 0:C.call(r)}}}},[p,o,e]);return y?null:a?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:s}),t.jsx("span",{className:"form-control",children:j||"-"})]}):t.jsxs("div",{className:`form-group fluig-style-guide ${d}`,children:[s&&t.jsx("label",{className:"control-label",htmlFor:e,children:s}),t.jsx("div",{className:`${v?"border-red":""}`,children:t.jsx(B,{id:e,name:e,selected:N,onChange:R,onBlur:b,dateFormat:E,placeholderText:n,disabled:f,readOnly:f,locale:"pt-BR",className:`form-control ${v?"border-red":""}`,wrapperClassName:"w-100",showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select",isClearable:!f&&!!j,autoComplete:"off",customInput:t.jsx(_e,{name:e,shimRef:m})})}),v&&t.jsx("span",{className:"help-block text-danger",children:String(v.message)})]})},Ee=u.memo(Ie);function qe({mapping:e={},defaultLabel:s="Não reconhecido",className:n="",hidden:d=!1,label:i}){const{activityId:c}=$.useFluigRuntime(),o=u.useMemo(()=>!e||c===null||c===void 0?null:e[c],[c,e]);if(!o)return t.jsxs("div",{className:`form-group ${d?"hidden":""}`,children:[i&&t.jsx("label",{children:i}),t.jsx("div",{className:`status-badge default ${n}`,children:s})]});const a={"--customColor":o.color};return t.jsxs("div",{className:`form-group ${d?"hidden":""}`,children:[i&&t.jsx("label",{children:i}),t.jsxs("div",{className:`status-badge ${n}`,style:a,children:[o.icon&&t.jsx("i",{className:o.icon}),t.jsx("span",{children:o.label})]})]})}const He=u.memo(qe);function Le({name:e,control:s,defaultRowValue:n,isView:d,isReadOnly:i,filters:c=[]}){const{field:o}=S.useController({name:e,control:s}),[a,x]=u.useState([]),[h,f]=u.useState([]),y=()=>Date.now()+Math.random(),w=r=>{try{const l=JSON.parse(r);return Array.isArray(l)?l.map(g=>({...g,_uid:g._uid||y()})):[]}catch(l){return console.error(`Erro ao ler dados da tabela "${e}":`,l),[]}};u.useEffect(()=>{if(!(a.length>0&&!d)&&o.value&&typeof o.value=="string"){const r=JSON.stringify(a);if(o.value===r)return;const l=w(o.value);x(l)}},[o.value,d]),u.useEffect(()=>{if(i)return;const r=JSON.stringify(a);o.value!==r&&o.onChange(r)},[a,o,i]);const b=u.useCallback(()=>{const r={_uid:y(),...n};x(l=>[...l,r])},[n]),j=u.useCallback(()=>{x(r=>r.filter(l=>!h.includes(l._uid))),f([])},[h]),p=u.useCallback((r,l,g)=>{x(P=>P.map(C=>C._uid===r?{...C,[l]:g}:C))},[]),v=u.useCallback(r=>{f(l=>l.includes(r)?l.filter(g=>g!==r):[...l,r])},[]),N=u.useCallback(r=>{f(r?a.map(l=>l._uid):[])},[a]),R=a.length>0&&h.length===a.length,m=u.useMemo(()=>!c||c.length===0?a:a.filter(r=>c.every(l=>{if("custom"in l)return l.custom(r);const g=r[l.field];switch(l.operator){case"===":return g===l.value;case"!==":return g!==l.value;case">":return g>l.value;case"<":return g<l.value;case">=":return g>=l.value;case"<=":return g<=l.value;default:return!0}})),[a,c]);return{field:o,tableRows:a,visibleRows:m,selectedRowIds:h,isAllSelected:R,handle:{addRow:b,removeRows:j,updateCellValue:p,toggleSelection:v,toggleSelectAll:N}}}const Be=({name:e,title:s="Tabela Dinâmica",columns:n,defaultRowValue:d={},forceReadOnly:i=!1,layout:c="fluid",actions:o=!0,filters:a=[]})=>{const{control:x}=S.useFormContext(),{isView:h,isReadOnly:f}=$.useFluigRuntime(),{isReadOnly:y}=$.useSection(),w=i||h||f||y&&y(e),{field:b,visibleRows:j,selectedRowIds:p,isAllSelected:v,handle:N}=Le({name:e,control:x,defaultRowValue:d,isView:h,isReadOnly:!!w,filters:a}),R=c==="fixed";return t.jsxs("div",{className:`table-wrapper ${R?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...b}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:s}),!w&&o&&t.jsxs("div",{className:"handle-actions",children:[t.jsxs("button",{type:"button",className:`btn ${p.length>0?"btn-danger":""}`,disabled:p.length===0,onClick:N.removeRows,children:["Remover (",p.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:[!w&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:v,onChange:m=>N.toggleSelectAll(m.target.checked)})}),n.map(m=>t.jsx("th",{style:m.width?{minWidth:R?m.width:"100%"}:{width:"max-content"},children:m.label},m.key))]})}),t.jsxs("tbody",{children:[j.map((m,r)=>t.jsxs("tr",{children:[!w&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:p.includes(m._uid),onChange:()=>N.toggleSelection(m._uid)})}),n.map(l=>t.jsx("td",{children:l.render?l.render.length<=1?l.render({row:m,index:r,updateRow:(g,P)=>N.updateCellValue(m._uid,g,P),isLocked:!!w,isView:!!h}):l.render(m,r,(g,P)=>N.updateCellValue(m._uid,g,P),!!w,!!h):m[l.key]},`${m._uid}-${l.key}`))]},m._uid)),j.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:w?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ze=e=>{const[s,n]=u.useState(null),{watch:d}=S.useFormContext(),i=d(e),c=u.useCallback(()=>{try{const a=window.top.__REACT_ATTACHMENT_BRIDGE__;if(a){const x=a.getAttachment(e);n(x||(i?{name:i,documentId:0}:null))}else n(i?{name:i,documentId:0}:null)}catch{n(i?{name:i,documentId:0}:null)}},[e,i]);return u.useEffect(()=>{c();const o=setInterval(c,1e3);return()=>clearInterval(o)},[c]),{attachment:s,sync:c}},Xe=({name:e,label:s,help:n,className:d="",showRemove:i=!0,showUpdate:c=!0})=>{const{isReadOnly:o}=$.useSection(),{isView:a}=$.useFluigRuntime(),{control:x}=S.useFormContext(),{field:h}=S.useController({name:e,control:x}),{attachment:f,sync:y}=ze(e),w=a||!!o(e),b=!!f,j=()=>{var m;try{const r=window.top;return{bridge:r.__REACT_ATTACHMENT_BRIDGE__,toast:(m=r.FLUIGC)==null?void 0:m.toast}}catch{return{bridge:null,toast:null}}},p=(m,r="info")=>{const{toast:l}=j();l?l({title:"Anexos: ",message:m,type:r}):console.log(`[LOCALHOST TOAST - ${r.toUpperCase()}]: ${m}`)},v=u.useCallback(()=>{if(w||b)return;const m=document.createElement("input");m.type="file",m.onchange=r=>{const l=r.target.files[0];if(!l)return;const{bridge:g}=j();g?(h.onChange(l.name),g.upload(l,e,P=>{h.onChange(P.name),p(`Arquivo ${l.name} enviado com sucesso!`,"success"),y()})):(h.onChange(l.name),p(`[LOCALHOST] Arquivo "${l.name}" simulado.`,"info"))},m.click()},[w,b,e,h,y]),N=()=>{if(!b)return;const{bridge:m}=j();m?m.view(e):p(`Visualização não disponível em localhost (${f.name})`,"warning")},R=m=>{m.stopPropagation();const{bridge:r}=j();window.confirm(`Deseja remover o anexo "${f.name}"?`)&&(r&&r.remove(e),h.onChange(""),p("Anexo removido.","danger"),y())};return t.jsxs("div",{className:`form-group ${d}`,style:{marginBottom:"15px"},children:[s&&t.jsx("label",{className:"control-label",children:s}),t.jsxs("div",{className:`attachment-container ${b?"has-file":""}`,style:{border:`1px ${b?"solid":"dashed"} ${b?"#5cb85c":"#ccc"}`,borderRadius:"4px",padding:"8px 15px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:w?"#f5f5f5":b?"#f9fff9":"#fff",cursor:w&&!b?"default":"pointer",minHeight:"48px",transition:"all 0.3s ease"},onClick:b?N:v,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1,overflow:"hidden"},children:[t.jsx("i",{className:`fluigicon ${b?"fluigicon-file-pdf":"fluigicon-paperclip"} icon-sm`,style:{color:b?"#5cb85c":"#777"}}),t.jsx("span",{style:{fontSize:"14px",fontWeight:b?"500":"400",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:b?"#333":"#777"},children:b?f.name:n||"Anexar arquivo"})]}),t.jsxs("div",{style:{display:"flex",gap:"8px",marginLeft:"10px"},children:[b&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link",title:"Visualizar",style:{padding:"0 5px",color:"#555"},children:t.jsx("i",{className:"fluigicon fluigicon-eye-open"})}),!w&&b&&t.jsxs(t.Fragment,{children:[c&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link",title:"Substituir",style:{padding:"0 5px",color:"#31708f"},onClick:m=>{R(m),setTimeout(v,400)},children:t.jsx("i",{className:"fluigicon fluigicon-refresh"})}),i&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link text-danger",title:"Remover",style:{padding:"0 5px"},onClick:R,children:t.jsx("i",{className:"fluigicon fluigicon-trash"})})]})]})]}),t.jsx("input",{type:"hidden",name:e,value:h.value||""})]})},Ue=u.memo(Xe);function Ye({items:e,time:s=0,showNavigation:n=!0,progressBar:d=!0}){const[i,c]=u.useState(0),[o,a]=u.useState(0),x=u.useRef(null),h=u.useRef(null),f=u.useCallback(()=>{c(p=>(p+1)%e.length),a(0)},[e.length]),y=u.useCallback(()=>{c(p=>(p-1+e.length)%e.length),a(0)},[e.length]);if(u.useEffect(()=>{if(s>0&&e.length>1){const v=100/s*100;x.current=setInterval(f,s),h.current=setInterval(()=>{a(N=>N>=100?0:N+v)},100)}return()=>{x.current&&clearInterval(x.current),h.current&&clearInterval(h.current)}},[s,f,e.length,i]),!e||e.length===0)return null;const w=e[i],b=typeof w=="string"?w:w.url,j=/\.(jpg|jpeg|png|gif|webp)$/i.test(b);return t.jsxs("div",{className:"carousel-root",children:[t.jsxs("div",{className:"carousel-viewport",children:[n&&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:f,children:t.jsx("i",{className:"flaticon flaticon-chevron-right"})})]}),t.jsx("div",{className:"carousel-media",children:j?t.jsx("img",{src:b,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:b,target:"_blank",rel:"noreferrer",className:"btn-open",children:"Abrir Arquivo"})]})}),e.length>1&&t.jsx("div",{className:"carousel-dots",children:e.map((p,v)=>t.jsx("div",{className:`dot ${v===i?"active":""}`,onClick:()=>{c(v),a(0)}},v))})]}),d&&s>0&&e.length>1&&t.jsx("div",{className:"carousel-progress-container",children:t.jsx("div",{className:"carousel-progress-bar",style:{width:`${o}%`}})})]})}function Ge({title:e,isOpen:s,onOpen:n,onClose:d,content:i,footer:c,width:o}){const a=u.useCallback(x=>{x.key==="Escape"&&d()},[d]);return u.useEffect(()=>(s&&(document.addEventListener("keydown",a),n==null||n(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow="auto"}),[s,a,n]),s?t.jsx("div",{className:"modal-overlay",onClick:d,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:o},className:"modal-container",onClick:x=>x.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:d,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:i}),c&&t.jsx("div",{className:"modal-footer",children:c})]})}):null}function Qe({logo:e,childs:s,footer:n,contentExternal:d,bg:i,color:c,onSelect:o}){return t.jsxs("div",{className:"main-container dfea",children:[t.jsxs("div",{className:"sidebar-wrapper",style:{backgroundColor:`${i}`},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(a=>{var x,h;return a!=null&&a.options&&((x=a==null?void 0:a.options)==null?void 0:x.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 f;(f=a.action)==null||f.call(a),o==null||o(a.id)},style:{color:`${c}`},children:[a.icon&&t.jsx("i",{className:a.icon}),a.label]}),(h=a.options)==null?void 0:h.map(f=>t.jsx("li",{className:"sidebar-option",onClick:()=>{var y;(y=f.action)==null||y.call(f),o==null||o(f.id)},style:{color:`${c}`},children:f.label}))]})}):t.jsxs("li",{className:"sidebar-child",onClick:()=>{var f;(f=a.action)==null||f.call(a),o==null||o(a.id)},style:{color:`${c}`},children:[a.icon&&t.jsx("i",{className:a.icon}),a.label]})})}),n&&t.jsx("div",{className:"sidebar-footer",children:n})]}),t.jsx("div",{className:"sidebar-content-external",children:d})]})}exports.Attachment=Ue;exports.Carousel=Ye;exports.Checkbox=Z;exports.DatePicker=Ee;exports.Input=G;exports.Modal=Ge;exports.RadioBtn=ee;exports.Select=J;exports.Sidebar=Qe;exports.SimpleTable=Be;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"),$=require("@fluig-kit/ecm"),B=require("react-datepicker"),I=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:a="",placeholder:n="",type:d="text",mask:i,className:c="",forceReadOnly:o=!1,forceHidden:s=!1}){const{isReadOnly:x,isHidden:f}=$.useSection(),h=o||!!x(e),y=s||!!f(e),{control:C}=S.useFormContext(),{isView:p}=$.useFluigRuntime(),{field:j}=S.useController({name:e,control:C}),{errors:b}=S.useFormState({name:e}),v=b==null?void 0:b[e],N=u.useMemo(()=>i?U[i]??i:null,[i]),R=u.useCallback(r=>{if(!r)return"";const l=r.replace(/\D/g,"");return(Number(l)/100).toLocaleString("pt-BR",{style:"currency",currency:"BRL"})},[]),m=u.useCallback(r=>d==="monetary"?R(r):r,[d,R]);return p?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:a}),t.jsx("span",{className:"form-control",children:j.value||"-"})]}):t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:a}),N?t.jsx(X.IMaskInput,{name:e,mask:N,value:String(j.value??""),unmask:!1,onAccept:r=>j.onChange(m(r)),placeholder:n,readOnly:h,className:`form-control ${v?"border-red":""} ${c}`,inputRef:j.ref,onBlur:j.onBlur}):t.jsx("input",{...j,type:"text",value:j.value??"",onChange:r=>j.onChange(m(r.target.value)),placeholder:n,readOnly:h,className:`form-control ${v?"border-red":""} ${c}`}),v&&t.jsx("p",{className:"text-danger",children:String(v.message)})]})}const G=u.memo(Y);function Q({name:e,label:a="",options:n=[],placeholder:d="",labelKey:i="label",valueKey:c="value",enableSearch:o=!1,searchPlaceholder:s="Buscar...",loading:x=!1,onSearchChange:f,debounceTime:h=300,onSelect:y,forceReadOnly:C=!1,forceHidden:p=!1}){const{isReadOnly:j,isHidden:b}=$.useSection(),v=C||!!j(e),N=p||!!b(e),{control:R,clearErrors:m}=S.useFormContext(),{isView:r}=$.useFluigRuntime(),{field:{onChange:l,value:g,ref:P},fieldState:{error:w}}=S.useController({name:e,control:R}),[M,O]=u.useState(!1),[A,q]=u.useState(""),W=u.useRef(null),D=u.useRef(f);u.useEffect(()=>{D.current=f},[f]),u.useEffect(()=>{const k=F=>{W.current&&!W.current.contains(F.target)&&O(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]),u.useEffect(()=>{M||q("")},[M]),u.useEffect(()=>{if(!o)return;const k=setTimeout(()=>{D.current&&D.current(A)},h);return()=>clearTimeout(k)},[A,o,h]);const H=u.useMemo(()=>o&&!f&&A.trim()?n.filter(k=>String((k==null?void 0:k[i])??"").toLowerCase().includes(A.toLowerCase())):n??[],[n,o,f,A,i]),L=u.useMemo(()=>{if(g==null)return"";if(typeof g=="object")return String(g[c]??"");const k=(n||[]).find(F=>String(F==null?void 0:F[c])===String(g));return String(k?(k==null?void 0:k[i])??"":g)},[g,n,c,i]),z=k=>{v||(l(k[c]),y&&y(k),m(e),O(!1))};return t.jsxs("div",{className:`select-wrapper form-group ${N?"hidden":""}`,ref:W,children:[t.jsx("label",{className:"control-label",children:a}),r?t.jsx("span",{className:"form-control",children:L||"-"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`select-control ${w?"border-red":""} ${v?"readOnly":""}`,onClick:()=>!v&&O(k=>!k),ref:P,children:[t.jsx("span",{className:`select-display ${v?"readOnly":""}`,children:L||d}),t.jsx("i",{className:"flaticon flaticon-chevron-down select-icon"})]}),M&&!v&&t.jsxs("div",{className:"select-dropdown",children:[o&&t.jsx("div",{className:"select-search",children:t.jsx("input",{type:"text",className:"select-search-input",value:A,onChange:k=>q(k.target.value),placeholder:x?"Carregando...":s,autoFocus:!0,onClick:k=>k.stopPropagation()})}),t.jsx("ul",{className:"select-options",children:x?t.jsx("li",{className:"select-option readOnly",children:"Carregando..."}):H.length>0?H.map(k=>t.jsx("li",{onClick:()=>z(k),className:"select-option handleHover",children:k[i]},k[c])):t.jsx("li",{className:"select-option readOnly",children:"Sem resultados"})})]})]}),t.jsx("input",{type:"hidden",name:e,value:g||""}),w&&t.jsx("p",{className:"text-danger",children:String(w.message)})]})}const J=u.memo(Q);function Z({name:e,options:a=[],label:n="",valueKey:d="value",labelKey:i="label",forceReadOnly:c=!1,forceHidden:o=!1}){var g,P;const s=S.useFormContext(),{isView:x,isReadOnly:f}=$.useFluigRuntime(),{isReadOnly:h,isHidden:y}=$.useSection(),C=h?h(e):!1,p=y?y(e):!1,j=c||C,b=o||p,v=j||f||x;if(!s||!e)return console.error("Checkbox requer contexto de formulário e nome."),null;const N=()=>!a||!s?{}:a.reduce((w,M)=>{const O=M[d],A=s.getValues(O);return w[O]=A==="on",w},{}),R=s.watch(e),m=u.useMemo(()=>R&&typeof R=="object"?R:N(),[R,a,d]);u.useEffect(()=>{const w=s.getValues(e);(!w||typeof w!="object")&&s.setValue(e,m,{shouldDirty:!1,shouldValidate:!1})},[m,e,s]);const r=(w,M)=>{if(v)return;const O={...m,[w]:M};s.setValue(e,O,{shouldDirty:!0,shouldValidate:!0}),s.setValue(w,M?"on":"",{shouldValidate:!1})},l=(P=(g=s.formState)==null?void 0:g.errors)==null?void 0:P[e];return t.jsxs("div",{className:`form-group ${b?"hidden":""}`,children:[n&&t.jsx("label",{children:n}),t.jsx("div",{className:`checkbox-group-custom ${v?"readOnly":""}`,children:a.map(w=>{const M=String(w[d]),O=m[M]===!0;return t.jsxs("div",{children:[t.jsx("input",{type:"hidden",...s.register(M)}),t.jsxs("label",{className:`custom-checkbox ${O?"checked":""} ${v?"readOnly":""}`,children:[t.jsx("input",{type:"checkbox",checked:O,disabled:v,onChange:A=>r(M,A.target.checked)}),t.jsx("span",{className:"checkmark"}),t.jsx("span",{children:w[i]})]})]},M)})}),l&&t.jsx("p",{className:"text-danger",children:String(l.message)})]})}function K({name:e,label:a="",options:n=[],valueKey:d="value",labelKey:i="label",iconKey:c="icon",forceReadOnly:o=!1,forceHidden:s=!1}){const{isReadOnly:x,isHidden:f}=$.useSection(),h=o||!!x(e),y=s||!!f(e),{control:C}=S.useFormContext(),{isView:p,isReadOnly:j}=$.useFluigRuntime(),{field:b,fieldState:{error:v}}=S.useController({name:e,control:C}),N=h||j||p,R=b.value??"",m=u.useCallback(r=>{N||b.onChange(r)},[N,b]);return t.jsxs("div",{className:`form-group column ${y?"hidden":""}`,children:[a&&t.jsx("label",{className:"control-label",children:a}),t.jsx("div",{className:`btn-group ${N?"view-mode":""}`,"data-field-name":e,children:n.map(r=>{const l=r[d],g=R===l,P=r.color?{"--customColor":r.color}:void 0;return t.jsxs("label",{htmlFor:`${e}_${l}`,style:P,className:`btn fs-ellipsis ${g?"active":""}`,children:[t.jsx("input",{type:"radio",id:`${e}_${l}`,name:e,value:l,checked:g,className:"hidden",onChange:()=>m(l),disabled:N}),r[c]&&t.jsx("i",{className:`${r[c]} icon-sm`})," ",r[i]]},l)})}),v&&t.jsx("p",{className:"text-danger",children:String(v.message)})]})}const ee=u.memo(K),te=({name:e,label:a="",placeholder:n="",className:d="",rows:i=4,maxLength:c,forceReadOnly:o=!1,forceHidden:s=!1})=>{const{isReadOnly:x,isHidden:f}=$.useSection(),h=o||!!x(e),y=s||!!f(e),{control:C}=S.useFormContext(),{isView:p}=$.useFluigRuntime(),{field:j,fieldState:{error:b}}=S.useController({name:e,control:C});return p?t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:a}),t.jsx("span",{className:"form-control",children:j.value||"-"})]}):t.jsxs("div",{className:`form-group ${y?"hidden":""}`,children:[t.jsx("label",{children:a}),t.jsx("textarea",{...j,rows:i,maxLength:c,value:j.value||"",placeholder:n,readOnly:h,className:`form-control ${b?"border-red":""} ${d}`}),b&&t.jsx("p",{className:"text-danger",children:String(b.message)})]})},ne=u.memo(te);function _(e){return(a={})=>{const n=a.width?String(a.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function V(e){return(a,n)=>{const d=n!=null&&n.context?String(n.context):"standalone";let i;if(d==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):o;i=e.formattingValues[s]||e.formattingValues[o]}else{const o=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[s]||e.values[o]}const c=e.argumentCallback?e.argumentCallback(a):a;return i[c]}}function T(e){return(a,n={})=>{const d=n.width,i=d&&e.matchPatterns[d]||e.matchPatterns[e.defaultMatchWidth],c=a.match(i);if(!c)return null;const o=c[0],s=d&&e.parsePatterns[d]||e.parsePatterns[e.defaultParseWidth],x=Array.isArray(s)?ae(s,y=>y.test(o)):se(s,y=>y.test(o));let f;f=e.valueCallback?e.valueCallback(x):x,f=n.valueCallback?n.valueCallback(f):f;const h=a.slice(o.length);return{value:f,rest:h}}}function se(e,a){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&a(e[n]))return n}function ae(e,a){for(let n=0;n<e.length;n++)if(a(e[n]))return n}function re(e){return(a,n={})=>{const d=a.match(e.matchPattern);if(!d)return null;const i=d[0],c=a.match(e.parsePattern);if(!c)return null;let o=e.valueCallback?e.valueCallback(c[0]):c[0];o=n.valueCallback?n.valueCallback(o):o;const s=a.slice(i.length);return{value:o,rest:s}}}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,a,n)=>{let d;const i=oe[e];return typeof i=="string"?d=i:a===1?d=i.one:d=i.other.replace("{{count}}",String(a)),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"em "+d:"há "+d:d},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:_({formats:le,defaultWidth:"full"}),time:_({formats:ce,defaultWidth:"full"}),dateTime:_({formats:de,defaultWidth:"full"})},me={lastWeek:e=>{const a=e.getDay();return"'"+(a===0||a===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,a,n,d)=>{const i=me[e];return typeof i=="function"?i(a):i},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"]},pe={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"}},ve={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"}},je=(e,a)=>{const n=Number(e);return(a==null?void 0:a.unit)==="week"?n+"ª":n+"º"},ye={ordinalNumber:je,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:pe,defaultWidth:"wide",formattingValues:ve,defaultFormattingWidth:"wide"})},Ce=/^(\d+)[ºªo]?/i,we=/\d+/i,Ne={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]},$e={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},Pe={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]},Me={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},Oe={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]},Ae={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},Fe={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:Ce,parsePattern:we,valueCallback:e=>parseInt(e,10)}),era:T({matchPatterns:Ne,defaultMatchWidth:"wide",parsePatterns:ke,defaultParseWidth:"any"}),quarter:T({matchPatterns:Re,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any",valueCallback:e=>e+1}),month:T({matchPatterns:$e,defaultMatchWidth:"wide",parsePatterns:Pe,defaultParseWidth:"any"}),day:T({matchPatterns:Me,defaultMatchWidth:"wide",parsePatterns:Oe,defaultParseWidth:"any"}),dayPeriod:T({matchPatterns:Ae,defaultMatchWidth:"any",parsePatterns:Fe,defaultParseWidth:"any"})},Te={code:"pt-BR",formatDistance:ie,formatLong:ue,formatRelative:he,localize:ye,match:Ve,options:{weekStartsOn:0,firstWeekContainsDate:1}};B.registerLocale("pt-BR",Te);const E="dd/MM/yyyy",We=e=>{if(!e)return null;const a=I.parse(e,E,new Date);return I.isValid(a)?a:null},De=e=>e?I.format(e,E):"",_e=u.forwardRef(({shimRef:e,className:a,name:n,...d},i)=>t.jsx("input",{name:n,...d,className:a,ref:c=>{typeof i=="function"?i(c):i&&(i.current=c),e&&e(c)}})),Ie=({name:e,label:a="",placeholder:n="dd/mm/aaaa",className:d="",forceReadOnly:i=!1,forceHidden:c=!1})=>{const{control:o}=S.useFormContext(),{isView:s}=$.useFluigRuntime(),{isReadOnly:x,isHidden:f}=$.useSection(),h=i||!!x(e),y=c||!!f(e),{field:{onChange:C,onBlur:p,value:j,ref:b},fieldState:{error:v}}=S.useController({name:e,control:o}),N=u.useMemo(()=>We(j),[j]),R=u.useCallback(r=>{C(r?De(r):"")},[C]),m=u.useCallback(r=>{var l,g;if(b(r),r&&((g=(l=o._fields)==null?void 0:l[e])!=null&&g._f)){const P=o._fields[e];P._f.ref={focus:()=>{var w;return(w=r.focus)==null?void 0:w.call(r)},select:()=>{var w;return(w=r.select)==null?void 0:w.call(r)},setCustomValidity:w=>{var M;return(M=r.setCustomValidity)==null?void 0:M.call(r,w)},reportValidity:()=>{var w;return(w=r.reportValidity)==null?void 0:w.call(r)}}}},[b,o,e]);return y?null:s?t.jsxs("div",{className:"form-group",children:[t.jsx("label",{children:a}),t.jsx("span",{className:"form-control",children:j||"-"})]}):t.jsxs("div",{className:`form-group fluig-style-guide ${d}`,children:[a&&t.jsx("label",{className:"control-label",htmlFor:e,children:a}),t.jsx("div",{className:`${v?"border-red":""}`,children:t.jsx(B,{id:e,name:e,selected:N,onChange:R,onBlur:p,dateFormat:E,placeholderText:n,disabled:h,readOnly:h,locale:"pt-BR",className:`form-control ${v?"border-red":""}`,wrapperClassName:"w-100",showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select",isClearable:!h&&!!j,autoComplete:"off",customInput:t.jsx(_e,{name:e,shimRef:m})})}),v&&t.jsx("span",{className:"help-block text-danger",children:String(v.message)})]})},Ee=u.memo(Ie);function qe({mapping:e={},defaultLabel:a="Não reconhecido",className:n="",hidden:d=!1,label:i}){const{activityId:c}=$.useFluigRuntime(),o=u.useMemo(()=>!e||c===null||c===void 0?null:e[c],[c,e]);if(!o)return t.jsxs("div",{className:`form-group ${d?"hidden":""}`,children:[i&&t.jsx("label",{children:i}),t.jsx("div",{className:`status-badge default ${n}`,children:a})]});const s={"--customColor":o.color};return t.jsxs("div",{className:`form-group ${d?"hidden":""}`,children:[i&&t.jsx("label",{children:i}),t.jsxs("div",{className:`status-badge ${n}`,style:s,children:[o.icon&&t.jsx("i",{className:o.icon}),t.jsx("span",{children:o.label})]})]})}const He=u.memo(qe);function Le({name:e,control:a,defaultRowValue:n,isView:d,isReadOnly:i,filters:c=[]}){const{field:o}=S.useController({name:e,control:a}),[s,x]=u.useState([]),[f,h]=u.useState([]),y=()=>Date.now()+Math.random(),C=r=>{try{const l=JSON.parse(r);return Array.isArray(l)?l.map(g=>({...g,_uid:g._uid||y()})):[]}catch(l){return console.error(`Erro ao ler dados da tabela "${e}":`,l),[]}};u.useEffect(()=>{if(!(s.length>0&&!d)&&o.value&&typeof o.value=="string"){const r=JSON.stringify(s);if(o.value===r)return;const l=C(o.value);x(l)}},[o.value,d]),u.useEffect(()=>{if(i)return;const r=JSON.stringify(s);o.value!==r&&o.onChange(r)},[s,o,i]);const p=u.useCallback(()=>{const r={_uid:y(),...n};x(l=>[...l,r])},[n]),j=u.useCallback(()=>{x(r=>r.filter(l=>!f.includes(l._uid))),h([])},[f]),b=u.useCallback((r,l,g)=>{x(P=>P.map(w=>w._uid===r?{...w,[l]:g}:w))},[]),v=u.useCallback(r=>{h(l=>l.includes(r)?l.filter(g=>g!==r):[...l,r])},[]),N=u.useCallback(r=>{h(r?s.map(l=>l._uid):[])},[s]),R=s.length>0&&f.length===s.length,m=u.useMemo(()=>!c||c.length===0?s:s.filter(r=>c.every(l=>{if("custom"in l)return l.custom(r);const g=r[l.field];switch(l.operator){case"===":return g===l.value;case"!==":return g!==l.value;case">":return g>l.value;case"<":return g<l.value;case">=":return g>=l.value;case"<=":return g<=l.value;default:return!0}})),[s,c]);return{field:o,tableRows:s,visibleRows:m,selectedRowIds:f,isAllSelected:R,handle:{addRow:p,removeRows:j,updateCellValue:b,toggleSelection:v,toggleSelectAll:N}}}const Be=({name:e,title:a="Tabela Dinâmica",columns:n,defaultRowValue:d={},forceReadOnly:i=!1,layout:c="fluid",actions:o=!0,filters:s=[]})=>{const{control:x}=S.useFormContext(),{isView:f,isReadOnly:h}=$.useFluigRuntime(),{isReadOnly:y}=$.useSection(),C=i||f||h||y&&y(e),{field:p,visibleRows:j,selectedRowIds:b,isAllSelected:v,handle:N}=Le({name:e,control:x,defaultRowValue:d,isView:f,isReadOnly:!!C,filters:s}),R=c==="fixed";return t.jsxs("div",{className:`table-wrapper ${R?"table-fixed":"table-fluid"}`,children:[t.jsx("input",{type:"hidden",...p}),t.jsxs("div",{className:"header-handle",children:[t.jsx("h3",{children:a}),!C&&o&&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:[!C&&t.jsx("th",{style:{width:"50px"},children:t.jsx("input",{type:"checkbox",checked:v,onChange:m=>N.toggleSelectAll(m.target.checked)})}),n.map(m=>t.jsx("th",{style:m.width?{minWidth:R?m.width:"100%"}:{width:"max-content"},children:m.label},m.key))]})}),t.jsxs("tbody",{children:[j.map((m,r)=>t.jsxs("tr",{children:[!C&&t.jsx("td",{children:t.jsx("input",{type:"checkbox",checked:b.includes(m._uid),onChange:()=>N.toggleSelection(m._uid)})}),n.map(l=>t.jsx("td",{children:l.render?l.render.length<=1?l.render({row:m,index:r,updateRow:(g,P)=>N.updateCellValue(m._uid,g,P),isLocked:!!C,isView:!!f}):l.render(m,r,(g,P)=>N.updateCellValue(m._uid,g,P),!!C,!!f):m[l.key]},`${m._uid}-${l.key}`))]},m._uid)),j.length===0&&t.jsx("tr",{className:"empty-row",children:t.jsx("td",{colSpan:100,className:"text-center",children:C?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ze=e=>{const[a,n]=u.useState(null),{watch:d}=S.useFormContext(),i=d(e),c=u.useCallback(()=>{if(!i){n(null);return}try{const s=window.top.__REACT_ATTACHMENT_BRIDGE__;if(s){const x=s.getAttachment(e);n(x||{name:i,documentId:0})}else n({name:i,documentId:0})}catch{n({name:i,documentId:0})}},[e,i]);return u.useEffect(()=>{c();const o=setInterval(c,1500);return()=>clearInterval(o)},[c]),{attachment:a,sync:c}},Xe=({name:e,label:a,help:n,className:d="",showRemove:i=!0,showUpdate:c=!0})=>{const{isReadOnly:o}=$.useSection(),{isView:s}=$.useFluigRuntime(),{control:x}=S.useFormContext(),{field:f}=S.useController({name:e,control:x}),{attachment:h,sync:y}=ze(e),C=s||!!o(e),p=!!h,j=()=>{var m;try{const r=window.top;return{bridge:r.__REACT_ATTACHMENT_BRIDGE__,toast:(m=r.FLUIGC)==null?void 0:m.toast}}catch{return{bridge:null,toast:null}}},b=(m,r="info")=>{const{toast:l}=j();l?l({title:"Anexos: ",message:m,type:r}):console.log(`[LOCALHOST TOAST - ${r.toUpperCase()}]: ${m}`)},v=u.useCallback(()=>{if(C||p)return;const m=document.createElement("input");m.type="file",m.onchange=r=>{const l=r.target.files[0];if(!l)return;const{bridge:g}=j();g?(f.onChange(l.name),g.upload(l,e,P=>{f.onChange(P.name),b(`Arquivo ${l.name} enviado com sucesso!`,"success"),y()})):(f.onChange(l.name),b(`[LOCALHOST] Arquivo "${l.name}" simulado.`,"info"))},m.click()},[C,p,e,f,y]),N=()=>{if(!p)return;const{bridge:m}=j();m?m.view(e):b(`Visualização não disponível em localhost (${h.name})`,"warning")},R=m=>{m.stopPropagation();const{bridge:r}=j(),l=(h==null?void 0:h.name)||"";window.confirm(`Deseja remover o anexo "${l}"?`)&&(r?r.remove(e)?(f.onChange(""),b("Anexo removido com sucesso.","success")):b("Erro ao tentar remover o anexo no Fluig.","danger"):(f.onChange(""),b("[LOCALHOST] Anexo removido da UI.","success")),setTimeout(()=>y(),500))};return t.jsxs("div",{className:`form-group ${d}`,style:{marginBottom:"15px"},children:[a&&t.jsx("label",{className:"control-label",children:a}),t.jsxs("div",{className:`attachment-container ${p?"has-file":""}`,style:{border:`1px ${p?"solid":"dashed"} ${p?"#5cb85c":"#ccc"}`,borderRadius:"4px",padding:"8px 15px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:C?"#f5f5f5":p?"#f9fff9":"#fff",cursor:C&&!p?"default":"pointer",minHeight:"48px",transition:"all 0.3s ease"},onClick:p?N:v,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1,overflow:"hidden"},children:[t.jsx("i",{className:`fluigicon ${p?"fluigicon-file-pdf":"fluigicon-paperclip"} icon-sm`,style:{color:p?"#5cb85c":"#777"}}),t.jsx("span",{style:{fontSize:"14px",fontWeight:p?"500":"400",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:p?"#333":"#777"},children:p?h.name:n||"Anexar arquivo"})]}),t.jsxs("div",{style:{display:"flex",gap:"8px",marginLeft:"10px"},children:[p&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link",title:"Visualizar",style:{padding:"0 5px",color:"#555"},children:t.jsx("i",{className:"fluigicon fluigicon-eye-open"})}),!C&&p&&t.jsxs(t.Fragment,{children:[c&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link",title:"Substituir",style:{padding:"0 5px",color:"#31708f"},onClick:m=>{R(m),setTimeout(v,400)},children:t.jsx("i",{className:"fluigicon fluigicon-refresh"})}),i&&t.jsx("button",{type:"button",className:"btn btn-sm btn-link text-danger",title:"Remover",style:{padding:"0 5px"},onClick:R,children:t.jsx("i",{className:"fluigicon fluigicon-trash"})})]})]})]}),t.jsx("input",{type:"hidden",name:e,value:f.value||""})]})},Ue=u.memo(Xe);function Ye({items:e,time:a=0,showNavigation:n=!0,progressBar:d=!0}){const[i,c]=u.useState(0),[o,s]=u.useState(0),x=u.useRef(null),f=u.useRef(null),h=u.useCallback(()=>{c(b=>(b+1)%e.length),s(0)},[e.length]),y=u.useCallback(()=>{c(b=>(b-1+e.length)%e.length),s(0)},[e.length]);if(u.useEffect(()=>{if(a>0&&e.length>1){const v=100/a*100;x.current=setInterval(h,a),f.current=setInterval(()=>{s(N=>N>=100?0:N+v)},100)}return()=>{x.current&&clearInterval(x.current),f.current&&clearInterval(f.current)}},[a,h,e.length,i]),!e||e.length===0)return null;const C=e[i],p=typeof C=="string"?C:C.url,j=/\.(jpg|jpeg|png|gif|webp)$/i.test(p);return t.jsxs("div",{className:"carousel-root",children:[t.jsxs("div",{className:"carousel-viewport",children:[n&&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:j?t.jsx("img",{src:p,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:p,target:"_blank",rel:"noreferrer",className:"btn-open",children:"Abrir Arquivo"})]})}),e.length>1&&t.jsx("div",{className:"carousel-dots",children:e.map((b,v)=>t.jsx("div",{className:`dot ${v===i?"active":""}`,onClick:()=>{c(v),s(0)}},v))})]}),d&&a>0&&e.length>1&&t.jsx("div",{className:"carousel-progress-container",children:t.jsx("div",{className:"carousel-progress-bar",style:{width:`${o}%`}})})]})}function Ge({title:e,isOpen:a,onOpen:n,onClose:d,content:i,footer:c,width:o}){const s=u.useCallback(x=>{x.key==="Escape"&&d()},[d]);return u.useEffect(()=>(a&&(document.addEventListener("keydown",s),n==null||n(),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",s),document.body.style.overflow="auto"}),[a,s,n]),a?t.jsx("div",{className:"modal-overlay",onClick:d,"aria-modal":"true",role:"dialog",children:t.jsxs("div",{style:{maxWidth:o},className:"modal-container",onClick:x=>x.stopPropagation(),children:[t.jsxs("div",{className:"modal-header",children:[t.jsx("h3",{children:e}),t.jsx("div",{className:"btn-close-modal",onClick:d,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:i}),c&&t.jsx("div",{className:"modal-footer",children:c})]})}):null}function Qe({logo:e,childs:a,footer:n,contentExternal:d,bg:i,color:c,onSelect:o}){return t.jsxs("div",{className:"main-container dfea",children:[t.jsxs("div",{className:"sidebar-wrapper",style:{backgroundColor:`${i}`},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:a==null?void 0:a.map(s=>{var x,f;return s!=null&&s.options&&((x=s==null?void 0:s.options)==null?void 0:x.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=s.action)==null||h.call(s),o==null||o(s.id)},style:{color:`${c}`},children:[s.icon&&t.jsx("i",{className:s.icon}),s.label]}),(f=s.options)==null?void 0:f.map(h=>t.jsx("li",{className:"sidebar-option",onClick:()=>{var y;(y=h.action)==null||y.call(h),o==null||o(h.id)},style:{color:`${c}`},children:h.label}))]})}):t.jsxs("li",{className:"sidebar-child",onClick:()=>{var h;(h=s.action)==null||h.call(s),o==null||o(s.id)},style:{color:`${c}`},children:[s.icon&&t.jsx("i",{className:s.icon}),s.label]})})}),n&&t.jsx("div",{className:"sidebar-footer",children:n})]}),t.jsx("div",{className:"sidebar-content-external",children:d})]})}exports.Attachment=Ue;exports.Carousel=Ye;exports.Checkbox=Z;exports.DatePicker=Ee;exports.Input=G;exports.Modal=Ge;exports.RadioBtn=ee;exports.Select=J;exports.Sidebar=Qe;exports.SimpleTable=Be;exports.StatusBadge=He;exports.TextArea=ne;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsxs as f, jsx as t, Fragment as B } from "react/jsx-runtime";
2
- import { memo as I, useMemo as _, useCallback as A, useState as j, useRef as E, useEffect as V, forwardRef as K } from "react";
2
+ import { memo as I, useMemo as _, useCallback as A, useState as j, useRef as q, useEffect as V, forwardRef as K } from "react";
3
3
  import { useFormContext as T, useController as H, useFormState as ee } from "react-hook-form";
4
4
  import { IMaskInput as te } from "react-imask";
5
5
  import { useSection as D, useFluigRuntime as W } from "@fluig-kit/ecm";
6
6
  import ne, { registerLocale as ae } from "react-datepicker";
7
- import { parse as re, isValid as se, format as ie } from "date-fns";
8
- const oe = {
7
+ import { parse as re, isValid as se, format as oe } from "date-fns";
8
+ const ie = {
9
9
  cpf: "000.000.000-00",
10
10
  cnpj: "00.000.000/0000-00",
11
11
  telefone: "(00) 00000-0000",
@@ -16,14 +16,14 @@ function le({
16
16
  label: r = "",
17
17
  placeholder: n = "",
18
18
  type: d = "text",
19
- mask: o,
19
+ mask: i,
20
20
  className: c = "",
21
- forceReadOnly: i = !1,
21
+ forceReadOnly: o = !1,
22
22
  forceHidden: a = !1
23
23
  }) {
24
- const { isReadOnly: p, isHidden: m } = D(), h = i || !!p(e), N = a || !!m(e), { control: x } = T(), { isView: b } = W(), { field: w } = H({ name: e, control: x }), { errors: v } = ee({ name: e }), y = v == null ? void 0 : v[e], k = _(
25
- () => o ? oe[o] ?? o : null,
26
- [o]
24
+ const { isReadOnly: p, isHidden: h } = D(), m = o || !!p(e), N = a || !!h(e), { control: x } = T(), { isView: v } = W(), { field: w } = H({ name: e, control: x }), { errors: b } = ee({ name: e }), y = b == null ? void 0 : b[e], k = _(
25
+ () => i ? ie[i] ?? i : null,
26
+ [i]
27
27
  ), $ = A((s) => {
28
28
  if (!s) return "";
29
29
  const l = s.replace(/\D/g, "");
@@ -35,7 +35,7 @@ function le({
35
35
  (s) => d === "monetary" ? $(s) : s,
36
36
  [d, $]
37
37
  );
38
- return b ? /* @__PURE__ */ f("div", { className: "form-group", children: [
38
+ return v ? /* @__PURE__ */ f("div", { className: "form-group", children: [
39
39
  /* @__PURE__ */ t("label", { children: r }),
40
40
  /* @__PURE__ */ t("span", { className: "form-control", children: w.value || "-" })
41
41
  ] }) : /* @__PURE__ */ f("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
@@ -49,7 +49,7 @@ function le({
49
49
  unmask: !1,
50
50
  onAccept: (s) => w.onChange(u(s)),
51
51
  placeholder: n,
52
- readOnly: h,
52
+ readOnly: m,
53
53
  className: `form-control ${y ? "border-red" : ""} ${c}`,
54
54
  inputRef: w.ref,
55
55
  onBlur: w.onBlur
@@ -62,65 +62,65 @@ function le({
62
62
  value: w.value ?? "",
63
63
  onChange: (s) => w.onChange(u(s.target.value)),
64
64
  placeholder: n,
65
- readOnly: h,
65
+ readOnly: m,
66
66
  className: `form-control ${y ? "border-red" : ""} ${c}`
67
67
  }
68
68
  ),
69
69
  y && /* @__PURE__ */ t("p", { className: "text-danger", children: String(y.message) })
70
70
  ] });
71
71
  }
72
- const it = I(le);
72
+ const ot = I(le);
73
73
  function ce({
74
74
  name: e,
75
75
  label: r = "",
76
76
  options: n = [],
77
77
  placeholder: d = "",
78
- labelKey: o = "label",
78
+ labelKey: i = "label",
79
79
  valueKey: c = "value",
80
- enableSearch: i = !1,
80
+ enableSearch: o = !1,
81
81
  searchPlaceholder: a = "Buscar...",
82
82
  loading: p = !1,
83
- onSearchChange: m,
84
- debounceTime: h = 300,
83
+ onSearchChange: h,
84
+ debounceTime: m = 300,
85
85
  onSelect: N,
86
86
  forceReadOnly: x = !1,
87
- forceHidden: b = !1
87
+ forceHidden: v = !1
88
88
  }) {
89
- const { isReadOnly: w, isHidden: v } = D(), y = x || !!w(e), k = b || !!v(e), { control: $, clearErrors: u } = T(), { isView: s } = W(), {
89
+ const { isReadOnly: w, isHidden: b } = D(), y = x || !!w(e), k = v || !!b(e), { control: $, clearErrors: u } = T(), { isView: s } = W(), {
90
90
  field: { onChange: l, value: g, ref: P },
91
91
  fieldState: { error: C }
92
92
  } = H({
93
93
  name: e,
94
94
  control: $
95
- }), [S, M] = j(!1), [O, G] = j(""), z = E(null), X = E(m);
95
+ }), [S, O] = j(!1), [M, G] = j(""), z = q(null), X = q(h);
96
96
  V(() => {
97
- X.current = m;
98
- }, [m]), V(() => {
97
+ X.current = h;
98
+ }, [h]), V(() => {
99
99
  const R = (F) => {
100
- z.current && !z.current.contains(F.target) && M(!1);
100
+ z.current && !z.current.contains(F.target) && O(!1);
101
101
  };
102
102
  return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
103
103
  }, []), V(() => {
104
104
  S || G("");
105
105
  }, [S]), V(() => {
106
- if (!i) return;
106
+ if (!o) return;
107
107
  const R = setTimeout(() => {
108
- X.current && X.current(O);
109
- }, h);
108
+ X.current && X.current(M);
109
+ }, m);
110
110
  return () => clearTimeout(R);
111
- }, [O, i, h]);
112
- const Q = _(() => i && !m && O.trim() ? n.filter(
113
- (R) => String((R == null ? void 0 : R[o]) ?? "").toLowerCase().includes(O.toLowerCase())
114
- ) : n ?? [], [n, i, m, O, o]), J = _(() => {
111
+ }, [M, o, m]);
112
+ const Q = _(() => o && !h && M.trim() ? n.filter(
113
+ (R) => String((R == null ? void 0 : R[i]) ?? "").toLowerCase().includes(M.toLowerCase())
114
+ ) : n ?? [], [n, o, h, M, i]), J = _(() => {
115
115
  if (g == null) return "";
116
116
  if (typeof g == "object")
117
117
  return String(g[c] ?? "");
118
118
  const R = (n || []).find(
119
119
  (F) => String(F == null ? void 0 : F[c]) === String(g)
120
120
  );
121
- return String(R ? (R == null ? void 0 : R[o]) ?? "" : g);
122
- }, [g, n, c, o]), Z = (R) => {
123
- y || (l(R[c]), N && N(R), u(e), M(!1));
121
+ return String(R ? (R == null ? void 0 : R[i]) ?? "" : g);
122
+ }, [g, n, c, i]), Z = (R) => {
123
+ y || (l(R[c]), N && N(R), u(e), O(!1));
124
124
  };
125
125
  return /* @__PURE__ */ f(
126
126
  "div",
@@ -134,7 +134,7 @@ function ce({
134
134
  "div",
135
135
  {
136
136
  className: `select-control ${C ? "border-red" : ""} ${y ? "readOnly" : ""}`,
137
- onClick: () => !y && M((R) => !R),
137
+ onClick: () => !y && O((R) => !R),
138
138
  ref: P,
139
139
  children: [
140
140
  /* @__PURE__ */ t("span", { className: `select-display ${y ? "readOnly" : ""}`, children: J || d }),
@@ -143,12 +143,12 @@ function ce({
143
143
  }
144
144
  ),
145
145
  S && !y && /* @__PURE__ */ f("div", { className: "select-dropdown", children: [
146
- i && /* @__PURE__ */ t("div", { className: "select-search", children: /* @__PURE__ */ t(
146
+ o && /* @__PURE__ */ t("div", { className: "select-search", children: /* @__PURE__ */ t(
147
147
  "input",
148
148
  {
149
149
  type: "text",
150
150
  className: "select-search-input",
151
- value: O,
151
+ value: M,
152
152
  onChange: (R) => G(R.target.value),
153
153
  placeholder: p ? "Carregando..." : a,
154
154
  autoFocus: !0,
@@ -160,7 +160,7 @@ function ce({
160
160
  {
161
161
  onClick: () => Z(R),
162
162
  className: "select-option handleHover",
163
- children: R[o]
163
+ children: R[i]
164
164
  },
165
165
  R[c]
166
166
  )) : /* @__PURE__ */ t("li", { className: "select-option readOnly", children: "Sem resultados" }) })
@@ -172,23 +172,23 @@ function ce({
172
172
  }
173
173
  );
174
174
  }
175
- const ot = I(ce);
175
+ const it = I(ce);
176
176
  function lt({
177
177
  name: e,
178
178
  options: r = [],
179
179
  label: n = "",
180
180
  valueKey: d = "value",
181
- labelKey: o = "label",
181
+ labelKey: i = "label",
182
182
  forceReadOnly: c = !1,
183
- forceHidden: i = !1
183
+ forceHidden: o = !1
184
184
  }) {
185
185
  var g, P;
186
- const a = T(), { isView: p, isReadOnly: m } = W(), { isReadOnly: h, isHidden: N } = D(), x = h ? h(e) : !1, b = N ? N(e) : !1, w = c || x, v = i || b, y = w || m || p;
186
+ const a = T(), { isView: p, isReadOnly: h } = W(), { isReadOnly: m, isHidden: N } = D(), x = m ? m(e) : !1, v = N ? N(e) : !1, w = c || x, b = o || v, y = w || h || p;
187
187
  if (!a || !e)
188
188
  return console.error("Checkbox requer contexto de formulário e nome."), null;
189
189
  const k = () => !r || !a ? {} : r.reduce((C, S) => {
190
- const M = S[d], O = a.getValues(M);
191
- return C[M] = O === "on", C;
190
+ const O = S[d], M = a.getValues(O);
191
+ return C[O] = M === "on", C;
192
192
  }, {}), $ = a.watch(e), u = _(() => $ && typeof $ == "object" ? $ : k(), [$, r, d]);
193
193
  V(() => {
194
194
  const C = a.getValues(e);
@@ -199,38 +199,38 @@ function lt({
199
199
  }, [u, e, a]);
200
200
  const s = (C, S) => {
201
201
  if (y) return;
202
- const M = { ...u, [C]: S };
203
- a.setValue(e, M, {
202
+ const O = { ...u, [C]: S };
203
+ a.setValue(e, O, {
204
204
  shouldDirty: !0,
205
205
  shouldValidate: !0
206
206
  }), a.setValue(C, S ? "on" : "", { shouldValidate: !1 });
207
207
  }, l = (P = (g = a.formState) == null ? void 0 : g.errors) == null ? void 0 : P[e];
208
- return /* @__PURE__ */ f("div", { className: `form-group ${v ? "hidden" : ""}`, children: [
208
+ return /* @__PURE__ */ f("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
209
209
  n && /* @__PURE__ */ t("label", { children: n }),
210
210
  /* @__PURE__ */ t(
211
211
  "div",
212
212
  {
213
213
  className: `checkbox-group-custom ${y ? "readOnly" : ""}`,
214
214
  children: r.map((C) => {
215
- const S = String(C[d]), M = u[S] === !0;
215
+ const S = String(C[d]), O = u[S] === !0;
216
216
  return /* @__PURE__ */ f("div", { children: [
217
217
  /* @__PURE__ */ t("input", { type: "hidden", ...a.register(S) }),
218
218
  /* @__PURE__ */ f(
219
219
  "label",
220
220
  {
221
- className: `custom-checkbox ${M ? "checked" : ""} ${y ? "readOnly" : ""}`,
221
+ className: `custom-checkbox ${O ? "checked" : ""} ${y ? "readOnly" : ""}`,
222
222
  children: [
223
223
  /* @__PURE__ */ t(
224
224
  "input",
225
225
  {
226
226
  type: "checkbox",
227
- checked: M,
227
+ checked: O,
228
228
  disabled: y,
229
- onChange: (O) => s(S, O.target.checked)
229
+ onChange: (M) => s(S, M.target.checked)
230
230
  }
231
231
  ),
232
232
  /* @__PURE__ */ t("span", { className: "checkmark" }),
233
- /* @__PURE__ */ t("span", { children: C[o] })
233
+ /* @__PURE__ */ t("span", { children: C[i] })
234
234
  ]
235
235
  }
236
236
  )
@@ -246,22 +246,22 @@ function de({
246
246
  label: r = "",
247
247
  options: n = [],
248
248
  valueKey: d = "value",
249
- labelKey: o = "label",
249
+ labelKey: i = "label",
250
250
  iconKey: c = "icon",
251
- forceReadOnly: i = !1,
251
+ forceReadOnly: o = !1,
252
252
  forceHidden: a = !1
253
253
  }) {
254
- const { isReadOnly: p, isHidden: m } = D(), h = i || !!p(e), N = a || !!m(e), { control: x } = T(), { isView: b, isReadOnly: w } = W(), {
255
- field: v,
254
+ const { isReadOnly: p, isHidden: h } = D(), m = o || !!p(e), N = a || !!h(e), { control: x } = T(), { isView: v, isReadOnly: w } = W(), {
255
+ field: b,
256
256
  fieldState: { error: y }
257
257
  } = H({
258
258
  name: e,
259
259
  control: x
260
- }), k = h || w || b, $ = v.value ?? "", u = A(
260
+ }), k = m || w || v, $ = b.value ?? "", u = A(
261
261
  (s) => {
262
- k || v.onChange(s);
262
+ k || b.onChange(s);
263
263
  },
264
- [k, v]
264
+ [k, b]
265
265
  );
266
266
  return /* @__PURE__ */ f("div", { className: `form-group column ${N ? "hidden" : ""}`, children: [
267
267
  r && /* @__PURE__ */ t("label", { className: "control-label", children: r }),
@@ -294,7 +294,7 @@ function de({
294
294
  ),
295
295
  s[c] && /* @__PURE__ */ t("i", { className: `${s[c]} icon-sm` }),
296
296
  " ",
297
- s[o]
297
+ s[i]
298
298
  ]
299
299
  },
300
300
  l
@@ -310,19 +310,19 @@ const ct = I(de), ue = ({
310
310
  label: r = "",
311
311
  placeholder: n = "",
312
312
  className: d = "",
313
- rows: o = 4,
313
+ rows: i = 4,
314
314
  maxLength: c,
315
- forceReadOnly: i = !1,
315
+ forceReadOnly: o = !1,
316
316
  forceHidden: a = !1
317
317
  }) => {
318
- const { isReadOnly: p, isHidden: m } = D(), h = i || !!p(e), N = a || !!m(e), { control: x } = T(), { isView: b } = W(), {
318
+ const { isReadOnly: p, isHidden: h } = D(), m = o || !!p(e), N = a || !!h(e), { control: x } = T(), { isView: v } = W(), {
319
319
  field: w,
320
- fieldState: { error: v }
320
+ fieldState: { error: b }
321
321
  } = H({
322
322
  name: e,
323
323
  control: x
324
324
  });
325
- return b ? /* @__PURE__ */ f("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
325
+ return v ? /* @__PURE__ */ f("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
326
326
  /* @__PURE__ */ t("label", { children: r }),
327
327
  /* @__PURE__ */ t("span", { className: "form-control", children: w.value || "-" })
328
328
  ] }) : /* @__PURE__ */ f("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
@@ -331,15 +331,15 @@ const ct = I(de), ue = ({
331
331
  "textarea",
332
332
  {
333
333
  ...w,
334
- rows: o,
334
+ rows: i,
335
335
  maxLength: c,
336
336
  value: w.value || "",
337
337
  placeholder: n,
338
- readOnly: h,
339
- className: `form-control ${v ? "border-red" : ""} ${d}`
338
+ readOnly: m,
339
+ className: `form-control ${b ? "border-red" : ""} ${d}`
340
340
  }
341
341
  ),
342
- v && /* @__PURE__ */ t("p", { className: "text-danger", children: String(v.message) })
342
+ b && /* @__PURE__ */ t("p", { className: "text-danger", children: String(b.message) })
343
343
  ] });
344
344
  }, dt = I(ue);
345
345
  function U(e) {
@@ -351,34 +351,34 @@ function U(e) {
351
351
  function L(e) {
352
352
  return (r, n) => {
353
353
  const d = n != null && n.context ? String(n.context) : "standalone";
354
- let o;
354
+ let i;
355
355
  if (d === "formatting" && e.formattingValues) {
356
- const i = e.defaultFormattingWidth || e.defaultWidth, a = n != null && n.width ? String(n.width) : i;
357
- o = e.formattingValues[a] || e.formattingValues[i];
356
+ const o = e.defaultFormattingWidth || e.defaultWidth, a = n != null && n.width ? String(n.width) : o;
357
+ i = e.formattingValues[a] || e.formattingValues[o];
358
358
  } else {
359
- const i = e.defaultWidth, a = n != null && n.width ? String(n.width) : e.defaultWidth;
360
- o = e.values[a] || e.values[i];
359
+ const o = e.defaultWidth, a = n != null && n.width ? String(n.width) : e.defaultWidth;
360
+ i = e.values[a] || e.values[o];
361
361
  }
362
362
  const c = e.argumentCallback ? e.argumentCallback(r) : r;
363
- return o[c];
363
+ return i[c];
364
364
  };
365
365
  }
366
- function q(e) {
366
+ function E(e) {
367
367
  return (r, n = {}) => {
368
- const d = n.width, o = d && e.matchPatterns[d] || e.matchPatterns[e.defaultMatchWidth], c = r.match(o);
368
+ const d = n.width, i = d && e.matchPatterns[d] || e.matchPatterns[e.defaultMatchWidth], c = r.match(i);
369
369
  if (!c)
370
370
  return null;
371
- const i = c[0], a = d && e.parsePatterns[d] || e.parsePatterns[e.defaultParseWidth], p = Array.isArray(a) ? he(a, (N) => N.test(i)) : (
371
+ const o = c[0], a = d && e.parsePatterns[d] || e.parsePatterns[e.defaultParseWidth], p = Array.isArray(a) ? he(a, (N) => N.test(o)) : (
372
372
  // [TODO] -- I challenge you to fix the type
373
- me(a, (N) => N.test(i))
373
+ me(a, (N) => N.test(o))
374
374
  );
375
- let m;
376
- m = e.valueCallback ? e.valueCallback(p) : p, m = n.valueCallback ? (
375
+ let h;
376
+ h = e.valueCallback ? e.valueCallback(p) : p, h = n.valueCallback ? (
377
377
  // [TODO] -- I challenge you to fix the type
378
- n.valueCallback(m)
379
- ) : m;
380
- const h = r.slice(i.length);
381
- return { value: m, rest: h };
378
+ n.valueCallback(h)
379
+ ) : h;
380
+ const m = r.slice(o.length);
381
+ return { value: h, rest: m };
382
382
  };
383
383
  }
384
384
  function me(e, r) {
@@ -395,12 +395,12 @@ function fe(e) {
395
395
  return (r, n = {}) => {
396
396
  const d = r.match(e.matchPattern);
397
397
  if (!d) return null;
398
- const o = d[0], c = r.match(e.parsePattern);
398
+ const i = d[0], c = r.match(e.parsePattern);
399
399
  if (!c) return null;
400
- let i = e.valueCallback ? e.valueCallback(c[0]) : c[0];
401
- i = n.valueCallback ? n.valueCallback(i) : i;
402
- const a = r.slice(o.length);
403
- return { value: i, rest: a };
400
+ let o = e.valueCallback ? e.valueCallback(c[0]) : c[0];
401
+ o = n.valueCallback ? n.valueCallback(o) : o;
402
+ const a = r.slice(i.length);
403
+ return { value: o, rest: a };
404
404
  };
405
405
  }
406
406
  const ge = {
@@ -467,8 +467,8 @@ const ge = {
467
467
  }
468
468
  }, pe = (e, r, n) => {
469
469
  let d;
470
- const o = ge[e];
471
- return typeof o == "string" ? d = o : r === 1 ? d = o.one : d = o.other.replace("{{count}}", String(r)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "em " + d : "há " + d : d;
470
+ const i = ge[e];
471
+ return typeof i == "string" ? d = i : r === 1 ? d = i.one : d = i.other.replace("{{count}}", String(r)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "em " + d : "há " + d : d;
472
472
  }, be = {
473
473
  full: "EEEE, d 'de' MMMM 'de' y",
474
474
  long: "d 'de' MMMM 'de' y",
@@ -508,8 +508,8 @@ const ge = {
508
508
  nextWeek: "eeee 'às' p",
509
509
  other: "P"
510
510
  }, xe = (e, r, n, d) => {
511
- const o = Ne[e];
512
- return typeof o == "function" ? o(r) : o;
511
+ const i = Ne[e];
512
+ return typeof i == "function" ? i(r) : i;
513
513
  }, Ce = {
514
514
  narrow: ["AC", "DC"],
515
515
  abbreviated: ["AC", "DC"],
@@ -634,7 +634,7 @@ const ge = {
634
634
  }, Ae = (e, r) => {
635
635
  const n = Number(e);
636
636
  return (r == null ? void 0 : r.unit) === "week" ? n + "ª" : n + "º";
637
- }, Me = {
637
+ }, Oe = {
638
638
  ordinalNumber: Ae,
639
639
  era: L({
640
640
  values: Ce,
@@ -659,7 +659,7 @@ const ge = {
659
659
  formattingValues: Se,
660
660
  defaultFormattingWidth: "wide"
661
661
  })
662
- }, Oe = /^(\d+)[ºªo]?/i, Ve = /\d+/i, Te = {
662
+ }, Me = /^(\d+)[ºªo]?/i, Ve = /\d+/i, Te = {
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
@@ -717,7 +717,7 @@ const ge = {
717
717
  }, Le = {
718
718
  narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
719
719
  any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i
720
- }, qe = {
720
+ }, Ee = {
721
721
  any: {
722
722
  am: /^a/i,
723
723
  pm: /^p/i,
@@ -728,41 +728,41 @@ const ge = {
728
728
  evening: /tarde/i,
729
729
  night: /noite/i
730
730
  }
731
- }, Ee = {
731
+ }, qe = {
732
732
  ordinalNumber: fe({
733
- matchPattern: Oe,
733
+ matchPattern: Me,
734
734
  parsePattern: Ve,
735
735
  valueCallback: (e) => parseInt(e, 10)
736
736
  }),
737
- era: q({
737
+ era: E({
738
738
  matchPatterns: Te,
739
739
  defaultMatchWidth: "wide",
740
740
  parsePatterns: We,
741
741
  defaultParseWidth: "any"
742
742
  }),
743
- quarter: q({
743
+ quarter: E({
744
744
  matchPatterns: De,
745
745
  defaultMatchWidth: "wide",
746
746
  parsePatterns: _e,
747
747
  defaultParseWidth: "any",
748
748
  valueCallback: (e) => e + 1
749
749
  }),
750
- month: q({
750
+ month: E({
751
751
  matchPatterns: je,
752
752
  defaultMatchWidth: "wide",
753
753
  parsePatterns: Ie,
754
754
  defaultParseWidth: "any"
755
755
  }),
756
- day: q({
756
+ day: E({
757
757
  matchPatterns: He,
758
758
  defaultMatchWidth: "wide",
759
759
  parsePatterns: Fe,
760
760
  defaultParseWidth: "any"
761
761
  }),
762
- dayPeriod: q({
762
+ dayPeriod: E({
763
763
  matchPatterns: Le,
764
764
  defaultMatchWidth: "any",
765
- parsePatterns: qe,
765
+ parsePatterns: Ee,
766
766
  defaultParseWidth: "any"
767
767
  })
768
768
  }, Be = {
@@ -770,8 +770,8 @@ const ge = {
770
770
  formatDistance: pe,
771
771
  formatLong: we,
772
772
  formatRelative: xe,
773
- localize: Me,
774
- match: Ee,
773
+ localize: Oe,
774
+ match: qe,
775
775
  options: {
776
776
  weekStartsOn: 0,
777
777
  firstWeekContainsDate: 1
@@ -782,15 +782,15 @@ const Y = "dd/MM/yyyy", ze = (e) => {
782
782
  if (!e) return null;
783
783
  const r = re(e, Y, /* @__PURE__ */ new Date());
784
784
  return se(r) ? r : null;
785
- }, Xe = (e) => e ? ie(e, Y) : "", Ue = K(
786
- ({ shimRef: e, className: r, name: n, ...d }, o) => /* @__PURE__ */ t(
785
+ }, Xe = (e) => e ? oe(e, Y) : "", Ue = K(
786
+ ({ shimRef: e, className: r, name: n, ...d }, i) => /* @__PURE__ */ t(
787
787
  "input",
788
788
  {
789
789
  name: n,
790
790
  ...d,
791
791
  className: r,
792
792
  ref: (c) => {
793
- typeof o == "function" ? o(c) : o && (o.current = c), e && e(c);
793
+ typeof i == "function" ? i(c) : i && (i.current = c), e && e(c);
794
794
  }
795
795
  }
796
796
  )
@@ -799,15 +799,15 @@ const Y = "dd/MM/yyyy", ze = (e) => {
799
799
  label: r = "",
800
800
  placeholder: n = "dd/mm/aaaa",
801
801
  className: d = "",
802
- forceReadOnly: o = !1,
802
+ forceReadOnly: i = !1,
803
803
  forceHidden: c = !1
804
804
  }) => {
805
- const { control: i } = T(), { isView: a } = W(), { isReadOnly: p, isHidden: m } = D(), h = o || !!p(e), N = c || !!m(e), {
806
- field: { onChange: x, onBlur: b, value: w, ref: v },
805
+ const { control: o } = T(), { isView: a } = W(), { isReadOnly: p, isHidden: h } = D(), m = i || !!p(e), N = c || !!h(e), {
806
+ field: { onChange: x, onBlur: v, value: w, ref: b },
807
807
  fieldState: { error: y }
808
808
  } = H({
809
809
  name: e,
810
- control: i
810
+ control: o
811
811
  }), k = _(() => ze(w), [w]), $ = A(
812
812
  (s) => {
813
813
  x(s ? Xe(s) : "");
@@ -816,8 +816,8 @@ const Y = "dd/MM/yyyy", ze = (e) => {
816
816
  ), u = A(
817
817
  (s) => {
818
818
  var l, g;
819
- if (v(s), s && ((g = (l = i._fields) == null ? void 0 : l[e]) != null && g._f)) {
820
- const P = i._fields[e];
819
+ if (b(s), s && ((g = (l = o._fields) == null ? void 0 : l[e]) != null && g._f)) {
820
+ const P = o._fields[e];
821
821
  P._f.ref = {
822
822
  focus: () => {
823
823
  var C;
@@ -838,7 +838,7 @@ const Y = "dd/MM/yyyy", ze = (e) => {
838
838
  };
839
839
  }
840
840
  },
841
- [v, i, e]
841
+ [b, o, e]
842
842
  );
843
843
  return N ? null : a ? /* @__PURE__ */ f("div", { className: "form-group", children: [
844
844
  /* @__PURE__ */ t("label", { children: r }),
@@ -852,18 +852,18 @@ const Y = "dd/MM/yyyy", ze = (e) => {
852
852
  name: e,
853
853
  selected: k,
854
854
  onChange: $,
855
- onBlur: b,
855
+ onBlur: v,
856
856
  dateFormat: Y,
857
857
  placeholderText: n,
858
- disabled: h,
859
- readOnly: h,
858
+ disabled: m,
859
+ readOnly: m,
860
860
  locale: "pt-BR",
861
861
  className: `form-control ${y ? "border-red" : ""}`,
862
862
  wrapperClassName: "w-100",
863
863
  showMonthDropdown: !0,
864
864
  showYearDropdown: !0,
865
865
  dropdownMode: "select",
866
- isClearable: !h && !!w,
866
+ isClearable: !m && !!w,
867
867
  autoComplete: "off",
868
868
  customInput: /* @__PURE__ */ t(Ue, { name: e, shimRef: u })
869
869
  }
@@ -876,22 +876,22 @@ function Ge({
876
876
  defaultLabel: r = "Não reconhecido",
877
877
  className: n = "",
878
878
  hidden: d = !1,
879
- label: o
879
+ label: i
880
880
  }) {
881
- const { activityId: c } = W(), i = _(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
882
- if (!i)
881
+ const { activityId: c } = W(), o = _(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
882
+ if (!o)
883
883
  return /* @__PURE__ */ f("div", { className: `form-group ${d ? "hidden" : ""}`, children: [
884
- o && /* @__PURE__ */ t("label", { children: o }),
884
+ i && /* @__PURE__ */ t("label", { children: i }),
885
885
  /* @__PURE__ */ t("div", { className: `status-badge default ${n}`, children: r })
886
886
  ] });
887
887
  const a = {
888
- "--customColor": i.color
888
+ "--customColor": o.color
889
889
  };
890
890
  return /* @__PURE__ */ f("div", { className: `form-group ${d ? "hidden" : ""}`, children: [
891
- o && /* @__PURE__ */ t("label", { children: o }),
891
+ i && /* @__PURE__ */ t("label", { children: i }),
892
892
  /* @__PURE__ */ f("div", { className: `status-badge ${n}`, style: a, children: [
893
- i.icon && /* @__PURE__ */ t("i", { className: i.icon }),
894
- /* @__PURE__ */ t("span", { children: i.label })
893
+ o.icon && /* @__PURE__ */ t("i", { className: o.icon }),
894
+ /* @__PURE__ */ t("span", { children: o.label })
895
895
  ] })
896
896
  ] });
897
897
  }
@@ -901,10 +901,10 @@ function Qe({
901
901
  control: r,
902
902
  defaultRowValue: n,
903
903
  isView: d,
904
- isReadOnly: o,
904
+ isReadOnly: i,
905
905
  filters: c = []
906
906
  }) {
907
- const { field: i } = H({ name: e, control: r }), [a, p] = j([]), [m, h] = j([]), N = () => Date.now() + Math.random(), x = (s) => {
907
+ const { field: o } = H({ name: e, control: r }), [a, p] = j([]), [h, m] = j([]), N = () => Date.now() + Math.random(), x = (s) => {
908
908
  try {
909
909
  const l = JSON.parse(s);
910
910
  return Array.isArray(l) ? l.map((g) => ({
@@ -916,25 +916,25 @@ function Qe({
916
916
  }
917
917
  };
918
918
  V(() => {
919
- if (!(a.length > 0 && !d) && i.value && typeof i.value == "string") {
919
+ if (!(a.length > 0 && !d) && o.value && typeof o.value == "string") {
920
920
  const s = JSON.stringify(a);
921
- if (i.value === s) return;
922
- const l = x(i.value);
921
+ if (o.value === s) return;
922
+ const l = x(o.value);
923
923
  p(l);
924
924
  }
925
- }, [i.value, d]), V(() => {
926
- if (o) return;
925
+ }, [o.value, d]), V(() => {
926
+ if (i) return;
927
927
  const s = JSON.stringify(a);
928
- i.value !== s && i.onChange(s);
929
- }, [a, i, o]);
930
- const b = A(() => {
928
+ o.value !== s && o.onChange(s);
929
+ }, [a, o, i]);
930
+ const v = A(() => {
931
931
  const s = { _uid: N(), ...n };
932
932
  p((l) => [...l, s]);
933
933
  }, [n]), w = A(() => {
934
934
  p(
935
- (s) => s.filter((l) => !m.includes(l._uid))
936
- ), h([]);
937
- }, [m]), v = A(
935
+ (s) => s.filter((l) => !h.includes(l._uid))
936
+ ), m([]);
937
+ }, [h]), b = A(
938
938
  (s, l, g) => {
939
939
  p(
940
940
  (P) => P.map(
@@ -944,15 +944,15 @@ function Qe({
944
944
  },
945
945
  []
946
946
  ), y = A((s) => {
947
- h(
947
+ m(
948
948
  (l) => l.includes(s) ? l.filter((g) => g !== s) : [...l, s]
949
949
  );
950
950
  }, []), k = A(
951
951
  (s) => {
952
- h(s ? a.map((l) => l._uid) : []);
952
+ m(s ? a.map((l) => l._uid) : []);
953
953
  },
954
954
  [a]
955
- ), $ = a.length > 0 && m.length === a.length, u = _(() => !c || c.length === 0 ? a : a.filter(
955
+ ), $ = a.length > 0 && h.length === a.length, u = _(() => !c || c.length === 0 ? a : a.filter(
956
956
  (s) => c.every((l) => {
957
957
  if ("custom" in l)
958
958
  return l.custom(s);
@@ -976,15 +976,15 @@ function Qe({
976
976
  })
977
977
  ), [a, c]);
978
978
  return {
979
- field: i,
979
+ field: o,
980
980
  tableRows: a,
981
981
  visibleRows: u,
982
- selectedRowIds: m,
982
+ selectedRowIds: h,
983
983
  isAllSelected: $,
984
984
  handle: {
985
- addRow: b,
985
+ addRow: v,
986
986
  removeRows: w,
987
- updateCellValue: v,
987
+ updateCellValue: b,
988
988
  toggleSelection: y,
989
989
  toggleSelectAll: k
990
990
  }
@@ -995,34 +995,34 @@ const ht = ({
995
995
  title: r = "Tabela Dinâmica",
996
996
  columns: n,
997
997
  defaultRowValue: d = {},
998
- forceReadOnly: o = !1,
998
+ forceReadOnly: i = !1,
999
999
  layout: c = "fluid",
1000
- actions: i = !0,
1000
+ actions: o = !0,
1001
1001
  filters: a = []
1002
1002
  }) => {
1003
- const { control: p } = T(), { isView: m, isReadOnly: h } = W(), { isReadOnly: N } = D(), x = o || m || h || N && N(e), { field: b, visibleRows: w, selectedRowIds: v, isAllSelected: y, handle: k } = Qe({
1003
+ const { control: p } = T(), { isView: h, isReadOnly: m } = W(), { isReadOnly: N } = D(), x = i || h || m || N && N(e), { field: v, visibleRows: w, selectedRowIds: b, isAllSelected: y, handle: k } = Qe({
1004
1004
  name: e,
1005
1005
  control: p,
1006
1006
  defaultRowValue: d,
1007
- isView: m,
1007
+ isView: h,
1008
1008
  isReadOnly: !!x,
1009
1009
  filters: a
1010
1010
  }), $ = c === "fixed";
1011
1011
  return /* @__PURE__ */ f("div", { className: `table-wrapper ${$ ? "table-fixed" : "table-fluid"}`, children: [
1012
- /* @__PURE__ */ t("input", { type: "hidden", ...b }),
1012
+ /* @__PURE__ */ t("input", { type: "hidden", ...v }),
1013
1013
  /* @__PURE__ */ f("div", { className: "header-handle", children: [
1014
1014
  /* @__PURE__ */ t("h3", { children: r }),
1015
- !x && i && /* @__PURE__ */ f("div", { className: "handle-actions", children: [
1015
+ !x && o && /* @__PURE__ */ f("div", { className: "handle-actions", children: [
1016
1016
  /* @__PURE__ */ f(
1017
1017
  "button",
1018
1018
  {
1019
1019
  type: "button",
1020
- className: `btn ${v.length > 0 ? "btn-danger" : ""}`,
1021
- disabled: v.length === 0,
1020
+ className: `btn ${b.length > 0 ? "btn-danger" : ""}`,
1021
+ disabled: b.length === 0,
1022
1022
  onClick: k.removeRows,
1023
1023
  children: [
1024
1024
  "Remover (",
1025
- v.length,
1025
+ b.length,
1026
1026
  ")"
1027
1027
  ]
1028
1028
  }
@@ -1055,7 +1055,7 @@ const ht = ({
1055
1055
  "input",
1056
1056
  {
1057
1057
  type: "checkbox",
1058
- checked: v.includes(u._uid),
1058
+ checked: b.includes(u._uid),
1059
1059
  onChange: () => k.toggleSelection(u._uid)
1060
1060
  }
1061
1061
  ) }),
@@ -1064,13 +1064,13 @@ const ht = ({
1064
1064
  index: s,
1065
1065
  updateRow: (g, P) => k.updateCellValue(u._uid, g, P),
1066
1066
  isLocked: !!x,
1067
- isView: !!m
1067
+ isView: !!h
1068
1068
  }) : l.render(
1069
1069
  u,
1070
1070
  s,
1071
1071
  (g, P) => k.updateCellValue(u._uid, g, P),
1072
1072
  !!x,
1073
- !!m
1073
+ !!h
1074
1074
  ) : u[l.key] }, `${u._uid}-${l.key}`))
1075
1075
  ] }, u._uid)),
1076
1076
  w.length === 0 && /* @__PURE__ */ t("tr", { className: "empty-row", children: /* @__PURE__ */ t("td", { colSpan: 100, className: "text-center", children: x ? "Nenhum registro encontrado." : "Nenhum registro." }) })
@@ -1078,31 +1078,36 @@ const ht = ({
1078
1078
  ] }) })
1079
1079
  ] });
1080
1080
  }, Je = (e) => {
1081
- const [r, n] = j(null), { watch: d } = T(), o = d(e), c = A(() => {
1081
+ const [r, n] = j(null), { watch: d } = T(), i = d(e), c = A(() => {
1082
+ if (!i) {
1083
+ n(null);
1084
+ return;
1085
+ }
1082
1086
  try {
1083
1087
  const a = window.top.__REACT_ATTACHMENT_BRIDGE__;
1084
1088
  if (a) {
1085
1089
  const p = a.getAttachment(e);
1086
- n(p || (o ? { name: o, documentId: 0 } : null));
1087
- } else n(o ? { name: o, documentId: 0 } : null);
1090
+ n(p || { name: i, documentId: 0 });
1091
+ } else
1092
+ n({ name: i, documentId: 0 });
1088
1093
  } catch {
1089
- n(o ? { name: o, documentId: 0 } : null);
1094
+ n({ name: i, documentId: 0 });
1090
1095
  }
1091
- }, [e, o]);
1096
+ }, [e, i]);
1092
1097
  return V(() => {
1093
1098
  c();
1094
- const i = setInterval(c, 1e3);
1095
- return () => clearInterval(i);
1099
+ const o = setInterval(c, 1500);
1100
+ return () => clearInterval(o);
1096
1101
  }, [c]), { attachment: r, sync: c };
1097
1102
  }, Ze = ({
1098
1103
  name: e,
1099
1104
  label: r,
1100
1105
  help: n,
1101
1106
  className: d = "",
1102
- showRemove: o = !0,
1107
+ showRemove: i = !0,
1103
1108
  showUpdate: c = !0
1104
1109
  }) => {
1105
- const { isReadOnly: i } = D(), { isView: a } = W(), { control: p } = T(), { field: m } = H({ name: e, control: p }), { attachment: h, sync: N } = Je(e), x = a || !!i(e), b = !!h, w = () => {
1110
+ const { isReadOnly: o } = D(), { isView: a } = W(), { control: p } = T(), { field: h } = H({ name: e, control: p }), { attachment: m, sync: N } = Je(e), x = a || !!o(e), v = !!m, w = () => {
1106
1111
  var u;
1107
1112
  try {
1108
1113
  const s = window.top;
@@ -1113,54 +1118,54 @@ const ht = ({
1113
1118
  } catch {
1114
1119
  return { bridge: null, toast: null };
1115
1120
  }
1116
- }, v = (u, s = "info") => {
1121
+ }, b = (u, s = "info") => {
1117
1122
  const { toast: l } = w();
1118
1123
  l ? l({ title: "Anexos: ", message: u, type: s }) : console.log(`[LOCALHOST TOAST - ${s.toUpperCase()}]: ${u}`);
1119
1124
  }, y = A(() => {
1120
- if (x || b) return;
1125
+ if (x || v) return;
1121
1126
  const u = document.createElement("input");
1122
1127
  u.type = "file", u.onchange = (s) => {
1123
1128
  const l = s.target.files[0];
1124
1129
  if (!l) return;
1125
1130
  const { bridge: g } = w();
1126
- g ? (m.onChange(l.name), g.upload(l, e, (P) => {
1127
- m.onChange(P.name), v(
1131
+ g ? (h.onChange(l.name), g.upload(l, e, (P) => {
1132
+ h.onChange(P.name), b(
1128
1133
  `Arquivo ${l.name} enviado com sucesso!`,
1129
1134
  "success"
1130
1135
  ), N();
1131
- })) : (m.onChange(l.name), v(`[LOCALHOST] Arquivo "${l.name}" simulado.`, "info"));
1136
+ })) : (h.onChange(l.name), b(`[LOCALHOST] Arquivo "${l.name}" simulado.`, "info"));
1132
1137
  }, u.click();
1133
- }, [x, b, e, m, N]), k = () => {
1134
- if (!b) return;
1138
+ }, [x, v, e, h, N]), k = () => {
1139
+ if (!v) return;
1135
1140
  const { bridge: u } = w();
1136
- u ? u.view(e) : v(
1137
- `Visualização não disponível em localhost (${h.name})`,
1141
+ u ? u.view(e) : b(
1142
+ `Visualização não disponível em localhost (${m.name})`,
1138
1143
  "warning"
1139
1144
  );
1140
1145
  }, $ = (u) => {
1141
1146
  u.stopPropagation();
1142
- const { bridge: s } = w();
1143
- window.confirm(`Deseja remover o anexo "${h.name}"?`) && (s && s.remove(e), m.onChange(""), v("Anexo removido.", "danger"), N());
1147
+ const { bridge: s } = w(), l = (m == null ? void 0 : m.name) || "";
1148
+ window.confirm(`Deseja remover o anexo "${l}"?`) && (s ? s.remove(e) ? (h.onChange(""), b("Anexo removido com sucesso.", "success")) : b("Erro ao tentar remover o anexo no Fluig.", "danger") : (h.onChange(""), b("[LOCALHOST] Anexo removido da UI.", "success")), setTimeout(() => N(), 500));
1144
1149
  };
1145
1150
  return /* @__PURE__ */ f("div", { className: `form-group ${d}`, style: { marginBottom: "15px" }, children: [
1146
1151
  r && /* @__PURE__ */ t("label", { className: "control-label", children: r }),
1147
1152
  /* @__PURE__ */ f(
1148
1153
  "div",
1149
1154
  {
1150
- className: `attachment-container ${b ? "has-file" : ""}`,
1155
+ className: `attachment-container ${v ? "has-file" : ""}`,
1151
1156
  style: {
1152
- border: `1px ${b ? "solid" : "dashed"} ${b ? "#5cb85c" : "#ccc"}`,
1157
+ border: `1px ${v ? "solid" : "dashed"} ${v ? "#5cb85c" : "#ccc"}`,
1153
1158
  borderRadius: "4px",
1154
1159
  padding: "8px 15px",
1155
1160
  display: "flex",
1156
1161
  alignItems: "center",
1157
1162
  justifyContent: "space-between",
1158
- backgroundColor: x ? "#f5f5f5" : b ? "#f9fff9" : "#fff",
1159
- cursor: x && !b ? "default" : "pointer",
1163
+ backgroundColor: x ? "#f5f5f5" : v ? "#f9fff9" : "#fff",
1164
+ cursor: x && !v ? "default" : "pointer",
1160
1165
  minHeight: "48px",
1161
1166
  transition: "all 0.3s ease"
1162
1167
  },
1163
- onClick: b ? k : y,
1168
+ onClick: v ? k : y,
1164
1169
  children: [
1165
1170
  /* @__PURE__ */ f(
1166
1171
  "div",
@@ -1176,8 +1181,8 @@ const ht = ({
1176
1181
  /* @__PURE__ */ t(
1177
1182
  "i",
1178
1183
  {
1179
- className: `fluigicon ${b ? "fluigicon-file-pdf" : "fluigicon-paperclip"} icon-sm`,
1180
- style: { color: b ? "#5cb85c" : "#777" }
1184
+ className: `fluigicon ${v ? "fluigicon-file-pdf" : "fluigicon-paperclip"} icon-sm`,
1185
+ style: { color: v ? "#5cb85c" : "#777" }
1181
1186
  }
1182
1187
  ),
1183
1188
  /* @__PURE__ */ t(
@@ -1185,20 +1190,20 @@ const ht = ({
1185
1190
  {
1186
1191
  style: {
1187
1192
  fontSize: "14px",
1188
- fontWeight: b ? "500" : "400",
1193
+ fontWeight: v ? "500" : "400",
1189
1194
  whiteSpace: "nowrap",
1190
1195
  overflow: "hidden",
1191
1196
  textOverflow: "ellipsis",
1192
- color: b ? "#333" : "#777"
1197
+ color: v ? "#333" : "#777"
1193
1198
  },
1194
- children: b ? h.name : n || "Anexar arquivo"
1199
+ children: v ? m.name : n || "Anexar arquivo"
1195
1200
  }
1196
1201
  )
1197
1202
  ]
1198
1203
  }
1199
1204
  ),
1200
1205
  /* @__PURE__ */ f("div", { style: { display: "flex", gap: "8px", marginLeft: "10px" }, children: [
1201
- b && /* @__PURE__ */ t(
1206
+ v && /* @__PURE__ */ t(
1202
1207
  "button",
1203
1208
  {
1204
1209
  type: "button",
@@ -1208,7 +1213,7 @@ const ht = ({
1208
1213
  children: /* @__PURE__ */ t("i", { className: "fluigicon fluigicon-eye-open" })
1209
1214
  }
1210
1215
  ),
1211
- !x && b && /* @__PURE__ */ f(B, { children: [
1216
+ !x && v && /* @__PURE__ */ f(B, { children: [
1212
1217
  c && /* @__PURE__ */ t(
1213
1218
  "button",
1214
1219
  {
@@ -1222,7 +1227,7 @@ const ht = ({
1222
1227
  children: /* @__PURE__ */ t("i", { className: "fluigicon fluigicon-refresh" })
1223
1228
  }
1224
1229
  ),
1225
- o && /* @__PURE__ */ t(
1230
+ i && /* @__PURE__ */ t(
1226
1231
  "button",
1227
1232
  {
1228
1233
  type: "button",
@@ -1238,7 +1243,7 @@ const ht = ({
1238
1243
  ]
1239
1244
  }
1240
1245
  ),
1241
- /* @__PURE__ */ t("input", { type: "hidden", name: e, value: m.value || "" })
1246
+ /* @__PURE__ */ t("input", { type: "hidden", name: e, value: h.value || "" })
1242
1247
  ] });
1243
1248
  }, ft = I(Ze);
1244
1249
  function gt({
@@ -1247,35 +1252,35 @@ function gt({
1247
1252
  showNavigation: n = !0,
1248
1253
  progressBar: d = !0
1249
1254
  }) {
1250
- const [o, c] = j(0), [i, a] = j(0), p = E(null), m = E(null), h = A(() => {
1251
- c((v) => (v + 1) % e.length), a(0);
1255
+ const [i, c] = j(0), [o, a] = j(0), p = q(null), h = q(null), m = A(() => {
1256
+ c((b) => (b + 1) % e.length), a(0);
1252
1257
  }, [e.length]), N = A(() => {
1253
- c((v) => (v - 1 + e.length) % e.length), a(0);
1258
+ c((b) => (b - 1 + e.length) % e.length), a(0);
1254
1259
  }, [e.length]);
1255
1260
  if (V(() => {
1256
1261
  if (r > 0 && e.length > 1) {
1257
1262
  const y = 100 / r * 100;
1258
- p.current = setInterval(h, r), m.current = setInterval(() => {
1263
+ p.current = setInterval(m, r), h.current = setInterval(() => {
1259
1264
  a((k) => k >= 100 ? 0 : k + y);
1260
1265
  }, 100);
1261
1266
  }
1262
1267
  return () => {
1263
- p.current && clearInterval(p.current), m.current && clearInterval(m.current);
1268
+ p.current && clearInterval(p.current), h.current && clearInterval(h.current);
1264
1269
  };
1265
- }, [r, h, e.length, o]), !e || e.length === 0) return null;
1266
- const x = e[o], b = typeof x == "string" ? x : x.url, w = /\.(jpg|jpeg|png|gif|webp)$/i.test(b);
1270
+ }, [r, m, e.length, i]), !e || e.length === 0) return null;
1271
+ const x = e[i], v = typeof x == "string" ? x : x.url, w = /\.(jpg|jpeg|png|gif|webp)$/i.test(v);
1267
1272
  return /* @__PURE__ */ f("div", { className: "carousel-root", children: [
1268
1273
  /* @__PURE__ */ f("div", { className: "carousel-viewport", children: [
1269
1274
  n && e.length > 1 && /* @__PURE__ */ f(B, { children: [
1270
1275
  /* @__PURE__ */ t("button", { className: "nav-btn prev", onClick: N, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-left" }) }),
1271
- /* @__PURE__ */ t("button", { className: "nav-btn next", onClick: h, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-right" }) })
1276
+ /* @__PURE__ */ t("button", { className: "nav-btn next", onClick: m, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-right" }) })
1272
1277
  ] }),
1273
- /* @__PURE__ */ t("div", { className: "carousel-media", children: w ? /* @__PURE__ */ t("img", { src: b, alt: "Slide", className: "carousel-image" }) : /* @__PURE__ */ f("div", { className: "carousel-file-fallback", children: [
1278
+ /* @__PURE__ */ t("div", { className: "carousel-media", children: w ? /* @__PURE__ */ t("img", { src: v, alt: "Slide", className: "carousel-image" }) : /* @__PURE__ */ f("div", { className: "carousel-file-fallback", children: [
1274
1279
  /* @__PURE__ */ t("i", { className: "flaticon flaticon-file icon-xl" }),
1275
1280
  /* @__PURE__ */ t(
1276
1281
  "a",
1277
1282
  {
1278
- href: b,
1283
+ href: v,
1279
1284
  target: "_blank",
1280
1285
  rel: "noreferrer",
1281
1286
  className: "btn-open",
@@ -1283,10 +1288,10 @@ function gt({
1283
1288
  }
1284
1289
  )
1285
1290
  ] }) }),
1286
- e.length > 1 && /* @__PURE__ */ t("div", { className: "carousel-dots", children: e.map((v, y) => /* @__PURE__ */ t(
1291
+ e.length > 1 && /* @__PURE__ */ t("div", { className: "carousel-dots", children: e.map((b, y) => /* @__PURE__ */ t(
1287
1292
  "div",
1288
1293
  {
1289
- className: `dot ${y === o ? "active" : ""}`,
1294
+ className: `dot ${y === i ? "active" : ""}`,
1290
1295
  onClick: () => {
1291
1296
  c(y), a(0);
1292
1297
  }
@@ -1298,7 +1303,7 @@ function gt({
1298
1303
  "div",
1299
1304
  {
1300
1305
  className: "carousel-progress-bar",
1301
- style: { width: `${i}%` }
1306
+ style: { width: `${o}%` }
1302
1307
  }
1303
1308
  ) })
1304
1309
  ] });
@@ -1308,9 +1313,9 @@ function pt({
1308
1313
  isOpen: r,
1309
1314
  onOpen: n,
1310
1315
  onClose: d,
1311
- content: o,
1316
+ content: i,
1312
1317
  footer: c,
1313
- width: i
1318
+ width: o
1314
1319
  }) {
1315
1320
  const a = A(
1316
1321
  (p) => {
@@ -1330,7 +1335,7 @@ function pt({
1330
1335
  children: /* @__PURE__ */ f(
1331
1336
  "div",
1332
1337
  {
1333
- style: { maxWidth: i },
1338
+ style: { maxWidth: o },
1334
1339
  className: "modal-container",
1335
1340
  onClick: (p) => p.stopPropagation(),
1336
1341
  children: [
@@ -1353,7 +1358,7 @@ function pt({
1353
1358
  }
1354
1359
  )
1355
1360
  ] }),
1356
- /* @__PURE__ */ t("div", { className: "modal-content", children: o }),
1361
+ /* @__PURE__ */ t("div", { className: "modal-content", children: i }),
1357
1362
  c && /* @__PURE__ */ t("div", { className: "modal-footer", children: c })
1358
1363
  ]
1359
1364
  }
@@ -1366,24 +1371,24 @@ function bt({
1366
1371
  childs: r,
1367
1372
  footer: n,
1368
1373
  contentExternal: d,
1369
- bg: o,
1374
+ bg: i,
1370
1375
  color: c,
1371
- onSelect: i
1376
+ onSelect: o
1372
1377
  }) {
1373
1378
  return /* @__PURE__ */ f("div", { className: "main-container dfea", children: [
1374
- /* @__PURE__ */ f("div", { className: "sidebar-wrapper", style: { backgroundColor: `${o}` }, children: [
1379
+ /* @__PURE__ */ f("div", { className: "sidebar-wrapper", style: { backgroundColor: `${i}` }, children: [
1375
1380
  e && /* @__PURE__ */ t("div", { className: "sidebar-logo", children: /* @__PURE__ */ t("img", { src: e, alt: "", width: "auto", height: "28px" }) }),
1376
1381
  /* @__PURE__ */ t("ul", { className: "sidebar-childs-content", children: r == null ? void 0 : r.map(
1377
1382
  (a) => {
1378
- var p, m;
1383
+ var p, h;
1379
1384
  return a != null && a.options && ((p = a == null ? void 0 : a.options) == null ? void 0 : p.length) > 0 ? /* @__PURE__ */ t(B, { children: /* @__PURE__ */ f("ul", { className: "sidebar-child sidebar-options-content", children: [
1380
1385
  /* @__PURE__ */ f(
1381
1386
  "li",
1382
1387
  {
1383
1388
  className: "sidebar-child",
1384
1389
  onClick: () => {
1385
- var h;
1386
- (h = a.action) == null || h.call(a), i == null || i(a.id);
1390
+ var m;
1391
+ (m = a.action) == null || m.call(a), o == null || o(a.id);
1387
1392
  },
1388
1393
  style: { color: `${c}` },
1389
1394
  children: [
@@ -1392,16 +1397,16 @@ function bt({
1392
1397
  ]
1393
1398
  }
1394
1399
  ),
1395
- (m = a.options) == null ? void 0 : m.map((h) => /* @__PURE__ */ t(
1400
+ (h = a.options) == null ? void 0 : h.map((m) => /* @__PURE__ */ t(
1396
1401
  "li",
1397
1402
  {
1398
1403
  className: "sidebar-option",
1399
1404
  onClick: () => {
1400
1405
  var N;
1401
- (N = h.action) == null || N.call(h), i == null || i(h.id);
1406
+ (N = m.action) == null || N.call(m), o == null || o(m.id);
1402
1407
  },
1403
1408
  style: { color: `${c}` },
1404
- children: h.label
1409
+ children: m.label
1405
1410
  }
1406
1411
  ))
1407
1412
  ] }) }) : /* @__PURE__ */ f(
@@ -1409,8 +1414,8 @@ function bt({
1409
1414
  {
1410
1415
  className: "sidebar-child",
1411
1416
  onClick: () => {
1412
- var h;
1413
- (h = a.action) == null || h.call(a), i == null || i(a.id);
1417
+ var m;
1418
+ (m = a.action) == null || m.call(a), o == null || o(a.id);
1414
1419
  },
1415
1420
  style: { color: `${c}` },
1416
1421
  children: [
@@ -1431,10 +1436,10 @@ export {
1431
1436
  gt as Carousel,
1432
1437
  lt as Checkbox,
1433
1438
  ut as DatePicker,
1434
- it as Input,
1439
+ ot as Input,
1435
1440
  pt as Modal,
1436
1441
  ct as RadioBtn,
1437
- ot as Select,
1442
+ it as Select,
1438
1443
  bt as Sidebar,
1439
1444
  ht as SimpleTable,
1440
1445
  mt as StatusBadge,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tech-diefra/fluig-ui",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",