@ufal-lccv/gpsub-ds 0.2.32 → 0.2.34
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/{GenericAGGridTable-DAJBGJxg.cjs → GenericAGGridTable-BkKlYm9W.cjs} +744 -746
- package/dist/{GenericAGGridTable-CD15_Ztb.js → GenericAGGridTable-TGbLm6ra.js} +12500 -12496
- package/dist/RequiredLabel.view-D8yK7yMX.js +165 -0
- package/dist/RequiredLabel.view-JYE_W93N.cjs +1 -0
- package/dist/{Table.view-Bdg7Hkt_.js → Table.view-9Q1g9jyS.js} +19 -20
- package/dist/Table.view-OMcadzNU.cjs +1 -0
- package/dist/{Title.view-DsYqM53k.js → Title.view-CEOS_2Kr.js} +8 -8
- package/dist/{Title.view-Dfu3-i8x.cjs → Title.view-Gt-LLz3O.cjs} +1 -1
- package/dist/components/atoms/index.cjs.js +1 -1
- package/dist/components/atoms/index.es.js +2 -2
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.es.js +4 -4
- package/dist/components/molecules/Alert/AlertStack.d.ts +2 -0
- package/dist/components/molecules/Alert/alertStore.d.ts +12 -0
- package/dist/components/molecules/Alert/styles.d.ts +1 -0
- package/dist/components/molecules/Confirm/ConfirmButton.view.d.ts +0 -2
- package/dist/components/molecules/Confirm/ConfirmModal.view.d.ts +2 -1
- package/dist/components/molecules/Confirm/showConfirm.d.ts +1 -1
- package/dist/components/molecules/index.cjs.js +1 -1
- package/dist/components/molecules/index.es.js +2 -2
- package/dist/components/organisms/index.cjs.js +1 -1
- package/dist/components/organisms/index.es.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +4 -4
- package/package.json +1 -1
- package/dist/RequiredLabel.view-CTnwA-1g.js +0 -166
- package/dist/RequiredLabel.view-CWbxOwfp.cjs +0 -1
- package/dist/Table.view-C3PxZQJ2.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { a1 as o, a2 as C, a3 as j, a4 as F, $ as r, a5 as f, a6 as I, c as x, a7 as w, a8 as E, a9 as S, aa as R, ab as A, ac as $, e as D, I as L, ad as _ } from "./GenericAGGridTable-CD15_Ztb.js";
|
|
2
|
-
import { d as v } from "./index-YF_5f0O1.js";
|
|
3
|
-
import { createPortal as y } from "react-dom";
|
|
4
|
-
import { useState as O } from "react";
|
|
5
|
-
import "sbwb-ds";
|
|
6
|
-
const V = ({
|
|
7
|
-
id: a,
|
|
8
|
-
type: l,
|
|
9
|
-
title: e,
|
|
10
|
-
description: c,
|
|
11
|
-
durationInMilliseconds: t = 3e3,
|
|
12
|
-
dataToCopy: i,
|
|
13
|
-
offset: d = { x: 0, y: 0 }
|
|
14
|
-
}) => {
|
|
15
|
-
const n = v.portal.add(a + Date.now() + Math.random()), p = () => {
|
|
16
|
-
try {
|
|
17
|
-
n.remove();
|
|
18
|
-
} catch {
|
|
19
|
-
console.error("Remoção indevida de alert.");
|
|
20
|
-
}
|
|
21
|
-
}, h = y(
|
|
22
|
-
/* @__PURE__ */ o.jsx(
|
|
23
|
-
C,
|
|
24
|
-
{
|
|
25
|
-
id: a,
|
|
26
|
-
type: l,
|
|
27
|
-
title: e,
|
|
28
|
-
description: c,
|
|
29
|
-
durationInMilliseconds: t,
|
|
30
|
-
destroy: p,
|
|
31
|
-
dataToCopy: i,
|
|
32
|
-
offset: d
|
|
33
|
-
}
|
|
34
|
-
),
|
|
35
|
-
n
|
|
36
|
-
);
|
|
37
|
-
j.createRoot(n).render(h);
|
|
38
|
-
}, N = ({
|
|
39
|
-
width: a = "100%",
|
|
40
|
-
height: l = "fit-content",
|
|
41
|
-
type: e,
|
|
42
|
-
variant: c = "small",
|
|
43
|
-
title: t,
|
|
44
|
-
message: i,
|
|
45
|
-
margin: d,
|
|
46
|
-
open: n = !0,
|
|
47
|
-
onClose: p,
|
|
48
|
-
canClose: h = !0
|
|
49
|
-
}) => {
|
|
50
|
-
var u, g;
|
|
51
|
-
const [b, m] = O(n), s = {
|
|
52
|
-
info: {
|
|
53
|
-
backgroundColor: "#D5EBFD",
|
|
54
|
-
borderColor: r.colors.feedbackColors.colorFeedbackInfo,
|
|
55
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
56
|
-
I,
|
|
57
|
-
{
|
|
58
|
-
color: r.colors.feedbackColors.colorFeedbackInfo,
|
|
59
|
-
height: "24px",
|
|
60
|
-
width: "24px"
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
},
|
|
64
|
-
success: {
|
|
65
|
-
backgroundColor: "#DAF9DB",
|
|
66
|
-
borderColor: r.colors.feedbackColors.colorFeedbackSuccess,
|
|
67
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
68
|
-
f,
|
|
69
|
-
{
|
|
70
|
-
color: r.colors.feedbackColors.colorFeedbackSuccess,
|
|
71
|
-
height: "24px",
|
|
72
|
-
width: "24px"
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
},
|
|
76
|
-
warning: {
|
|
77
|
-
backgroundColor: "#FEEECF",
|
|
78
|
-
borderColor: r.colors.feedbackColors.colorFeedbackWarning
|
|
79
|
-
},
|
|
80
|
-
error: {
|
|
81
|
-
backgroundColor: "#FFE1E1",
|
|
82
|
-
borderColor: r.colors.feedbackColors.colorFeedbackError,
|
|
83
|
-
icon: /* @__PURE__ */ o.jsx(
|
|
84
|
-
F,
|
|
85
|
-
{
|
|
86
|
-
color: r.colors.feedbackColors.colorFeedbackError,
|
|
87
|
-
height: "24px",
|
|
88
|
-
width: "24px"
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
function k() {
|
|
94
|
-
m(!1), p == null || p();
|
|
95
|
-
}
|
|
96
|
-
return /* @__PURE__ */ o.jsx(o.Fragment, { children: b ? /* @__PURE__ */ o.jsxs(
|
|
97
|
-
x,
|
|
98
|
-
{
|
|
99
|
-
width: a,
|
|
100
|
-
height: l,
|
|
101
|
-
direction: "horizontal",
|
|
102
|
-
verticalAlign: t ? "top" : "center",
|
|
103
|
-
gap: r.spacings.spacingInline.spacingInlineAnt,
|
|
104
|
-
padding: c == "small" ? `${r.spacings.spacingStack.spacingStackXs} ${r.spacings.spacingInline.spacingInlineAnt}` : r.spacings.spacingInline.spacingInlineSm,
|
|
105
|
-
backgroundColor: (u = s == null ? void 0 : s[e]) == null ? void 0 : u.backgroundColor,
|
|
106
|
-
customStyles: {
|
|
107
|
-
border: `1px solid ${(g = s == null ? void 0 : s[e]) == null ? void 0 : g.borderColor}`,
|
|
108
|
-
borderRadius: r.borders.borderRadius.borderRadiusSm,
|
|
109
|
-
margin: d,
|
|
110
|
-
position: "relative"
|
|
111
|
-
},
|
|
112
|
-
children: [
|
|
113
|
-
e === "warning" ? /* @__PURE__ */ o.jsx(w, { children: /* @__PURE__ */ o.jsx(E, { width: "24px", height: "24px" }) }) : /* @__PURE__ */ o.jsx(o.Fragment, { children: s == null ? void 0 : s[e].icon }),
|
|
114
|
-
/* @__PURE__ */ o.jsxs(x, { width: "100%", flex: "1", height: "100%", children: [
|
|
115
|
-
/* @__PURE__ */ o.jsx(S, { children: t }),
|
|
116
|
-
/* @__PURE__ */ o.jsx(R, { children: i })
|
|
117
|
-
] }),
|
|
118
|
-
h && /* @__PURE__ */ o.jsx(x, { children: /* @__PURE__ */ o.jsx(
|
|
119
|
-
A,
|
|
120
|
-
{
|
|
121
|
-
color: r.colors.neutralColors.colorNeutralCloudy,
|
|
122
|
-
cursor: "pointer",
|
|
123
|
-
onClick: k,
|
|
124
|
-
height: "20px",
|
|
125
|
-
width: "20px"
|
|
126
|
-
}
|
|
127
|
-
) })
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
) : /* @__PURE__ */ o.jsx(o.Fragment, {}) });
|
|
131
|
-
}, T = ({
|
|
132
|
-
label: a,
|
|
133
|
-
labelRender: l,
|
|
134
|
-
infoProps: e = {},
|
|
135
|
-
withInfo: c = !0,
|
|
136
|
-
flex: t,
|
|
137
|
-
width: i = "100%",
|
|
138
|
-
isRequired: d = !1
|
|
139
|
-
}) => {
|
|
140
|
-
const n = {
|
|
141
|
-
tooltipProps: {
|
|
142
|
-
position: "top",
|
|
143
|
-
...e == null ? void 0 : e.tooltipProps,
|
|
144
|
-
size: "Small"
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
return /* @__PURE__ */ o.jsxs(x, { width: i, direction: "horizontal", gap: "4px", flex: t, children: [
|
|
148
|
-
l ?? /* @__PURE__ */ o.jsxs($, { children: [
|
|
149
|
-
a,
|
|
150
|
-
" ",
|
|
151
|
-
d ? /* @__PURE__ */ o.jsx(D, {}) : null
|
|
152
|
-
] }),
|
|
153
|
-
c && /* @__PURE__ */ o.jsx(L, { ...n })
|
|
154
|
-
] });
|
|
155
|
-
}, X = ({
|
|
156
|
-
width: a = "100%",
|
|
157
|
-
flex: l,
|
|
158
|
-
label: e = "Obrigatório",
|
|
159
|
-
margin: c = "0 0 16px 0"
|
|
160
|
-
}) => /* @__PURE__ */ o.jsx(x, { width: a, flex: l, customStyles: { margin: c }, children: /* @__PURE__ */ o.jsx(_, { children: `* ${e}` }) });
|
|
161
|
-
export {
|
|
162
|
-
N as A,
|
|
163
|
-
T as L,
|
|
164
|
-
X as R,
|
|
165
|
-
V as s
|
|
166
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./GenericAGGridTable-DAJBGJxg.cjs"),b=require("./index-CPP6SuZS.cjs"),E=require("react-dom"),g=require("react");require("sbwb-ds");const R=({id:s,type:t,title:r,description:n,durationInMilliseconds:l=3e3,dataToCopy:c,offset:a={x:0,y:0}})=>{const i=b.dom.portal.add(s+Date.now()+Math.random()),x=()=>{try{i.remove()}catch{console.error("Remoção indevida de alert.")}},d=E.createPortal(e.jsxRuntimeExports.jsx(e.AlertView,{id:s,type:t,title:r,description:n,durationInMilliseconds:l,destroy:x,dataToCopy:c,offset:a}),i);e.clientExports.createRoot(i).render(d)},C=({width:s="100%",height:t="fit-content",type:r,variant:n="small",title:l,message:c,margin:a,open:i=!0,onClose:x,canClose:d=!0})=>{var p,j;const[u,m]=g.useState(i),o={info:{backgroundColor:"#D5EBFD",borderColor:e.y.colors.feedbackColors.colorFeedbackInfo,icon:e.jsxRuntimeExports.jsx(e.InfoFill_default,{color:e.y.colors.feedbackColors.colorFeedbackInfo,height:"24px",width:"24px"})},success:{backgroundColor:"#DAF9DB",borderColor:e.y.colors.feedbackColors.colorFeedbackSuccess,icon:e.jsxRuntimeExports.jsx(e.CheckCircleFill_default,{color:e.y.colors.feedbackColors.colorFeedbackSuccess,height:"24px",width:"24px"})},warning:{backgroundColor:"#FEEECF",borderColor:e.y.colors.feedbackColors.colorFeedbackWarning},error:{backgroundColor:"#FFE1E1",borderColor:e.y.colors.feedbackColors.colorFeedbackError,icon:e.jsxRuntimeExports.jsx(e.ErrorFill_default,{color:e.y.colors.feedbackColors.colorFeedbackError,height:"24px",width:"24px"})}};function h(){m(!1),x==null||x()}return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:u?e.jsxRuntimeExports.jsxs(e.Container,{width:s,height:t,direction:"horizontal",verticalAlign:l?"top":"center",gap:e.y.spacings.spacingInline.spacingInlineAnt,padding:n=="small"?`${e.y.spacings.spacingStack.spacingStackXs} ${e.y.spacings.spacingInline.spacingInlineAnt}`:e.y.spacings.spacingInline.spacingInlineSm,backgroundColor:(p=o==null?void 0:o[r])==null?void 0:p.backgroundColor,customStyles:{border:`1px solid ${(j=o==null?void 0:o[r])==null?void 0:j.borderColor}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,margin:a,position:"relative"},children:[r==="warning"?e.jsxRuntimeExports.jsx(e.ContainerWarning,{children:e.jsxRuntimeExports.jsx(e.WarningFill_default,{width:"24px",height:"24px"})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o==null?void 0:o[r].icon}),e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",height:"100%",children:[e.jsxRuntimeExports.jsx(e.Title,{children:l}),e.jsxRuntimeExports.jsx(e.Message,{children:c})]}),d&&e.jsxRuntimeExports.jsx(e.Container,{children:e.jsxRuntimeExports.jsx(e.Close_default,{color:e.y.colors.neutralColors.colorNeutralCloudy,cursor:"pointer",onClick:h,height:"20px",width:"20px"})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})})},k=({label:s,labelRender:t,infoProps:r={},withInfo:n=!0,flex:l,width:c="100%",isRequired:a=!1})=>{const i={tooltipProps:{position:"top",...r==null?void 0:r.tooltipProps,size:"Small"}};return e.jsxRuntimeExports.jsxs(e.Container,{width:c,direction:"horizontal",gap:"4px",flex:l,children:[t??e.jsxRuntimeExports.jsxs(e.Label$1,{children:[s," ",a?e.jsxRuntimeExports.jsx(e.Required,{}):null]}),n&&e.jsxRuntimeExports.jsx(e.Info,{...i})]})},F=({width:s="100%",flex:t,label:r="Obrigatório",margin:n="0 0 16px 0"})=>e.jsxRuntimeExports.jsx(e.Container,{width:s,flex:t,customStyles:{margin:n},children:e.jsxRuntimeExports.jsx(e.Label$2,{children:`* ${r}`})});exports.AlertInline=C;exports.LabelField=k;exports.RequiredLabelView=F;exports.showAlert=R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./GenericAGGridTable-DAJBGJxg.cjs"),W=require("react");require("react-dom");const X=require("sbwb-ds"),P=require("react-hook-form"),U=require("./index-CPP6SuZS.cjs"),Y=require("./parseDate-w5bp6OXe.cjs"),Z=350,K=({title:r,children:n,endAdornment:c=null,marginBottom:p="16px",customStyles:a={},wrapperCustomStyles:l={},animationContainerCustomStyles:u={},hideAdornmentOnCollapse:h=!1,maxHeight:S="none",height:D="fit-content"})=>{const[k,A]=W.useState(!1),[j,w]=W.useState(!0);W.useEffect(()=>{if(h)if(k){const g=setTimeout(()=>w(!1),Z);return()=>clearTimeout(g)}else w(!0)},[k,h]);const T=h&&!j?null:c;return e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",gap:"8px",customStyles:l,children:[e.jsxRuntimeExports.jsx(e.SectionTitle,{title:r,divider:!0,marginBottom:p,collapse:{collapsed:k,setCollapsed:A},endAdornment:T,customStyles:a}),e.jsxRuntimeExports.jsx(e.Container,{gap:"8px",width:"100%",height:D,customStyles:{...u,maxHeight:k?"0":S,transition:`max-height ${Z}ms ease-in-out`},children:n})]})};function v({form:r,name:n,id:c=n,label:p,readonly:a=!1,disabled:l=!1,afterCheck:u,width:h="100%",formatter:S,parser:D,flex:k,size:A="Medium",checkColor:j,triggerFormField:w=null,...T}){const{onChangeTrigger:g}=e.useTriggerFormField({form:r,fieldName:n,triggerType:w,debounceTime:0}),x=(m,F)=>{F(m),u==null||u(m),g==null||g()};return e.jsxRuntimeExports.jsx(e.Container,{width:h,flex:k,children:e.jsxRuntimeExports.jsx(P.Controller,{name:n,control:r.control,render:({field:{onChange:m,value:F,onBlur:N},fieldState:{error:C=null}})=>{const M=C==null?void 0:C.message;return M&&console.log("Error on checkbox!",M),e.jsxRuntimeExports.jsx(e.Checkbox,{id:`form-checkbox-${c}`,checked:S?S(F):!!F,name:n,label:p,disabled:l||a,onChange:f=>{x((D==null?void 0:D(f.target.checked,F))??f.target.checked,m),N==null||N()},size:A,checkColor:j,...T})}})})}const B=({form:r,name:n,label:c,placeholder:p,readonly:a=!1,disabled:l=!1,width:u="100%",flex:h,tooltipIsVisible:S,tooltipMaxWidth:D,tooltipPosition:k="top",afterFormChange:A,openToDate:j,range:w=!1,openCalendarOnInputClick:T=!1,...g})=>{let x=p;return!U.valuable(p)&&!l&&(x=a?"Nenhuma data escolhida":"Escolha uma data"),e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:h,children:e.jsxRuntimeExports.jsx(P.Controller,{name:n,control:r.control,render:({field:{value:m,onChange:F,ref:N}})=>{let C;U.valuable(m)&&(w?C=Array.isArray(m)?m.join(" - "):m:C=new Date(U.stringToUtcDate(m.slice(0,10))));const{error:M}=r.getFieldState(n,r.formState);return e.jsxRuntimeExports.jsx(e.Datepicker,{ref:N,idCalendar:`${n}-calendar`,label:c,value:C,size:"Small",readonly:a,errorMessage:M==null?void 0:M.message,disabled:l,placeholder:x,onChangeHandleDate:f=>{var o;F(w?f?f.split(" - ").map(L=>{var $;return(($=Y.parseDate(L))==null?void 0:$.slice(0,10))||null}):[null,null]:f&&((o=Y.parseDate(f))==null?void 0:o.slice(0,10))||null),A==null||A(f)},openToDate:j,selectsRange:w,openCalendarOnInputClick:T,width:u,flex:h,...g})}})})};function ee({form:r,name:n,label:c,slots:{field:p},slotsProps:a,triggerFormField:l=null,value:u,bypassControllerOnChange:h=!1,overrideOnBlur:S=!1,isRequired:D=!1,readonly:k=!1,disabled:A=!1,parser:j,debounce:w,beforeChange:T,onChange:g,afterChange:x,beforeBlur:m,onBlur:F,afterBlur:N,onEnter:C}){const{field:{value:M,onChange:f},fieldState:{error:o=null}}=P.useController({name:n,control:r.control}),L=U.valuable(w),{onChangeTrigger:$,onBlurTrigger:d}=e.useTriggerFormField({form:r,fieldName:n,triggerType:l,debounceTime:L?0:500}),i=(t,R)=>{var y,G;const V=((y=t==null?void 0:t.target)==null?void 0:y.value)||((G=t==null?void 0:t.target)==null?void 0:G.checked)||t||void 0,I=U.valuable(j)?j(V):V;T==null||T(I),h||R==null||R(I),g==null||g(t,R),x==null||x(t,R),$==null||$()},E=W.useMemo(()=>{if(!L)return i;let t;return(V,I)=>{clearTimeout(t),t=setTimeout(()=>i(V,I),w)}},[L,w,i]),b=(t,R)=>{var I,y;const V=((I=t==null?void 0:t.target)==null?void 0:I.value)||((y=t==null?void 0:t.target)==null?void 0:y.checked)||t||void 0;!S&&h&&(f==null||f(V)),m==null||m(t,R),F==null||F(t,R),N==null||N(t,R),d==null||d()},H=(t,R)=>{C==null||C(t,R)};o!=null&&o.message&&console.log(`Error on ${p.displayName}!`,o.message);const s=U.valuable(u)?u==null?void 0:u(M):{value:M};return e.jsxRuntimeExports.jsx(e.Container,{...a==null?void 0:a.container,children:e.jsxRuntimeExports.jsx(p,{...a==null?void 0:a.field,...s,label:c,onChange:t=>E==null?void 0:E(t,f),onBlur:t=>b==null?void 0:b(t,f),onEnter:t=>H==null?void 0:H(t,f),errorMessage:o==null?void 0:o.message})})}const te=({form:r,name:n,label:c,options:p,readonly:a=!1,disabled:l=!1,width:u="100%",flex:h,placeholder:S,iconName:D,onSelect:k,hasSelectAll:A=!1,tags:j=!0,sortOptions:w=!1,enableSearch:T=!1,valueAllOption:g,isRequired:x=!1,tooltipProps:m={},infoProps:F={},triggerFormField:N=null,...C})=>{const{onChangeTrigger:M}=e.useTriggerFormField({form:r,fieldName:n,triggerType:N,debounceTime:0});return e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:h,children:e.jsxRuntimeExports.jsx(P.Controller,{name:n,control:r.control,render:({field:{value:f,onChange:o}})=>{const{error:L}=r.getFieldState(n),$=U.valuable(f)?f:[];return e.jsxRuntimeExports.jsx(e.MultiSelect,{label:c,size:"Small",disabled:l||a,onChange:d=>{o(d),k==null||k(d),M==null||M()},values:$,errorMessage:L==null?void 0:L.message,options:p,iconName:D,hasSelectAll:A,tags:j,sortOptions:w,placeholder:S,enableSearch:T,valueAllOption:g,isRequired:x,tooltipProps:{position:"top",...m},infoProps:{tooltipProps:{position:"top",maxWidth:"300px",...F.tooltipProps},...F},...C})}})})},se=({variant:r="default",form:n,name:c,label:p,options:a,readonly:l=!1,disabled:u=!1,optionsMap:h,width:S="100%",flex:D,placeholder:k,onSelect:A,parser:j,onPaste:w,filter:T,tooltipProps:g={},infoProps:x={},maxHeightMenu:m,isRequired:F=!1,onRemoveSelected:N,triggerFormField:C=null,displayText:M,usePortal:f=!1,...o})=>{const{onChangeTrigger:L}=e.useTriggerFormField({form:n,fieldName:c,triggerType:C,debounceTime:0}),$={position:"top",...g},d={...x,tooltipProps:{position:"top",maxWidth:"300px",...x==null?void 0:x.tooltipProps}},i=(b,H)=>{let s=b;j&&(s=j==null?void 0:j(b)),H(s),A==null||A(s),L==null||L()},E=W.useMemo(()=>U.valuable(h)?h:Object.fromEntries(a.map(b=>[b.value,b])),[a,h]);return e.jsxRuntimeExports.jsx(e.Container,{width:S,flex:D,children:e.jsxRuntimeExports.jsx(P.Controller,{name:c,control:n.control,render:({field:{onChange:b,value:H},fieldState:{error:s=null}})=>{let t=E[H];return e.jsxRuntimeExports.jsx(e.Select,{label:p,width:"100%",size:"Small",variant:r,disabled:u,readonly:l,filter:T,errorMessage:s==null?void 0:s.message,placeholder:k,value:t,handleOption:R=>{i(R.value,b)},tooltipProps:$,options:a,usePortal:f,infoProps:d,maxHeightMenu:m,isRequired:F,onRemoveSelected:N,displayText:M,onPaste:w,...o})}})})},le=r=>{const[n,c]=W.useState(!1),[p,a]=W.useState(r),l=W.useRef(null);return W.useEffect(()=>{a(r)},[r]),{setIsOpen:c,isOpen:n,setOptionsSelect:a,optionsSelect:p,selectContainerRef:l}},ie=200,re=({name:r,variant:n="primary",width:c="100%",size:p="Medium",disabled:a=!1,isLoading:l=!1,onClick:u,options:h,label:S,menuSelectProps:D={},iconName:k,optionsIconPosition:A})=>{const{isOpen:j,setIsOpen:w,selectContainerRef:T,optionsSelect:g}=le(h);let x=e.y.colors.backgroundColors.colorBackgroundSnow;a?x=e.y.colors.neutralColors.colorNeutralCloudy:n!=="primary"&&(x=e.y.colors.neutralColors.colorNeutralDark);const m={...D};return e.jsxRuntimeExports.jsxs(e.SelectContainer,{ref:T,width:c,size:p,disabled:a,onBlur:()=>setTimeout(()=>w(!1),ie),children:[S&&e.jsxRuntimeExports.jsx(e.Label$3,{children:S}),e.jsxRuntimeExports.jsxs(e.Button$1,{type:"button",size:p,disabled:a,variant:n,isLoading:l,onClick:()=>!l&&w(!j),id:`button-component-${r}`,"data-cy":`button-component-${r}`,children:[l&&e.jsxRuntimeExports.jsx(e.WrapperIcon,{size:p,disabled:a,variant:n,children:e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ProgressActivity${p==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-loading"})}),!l&&e.jsxRuntimeExports.jsx("p",{title:r,children:r}),!l&&(j?e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandLess${p==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-less"}):e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandMore${p==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-more"}))]}),j&&e.jsxRuntimeExports.jsx(e.MenuSelect,{selectContainerRef:T,value:null,optionsSelect:g,selectOption:u,size:p,inputValue:null,iconPosition:A,iconName:k,...m})]})},ne=({width:r="100%",height:n="fit-content",flex:c,backgroundColor:p=e.y.colors.backgroundColors.colorBackgroundCarpet,upperComponent:a=void 0,options:l=[],lowerComponent:u=void 0,heightItems:h="60px",widthItems:S="155px",emptyProps:D={title:"Nenhum dado a ser mostrado",body:null},customWrapperStyles:k={border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:"8px"},customItemStyles:A={},selectedKey:j,onSelect:w,selectedItemKey:T,setSelectedItemKey:g})=>{var $;const x=j!==void 0,m=!x&&T!==void 0,[F,N]=W.useState((($=l[0])==null?void 0:$.key)??null),C=W.useRef(null),M=W.useRef(null),f=x?j:m?T:F,o=W.useMemo(()=>l.length?f==null?x?null:l[0]:l.find(i=>i.key===f)??(x||m?null:l[0]):null,[l,f,x,m]);W.useEffect(()=>{const d=C.current,i=M.current,E=()=>{d&&i&&(i.scrollTop=d.scrollTop)};return d==null||d.addEventListener("scroll",E),()=>{d==null||d.removeEventListener("scroll",E)}},[]),W.useEffect(()=>{if(!(x||m)){if(!l.length){N(null);return}N(d=>d!=null&&l.some(i=>i.key===d)?d:l[0].key)}},[l,x,m]);const L=d=>{w==null||w(d),g==null||g(d.key),!x&&!m&&N(d.key)};return(l==null?void 0:l.length)===0?e.jsxRuntimeExports.jsx(e.Empty,{title:D.title,body:D.body,flex:"1",mode:"table"}):e.jsxRuntimeExports.jsxs(e.Container,{width:r,height:n,flex:c,backgroundColor:p,direction:"horizontal",customStyles:{border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,...k,overflow:"hidden"},children:[e.jsxRuntimeExports.jsxs(e.Container$2,{ref:C,widthItems:S,children:[a&&a,l==null?void 0:l.map(d=>e.jsxRuntimeExports.jsx(e.ContainerItem,{selected:f===d.key,onClick:()=>L(d),withBorderRight:!0,heightItems:h,customStyles:A,children:d.item},d.key)),u&&u,e.jsxRuntimeExports.jsx(e.LastSpace,{})]}),e.jsxRuntimeExports.jsx(e.ContainerContent,{children:o&&(o==null?void 0:o.contentItem)})]})};function oe(r){return n=>typeof r=="string"?n[r]:typeof r=="function"?r(n):(console.warn("Please, setup a rowKey for table."),JSON.stringify(n))}function de({id:r,rowKey:n="id",size:c="Small",onRowClick:p,fit:a=!1,maxHeight:l="40rem",columns:u,dataSource:h,columnsTextSize:S=c,emptyProps:D={width:"100%",height:"100%",title:"Nenhum dado a ser mostrado.",mode:"table",borders:!0,backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow},selectedRow:k=!1,hideHeader:A=!1,withBorder:j=!0,withBorderRadius:w=!0,striped:T=!1,borderRadius:g=e.y.borders.borderRadius.borderRadiusSm,disableMaxHeight:x=!1,isVisible:m=!1}){const F=W.useMemo(()=>oe(n),[n]),[N,C]=W.useState(null),M=W.useRef(null),f=W.useRef(null),[o,L]=W.useState(u);W.useLayoutEffect(()=>{if(!f.current||u.length===0){L(u);return}const i=()=>{var G;const b=((G=f.current)==null?void 0:G.clientWidth)||0;if(b===0)return;let H=0,s=0;const t=[],R=[];u.forEach(q=>{const O=Number(q.flex);q.width?H+=parseInt(q.width,10)||0:q.flex&&O>0?(s+=O,t.push(q)):R.push(q)});const V=b-H,I="80";let y=[...u];if(V>0){if(t.length>0){const q=V/s;y=u.map(O=>{const _=Number(O.flex);if(_&&_>0){const J=parseInt(O.minWidth||I,10),Q=_*q,z=Math.max(Q,J);return{...O,width:`${Math.floor(z)}px`}}return!O.width&&!_?{...O,width:O.minWidth||`${I}px`}:O})}else if(R.length>0){const q=V/R.length;y=u.map(O=>{const _=Number(O.flex);if(!O.width&&!_){const J=parseInt(O.minWidth||I,10),Q=Math.max(q,J);return{...O,width:`${Math.floor(Q)}px`}}return O})}}else y=u.map(q=>q.width?q:{...q,width:q.minWidth||`${I}px`});L(y)};i();const E=new ResizeObserver(i);return E.observe(f.current),()=>E.disconnect()},[u]),W.useEffect(()=>{const i=E=>{M.current&&!M.current.contains(E.target)&&C(null)};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const $=W.useMemo(()=>o?o.some(i=>i.mergeHeaderId&&i.mergeHeaderLabel):!1,[o]),d=W.useMemo(()=>{var H,s;if(A||!o||o.length===0)return null;if(!$)return e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:c,numRows:1,borderRadius:g,children:o.map(t=>{var R;return e.jsxRuntimeExports.jsx(e.HeaderCell,{width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:c,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,children:((R=t.columnRender)==null?void 0:R.call(t,h))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)})});const i=[],E=[];let b=0;for(;b<o.length;){const t=o[b];if(t.mergeHeaderId&&t.mergeHeaderLabel){let R=0;const V=t.mergeHeaderId;for(let I=b;I<o.length&&o[I].mergeHeaderId===V;I++)R++;i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{colSpan:R,horizontalAlign:"center",size:c,columnsTextSize:S,withBorder:j,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,headerAlign:t.headerAlign,isTopRow:!0,children:e.jsxRuntimeExports.jsx("span",{title:t.mergeHeaderLabel,children:t.mergeHeaderLabel})},`${t.mergeHeaderId}-merged`));for(let I=0;I<R;I++){const y=o[b+I];E.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{width:y.width,minWidth:y.minWidth,maxWidth:y.maxWidth,horizontalAlign:y.horizontalAlign,size:c,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,children:((H=y.columnRender)==null?void 0:H.call(y,h))||e.jsxRuntimeExports.jsx("span",{title:y.label,children:y.label})},y.dataIndex+"-individual"))}b+=R}else i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{rowSpan:2,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:c,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isTopRow:!0,children:((s=t.columnRender)==null?void 0:s.call(t,h))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)),b++}return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:c,numRows:2,borderRadius:g,children:i}),E.length>0&&e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:c,numRows:2,borderRadius:g,children:E})]})},[o,A,c,S,$]);return!h||h.length===0?e.jsxRuntimeExports.jsx(e.Empty,{backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow,borders:!0,mode:"table",...D}):e.jsxRuntimeExports.jsx(e.ContainerTable,{maxHeight:l,disableMaxHeight:x,withBorderRadius:w,ref:f,borderRadius:g,isVisible:m,children:e.jsxRuntimeExports.jsxs(e.Table,{id:r,ref:M,children:[e.jsxRuntimeExports.jsx("thead",{children:d}),e.jsxRuntimeExports.jsx("tbody",{style:{width:"100%"},children:h==null?void 0:h.map((i,E,b)=>{const H=F(i);return e.jsxRuntimeExports.jsx(e.TableRow,{isLast:E===b.length-1,fit:a,size:c,withBorder:j,isSelected:H===N&&k,striped:T&&E%2!==0,borderRadius:g,children:o.map(s=>{var t,R,V,I,y;return e.jsxRuntimeExports.jsx(e.RowCell,{width:s.width,minWidth:s.minWidth,maxWidth:s.maxWidth,size:c,isClickable:U.valuable(p),onClick:()=>{p&&p(i,s,E),k&&C(N===H?null:H)},horizontalAlign:s.horizontalAlign,verticalAlign:s.verticalAlign,rowPadding:s.rowPadding,withBorder:j,isLast:E===b.length-1,disabled:(t=s.disable)==null?void 0:t.call(s,i[s.dataIndex],i,E,b),hasError:(R=s.warn)==null?void 0:R.call(s,i[s.dataIndex],i,E,b),backgroundColor:(V=s.paint)==null?void 0:V.call(s,i[s.dataIndex],i,E,b),children:((I=s.render)==null?void 0:I.call(s,i[s.dataIndex],i,E,b))||e.jsxRuntimeExports.jsx(e.CellText,{title:i[s.dataIndex],style:(y=s.rowCss)==null?void 0:y.call(s,i),children:i[s.dataIndex]})||""},`${H}::${s.dataIndex}`)})},H)})})]})})}exports.CheckboxField=v;exports.CollapseSection=K;exports.DateField=B;exports.FormFieldView=ee;exports.MultiSelectField=te;exports.SelectButton=re;exports.SelectField=se;exports.TabInfo=ne;exports.Table=de;
|