@thecb/components 9.0.0-beta.8 → 9.0.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/dist/index.cjs.js +311 -1369
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +311 -1370
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/country-dropdown/CountryDropdown.js +1 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +0 -1
- package/src/components/atoms/dropdown/Dropdown.js +9 -9
- package/src/components/atoms/form-layouts/FormInput.js +2 -3
- package/src/components/atoms/form-layouts/index.d.ts +1 -1
- package/src/components/atoms/form-select/index.d.ts +1 -1
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +0 -1
- package/src/components/molecules/link-card/index.d.ts +1 -1
- package/src/components/molecules/partial-amount-form/PartialAmountForm.state.js +40 -22
- package/src/components/molecules/partial-amount-form/index.js +9 -2
- package/src/components/molecules/payment-details/PaymentDetails.js +36 -16
- package/src/components/molecules/phone-form/PhoneForm.js +1 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +1 -2
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +0 -1
- package/src/components/atoms/state-province-dropdown/index.d.ts +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecb/components",
|
|
3
|
-
"version": "9.0.0
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Common lib for CityBase react components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"ramda": "^0.27.0",
|
|
91
91
|
"react-aria-modal": "^4.0.0",
|
|
92
92
|
"react-pose": "^4.0.10",
|
|
93
|
-
"redux-freeform": "^5.
|
|
93
|
+
"redux-freeform": "^5.8.0"
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -3,7 +3,6 @@ import { Box, Stack } from "../layouts";
|
|
|
3
3
|
import Text from "../text";
|
|
4
4
|
import {
|
|
5
5
|
noop,
|
|
6
|
-
createIdFromString,
|
|
7
6
|
inputDisabledStyle,
|
|
8
7
|
inputPlaceholderTextStyle
|
|
9
8
|
} from "../../../util/general";
|
|
@@ -383,6 +382,7 @@ const Dropdown = ({
|
|
|
383
382
|
data-qa={choice.text}
|
|
384
383
|
themeValues={themeValues}
|
|
385
384
|
title={hasTitles ? choice.text : null}
|
|
385
|
+
role="option"
|
|
386
386
|
onFocus={() => setFocusedRef(optionRefs.current[i])}
|
|
387
387
|
>
|
|
388
388
|
<Text
|
|
@@ -395,14 +395,14 @@ const Dropdown = ({
|
|
|
395
395
|
: MINESHAFT_GREY
|
|
396
396
|
}
|
|
397
397
|
extraStyles={`padding-left: 16px;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
398
|
+
cursor: ${
|
|
399
|
+
disabledValues.includes(choice.value)
|
|
400
|
+
? "default"
|
|
401
|
+
: "pointer"
|
|
402
|
+
};
|
|
403
|
+
white-space: nowrap;
|
|
404
|
+
overflow: hidden;
|
|
405
|
+
text-overflow: ellipsis;`}
|
|
406
406
|
>
|
|
407
407
|
{choice.text}
|
|
408
408
|
</Text>
|
|
@@ -112,10 +112,10 @@ const FormInput = ({
|
|
|
112
112
|
themeValues,
|
|
113
113
|
background,
|
|
114
114
|
customHeight,
|
|
115
|
-
autocompleteValue =
|
|
115
|
+
autocompleteValue = null,
|
|
116
116
|
extraStyles,
|
|
117
117
|
removeFromValue, // regex of characters to remove before setting value
|
|
118
|
-
dataQa,
|
|
118
|
+
dataQa = null,
|
|
119
119
|
...props
|
|
120
120
|
}) => {
|
|
121
121
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -256,7 +256,6 @@ const FormInput = ({
|
|
|
256
256
|
justify="space-between"
|
|
257
257
|
aria-live="polite"
|
|
258
258
|
aria-atomic={true}
|
|
259
|
-
data-qa={`${labelTextWhenNoError} error message`}
|
|
260
259
|
>
|
|
261
260
|
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
262
261
|
<Text
|
|
@@ -14,28 +14,13 @@ export const createPartialAmountFormState = (
|
|
|
14
14
|
blockPartialPaymentOverpay = false
|
|
15
15
|
) => {
|
|
16
16
|
const formConfig = lineItems.reduce((acc, item) => {
|
|
17
|
-
const validators =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
];
|
|
26
|
-
if (!!maximum) {
|
|
27
|
-
validators.push(
|
|
28
|
-
validateSum(
|
|
29
|
-
numberLessThanOrEqualTo(maximum),
|
|
30
|
-
lineItems
|
|
31
|
-
.filter(lineItem => lineItem != item)
|
|
32
|
-
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
33
|
-
)
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
if (blockPartialPaymentOverpay) {
|
|
37
|
-
validators.push(numberLessThanOrEqualTo(item.amount));
|
|
38
|
-
}
|
|
17
|
+
const validators = createPartialAmountFormValidators(
|
|
18
|
+
item,
|
|
19
|
+
lineItems,
|
|
20
|
+
maximum,
|
|
21
|
+
minimum,
|
|
22
|
+
blockPartialPaymentOverpay
|
|
23
|
+
);
|
|
39
24
|
return {
|
|
40
25
|
...acc,
|
|
41
26
|
[item.id]: {
|
|
@@ -54,3 +39,36 @@ export const createPartialAmountFormState = (
|
|
|
54
39
|
partialAmountFormMapDispatchToProps: mapDispatchToProps
|
|
55
40
|
};
|
|
56
41
|
};
|
|
42
|
+
|
|
43
|
+
export const createPartialAmountFormValidators = (
|
|
44
|
+
item,
|
|
45
|
+
lineItems,
|
|
46
|
+
maximum,
|
|
47
|
+
minimum = 1,
|
|
48
|
+
blockPartialPaymentOverpay = false
|
|
49
|
+
) => {
|
|
50
|
+
const validators = [
|
|
51
|
+
required(),
|
|
52
|
+
validateSum(
|
|
53
|
+
numberGreaterThanOrEqualTo(minimum),
|
|
54
|
+
lineItems
|
|
55
|
+
.filter(lineItem => lineItem != item)
|
|
56
|
+
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
57
|
+
)
|
|
58
|
+
];
|
|
59
|
+
if (!!maximum) {
|
|
60
|
+
validators.push(
|
|
61
|
+
validateSum(
|
|
62
|
+
numberLessThanOrEqualTo(maximum),
|
|
63
|
+
lineItems
|
|
64
|
+
.filter(lineItem => lineItem != item)
|
|
65
|
+
.reduce((acc, curr) => [...acc, curr.id], [])
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (blockPartialPaymentOverpay) {
|
|
70
|
+
validators.push(numberLessThanOrEqualTo(item.amount));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return validators;
|
|
74
|
+
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import PartialAmountForm from "./PartialAmountForm";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createPartialAmountFormState,
|
|
4
|
+
createPartialAmountFormValidators
|
|
5
|
+
} from "./PartialAmountForm.state";
|
|
3
6
|
|
|
4
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
PartialAmountForm,
|
|
9
|
+
createPartialAmountFormState,
|
|
10
|
+
createPartialAmountFormValidators
|
|
11
|
+
};
|
|
@@ -13,6 +13,7 @@ import { displayCurrency } from "../../../util/general";
|
|
|
13
13
|
import { themeComponent } from "../../../util/themeUtils";
|
|
14
14
|
import CollapsibleSection from "../collapsible-section";
|
|
15
15
|
|
|
16
|
+
import LoadingLine from "../../atoms/loading-line";
|
|
16
17
|
import LabeledAmount from "../../atoms/labeled-amount";
|
|
17
18
|
import LineItem from "../../atoms/line-item";
|
|
18
19
|
import Title from "../../atoms/title";
|
|
@@ -120,22 +121,41 @@ const PaymentDetailsContent = ({
|
|
|
120
121
|
);
|
|
121
122
|
|
|
122
123
|
const LoadingDetails = () => (
|
|
123
|
-
<Box
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
<Box padding="0" minHeight="196px">
|
|
125
|
+
<Box
|
|
126
|
+
padding="0"
|
|
127
|
+
extraStyles={`position: absolute;
|
|
128
|
+
height: 200px;
|
|
129
|
+
width: 100%;
|
|
130
|
+
display: flex;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;`}
|
|
133
|
+
>
|
|
134
|
+
<Spinner size="100" centerSpinner />
|
|
135
|
+
</Box>
|
|
136
|
+
<Stack childGap="16px">
|
|
137
|
+
<Cluster nowrap justify="space-between" align="start">
|
|
138
|
+
<LoadingLine exactWidth="110" height="27px" />
|
|
139
|
+
<LoadingLine exactWidth="60" height="27px" />
|
|
140
|
+
</Cluster>
|
|
141
|
+
<SolidDivider />
|
|
142
|
+
<Box padding="0.5rem 0">
|
|
143
|
+
<Cluster justify="space-between" align="start">
|
|
144
|
+
<LoadingLine exactWidth="80" height="27px" />
|
|
145
|
+
<LoadingLine exactWidth="60" height="27px" />
|
|
146
|
+
</Cluster>
|
|
147
|
+
<Box padding="4px 0" />
|
|
148
|
+
<Cluster justify="space-between" align="start">
|
|
149
|
+
<LoadingLine exactWidth="100" height="27px" />
|
|
150
|
+
<LoadingLine exactWidth="50" height="27px" />
|
|
151
|
+
</Cluster>
|
|
152
|
+
</Box>
|
|
153
|
+
<SolidDivider />
|
|
154
|
+
<Stack justify="space-between" direction="row">
|
|
155
|
+
<LoadingLine exactWidth="55" height="30px" />
|
|
156
|
+
<LoadingLine exactWidth="70" height="30px" />
|
|
157
|
+
</Stack>
|
|
158
|
+
</Stack>
|
|
139
159
|
</Box>
|
|
140
160
|
);
|
|
141
161
|
|
|
@@ -14,12 +14,11 @@ const TermsAndConditionsControlV1 = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
16
16
|
return (
|
|
17
|
-
<DisplayBox
|
|
17
|
+
<DisplayBox>
|
|
18
18
|
<Stack>
|
|
19
19
|
<Checkbox
|
|
20
20
|
name="terms"
|
|
21
21
|
title="Terms and Conditions"
|
|
22
|
-
dataQa="Terms and Conditions"
|
|
23
22
|
error={error}
|
|
24
23
|
checked={isChecked}
|
|
25
24
|
onChange={onCheck}
|
|
@@ -45,7 +45,6 @@ const TermsAndConditionsControlV2 = ({
|
|
|
45
45
|
background={displayInline ? "transparent" : containerBackground}
|
|
46
46
|
boxShadow={displayInline ? "none" : standardBoxShadow}
|
|
47
47
|
borderRadius={displayInline ? "0" : "4px"}
|
|
48
|
-
dataQa="TermsAndConditionsControlV2"
|
|
49
48
|
>
|
|
50
49
|
<Stack childGap="0">
|
|
51
50
|
{html && <Box padding="0">{html}</Box>}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ErrorMessageDictionary,
|
|
5
|
-
Field,
|
|
6
|
-
FieldActions,
|
|
7
|
-
FormSelectOption
|
|
8
|
-
} from "../../../types/common";
|
|
9
|
-
import Expand from "../../../util/expand";
|
|
10
|
-
|
|
11
|
-
export interface StateProvinceDropdownProps {
|
|
12
|
-
labelTextWhenNoError?: string;
|
|
13
|
-
errorMessages?: ErrorMessageDictionary;
|
|
14
|
-
field?: Field;
|
|
15
|
-
fieldActions?: FieldActions;
|
|
16
|
-
options?: FormSelectOption[];
|
|
17
|
-
showErrors?: boolean;
|
|
18
|
-
countryCode?: string;
|
|
19
|
-
autocompleteValue?: string;
|
|
20
|
-
dataQa?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const StateProvinceDropdown: React.FC<Expand<
|
|
24
|
-
StateProvinceDropdownProps
|
|
25
|
-
> &
|
|
26
|
-
React.HTMLAttributes<HTMLElement>>;
|