@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 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
- position: relative;
758
- width: 100%;
759
- height: 100%;
760
- min-height: 100%;
761
- max-width: ${({$size:l})=>n3(l||"default")};
762
- padding: ${L.XXL} 0;
763
- ${s.Flexbox({$flexDirection:"column",$alignItems:"flex-start",$gap:"l"})}
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
- flex-shrink: 0;
768
- }
766
+ flex-shrink: 0;
767
+ }
769
768
 
770
- ${({$size:l,$contentSize:c})=>l==="full"&&o.css`
771
- display: grid;
772
- grid-template-columns: 1fr ${n3(c||"default")} 1fr;
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
- grid-column: 2;
776
- }
777
- `}
773
+ & > * {
774
+ grid-column: 2;
775
+ }
776
+ `}
778
777
 
779
- @media ${N.BREAKPOINT_TABLET_LARGE} {
780
- height: unset;
781
- min-height: unset;
782
- padding: ${L.L} 0;
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,...n})=>{var y,A;const H=typeof i=="object",u=H&&i.size?i.size:8,C={"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,...n};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,{...C}),t.jsx(m4,{"data-testid":l&&`${l}.Badge`,className:T({Badge:v},`Position${w.capitalize(H&&i.position?i.position:"top")}`),size:u,number:H&&i.content?i.content:void 0,backgroundColor:H&&i.backgroundColor?i.backgroundColor:void 0,contentColor:H&&i.contentColor?i.contentColor:void 0,padding:H&&i.padding?i.padding:void 0,$width:u,$paddingLeftRight:H&&typeof i.padding=="object"&&((y=i.padding)!=null&&y.leftRight)?(A=i.padding)==null?void 0:A.leftRight:"0px",$outline:H&&i.outline?i.outline:void 0})]}):t.jsx(k3,{...C})},z0=({$size:l})=>o.css`
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
- position: relative;
6613
- width: 100%;
6614
- height: 100%;
6615
- min-height: 100%;
6616
- max-width: ${({ $size: l }) => C3(l || "default")};
6617
- padding: ${A.XXL} 0;
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
- ${s.StretchTags}
6622
+ ${s.StretchTags}
6624
6623
 
6625
6624
  & > * {
6626
- flex-shrink: 0;
6627
- }
6625
+ flex-shrink: 0;
6626
+ }
6628
6627
 
6629
- ${({ $size: l, $contentSize: c }) => l === "full" && x`
6630
- display: grid;
6631
- grid-template-columns: 1fr ${C3(c || "default")} 1fr;
6628
+ ${({ $size: l, $contentSize: c }) => l === "full" && x`
6629
+ display: grid;
6630
+ grid-template-columns: 1fr ${C3(c || "default")} 1fr;
6632
6631
 
6633
- & > * {
6634
- grid-column: 2;
6635
- }
6636
- `}
6632
+ & > * {
6633
+ grid-column: 2;
6634
+ }
6635
+ `}
6637
6636
 
6638
- @media ${S.BREAKPOINT_TABLET_LARGE} {
6639
- height: unset;
6640
- min-height: unset;
6641
- padding: ${A.L} 0;
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
- ...v
7982
+ role: v = "img",
7983
+ ...u
7985
7984
  }) => {
7986
- var H, $;
7987
- const u = typeof i == "object", w = u && i.size ? i.size : 8, y = {
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
- ...v
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, { ...y }),
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
- u && i.position ? i.position : "top"
8026
+ w && i.position ? i.position : "top"
8027
8027
  )}`
8028
8028
  ),
8029
- size: w,
8030
- number: u && i.content ? i.content : void 0,
8031
- backgroundColor: u && i.backgroundColor ? i.backgroundColor : void 0,
8032
- contentColor: u && i.contentColor ? i.contentColor : void 0,
8033
- padding: u && i.padding ? i.padding : void 0,
8034
- $width: w,
8035
- $paddingLeftRight: u && typeof i.padding == "object" && ((H = i.padding) != null && H.leftRight) ? ($ = i.padding) == null ? void 0 : $.leftRight : "0px",
8036
- $outline: u && i.outline ? i.outline : void 0
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, { ...y });
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
- position: relative;
758
- width: 100%;
759
- height: 100%;
760
- min-height: 100%;
761
- max-width: ${({$size:l})=>f1(l||"default")};
762
- padding: ${L.XXL} 0;
763
- ${o.Flexbox({$flexDirection:"column",$alignItems:"flex-start",$gap:"l"})}
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
- flex-shrink: 0;
768
- }
766
+ flex-shrink: 0;
767
+ }
769
768
 
770
- ${({$size:l,$contentSize:c})=>l==="full"&&s.css`
771
- display: grid;
772
- grid-template-columns: 1fr ${f1(c||"default")} 1fr;
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
- grid-column: 2;
776
- }
777
- `}
773
+ & > * {
774
+ grid-column: 2;
775
+ }
776
+ `}
778
777
 
