@thecb/components 7.12.2-beta.8 → 7.12.2

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": "7.12.2-beta.8",
3
+ "version": "7.12.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -4,7 +4,6 @@ import { Box, Center, Cluster, Stack, Cover, Sidebar } from "../layouts";
4
4
  import Text from "../text";
5
5
  import { fallbackValues } from "./Alert.theme";
6
6
  import { themeComponent } from "../../../util/themeUtils";
7
- import { generateShadows } from "../../../util/generateShadows";
8
7
 
9
8
  const Alert = ({
10
9
  heading,
@@ -18,10 +17,7 @@ const Alert = ({
18
17
  showQuitLink = true,
19
18
  themeValues,
20
19
  extraStyles,
21
- maxContentWidth,
22
- noBorder = false,
23
- enableBoxShadow = false,
24
- enableSmallText = false
20
+ maxContentWidth
25
21
  }) => {
26
22
  const Icon = AlertIcons[variant];
27
23
 
@@ -42,11 +38,7 @@ const Alert = ({
42
38
  textOverride
43
39
  ) : (
44
40
  <Stack fullHeight childGap="0.25rem">
45
- <Text
46
- variant={enableSmallText ? "pS" : "p"}
47
- color={themeValues.text}
48
- weight="600"
49
- >
41
+ <Text variant="p" color={themeValues.text} weight="600">
50
42
  {heading}
51
43
  </Text>
52
44
  <Text variant="pS" color={themeValues.text}>
@@ -78,8 +70,7 @@ const Alert = ({
78
70
  background={themeValues.background}
79
71
  borderRadius="4px"
80
72
  borderColor={themeValues.border}
81
- borderSize={noBorder ? "0px" : "1px"}
82
- boxShadow={enableBoxShadow ? generateShadows()?.inset?.base : ""}
73
+ borderSize="1px"
83
74
  extraStyles={extraStyles}
84
75
  >
85
76
  {maxContentWidth ? (
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { SEA_GREEN } from "../../../constants/colors";
3
3
 
4
- const AutopayOnIcon = () => (
4
+ const AutopayOnIcon = (color = SEA_GREEN) => (
5
5
  <svg
6
6
  xmlns="http://www.w3.org/2000/svg"
7
7
  width="12"
@@ -11,7 +11,7 @@ const AutopayOnIcon = () => (
11
11
  <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
12
12
  <path
13
13
  className="autopayIcon"
14
- fill={SEA_GREEN}
14
+ fill={color}
15
15
  fillRule="nonzero"
16
16
  d="M1.898 5.75c.079 0 .141-.02.188-.059a.281.281 0 00.094-.152 3.825 3.825 0 011.394-2.144A3.838 3.838 0 016 2.563c.5 0 .98.09 1.441.27.461.179.88.44 1.254.784l-.984.985A.542.542 0 007.547 5c0 .156.055.29.164.398.11.11.242.165.398.165h3.141c.156 0 .289-.055.398-.165A.542.542 0 0011.812 5V1.86a.542.542 0 00-.164-.399.542.542 0 00-.398-.164.542.542 0 00-.398.164l-.844.844A5.699 5.699 0 006 .688c-.938 0-1.809.207-2.613.62-.805.415-1.48.981-2.028 1.7A5.726 5.726 0 00.281 5.422a.265.265 0 00.059.223c.055.07.129.105.222.105h1.336zM6 12.312c.937 0 1.809-.207 2.613-.62a5.919 5.919 0 002.028-1.7 5.726 5.726 0 001.078-2.414.265.265 0 00-.059-.223.267.267 0 00-.223-.105h-1.335c-.079 0-.141.02-.188.059a.281.281 0 00-.094.152 3.825 3.825 0 01-1.394 2.144c-.711.555-1.52.833-2.426.833-.5 0-.98-.09-1.441-.27a3.985 3.985 0 01-1.254-.785l.984-.985A.542.542 0 004.453 8a.542.542 0 00-.164-.398.542.542 0 00-.398-.164H.75a.542.542 0 00-.398.164A.542.542 0 00.187 8v3.14c0 .157.055.29.165.4.109.108.242.163.398.163.156 0 .29-.055.398-.164l.844-.844A5.699 5.699 0 006 12.312z"
17
17
  ></path>
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import styled, { css } from "styled-components";
2
+ import styled from "styled-components";
3
3
  import { fallbackValues } from "./Spinner.theme";
4
4
  import { themeComponent } from "../../../util/themeUtils";
5
5
 
@@ -32,12 +32,6 @@ const SpinnerSvgAnimation = styled.svg`
32
32
  stroke-dashoffset: -124;
33
33
  }
34
34
  }
35
- ${({ centerSpinner }) =>
36
- centerSpinner
37
- ? css`
38
- margin: 0;
39
- `
40
- : ""}
41
35
  `;
42
36
 
43
37
  export const SpinnerContainer = styled.div`
@@ -47,27 +41,11 @@ export const SpinnerContainer = styled.div`
47
41
  align-items: center;
48
42
  justify-content: center;
49
43
  line-height: 1;
50
- ${({ centerSpinner, size }) =>
51
- centerSpinner
52
- ? css`
53
- width: ${size}px;
54
- height: ${size}px;
55
- `
56
- : ""}
57
44
  `;
58
45
 
59
- /*
60
- `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
61
- containers. Default is false to preserve legacy behavior for past uses.
62
- */
63
-
64
- const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
65
- <SpinnerContainer centerSpinner={centerSpinner} size={size}>
66
- <SpinnerSvgAnimation
67
- size={size}
68
- color={themeValues.color}
69
- centerSpinner={centerSpinner}
70
- >
46
+ const Spinner = ({ size = "24", themeValues }) => (
47
+ <SpinnerContainer>
48
+ <SpinnerSvgAnimation size={size} color={themeValues.color}>
71
49
  <circle
72
50
  className="path"
73
51
  cx="50"
@@ -7,6 +7,7 @@ import { Box, Cluster } from "../../atoms/layouts";
7
7
  import SolidDivider from "../../atoms/solid-divider";
8
8
 
9
9
  const PaymentButtonBar = ({
10
+ isForwardButtonDisabled = false,
10
11
  forwardButtonText = "Next",
11
12
  forwardButtonAction,
12
13
  forwardButtonLoading,
@@ -51,6 +52,7 @@ const PaymentButtonBar = ({
51
52
  variant={forwardButtonVariant}
52
53
  extraStyles={isMobile && "flex-grow: 1"}
53
54
  dataQa={redirectText}
55
+ disabled={isForwardButtonDisabled}
54
56
  />
55
57
  ) : (
56
58
  forwardButtonAction && (
@@ -61,6 +63,7 @@ const PaymentButtonBar = ({
61
63
  isLoading={forwardButtonLoading}
62
64
  extraStyles={isMobile && "flex-grow: 1"}
63
65
  dataQa={forwardButtonText}
66
+ disabled={isForwardButtonDisabled}
64
67
  />
65
68
  )
66
69
  );
@@ -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";
@@ -21,11 +14,9 @@ import {
21
14
  FONT_WEIGHT_BOLD,
22
15
  FONT_WEIGHT_REGULAR
23
16
  } from "../../../constants/style_constants";
24
- import { ATHENS_GREY, GRECIAN_GREY } from "../../../constants/colors";
17
+ import { ATHENS_GREY } from "../../../constants/colors";
25
18
  import ButtonWithAction from "../../atoms/button-with-action";
26
19
  import Text from "../../atoms/text";
27
- import Alert from "../../atoms/alert";
28
- import Spinner from "../../atoms/spinner";
29
20
  import { noop } from "../../../util/general";
30
21
 
31
22
  const PaymentDetailsContent = ({
@@ -119,61 +110,7 @@ const PaymentDetailsContent = ({
119
110
  </Stack>
120
111
  );
121
112
 
122
- const LoadingDetails = () => (
123
- <Box
124
- padding="0"
125
- background={GRECIAN_GREY}
126
- borderRadius="4px"
127
- minHeight="196px"
128
- >
129
- <Cover minHeight="196px" singleChild fillCenter>
130
- <Center intrinsic>
131
- <Box
132
- padding="0"
133
- extraStyles={`flex-grow: 1; display: flex; justify-content: center; align-items: center;`}
134
- >
135
- <Spinner size="100" centerSpinner />
136
- </Box>
137
- </Center>
138
- </Cover>
139
- </Box>
140
- );
141
-
142
- const ErrorDetails = () => (
143
- <Box padding="0">
144
- <Alert
145
- variant="error"
146
- heading="Error Loading Payment"
147
- text="Please go back and try again."
148
- showQuitLink={false}
149
- maxContentWidth="350px"
150
- padding="0"
151
- noBorder
152
- enableBoxShadow
153
- extraStyles={`min-height: 67px; height: 67px;`}
154
- enableSmallText
155
- />
156
- </Box>
157
- );
158
-
159
- const getLoadingOrErrorContent = (isLoading = false, isError = false) => {
160
- if (isLoading) {
161
- return <LoadingDetails />;
162
- } else if (isError) {
163
- return <ErrorDetails />;
164
- }
165
- return <Fragment />;
166
- };
167
-
168
- const Collapsible = ({
169
- content,
170
- title,
171
- supportsTouch,
172
- isOpen,
173
- setIsOpen,
174
- isLoading = false,
175
- isError = false
176
- }) => (
113
+ const Collapsible = ({ content, title, supportsTouch, isOpen, setIsOpen }) => (
177
114
  <CollapsibleSection
178
115
  isMobile={true}
179
116
  supportsTouch={supportsTouch}
@@ -192,24 +129,15 @@ const Collapsible = ({
192
129
  positionTransition
193
130
  initial={"closed"}
194
131
  >
195
- {isLoading || isError
196
- ? getLoadingOrErrorContent(isLoading, isError)
197
- : content}
132
+ {content}
198
133
  </Motion>
199
134
  </CollapsibleSection>
200
135
  );
201
136
 
202
- const NonCollapsible = ({
203
- title,
204
- content,
205
- isLoading = false,
206
- isError = false
207
- }) => (
137
+ const NonCollapsible = ({ title, content }) => (
208
138
  <Stack>
209
139
  {title}
210
- {isLoading || isError
211
- ? getLoadingOrErrorContent(isLoading, isError)
212
- : content}
140
+ {content}
213
141
  </Stack>
214
142
  );
215
143
 
@@ -231,10 +159,8 @@ const PaymentDetails = ({
231
159
  voidableTransactionDetails = [],
232
160
  partialVoidAction = noop,
233
161
  voidableAmountPaid = 0,
234
- remainingBalance = false,
162
+ remainingBalance = false
235
163
  // end partial void section
236
- isLoading = false,
237
- isError = false
238
164
  }) => {
239
165
  const [isOpen, setIsOpen] = useState(initiallyOpen);
240
166
  const fees = _fees
@@ -340,13 +266,11 @@ const PaymentDetails = ({
340
266
  isOpen,
341
267
  setIsOpen,
342
268
  isMobile,
343
- supportsTouch,
344
- isLoading,
345
- isError
269
+ supportsTouch
346
270
  }}
347
271
  />
348
272
  ) : (
349
- <NonCollapsible {...{ title, content, isLoading, isError }} />
273
+ <NonCollapsible {...{ title, content }} />
350
274
  );
351
275
  };
352
276
 
@@ -28,7 +28,7 @@ const rgbToRgba = (rgbValue = "", opacity = "") => {
28
28
  )}, ${opacity}${rgbValue.slice(-1)}`;
29
29
  };
30
30
 
31
- export const generateShadows = (baseColorRGB = "rgb(41, 42, 51)") => {
31
+ export const generateShadows = baseColorRGB => {
32
32
  const colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
33
33
  const colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
34
34
  const colorTwentyFive =
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file