@ufal-lccv/gpsub-ds 0.0.18 → 0.0.19-alpha
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-dgKqpBRL.js → Table.view-B2Rfbg5X.js} +537 -533
- package/dist/{Table.view-wnIhy1DV.cjs → Table.view-Bb0QYYNi.cjs} +23 -15
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.es.js +1 -1
- package/dist/components/organisms/TabInfo/TabInfo.style.d.ts +1 -0
- 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-DFbiE7Mi.cjs"),g=require("react"),t=require("sbwb-ds"),F=require("./index-BcwQwoIM.cjs"),Q=require("react-hook-form"),ee=350,ae=({title:e,children:n,endAdornment:i=null,marginBottom:s="16px",customStyles:l={},wrapperCustomStyles:c={},hideAdornmentOnCollapse:a=!1,maxHeight:
|
|
1
|
+
"use strict";const o=require("./Checkbox.view-DFbiE7Mi.cjs"),g=require("react"),t=require("sbwb-ds"),F=require("./index-BcwQwoIM.cjs"),Q=require("react-hook-form"),ee=350,ae=({title:e,children:n,endAdornment:i=null,marginBottom:s="16px",customStyles:l={},wrapperCustomStyles:c={},hideAdornmentOnCollapse:a=!1,maxHeight:x="none"})=>{const[h,m]=g.useState(!1),[f,u]=g.useState(!0);g.useEffect(()=>{if(a)if(h){const N=setTimeout(()=>u(!1),ee);return()=>clearTimeout(N)}else u(!0)},[h,a]);const b=a&&!f?null:i;return o.jsxRuntimeExports.jsxs(o.Container,{width:"100%",flex:"1",gap:"8px",customStyles:c,children:[o.jsxRuntimeExports.jsx(o.SectionTitle,{title:e,divider:!0,marginBottom:s,collapse:{collapsed:h,setCollapsed:m},endAdornment:b,customStyles:l}),o.jsxRuntimeExports.jsx(o.Container,{gap:"8px",width:"100%",customStyles:{maxHeight:h?"0":x,transition:`max-height ${ee}ms ease-in-out`},children:n})]})};function Y(e,n,i){var s,l,c,a,x;n==null&&(n=100);function h(){var f=Date.now()-a;f<n&&f>=0?s=setTimeout(h,n-f):(s=null,i||(x=e.apply(c,l),c=l=null))}var m=function(){c=this,l=arguments,a=Date.now();var f=i&&!s;return s||(s=setTimeout(h,n)),f&&(x=e.apply(c,l),c=l=null),x};return m.clear=function(){s&&(clearTimeout(s),s=null)},m.flush=function(){s&&(x=e.apply(c,l),c=l=null,clearTimeout(s),s=null)},m}Y.debounce=Y;var ce=Y;const de=o.getDefaultExportFromCjs(ce);function Z({form:e,fieldName:n,triggerType:i=null,debounceTime:s=500}){const l=g.useCallback(()=>{e.trigger(n)},[e,n]),c=g.useMemo(()=>de(()=>l(),s),[l,s]),a=g.useMemo(()=>["all","onChange"].includes(i)?c:null,[c,i]),x=g.useMemo(()=>["all","onBlur"].includes(i)?l:null,[i]);return g.useMemo(()=>({onChangeTrigger:a,onBlurTrigger:x}),[a,x])}const ge=({form:e,name:n,label:i,options:s,readonly:l=!1,disabled:c=!1,optionsMap:a,width:x="100%",flex:h,placeholder:m,onSelect:f,parser:u,filter:b,tooltipProps:N={},infoProps:p={},maxHeigthMenu:C,isRequired:R=!1,onRemoveSelected:H,triggerFormField:j=null,displayText:W,...v})=>{const{onChangeTrigger:k}=Z({form:e,fieldName:n,triggerType:j,debounceTime:0}),O={position:"top",...N},L={...p,tooltipProps:{position:"top",maxWidth:"300px",...p==null?void 0:p.tooltipProps}},T=(w,I)=>{let A=w;u&&(A=u==null?void 0:u(w)),I(A),f==null||f(A),k==null||k()},$=g.useMemo(()=>F.valuable(a)?a:Object.fromEntries(s.map(w=>[w.value,w])),[s,a]);return o.jsxRuntimeExports.jsx(o.Container,{width:x,flex:h,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:e.control,render:({field:{onChange:w,value:I},fieldState:{error:A=null}})=>{let y=$[I];return o.jsxRuntimeExports.jsx(K,{label:i,width:"100%",size:"Small",disabled:c,readonly:l,filter:b,errorMessage:A==null?void 0:A.message,placeholder:m,value:y,handleOption:d=>{T(d.value,w)},tooltipProps:O,options:s,maxHeigthMenu:C,infoProps:L,maxHeightMenu:C,isRequired:R,onRemoveSelected:H,displayText:W,...v})}})})},oe=({form:e,name:n,label:i,readonly:s=!1,disabled:l=!1,width:c="100%",height:a="100%",flex:x,placeholder:h,charactersCounter:m=!0,maxlength:f=1e3,resize:u=!0,triggerFormField:b=null,minHeight:N,maxHeight:p,...C})=>{const{onChangeTrigger:R}=Z({form:e,fieldName:n,triggerType:b}),H=(j,W)=>{W(j),R==null||R()};return o.jsxRuntimeExports.jsx(o.Container,{width:c,flex:x,height:a,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:e.control,render:({field:{onChange:j,value:W},fieldState:{error:v=null}})=>o.jsxRuntimeExports.jsx(o.Textarea,{label:i,value:W||"",width:"100%",disabled:l,readonly:s,height:a,minHeight:N,maxHeight:p,errorMessage:v==null?void 0:v.message,placeholder:h,onChange:k=>H(k.target.value,j),charactersCounter:m,maxlength:f,size:"Small",resize:u,...C})})})};oe.displayName="TextareaField";const ue=({form:e,name:n,id:i=n,label:s,readonly:l=!1,disabled:c=!1,afterCheck:a,width:x="100%",formatter:h,parser:m,flex:f,size:u="Medium",triggerFormField:b=null,...N})=>{const{onChangeTrigger:p}=Z({form:e,fieldName:n,triggerType:b,debounceTime:0}),C=(R,H)=>{H(R),a==null||a(R),p==null||p()};return o.jsxRuntimeExports.jsx(o.Container,{width:x,flex:f,children:o.jsxRuntimeExports.jsx(Q.Controller,{name:n,control:e.control,render:({field:{onChange:R,value:H},fieldState:{error:j=null}})=>{const W=j==null?void 0:j.message;return W&&console.log("Error on checkbox!",W),o.jsxRuntimeExports.jsx(o.Checkbox,{id:`form-checkbox-${i}`,checked:(h==null?void 0:h(H))??H,name:n,label:s,disabled:c||l,onChange:v=>{C((m==null?void 0:m(v.target.checked,H))??v.target.checked,R)},size:u,...N})}})})},fe=o.qe.ul`
|
|
2
2
|
${F.resetStyles}
|
|
3
3
|
position: fixed;
|
|
4
4
|
margin-top: ${({marginTop:e})=>e};
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
margin: 0;
|
|
119
119
|
display: flex;
|
|
120
120
|
align-self: center;
|
|
121
|
-
`,we=(e,n,i=0,s=0,l="left")=>{const[c,a]=g.useState(0),[
|
|
121
|
+
`,we=(e,n,i=0,s=0,l="left")=>{const[c,a]=g.useState(0),[x,h]=g.useState(),m=g.useRef(null),f=g.useCallback(()=>{if(!e.current||!m.current)return;const u=e.current.getBoundingClientRect(),b=m.current.getBoundingClientRect(),N=window.innerHeight,p=window.innerWidth,C=u.top,R=N-u.bottom,H=R<b.height+s&&C>R;let j;H?(j=u.top-b.height-i,m.current.style.maxHeight=`${C-i}px`):(j=u.bottom+s,m.current.style.maxHeight=`${R-s}px`);let W=u.left;const v=W+b.width-p;v>0&&(W-=v),W<0&&(W=0);const k=p-u.right;Object.assign(m.current.style,{position:"fixed",top:`${j}px`,...l==="left"?{left:`${W}px`}:{right:`${k}px`},width:`${Math.max(u.width,b.width)}px`,overflowY:"auto"})},[i,s,l]);return g.useEffect(()=>{var b;a(0),h((b=e.current)==null?void 0:b.clientWidth),f();const u=()=>f();return window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[e,f]),{highlightedIndex:c,setHighlightedIndex:a,isOptionSelected:u=>u.label===(n==null?void 0:n.label),optionsRef:m,parentWidth:x}},J=g.forwardRef(({selectContainerRef:e,optionsSelect:n,size:i,selectOption:s,value:l,inputValue:c,widthMenu:a,maxHeightMenu:x="180px",menuIsOpen:h,onEnter:m,marginTop:f="4px",iconName:u,iconColor:b,iconPosition:N,topOffset:p=0,bottomOffset:C=0,truncateText:R=!0,menuJustifyContent:H="flex-start",tableActionButton:j,menuLateralPadding:W="8px",menuOptionFlexDirection:v="column",confirmSelection:k,menuAlign:O="left"},L)=>{F.valuable(u)&&(u+="Ant");const{highlightedIndex:T,setHighlightedIndex:$,isOptionSelected:w,optionsRef:I,parentWidth:A}=we(e,l,p,C,O);g.useEffect(()=>{const r=S=>{if(h){if(S.key==="ArrowDown")S.preventDefault(),$(E=>E<n.length-1?E+1:E);else if(S.key==="ArrowUp")S.preventDefault(),$(E=>E>0?E-1:0);else if(S.key==="Enter"&&n[T]){S.preventDefault();const E=n[T];s(E),m&&m(E)}}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[h,n,T,m,s,k]);const y=r=>typeof r=="string"?r:g.isValidElement(r)&&typeof r.props.children=="string"?r.props.children:String(r),d=(r,S)=>{var M,B;if(N!==S)return null;const E=F.valuable((M=r.tooltipProps)==null?void 0:M.label),z=r.iconName||u||"InfoFill0Sm",P=o.jsxRuntimeExports.jsx($e,{iconPosition:(B=r.tooltipProps)==null?void 0:B.position,id:`iconContainer-${r.value}`,children:o.jsxRuntimeExports.jsx(t.Icon,{iconName:z,color:r.disabled?t.sg.colors.neutralColors.colorNeutralCleanest:w(r)?t.sg.colors.brandColors.colorBrandSoft:b??t.sg.colors.neutralColors.colorNeutralDark})});return E?o.jsxRuntimeExports.jsx(o.Tooltip,{...r==null?void 0:r.tooltipProps,isActive:!0,children:P}):P};return o.jsxRuntimeExports.jsx(fe,{marginTop:f,width:a??`${A}px`,maxHeight:x,height:"fit-content",ref:r=>{I.current=r,typeof L=="function"?L(r):L&&(L.current=r)},"data-testid":"MenuSelect",id:"MenuSelect",children:n.length===0?o.jsxRuntimeExports.jsx(he,{size:i,children:"Sem opções"}):n.map((r,S)=>{var P,M;const E=typeof r.render=="function"?r.render():null,z=y(r.label);if(r.isSection)return o.jsxRuntimeExports.jsx(me,{size:i,children:z},z);{const B=z.toLowerCase().indexOf((c==null?void 0:c.toLowerCase())||"");return o.jsxRuntimeExports.jsxs(be,{isOptionSelected:w(r),highlightedIndex:S===T,onClick:D=>{D.stopPropagation(),r.disabled||(k?o.showConfirm({id:"select-option",title:k.title,description:k.description,icon:k.icon,iconColor:k.iconColor,leftButtonProps:{name:"Cancelar",variant:"tertiary",onClick:()=>{}},rightButtonProps:{name:"Confirmar",variant:"secondary",onClick:()=>s(r)}}):s(r))},onMouseEnter:()=>$(S),disabled:r.disabled,size:i,menuLateralPadding:W,children:[d(r,"left"),o.jsxRuntimeExports.jsxs(xe,{menuOptionFlexDirection:v,menuJustifyContent:H,iconName:u,isOptionSelected:w(r),highlightedIndex:S===T,"data-testid":r.value,size:i,hasDescription:!!r.description,optionValue:r.value,disabled:r.disabled,truncateText:R,tableActionButton:j,children:[o.jsxRuntimeExports.jsxs(Se,{truncateText:!g.isValidElement(r.label)&&R,children:[E,g.isValidElement(r.label)?o.jsxRuntimeExports.jsx("p",{title:((P=r==null?void 0:r.tooltipProps)==null?void 0:P.label)??y(r.label),children:r.label}):o.jsxRuntimeExports.jsx("p",{title:((M=r==null?void 0:r.tooltipProps)==null?void 0:M.label)??z,children:c&&B>=0?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[z.substring(0,B),o.jsxRuntimeExports.jsx(pe,{size:i,children:z.substring(B,B+((c==null?void 0:c.length)||0))}),z.substring(B+((c==null?void 0:c.length)||0))]}):z})]}),r.description&&o.jsxRuntimeExports.jsx("p",{title:r.description,children:r.description})]}),d(r,"right")]},String(r.value))}})})});J.displayName="MenuSelect";const ne=({title:e,iconName:n,onClickIcon:i,width:s,height:l,flex:c,children:a,wrapperCustomStyles:x={},contentCustomStyles:h={},titleCustomStyles:m={}})=>o.jsxRuntimeExports.jsxs(o.Container,{width:s,height:l,flex:c,direction:"vertical",padding:t.sg.spacings.spacingStack.spacingStackSm,customStyles:{backgroundColor:t.sg.colors.backgroundColors.colorBackgroundSnow,border:`1px solid ${t.sg.colors.neutralColors.colorNeutralSoft}`,borderRadius:"8px",...x},children:[o.jsxRuntimeExports.jsxs(o.Container,{width:"100%",direction:"horizontal",customStyles:h,children:[e?o.jsxRuntimeExports.jsx(o.Container,{width:"fit-content",customStyles:m,children:o.jsxRuntimeExports.jsx(o.SectionTitle,{title:e,divider:!1})}):null,n?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(o.Spacer,{size:"auto",direction:"horizontal"}),o.jsxRuntimeExports.jsx(t.Icon,{iconName:n,onClick:()=>i==null?void 0:i(),color:F.valuable(i)?t.sg.colors.neutralColors.colorNeutralDark:t.sg.colors.neutralColors.colorNeutralCloudy,cursorPointer:F.valuable(i)})]}):null]}),o.jsxRuntimeExports.jsx(o.Container,{width:"100%",flex:"1",children:a})]});ne.displayName="Section";const ye=o.qe.div`
|
|
122
122
|
${F.resetStyles}
|
|
123
123
|
display: flex;
|
|
124
124
|
flex-direction: column;
|
|
@@ -258,14 +258,14 @@
|
|
|
258
258
|
color: ${t.sg.colors.neutralColors.colorNeutralDark};
|
|
259
259
|
margin-top: ${t.sg.spacings.spacingInline.spacingInlineNano};
|
|
260
260
|
width: 100%;
|
|
261
|
-
`,
|
|
261
|
+
`,Ie=(e,{value:n,options:i})=>{const[s,l]=g.useState(!1),[c,a]=g.useState(!1),[x,h]=g.useState(""),[m,f]=g.useState(i),u=g.useRef(null),b=g.useRef(null),N=g.useRef(null),p=g.useRef(null);g.useEffect(()=>{const j=()=>{a(!1)};return window.addEventListener("scroll",j,{passive:!0}),window.addEventListener("resize",j,{passive:!0}),()=>{window.removeEventListener("scroll",j),window.removeEventListener("resize",j)}},[]);function C(j){h(""),a(!1),l(!0),N!=null&&N.current&&N.current.focus(),j!==n&&e(j)}const R=j=>{if(j){const W=new RegExp(j,"i"),v=i.filter(k=>W.exec(k.label));f(v)}else f(i)};function H(j){return!j}return{isOpen:s,setIsOpen:l,expanded:c,setExpanded:a,inputValue:x,setInputValue:h,optionsSelect:m,setOptionSelect:f,selectContainerRef:u,containerRef:b,inputContainerRef:N,optionsRef:p,selectOption:C,handlerFilterOptions:R,isValue:H}},K=g.forwardRef(({value:e,handleOption:n,options:i,filter:s=!0,placeholder:l,label:c,size:a="Medium",width:x="100%",disabled:h,helpText:m,readonly:f,errorMessage:u,tooltipProps:b={},onBlur:N,onEnter:p,variant:C="default",infoProps:R={},maxHeightMenu:H,isRequired:j=!1,onRemoveSelected:W,displayText:v,displayTextProps:k={}},O)=>{const{isOpen:L,setIsOpen:T,expanded:$,setExpanded:w,inputValue:I,setInputValue:A,optionsSelect:y,selectContainerRef:d,containerRef:r,inputContainerRef:S,selectOption:E,setOptionSelect:z,handlerFilterOptions:P,isValue:M}=Ie(n,{value:e,options:i}),B=!!u,D={label:u,...b,wrapperWidth:"auto",isActive:B,isErrorTooltip:!0},q={...R,size:a},_=o.jsxRuntimeExports.jsx(t.Icon,{iconName:`Close${a==="Small"?"Sm":"Ant"}`,onClick:X=>{X.stopPropagation(),W(e)}}),V=o.jsxRuntimeExports.jsx(t.Icon,{iconName:`ExpandLess${a==="Small"?"Sm":"Ant"}`}),le=o.jsxRuntimeExports.jsx(t.Icon,{iconName:`ExpandMore${a==="Small"?"Sm":"Ant"}`});return o.jsxRuntimeExports.jsxs(ye,{ref:d,width:x,size:a,disabled:h,readonly:f,children:[c&&o.jsxRuntimeExports.jsxs(Ee,{children:[o.jsxRuntimeExports.jsxs(ze,{"data-testid":"label",ref:O,children:[c,j&&!h?o.jsxRuntimeExports.jsx(Be,{children:" *"}):null]}),((q==null?void 0:q.message)||(q==null?void 0:q.render))&&o.jsxRuntimeExports.jsx(o.Info,{...q})]}),o.jsxRuntimeExports.jsx(o.Tooltip,{...D,children:o.jsxRuntimeExports.jsxs(je,{hasError:B,readonly:f,ref:r,onBlur:()=>{setTimeout(()=>{(L||$)&&S.current!==document.activeElement&&(N&&N(e),T(!1),w(!1))},250)},onClick:()=>{!h&&!f&&(L&&!$?(w(!0),S!=null&&S.current&&S.current.focus()):!L&&!$?(T(!0),w(!0),S!=null&&S.current&&S.current.focus()):(T(!1),w(!1),S!=null&&S.current&&S.current.blur()),!I&&z(i))},tabIndex:0,width:x,size:a,isOpen:L||$,"data-testid":"select",disabled:h,helpText:m,variant:C,children:[o.jsxRuntimeExports.jsxs(Ce,{children:[F.valuable(v)?o.jsxRuntimeExports.jsx(te,{size:a,variant:C,isDisplayText:!0,children:o.jsxRuntimeExports.jsx("p",{title:e==null?void 0:e.label,...k,children:v})}):o.jsxRuntimeExports.jsxs(te,{size:a,variant:C,children:[l&&M(e)&&!I&&!L?o.jsxRuntimeExports.jsx(Re,{size:a,variant:C,children:l}):null,(e==null?void 0:e.label)&&o.jsxRuntimeExports.jsx("p",{title:(e==null?void 0:e.hint)??(e==null?void 0:e.label),children:e==null?void 0:e.label})]}),s&&!F.valuable(v)&&o.jsxRuntimeExports.jsx(ke,{ref:S,value:I,onChange:X=>{A(X.target.value),X.target.value.length>0&&(T(!0),w(!0)),P(X.target.value)},readOnly:f,width:I.length,size:a,disabled:h,variant:C})]}),W&&e?_:null,$?V:le,$&&o.jsxRuntimeExports.jsx(J,{onEnter:X=>{n&&n(X),T(!1),w(!1),p&&p(X)},menuIsOpen:L,selectContainerRef:d,value:e,optionsSelect:y,selectOption:E,size:a,inputValue:I,maxHeightMenu:H})]})}),m&&o.jsxRuntimeExports.jsx(Ne,{size:a,children:m})]})});K.displayName="Select";const re=o.We`
|
|
262
262
|
from {
|
|
263
263
|
transform: rotate(0deg);
|
|
264
264
|
}
|
|
265
265
|
to {
|
|
266
266
|
transform: rotate(360deg);
|
|
267
267
|
}
|
|
268
|
-
`,
|
|
268
|
+
`,We=o.qe.button`
|
|
269
269
|
display: flex;
|
|
270
270
|
justify-content: space-between;
|
|
271
271
|
align-items: center;
|
|
@@ -380,11 +380,13 @@
|
|
|
380
380
|
&:hover {
|
|
381
381
|
cursor: not-allowed;
|
|
382
382
|
}
|
|
383
|
-
`,He=e=>{const[n,i]=g.useState(!1),[s,l]=g.useState(e),c=g.useRef(null);return g.useEffect(()=>{l(e)},[e]),{setIsOpen:i,isOpen:n,setOptionsSelect:l,optionsSelect:s,selectContainerRef:c}},Fe=200,Le=({name:e,variant:n="primary",width:i="100%",size:s="Medium",disabled:l=!1,isLoading:c=!1,onClick:a,options:
|
|
383
|
+
`,He=e=>{const[n,i]=g.useState(!1),[s,l]=g.useState(e),c=g.useRef(null);return g.useEffect(()=>{l(e)},[e]),{setIsOpen:i,isOpen:n,setOptionsSelect:l,optionsSelect:s,selectContainerRef:c}},Fe=200,Le=({name:e,variant:n="primary",width:i="100%",size:s="Medium",disabled:l=!1,isLoading:c=!1,onClick:a,options:x,label:h,menuSelectProps:m={},iconName:f,optionsIconPosition:u})=>{const{isOpen:b,setIsOpen:N,selectContainerRef:p,optionsSelect:C}=He(x);let R=t.sg.colors.backgroundColors.colorBackgroundSnow;l?R=t.sg.colors.neutralColors.colorNeutralCloudy:n!=="primary"&&(R=t.sg.colors.neutralColors.colorNeutralDark);const H={...m};return o.jsxRuntimeExports.jsxs(ve,{ref:p,width:i,size:s,disabled:l,onBlur:()=>setTimeout(()=>N(!1),Fe),children:[h&&o.jsxRuntimeExports.jsx(Ae,{children:h}),o.jsxRuntimeExports.jsxs(We,{type:"button",size:s,disabled:l,variant:n,isLoading:c,onClick:()=>!c&&N(!b),id:`button-component-${e}`,children:[c&&o.jsxRuntimeExports.jsx(Me,{size:s,disabled:l,variant:n,children:o.jsxRuntimeExports.jsx(t.Icon,{iconName:`ProgressActivity${s==="Small"?"Ant":"Sm"}`,color:R,"data-testid":"icon-loading"})}),!c&&o.jsxRuntimeExports.jsx("p",{title:e,children:e}),!c&&(b?o.jsxRuntimeExports.jsx(t.Icon,{iconName:`ExpandLess${s==="Small"?"Ant":"Sm"}`,color:R,"data-testid":"icon-button-less"}):o.jsxRuntimeExports.jsx(t.Icon,{iconName:`ExpandMore${s==="Small"?"Ant":"Sm"}`,color:R,"data-testid":"icon-button-more"}))]}),b&&o.jsxRuntimeExports.jsx(J,{selectContainerRef:p,value:null,optionsSelect:C,selectOption:a,size:s,inputValue:null,iconPosition:u,iconName:f,...H})]})},Te=o.qe.div`
|
|
384
384
|
min-width: ${({widthItems:e})=>e};
|
|
385
385
|
max-width: ${({widthItems:e})=>e};
|
|
386
386
|
height: 100%;
|
|
387
387
|
overflow: hidden;
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: column;
|
|
388
390
|
|
|
389
391
|
&:hover {
|
|
390
392
|
overflow: auto;
|
|
@@ -402,7 +404,7 @@
|
|
|
402
404
|
`}
|
|
403
405
|
cursor: pointer;
|
|
404
406
|
${({customStyles:e})=>e&&o.Ae(e)}
|
|
405
|
-
|
|
407
|
+
`;o.qe.div`
|
|
406
408
|
max-width: 4px;
|
|
407
409
|
min-width: 4px;
|
|
408
410
|
min-height: ${({heightItems:e})=>e};
|
|
@@ -414,19 +416,25 @@
|
|
|
414
416
|
border-right: ${({selected:n})=>n?"none":`1px solid ${t.sg.colors.neutralColors.colorNeutralSoft}`};
|
|
415
417
|
`}
|
|
416
418
|
cursor: pointer;
|
|
417
|
-
|
|
419
|
+
`;const Pe=o.qe.div`
|
|
418
420
|
display: flex;
|
|
419
421
|
min-width: 0;
|
|
420
422
|
height: 100%;
|
|
421
423
|
flex: 1;
|
|
422
424
|
background-color: ${t.sg.colors.backgroundColors.colorBackgroundSnow};
|
|
423
|
-
|
|
425
|
+
`;o.qe.div`
|
|
424
426
|
max-width: 4px;
|
|
425
427
|
min-width: 4px;
|
|
426
428
|
height: 100%;
|
|
427
429
|
background-color: 'transparent';
|
|
428
430
|
overflow: hidden;
|
|
429
|
-
|
|
431
|
+
`;const De=o.qe.div`
|
|
432
|
+
flex: 1;
|
|
433
|
+
width: 100%;
|
|
434
|
+
background-color: 'transparent';
|
|
435
|
+
border-right: 1px solid ${t.sg.colors.neutralColors.colorNeutralSoft};
|
|
436
|
+
overflow: hidden;
|
|
437
|
+
`,Oe=({width:e="100%",height:n="fit-content",flex:i,backgroundColor:s="white",options:l=[],heightItems:c="60px",widthItems:a="155px",emptyProps:x={title:"Nenhum dado a ser mostrado",body:null},customWrapperStyles:h={},customItemStyles:m={}})=>{const[f,u]=g.useState(l[0]||null),b=g.useRef(null),N=g.useRef(null);return g.useEffect(()=>{const p=b.current,C=N.current,R=()=>{p&&C&&(C.scrollTop=p.scrollTop)};return p==null||p.addEventListener("scroll",R),()=>{p==null||p.removeEventListener("scroll",R)}},[]),g.useEffect(()=>{u(l[(l==null?void 0:l.length)-1]||null)},[l==null?void 0:l.length]),(l==null?void 0:l.length)===0?o.jsxRuntimeExports.jsx(o.Empty,{title:x.title,body:x.body,flex:"1",mode:"table"}):o.jsxRuntimeExports.jsxs(o.Container,{width:e,height:n,flex:i,backgroundColor:s,direction:"horizontal",customStyles:{border:`1px solid ${t.sg.colors.neutralColors.colorNeutralSoft}`,borderRadius:t.sg.borders.borderRadius.borderRadiusSm,...h},children:[o.jsxRuntimeExports.jsxs(Te,{ref:b,widthItems:a,children:[l==null?void 0:l.map((p,C)=>o.jsxRuntimeExports.jsx(qe,{selected:(f==null?void 0:f.key)===p.key,onClick:()=>u(p),withBorderRight:!0,heightItems:c,customStyles:m,children:p.item},C)),o.jsxRuntimeExports.jsx(De,{})]}),o.jsxRuntimeExports.jsx(Pe,{children:f&&(f==null?void 0:f.contentItem)})]})},se=o.Ae`
|
|
430
438
|
svg:not([color]):not([data-testid='icon']) {
|
|
431
439
|
path {
|
|
432
440
|
fill: ${t.sg.colors.neutralColors.colorNeutralDarkest};
|
|
@@ -438,7 +446,7 @@
|
|
|
438
446
|
fill: ${t.sg.colors.neutralColors.colorNeutralDarkest};
|
|
439
447
|
}
|
|
440
448
|
}
|
|
441
|
-
`,
|
|
449
|
+
`,Xe=o.qe.div`
|
|
442
450
|
width: 100%;
|
|
443
451
|
max-height: ${({maxHeight:e})=>e};
|
|
444
452
|
overflow: auto;
|
|
@@ -460,11 +468,11 @@
|
|
|
460
468
|
background: ${t.sg.colors.neutralColors.colorNeutralClean};
|
|
461
469
|
border-radius: ${t.sg.borders.borderRadius.borderRadiusPill};
|
|
462
470
|
}
|
|
463
|
-
`,
|
|
471
|
+
`,_e=o.qe.table`
|
|
464
472
|
border-collapse: separate;
|
|
465
473
|
border-spacing: 0;
|
|
466
474
|
width: 100%;
|
|
467
|
-
`,
|
|
475
|
+
`,Ue=`${t.sg.borders.borderRadius.borderExtraSmall} ${t.sg.borders.borderRadius.borderExtraSmall} 0 0`,Ge=`0 0 ${t.sg.borders.borderRadius.borderExtraSmall} ${t.sg.borders.borderRadius.borderExtraSmall}`,U=o.qe.tr`
|
|
468
476
|
${({isHeader:e,size:n})=>e&&o.Ae`
|
|
469
477
|
position: sticky;
|
|
470
478
|
background-color: ${t.sg.colors.backgroundColors.colorBackgroundSnow};
|
|
@@ -487,7 +495,7 @@
|
|
|
487
495
|
background-color: ${n?t.sg.colors.neutralColors.colorNeutralClean:i?"#F5F9FE":t.sg.colors.backgroundColors.colorBackgroundSnow};
|
|
488
496
|
`}
|
|
489
497
|
|
|
490
|
-
border-radius: ${({isFirst:e,isLast:n,isHeader:i,borderRadius:s})=>{if(e&&!i)return s?`${s} ${s} 0 0`:
|
|
498
|
+
border-radius: ${({isFirst:e,isLast:n,isHeader:i,borderRadius:s})=>{if(e&&!i)return s?`${s} ${s} 0 0`:Ue;if(n)return s?`0 0 ${s} ${s}`:Ge}};
|
|
491
499
|
transition: background-color 0.2s 0s;
|
|
492
500
|
|
|
493
501
|
&:hover {
|
|
@@ -554,7 +562,7 @@
|
|
|
554
562
|
&:hover {
|
|
555
563
|
cursor: default;
|
|
556
564
|
}
|
|
557
|
-
`,
|
|
565
|
+
`,Je=o.qe.td`
|
|
558
566
|
text-align: ${({horizontalAlign:e})=>e||"left"};
|
|
559
567
|
vertical-align: ${({verticalAlign:e})=>e||"middle"};
|
|
560
568
|
|
|
@@ -586,4 +594,4 @@
|
|
|
586
594
|
&:hover {
|
|
587
595
|
cursor: ${e=>e.isClickable?"pointer":"default"};
|
|
588
596
|
}
|
|
589
|
-
`;function
|
|
597
|
+
`;function Ve(e){return n=>typeof e=="string"?n[e]:typeof e=="function"?e(n):(console.warn("Please, setup a rowKey for table."),JSON.stringify(n))}function Ye({id:e,rowKey:n="id",size:i="Small",onRowClick:s,fit:l=!1,maxHeight:c="40rem",columns:a,dataSource:x,columnsTextSize:h=i,emptyProps:m={width:"100%",height:"100%",title:"Nenhum dado a ser mostrado.",mode:"table",borders:!0,backgroundColor:t.sg.colors.backgroundColors.colorBackgroundSnow},selectedRow:f=!1,hideHeader:u=!1,withBorder:b=!0,withBorderRadius:N=!0,striped:p=!1,borderRadius:C=t.sg.borders.borderRadius.borderRadiusSm}){const R=g.useMemo(()=>Ve(n),[n]),[H,j]=g.useState(null),W=g.useRef(null),v=g.useRef(null),[k,O]=g.useState(a);g.useLayoutEffect(()=>{if(!v.current||a.length===0){O(a);return}const $=()=>{var P;const I=((P=v.current)==null?void 0:P.clientWidth)||0;if(I===0)return;let A=0,y=0;const d=[],r=[];a.forEach(M=>{const B=Number(M.flex);M.width?A+=parseInt(M.width,10)||0:M.flex&&B>0?(y+=B,d.push(M)):r.push(M)});const S=I-A,E="80";let z=[...a];if(S>0){if(d.length>0){const M=S/y;z=a.map(B=>{const D=Number(B.flex);if(D&&D>0){const q=parseInt(B.minWidth||E,10),_=D*M,V=Math.max(_,q);return{...B,width:`${Math.floor(V)}px`}}return!B.width&&!D?{...B,width:B.minWidth||`${E}px`}:B})}else if(r.length>0){const M=S/r.length;z=a.map(B=>{const D=Number(B.flex);if(!B.width&&!D){const q=parseInt(B.minWidth||E,10),_=Math.max(M,q);return{...B,width:`${Math.floor(_)}px`}}return B})}}else z=a.map(M=>M.width?M:{...M,width:M.minWidth||`${E}px`});O(z)};$();const w=new ResizeObserver($);return w.observe(v.current),()=>w.disconnect()},[a]),g.useEffect(()=>{const $=w=>{W.current&&!W.current.contains(w.target)&&j(null)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[]);const L=g.useMemo(()=>k?k.some($=>$.mergeHeaderId&&$.mergeHeaderLabel):!1,[k]),T=g.useMemo(()=>{var A,y;if(u||!k||k.length===0)return null;if(!L)return o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:1,borderRadius:C,children:k.map(d=>{var r;return o.jsxRuntimeExports.jsx(G,{width:d.width,minWidth:d.minWidth,maxWidth:d.maxWidth,horizontalAlign:d.horizontalAlign,size:i,columnsTextSize:h,withBorder:b,headerAlign:d.headerAlign,children:((r=d.columnRender)==null?void 0:r.call(d,x))||o.jsxRuntimeExports.jsx("span",{title:d.label,children:d.label})},d.dataIndex)})});const $=[],w=[];let I=0;for(;I<k.length;){const d=k[I];if(d.mergeHeaderId&&d.mergeHeaderLabel){let r=0;const S=d.mergeHeaderId;for(let E=I;E<k.length&&k[E].mergeHeaderId===S;E++)r++;$.push(o.jsxRuntimeExports.jsx(G,{colSpan:r,horizontalAlign:"center",size:i,columnsTextSize:h,withBorder:b,width:d.width,minWidth:d.minWidth,maxWidth:d.maxWidth,headerAlign:d.headerAlign,isTopRow:!0,children:o.jsxRuntimeExports.jsx("span",{title:d.mergeHeaderLabel,children:d.mergeHeaderLabel})},`${d.mergeHeaderId}-merged`));for(let E=0;E<r;E++){const z=k[I+E];w.push(o.jsxRuntimeExports.jsx(G,{width:z.width,minWidth:z.minWidth,maxWidth:z.maxWidth,horizontalAlign:z.horizontalAlign,size:i,columnsTextSize:h,withBorder:b,headerAlign:d.headerAlign,children:((A=z.columnRender)==null?void 0:A.call(z,x))||o.jsxRuntimeExports.jsx("span",{title:z.label,children:z.label})},z.dataIndex+"-individual"))}I+=r}else $.push(o.jsxRuntimeExports.jsx(G,{rowSpan:2,width:d.width,minWidth:d.minWidth,maxWidth:d.maxWidth,horizontalAlign:d.horizontalAlign,size:i,columnsTextSize:h,withBorder:b,headerAlign:d.headerAlign,isTopRow:!0,children:((y=d.columnRender)==null?void 0:y.call(d,x))||o.jsxRuntimeExports.jsx("span",{title:d.label,children:d.label})},d.dataIndex)),I++}return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:2,borderRadius:C,children:$}),w.length>0&&o.jsxRuntimeExports.jsx(U,{isHeader:!0,size:i,numRows:2,borderRadius:C,children:w})]})},[k,u,i,h,L]);return!x||x.length===0?o.jsxRuntimeExports.jsx(o.Empty,{backgroundColor:t.sg.colors.backgroundColors.colorBackgroundSnow,borders:!0,mode:"table",...m}):o.jsxRuntimeExports.jsx(Xe,{maxHeight:c,withBorderRadius:N,ref:v,borderRadius:C,children:o.jsxRuntimeExports.jsxs(_e,{id:e,ref:W,children:[o.jsxRuntimeExports.jsx("thead",{children:T}),o.jsxRuntimeExports.jsx("tbody",{style:{width:"100%"},children:x==null?void 0:x.map(($,w,I)=>{const A=R($);return o.jsxRuntimeExports.jsx(U,{isLast:w===I.length-1,fit:l,size:i,withBorder:b,isSelected:A===H&&f,striped:p&&w%2!==0,borderRadius:C,children:k.map(y=>{var d,r,S;return o.jsxRuntimeExports.jsx(Je,{width:y.width,minWidth:y.minWidth,maxWidth:y.maxWidth,size:i,isClickable:F.valuable(s),onClick:()=>{s&&s($,y,w),f&&j(H===A?null:A)},horizontalAlign:y.horizontalAlign,verticalAlign:y.verticalAlign,rowPadding:y.rowPadding,withBorder:b,isLast:w===I.length-1,backgroundColor:(d=y.paint)==null?void 0:d.call(y,$[y.dataIndex],$,w,I),children:((r=y.render)==null?void 0:r.call(y,$[y.dataIndex],$,w,I))||o.jsxRuntimeExports.jsx("span",{title:$[y.dataIndex],style:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",...(S=y.rowCss)==null?void 0:S.call(y,$)},children:$[y.dataIndex]})||""},`${A}::${y.dataIndex}`)})},A)})})]})})}exports.CheckboxField=ue;exports.CollapseSection=ae;exports.MenuSelect=J;exports.Section=ne;exports.Select=K;exports.SelectButton=Le;exports.SelectField=ge;exports.TabInfo=Oe;exports.Table=Ye;exports.TextareaField=oe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.view-DFbiE7Mi.cjs"),t=require("../Title.view-B2dLqH4V.cjs"),i=require("../RequiredLabel.view-DRKx7lq3.cjs"),o=require("../Table.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../Checkbox.view-DFbiE7Mi.cjs"),t=require("../Title.view-B2dLqH4V.cjs"),i=require("../RequiredLabel.view-DRKx7lq3.cjs"),o=require("../Table.view-Bb0QYYNi.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.TabInfo=o.TabInfo;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 f, F as S, I as m, f as C, L as T, g as b, b as p, 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-D75146I3.js";
|
|
2
2
|
import { E as I, S as A, T as E } from "../Title.view-DGXidSXd.js";
|
|
3
3
|
import { A as k, L as V, R as j } from "../RequiredLabel.view-Cv_y1fuR.js";
|
|
4
|
-
import { a as y, C as v, M as z, b as D, c as G, d as H, S as J, e as K, f as N, T as O } from "../Table.view-
|
|
4
|
+
import { a as y, C as v, M as z, b as D, c as G, d as H, S as J, e as K, f as N, T as O } from "../Table.view-B2Rfbg5X.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-Bb0QYYNi.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.TabInfo=e.TabInfo;exports.Table=e.Table;exports.TextareaField=e.TextareaField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as s, C as l, M as t, b as c, c as o, d as S, S as i, e as n, f as b, T as d } from "../../Table.view-
|
|
1
|
+
import { a as s, C as l, M as t, b as c, c as o, d as S, S as i, e as n, f as b, T as d } from "../../Table.view-B2Rfbg5X.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CheckboxField,
|
|
4
4
|
l 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-DFbiE7Mi.cjs"),o=require("./Title.view-B2dLqH4V.cjs"),l=require("./RequiredLabel.view-DRKx7lq3.cjs"),t=require("./Table.view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Checkbox.view-DFbiE7Mi.cjs"),o=require("./Title.view-B2dLqH4V.cjs"),l=require("./RequiredLabel.view-DRKx7lq3.cjs"),t=require("./Table.view-Bb0QYYNi.cjs"),i=require("./index-BcwQwoIM.cjs"),a=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.TabInfo=t.TabInfo;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=a.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 f, F as m, I as S, f as p, L as b, g as x, b as T, M as C, R as F, i as u, S as L, j as B, T as M, s as g, h, k as w } from "./Checkbox.view-D75146I3.js";
|
|
2
2
|
import { E as I, S as R, T as y } from "./Title.view-DGXidSXd.js";
|
|
3
3
|
import { A as k, L as v, R as z } from "./RequiredLabel.view-Cv_y1fuR.js";
|
|
4
|
-
import { a as V, C as j, M as q, b as H, c as D, d as J, S as K, e as N, f as O, T as P } from "./Table.view-
|
|
4
|
+
import { a as V, C as j, M as q, b as H, c as D, d as J, S as K, e as N, f as O, T as P } from "./Table.view-B2Rfbg5X.js";
|
|
5
5
|
import { a as U, c as W, b as X, d as Y, r as Z, v as _ } from "./index-_v6RoRxb.js";
|
|
6
6
|
import { stableStringify as aa } from "./helpers/index.es.js";
|
|
7
7
|
export {
|