779
- @media ${N.BREAKPOINT_TABLET_LARGE} {
780
- height: unset;
781
- min-height: unset;
782
- padding: ${L.L} 0;
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,...n})=>{var y,R;const C=typeof i=="object",u=C&&i.size?i.size:8,$={"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,...n};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,{...$}),t.jsx(U1,{"data-testid":l&&`${l}.Badge`,className:G({Badge:v},`Position${x.capitalize(C&&i.position?i.position:"top")}`),size:u,number:C&&i.content?i.content:void 0,backgroundColor:C&&i.backgroundColor?i.backgroundColor:void 0,contentColor:C&&i.contentColor?i.contentColor:void 0,padding:C&&i.padding?i.padding:void 0,$width:u,$paddingLeftRight:C&&typeof i.padding=="object"&&((y=i.padding)!=null&&y.leftRight)?(R=i.padding)==null?void 0:R.leftRight:"0px",$outline:C&&i.outline?i.outline:void 0})]}):t.jsx(F1,{...$})},s0=({$size:l})=>s.css`
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;
@@ -19,7 +19,6 @@ const StyledAside = styled.aside<{
19
19
  }>`
20
20
  position: relative;
21
21
  width: 100%;
22
- height: 100%;
23
22
  min-height: 100%;
24
23
  max-width: ${({ $size }) => getAsideSize($size || "default")};
25
24
  padding: ${SPACERS.XXL} 0;
@@ -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
- "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
- ...rest
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
- const isBadgeObject = typeof badge === "object"
60
- const badgeSize = isBadgeObject && badge.size ? badge.size : 8
60
+ const isBadgeObject = typeof badge === "object"
61
+ const badgeSize = isBadgeObject && badge.size ? badge.size : 8
61
62
 
62
- const avatarProps = {
63
- "data-testid": testid,
64
- as,
65
- className,
66
- hasBadge: !!badge,
67
- backgroundColor,
68
- border,
69
- borderRadius,
70
- size,
71
- contentColor,
72
- img,
73
- letter,
74
- icon,
75
- iconSize,
76
- ref,
77
- ...rest,
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
- if (badge)
81
- return (
82
- <StyledAvatarContainer
83
- data-testid={testid}
84
- ref={ref}
85
- as={as}
86
- className={className}
87
- style={containerStyle}
88
- $backgroundColor={backgroundColor}
89
- $border={border}
90
- $borderRadius={borderRadius}
91
- $size={size}
92
- $contentColor={contentColor}
93
- >
94
- <AvatarFunction {...avatarProps} />
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
- <StyledBadge
97
- data-testid={testid && `${testid}.Badge`}
98
- className={classNames(
99
- { Badge: className },
100
- `Position${capitalize(
101
- isBadgeObject && badge.position
102
- ? badge.position
103
- : "top"
104
- )}`
105
- )}
106
- size={badgeSize}
107
- number={
108
- isBadgeObject && badge.content
109
- ? badge.content
110
- : undefined
111
- }
112
- backgroundColor={
113
- isBadgeObject && badge.backgroundColor
114
- ? badge.backgroundColor
115
- : undefined
116
- }
117
- contentColor={
118
- isBadgeObject && badge.contentColor
119
- ? badge.contentColor
120
- : undefined
121
- }
122
- padding={
123
- isBadgeObject && badge.padding
124
- ? badge.padding
125
- : undefined
126
- }
127
- $width={badgeSize}
128
- $paddingLeftRight={
129
- isBadgeObject &&
130
- typeof badge.padding === "object" &&
131
- badge.padding?.leftRight
132
- ? badge.padding?.leftRight
133
- : "0px"
134
- }
135
- $outline={
136
- isBadgeObject && badge.outline
137
- ? badge.outline
138
- : undefined
139
- }
140
- />
141
- </StyledAvatarContainer>
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
- return <AvatarFunction {...avatarProps} />
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
- if (typeof size === "number") return stringifyPx(size)
7
+ if (typeof size === "number") return stringifyPx(size)
8
8
 
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
- ])
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
- return sizesMap.get(size)
16
+ return sizesMap.get(size)
17
17
  }
18
18
 
19
19
  const StyledMain = styled.main<{
20
- $size?: LibMainSize
21
- $contentSize?: Extract<LibMainSize, "default" | "large" | "form">
22
- $minHeight: string | number
20
+ $size?: LibMainSize
21
+ $contentSize?: Extract<LibMainSize, "default" | "large" | "form">
22
+ $minHeight: string | number
23
23
  }>`
24
- position: relative;
25
- width: 100%;
26
- height: 100%;
27
- min-height: 100%;
28
- max-width: ${({ $size }) => getMainSize($size || "default")};
29
- padding: ${SPACERS.XXL} 0;
30
- ${Mixins.Flexbox({
31
- $flexDirection: "column",
32
- $alignItems: "flex-start",
33
- $gap: "l",
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
- flex-shrink: 0;
39
- }
40
-
41
- ${({ $size, $contentSize }) =>
42
- $size === "full" &&
43
- css`
44
- display: grid;
45
- grid-template-columns: 1fr ${getMainSize($contentSize || "default")} 1fr;
46
-
47
- & > * {
48
- grid-column: 2;
49
- }
50
- `}
51
-
52
- @media ${MEDIA.BREAKPOINT_TABLET_LARGE} {
53
- height: unset;
54
- min-height: unset;
55
- padding: ${SPACERS.L} 0;
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])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julseb-lib/react",
3
- "version": "0.0.90",
3
+ "version": "0.0.91",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {