@thecb/components 10.2.4-beta.14 → 10.2.4-beta.15

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": "10.2.4-beta.14",
3
+ "version": "10.2.4-beta.15",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -81,7 +81,6 @@ const ButtonWithAction = forwardRef(
81
81
  },
82
82
  ref
83
83
  ) => {
84
- const isGhostVariant = variant === "ghost" || variant === "smallGhost";
85
84
  const themeContext = useContext(ThemeContext);
86
85
  const themeValues = createThemeValues(
87
86
  themeContext,
@@ -92,35 +91,35 @@ const ButtonWithAction = forwardRef(
92
91
  const { isMobile } = themeContext;
93
92
 
94
93
  const hoverStyles = `
95
- outline: none;
96
- background-color: ${themeValues.hoverBackgroundColor};
97
- border-color: ${themeValues.hoverBorderColor};
98
- color: ${themeValues.hoverColor};
99
- text-decoration: ${
100
- variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
101
- };
102
- cursor: pointer;
103
- `;
94
+ outline: none;
95
+ background-color: ${themeValues.hoverBackgroundColor};
96
+ border-color: ${themeValues.hoverBorderColor};
97
+ color: ${themeValues.hoverColor};
98
+ text-decoration: ${
99
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
100
+ };
101
+ cursor: pointer;
102
+ `;
104
103
  const activeStyles = `
105
- outline: none;
106
- background-color: ${themeValues.activeBackgroundColor};
107
- border-color: ${themeValues.activeBorderColor};
108
- color: ${themeValues.activeColor};
109
- text-decoration: ${
110
- variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
111
- };
104
+ outline: none;
105
+ background-color: ${themeValues.activeBackgroundColor};
106
+ border-color: ${themeValues.activeBorderColor};
107
+ color: ${themeValues.activeColor};
108
+ text-decoration: ${
109
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
110
+ };
112
111
  `;
113
112
  const disabledStyles = `
114
- background-color: ${isGhostVariant ? "transparent;" : "#6D717E;"};
115
- border-color: ${isGhostVariant ? "transparent;" : "#6D717E;"};
116
- color: ${isGhostVariant ? "#6D717E;" : "#FFFFFF"};
117
- cursor: default;
118
- &:focus {
119
- outline: 3px solid #6D717E;
120
- outline-offset: 2px;
121
- }
122
- ${extraDisabledStyles}
123
- `;
113
+ background-color: #6D717E;
114
+ border-color: #6D717E;
115
+ color: #FFFFFF;
116
+ cursor: default;
117
+ &:focus {
118
+ outline: 3px solid #6D717E;
119
+ outline-offset: 2px;
120
+ }
121
+ ${extraDisabledStyles}
122
+ `;
124
123
 
125
124
  return (
126
125
  <Box
@@ -136,7 +135,7 @@ const ButtonWithAction = forwardRef(
136
135
  disabledStyles={disabledStyles}
137
136
  aria-disabled={disabled}
138
137
  as="button"
139
- onClick={isLoading || disabled ? noop : action}
138
+ onClick={isLoading || disabled ? undefined : action}
140
139
  borderRadius="2px"
141
140
  theme={themeContext}
142
141
  extraStyles={`margin: 0.5rem; ${extraStyles}`}
@@ -156,9 +155,7 @@ const ButtonWithAction = forwardRef(
156
155
  variant={themeValues.fontSizeVariant}
157
156
  color={themeValues.color}
158
157
  textWrap={textWrap}
159
- extraStyles={
160
- disabled ? textExtraStyles + disabledStyles : textExtraStyles
161
- }
158
+ extraStyles={textExtraStyles}
162
159
  >
163
160
  {text}
164
161
  </Text>
@@ -10,6 +10,7 @@ const variants = {
10
10
  back: "back",
11
11
  smallPrimary: "smallPrimary",
12
12
  smallSecondary: "smallSecondary",
13
+ disabledSecondary: "disabledSecondary",
13
14
  ghost: "ghost",
14
15
  smallGhost: "smallGhost",
15
16
  danger: "danger",
@@ -3,6 +3,7 @@ import {
3
3
  TRANSPARENT,
4
4
  SAPPHIRE_BLUE,
5
5
  PEACOCK_BLUE,
6
+ MANATEE_GREY,
6
7
  MATISSE_BLUE,
7
8
  RASPBERRY,
8
9
  ERROR_COLOR
@@ -11,6 +12,7 @@ import {
11
12
  const padding = {
12
13
  primary: "0.75rem 1.5rem",
13
14
  secondary: "0.75rem 1.5rem",
15
+ disabledSecondary: "0.75rem 1.5rem",
14
16
  back: "0.75rem 1.5rem",
15
17
  smallPrimary: "0.75rem 1rem",
16
18
  smallSecondary: "0.75rem 1rem",
@@ -26,6 +28,7 @@ const padding = {
26
28
  const color = {
27
29
  primary: WHITE,
28
30
  secondary: MATISSE_BLUE,
31
+ disabledSecondary: MANATEE_GREY,
29
32
  back: MATISSE_BLUE,
30
33
  smallPrimary: WHITE,
31
34
  smallSecondary: MATISSE_BLUE,
@@ -41,6 +44,7 @@ const color = {
41
44
  const fontSizeVariant = {
42
45
  primary: "pS",
43
46
  secondary: "pS",
47
+ disabledSecondary: "pS",
44
48
  back: "pS",
45
49
  smallPrimary: "pS",
46
50
  smallSecondary: "pS",
@@ -56,6 +60,7 @@ const fontSizeVariant = {
56
60
  const fontWeight = {
57
61
  primary: "600",
58
62
  secondary: "600",
63
+ disabledSecondary: "600",
59
64
  back: "600",
60
65
  smallPrimary: "600",
61
66
  smallSecondary: "600",
@@ -71,6 +76,7 @@ const fontWeight = {
71
76
  const height = {
72
77
  primary: "3rem",
73
78
  secondary: "3rem",
79
+ disabledSecondary: "3rem",
74
80
  back: "3rem",
75
81
  smallPrimary: "2.5rem",
76
82
  smallSecondary: "2.5rem",
@@ -86,6 +92,7 @@ const height = {
86
92
  const minWidth = {
87
93
  primary: "130px",
88
94
  secondary: "130px",
95
+ disabledSecondary: "130px",
89
96
  back: "130px",
90
97
  smallPrimary: "100px",
91
98
  smallSecondary: "100px",
@@ -101,6 +108,7 @@ const minWidth = {
101
108
  const backgroundColor = {
102
109
  primary: MATISSE_BLUE,
103
110
  secondary: TRANSPARENT,
111
+ disabledSecondary: TRANSPARENT,
104
112
  back: TRANSPARENT,
105
113
  smallPrimary: MATISSE_BLUE,
106
114
  smallSecondary: TRANSPARENT,
@@ -116,6 +124,7 @@ const backgroundColor = {
116
124
  const border = {
117
125
  primary: "2px solid " + MATISSE_BLUE,
118
126
  secondary: "2px solid " + MATISSE_BLUE,
127
+ disabledSecondary: "2px solid " + MANATEE_GREY,
119
128
  back: "2px solid " + MATISSE_BLUE,
120
129
  smallPrimary: "2px solid " + MATISSE_BLUE,
121
130
  smallSecondary: "2px solid " + MATISSE_BLUE,
@@ -131,6 +140,7 @@ const border = {
131
140
  const hoverBackgroundColor = {
132
141
  primary: SAPPHIRE_BLUE,
133
142
  secondary: "#DBEAF0",
143
+ disabledSecondary: TRANSPARENT,
134
144
  back: TRANSPARENT,
135
145
  smallPrimary: SAPPHIRE_BLUE,
136
146
  smallSecondary: "#DBEAF0",
@@ -146,6 +156,7 @@ const hoverBackgroundColor = {
146
156
  const hoverBorderColor = {
147
157
  primary: SAPPHIRE_BLUE,
148
158
  secondary: MATISSE_BLUE,
159
+ disabledSecondary: MANATEE_GREY,
149
160
  back: "#DCEAF1",
150
161
  smallPrimary: SAPPHIRE_BLUE,
151
162
  smallSecondary: MATISSE_BLUE,
@@ -161,6 +172,7 @@ const hoverBorderColor = {
161
172
  const hoverColor = {
162
173
  primary: WHITE,
163
174
  secondary: SAPPHIRE_BLUE,
175
+ disabledSecondary: MANATEE_GREY,
164
176
  back: SAPPHIRE_BLUE,
165
177
  smallPrimary: WHITE,
166
178
  smallSecondary: SAPPHIRE_BLUE,
@@ -176,6 +188,7 @@ const hoverColor = {
176
188
  const activeBackgroundColor = {
177
189
  primary: PEACOCK_BLUE,
178
190
  secondary: "#B8D5E1",
191
+ disabledSecondary: TRANSPARENT,
179
192
  back: TRANSPARENT,
180
193
  smallPrimary: PEACOCK_BLUE,
181
194
  smallSecondary: "#B8D5E1",
@@ -191,6 +204,7 @@ const activeBackgroundColor = {
191
204
  const activeBorderColor = {
192
205
  primary: PEACOCK_BLUE,
193
206
  secondary: MATISSE_BLUE,
207
+ disabledSecondary: MANATEE_GREY,
194
208
  back: PEACOCK_BLUE,
195
209
  smallPrimary: PEACOCK_BLUE,
196
210
  smallSecondary: MATISSE_BLUE,
@@ -206,6 +220,7 @@ const activeBorderColor = {
206
220
  const activeColor = {
207
221
  primary: WHITE,
208
222
  secondary: MATISSE_BLUE,
223
+ disabledSecondary: MANATEE_GREY,
209
224
  back: PEACOCK_BLUE,
210
225
  smallPrimary: WHITE,
211
226
  smallSecondary: PEACOCK_BLUE,
@@ -115,7 +115,6 @@ const Obligation = ({
115
115
  description={description}
116
116
  subDescription={subDescription}
117
117
  allowedPaymentInstruments={allowedPaymentInstruments}
118
- isInCustomerManagement={isInCustomerManagement}
119
118
  />
120
119
  )}
121
120
  </Cluster>
@@ -222,7 +221,6 @@ const Obligation = ({
222
221
  description={description}
223
222
  subDescription={subDescription}
224
223
  allowedPaymentInstruments={allowedPaymentInstruments}
225
- isInCustomerManagement={isInCustomerManagement}
226
224
  />
227
225
  )}
228
226
  </Cluster>
@@ -245,7 +243,6 @@ const Obligation = ({
245
243
  description={description}
246
244
  subDescription={subDescription}
247
245
  allowedPaymentInstruments={allowedPaymentInstruments}
248
- isInCustomerManagement={isInCustomerManagement}
249
246
  />
250
247
  )}
251
248
  </Stack>
@@ -18,8 +18,7 @@ const AmountModule = ({
18
18
  nextAutopayDate,
19
19
  description,
20
20
  subDescription,
21
- allowedPaymentInstruments,
22
- isInCustomerManagement = false
21
+ allowedPaymentInstruments
23
22
  }) => {
24
23
  const [modalOpen, toggleModal] = useState(false);
25
24
  return (
@@ -50,7 +49,6 @@ const AmountModule = ({
50
49
  description={description}
51
50
  subDescription={subDescription}
52
51
  allowedPaymentInstruments={allowedPaymentInstruments}
53
- isInCustomerManagement={isInCustomerManagement}
54
52
  />
55
53
  )}
56
54
  </Stack>
@@ -10,7 +10,7 @@ const groupId = "props";
10
10
  export const amountModule = () => (
11
11
  <AmountModule
12
12
  totalAmountDue={text("totalAmountDue", "123", groupId)}
13
- autoPayEnabled={boolean("autoPayEnabled", true, groupId)}
13
+ autoPayEnabled={boolean("autopayEnabled", true, groupId)}
14
14
  isMobile={boolean("isMobile", false, groupId)}
15
15
  deactivatePaymentSchedule={noop}
16
16
  navigateToSettings={noop}
@@ -87,7 +87,7 @@ const AutopayModal = ({
87
87
  }
88
88
  variant="secondary"
89
89
  action={() => {
90
- isInCustomerManagement ? noop : toggleModal(true);
90
+ toggleModal(true);
91
91
  }}
92
92
  dataQa="Turn off Autopay"
93
93
  extraStyles={
@@ -101,14 +101,14 @@ const AutopayModal = ({
101
101
  case "tertiary": {
102
102
  return (
103
103
  <ButtonWithAction
104
+ disabled={isInCustomerManagement}
104
105
  text={autoPayActive ? `Manage ${shortPlan}` : `Set Up ${shortPlan}`}
105
106
  variant="tertiary"
106
107
  action={() => {
107
- isInCustomerManagement ? noop : toggleModal(true);
108
+ toggleModal(true);
108
109
  }}
109
110
  dataQa="Manage Autopay"
110
111
  extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
111
- disabled={isInCustomerManagement}
112
112
  />
113
113
  );
114
114
  }
@@ -117,7 +117,7 @@ const AutopayModal = ({
117
117
  <Box
118
118
  padding="0"
119
119
  onClick={() => {
120
- isInCustomerManagement ? noop : toggleModal(true);
120
+ toggleModal(true);
121
121
  }}
122
122
  hoverStyles={hoverStyles}
123
123
  activeStyles={activeStyles}
@@ -130,13 +130,9 @@ const AutopayModal = ({
130
130
  <AutopayOnIcon />
131
131
  <Text
132
132
  variant="pS"
133
- onClick={() =>
134
- isInCustomerManagement ? noop : toggleModal(true)
135
- }
133
+ onClick={() => toggleModal(true)}
136
134
  onKeyPress={e => {
137
- isInCustomerManagement
138
- ? noop
139
- : e.key === "Enter" && toggleModal(true);
135
+ e.key === "Enter" && toggleModal(true);
140
136
  }}
141
137
  tabIndex="0"
142
138
  dataQa={`${shortPlan} On`}
@@ -155,8 +151,8 @@ const AutopayModal = ({
155
151
  };
156
152
  return (
157
153
  <Modal
158
- showModal={() => (isInCustomerManagement ? noop : toggleModal(true))}
159
- hideModal={() => (isInCustomerManagement ? noop : toggleModal(false))}
154
+ showModal={() => toggleModal(true)}
155
+ hideModal={() => toggleModal(false)}
160
156
  modalOpen={modalOpen}
161
157
  {...modalExtraProps}
162
158
  >
@@ -21,8 +21,7 @@ const InactiveControlsModule = ({
21
21
  actions,
22
22
  description,
23
23
  subDescription,
24
- allowedPaymentInstruments,
25
- isInCustomerManagement = false
24
+ allowedPaymentInstruments
26
25
  }) => {
27
26
  const [modalOpen, toggleModal] = useState(false);
28
27
  const { deleteObligationAssoc } = actions;
@@ -59,17 +58,15 @@ const InactiveControlsModule = ({
59
58
  description={description}
60
59
  subDescription={subDescription}
61
60
  allowedPaymentInstruments={allowedPaymentInstruments}
62
- isInCustomerManagement={isInCustomerManagement}
63
61
  />
64
62
  </Box>
65
63
  )}
66
64
  <Box padding="0" extraStyles={`flex-grow: 1;`}>
67
65
  <RemoveAccountModalModule
68
66
  agencyName={agencyName}
69
- removeAccount={isInCustomerManagement ? noop : handleRemoveAccount}
67
+ removeAccount={handleRemoveAccount}
70
68
  accountType={configType === "ACCOUNT" ? "Account" : "Property"}
71
69
  isMobile={isMobile}
72
- isInCustomerManagement={isInCustomerManagement}
73
70
  />
74
71
  </Box>
75
72
  </Cluster>
@@ -4,7 +4,6 @@ import ButtonWithAction from "../../../atoms/button-with-action";
4
4
  import { AutopayModalModule } from "./AutopayModalModule";
5
5
  import { GHOST_GREY } from "../../../../constants/colors";
6
6
  import AmountModule from "./AmountModule";
7
- import { noop } from "../../../../util/general";
8
7
 
9
8
  const PaymentDetailsActions = ({
10
9
  isMobile,
@@ -81,7 +80,6 @@ const PaymentDetailsActions = ({
81
80
  description={description}
82
81
  subDescription={subDescription}
83
82
  allowedPaymentInstruments={allowedPaymentInstruments}
84
- isInCustomerManagement={isInCustomerManagement}
85
83
  />
86
84
  </Cluster>
87
85
  </Box>
@@ -141,7 +139,6 @@ const PaymentDetailsActions = ({
141
139
  description={description}
142
140
  subDescription={subDescription}
143
141
  allowedPaymentInstruments={allowedPaymentInstruments}
144
- isInCustomerManagement={isInCustomerManagement}
145
142
  />
146
143
  )}
147
144
  </Box>
@@ -149,9 +146,7 @@ const PaymentDetailsActions = ({
149
146
  <Box padding={"0"}>
150
147
  <ButtonWithAction
151
148
  isLoading={isLoading}
152
- action={() =>
153
- isInCustomerManagement ? noop : handleClick(obligations)
154
- }
149
+ action={() => handleClick(obligations)}
155
150
  text="Pay Now"
156
151
  variant={isMobile ? "smallSecondary" : "secondary"}
157
152
  dataQa="Pay Now"
@@ -8,8 +8,7 @@ const RemoveAccountModalModule = ({
8
8
  obligations = [],
9
9
  removeAccount,
10
10
  accountType,
11
- isMobile,
12
- isInCustomerManagement = false
11
+ isMobile
13
12
  }) => {
14
13
  const [modalIsOpen, setModalIsOpen] = useState(false);
15
14
  const lastItem = [...obligations].pop();
@@ -55,7 +54,6 @@ const RemoveAccountModalModule = ({
55
54
  extraStyles={
56
55
  isMobile ? `flex-grow: 1; width: 100%; margin: 0;` : `flex-grow: 1;`
57
56
  }
58
- disabled={isInCustomerManagement}
59
57
  />
60
58
  </Box>
61
59
  </Modal>