@tech-diefra/fluig-ui 1.2.16 → 1.2.18

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:w}=S.useFormContext(),{isView:p}=$.useFluigRuntime(),{field:j}=S.useController({name:e,control:w}),{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:w=!1,forceHidden:p=!1}){const{isReadOnly:j,isHidden:b}=$.useSection(),v=w||!!j(e),N=p||!!b(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,O]=u.useState(!1),[F,q]=u.useState(""),W=u.useRef(null),D=u.useRef(f);u.useEffect(()=>{D.current=f},[f]),u.useEffect(()=>{const k=A=>{W.current&&!W.current.contains(A.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(F)},h);return()=>clearTimeout(k)},[F,o,h]);const H=u.useMemo(()=>o&&!f&&F.trim()?n.filter(k=>String((k==null?void 0:k[i])??"").toLowerCase().includes(F.toLowerCase())):n??[],[n,o,f,F,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),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 ${C?"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:F,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||""}),C&&t.jsx("p",{className:"text-danger",children:String(C.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(),w=h?h(e):!1,p=y?y(e):!1,j=c||w,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((C,M)=>{const O=M[d],F=s.getValues(O);return C[O]=F==="on",C},{}),R=s.watch(e),m=u.useMemo(()=>R&&typeof R=="object"?R:N(),[R,a,d]);u.useEffect(()=>{const C=s.getValues(e);(!C||typeof C!="object")&&s.setValue(e,m,{shouldDirty:!1,shouldValidate:!1})},[m,e,s]);const r=(C,M)=>{if(v)return;const O={...m,[C]:M};s.setValue(e,O,{shouldDirty:!0,shouldValidate:!0}),s.setValue(C,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(C=>{const M=String(C[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:F=>r(M,F.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: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:w}=S.useFormContext(),{isView:p,isReadOnly:j}=$.useFluigRuntime(),{field:b,fieldState:{error:v}}=S.useController({name:e,control:w}),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:w}=S.useFormContext(),{isView:p}=$.useFluigRuntime(),{field:j,fieldState:{error:b}}=S.useController({name:e,control:w});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"})},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},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]},Fe={narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},Ae={any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},Ve={ordinalNumber:re({matchPattern: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:Oe,defaultParseWidth:"any"}),dayPeriod:T({matchPatterns:Fe,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 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:w,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=>{w(r?De(r):"")},[w]),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 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)}}}},[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(),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(!(s.length>0&&!d)&&o.value&&typeof o.value=="string"){const r=JSON.stringify(s);if(o.value===r)return;const l=w(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(C=>C._uid===r?{...C,[l]:g}:C))},[]),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(),w=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:!!w,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}),!w&&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:[!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: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:!!w,isView:!!f}):l.render(m,r,(g,P)=>N.updateCellValue(m._uid,g,P),!!w,!!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:w?"Nenhum registro encontrado.":"Nenhum registro."})})]})]})})]})},ze=e=>{const[a,n]=u.useState(null),{watch:d}=S.useFormContext(),i=d(e),c=u.useCallback(()=>{try{const s=window.top.__REACT_ATTACHMENT_BRIDGE__;if(s){const x=s.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,2e3);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),w=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(w||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()},[w,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)||f.value;window.confirm(`Deseja remover o anexo "${l}"?`)&&(f.onChange(""),r?r.remove(e)?b("Anexo removido com sucesso.","success"):console.warn("Fluig não encontrou o arquivo para deletar fisicamente."):b("[LOCALHOST] Removido.","success"),setTimeout(()=>y(),200))};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:w?"#f5f5f5":p?"#f9fff9":"#fff",cursor:w&&!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"})}),!w&&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 w=e[i],p=typeof w=="string"?w:w.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 O, useState as j, useRef as E, 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,26 +16,26 @@ 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]
27
- ), $ = A((s) => {
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
+ ), $ = O((s) => {
28
28
  if (!s) return "";
29
29
  const l = s.replace(/\D/g, "");
30
30
  return (Number(l) / 100).toLocaleString("pt-BR", {
31
31
  style: "currency",
32
32
  currency: "BRL"
33
33
  });
34
- }, []), u = A(
34
+ }, []), u = O(
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, A] = j(!1), [M, G] = j(""), z = E(null), X = E(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) && A(!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), A(!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 && A((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 A = S[d], M = a.getValues(A);
191
+ return C[A] = 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 A = { ...u, [C]: S };
203
+ a.setValue(e, A, {
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]), A = 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 ${A ? "checked" : ""} ${y ? "readOnly" : ""}`,
222
222
  children: [
223
223
  /* @__PURE__ */ t(
224
224
  "input",
225
225
  {
226
226
  type: "checkbox",
227
- checked: M,
227
+ checked: A,
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 = O(
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
366
  function q(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"],
@@ -631,11 +631,11 @@ const ge = {
631
631
  evening: "da tarde",
632
632
  night: "da noite"
633
633
  }
634
- }, Ae = (e, r) => {
634
+ }, Oe = (e, r) => {
635
635
  const n = Number(e);
636
636
  return (r == null ? void 0 : r.unit) === "week" ? n + "ª" : n + "º";
637
- }, Me = {
638
- ordinalNumber: Ae,
637
+ }, Ae = {
638
+ ordinalNumber: Oe,
639
639
  era: L({
640
640
  values: Ce,
641
641
  defaultWidth: "wide"
@@ -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
@@ -730,7 +730,7 @@ const ge = {
730
730
  }
731
731
  }, Ee = {
732
732
  ordinalNumber: fe({
733
- matchPattern: Oe,
733
+ matchPattern: Me,
734
734
  parsePattern: Ve,
735
735
  valueCallback: (e) => parseInt(e, 10)
736
736
  }),
@@ -770,7 +770,7 @@ const ge = {
770
770
  formatDistance: pe,
771
771
  formatLong: we,
772
772
  formatRelative: xe,
773
- localize: Me,
773
+ localize: Ae,
774
774
  match: Ee,
775
775
  options: {
776
776
  weekStartsOn: 0,
@@ -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,25 +799,25 @@ 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
811
- }), k = _(() => ze(w), [w]), $ = A(
810
+ control: o
811
+ }), k = _(() => ze(w), [w]), $ = O(
812
812
  (s) => {
813
813
  x(s ? Xe(s) : "");
814
814
  },
815
815
  [x]
816
- ), u = A(
816
+ ), u = O(
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 = O(() => {
931
931
  const s = { _uid: N(), ...n };
932
932
  p((l) => [...l, s]);
933
- }, [n]), w = A(() => {
933
+ }, [n]), w = O(() => {
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 = O(
938
938
  (s, l, g) => {
939
939
  p(
940
940
  (P) => P.map(
@@ -943,16 +943,16 @@ function Qe({
943
943
  );
944
944
  },
945
945
  []
946
- ), y = A((s) => {
947
- h(
946
+ ), y = O((s) => {
947
+ m(
948
948
  (l) => l.includes(s) ? l.filter((g) => g !== s) : [...l, s]
949
949
  );
950
- }, []), k = A(
950
+ }, []), k = O(
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,32 @@ 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 = O(() => {
1082
1082
  try {
1083
1083
  const a = window.top.__REACT_ATTACHMENT_BRIDGE__;
1084
1084
  if (a) {
1085
1085
  const p = a.getAttachment(e);
1086
- n(p || (o ? { name: o, documentId: 0 } : null));
1087
- } else n(o ? { name: o, documentId: 0 } : null);
1086
+ n(p || (i ? { name: i, documentId: 0 } : null));
1087
+ } else
1088
+ n(i ? { name: i, documentId: 0 } : null);
1088
1089
  } catch {
1089
- n(o ? { name: o, documentId: 0 } : null);
1090
+ n(i ? { name: i, documentId: 0 } : null);
1090
1091
  }
1091
- }, [e, o]);
1092
+ }, [e, i]);
1092
1093
  return V(() => {
1093
1094
  c();
1094
- const i = setInterval(c, 1e3);
1095
- return () => clearInterval(i);
1095
+ const o = setInterval(c, 2e3);
1096
+ return () => clearInterval(o);
1096
1097
  }, [c]), { attachment: r, sync: c };
1097
1098
  }, Ze = ({
1098
1099
  name: e,
1099
1100
  label: r,
1100
1101
  help: n,
1101
1102
  className: d = "",
1102
- showRemove: o = !0,
1103
+ showRemove: i = !0,
1103
1104
  showUpdate: c = !0
1104
1105
  }) => {
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 = () => {
1106
+ 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
1107
  var u;
1107
1108
  try {
1108
1109
  const s = window.top;
@@ -1113,54 +1114,56 @@ const ht = ({
1113
1114
  } catch {
1114
1115
  return { bridge: null, toast: null };
1115
1116
  }
1116
- }, v = (u, s = "info") => {
1117
+ }, b = (u, s = "info") => {
1117
1118
  const { toast: l } = w();
1118
1119
  l ? l({ title: "Anexos: ", message: u, type: s }) : console.log(`[LOCALHOST TOAST - ${s.toUpperCase()}]: ${u}`);
1119
- }, y = A(() => {
1120
- if (x || b) return;
1120
+ }, y = O(() => {
1121
+ if (x || v) return;
1121
1122
  const u = document.createElement("input");
1122
1123
  u.type = "file", u.onchange = (s) => {
1123
1124
  const l = s.target.files[0];
1124
1125
  if (!l) return;
1125
1126
  const { bridge: g } = w();
1126
- g ? (m.onChange(l.name), g.upload(l, e, (P) => {
1127
- m.onChange(P.name), v(
1127
+ g ? (h.onChange(l.name), g.upload(l, e, (P) => {
1128
+ h.onChange(P.name), b(
1128
1129
  `Arquivo ${l.name} enviado com sucesso!`,
1129
1130
  "success"
1130
1131
  ), N();
1131
- })) : (m.onChange(l.name), v(`[LOCALHOST] Arquivo "${l.name}" simulado.`, "info"));
1132
+ })) : (h.onChange(l.name), b(`[LOCALHOST] Arquivo "${l.name}" simulado.`, "info"));
1132
1133
  }, u.click();
1133
- }, [x, b, e, m, N]), k = () => {
1134
- if (!b) return;
1134
+ }, [x, v, e, h, N]), k = () => {
1135
+ if (!v) return;
1135
1136
  const { bridge: u } = w();
1136
- u ? u.view(e) : v(
1137
- `Visualização não disponível em localhost (${h.name})`,
1137
+ u ? u.view(e) : b(
1138
+ `Visualização não disponível em localhost (${m.name})`,
1138
1139
  "warning"
1139
1140
  );
1140
1141
  }, $ = (u) => {
1141
1142
  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());
1143
+ const { bridge: s } = w(), l = (m == null ? void 0 : m.name) || h.value;
1144
+ window.confirm(`Deseja remover o anexo "${l}"?`) && (h.onChange(""), s ? s.remove(e) ? b("Anexo removido com sucesso.", "success") : console.warn(
1145
+ "Fluig não encontrou o arquivo para deletar fisicamente."
1146
+ ) : b("[LOCALHOST] Removido.", "success"), setTimeout(() => N(), 200));
1144
1147
  };
1145
1148
  return /* @__PURE__ */ f("div", { className: `form-group ${d}`, style: { marginBottom: "15px" }, children: [
1146
1149
  r && /* @__PURE__ */ t("label", { className: "control-label", children: r }),
1147
1150
  /* @__PURE__ */ f(
1148
1151
  "div",
1149
1152
  {
1150
- className: `attachment-container ${b ? "has-file" : ""}`,
1153
+ className: `attachment-container ${v ? "has-file" : ""}`,
1151
1154
  style: {
1152
- border: `1px ${b ? "solid" : "dashed"} ${b ? "#5cb85c" : "#ccc"}`,
1155
+ border: `1px ${v ? "solid" : "dashed"} ${v ? "#5cb85c" : "#ccc"}`,
1153
1156
  borderRadius: "4px",
1154
1157
  padding: "8px 15px",
1155
1158
  display: "flex",
1156
1159
  alignItems: "center",
1157
1160
  justifyContent: "space-between",
1158
- backgroundColor: x ? "#f5f5f5" : b ? "#f9fff9" : "#fff",
1159
- cursor: x && !b ? "default" : "pointer",
1161
+ backgroundColor: x ? "#f5f5f5" : v ? "#f9fff9" : "#fff",
1162
+ cursor: x && !v ? "default" : "pointer",
1160
1163
  minHeight: "48px",
1161
1164
  transition: "all 0.3s ease"
1162
1165
  },
1163
- onClick: b ? k : y,
1166
+ onClick: v ? k : y,
1164
1167
  children: [
1165
1168
  /* @__PURE__ */ f(
1166
1169
  "div",
@@ -1176,8 +1179,8 @@ const ht = ({
1176
1179
  /* @__PURE__ */ t(
1177
1180
  "i",
1178
1181
  {
1179
- className: `fluigicon ${b ? "fluigicon-file-pdf" : "fluigicon-paperclip"} icon-sm`,
1180
- style: { color: b ? "#5cb85c" : "#777" }
1182
+ className: `fluigicon ${v ? "fluigicon-file-pdf" : "fluigicon-paperclip"} icon-sm`,
1183
+ style: { color: v ? "#5cb85c" : "#777" }
1181
1184
  }
1182
1185
  ),
1183
1186
  /* @__PURE__ */ t(
@@ -1185,20 +1188,20 @@ const ht = ({
1185
1188
  {
1186
1189
  style: {
1187
1190
  fontSize: "14px",
1188
- fontWeight: b ? "500" : "400",
1191
+ fontWeight: v ? "500" : "400",
1189
1192
  whiteSpace: "nowrap",
1190
1193
  overflow: "hidden",
1191
1194
  textOverflow: "ellipsis",
1192
- color: b ? "#333" : "#777"
1195
+ color: v ? "#333" : "#777"
1193
1196
  },
1194
- children: b ? h.name : n || "Anexar arquivo"
1197
+ children: v ? m.name : n || "Anexar arquivo"
1195
1198
  }
1196
1199
  )
1197
1200
  ]
1198
1201
  }
1199
1202
  ),
1200
1203
  /* @__PURE__ */ f("div", { style: { display: "flex", gap: "8px", marginLeft: "10px" }, children: [
1201
- b && /* @__PURE__ */ t(
1204
+ v && /* @__PURE__ */ t(
1202
1205
  "button",
1203
1206
  {
1204
1207
  type: "button",
@@ -1208,7 +1211,7 @@ const ht = ({
1208
1211
  children: /* @__PURE__ */ t("i", { className: "fluigicon fluigicon-eye-open" })
1209
1212
  }
1210
1213
  ),
1211
- !x && b && /* @__PURE__ */ f(B, { children: [
1214
+ !x && v && /* @__PURE__ */ f(B, { children: [
1212
1215
  c && /* @__PURE__ */ t(
1213
1216
  "button",
1214
1217
  {
@@ -1222,7 +1225,7 @@ const ht = ({
1222
1225
  children: /* @__PURE__ */ t("i", { className: "fluigicon fluigicon-refresh" })
1223
1226
  }
1224
1227
  ),
1225
- o && /* @__PURE__ */ t(
1228
+ i && /* @__PURE__ */ t(
1226
1229
  "button",
1227
1230
  {
1228
1231
  type: "button",
@@ -1238,7 +1241,7 @@ const ht = ({
1238
1241
  ]
1239
1242
  }
1240
1243
  ),
1241
- /* @__PURE__ */ t("input", { type: "hidden", name: e, value: m.value || "" })
1244
+ /* @__PURE__ */ t("input", { type: "hidden", name: e, value: h.value || "" })
1242
1245
  ] });
1243
1246
  }, ft = I(Ze);
1244
1247
  function gt({
@@ -1247,35 +1250,35 @@ function gt({
1247
1250
  showNavigation: n = !0,
1248
1251
  progressBar: d = !0
1249
1252
  }) {
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);
1252
- }, [e.length]), N = A(() => {
1253
- c((v) => (v - 1 + e.length) % e.length), a(0);
1253
+ const [i, c] = j(0), [o, a] = j(0), p = E(null), h = E(null), m = O(() => {
1254
+ c((b) => (b + 1) % e.length), a(0);
1255
+ }, [e.length]), N = O(() => {
1256
+ c((b) => (b - 1 + e.length) % e.length), a(0);
1254
1257
  }, [e.length]);
1255
1258
  if (V(() => {
1256
1259
  if (r > 0 && e.length > 1) {
1257
1260
  const y = 100 / r * 100;
1258
- p.current = setInterval(h, r), m.current = setInterval(() => {
1261
+ p.current = setInterval(m, r), h.current = setInterval(() => {
1259
1262
  a((k) => k >= 100 ? 0 : k + y);
1260
1263
  }, 100);
1261
1264
  }
1262
1265
  return () => {
1263
- p.current && clearInterval(p.current), m.current && clearInterval(m.current);
1266
+ p.current && clearInterval(p.current), h.current && clearInterval(h.current);
1264
1267
  };
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);
1268
+ }, [r, m, e.length, i]), !e || e.length === 0) return null;
1269
+ const x = e[i], v = typeof x == "string" ? x : x.url, w = /\.(jpg|jpeg|png|gif|webp)$/i.test(v);
1267
1270
  return /* @__PURE__ */ f("div", { className: "carousel-root", children: [
1268
1271
  /* @__PURE__ */ f("div", { className: "carousel-viewport", children: [
1269
1272
  n && e.length > 1 && /* @__PURE__ */ f(B, { children: [
1270
1273
  /* @__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" }) })
1274
+ /* @__PURE__ */ t("button", { className: "nav-btn next", onClick: m, children: /* @__PURE__ */ t("i", { className: "flaticon flaticon-chevron-right" }) })
1272
1275
  ] }),
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: [
1276
+ /* @__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
1277
  /* @__PURE__ */ t("i", { className: "flaticon flaticon-file icon-xl" }),
1275
1278
  /* @__PURE__ */ t(
1276
1279
  "a",
1277
1280
  {
1278
- href: b,
1281
+ href: v,
1279
1282
  target: "_blank",
1280
1283
  rel: "noreferrer",
1281
1284
  className: "btn-open",
@@ -1283,10 +1286,10 @@ function gt({
1283
1286
  }
1284
1287
  )
1285
1288
  ] }) }),
1286
- e.length > 1 && /* @__PURE__ */ t("div", { className: "carousel-dots", children: e.map((v, y) => /* @__PURE__ */ t(
1289
+ e.length > 1 && /* @__PURE__ */ t("div", { className: "carousel-dots", children: e.map((b, y) => /* @__PURE__ */ t(
1287
1290
  "div",
1288
1291
  {
1289
- className: `dot ${y === o ? "active" : ""}`,
1292
+ className: `dot ${y === i ? "active" : ""}`,
1290
1293
  onClick: () => {
1291
1294
  c(y), a(0);
1292
1295
  }
@@ -1298,7 +1301,7 @@ function gt({
1298
1301
  "div",
1299
1302
  {
1300
1303
  className: "carousel-progress-bar",
1301
- style: { width: `${i}%` }
1304
+ style: { width: `${o}%` }
1302
1305
  }
1303
1306
  ) })
1304
1307
  ] });
@@ -1308,11 +1311,11 @@ function pt({
1308
1311
  isOpen: r,
1309
1312
  onOpen: n,
1310
1313
  onClose: d,
1311
- content: o,
1314
+ content: i,
1312
1315
  footer: c,
1313
- width: i
1316
+ width: o
1314
1317
  }) {
1315
- const a = A(
1318
+ const a = O(
1316
1319
  (p) => {
1317
1320
  p.key === "Escape" && d();
1318
1321
  },
@@ -1330,7 +1333,7 @@ function pt({
1330
1333
  children: /* @__PURE__ */ f(
1331
1334
  "div",
1332
1335
  {
1333
- style: { maxWidth: i },
1336
+ style: { maxWidth: o },
1334
1337
  className: "modal-container",
1335
1338
  onClick: (p) => p.stopPropagation(),
1336
1339
  children: [
@@ -1353,7 +1356,7 @@ function pt({
1353
1356
  }
1354
1357
  )
1355
1358
  ] }),
1356
- /* @__PURE__ */ t("div", { className: "modal-content", children: o }),
1359
+ /* @__PURE__ */ t("div", { className: "modal-content", children: i }),
1357
1360
  c && /* @__PURE__ */ t("div", { className: "modal-footer", children: c })
1358
1361
  ]
1359
1362
  }
@@ -1366,24 +1369,24 @@ function bt({
1366
1369
  childs: r,
1367
1370
  footer: n,
1368
1371
  contentExternal: d,
1369
- bg: o,
1372
+ bg: i,
1370
1373
  color: c,
1371
- onSelect: i
1374
+ onSelect: o
1372
1375
  }) {
1373
1376
  return /* @__PURE__ */ f("div", { className: "main-container dfea", children: [
1374
- /* @__PURE__ */ f("div", { className: "sidebar-wrapper", style: { backgroundColor: `${o}` }, children: [
1377
+ /* @__PURE__ */ f("div", { className: "sidebar-wrapper", style: { backgroundColor: `${i}` }, children: [
1375
1378
  e && /* @__PURE__ */ t("div", { className: "sidebar-logo", children: /* @__PURE__ */ t("img", { src: e, alt: "", width: "auto", height: "28px" }) }),
1376
1379
  /* @__PURE__ */ t("ul", { className: "sidebar-childs-content", children: r == null ? void 0 : r.map(
1377
1380
  (a) => {
1378
- var p, m;
1381
+ var p, h;
1379
1382
  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
1383
  /* @__PURE__ */ f(
1381
1384
  "li",
1382
1385
  {
1383
1386
  className: "sidebar-child",
1384
1387
  onClick: () => {
1385
- var h;
1386
- (h = a.action) == null || h.call(a), i == null || i(a.id);
1388
+ var m;
1389
+ (m = a.action) == null || m.call(a), o == null || o(a.id);
1387
1390
  },
1388
1391
  style: { color: `${c}` },
1389
1392
  children: [
@@ -1392,16 +1395,16 @@ function bt({
1392
1395
  ]
1393
1396
  }
1394
1397
  ),
1395
- (m = a.options) == null ? void 0 : m.map((h) => /* @__PURE__ */ t(
1398
+ (h = a.options) == null ? void 0 : h.map((m) => /* @__PURE__ */ t(
1396
1399
  "li",
1397
1400
  {
1398
1401
  className: "sidebar-option",
1399
1402
  onClick: () => {
1400
1403
  var N;
1401
- (N = h.action) == null || N.call(h), i == null || i(h.id);
1404
+ (N = m.action) == null || N.call(m), o == null || o(m.id);
1402
1405
  },
1403
1406
  style: { color: `${c}` },
1404
- children: h.label
1407
+ children: m.label
1405
1408
  }
1406
1409
  ))
1407
1410
  ] }) }) : /* @__PURE__ */ f(
@@ -1409,8 +1412,8 @@ function bt({
1409
1412
  {
1410
1413
  className: "sidebar-child",
1411
1414
  onClick: () => {
1412
- var h;
1413
- (h = a.action) == null || h.call(a), i == null || i(a.id);
1415
+ var m;
1416
+ (m = a.action) == null || m.call(a), o == null || o(a.id);
1414
1417
  },
1415
1418
  style: { color: `${c}` },
1416
1419
  children: [
@@ -1431,10 +1434,10 @@ export {
1431
1434
  gt as Carousel,
1432
1435
  lt as Checkbox,
1433
1436
  ut as DatePicker,
1434
- it as Input,
1437
+ ot as Input,
1435
1438
  pt as Modal,
1436
1439
  ct as RadioBtn,
1437
- ot as Select,
1440
+ it as Select,
1438
1441
  bt as Sidebar,
1439
1442
  ht as SimpleTable,
1440
1443
  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.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",