@thecb/components 4.0.3 → 4.0.7-beta.0

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": "4.0.3",
3
+ "version": "4.0.7-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,5 +1,5 @@
1
1
  import {
2
- STORM_GREY,
2
+ FIREFLY_GREY,
3
3
  MATISSE_BLUE,
4
4
  WHITE,
5
5
  SEASHELL_WHITE,
@@ -23,7 +23,7 @@ const inputBackgroundColor = {
23
23
  disabled: `${SEASHELL_WHITE}`
24
24
  };
25
25
  const color = { default: `${MINESHAFT_GREY}`, disabled: `${DUSTY_GREY}` };
26
- const labelColor = { default: `${STORM_GREY}`, disabled: `${STORM_GREY}` };
26
+ const labelColor = { default: `${FIREFLY_GREY}`, disabled: `${FIREFLY_GREY}` };
27
27
  const borderColor = { default: `${GREY_CHATEAU}`, disabled: `${GREY_CHATEAU}` };
28
28
  const lineHeight = { default: "1rem", disabled: "1rem" };
29
29
  const fontSize = { default: "0.875rem", disabled: "0.875rem" };
@@ -2,9 +2,11 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import GenericCard from "../icons/GenericCard";
4
4
  import Text from "../text";
5
- import { Stack } from "../layouts";
5
+ import Paragraph from "../paragraph";
6
+ import { Box, Stack } from "../layouts";
6
7
  import { fallbackValues } from "./FormattedCreditCard.theme";
7
8
  import { themeComponent } from "../../../util/themeUtils";
9
+ import { ASH_GREY } from "../../../constants/colors";
8
10
 
9
11
  export const CreditCardWrapper = styled.div`
10
12
  display: flex;
@@ -19,21 +21,33 @@ export const CCIconWrapper = styled.div`
19
21
  display: flex;
20
22
  `;
21
23
 
22
- const FormattedCreditCard = ({ lastFour, autoPay, themeValues }) => (
24
+ const FormattedCreditCard = ({
25
+ lastFour,
26
+ autoPay,
27
+ expireDate,
28
+ themeValues
29
+ }) => (
23
30
  <CreditCardWrapper>
24
31
  <CCIconWrapper>
25
32
  <GenericCard />
26
33
  </CCIconWrapper>
27
34
  <Stack childGap="0">
28
- <Text
29
- variant="p"
30
- padding="0 0 0 8px"
31
- color={themeValues.textColor}
32
- textAlign="left"
33
- extraStyles={`display: inline-block;`}
34
- >
35
- {`Card ending in ${lastFour}`}
36
- </Text>
35
+ <Box padding="0">
36
+ <Text
37
+ variant="p"
38
+ padding="0 0 0 8px"
39
+ color={themeValues.textColor}
40
+ textAlign="left"
41
+ extraStyles={`display: inline-block;`}
42
+ >
43
+ {`Card ending in ${lastFour}`}
44
+ </Text>
45
+ {expireDate && (
46
+ <Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
47
+ {`Exp ${expireDate}`}
48
+ </Paragraph>
49
+ )}
50
+ </Box>
37
51
  {autoPay && (
38
52
  <Text
39
53
  variant="p"
@@ -15,12 +15,14 @@ const Heading = ({
15
15
  extraStyles = ``,
16
16
  className,
17
17
  variant = "h1",
18
+ as = "h1",
18
19
  dataQa,
19
20
  children,
20
21
  ...rest
21
22
  }) => (
22
23
  <HeadingText
23
- as={variant}
24
+ variant={variant}
25
+ as={as}
24
26
  weight={weight}
25
27
  color={color}
26
28
  margin={margin}
@@ -5,12 +5,13 @@ import { Stack } from "../layouts";
5
5
  import Heading from "../heading";
6
6
  import Paragraph from "../paragraph";
7
7
 
8
- const LabeledAmount = ({ variant = "pL", label, amount, themeValues }) => {
8
+ const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
9
9
  const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
10
10
  return (
11
11
  <Stack direction="row">
12
12
  <LabeledAmountText
13
13
  variant={variant}
14
+ as={as}
14
15
  weight={themeValues.fontWeight}
15
16
  extraStyles="text-align: start; flex: 3;"
16
17
  >
@@ -18,6 +19,7 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues }) => {
18
19
  </LabeledAmountText>
19
20
  <LabeledAmountText
20
21
  variant={variant}
22
+ as={as}
21
23
  weight={themeValues.fontWeight}
22
24
  extraStyles="text-align: end; flex: 1;"
23
25
  >
@@ -27,8 +27,10 @@ export const BoxWrapper = styled(
27
27
  maxWidth,
28
28
  padding,
29
29
  hiddenStyles,
30
+ ariaControls,
31
+ ariaLabel,
30
32
  ...props
31
- }) => <div {...props} />
33
+ }) => <div aria-controls={ariaControls} aria-label={ariaLabel} {...props} />
32
34
  )`
33
35
  position: relative;
34
36
  box-sizing: border-box;
@@ -106,11 +108,5 @@ export const BoxWrapper = styled(
106
108
  css`
107
109
  ${extraStyles}
108
110
  `}
109
-
110
- ${({ hiddenStyles }) =>
111
- hiddenStyles &&
112
- css`
113
- display: none;
114
- `}
115
111
  `;
116
112
  /* eslint-enable no-unused-vars */
@@ -44,6 +44,7 @@ const HighlightTabRow = ({ tabs, highlightIndex, themeValues, isMobile }) => {
44
44
  highlightIndex == i ? themeValues.textColor : "transparent"
45
45
  }
46
46
  borderWidthOverride="0 0 3px 0"
47
+ extraStyles="text-align: center;"
47
48
  >
48
49
  <Text
49
50
  variant="p"
@@ -16,12 +16,11 @@ const Module = ({
16
16
  <Fragment>
17
17
  {heading && (
18
18
  <Heading
19
- variant={variant === "default" ? "h5" : "h3"}
19
+ variant={variant === "default" ? "h5" : "h2"}
20
20
  weight={themeValues.fontWeight}
21
21
  color={themeValues.fontColor}
22
22
  margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
23
23
  textAlign={themeValues.textAlign}
24
- aria-level={variant === "default" ? "3" : "1"}
25
24
  >
26
25
  {heading}
27
26
  </Heading>
@@ -5,7 +5,7 @@ const fontWeight = { default: "600", largeTitle: "700" };
5
5
  const fontColor = { default: CHARADE_GREY, largeTitle: CHARADE_GREY };
6
6
  const lineHeight = { default: "2rem", largeTitle: "2rem" };
7
7
  const textAlign = { default: "left", largeTitle: "left" };
8
- const titleType = { default: "h5", largeTitle: "h3" };
8
+ const titleType = { default: "h5", largeTitle: "h1" };
9
9
  const titleSpacing = { default: "0.5rem", largeTitle: "1.125rem" };
10
10
  const boxShadow = {
11
11
  default:
@@ -31,6 +31,7 @@ const PaymentDetailsContent = ({
31
31
  </Box>
32
32
  <SolidDivider />
33
33
  <LabeledAmount
34
+ as="h2"
34
35
  variant={themeValues.labeledAmountTotal}
35
36
  label="Total"
36
37
  amount={displayCurrency(total)}
@@ -123,14 +124,14 @@ const PaymentDetails = ({
123
124
  ) : isCollapsible ? (
124
125
  <Box width="100%" padding="none">
125
126
  <Cluster justify="space-between" align="center">
126
- <Heading variant="h6" weight="700">
127
+ <Heading variant="h5" weight="700" as="h1">
127
128
  {titleText}
128
129
  </Heading>
129
130
  {displayCurrency(total)}
130
131
  </Cluster>
131
132
  </Box>
132
133
  ) : (
133
- <Heading variant="h3" weight="700" margin="1rem 0 0 0">
134
+ <Heading as="h1" variant="h3" weight="700" margin="1rem 0 0 0">
134
135
  {titleText}
135
136
  </Heading>
136
137
  );
@@ -181,6 +181,7 @@ const RadioSection = ({
181
181
  key={icon.img}
182
182
  fade={!icon.enabled}
183
183
  isMobile={isMobile}
184
+ alt={icon.altText}
184
185
  />
185
186
  ))}
186
187
  </Cluster>