@julseb-lib/react 0.0.90 → 0.0.92
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 +454 -453
- package/dist/index.es.js +1092 -1089
- package/dist/index.umd.js +306 -305
- package/dist/lib/components/Aside/styles.tsx +28 -29
- package/dist/lib/components/Avatar/Avatar.tsx +104 -102
- package/dist/lib/components/Main/styles.tsx +42 -42
- package/dist/lib/components/Wrapper/styles.tsx +21 -19
- package/package.json +1 -1
|
@@ -4,43 +4,42 @@ import { setDefaultTheme, LAYOUTS, Mixins, SPACERS, MEDIA } from "../../"
|
|
|
4
4
|
import type { LibAsideSize } from "../../types"
|
|
5
5
|
|
|
6
6
|
const getAsideSize = (size: LibAsideSize) => {
|
|
7
|
-
|
|
7
|
+
if (typeof size === "number") return stringifyPx(size)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const sizesMap = new Map<LibAsideSize, LAYOUTS>([
|
|
10
|
+
["default", LAYOUTS.ASIDE_DEFAULT],
|
|
11
|
+
["small", LAYOUTS.ASIDE_SMALL],
|
|
12
|
+
])
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
return sizesMap.get(size)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const StyledAside = styled.aside<{
|
|
18
|
-
|
|
18
|
+
$size?: LibAsideSize
|
|
19
19
|
}>`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
${Mixins.StretchTags}
|
|
20
|
+
position: relative;
|
|
21
|
+
width: 100%;
|
|
22
|
+
min-height: 100%;
|
|
23
|
+
max-width: ${({ $size }) => getAsideSize($size || "default")};
|
|
24
|
+
padding: ${SPACERS.XXL} 0;
|
|
25
|
+
${Mixins.Flexbox({
|
|
26
|
+
$flexDirection: "column",
|
|
27
|
+
$alignItems: "flex-start",
|
|
28
|
+
$gap: "l",
|
|
29
|
+
})}
|
|
30
|
+
${Mixins.StretchTags}
|
|
32
31
|
|
|
33
32
|
& > * {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media ${MEDIA.BREAKPOINT_TABLET_SMALL} {
|
|
37
|
+
width: 100%;
|
|
38
|
+
max-width: unset;
|
|
39
|
+
height: unset;
|
|
40
|
+
min-height: unset;
|
|
41
|
+
padding: ${SPACERS.L} 0;
|
|
42
|
+
}
|
|
44
43
|
`
|
|
45
44
|
|
|
46
45
|
setDefaultTheme([StyledAside])
|
|
@@ -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,56 @@ 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_SMALL} {
|
|
52
|
+
height: unset;
|
|
53
|
+
min-height: unset;
|
|
54
|
+
max-width: unset;
|
|
55
|
+
padding: ${SPACERS.L} 0;
|
|
56
|
+
}
|
|
57
57
|
`
|
|
58
58
|
|
|
59
59
|
setDefaultTheme([StyledMain])
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import styled from "styled-components"
|
|
2
2
|
import { stringifyPx } from "@julseb-lib/utils"
|
|
3
|
-
import { MEDIA, Mixins, setDefaultTheme } from "../../"
|
|
3
|
+
import { MEDIA, Mixins, setDefaultTheme, SPACERS } from "../../"
|
|
4
4
|
import type { LibAllColors, LibSpacers } from "../../types"
|
|
5
5
|
|
|
6
6
|
const StyledWrapper = styled.section<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
$gap: LibSpacers
|
|
8
|
+
$backgroundColor: LibAllColors
|
|
9
|
+
$minHeight: string | number
|
|
10
10
|
}>`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
position: relative;
|
|
12
|
+
background-color: ${({ $backgroundColor, theme }) =>
|
|
13
|
+
Mixins.AllColors($backgroundColor, theme)};
|
|
14
|
+
min-height: ${({ $minHeight }) => stringifyPx($minHeight)};
|
|
15
|
+
padding: 0 ${SPACERS.XXL};
|
|
16
|
+
${({ $gap }) =>
|
|
17
|
+
Mixins.Flexbox({
|
|
18
|
+
$gap,
|
|
19
|
+
$justifyContent: "center",
|
|
20
|
+
})}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
@media ${MEDIA.BREAKPOINT_TABLET_SMALL} {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
min-height: ${({ $minHeight }) => stringifyPx($minHeight)};
|
|
27
|
+
padding: ${SPACERS.L} ${SPACERS.M};
|
|
28
|
+
}
|
|
27
29
|
`
|
|
28
30
|
|
|
29
31
|
setDefaultTheme([StyledWrapper])
|