@thecb/components 10.1.3-beta.3 → 10.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.1.3-beta.3",
3
+ "version": "10.2.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -68,6 +68,7 @@ const ButtonWithAction = forwardRef(
68
68
  text,
69
69
  textWrap = false,
70
70
  isLoading = false,
71
+ disabled = false,
71
72
  loadingColor = "white",
72
73
  dataQa = null,
73
74
  textExtraStyles,
@@ -114,8 +115,8 @@ const ButtonWithAction = forwardRef(
114
115
  color: #FFFFFF;
115
116
  cursor: default;
116
117
  &:focus {
117
- box-shadow: 0 0 10px #6D717E;
118
- outline: none;
118
+ outline: 3px solid #6D717E;
119
+ outline-offset: 2px;
119
120
  }
120
121
  ${extraDisabledStyles}
121
122
  `;
@@ -129,11 +130,12 @@ const ButtonWithAction = forwardRef(
129
130
  minWidth={themeValues.minWidth}
130
131
  background={themeValues.backgroundColor}
131
132
  border={themeValues.border}
132
- hoverStyles={hoverStyles}
133
- activeStyles={activeStyles}
133
+ hoverStyles={disabled ? disabledStyles : hoverStyles}
134
+ activeStyles={disabled ? disabledStyles : activeStyles}
134
135
  disabledStyles={disabledStyles}
136
+ aria-disabled={disabled}
135
137
  as="button"
136
- onClick={isLoading ? undefined : action}
138
+ onClick={isLoading || disabled ? undefined : action}
137
139
  borderRadius="2px"
138
140
  theme={themeContext}
139
141
  extraStyles={`margin: 0.5rem; ${extraStyles}`}
@@ -18,12 +18,15 @@ const variants = {
18
18
  const defaultValue = "primary";
19
19
  const groupId = "props";
20
20
 
21
+ const buttonHandler = () => console.log("Button selected");
22
+
21
23
  export const buttonWithAction = () => (
22
24
  <ButtonWithAction
23
25
  variant={select(variantsLabel, variants, defaultValue, groupId)}
24
26
  text={text("text", "button", "props")}
25
27
  isLoading={boolean("isLoading", false, "props")}
26
- action={text("action", undefined, "props")}
28
+ action={text("action", buttonHandler, "props")}
29
+ disabled={boolean("disabled", false, "props")}
27
30
  />
28
31
  );
29
32
 
@@ -57,7 +57,11 @@ const ButtonWithLink = ({
57
57
  text-decoration: none; }`}
58
58
  dataQa={dataQa}
59
59
  >
60
- <ButtonWithAction {...otherProps} extraStyles={extraStyles} />
60
+ <ButtonWithAction
61
+ {...otherProps}
62
+ disabled={disabled}
63
+ extraStyles={extraStyles}
64
+ />
61
65
  </ButtonWithLinkWrapper>
62
66
  );
63
67
  };
@@ -107,6 +107,21 @@ export const BoxWrapper = styled(
107
107
  : ``}
108
108
  `}
109
109
  }
110
+
111
+ &[aria-disabled="true"] {
112
+ ${({ disabledStyles, as }) =>
113
+ css`
114
+ ${disabledStyles}
115
+ ${as === "button"
116
+ ? ` > * > span {
117
+ ${disabledStyles}
118
+ border: none;
119
+ outline: none;
120
+ box-shadow: none;
121
+ }`
122
+ : ``}
123
+ `}
124
+ }
110
125
 
111
126
  & * {
112
127
  color: ${({ color }) => color};
@@ -43,7 +43,7 @@ const AutopayModal = ({
43
43
  };
44
44
  const plan = isPaymentPlan ? "your payment plan" : "autopay";
45
45
  const shortPlan = isPaymentPlan ? "Payment Plan" : "Autopay";
46
- const deactivateText = `stop ${shortPlan.toLowerCase()} for ${description}: ${subDescription}`;
46
+ const deactivateText = `deactivate ${shortPlan} for ${description}: ${subDescription}`;
47
47
  const activateText = `Set Up ${shortPlan} for ${description}: ${subDescription}`;
48
48
  const nextDate = dueDate || nextAutopayDate;
49
49
  const modalExtraProps = {
@@ -51,13 +51,13 @@ const AutopayModal = ({
51
51
  ? titleCaseString(deactivateText)
52
52
  : titleCaseString(activateText),
53
53
  modalBodyText: autoPayActive
54
- ? `Are you sure you want to stop ${plan}? ${
55
- !inactive && nextDate && nextDate !== "On"
56
- ? "Your next payment will be due on " + nextDate + "."
54
+ ? `Are you sure you want to deactivate ${plan}? ${
55
+ !inactive && nextDate
56
+ ? `Your next payment will be due on ${nextDate}.`
57
57
  : ""
58
58
  }`
59
59
  : generateMethodNeededText(plan, allowedPaymentInstruments),
60
- continueButtonText: autoPayActive ? `Stop ${shortPlan}` : "Add",
60
+ continueButtonText: autoPayActive ? `Disable ${shortPlan}` : "Add",
61
61
  useDangerButton: autoPayActive,
62
62
  continueAction: autoPayActive
63
63
  ? () => {