@julseb-lib/react 0.0.90 → 0.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +22 -24
- package/dist/index.es.js +38 -38
- package/dist/index.umd.js +22 -24
- package/dist/lib/components/Aside/styles.tsx +0 -1
- package/dist/lib/components/Avatar/Avatar.tsx +104 -102
- package/dist/lib/components/Main/styles.tsx +41 -42
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -754,37 +754,35 @@ React keys must be passed directly to JSX without using spread:
|
|
|
754
754
|
min-height: ${({$minHeight:l})=>w.stringifyPx(l)};
|
|
755
755
|
}
|
|
756
756
|
`;_([A1]);const L1=({"data-testid":l,as:c,ref:e,children:a,gap:h="l",backgroundColor:d="transparent",minHeight:i="100svh",...f})=>t.jsx(A1,{"data-testid":l,ref:e,as:c,$gap:h,$backgroundColor:d,$minHeight:i,...f,children:a}),n3=l=>typeof l=="number"?w.stringifyPx(l):new Map([["default",I2.MAIN_DEFAULT],["large",I2.MAIN_LARGE],["form",I2.MAIN_FORM],["full",I2.MAIN_FULL]]).get(l),R1=o.main`
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
${s.StretchTags}
|
|
757
|
+
position: relative;
|
|
758
|
+
width: 100%;
|
|
759
|
+
min-height: 100%;
|
|
760
|
+
max-width: ${({$size:l})=>n3(l||"default")};
|
|
761
|
+
padding: ${L.XXL} 0;
|
|
762
|
+
${s.Flexbox({$flexDirection:"column",$alignItems:"flex-start",$gap:"l"})}
|
|
763
|
+
${s.StretchTags}
|
|
765
764
|
|
|
766
765
|
& > * {
|
|
767
|
-
|
|
768
|
-
|
|
766
|
+
flex-shrink: 0;
|
|
767
|
+
}
|
|
769
768
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
769
|
+
${({$size:l,$contentSize:c})=>l==="full"&&o.css`
|
|
770
|
+
display: grid;
|
|
771
|
+
grid-template-columns: 1fr ${n3(c||"default")} 1fr;
|
|
773
772
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
773
|
+
& > * {
|
|
774
|
+
grid-column: 2;
|
|
775
|
+
}
|
|
776
|
+
`}
|
|
778
777
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
778
|
+
@media ${N.BREAKPOINT_TABLET_LARGE} {
|
|
779
|
+
height: unset;
|
|
780
|
+
min-height: unset;
|
|
781
|
+
padding: ${L.L} 0;
|
|
782
|
+
}
|
|
784
783
|
`;_([R1]);const j1=({"data-testid":l,as:c,ref:e,children:a,size:h="default",contentSize:d="default",...i})=>t.jsx(R1,{"data-testid":l,ref:e,as:c,$size:h,$contentSize:d,...i,children:a}),M3=l=>typeof l=="number"?w.stringifyPx(l):new Map([["default",I2.ASIDE_DEFAULT],["small",I2.ASIDE_SMALL]]).get(l),S1=o.aside`
|
|
785
784
|
position: relative;
|
|
786
785
|
width: 100%;
|
|
787
|
-
height: 100%;
|
|
788
786
|
min-height: 100%;
|
|
789
787
|
max-width: ${({$size:l})=>M3(l||"default")};
|
|
790
788
|
padding: ${L.XXL} 0;
|
|
@@ -1111,7 +1109,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1111
1109
|
${h?`#${h}`:`.${y}`} {
|
|
1112
1110
|
--avatar-size: ${m}px;
|
|
1113
1111
|
}
|
|
1114
|
-
`),console.log(z==null?void 0:z.fallbackBackgroundColor),t.jsxs(f4,{"data-testid":d&&l?`${l}.Avatar`:l,ref:d?void 0:e,as:d?"span":c,id:h,className:T(d&&a?"Avatar":a,C),$backgroundColor:i,$border:f,$borderRadius:r,$size:m,$contentColor:p,$fontSize:H,...u,children:[z&&t.jsx(D2,{"data-testid":l&&`${l}.Image`,className:a&&"Image",src:typeof z=="object"?z.src:z,alt:typeof z=="object"?z.alt:"Avatar",width:"100%",height:"100%",fit:"cover",imgFallback:typeof z=="object"?{text:z.fallback??"",fontSize:z.fallbackFontSize??H,background:z.fallbackBackgroundColor??i,textColor:z.fallbackFontColor??p}:void 0}),M&&M,v&&t.jsx(l2,{"data-testid":l&&`${l}.Icon`,className:a&&"Icon",icon:v,size:g,color:p,baseUrl:n})]})},$l=({"data-testid":l,as:c,ref:e,size:a=32,border:h,borderRadius:d="circle",badge:i,img:f,letter:r,icon:m,iconSize:p=h2(a),backgroundColor:z="danger",contentColor:M=z==="white"?"primary":z==="black"?"white":"background",className:v,containerStyle:g,...
|
|
1112
|
+
`),console.log(z==null?void 0:z.fallbackBackgroundColor),t.jsxs(f4,{"data-testid":d&&l?`${l}.Avatar`:l,ref:d?void 0:e,as:d?"span":c,id:h,className:T(d&&a?"Avatar":a,C),$backgroundColor:i,$border:f,$borderRadius:r,$size:m,$contentColor:p,$fontSize:H,...u,children:[z&&t.jsx(D2,{"data-testid":l&&`${l}.Image`,className:a&&"Image",src:typeof z=="object"?z.src:z,alt:typeof z=="object"?z.alt:"Avatar",width:"100%",height:"100%",fit:"cover",imgFallback:typeof z=="object"?{text:z.fallback??"",fontSize:z.fallbackFontSize??H,background:z.fallbackBackgroundColor??i,textColor:z.fallbackFontColor??p}:void 0}),M&&M,v&&t.jsx(l2,{"data-testid":l&&`${l}.Icon`,className:a&&"Icon",icon:v,size:g,color:p,baseUrl:n})]})},$l=({"data-testid":l,as:c,ref:e,size:a=32,border:h,borderRadius:d="circle",badge:i,img:f,letter:r,icon:m,iconSize:p=h2(a),backgroundColor:z="danger",contentColor:M=z==="white"?"primary":z==="black"?"white":"background",className:v,containerStyle:g,role:n="img",...H})=>{var A,$;const u=typeof i=="object",C=u&&i.size?i.size:8,y={"data-testid":l,as:c,className:v,hasBadge:!!i,backgroundColor:z,border:h,borderRadius:d,size:a,contentColor:M,img:f,letter:r,icon:m,iconSize:p,ref:e,role:n,...H};return i?t.jsxs(r4,{"data-testid":l,ref:e,as:c,className:v,style:g,$backgroundColor:z,$border:h,$borderRadius:d,$size:a,$contentColor:M,children:[t.jsx(k3,{...y}),t.jsx(m4,{"data-testid":l&&`${l}.Badge`,className:T({Badge:v},`Position${w.capitalize(u&&i.position?i.position:"top")}`),size:C,number:u&&i.content?i.content:void 0,backgroundColor:u&&i.backgroundColor?i.backgroundColor:void 0,contentColor:u&&i.contentColor?i.contentColor:void 0,padding:u&&i.padding?i.padding:void 0,$width:C,$paddingLeftRight:u&&typeof i.padding=="object"&&((A=i.padding)!=null&&A.leftRight)?($=i.padding)==null?void 0:$.leftRight:"0px",$outline:u&&i.outline?i.outline:void 0})]}):t.jsx(k3,{...y})},z0=({$size:l})=>o.css`
|
|
1115
1113
|
width: ${l&&w.stringifyPx(l)};
|
|
1116
1114
|
height: ${l&&w.stringifyPx(l)};
|
|
1117
1115
|
position: relative;
|
package/dist/index.es.js
CHANGED
|
@@ -6609,37 +6609,36 @@ const rl = ({
|
|
|
6609
6609
|
["form", F2.MAIN_FORM],
|
|
6610
6610
|
["full", F2.MAIN_FULL]
|
|
6611
6611
|
])).get(l), G1 = k.main`
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
${s.Flexbox({
|
|
6612
|
+
position: relative;
|
|
6613
|
+
width: 100%;
|
|
6614
|
+
min-height: 100%;
|
|
6615
|
+
max-width: ${({ $size: l }) => C3(l || "default")};
|
|
6616
|
+
padding: ${A.XXL} 0;
|
|
6617
|
+
${s.Flexbox({
|
|
6619
6618
|
$flexDirection: "column",
|
|
6620
6619
|
$alignItems: "flex-start",
|
|
6621
6620
|
$gap: "l"
|
|
6622
6621
|
})}
|
|
6623
|
-
|
|
6622
|
+
${s.StretchTags}
|
|
6624
6623
|
|
|
6625
6624
|
& > * {
|
|
6626
|
-
|
|
6627
|
-
|
|
6625
|
+
flex-shrink: 0;
|
|
6626
|
+
}
|
|
6628
6627
|
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6628
|
+
${({ $size: l, $contentSize: c }) => l === "full" && x`
|
|
6629
|
+
display: grid;
|
|
6630
|
+
grid-template-columns: 1fr ${C3(c || "default")} 1fr;
|
|
6632
6631
|
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6632
|
+
& > * {
|
|
6633
|
+
grid-column: 2;
|
|
6634
|
+
}
|
|
6635
|
+
`}
|
|
6637
6636
|
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6637
|
+
@media ${S.BREAKPOINT_TABLET_LARGE} {
|
|
6638
|
+
height: unset;
|
|
6639
|
+
min-height: unset;
|
|
6640
|
+
padding: ${A.L} 0;
|
|
6641
|
+
}
|
|
6643
6642
|
`;
|
|
6644
6643
|
j([G1]);
|
|
6645
6644
|
const ml = ({
|
|
@@ -6667,7 +6666,6 @@ const ml = ({
|
|
|
6667
6666
|
])).get(l), T1 = k.aside`
|
|
6668
6667
|
position: relative;
|
|
6669
6668
|
width: 100%;
|
|
6670
|
-
height: 100%;
|
|
6671
6669
|
min-height: 100%;
|
|
6672
6670
|
max-width: ${({ $size: l }) => $3(l || "default")};
|
|
6673
6671
|
padding: ${A.XXL} 0;
|
|
@@ -7981,10 +7979,11 @@ const R3 = ({
|
|
|
7981
7979
|
contentColor: n = z === "white" ? "primary" : z === "black" ? "white" : "background",
|
|
7982
7980
|
className: p,
|
|
7983
7981
|
containerStyle: M,
|
|
7984
|
-
|
|
7982
|
+
role: v = "img",
|
|
7983
|
+
...u
|
|
7985
7984
|
}) => {
|
|
7986
|
-
var
|
|
7987
|
-
const
|
|
7985
|
+
var $, C;
|
|
7986
|
+
const w = typeof i == "object", y = w && i.size ? i.size : 8, H = {
|
|
7988
7987
|
"data-testid": l,
|
|
7989
7988
|
as: c,
|
|
7990
7989
|
className: p,
|
|
@@ -7999,7 +7998,8 @@ const R3 = ({
|
|
|
7999
7998
|
icon: m,
|
|
8000
7999
|
iconSize: o,
|
|
8001
8000
|
ref: e,
|
|
8002
|
-
|
|
8001
|
+
role: v,
|
|
8002
|
+
...u
|
|
8003
8003
|
};
|
|
8004
8004
|
return i ? /* @__PURE__ */ t.jsxs(
|
|
8005
8005
|
z4,
|
|
@@ -8015,7 +8015,7 @@ const R3 = ({
|
|
|
8015
8015
|
$size: a,
|
|
8016
8016
|
$contentColor: n,
|
|
8017
8017
|
children: [
|
|
8018
|
-
/* @__PURE__ */ t.jsx(R3, { ...
|
|
8018
|
+
/* @__PURE__ */ t.jsx(R3, { ...H }),
|
|
8019
8019
|
/* @__PURE__ */ t.jsx(
|
|
8020
8020
|
v4,
|
|
8021
8021
|
{
|
|
@@ -8023,22 +8023,22 @@ const R3 = ({
|
|
|
8023
8023
|
className: D(
|
|
8024
8024
|
{ Badge: p },
|
|
8025
8025
|
`Position${A2(
|
|
8026
|
-
|
|
8026
|
+
w && i.position ? i.position : "top"
|
|
8027
8027
|
)}`
|
|
8028
8028
|
),
|
|
8029
|
-
size:
|
|
8030
|
-
number:
|
|
8031
|
-
backgroundColor:
|
|
8032
|
-
contentColor:
|
|
8033
|
-
padding:
|
|
8034
|
-
$width:
|
|
8035
|
-
$paddingLeftRight:
|
|
8036
|
-
$outline:
|
|
8029
|
+
size: y,
|
|
8030
|
+
number: w && i.content ? i.content : void 0,
|
|
8031
|
+
backgroundColor: w && i.backgroundColor ? i.backgroundColor : void 0,
|
|
8032
|
+
contentColor: w && i.contentColor ? i.contentColor : void 0,
|
|
8033
|
+
padding: w && i.padding ? i.padding : void 0,
|
|
8034
|
+
$width: y,
|
|
8035
|
+
$paddingLeftRight: w && typeof i.padding == "object" && (($ = i.padding) != null && $.leftRight) ? (C = i.padding) == null ? void 0 : C.leftRight : "0px",
|
|
8036
|
+
$outline: w && i.outline ? i.outline : void 0
|
|
8037
8037
|
}
|
|
8038
8038
|
)
|
|
8039
8039
|
]
|
|
8040
8040
|
}
|
|
8041
|
-
) : /* @__PURE__ */ t.jsx(R3, { ...
|
|
8041
|
+
) : /* @__PURE__ */ t.jsx(R3, { ...H });
|
|
8042
8042
|
}, y0 = ({ $size: l }) => x`
|
|
8043
8043
|
width: ${l && G(l)};
|
|
8044
8044
|
height: ${l && G(l)};
|
package/dist/index.umd.js
CHANGED
|
@@ -754,37 +754,35 @@ React keys must be passed directly to JSX without using spread:
|
|
|
754
754
|
min-height: ${({$minHeight:l})=>x.stringifyPx(l)};
|
|
755
755
|
}
|
|
756
756
|
`;_([d1]);const i1=({"data-testid":l,as:c,ref:e,children:a,gap:h="l",backgroundColor:d="transparent",minHeight:i="100svh",...r})=>t.jsx(d1,{"data-testid":l,ref:e,as:c,$gap:h,$backgroundColor:d,$minHeight:i,...r,children:a}),f1=l=>typeof l=="number"?x.stringifyPx(l):new Map([["default",I2.MAIN_DEFAULT],["large",I2.MAIN_LARGE],["form",I2.MAIN_FORM],["full",I2.MAIN_FULL]]).get(l),r1=s.main`
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
${o.StretchTags}
|
|
757
|
+
position: relative;
|
|
758
|
+
width: 100%;
|
|
759
|
+
min-height: 100%;
|
|
760
|
+
max-width: ${({$size:l})=>f1(l||"default")};
|
|
761
|
+
padding: ${L.XXL} 0;
|
|
762
|
+
${o.Flexbox({$flexDirection:"column",$alignItems:"flex-start",$gap:"l"})}
|
|
763
|
+
${o.StretchTags}
|
|
765
764
|
|
|
766
765
|
& > * {
|
|
767
|
-
|
|
768
|
-
|
|
766
|
+
flex-shrink: 0;
|
|
767
|
+
}
|
|
769
768
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
769
|
+
${({$size:l,$contentSize:c})=>l==="full"&&s.css`
|
|
770
|
+
display: grid;
|
|
771
|
+
grid-template-columns: 1fr ${f1(c||"default")} 1fr;
|
|
773
772
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
773
|
+
& > * {
|
|
774
|
+
grid-column: 2;
|
|
775
|
+
}
|
|
776
|
+
`}
|
|
778
777
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
778
|
+
@media ${N.BREAKPOINT_TABLET_LARGE} {
|
|
779
|
+
height: unset;
|
|
780
|
+
min-height: unset;
|
|
781
|
+
padding: ${L.L} 0;
|
|
782
|
+
}
|
|
784
783
|
`;_([r1]);const m1=({"data-testid":l,as:c,ref:e,children:a,size:h="default",contentSize:d="default",...i})=>t.jsx(r1,{"data-testid":l,ref:e,as:c,$size:h,$contentSize:d,...i,children:a}),s1=l=>typeof l=="number"?x.stringifyPx(l):new Map([["default",I2.ASIDE_DEFAULT],["small",I2.ASIDE_SMALL]]).get(l),o1=s.aside`
|
|
785
784
|
position: relative;
|
|
786
785
|
width: 100%;
|
|
787
|
-
height: 100%;
|
|
788
786
|
min-height: 100%;
|
|
789
787
|
max-width: ${({$size:l})=>s1(l||"default")};
|
|
790
788
|
padding: ${L.XXL} 0;
|
|
@@ -1111,7 +1109,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
1111
1109
|
${h?`#${h}`:`.${y}`} {
|
|
1112
1110
|
--avatar-size: ${m}px;
|
|
1113
1111
|
}
|
|
1114
|
-
`),console.log(p==null?void 0:p.fallbackBackgroundColor),t.jsxs(Y1,{"data-testid":d&&l?`${l}.Avatar`:l,ref:d?void 0:e,as:d?"span":c,id:h,className:G(d&&a?"Avatar":a,$),$backgroundColor:i,$border:r,$borderRadius:f,$size:m,$contentColor:z,$fontSize:C,...u,children:[p&&t.jsx(V2,{"data-testid":l&&`${l}.Image`,className:a&&"Image",src:typeof p=="object"?p.src:p,alt:typeof p=="object"?p.alt:"Avatar",width:"100%",height:"100%",fit:"cover",imgFallback:typeof p=="object"?{text:p.fallback??"",fontSize:p.fallbackFontSize??C,background:p.fallbackBackgroundColor??i,textColor:p.fallbackFontColor??z}:void 0}),M&&M,v&&t.jsx(l2,{"data-testid":l&&`${l}.Icon`,className:a&&"Icon",icon:v,size:g,color:z,baseUrl:n})]})},wl=({"data-testid":l,as:c,ref:e,size:a=32,border:h,borderRadius:d="circle",badge:i,img:r,letter:f,icon:m,iconSize:z=h2(a),backgroundColor:p="danger",contentColor:M=p==="white"?"primary":p==="black"?"white":"background",className:v,containerStyle:g,...
|
|
1112
|
+
`),console.log(p==null?void 0:p.fallbackBackgroundColor),t.jsxs(Y1,{"data-testid":d&&l?`${l}.Avatar`:l,ref:d?void 0:e,as:d?"span":c,id:h,className:G(d&&a?"Avatar":a,$),$backgroundColor:i,$border:r,$borderRadius:f,$size:m,$contentColor:z,$fontSize:C,...u,children:[p&&t.jsx(V2,{"data-testid":l&&`${l}.Image`,className:a&&"Image",src:typeof p=="object"?p.src:p,alt:typeof p=="object"?p.alt:"Avatar",width:"100%",height:"100%",fit:"cover",imgFallback:typeof p=="object"?{text:p.fallback??"",fontSize:p.fallbackFontSize??C,background:p.fallbackBackgroundColor??i,textColor:p.fallbackFontColor??z}:void 0}),M&&M,v&&t.jsx(l2,{"data-testid":l&&`${l}.Icon`,className:a&&"Icon",icon:v,size:g,color:z,baseUrl:n})]})},wl=({"data-testid":l,as:c,ref:e,size:a=32,border:h,borderRadius:d="circle",badge:i,img:r,letter:f,icon:m,iconSize:z=h2(a),backgroundColor:p="danger",contentColor:M=p==="white"?"primary":p==="black"?"white":"background",className:v,containerStyle:g,role:n="img",...C})=>{var R,A;const u=typeof i=="object",$=u&&i.size?i.size:8,y={"data-testid":l,as:c,className:v,hasBadge:!!i,backgroundColor:p,border:h,borderRadius:d,size:a,contentColor:M,img:r,letter:f,icon:m,iconSize:z,ref:e,role:n,...C};return i?t.jsxs(P1,{"data-testid":l,ref:e,as:c,className:v,style:g,$backgroundColor:p,$border:h,$borderRadius:d,$size:a,$contentColor:M,children:[t.jsx(F1,{...y}),t.jsx(U1,{"data-testid":l&&`${l}.Badge`,className:G({Badge:v},`Position${x.capitalize(u&&i.position?i.position:"top")}`),size:$,number:u&&i.content?i.content:void 0,backgroundColor:u&&i.backgroundColor?i.backgroundColor:void 0,contentColor:u&&i.contentColor?i.contentColor:void 0,padding:u&&i.padding?i.padding:void 0,$width:$,$paddingLeftRight:u&&typeof i.padding=="object"&&((R=i.padding)!=null&&R.leftRight)?(A=i.padding)==null?void 0:A.leftRight:"0px",$outline:u&&i.outline?i.outline:void 0})]}):t.jsx(F1,{...y})},s0=({$size:l})=>s.css`
|
|
1115
1113
|
width: ${l&&x.stringifyPx(l)};
|
|
1116
1114
|
height: ${l&&x.stringifyPx(l)};
|
|
1117
1115
|
position: relative;
|
|
@@ -35,111 +35,113 @@ import type { ILibAvatar } from "./types"
|
|
|
35
35
|
* <Avatar icon={<UserIcon />} badge={{ content: 1, backgroundColor: "danger" }} />
|
|
36
36
|
*/
|
|
37
37
|
export const Avatar: FC<ILibAvatar> = ({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
38
|
+
"data-testid": testid,
|
|
39
|
+
as,
|
|
40
|
+
ref,
|
|
41
|
+
size = 32,
|
|
42
|
+
border,
|
|
43
|
+
borderRadius = "circle",
|
|
44
|
+
badge,
|
|
45
|
+
img,
|
|
46
|
+
letter,
|
|
47
|
+
icon,
|
|
48
|
+
iconSize = roundIconSize(size),
|
|
49
|
+
backgroundColor = "danger",
|
|
50
|
+
contentColor = backgroundColor === "white"
|
|
51
|
+
? "primary"
|
|
52
|
+
: backgroundColor === "black"
|
|
53
|
+
? "white"
|
|
54
|
+
: "background",
|
|
55
|
+
className,
|
|
56
|
+
containerStyle,
|
|
57
|
+
role = "img",
|
|
58
|
+
...rest
|
|
58
59
|
}) => {
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const isBadgeObject = typeof badge === "object"
|
|
61
|
+
const badgeSize = isBadgeObject && badge.size ? badge.size : 8
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
const avatarProps = {
|
|
64
|
+
"data-testid": testid,
|
|
65
|
+
as,
|
|
66
|
+
className,
|
|
67
|
+
hasBadge: !!badge,
|
|
68
|
+
backgroundColor,
|
|
69
|
+
border,
|
|
70
|
+
borderRadius,
|
|
71
|
+
size,
|
|
72
|
+
contentColor,
|
|
73
|
+
img,
|
|
74
|
+
letter,
|
|
75
|
+
icon,
|
|
76
|
+
iconSize,
|
|
77
|
+
ref,
|
|
78
|
+
role,
|
|
79
|
+
...rest,
|
|
80
|
+
}
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
if (badge)
|
|
83
|
+
return (
|
|
84
|
+
<StyledAvatarContainer
|
|
85
|
+
data-testid={testid}
|
|
86
|
+
ref={ref}
|
|
87
|
+
as={as}
|
|
88
|
+
className={className}
|
|
89
|
+
style={containerStyle}
|
|
90
|
+
$backgroundColor={backgroundColor}
|
|
91
|
+
$border={border}
|
|
92
|
+
$borderRadius={borderRadius}
|
|
93
|
+
$size={size}
|
|
94
|
+
$contentColor={contentColor}
|
|
95
|
+
>
|
|
96
|
+
<AvatarFunction {...avatarProps} />
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
98
|
+
<StyledBadge
|
|
99
|
+
data-testid={testid && `${testid}.Badge`}
|
|
100
|
+
className={classNames(
|
|
101
|
+
{ Badge: className },
|
|
102
|
+
`Position${capitalize(
|
|
103
|
+
isBadgeObject && badge.position
|
|
104
|
+
? badge.position
|
|
105
|
+
: "top"
|
|
106
|
+
)}`
|
|
107
|
+
)}
|
|
108
|
+
size={badgeSize}
|
|
109
|
+
number={
|
|
110
|
+
isBadgeObject && badge.content
|
|
111
|
+
? badge.content
|
|
112
|
+
: undefined
|
|
113
|
+
}
|
|
114
|
+
backgroundColor={
|
|
115
|
+
isBadgeObject && badge.backgroundColor
|
|
116
|
+
? badge.backgroundColor
|
|
117
|
+
: undefined
|
|
118
|
+
}
|
|
119
|
+
contentColor={
|
|
120
|
+
isBadgeObject && badge.contentColor
|
|
121
|
+
? badge.contentColor
|
|
122
|
+
: undefined
|
|
123
|
+
}
|
|
124
|
+
padding={
|
|
125
|
+
isBadgeObject && badge.padding
|
|
126
|
+
? badge.padding
|
|
127
|
+
: undefined
|
|
128
|
+
}
|
|
129
|
+
$width={badgeSize}
|
|
130
|
+
$paddingLeftRight={
|
|
131
|
+
isBadgeObject &&
|
|
132
|
+
typeof badge.padding === "object" &&
|
|
133
|
+
badge.padding?.leftRight
|
|
134
|
+
? badge.padding?.leftRight
|
|
135
|
+
: "0px"
|
|
136
|
+
}
|
|
137
|
+
$outline={
|
|
138
|
+
isBadgeObject && badge.outline
|
|
139
|
+
? badge.outline
|
|
140
|
+
: undefined
|
|
141
|
+
}
|
|
142
|
+
/>
|
|
143
|
+
</StyledAvatarContainer>
|
|
144
|
+
)
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
return <AvatarFunction {...avatarProps} />
|
|
145
147
|
}
|
|
@@ -4,56 +4,55 @@ import { setDefaultTheme, Mixins, MEDIA, SPACERS, LAYOUTS } from "../../"
|
|
|
4
4
|
import type { LibMainSize } from "../../types"
|
|
5
5
|
|
|
6
6
|
const getMainSize = (size: LibMainSize) => {
|
|
7
|
-
|
|
7
|
+
if (typeof size === "number") return stringifyPx(size)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const sizesMap = new Map<LibMainSize, LAYOUTS>([
|
|
10
|
+
["default", LAYOUTS.MAIN_DEFAULT],
|
|
11
|
+
["large", LAYOUTS.MAIN_LARGE],
|
|
12
|
+
["form", LAYOUTS.MAIN_FORM],
|
|
13
|
+
["full", LAYOUTS.MAIN_FULL],
|
|
14
|
+
])
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
return sizesMap.get(size)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const StyledMain = styled.main<{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
$size?: LibMainSize
|
|
21
|
+
$contentSize?: Extract<LibMainSize, "default" | "large" | "form">
|
|
22
|
+
$minHeight: string | number
|
|
23
23
|
}>`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
${Mixins.StretchTags}
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
min-height: 100%;
|
|
27
|
+
max-width: ${({ $size }) => getMainSize($size || "default")};
|
|
28
|
+
padding: ${SPACERS.XXL} 0;
|
|
29
|
+
${Mixins.Flexbox({
|
|
30
|
+
$flexDirection: "column",
|
|
31
|
+
$alignItems: "flex-start",
|
|
32
|
+
$gap: "l",
|
|
33
|
+
})}
|
|
34
|
+
${Mixins.StretchTags}
|
|
36
35
|
|
|
37
36
|
& > * {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${({ $size, $contentSize }) =>
|
|
41
|
+
$size === "full" &&
|
|
42
|
+
css`
|
|
43
|
+
display: grid;
|
|
44
|
+
grid-template-columns: 1fr ${getMainSize($contentSize || "default")} 1fr;
|
|
45
|
+
|
|
46
|
+
& > * {
|
|
47
|
+
grid-column: 2;
|
|
48
|
+
}
|
|
49
|
+
`}
|
|
50
|
+
|
|
51
|
+
@media ${MEDIA.BREAKPOINT_TABLET_LARGE} {
|
|
52
|
+
height: unset;
|
|
53
|
+
min-height: unset;
|
|
54
|
+
padding: ${SPACERS.L} 0;
|
|
55
|
+
}
|
|
57
56
|
`
|
|
58
57
|
|
|
59
58
|
setDefaultTheme([StyledMain])
|