@thecb/components 9.4.0 → 9.4.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": "9.4.0",
3
+ "version": "9.4.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,39 +1,14 @@
1
1
  import React from "react";
2
2
  import { fallbackValues } from "./LabeledAmount.theme";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
- import { Stack } from "../layouts";
5
- import Heading from "../heading";
6
- import Paragraph from "../paragraph";
4
+ import LabeledAmountV1 from "./LabeledAmountV1";
5
+ import LabeledAmountV2 from "./LabeledAmountV2";
7
6
 
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
- );
7
+ const LabeledAmount = ({ version = "v1", ...rest }) => {
8
+ const LabeledAmountComponent =
9
+ version === "v1" ? LabeledAmountV1 : LabeledAmountV2;
10
+
11
+ return <LabeledAmountComponent {...rest} />;
37
12
  };
38
13
 
39
14
  export default themeComponent(
@@ -9,16 +9,29 @@ const variants = {
9
9
  p: "p",
10
10
  pL: "pL",
11
11
  h6: "h6",
12
+ small: "small",
13
+ regular: "regular",
14
+ large: "large",
12
15
  None: undefined
13
16
  };
14
17
  const defaultValue = "default";
18
+
19
+ const versionsLabel = "version";
20
+ const versions = {
21
+ v1: "v1",
22
+ v2: "v2"
23
+ };
24
+ const defaultVersion = "v1";
25
+
15
26
  const groupId = "props";
16
27
 
17
28
  export const labeledAmount = () => (
18
29
  <LabeledAmount
19
30
  variant={select(variantsLabel, variants, defaultValue, groupId)}
31
+ as={text("as", "p", groupId)}
20
32
  label={text("label", "Amount", groupId)}
21
33
  amount={text("amount", "$1.23", groupId)}
34
+ version={select(versionsLabel, versions, defaultVersion, groupId)}
22
35
  />
23
36
  );
24
37
 
@@ -1,9 +1,15 @@
1
1
  const fontWeight = {
2
+ // v1 variants
2
3
  default: "600",
3
4
  pS: "600",
4
5
  p: "600",
5
6
  pL: "600",
6
- h6: "700"
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
7
13
  };
8
14
 
9
15
  export const fallbackValues = {
@@ -0,0 +1,37 @@
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;
@@ -0,0 +1,34 @@
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;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { Cluster, Stack } from "../layouts";
3
- import Paragraph from "../paragraph";
2
+ import { Stack } from "../layouts";
3
+ import Detail from "../detail";
4
4
  import { themeComponent } from "../../../util/themeUtils";
5
5
  import { fallbackValues } from "./LineItem.theme";
6
6
  import { STORM_GREY } from "../../../constants/colors";
@@ -28,43 +28,29 @@ const LineItem = ({
28
28
  attr => visibleFields?.includes(attr.key) && attr.key !== "description"
29
29
  )
30
30
  ?.map(attr => (
31
- <Paragraph variant="pS" weight="400" key={attr.key} color={STORM_GREY}>
31
+ <Detail variant="small" weight="400" key={attr.key} color={STORM_GREY}>
32
32
  {`${formatAttrKeys(attr.key)}: ${attr.value}`}
33
- </Paragraph>
33
+ </Detail>
34
34
  ));
35
-
36
35
  return (
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>
59
- )}
60
- <Paragraph
61
- variant={themeValues.paragraphVariant}
62
- weight="600"
63
- extraStyles="margin: 0; text-align: end; min-width: fit-content; padding-left: 32px;"
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;`}
64
42
  >
65
- {amount}
66
- </Paragraph>
67
- </Cluster>
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>
52
+ )}
53
+ </Stack>
68
54
  );
69
55
  };
70
56
 
@@ -1,7 +1,7 @@
1
1
  const weightTitle = { default: "600", small: "400" };
2
- const paragraphVariant = { default: "pL", small: "pS" };
2
+ const detailVariant = { default: "large", small: "small" };
3
3
 
4
4
  export const fallbackValues = {
5
5
  weightTitle,
6
- paragraphVariant
6
+ detailVariant
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 Heading from "../../atoms/heading";
7
+ import Title from "../../atoms/title";
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
- <Heading variant="h6" weight={FONT_WEIGHT_SEMIBOLD}>
87
+ <Title as="h2" weight={FONT_WEIGHT_SEMIBOLD} fontSize="1.25rem">
88
88
  {modalHeaderText}
89
- </Heading>
89
+ </Title>
90
90
  </Cluster>
91
91
  </Box>
92
92
  <Box background={modalBodyBg} padding="1.5rem">
@@ -1,12 +1,5 @@
1
1
  import React, { useState, Fragment } from "react";
2
- import {
3
- Stack,
4
- Cluster,
5
- Box,
6
- Motion,
7
- Cover,
8
- Center
9
- } from "../../atoms/layouts";
2
+ import { Stack, Cluster, Box, Motion } from "../../atoms/layouts";
10
3
  import { fallbackValues } from "./PaymentDetails.theme";
11
4
 
12
5
  import { displayCurrency } from "../../../util/general";
@@ -22,7 +15,7 @@ import {
22
15
  FONT_WEIGHT_BOLD,
23
16
  FONT_WEIGHT_REGULAR
24
17
  } from "../../../constants/style_constants";
25
- import { ATHENS_GREY, GRECIAN_GREY } from "../../../constants/colors";
18
+ import { ATHENS_GREY } from "../../../constants/colors";
26
19
  import ButtonWithAction from "../../atoms/button-with-action";
27
20
  import Text from "../../atoms/text";
28
21
  import Alert from "../../atoms/alert";
@@ -84,6 +77,9 @@ const PaymentDetailsContent = ({
84
77
  <SolidDivider />
85
78
  </Box>
86
79
  <LabeledAmount
80
+ version="v2"
81
+ as="h3"
82
+ variant="small"
87
83
  extraStyles={`font-weight: ${FONT_WEIGHT_REGULAR}; font-size: 14px;`}
88
84
  label="Amount paid"
89
85
  amount={displayCurrency(voidableAmountPaid)}
@@ -97,9 +93,11 @@ const PaymentDetailsContent = ({
97
93
  <>
98
94
  <Box padding="0.5rem 0">
99
95
  <LabeledAmount
96
+ version="v2"
100
97
  variant={themeValues.labeledAmountSubtotal}
101
98
  label="Subtotal"
102
99
  amount={displayCurrency(subtotal)}
100
+ as="h3"
103
101
  />
104
102
  {feeElems}
105
103
  </Box>
@@ -109,13 +107,14 @@ const PaymentDetailsContent = ({
109
107
  <></>
110
108
  )}
111
109
  <LabeledAmount
112
- as="p"
110
+ version="v2"
111
+ as="h3"
113
112
  variant={themeValues.labeledAmountTotal}
114
113
  label={hasVoidablePaymentsSection ? "Remaining amount due" : "Total"}
115
114
  amount={displayCurrency(
116
115
  typeof remainingBalance === "number" ? remainingBalance : total
117
116
  )}
118
- extraStyles={variant === "small" && `font-weight: ${FONT_WEIGHT_BOLD};`}
117
+ extraStyles={`margin-top: 1rem;`}
119
118
  />
120
119
  </Stack>
121
120
  );
@@ -277,6 +276,8 @@ const PaymentDetails = ({
277
276
  <Fragment key={fee.label}>
278
277
  <Box padding="4px 0" />
279
278
  <LabeledAmount
279
+ version="v2"
280
+ as="h3"
280
281
  key={fee.label}
281
282
  variant={themeValues.labeledAmountSubtotal}
282
283
  {...fee}
@@ -328,7 +329,7 @@ const PaymentDetails = ({
328
329
  <Cluster justify="space-between" align="center">
329
330
  <Title
330
331
  weight={FONT_WEIGHT_BOLD}
331
- as="h1"
332
+ as="h2"
332
333
  extraStyles={`font-size: 1.375rem;`}
333
334
  id="payment-details-title"
334
335
  >
@@ -345,7 +346,7 @@ const PaymentDetails = ({
345
346
  </Box>
346
347
  ) : (
347
348
  <Title
348
- as="h1"
349
+ as="h2"
349
350
  weight={FONT_WEIGHT_BOLD}
350
351
  margin="1rem 0 0 0"
351
352
  extraStyles={`font-size: 1.75rem;`}
@@ -46,6 +46,42 @@ 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"
49
85
  }
50
86
  ],
51
87
  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: "pL", small: "pS" };
4
- const labeledAmountTotal = { default: "h6", small: "p" };
3
+ const labeledAmountSubtotal = { default: "regular", small: "small" };
4
+ const labeledAmountTotal = { default: "large", small: "small" };
5
5
 
6
6
  export const fallbackValues = {
7
7
  backgroundColor,