@thecb/components 11.6.2 → 11.6.3-beta.1
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 +71 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.esm.js +71 -21
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/badge/Badge.js +39 -25
- package/src/components/atoms/badge/Badge.stories.js +24 -3
- package/src/components/atoms/badge/Badge.theme.js +49 -1
- package/src/components/atoms/badge/index.d.ts +1 -0
- package/src/components/atoms/index.d.ts +1 -0
- package/src/components/molecules/collapsible-section/index.d.ts +1 -1
- package/src/constants/style_constants.js +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import styled, { ThemeContext } from "styled-components";
|
|
3
3
|
import Box from "../layouts/Box";
|
|
4
4
|
import Text from "../../atoms/text/";
|
|
5
5
|
import { themeComponent } from "../../../util/themeUtils";
|
|
@@ -15,31 +15,45 @@ const StyledBadgeContainer = styled(Box)`
|
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
17
|
const StyledBadge = styled(Text)`
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
font-style: normal;
|
|
21
|
-
font-weight: 400;
|
|
22
|
-
line-height: 150%; /* 15px */
|
|
23
|
-
letter-spacing: 0.2px;
|
|
18
|
+
line-height: 150%;
|
|
19
|
+
letter-spacing: ${props => (props.isMobile ? "0.2px" : "0.24px")};
|
|
24
20
|
white-space: nowrap;
|
|
25
|
-
|
|
26
|
-
@media screen and (min-width: 1049px) {
|
|
27
|
-
font-size: 12px;
|
|
28
|
-
line-height: 150%; /* 18px */
|
|
29
|
-
letter-spacing: 0.24px;
|
|
30
|
-
}
|
|
31
21
|
`;
|
|
32
22
|
|
|
33
|
-
const Badge = ({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
const Badge = ({
|
|
24
|
+
label,
|
|
25
|
+
Icon,
|
|
26
|
+
themeValues,
|
|
27
|
+
iconOnLeft = true,
|
|
28
|
+
id,
|
|
29
|
+
extraStyles
|
|
30
|
+
}) => {
|
|
31
|
+
const { isMobile } = useContext(ThemeContext);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<StyledBadgeContainer
|
|
35
|
+
background={themeValues.background}
|
|
36
|
+
id={id}
|
|
37
|
+
extraStyles={extraStyles}
|
|
38
|
+
>
|
|
39
|
+
{iconOnLeft && Icon && (
|
|
40
|
+
<Icon color={themeValues.color} fill={themeValues.color} />
|
|
41
|
+
)}
|
|
42
|
+
<StyledBadge
|
|
43
|
+
color={themeValues.color}
|
|
44
|
+
weight={themeValues.fontWeight}
|
|
45
|
+
fontSize={
|
|
46
|
+
isMobile ? themeValues.fontSizeMobile : themeValues.fontSizeDesktop
|
|
47
|
+
}
|
|
48
|
+
isMobile={isMobile}
|
|
49
|
+
>
|
|
50
|
+
{label}
|
|
51
|
+
</StyledBadge>
|
|
52
|
+
{!iconOnLeft && Icon && (
|
|
53
|
+
<Icon color={themeValues.color} fill={themeValues.color} />
|
|
54
|
+
)}
|
|
55
|
+
</StyledBadgeContainer>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
44
58
|
|
|
45
59
|
export default themeComponent(Badge, "Badge", fallbackValues, "success");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
3
|
MANATEE_GREY,
|
|
4
|
-
MATISSE_BLUE,
|
|
5
4
|
ROYAL_BLUE_VIVID,
|
|
6
|
-
ZEST_ORANGE
|
|
5
|
+
ZEST_ORANGE,
|
|
6
|
+
CORNFLOWER_BLUE
|
|
7
7
|
} from "../../../constants/colors";
|
|
8
8
|
import Badge from "./Badge";
|
|
9
9
|
import { Box, Stack, Cluster } from "../layouts";
|
|
@@ -80,12 +80,30 @@ const PrimaryBadge = props => {
|
|
|
80
80
|
<Badge
|
|
81
81
|
{...props}
|
|
82
82
|
label={"Item in Cart"}
|
|
83
|
-
Icon={() => MultiCartIcon({
|
|
83
|
+
Icon={() => MultiCartIcon({ iconFill: ROYAL_BLUE_VIVID })}
|
|
84
84
|
variant="primary"
|
|
85
85
|
/>
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
const PrimaryHeadlineBadge = props => {
|
|
90
|
+
return <Badge {...props} label={"Kiosk"} variant="primaryHeadline" />;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const SecondaryBadge = props => {
|
|
94
|
+
return (
|
|
95
|
+
<Badge
|
|
96
|
+
{...props}
|
|
97
|
+
label={"Item in Cart"}
|
|
98
|
+
Icon={() => MultiCartIcon({ iconFill: CORNFLOWER_BLUE })}
|
|
99
|
+
variant="secondary"
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const SecondaryHeadlineBadge = props => {
|
|
105
|
+
return <Badge {...props} label={"Online"} variant="secondaryHeadline" />;
|
|
106
|
+
};
|
|
89
107
|
const InfoBadge = props => {
|
|
90
108
|
return (
|
|
91
109
|
<Badge
|
|
@@ -133,6 +151,9 @@ export const Badges = {
|
|
|
133
151
|
<SuccessBadge {...args} />
|
|
134
152
|
<DisabledBadge {...args} />
|
|
135
153
|
<PrimaryBadge {...args} />
|
|
154
|
+
<PrimaryHeadlineBadge {...args} />
|
|
155
|
+
<SecondaryBadge {...args} />
|
|
156
|
+
<SecondaryHeadlineBadge {...args} />
|
|
136
157
|
<WarnBadge {...args} />
|
|
137
158
|
</Cluster>
|
|
138
159
|
<Cluster justify="flex-start" align="center" childGap="1.5rem">
|
|
@@ -10,11 +10,20 @@ import {
|
|
|
10
10
|
SEA_GREEN,
|
|
11
11
|
ZEST_ORANGE
|
|
12
12
|
} from "../../../constants/colors";
|
|
13
|
+
import {
|
|
14
|
+
FONT_SIZE,
|
|
15
|
+
FONT_WEIGHT_REGULAR,
|
|
16
|
+
FONT_WEIGHT_SEMIBOLD
|
|
17
|
+
} from "../../../constants/style_constants";
|
|
18
|
+
import { fallbackValues as textTheme } from "../text/Text.theme";
|
|
13
19
|
|
|
14
20
|
const background = {
|
|
15
21
|
info: `${INFO_BLUE}`,
|
|
16
22
|
warn: `${HALF_COLONIAL_WHITE}`,
|
|
17
23
|
primary: `${CORNFLOWER_BLUE}`,
|
|
24
|
+
primaryHeadline: `${CORNFLOWER_BLUE}`,
|
|
25
|
+
secondary: `${ROYAL_BLUE_VIVID}`,
|
|
26
|
+
secondaryHeadline: `${ROYAL_BLUE_VIVID}`,
|
|
18
27
|
success: `${HINT_GREEN}`,
|
|
19
28
|
disabled: `${GRECIAN_GREY}`
|
|
20
29
|
};
|
|
@@ -23,11 +32,50 @@ const color = {
|
|
|
23
32
|
info: `${MATISSE_BLUE}`,
|
|
24
33
|
warn: `${ZEST_ORANGE}`,
|
|
25
34
|
primary: `${ROYAL_BLUE_VIVID}`,
|
|
35
|
+
primaryHeadline: `${ROYAL_BLUE_VIVID}`,
|
|
36
|
+
secondary: `${CORNFLOWER_BLUE}`,
|
|
37
|
+
secondaryHeadline: `${CORNFLOWER_BLUE}`,
|
|
26
38
|
success: `${SEA_GREEN}`,
|
|
27
39
|
disabled: `${MANATEE_GREY}`
|
|
28
40
|
};
|
|
29
41
|
|
|
42
|
+
const fontWeight = {
|
|
43
|
+
info: FONT_WEIGHT_REGULAR,
|
|
44
|
+
warn: FONT_WEIGHT_REGULAR,
|
|
45
|
+
primary: FONT_WEIGHT_REGULAR,
|
|
46
|
+
primaryHeadline: FONT_WEIGHT_SEMIBOLD,
|
|
47
|
+
secondary: FONT_WEIGHT_REGULAR,
|
|
48
|
+
secondaryHeadline: FONT_WEIGHT_SEMIBOLD,
|
|
49
|
+
success: FONT_WEIGHT_REGULAR,
|
|
50
|
+
disabled: FONT_WEIGHT_REGULAR
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const fontSizeMobile = {
|
|
54
|
+
info: textTheme.fontSize.pXXS,
|
|
55
|
+
warn: textTheme.fontSize.pXXS,
|
|
56
|
+
primary: textTheme.fontSize.pXXS,
|
|
57
|
+
primaryHeadline: textTheme.fontSize.pXS,
|
|
58
|
+
secondary: textTheme.fontSize.pXXS,
|
|
59
|
+
secondaryHeadline: textTheme.fontSize.pXS,
|
|
60
|
+
success: textTheme.fontSize.pXXS,
|
|
61
|
+
disabled: textTheme.fontSize.pXXS
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const fontSizeDesktop = {
|
|
65
|
+
info: textTheme.fontSize.pXS,
|
|
66
|
+
warn: textTheme.fontSize.pXS,
|
|
67
|
+
primary: textTheme.fontSize.pXS,
|
|
68
|
+
primaryHeadline: textTheme.fontSize.pS,
|
|
69
|
+
secondary: textTheme.fontSize.pXS,
|
|
70
|
+
secondaryHeadline: textTheme.fontSize.pS,
|
|
71
|
+
success: textTheme.fontSize.pXS,
|
|
72
|
+
disabled: textTheme.fontSize.pXS
|
|
73
|
+
};
|
|
74
|
+
|
|
30
75
|
export const fallbackValues = {
|
|
31
76
|
background,
|
|
32
|
-
color
|
|
77
|
+
color,
|
|
78
|
+
fontWeight,
|
|
79
|
+
fontSizeMobile,
|
|
80
|
+
fontSizeDesktop
|
|
33
81
|
};
|
|
@@ -5,6 +5,7 @@ export interface BadgeProps {
|
|
|
5
5
|
label: string;
|
|
6
6
|
Icon?: JSX.Element;
|
|
7
7
|
iconOnLeft?: boolean;
|
|
8
|
+
variant?: "info" | "warn" | "primary" | "primaryHeadline" | "secondary" | "secondaryHeadline" | "success" | "disabled";
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export const Badge: React.FC<Expand<BadgeProps> & HTMLAttributes<HTMLElement>>;
|