@thecb/components 9.3.5-beta.1 → 9.3.6-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": "9.3.5-beta.1",
3
+ "version": "9.3.6-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
package/src/.DS_Store ADDED
Binary file
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- const ShoppingCartIcon = () => (
3
+ const ShoppingCartIcon = ({ iconFill }) => (
4
4
  <svg
5
5
  width="32px"
6
6
  height="32px"
@@ -31,8 +31,7 @@ const ShoppingCartIcon = () => (
31
31
  <path
32
32
  d="M18.7499553,20.499994 C19.348912,20.499994 19.8632339,20.2851508 20.2929204,19.8554643 C20.7226068,19.4257779 20.9374501,18.911456 20.9374501,18.3124993 C20.9374501,17.8958334 20.8267735,17.5117199 20.6054196,17.1601583 C20.3840658,16.8085966 20.0780771,16.5416703 19.6874531,16.3593789 L19.6874531,16.3593789 L19.9218275,15.3828187 C19.9739105,15.0963613 19.9088069,14.835945 19.7265155,14.6015706 C19.544224,14.3671962 19.3098496,14.2500089 19.0233921,14.2500089 L19.0233921,14.2500089 L8.5156047,14.2500089 L8.28123026,13.0000119 L19.7265155,13.0000119 C19.9348481,13.0000119 20.1236501,12.9349077 20.2929204,12.8046999 C20.4621906,12.6744921 20.5728678,12.4922006 20.6249508,12.2578262 L20.6249508,12.2578262 L22.4608839,4.13284556 C22.5390088,3.84638811 22.4869258,3.58597187 22.3046343,3.35159742 C22.1223429,3.11722298 21.8749478,3.00004172 21.5624486,3.00004172 L21.5624486,3.00004172 L6.21092269,3.00004172 L5.85936103,1.24222745 C5.80727802,1.03389482 5.6966008,0.858113985 5.52733057,0.714884961 C5.35806034,0.571655937 5.16925831,0.500041723 4.96092567,0.500041723 L4.96092567,0.500041723 L0.937497765,0.500041723 C0.67708152,0.500041723 0.455728279,0.591187141 0.273436848,0.773478571 C0.0911454173,0.955770002 0,1.17712324 0,1.43753949 L0,1.43753949 L0,2.062538 C0,2.32295424 0.0911454173,2.54430748 0.273436848,2.72659891 C0.455728279,2.90889035 0.67708152,3.00004172 0.937497765,3.00004172 L0.937497765,3.00004172 L3.67186625,3.00004172 L6.40623473,16.3984413 C6.06769367,16.606774 5.80076742,16.8802108 5.60545539,17.2187519 C5.41014335,17.5572929 5.31248733,17.9218752 5.31248733,18.3124993 C5.31248733,18.911456 5.52733057,19.4257779 5.95701705,19.8554643 C6.38670352,20.2851508 6.90102541,20.499994 7.49998212,20.499994 C8.09893883,20.499994 8.61326071,20.2851508 9.04294719,19.8554643 C9.47263367,19.4257779 9.6874769,18.904946 9.6874769,18.2929681 C9.6874769,17.6809901 9.46612307,17.1666689 9.02341599,16.750003 L9.02341599,16.750003 L17.2265214,16.750003 C16.7838143,17.1666689 16.5624605,17.6809901 16.5624605,18.2929681 C16.5624605,18.904946 16.7773037,19.4257779 17.2069902,19.8554643 C17.6366767,20.2851508 18.1509986,20.499994 18.7499553,20.499994 Z"
33
33
  id="cart-badge-shopping-cart"
34
- fill="#FFFFFF"
35
- fillRule="nonzero"
34
+ fill={iconFill ?? "#FFFFFF"}
36
35
  ></path>
37
36
  </g>
38
37
  </g>
@@ -20,7 +20,8 @@ const Jumbo = ({
20
20
  total,
21
21
  itemsCount,
22
22
  showCartStatus = false,
23
- openCartSlider
23
+ openCartSlider,
24
+ extraStyles
24
25
  }) => {
25
26
  const { isMobile } = useContext(ThemeContext);
26
27
  return (
@@ -29,6 +30,7 @@ const Jumbo = ({
29
30
  minHeight="65px"
30
31
  id={`heroImage-${slug}`}
31
32
  className="themeJumboBackground"
33
+ extraStyles={extraStyles}
32
34
  >
33
35
  <Center maxWidth="76.5rem">
34
36
  <Cover singleChild minHeight="65px">
@@ -1,14 +1,39 @@
1
1
  import React from "react";
2
2
  import { fallbackValues } from "./LabeledAmount.theme";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
- import LabeledAmountV1 from "./LabeledAmountV1";
5
- import LabeledAmountV2 from "./LabeledAmountV2";
4
+ import { Stack } from "../layouts";
5
+ import Heading from "../heading";
6
+ import Paragraph from "../paragraph";
6
7
 
7
- const LabeledAmount = ({ version = "v1", ...rest }) => {
8
- const LabeledAmountComponent =
9
- version === "v1" ? LabeledAmountV1 : LabeledAmountV2;
10
-
11
- return <LabeledAmountComponent {...rest} />;
8
+ const LabeledAmount = ({
9
+ variant = "pL",
10
+ label,
11
+ amount,
12
+ themeValues,
13
+ as,
14
+ extraStyles
15
+ }) => {
16
+ const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
17
+ return (
18
+ <Stack direction="row">
19
+ <LabeledAmountText
20
+ variant={variant}
21
+ as={as}
22
+ weight={themeValues.fontWeight}
23
+ extraStyles={`${extraStyles}; text-align: start; flex: 3;`}
24
+ >
25
+ {label}:
26
+ </LabeledAmountText>
27
+ <LabeledAmountText
28
+ variant={variant}
29
+ as={as}
30
+ weight={themeValues.fontWeight}
31
+ extraStyles={`${extraStyles}; text-align: end; flex: 1;`}
32
+ >
33
+ {amount}
34
+ </LabeledAmountText>
35
+ </Stack>
36
+ );
12
37
  };
13
38
 
14
39
  export default themeComponent(
@@ -9,29 +9,16 @@ const variants = {
9
9
  p: "p",
10
10
  pL: "pL",
11
11
  h6: "h6",
12
- small: "small",
13
- regular: "regular",
14
- large: "large",
15
12
  None: undefined
16
13
  };
17
14
  const defaultValue = "default";
18
-
19
- const versionsLabel = "version";
20
- const versions = {
21
- v1: "v1",
22
- v2: "v2"
23
- };
24
- const defaultVersion = "v1";
25
-
26
15
  const groupId = "props";
27
16
 
28
17
  export const labeledAmount = () => (
29
18
  <LabeledAmount
30
19
  variant={select(variantsLabel, variants, defaultValue, groupId)}
31
- as={text("as", "p", groupId)}
32
20
  label={text("label", "Amount", groupId)}
33
21
  amount={text("amount", "$1.23", groupId)}
34
- version={select(versionsLabel, versions, defaultVersion, groupId)}
35
22
  />
36
23
  );
37
24
 
@@ -1,15 +1,9 @@
1
1
  const fontWeight = {
2
- // v1 variants
3
2
  default: "600",
4
3
  pS: "600",
5
4
  p: "600",
6
5
  pL: "600",
7
- h6: "700",
8
- // v2 variants
9
- regular: "600", // fontsize Detail large
10
- extraSmall: "600", //fontsize Detail small
11
- small: "600", // fontsize Detail regular
12
- large: "700" // fontsize Title small
6
+ h6: "700"
13
7
  };
14
8
 
15
9
  export const fallbackValues = {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { Stack } from "../layouts";
3
- import Detail from "../detail";
2
+ import { Cluster, Stack } from "../layouts";
3
+ import Paragraph from "../paragraph";
4
4
  import { themeComponent } from "../../../util/themeUtils";
5
5
  import { fallbackValues } from "./LineItem.theme";
6
6
  import { STORM_GREY } from "../../../constants/colors";
@@ -28,29 +28,43 @@ const LineItem = ({
28
28
  attr => visibleFields?.includes(attr.key) && attr.key !== "description"
29
29
  )
30
30
  ?.map(attr => (
31
- <Detail variant="small" weight="400" key={attr.key} color={STORM_GREY}>
31
+ <Paragraph variant="pS" weight="400" key={attr.key} color={STORM_GREY}>
32
32
  {`${formatAttrKeys(attr.key)}: ${attr.value}`}
33
- </Detail>
33
+ </Paragraph>
34
34
  ));
35
+
35
36
  return (
36
- <Stack childGap="0px">
37
- <Detail
38
- as="h3"
39
- variant={themeValues.detailVariant}
40
- weight={themeValues.weightTitle}
41
- extraStyles={`display: flex; justify-content: space-between;`}
42
- >
43
- <span>{description}</span>
44
- <span>{!!displayQuantity && `x${displayQuantity}`}</span>
45
- <span>{amount}</span>
46
- </Detail>
47
- <Detail as="p" variant={themeValues.detailVariant} weight="400">
48
- {subDescription}
49
- </Detail>
50
- {visibleCustomAttrs && (
51
- <Stack childGap="0.25rem">{visibleCustomAttrs}</Stack>
37
+ <Cluster nowrap justify="space-between" align="start">
38
+ <Stack childGap="0px">
39
+ <Paragraph
40
+ variant={themeValues.paragraphVariant}
41
+ weight={themeValues.weightTitle}
42
+ >
43
+ {description}
44
+ </Paragraph>
45
+ <Paragraph variant={themeValues.paragraphVariant} weight="400">
46
+ {subDescription}
47
+ </Paragraph>
48
+ {visibleCustomAttrs && (
49
+ <Stack childGap="0.25rem">{visibleCustomAttrs}</Stack>
50
+ )}
51
+ </Stack>
52
+ {!!displayQuantity && (
53
+ <Paragraph
54
+ variant={themeValues.paragraphVariant}
55
+ weight={themeValues.weightTitle}
56
+ >
57
+ {`x${displayQuantity}`}
58
+ </Paragraph>
52
59
  )}
53
- </Stack>
60
+ <Paragraph
61
+ variant={themeValues.paragraphVariant}
62
+ weight="600"
63
+ extraStyles="margin: 0; text-align: end; min-width: fit-content; padding-left: 32px;"
64
+ >
65
+ {amount}
66
+ </Paragraph>
67
+ </Cluster>
54
68
  );
55
69
  };
56
70
 
@@ -1,7 +1,7 @@
1
1
  const weightTitle = { default: "600", small: "400" };
2
- const detailVariant = { default: "large", small: "small" };
2
+ const paragraphVariant = { default: "pL", small: "pS" };
3
3
 
4
4
  export const fallbackValues = {
5
5
  weightTitle,
6
- detailVariant
6
+ paragraphVariant
7
7
  };
@@ -4,7 +4,7 @@ import AriaModal from "react-aria-modal";
4
4
  import { WHITE, ATHENS_GREY, SILVER_GREY } from "../../../constants/colors";
5
5
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
6
6
  import Paragraph from "../../atoms/paragraph";
7
- import Title from "../../atoms/title";
7
+ import Heading from "../../atoms/heading";
8
8
  import ButtonWithAction from "../../atoms/button-with-action";
9
9
  import { Box, Stack, Cluster } from "../../atoms/layouts";
10
10
 
@@ -84,9 +84,9 @@ const Modal = ({
84
84
  >
85
85
  <Box background={modalHeaderBg} padding="1.5rem">
86
86
  <Cluster justify="flex-start" align="center">
87
- <Title as="h2" weight={FONT_WEIGHT_SEMIBOLD} fontSize="1.25rem">
87
+ <Heading variant="h6" weight={FONT_WEIGHT_SEMIBOLD}>
88
88
  {modalHeaderText}
89
- </Title>
89
+ </Heading>
90
90
  </Cluster>
91
91
  </Box>
92
92
  <Box background={modalBodyBg} padding="1.5rem">
@@ -1,5 +1,12 @@
1
1
  import React, { useState, Fragment } from "react";
2
- import { Stack, Cluster, Box, Motion } from "../../atoms/layouts";
2
+ import {
3
+ Stack,
4
+ Cluster,
5
+ Box,
6
+ Motion,
7
+ Cover,
8
+ Center
9
+ } from "../../atoms/layouts";
3
10
  import { fallbackValues } from "./PaymentDetails.theme";
4
11
 
5
12
  import { displayCurrency } from "../../../util/general";
@@ -15,7 +22,7 @@ import {
15
22
  FONT_WEIGHT_BOLD,
16
23
  FONT_WEIGHT_REGULAR
17
24
  } from "../../../constants/style_constants";
18
- import { ATHENS_GREY } from "../../../constants/colors";
25
+ import { ATHENS_GREY, GRECIAN_GREY } from "../../../constants/colors";
19
26
  import ButtonWithAction from "../../atoms/button-with-action";
20
27
  import Text from "../../atoms/text";
21
28
  import Alert from "../../atoms/alert";
@@ -77,9 +84,6 @@ const PaymentDetailsContent = ({
77
84
  <SolidDivider />
78
85
  </Box>
79
86
  <LabeledAmount
80
- version="v2"
81
- as="h3"
82
- variant="small"
83
87
  extraStyles={`font-weight: ${FONT_WEIGHT_REGULAR}; font-size: 14px;`}
84
88
  label="Amount paid"
85
89
  amount={displayCurrency(voidableAmountPaid)}
@@ -93,11 +97,9 @@ const PaymentDetailsContent = ({
93
97
  <>
94
98
  <Box padding="0.5rem 0">
95
99
  <LabeledAmount
96
- version="v2"
97
100
  variant={themeValues.labeledAmountSubtotal}
98
101
  label="Subtotal"
99
102
  amount={displayCurrency(subtotal)}
100
- as="h3"
101
103
  />
102
104
  {feeElems}
103
105
  </Box>
@@ -107,14 +109,13 @@ const PaymentDetailsContent = ({
107
109
  <></>
108
110
  )}
109
111
  <LabeledAmount
110
- version="v2"
111
- as="h3"
112
+ as="p"
112
113
  variant={themeValues.labeledAmountTotal}
113
114
  label={hasVoidablePaymentsSection ? "Remaining amount due" : "Total"}
114
115
  amount={displayCurrency(
115
116
  typeof remainingBalance === "number" ? remainingBalance : total
116
117
  )}
117
- extraStyles={`margin-top: 1rem;`}
118
+ extraStyles={variant === "small" && `font-weight: ${FONT_WEIGHT_BOLD};`}
118
119
  />
119
120
  </Stack>
120
121
  );
@@ -276,8 +277,6 @@ const PaymentDetails = ({
276
277
  <Fragment key={fee.label}>
277
278
  <Box padding="4px 0" />
278
279
  <LabeledAmount
279
- version="v2"
280
- as="h3"
281
280
  key={fee.label}
282
281
  variant={themeValues.labeledAmountSubtotal}
283
282
  {...fee}
@@ -329,7 +328,7 @@ const PaymentDetails = ({
329
328
  <Cluster justify="space-between" align="center">
330
329
  <Title
331
330
  weight={FONT_WEIGHT_BOLD}
332
- as="h2"
331
+ as="h1"
333
332
  extraStyles={`font-size: 1.375rem;`}
334
333
  id="payment-details-title"
335
334
  >
@@ -346,7 +345,7 @@ const PaymentDetails = ({
346
345
  </Box>
347
346
  ) : (
348
347
  <Title
349
- as="h2"
348
+ as="h1"
350
349
  weight={FONT_WEIGHT_BOLD}
351
350
  margin="1rem 0 0 0"
352
351
  extraStyles={`font-size: 1.75rem;`}
@@ -46,42 +46,6 @@ const payment = {
46
46
  description: "0034 Bednar Mission Unit: 79",
47
47
  quantity: 1,
48
48
  subDescription: "PIN: 71-83-630-216-0724"
49
- },
50
- {
51
- amount: 42042,
52
- customAttributes: [
53
- {
54
- key: "parcel_id",
55
- value: "71-83-630-216-0724"
56
- },
57
- {
58
- key: "property_city",
59
- value: "North Breana"
60
- },
61
- {
62
- key: "property_class",
63
- value: "7-91"
64
- },
65
- {
66
- key: "property_secondary_address",
67
- value: "79"
68
- },
69
- {
70
- key: "property_street_address",
71
- value: "0034 Bednar Mission"
72
- },
73
- {
74
- key: "property_zip_code",
75
- value: "80326-6917"
76
- },
77
- {
78
- key: "tax_rate",
79
- value: "7.076"
80
- }
81
- ],
82
- description: "42 Bednar Mission Unit: 42",
83
- quantity: 1,
84
- subDescription: "PIN: 71-83-630-216-0724"
85
49
  }
86
50
  ],
87
51
  subtotal: 77294,
@@ -1,7 +1,7 @@
1
1
  const backgroundColor = { default: "transparent", small: "transparent" };
2
2
  const lineItem = { default: "default", small: "small" };
3
- const labeledAmountSubtotal = { default: "regular", small: "small" };
4
- const labeledAmountTotal = { default: "large", small: "small" };
3
+ const labeledAmountSubtotal = { default: "pL", small: "pS" };
4
+ const labeledAmountTotal = { default: "h6", small: "p" };
5
5
 
6
6
  export const fallbackValues = {
7
7
  backgroundColor,
@@ -1,37 +0,0 @@
1
- import React from "react";
2
- import { Stack } from "../layouts";
3
- import Heading from "../heading";
4
- import Paragraph from "../paragraph";
5
-
6
- const LabeledAmountV1 = ({
7
- variant = "pL",
8
- label,
9
- amount,
10
- themeValues,
11
- as,
12
- extraStyles
13
- }) => {
14
- const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
15
- return (
16
- <Stack direction="row">
17
- <LabeledAmountText
18
- variant={variant}
19
- as={as}
20
- weight={themeValues.fontWeight}
21
- extraStyles={`${extraStyles}; text-align: start; flex: 3;`}
22
- >
23
- {label}:
24
- </LabeledAmountText>
25
- <LabeledAmountText
26
- variant={variant}
27
- as={as}
28
- weight={themeValues.fontWeight}
29
- extraStyles={`${extraStyles}; text-align: end; flex: 1;`}
30
- >
31
- {amount}
32
- </LabeledAmountText>
33
- </Stack>
34
- );
35
- };
36
-
37
- export default LabeledAmountV1;
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- import Detail from "../detail";
3
- import Title from "../title";
4
-
5
- const LabeledAmountV2 = ({
6
- variant = "regular",
7
- label,
8
- amount,
9
- themeValues,
10
- as,
11
- extraStyles
12
- }) => {
13
- const mappedDetailVariants = {
14
- regular: "large",
15
- small: "regular",
16
- extraSmall: "small"
17
- };
18
- const LabeledAmountContainer = variant === "large" ? Title : Detail;
19
- const containerVariant =
20
- variant === "large" ? "small" : mappedDetailVariants[variant];
21
- return (
22
- <LabeledAmountContainer
23
- variant={containerVariant}
24
- as={as}
25
- weight={themeValues.fontWeight}
26
- extraStyles={`display: flex; justify-content: space-between; ${extraStyles}`}
27
- >
28
- <span>{label}</span>
29
- <span>{amount}</span>
30
- </LabeledAmountContainer>
31
- );
32
- };
33
-
34
- export default LabeledAmountV2;