@ufal-lccv/gpsub-ds 0.0.6-alpha-1 → 0.0.6-alpha-2
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/{Table.view-JyPK82wk.cjs → Table.view-CnPzI0s1.cjs} +7 -7
- package/dist/{Table.view-BDXr7LNF.js → Table.view-DNLacIcf.js} +3 -1
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.es.js +1 -1
- package/dist/components/organisms/index.cjs.js +1 -1
- package/dist/components/organisms/index.es.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("./Checkbox.view-CDJhnIP4.cjs"),g=require("react"),e=require("sbwb-ds"),F=require("./index-BcwQwoIM.cjs"),Q=require("react-hook-form");function Y(t,n,i){var r,d,a,l,h;n==null&&(n=100);function f(){var
|
|
1
|
+
"use strict";const o=require("./Checkbox.view-CDJhnIP4.cjs"),g=require("react"),e=require("sbwb-ds"),F=require("./index-BcwQwoIM.cjs"),Q=require("react-hook-form");function Y(t,n,i){var r,d,a,l,h;n==null&&(n=100);function f(){var m=Date.now()-l;m<n&&m>=0?r=setTimeout(f,n-m):(r=null,i||(h=t.apply(a,d),a=d=null))}var x=function(){a=this,d=arguments,l=Date.now();var m=i&&!r;return r||(r=setTimeout(f,n)),m&&(h=t.apply(a,d),a=d=null),h};return x.clear=function(){r&&(clearTimeout(r),r=null)},x.flush=function(){r&&(h=t.apply(a,d),a=d=null,clearTimeout(r),r=null)},x}Y.debounce=Y;var le=Y;const ae=o.getDefaultExportFromCjs(le);function Z({form:t,fieldName:n,triggerType:i=null,debounceTime:r=500}){const d=g.useCallback(()=>{t.trigger(n)},[t,n]),a=g.useMemo(()=>ae(()=>d(),r),[d,r]),l=g.useMemo(()=>["all","onChange"].includes(i)?a:null,[a,i]),h=g.useMemo(()=>["all","onBlur"].includes(i)?d:null,[i]);return g.useMemo(()=>({onChangeTrigger:l,onBlurTrigger:h}),[l,h])}const ce=({form:t,name:n,label:i,options:r,readonly:d=!1,disabled:a=!1,optionsMap:l,width:h="100%",flex:f,placeholder:x,onSelect:m,parser:u,filter:y,tooltipProps:v={},infoProps:B={},maxHeigthMenu:z,isRequired:C=!1,onRemoveSelected:H,triggerFormField:p=null,displayText:W,...N})=>{const{onChangeTrigger:w}=Z({form:t,fieldName:n,triggerType:p,debounceTime:0}),O={position:"top",...v},L={...B,tooltipProps:{position:"top",maxWidth:"300px",...B==null?void 0:B.tooltipProps}},T=(b,I)=>{let M=b;u&&(M=u==null?void 0:u(b)),I(M),m==null||m(M),w==null||w()},S=g.useMemo(()=>F.valuable(l)?l:Object.fromEntries(r.map(b=>[b.value,b])),[r,l]);return o.jsxRuntimeExports.jsx(o.Container,{width:h,flex:f,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:t.control,render:({field:{onChange:b,value:I},fieldState:{error:M=null}})=>{let j=S[I];return o.jsxRuntimeExports.jsx(K,{label:i,width:"100%",size:"Small",disabled:a,readonly:d,filter:y,errorMessage:M==null?void 0:M.message,placeholder:x,value:j,handleOption:c=>{T(c.value,b)},tooltipProps:O,options:r,maxHeigthMenu:z,infoProps:L,maxHeightMenu:z,isRequired:C,onRemoveSelected:H,displayText:W,...N})}})})},te=({form:t,name:n,label:i,readonly:r=!1,disabled:d=!1,width:a="100%",height:l="100%",flex:h,placeholder:f,charactersCounter:x=!0,maxlength:m=1e3,resize:u=!0,triggerFormField:y=null,minHeight:v,maxHeight:B,...z})=>{const{onChangeTrigger:C}=Z({form:t,fieldName:n,triggerType:y}),H=(p,W)=>{W(p),C==null||C()};return o.jsxRuntimeExports.jsx(o.Container,{width:a,flex:h,height:l,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:t.control,render:({field:{onChange:p,value:W},fieldState:{error:N=null}})=>o.jsxRuntimeExports.jsx(o.Textarea,{label:i,value:W||"",width:"100%",disabled:d,readonly:r,height:l,minHeight:v,maxHeight:B,errorMessage:N==null?void 0:N.message,placeholder:f,onChange:w=>H(w.target.value,p),charactersCounter:x,maxlength:m,size:"Small",resize:u,...z})})})};te.displayName="TextareaField";const de=({form:t,name:n,id:i=n,label:r,readonly:d=!1,disabled:a=!1,afterCheck:l,width:h="100%",formatter:f,parser:x,flex:m,size:u="Medium",triggerFormField:y=null,...v})=>{const{onChangeTrigger:B}=Z({form:t,fieldName:n,triggerType:y,debounceTime:0}),z=(C,H)=>{H(C),l==null||l(C),B==null||B()};return o.jsxRuntimeExports.jsx(o.Container,{width:h,flex:m,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:t.control,render:({field:{onChange:C,value:H},fieldState:{error:p=null}})=>{const W=p==null?void 0:p.message;return W&&console.log("Error on checkbox!",W),o.jsxRuntimeExports.jsx(o.Checkbox,{id:`form-checkbox-${i}`,checked:(f==null?void 0:f(H))??H,name:n,label:r,disabled:a||d,onChange:N=>{z((x==null?void 0:x(N.target.checked,H))??N.target.checked,C)},size:u,...v})}})})},ge=o.qe.ul`
|
|
2
2
|
${F.resetStyles}
|
|
3
3
|
position: fixed;
|
|
4
4
|
margin-top: ${({marginTop:t})=>t};
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
margin: ${({size:t})=>t==="Small"?`${e.sg.spacings.spacingStack.spacingStackSm} ${e.sg.spacings.spacingInline.spacingInlineXs}
|
|
80
80
|
${e.sg.spacings.spacingStack.spacingStackNano}`:`${e.sg.spacings.spacingStack.spacingStackSm} ${e.sg.spacings.spacingInline.spacingInlineXs}
|
|
81
81
|
${e.sg.spacings.spacingStack.spacingStackXs}`};
|
|
82
|
-
`,
|
|
82
|
+
`,xe=o.qe.span`
|
|
83
83
|
${F.resetStyles}
|
|
84
84
|
font-family: ${e.sg.fonts.fontFamily.fontFamilyPrimary};
|
|
85
85
|
font-size: ${({size:t})=>t==="Small"?e.sg.fonts.fontSize.fontSizeBodyMd:e.sg.fonts.fontSize.fontSizeBodyLg};
|
|
86
86
|
font-weight: ${e.sg.fonts.fontWeight.fontWeightSemiBold};
|
|
87
87
|
line-height: ${({size:t})=>t==="Small"?e.sg.fonts.lineHeight.lineHeightSm(e.sg.fonts.fontSize.fontSizeBodyMd):e.sg.fonts.lineHeight.lineHeightMd(e.sg.fonts.fontSize.fontSizeBodyLg)};
|
|
88
|
-
`,
|
|
88
|
+
`,me=o.qe.div`
|
|
89
89
|
${F.resetStyles}
|
|
90
90
|
display: flex;
|
|
91
91
|
font-family: ${e.sg.fonts.fontFamily.fontFamilyPrimary};
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
margin: 0;
|
|
119
119
|
display: flex;
|
|
120
120
|
align-self: center;
|
|
121
|
-
`,be=(t,n,i=0,r=0,d="left")=>{const[a,l]=g.useState(0),[h,f]=g.useState(),
|
|
121
|
+
`,be=(t,n,i=0,r=0,d="left")=>{const[a,l]=g.useState(0),[h,f]=g.useState(),x=g.useRef(null),m=g.useCallback(()=>{if(!t.current||!x.current)return;const u=t.current.getBoundingClientRect(),y=x.current.getBoundingClientRect(),v=window.innerHeight,B=window.innerWidth,z=u.top,C=v-u.bottom,H=C<y.height+r&&z>C;let p;H?(p=u.top-y.height-i,x.current.style.maxHeight=`${z-i}px`):(p=u.bottom+r,x.current.style.maxHeight=`${C-r}px`);let W=u.left;const N=W+y.width-B;N>0&&(W-=N),W<0&&(W=0);const w=B-u.right;Object.assign(x.current.style,{position:"fixed",top:`${p}px`,...d==="left"?{left:`${W}px`}:{right:`${w}px`},width:`${Math.max(u.width,y.width)}px`,overflowY:"auto"})},[i,r,d]);return g.useEffect(()=>{var y;l(0),f((y=t.current)==null?void 0:y.clientWidth),m();const u=()=>m();return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[t,m]),{highlightedIndex:a,setHighlightedIndex:l,isOptionSelected:u=>u.label===(n==null?void 0:n.label),optionsRef:x,parentWidth:h}},J=g.forwardRef(({selectContainerRef:t,optionsSelect:n,size:i,selectOption:r,value:d,inputValue:a,widthMenu:l,maxHeightMenu:h="180px",menuIsOpen:f,onEnter:x,marginTop:m="4px",iconName:u,iconColor:y,iconPosition:v,topOffset:B=0,bottomOffset:z=0,truncateText:C=!0,menuJustifyContent:H="flex-start",tableActionButton:p,menuLateralPadding:W="8px",menuOptionFlexDirection:N="column",confirmSelection:w,menuAlign:O="left"},L)=>{F.valuable(u)&&(u+="Ant");const{highlightedIndex:T,setHighlightedIndex:S,isOptionSelected:b,optionsRef:I,parentWidth:M}=be(t,d,B,z,O);g.useEffect(()=>{const s=$=>{if(f){if($.key==="ArrowDown")$.preventDefault(),S(R=>R<n.length-1?R+1:R);else if($.key==="ArrowUp")$.preventDefault(),S(R=>R>0?R-1:0);else if($.key==="Enter"&&n[T]){$.preventDefault();const R=n[T];r(R),x&&x(R)}}};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[f,n,T,x,r,w]);const j=s=>typeof s=="string"?s:g.isValidElement(s)&&typeof s.props.children=="string"?s.props.children:String(s),c=(s,$)=>{var A,E;if(v!==$)return null;const R=F.valuable((A=s.tooltipProps)==null?void 0:A.label),k=s.iconName||u||"InfoFill0Sm",q=o.jsxRuntimeExports.jsx(Se,{iconPosition:(E=s.tooltipProps)==null?void 0:E.position,id:`iconContainer-${s.value}`,children:o.jsxRuntimeExports.jsx(e.Icon,{iconName:k,color:s.disabled?e.sg.colors.neutralColors.colorNeutralCleanest:b(s)?e.sg.colors.brandColors.colorBrandSoft:y??e.sg.colors.neutralColors.colorNeutralDark})});return R?o.jsxRuntimeExports.jsx(o.Tooltip,{...s==null?void 0:s.tooltipProps,isActive:!0,children:q}):q};return o.jsxRuntimeExports.jsx(ge,{marginTop:m,width:l??`${M}px`,maxHeight:h,height:"fit-content",ref:s=>{I.current=s,typeof L=="function"?L(s):L&&(L.current=s)},"data-testid":"MenuSelect",id:"MenuSelect",children:n.length===0?o.jsxRuntimeExports.jsx(ue,{size:i,children:"Sem opções"}):n.map((s,$)=>{var q,A;const R=typeof s.render=="function"?s.render():null,k=j(s.label);if(s.isSection)return o.jsxRuntimeExports.jsx(he,{size:i,children:k},k);{const E=k.toLowerCase().indexOf((a==null?void 0:a.toLowerCase())||"");return o.jsxRuntimeExports.jsxs(pe,{isOptionSelected:b(s),highlightedIndex:$===T,onClick:D=>{D.stopPropagation(),s.disabled||(w?o.showConfirm({id:"select-option",title:w.title,description:w.description,icon:w.icon,iconColor:w.iconColor,leftButtonProps:{name:"Cancelar",variant:"tertiary",onClick:()=>{}},rightButtonProps:{name:"Confirmar",variant:"secondary",onClick:()=>r(s)}}):r(s))},onMouseEnter:()=>S($),disabled:s.disabled,size:i,menuLateralPadding:W,children:[c(s,"left"),o.jsxRuntimeExports.jsxs(fe,{menuOptionFlexDirection:N,menuJustifyContent:H,iconName:u,isOptionSelected:b(s),highlightedIndex:$===T,"data-testid":s.value,size:i,hasDescription:!!s.description,optionValue:s.value,disabled:s.disabled,truncateText:C,tableActionButton:p,children:[o.jsxRuntimeExports.jsxs(me,{truncateText:!g.isValidElement(s.label)&&C,children:[R,g.isValidElement(s.label)?o.jsxRuntimeExports.jsx("p",{title:((q=s==null?void 0:s.tooltipProps)==null?void 0:q.label)??j(s.label),children:s.label}):o.jsxRuntimeExports.jsx("p",{title:((A=s==null?void 0:s.tooltipProps)==null?void 0:A.label)??k,children:a&&E>=0?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[k.substring(0,E),o.jsxRuntimeExports.jsx(xe,{size:i,children:k.substring(E,E+((a==null?void 0:a.length)||0))}),k.substring(E+((a==null?void 0:a.length)||0))]}):k})]}),s.description&&o.jsxRuntimeExports.jsx("p",{title:s.description,children:s.description})]}),c(s,"right")]},String(s.value))}})})});J.displayName="MenuSelect";const oe=({title:t,iconName:n,onClickIcon:i,width:r,height:d,flex:a,children:l,wrapperCustomStyles:h={},contentCustomStyles:f={},titleCustomStyles:x={}})=>o.jsxRuntimeExports.jsxs(o.Container,{width:r,height:d,flex:a,direction:"vertical",padding:e.sg.spacings.spacingStack.spacingStackSm,customStyles:{backgroundColor:e.sg.colors.backgroundColors.colorBackgroundSnow,border:`1px solid ${e.sg.colors.neutralColors.colorNeutralSoft}`,borderRadius:"8px",...h},children:[o.jsxRuntimeExports.jsxs(o.Container,{width:"100%",direction:"horizontal",customStyles:f,children:[t?o.jsxRuntimeExports.jsx(o.Container,{width:"fit-content",customStyles:x,children:o.jsxRuntimeExports.jsx(o.SectionTitle,{title:t,divider:!1})}):null,n?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(o.Spacer,{size:"auto",direction:"horizontal"}),o.jsxRuntimeExports.jsx(e.Icon,{iconName:n,onClick:()=>i==null?void 0:i(),color:F.valuable(i)?e.sg.colors.neutralColors.colorNeutralDark:e.sg.colors.neutralColors.colorNeutralCloudy,cursorPointer:F.valuable(i)})]}):null]}),o.jsxRuntimeExports.jsx(o.Container,{width:"100%",flex:"1",children:l})]});oe.displayName="Section";const $e=o.qe.div`
|
|
122
122
|
${F.resetStyles}
|
|
123
123
|
display: flex;
|
|
124
124
|
flex-direction: column;
|
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
color: ${e.sg.colors.neutralColors.colorNeutralDark};
|
|
259
259
|
margin-top: ${e.sg.spacings.spacingInline.spacingInlineNano};
|
|
260
260
|
width: 100%;
|
|
261
|
-
`,Be=(t,{value:n,options:i})=>{const[r,d]=g.useState(!1),[a,l]=g.useState(!1),[h,f]=g.useState(""),[m
|
|
261
|
+
`,Be=(t,{value:n,options:i})=>{const[r,d]=g.useState(!1),[a,l]=g.useState(!1),[h,f]=g.useState(""),[x,m]=g.useState(i),u=g.useRef(null),y=g.useRef(null),v=g.useRef(null),B=g.useRef(null);g.useEffect(()=>{const p=()=>{l(!1)};return window.addEventListener("scroll",p,{passive:!0}),window.addEventListener("resize",p,{passive:!0}),()=>{window.removeEventListener("scroll",p),window.removeEventListener("resize",p)}},[]);function z(p){f(""),l(!1),d(!0),v!=null&&v.current&&v.current.focus(),p!==n&&t(p)}const C=p=>{if(p){const W=new RegExp(p,"i"),N=i.filter(w=>W.exec(w.label));m(N)}else m(i)};function H(p){return!p}return{isOpen:r,setIsOpen:d,expanded:a,setExpanded:l,inputValue:h,setInputValue:f,optionsSelect:x,setOptionSelect:m,selectContainerRef:u,containerRef:y,inputContainerRef:v,optionsRef:B,selectOption:z,handlerFilterOptions:C,isValue:H}},K=g.forwardRef(({value:t,handleOption:n,options:i,filter:r=!0,placeholder:d,label:a,size:l="Medium",width:h="100%",disabled:f,helpText:x,readonly:m,errorMessage:u,tooltipProps:y={},onBlur:v,onEnter:B,variant:z="default",infoProps:C={},maxHeightMenu:H,isRequired:p=!1,onRemoveSelected:W,displayText:N,displayTextProps:w={}},O)=>{const{isOpen:L,setIsOpen:T,expanded:S,setExpanded:b,inputValue:I,setInputValue:M,optionsSelect:j,selectContainerRef:c,containerRef:s,inputContainerRef:$,selectOption:R,setOptionSelect:k,handlerFilterOptions:q,isValue:A}=Be(n,{value:t,options:i}),E=!!u,D={label:u,...y,wrapperWidth:"auto",isActive:E,isErrorTooltip:!0},P={...C,size:l},_=o.jsxRuntimeExports.jsx(e.Icon,{iconName:`Close${l==="Small"?"Sm":"Ant"}`,onClick:X=>{X.stopPropagation(),W(t)}}),V=o.jsxRuntimeExports.jsx(e.Icon,{iconName:`ExpandLess${l==="Small"?"Sm":"Ant"}`}),ie=o.jsxRuntimeExports.jsx(e.Icon,{iconName:`ExpandMore${l==="Small"?"Sm":"Ant"}`});return o.jsxRuntimeExports.jsxs($e,{ref:c,width:h,size:l,disabled:f,readonly:m,children:[a&&o.jsxRuntimeExports.jsxs(Re,{children:[o.jsxRuntimeExports.jsxs(ke,{"data-testid":"label",ref:O,children:[a,p&&!f?o.jsxRuntimeExports.jsx(Ee,{children:" *"}):null]}),((P==null?void 0:P.message)||(P==null?void 0:P.render))&&o.jsxRuntimeExports.jsx(o.Info,{...P})]}),o.jsxRuntimeExports.jsx(o.Tooltip,{...D,children:o.jsxRuntimeExports.jsxs(we,{hasError:E,readonly:m,ref:s,onBlur:()=>{setTimeout(()=>{(L||S)&&$.current!==document.activeElement&&(v&&v(t),T(!1),b(!1))},250)},onClick:()=>{!f&&!m&&(L&&!S?(b(!0),$!=null&&$.current&&$.current.focus()):!L&&!S?(T(!0),b(!0),$!=null&&$.current&&$.current.focus()):(T(!1),b(!1),$!=null&&$.current&&$.current.blur()),!I&&k(i))},tabIndex:0,width:h,size:l,isOpen:L||S,"data-testid":"select",disabled:f,helpText:x,variant:z,children:[o.jsxRuntimeExports.jsxs(ye,{children:[F.valuable(N)?o.jsxRuntimeExports.jsx(ee,{size:l,variant:z,isDisplayText:!0,children:o.jsxRuntimeExports.jsx("p",{title:t==null?void 0:t.label,...w,children:N})}):o.jsxRuntimeExports.jsxs(ee,{size:l,variant:z,children:[d&&A(t)&&!I&&!L?o.jsxRuntimeExports.jsx(je,{size:l,variant:z,children:d}):null,(t==null?void 0:t.label)&&o.jsxRuntimeExports.jsx("p",{title:(t==null?void 0:t.hint)??(t==null?void 0:t.label),children:t==null?void 0:t.label})]}),r&&!F.valuable(N)&&o.jsxRuntimeExports.jsx(Ce,{ref:$,value:I,onChange:X=>{M(X.target.value),X.target.value.length>0&&(T(!0),b(!0)),q(X.target.value)},readOnly:m,width:I.length,size:l,disabled:f,variant:z})]}),W&&t?_:null,S?V:ie,S&&o.jsxRuntimeExports.jsx(J,{onEnter:X=>{n&&n(X),T(!1),b(!1),B&&B(X)},menuIsOpen:L,selectContainerRef:c,value:t,optionsSelect:j,selectOption:R,size:l,inputValue:I,maxHeightMenu:H})]})}),x&&o.jsxRuntimeExports.jsx(ze,{size:l,children:x})]})});K.displayName="Select";const ne=o.We`
|
|
262
262
|
from {
|
|
263
263
|
transform: rotate(0deg);
|
|
264
264
|
}
|
|
@@ -380,7 +380,7 @@
|
|
|
380
380
|
&:hover {
|
|
381
381
|
cursor: not-allowed;
|
|
382
382
|
}
|
|
383
|
-
`,Me=t=>{const[n,i]=g.useState(!1),[r,d]=g.useState(t),a=g.useRef(null);return g.useEffect(()=>{d(t)},[t]),{setIsOpen:i,isOpen:n,setOptionsSelect:d,optionsSelect:r,selectContainerRef:a}},Ae=200,He=({name:t,variant:n="primary",width:i="100%",size:r="Medium",disabled:d=!1,isLoading:a=!1,onClick:l,options:h,label:f,menuSelectProps:
|
|
383
|
+
`,Me=t=>{const[n,i]=g.useState(!1),[r,d]=g.useState(t),a=g.useRef(null);return g.useEffect(()=>{d(t)},[t]),{setIsOpen:i,isOpen:n,setOptionsSelect:d,optionsSelect:r,selectContainerRef:a}},Ae=200,He=({name:t,variant:n="primary",width:i="100%",size:r="Medium",disabled:d=!1,isLoading:a=!1,onClick:l,options:h,label:f,menuSelectProps:x={},iconName:m,optionsIconPosition:u})=>{const{isOpen:y,setIsOpen:v,selectContainerRef:B,optionsSelect:z}=Me(h);let C=e.sg.colors.backgroundColors.colorBackgroundSnow;d?C=e.sg.colors.neutralColors.colorNeutralCloudy:n!=="primary"&&(C=e.sg.colors.neutralColors.colorNeutralDark);const H={...x};return o.jsxRuntimeExports.jsxs(Ie,{ref:B,width:i,size:r,disabled:d,onBlur:()=>setTimeout(()=>v(!1),Ae),children:[f&&o.jsxRuntimeExports.jsx(Ne,{children:f}),o.jsxRuntimeExports.jsxs(We,{type:"button",size:r,disabled:d,variant:n,isLoading:a,onClick:()=>!a&&v(!y),id:`button-component-${t}`,children:[a&&o.jsxRuntimeExports.jsx(ve,{size:r,disabled:d,variant:n,children:o.jsxRuntimeExports.jsx(e.Icon,{iconName:`ProgressActivity${r==="Small"?"Ant":"Sm"}`,color:C,"data-testid":"icon-loading"})}),!a&&o.jsxRuntimeExports.jsx("p",{title:t,children:t}),!a&&(y?o.jsxRuntimeExports.jsx(e.Icon,{iconName:`ExpandLess${r==="Small"?"Ant":"Sm"}`,color:C,"data-testid":"icon-button-less"}):o.jsxRuntimeExports.jsx(e.Icon,{iconName:`ExpandMore${r==="Small"?"Ant":"Sm"}`,color:C,"data-testid":"icon-button-more"}))]}),y&&o.jsxRuntimeExports.jsx(J,{selectContainerRef:B,value:null,optionsSelect:z,selectOption:l,size:r,inputValue:null,iconPosition:u,iconName:m,...H})]})},Fe=({title:t,children:n,endAdornment:i=null,marginBottom:r="16px",customStyles:d={},wrapperCustomStyles:a={},hideAdornmentOnCollapse:l=!1})=>{const[h,f]=g.useState(!1),x=l&&h?null:i;return o.jsxRuntimeExports.jsxs(o.Container,{width:"100%",flex:"1",gap:"8px",customStyles:a,children:[o.jsxRuntimeExports.jsx(o.SectionTitle,{title:t,divider:!0,marginBottom:r,collapse:{collapsed:h,setCollapsed:f},endAdornment:x,customStyles:d}),o.jsxRuntimeExports.jsx(o.Container,{gap:"8px",width:"100%",customStyles:{maxHeight:h?"0":"2000px",transition:"max-height 0.35s ease-in-out"},children:n})]})},se=o.Ae`
|
|
384
384
|
svg:not([color]):not([data-testid='icon']) {
|
|
385
385
|
path {
|
|
386
386
|
fill: ${e.sg.colors.neutralColors.colorNeutralDarkest};
|
|
@@ -538,4 +538,4 @@
|
|
|
538
538
|
&:hover {
|
|
539
539
|
cursor: ${t=>t.isClickable?"pointer":"default"};
|
|
540
540
|
}
|
|
541
|
-
`;function Oe(t){return n=>typeof t=="string"?n[t]:typeof t=="function"?t(n):(console.warn("Please, setup a rowKey for table."),JSON.stringify(n))}function Xe({id:t,rowKey:n="id",size:i="Small",onRowClick:r,fit:d=!1,maxHeight:a="40rem",columns:l,dataSource:h,columnsTextSize:f=i,emptyProps:
|
|
541
|
+
`;function Oe(t){return n=>typeof t=="string"?n[t]:typeof t=="function"?t(n):(console.warn("Please, setup a rowKey for table."),JSON.stringify(n))}function Xe({id:t,rowKey:n="id",size:i="Small",onRowClick:r,fit:d=!1,maxHeight:a="40rem",columns:l,dataSource:h,columnsTextSize:f=i,emptyProps:x={width:"100%",height:"100%",title:"Nenhum dado a ser mostrado.",mode:"table",borders:!0,backgroundColor:e.sg.colors.backgroundColors.colorBackgroundSnow},selectedRow:m=!1,hideHeader:u=!1,withBorder:y=!0,withBorderRadius:v=!0,striped:B=!1,borderRadius:z=e.sg.borders.borderRadius.borderRadiusSm}){const C=g.useMemo(()=>Oe(n),[n]),[H,p]=g.useState(null),W=g.useRef(null),N=g.useRef(null),[w,O]=g.useState(l);g.useLayoutEffect(()=>{if(!N.current||l.length===0){O(l);return}const S=()=>{var q;const I=((q=N.current)==null?void 0:q.clientWidth)||0;if(I===0)return;let M=0,j=0;const c=[],s=[];l.forEach(A=>{const E=Number(A.flex);A.width?M+=parseInt(A.width,10)||0:A.flex&&E>0?(j+=E,c.push(A)):s.push(A)});const $=I-M,R="80";let k=[...l];if($>0){if(c.length>0){const A=$/j;k=l.map(E=>{const D=Number(E.flex);if(D&&D>0){const P=parseInt(E.minWidth||R,10),_=D*A,V=Math.max(_,P);return{...E,width:`${Math.floor(V)}px`}}return!E.width&&!D?{...E,width:E.minWidth||`${R}px`}:E})}else if(s.length>0){const A=$/s.length;k=l.map(E=>{const D=Number(E.flex);if(!E.width&&!D){const P=parseInt(E.minWidth||R,10),_=Math.max(A,P);return{...E,width:`${Math.floor(_)}px`}}return E})}}else k=l.map(A=>A.width?A:{...A,width:A.minWidth||`${R}px`});O(k)};S();const b=new ResizeObserver(S);return b.observe(N.current),()=>b.disconnect()},[l]),g.useEffect(()=>{const S=b=>{W.current&&!W.current.contains(b.target)&&p(null)};return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[]);const L=g.useMemo(()=>w?w.some(S=>S.mergeHeaderId&&S.mergeHeaderLabel):!1,[w]),T=g.useMemo(()=>{var M,j;if(u||!w||w.length===0)return null;if(!L)return o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:1,borderRadius:z,children:w.map(c=>{var s;return o.jsxRuntimeExports.jsx(G,{width:c.width,minWidth:c.minWidth,maxWidth:c.maxWidth,horizontalAlign:c.horizontalAlign,size:i,columnsTextSize:f,withBorder:y,headerAlign:c.headerAlign,children:((s=c.columnRender)==null?void 0:s.call(c))||o.jsxRuntimeExports.jsx("span",{title:c.label,children:c.label})},c.dataIndex)})});const S=[],b=[];let I=0;for(;I<w.length;){const c=w[I];if(c.mergeHeaderId&&c.mergeHeaderLabel){let s=0;const $=c.mergeHeaderId;for(let R=I;R<w.length&&w[R].mergeHeaderId===$;R++)s++;S.push(o.jsxRuntimeExports.jsx(G,{colSpan:s,horizontalAlign:"center",size:i,columnsTextSize:f,withBorder:y,width:c.width,minWidth:c.minWidth,maxWidth:c.maxWidth,headerAlign:c.headerAlign,isTopRow:!0,children:o.jsxRuntimeExports.jsx("span",{title:c.mergeHeaderLabel,children:c.mergeHeaderLabel})},`${c.mergeHeaderId}-merged`));for(let R=0;R<s;R++){const k=w[I+R];b.push(o.jsxRuntimeExports.jsx(G,{width:k.width,minWidth:k.minWidth,maxWidth:k.maxWidth,horizontalAlign:k.horizontalAlign,size:i,columnsTextSize:f,withBorder:y,headerAlign:c.headerAlign,children:((M=k.columnRender)==null?void 0:M.call(k))||o.jsxRuntimeExports.jsx("span",{title:k.label,children:k.label})},k.dataIndex+"-individual"))}I+=s}else S.push(o.jsxRuntimeExports.jsx(G,{rowSpan:2,width:c.width,minWidth:c.minWidth,maxWidth:c.maxWidth,horizontalAlign:c.horizontalAlign,size:i,columnsTextSize:f,withBorder:y,headerAlign:c.headerAlign,isTopRow:!0,children:((j=c.columnRender)==null?void 0:j.call(c))||o.jsxRuntimeExports.jsx("span",{title:c.label,children:c.label})},c.dataIndex)),I++}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:2,borderRadius:z,children:S}),b.length>0&&o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:2,borderRadius:z,children:b})]})},[w,u,i,f,L]);return!h||h.length===0?o.jsxRuntimeExports.jsx(o.Empty,{backgroundColor:e.sg.colors.backgroundColors.colorBackgroundSnow,borders:!0,mode:"table",...x}):o.jsxRuntimeExports.jsx(Le,{maxHeight:a,withBorderRadius:v,ref:N,borderRadius:z,children:o.jsxRuntimeExports.jsxs(Te,{id:t,ref:W,children:[o.jsxRuntimeExports.jsx("thead",{children:T}),o.jsxRuntimeExports.jsx("tbody",{style:{width:"100%"},children:h==null?void 0:h.map((S,b,I)=>{const M=C(S);return o.jsxRuntimeExports.jsx(U,{isLast:b===I.length-1,fit:d,size:i,withBorder:y,isSelected:M===H&&m,striped:B&&b%2!==0,borderRadius:z,children:w.map(j=>{var c,s;return o.jsxRuntimeExports.jsx(De,{width:j.width,minWidth:j.minWidth,maxWidth:j.maxWidth,size:i,isClickable:F.valuable(r),onClick:()=>{r&&r(S,j,b),m&&p(H===M?null:M)},horizontalAlign:j.horizontalAlign,verticalAlign:j.verticalAlign,rowPadding:j.rowPadding,withBorder:y,isLast:b===I.length-1,children:((c=j.render)==null?void 0:c.call(j,S[j.dataIndex],S,b,I))||o.jsxRuntimeExports.jsx("span",{title:S[j.dataIndex],style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",...(s=j.rowCss)==null?void 0:s.call(j,S)},children:S[j.dataIndex]})||""},`${M}::${j.dataIndex}`)})},M)})})]})})}exports.CheckboxField=de;exports.CollapseSection=Fe;exports.MenuSelect=J;exports.Section=oe;exports.Select=K;exports.SelectButton=He;exports.SelectField=ce;exports.Table=Xe;exports.TextareaField=te;
|
|
@@ -1265,7 +1265,9 @@ const oo = k.div`
|
|
|
1265
1265
|
gap: "8px",
|
|
1266
1266
|
width: "100%",
|
|
1267
1267
|
customStyles: {
|
|
1268
|
-
|
|
1268
|
+
// assuming max content height won't exceed 2000px (a large value)
|
|
1269
|
+
// If a maxHeight is not set, the transition won't work
|
|
1270
|
+
maxHeight: h ? "0" : "2000px",
|
|
1269
1271
|
transition: "max-height 0.35s ease-in-out"
|
|
1270
1272
|
},
|
|
1271
1273
|
children: t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.view-CDJhnIP4.cjs"),t=require("../Title.view-CX_Y7KM1.cjs"),i=require("../RequiredLabel.view-CV4twgie.cjs"),o=require("../Table.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.view-CDJhnIP4.cjs"),t=require("../Title.view-CX_Y7KM1.cjs"),i=require("../RequiredLabel.view-CV4twgie.cjs"),o=require("../Table.view-CnPzI0s1.cjs");exports.ActionButton=e.ActionButton;exports.Badge=e.Badge;exports.Button=e.Button;exports.Checkbox=e.Checkbox;exports.Confirm=e.ConfirmModal;exports.ConfirmButton=e.ConfirmButton;exports.ConfirmModal=e.ConfirmModal;exports.Container=e.Container;exports.Empty=e.Empty;exports.Frame=e.FrameView;exports.FrameView=e.FrameView;exports.Info=e.Info;exports.Input=e.Input;exports.Label=e.Label;exports.Loading=e.Loading;exports.LoadingBar=e.LoadingBar;exports.Modal=e.Modal;exports.Radio=e.Radio;exports.SectionTitle=e.SectionTitle;exports.Spacer=e.Spacer;exports.Textarea=e.Textarea;exports.Tooltip=e.Tooltip;exports.showConfirm=e.showConfirm;exports.showModal=e.showModal;exports.ErrorMessage=t.ErrorMessage;exports.Switch=t.Switch;exports.Title=t.Title;exports.AlertInline=i.AlertInline;exports.LabelField=i.LabelField;exports.RequiredLabelView=i.RequiredLabelView;exports.CheckboxField=o.CheckboxField;exports.CollapseSection=o.CollapseSection;exports.MenuSelect=o.MenuSelect;exports.Section=o.Section;exports.Select=o.Select;exports.SelectButton=o.SelectButton;exports.SelectField=o.SelectField;exports.Table=o.Table;exports.TextareaField=o.TextareaField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as s, B as o, a as t, c as i, e as r, d as l, e as n, C as c, E as d, F as S, F as m, I as f, f as C, L as p, g as T, b, M as x, R as F, i as u, S as B, j as L, T as M, s as h, h as g } from "../Checkbox.view-DEBTcr4E.js";
|
|
2
2
|
import { E as A, S as E, T as I } from "../Title.view-DK7iD7P1.js";
|
|
3
3
|
import { A as k, L as V, R as j } from "../RequiredLabel.view-DeP7ncq9.js";
|
|
4
|
-
import { C as y, d as v, M as z, a as D, b as G, c as H, S as J, e as K, T as N } from "../Table.view-
|
|
4
|
+
import { C as y, d as v, M as z, a as D, b as G, c as H, S as J, e as K, T as N } from "../Table.view-DNLacIcf.js";
|
|
5
5
|
export {
|
|
6
6
|
s as ActionButton,
|
|
7
7
|
k as AlertInline,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../Table.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../Table.view-CnPzI0s1.cjs");exports.CheckboxField=e.CheckboxField;exports.CollapseSection=e.CollapseSection;exports.MenuSelect=e.MenuSelect;exports.Section=e.Section;exports.Select=e.Select;exports.SelectButton=e.SelectButton;exports.SelectField=e.SelectField;exports.Table=e.Table;exports.TextareaField=e.TextareaField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as l, d as s, M as t, a as c, b as o, c as S, S as i, e as d, T as n } from "../../Table.view-
|
|
1
|
+
import { C as l, d as s, M as t, a as c, b as o, c as S, S as i, e as d, T as n } from "../../Table.view-DNLacIcf.js";
|
|
2
2
|
export {
|
|
3
3
|
l as CheckboxField,
|
|
4
4
|
s as CollapseSection,
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Checkbox.view-CDJhnIP4.cjs"),o=require("./Title.view-CX_Y7KM1.cjs"),l=require("./RequiredLabel.view-CV4twgie.cjs"),t=require("./Table.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Checkbox.view-CDJhnIP4.cjs"),o=require("./Title.view-CX_Y7KM1.cjs"),l=require("./RequiredLabel.view-CV4twgie.cjs"),t=require("./Table.view-CnPzI0s1.cjs"),i=require("./index-BcwQwoIM.cjs"),r=require("./helpers/index.cjs.js");exports.ActionButton=e.ActionButton;exports.Badge=e.Badge;exports.Button=e.Button;exports.Checkbox=e.Checkbox;exports.Confirm=e.ConfirmModal;exports.ConfirmButton=e.ConfirmButton;exports.ConfirmModal=e.ConfirmModal;exports.Container=e.Container;exports.Empty=e.Empty;exports.Frame=e.FrameView;exports.FrameView=e.FrameView;exports.Info=e.Info;exports.Input=e.Input;exports.Label=e.Label;exports.Loading=e.Loading;exports.LoadingBar=e.LoadingBar;exports.Modal=e.Modal;exports.Radio=e.Radio;exports.SectionTitle=e.SectionTitle;exports.Spacer=e.Spacer;exports.Textarea=e.Textarea;exports.Tooltip=e.Tooltip;exports.showConfirm=e.showConfirm;exports.showModal=e.showModal;exports.styleGuide=e.index;exports.ErrorMessage=o.ErrorMessage;exports.Switch=o.Switch;exports.Title=o.Title;exports.AlertInline=l.AlertInline;exports.LabelField=l.LabelField;exports.RequiredLabelView=l.RequiredLabelView;exports.CheckboxField=t.CheckboxField;exports.CollapseSection=t.CollapseSection;exports.MenuSelect=t.MenuSelect;exports.Section=t.Section;exports.Select=t.Select;exports.SelectButton=t.SelectButton;exports.SelectField=t.SelectField;exports.Table=t.Table;exports.TextareaField=t.TextareaField;exports.capitalizeAllFirstLetters=i.capitalizeAllFirstLetters;exports.capitalizeFirstLetter=i.capitalizeFirstLetter;exports.convertHexToRGB=i.convertHexToRGB;exports.dom=i.dom;exports.resetStyles=i.resetStyles;exports.valuable=i.valuable;exports.stableStringify=r.stableStringify;
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as s, B as t, a as o, c as r, e as i, d as l, e as n, C as c, E as d, F as m, F as S, I as f, f as p, L as b, g as x, b as C, M as F, R as T, i as u, S as L, j as B, T as M, s as g, h, k as w } from "./Checkbox.view-DEBTcr4E.js";
|
|
2
2
|
import { E as R, S as y, T as E } from "./Title.view-DK7iD7P1.js";
|
|
3
3
|
import { A as k, L as v, R as z } from "./RequiredLabel.view-DeP7ncq9.js";
|
|
4
|
-
import { C as V, d as j, M as q, a as H, b as D, c as J, S as K, e as N, T as O } from "./Table.view-
|
|
4
|
+
import { C as V, d as j, M as q, a as H, b as D, c as J, S as K, e as N, T as O } from "./Table.view-DNLacIcf.js";
|
|
5
5
|
import { a as Q, c as U, b as W, d as X, r as Y, v as Z } from "./index-_v6RoRxb.js";
|
|
6
6
|
import { stableStringify as $ } from "./helpers/index.es.js";
|
|
7
7
|
export {
|
package/package.json
CHANGED