@thecb/components 11.1.13-beta.0 → 11.1.14-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.
@@ -2,18 +2,39 @@ import React from "react";
2
2
  import { equals } from "ramda";
3
3
  import { FormInput } from "../../atoms/form-layouts";
4
4
  import { displayCurrency } from "../../../util/general";
5
- import Text from "../../atoms/text";
6
-
5
+ import { Stack, Detail, Text } from "../../atoms";
6
+ import { themeComponent } from "../../../util/themeUtils";
7
+ import { fallbackValues } from "./PartialAmountField.theme";
7
8
  const PartialAmountField = ({
8
9
  lineItem,
9
10
  field,
10
11
  showErrors,
11
12
  errorMessages,
12
13
  moneyFormat,
13
- fieldActions
14
+ fieldActions,
15
+ themeValues
14
16
  }) => (
15
17
  <FormInput
16
18
  labelTextWhenNoError={lineItem.description}
19
+ labelDisplayOverride={
20
+ <Stack childGap="0px">
21
+ <Detail
22
+ as="h3"
23
+ variant={themeValues.detailVariant}
24
+ weight={themeValues.weightTitle}
25
+ >
26
+ <span>{lineItem.description}</span>
27
+ </Detail>
28
+ <Detail
29
+ id={lineItem.subDescription}
30
+ as="p"
31
+ variant={themeValues.detailVariant}
32
+ weight="400"
33
+ >
34
+ {lineItem.subDescription}
35
+ </Detail>
36
+ </Stack>
37
+ }
17
38
  key={lineItem.id}
18
39
  field={field}
19
40
  fieldActions={fieldActions}
@@ -46,4 +67,12 @@ function arePropsEqual(prevProps, nextProps) {
46
67
  );
47
68
  }
48
69
 
49
- export default React.memo(PartialAmountField, arePropsEqual);
70
+ export default React.memo(
71
+ themeComponent(
72
+ PartialAmountField,
73
+ "PartialAmountField",
74
+ fallbackValues,
75
+ "default"
76
+ ),
77
+ arePropsEqual
78
+ );
@@ -0,0 +1,7 @@
1
+ const weightTitle = { default: "600", small: "400" };
2
+ const detailVariant = { default: "large", small: "small" };
3
+
4
+ export const fallbackValues = {
5
+ weightTitle,
6
+ detailVariant
7
+ };
@@ -3,6 +3,7 @@ import {
3
3
  required,
4
4
  onlyIntegers,
5
5
  hasLength,
6
+ includesPotentialCardNumber,
6
7
  matchesRegex,
7
8
  validateWhen,
8
9
  dateAfterToday,
@@ -18,7 +19,7 @@ const formConfig = {
18
19
  validators: [required()]
19
20
  },
20
21
  nameOnCard: {
21
- validators: [required()]
22
+ validators: [required(), includesPotentialCardNumber()]
22
23
  },
23
24
  creditCardNumber: {
24
25
  validators: [required(), hasLength(15, 16)],