@thecb/components 7.12.0 → 7.12.2-beta.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/dist/index.cjs.js +66 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +66 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/PendingIcon.js +3 -6
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/payment-details/PaymentDetails.js +71 -9
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { STORM_GREY } from "../../../constants/colors";
|
|
2
3
|
|
|
3
|
-
const PendingIcon = () => (
|
|
4
|
+
const PendingIcon = ({ fill = STORM_GREY }) => (
|
|
4
5
|
<svg
|
|
5
6
|
width="32px"
|
|
6
7
|
height="32px"
|
|
@@ -16,11 +17,7 @@ const PendingIcon = () => (
|
|
|
16
17
|
fill="none"
|
|
17
18
|
fillRule="evenodd"
|
|
18
19
|
>
|
|
19
|
-
<g
|
|
20
|
-
id="Icons"
|
|
21
|
-
transform="translate(-64.000000, -448.000000)"
|
|
22
|
-
fill="#6D717E"
|
|
23
|
-
>
|
|
20
|
+
<g id="Icons" transform="translate(-64.000000, -448.000000)" fill={fill}>
|
|
24
21
|
<path
|
|
25
22
|
d="M80,480 C88.836556,480 96,472.836556 96,464 C96,455.163444 88.836556,448 80,448 C71.163444,448 64,455.163444 64,464 C64,472.836556 71.163444,480 80,480 Z M87,466 C88.1045695,466 89,465.104569 89,464 C89,462.895431 88.1045695,462 87,462 C85.8954305,462 85,462.895431 85,464 C85,465.104569 85.8954305,466 87,466 Z M80,462 C81.1045695,462 82,462.895431 82,464 C82,465.104569 81.1045695,466 80,466 C78.8954305,466 78,465.104569 78,464 C78,462.895431 78.8954305,462 80,462 Z M73,462 C74.1045695,462 75,462.895431 75,464 C75,465.104569 74.1045695,466 73,466 C71.8954305,466 71,465.104569 71,464 C71,462.895431 71.8954305,462 73,462 Z"
|
|
26
23
|
id="status-icon---pending"
|
|
Binary file
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React, { useState, Fragment } from "react";
|
|
2
|
-
import {
|
|
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";
|
|
@@ -14,9 +21,11 @@ import {
|
|
|
14
21
|
FONT_WEIGHT_BOLD,
|
|
15
22
|
FONT_WEIGHT_REGULAR
|
|
16
23
|
} from "../../../constants/style_constants";
|
|
17
|
-
import { ATHENS_GREY } from "../../../constants/colors";
|
|
24
|
+
import { ATHENS_GREY, GHOST_GREY } from "../../../constants/colors";
|
|
18
25
|
import ButtonWithAction from "../../atoms/button-with-action";
|
|
19
26
|
import Text from "../../atoms/text";
|
|
27
|
+
import Alert from "../../atoms/alert";
|
|
28
|
+
import Spinner from "../../atoms/spinner";
|
|
20
29
|
import { noop } from "../../../util/general";
|
|
21
30
|
|
|
22
31
|
const PaymentDetailsContent = ({
|
|
@@ -110,7 +119,47 @@ const PaymentDetailsContent = ({
|
|
|
110
119
|
</Stack>
|
|
111
120
|
);
|
|
112
121
|
|
|
113
|
-
const
|
|
122
|
+
const LoadingDetails = () => (
|
|
123
|
+
<Box padding="0" background={GHOST_GREY} borderRadius="4px">
|
|
124
|
+
<Cover minHeight="100%" singleChild>
|
|
125
|
+
<Center intrinsic>
|
|
126
|
+
<Box>
|
|
127
|
+
<Spinner size="100" />
|
|
128
|
+
</Box>
|
|
129
|
+
</Center>
|
|
130
|
+
</Cover>
|
|
131
|
+
</Box>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const ErrorDetails = () => (
|
|
135
|
+
<Box padding="0">
|
|
136
|
+
<Alert
|
|
137
|
+
variant="error"
|
|
138
|
+
heading="Error Loading Payment"
|
|
139
|
+
text="Please go back and try again."
|
|
140
|
+
showQuitLink={false}
|
|
141
|
+
/>
|
|
142
|
+
</Box>
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const getLoadingOrErrorContent = (isLoading = false, isError = false) => {
|
|
146
|
+
if (isLoading) {
|
|
147
|
+
return <LoadingDetails />;
|
|
148
|
+
} else if (isError) {
|
|
149
|
+
return <ErrorDetails />;
|
|
150
|
+
}
|
|
151
|
+
return <Fragment />;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const Collapsible = ({
|
|
155
|
+
content,
|
|
156
|
+
title,
|
|
157
|
+
supportsTouch,
|
|
158
|
+
isOpen,
|
|
159
|
+
setIsOpen,
|
|
160
|
+
isLoading = false,
|
|
161
|
+
isError = false
|
|
162
|
+
}) => (
|
|
114
163
|
<CollapsibleSection
|
|
115
164
|
isMobile={true}
|
|
116
165
|
supportsTouch={supportsTouch}
|
|
@@ -129,15 +178,24 @@ const Collapsible = ({ content, title, supportsTouch, isOpen, setIsOpen }) => (
|
|
|
129
178
|
positionTransition
|
|
130
179
|
initial={"closed"}
|
|
131
180
|
>
|
|
132
|
-
{
|
|
181
|
+
{isLoading || isError
|
|
182
|
+
? getLoadingOrErrorContent(isLoading, isError)
|
|
183
|
+
: content}
|
|
133
184
|
</Motion>
|
|
134
185
|
</CollapsibleSection>
|
|
135
186
|
);
|
|
136
187
|
|
|
137
|
-
const NonCollapsible = ({
|
|
188
|
+
const NonCollapsible = ({
|
|
189
|
+
title,
|
|
190
|
+
content,
|
|
191
|
+
isLoading = false,
|
|
192
|
+
isError = false
|
|
193
|
+
}) => (
|
|
138
194
|
<Stack>
|
|
139
195
|
{title}
|
|
140
|
-
{
|
|
196
|
+
{isLoading || isError
|
|
197
|
+
? getLoadingOrErrorContent(isLoading, isError)
|
|
198
|
+
: content}
|
|
141
199
|
</Stack>
|
|
142
200
|
);
|
|
143
201
|
|
|
@@ -159,8 +217,10 @@ const PaymentDetails = ({
|
|
|
159
217
|
voidableTransactionDetails = [],
|
|
160
218
|
partialVoidAction = noop,
|
|
161
219
|
voidableAmountPaid = 0,
|
|
162
|
-
remainingBalance = false
|
|
220
|
+
remainingBalance = false,
|
|
163
221
|
// end partial void section
|
|
222
|
+
isLoading = false,
|
|
223
|
+
isError = false
|
|
164
224
|
}) => {
|
|
165
225
|
const [isOpen, setIsOpen] = useState(initiallyOpen);
|
|
166
226
|
const fees = _fees
|
|
@@ -266,11 +326,13 @@ const PaymentDetails = ({
|
|
|
266
326
|
isOpen,
|
|
267
327
|
setIsOpen,
|
|
268
328
|
isMobile,
|
|
269
|
-
supportsTouch
|
|
329
|
+
supportsTouch,
|
|
330
|
+
isLoading,
|
|
331
|
+
isError
|
|
270
332
|
}}
|
|
271
333
|
/>
|
|
272
334
|
) : (
|
|
273
|
-
<NonCollapsible {...{ title, content }} />
|
|
335
|
+
<NonCollapsible {...{ title, content, isLoading, isError }} />
|
|
274
336
|
);
|
|
275
337
|
};
|
|
276
338
|
|