@thecb/components 9.3.5-beta.0 → 9.4.0-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.0",
3
+ "version": "9.4.0-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
Binary file
Binary file
@@ -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
 
@@ -3,11 +3,7 @@ const fontWeight = {
3
3
  pS: "600",
4
4
  p: "600",
5
5
  pL: "600",
6
- h6: "700",
7
- regular: "600",
8
- extraSmall: "600",
9
- small: "600",
10
- large: "600"
6
+ h6: "700"
11
7
  };
12
8
 
13
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
  };
@@ -38,6 +38,7 @@ const SearchableSelect = ({
38
38
  selectItem(value);
39
39
  }
40
40
  };
41
+
41
42
  return (
42
43
  <Box
43
44
  padding="1rem"
@@ -60,20 +61,25 @@ const SearchableSelect = ({
60
61
  extraStyles={`overflow-y: scroll; max-height: 250px;`}
61
62
  >
62
63
  <Stack>
63
- {itemList.map(value => (
64
- <Checkbox
65
- key={value.name}
66
- title={value.name}
67
- name={value.name}
68
- checked={
69
- selectedItems?.find(item => item?.name === value?.name) ?? false
70
- }
71
- onChange={() => handleSelect(value)}
72
- textExtraStyles={`margin: 0;`}
73
- disabled={disabled}
74
- extraStyles={`margin: 0.5rem;`}
75
- />
76
- ))}
64
+ {itemList
65
+ .sort((a, b) =>
66
+ a.name.toLowerCase().localeCompare(b.name.toLowerCase())
67
+ )
68
+ .map(value => (
69
+ <Checkbox
70
+ key={value.name}
71
+ title={value.name}
72
+ name={value.name}
73
+ checked={
74
+ selectedItems?.find(item => item?.name === value?.name) ??
75
+ false
76
+ }
77
+ onChange={() => handleSelect(value)}
78
+ textExtraStyles={`margin: 0;`}
79
+ disabled={disabled}
80
+ extraStyles={`margin: 0.5rem;`}
81
+ />
82
+ ))}
77
83
  </Stack>
78
84
  </Box>
79
85
  </Box>
@@ -14,8 +14,8 @@ const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
14
14
 
15
15
  const items = [
16
16
  { name: "Foo", value: "foo-value" },
17
- { name: "Bar", value: "bar-value" },
18
- { name: "Baz", value: "baz-value" }
17
+ { name: "Baz", value: "baz-value" },
18
+ { name: "Bar", value: "bar-value" }
19
19
  ];
20
20
 
21
21
  const FormWrapper = props => {
@@ -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: "large", 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,25 +0,0 @@
1
- import React from "react";
2
- import Detail from "../detail";
3
-
4
- const LabeledAmountV2 = ({
5
- variant = "regular",
6
- label,
7
- amount,
8
- themeValues,
9
- as,
10
- extraStyles
11
- }) => {
12
- return (
13
- <Detail
14
- variant={variant}
15
- as={as}
16
- weight={themeValues.fontWeight}
17
- extraStyles={`display: flex; justify-content: space-between; ${extraStyles}`}
18
- >
19
- <span>{label}</span>
20
- <span>{amount}</span>
21
- </Detail>
22
- );
23
- };
24
-
25
- export default LabeledAmountV2;