@thecb/components 11.9.0 → 11.10.0-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.9.0",
3
+ "version": "11.10.0-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -34,9 +34,17 @@ const cardBrands = {
34
34
  }
35
35
  };
36
36
 
37
+ const normalizeType = type => {
38
+ if (!type) return undefined;
39
+ const lower = type.toLowerCase();
40
+ if (lower === "mastercard") return "master_card";
41
+ return lower;
42
+ };
43
+
37
44
  const CardType = ({ type, size = "small" }) => {
45
+ const normalizedType = normalizeType(type);
38
46
  const { label, [size]: IconComponent } =
39
- cardBrands[type] || cardBrands.default;
47
+ cardBrands[normalizedType] || cardBrands.default;
40
48
  return (
41
49
  <span role="img" aria-label={label}>
42
50
  <IconComponent />
@@ -15,7 +15,7 @@ export const CreditCardWrapper = styled.div`
15
15
 
16
16
  export const CCIconWrapper = styled.div`
17
17
  margin-right: 16px;
18
- width: 30px;
18
+ width: 36px;
19
19
  height: auto;
20
20
  display: flex;
21
21
  `;
@@ -30,13 +30,13 @@ const FormattedCreditCard = ({
30
30
  }) => (
31
31
  <CreditCardWrapper>
32
32
  <CCIconWrapper>
33
- <CardType type={type} />
33
+ <CardType type={type} size="large" />
34
34
  </CCIconWrapper>
35
35
  <Stack childGap="0">
36
36
  <Box padding="0">
37
37
  <Text
38
38
  variant="p"
39
- padding="0 0 0 8px"
39
+ padding="0"
40
40
  color={themeValues.textColor}
41
41
  textAlign="left"
42
42
  extraStyles={`display: inline-block;`}
@@ -8,6 +8,8 @@ const AmExSmallIcon = () => {
8
8
  viewBox="0 0 24 16"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
+ role="img"
12
+ aria-label="American Express"
11
13
  >
12
14
  <g clipPath="url(#clip0_3693_1095)">
13
15
  <g clipPath="url(#clip1_3693_1095)">
@@ -8,6 +8,8 @@ const DiscoverSmallIcon = () => {
8
8
  viewBox="0 0 24 16"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
+ role="img"
12
+ aria-label="Discover"
11
13
  >
12
14
  <g clipPath="url(#clip0_3818_267)">
13
15
  <path
@@ -9,7 +9,7 @@ const GenericCardLarge = () => {
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
11
  role="img"
12
- aria-label="Card Payment"
12
+ aria-label="Credit card"
13
13
  >
14
14
  <rect width="36" height="24" rx="2" fill="#15749D" />
15
15
  <path
@@ -8,6 +8,8 @@ const GenericSmallIcon = () => {
8
8
  viewBox="0 0 24 16"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
+ role="img"
12
+ aria-label="Credit card"
11
13
  >
12
14
  <rect width="24" height="16" rx="2" fill="#15749D" />
13
15
  <path
@@ -8,6 +8,8 @@ const MasterCardSmallIcon = () => {
8
8
  viewBox="0 0 24 16"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
+ role="img"
12
+ aria-label="Mastercard"
11
13
  >
12
14
  <rect width="24" height="16" rx="1" fill="#F6F6F9" />
13
15
  <path
@@ -8,6 +8,8 @@ const VisaSmallIcon = () => {
8
8
  viewBox="0 0 24 16"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
+ role="img"
12
+ aria-label="Visa"
11
13
  >
12
14
  <path
13
15
  fillRule="evenodd"
@@ -69,8 +69,8 @@ const InnerRadioSection = ({
69
69
  `;
70
70
 
71
71
  const RightIcon = styled.img`
72
- height: ${({ isMobile }) => (isMobile ? "14px" : "18px")};
73
- width: ${({ isMobile }) => (isMobile ? "22px" : "28px")};
72
+ height: ${({ isMobile }) => (isMobile ? "16px" : "24px")};
73
+ width: ${({ isMobile }) => (isMobile ? "24px" : "36px")};
74
74
  ${({ fade }) => fade && "opacity: 0.4;"}
75
75
  transition: opacity 0.3s ease;
76
76
  `;