@thecb/components 12.1.0-beta.1 → 12.1.0-beta.3
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/README.md +5 -24
- package/dist/index.cjs.js +75 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +75 -46
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -2
- package/src/components/atoms/checkbox/Checkbox.js +15 -21
- package/src/components/atoms/checkbox/Checkbox.stories.js +7 -1
- package/src/components/molecules/partial-amount-form/PartialAmountField.js +1 -2
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +44 -24
- package/src/components/molecules/payment-form-ach/PaymentFormACH.stories.js +133 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +44 -24
- package/src/components/molecules/payment-form-card/PaymentFormCard.stories.js +131 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +3 -2
package/README.md
CHANGED
|
@@ -140,32 +140,13 @@ Publishing to NPM is automated. When a PR is merged to master, the package will
|
|
|
140
140
|
- Run `yarn add @thecb/components`.
|
|
141
141
|
- To verify it installed successfully, make sure it is in the applicaton's `package.json` file.
|
|
142
142
|
|
|
143
|
-
###
|
|
143
|
+
### Testing changes locally
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
Open the `@thecb/components`, and in the command line
|
|
145
|
+
See **[TESTING.md](./TESTING.md)** for a complete guide to testing your changes. In short, you have three options:
|
|
147
146
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
You should see a success message, and directions on how to link this package into an application. In the application you’d like the components, navigate to that application and in the command line
|
|
152
|
-
|
|
153
|
-
- Run `yarn link @thecb/components`
|
|
154
|
-
|
|
155
|
-
Now the package is linked locally and you can make changes to the `@thecb/components` and you’ll see the changes in the application running `@thecb/components`. To unlink the package, in the application running `@thecb/components` and in the command line
|
|
156
|
-
|
|
157
|
-
- Run `yarn unlink @thecb/components`
|
|
158
|
-
- Run `yarn install` ` --``force `
|
|
159
|
-
|
|
160
|
-
Next go to the `@thecb/components` and in the command line
|
|
161
|
-
|
|
162
|
-
- Run `yarn unlink`
|
|
163
|
-
|
|
164
|
-
Now the package is unlinked, and you’re using the version on NPM.
|
|
165
|
-
|
|
166
|
-
### Yalc
|
|
167
|
-
|
|
168
|
-
If you encounter issues using `yarn link`, a nice alternative is `yalc`. See [https://github.com/wclr/yalc](https://github.com/wclr/yalc) for usage instructions.
|
|
147
|
+
1. **Storybook** (`yarn storybook`) — fastest, for self-contained component changes
|
|
148
|
+
2. **Live Sync** (`yarn sync <path-to-project>`) — test inside a real running app without publishing
|
|
149
|
+
3. **Beta Publish** (`yarn publish-beta`) — publish to npm for CI/CD, QA, or sharing with teammates
|
|
169
150
|
|
|
170
151
|
### Importing and using components
|
|
171
152
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -22238,45 +22238,43 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
22238
22238
|
func();
|
|
22239
22239
|
}
|
|
22240
22240
|
};
|
|
22241
|
-
var
|
|
22242
|
-
var
|
|
22243
|
-
var
|
|
22241
|
+
var normalizedName = name ? name.replace(/\s+/g, "-") : name;
|
|
22242
|
+
var checkboxId = "checkbox-".concat(normalizedName);
|
|
22243
|
+
var titleId = title ? "checkboxlabel-".concat(normalizedName) : undefined;
|
|
22244
|
+
// aria-label fallback when no visible title or external labelledById is provided
|
|
22245
|
+
var ariaLabel = !labelledById && !title ? name : undefined;
|
|
22244
22246
|
return /*#__PURE__*/React__default.createElement(Box, _extends({
|
|
22245
22247
|
ref: ref,
|
|
22246
22248
|
padding: "0",
|
|
22247
|
-
tabIndex: "0",
|
|
22248
|
-
role: "checkbox",
|
|
22249
|
-
"aria-checked": checked,
|
|
22250
|
-
"aria-required": isRequired || undefined,
|
|
22251
|
-
"aria-invalid": error,
|
|
22252
|
-
"aria-label": ariaLabel,
|
|
22253
|
-
"aria-labelledby": ariaLabelledById,
|
|
22254
|
-
"aria-describedby": error ? "".concat(name, "-error-message") : undefined,
|
|
22255
|
-
onFocus: function onFocus() {
|
|
22256
|
-
return setFocused(true);
|
|
22257
|
-
},
|
|
22258
|
-
onBlur: function onBlur() {
|
|
22259
|
-
return setFocused(false);
|
|
22260
|
-
},
|
|
22261
|
-
onKeyDown: function onKeyDown(e) {
|
|
22262
|
-
return handleClick(e, onChange);
|
|
22263
|
-
},
|
|
22264
22249
|
hiddenStyles: hidden,
|
|
22265
22250
|
background: themeValues.backgroundColor,
|
|
22266
|
-
extraStyles: "\n
|
|
22251
|
+
extraStyles: "\n ".concat(extraStyles, "; \n margin: ").concat(checkboxMargin, ";\n ")
|
|
22267
22252
|
}, rest), /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, {
|
|
22253
|
+
htmlFor: checkboxId,
|
|
22268
22254
|
"data-qa": dataQa
|
|
22269
22255
|
}, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
|
|
22270
22256
|
"data-qa": "Checkbox"
|
|
22271
22257
|
}, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
|
|
22272
|
-
id:
|
|
22258
|
+
id: checkboxId,
|
|
22273
22259
|
disabled: disabled,
|
|
22274
22260
|
name: name,
|
|
22275
22261
|
checked: checked,
|
|
22276
22262
|
onChange: onChange,
|
|
22277
|
-
tabIndex: "
|
|
22263
|
+
tabIndex: "0",
|
|
22278
22264
|
required: isRequired,
|
|
22279
|
-
"aria-
|
|
22265
|
+
"aria-invalid": error,
|
|
22266
|
+
"aria-label": ariaLabel,
|
|
22267
|
+
"aria-labelledby": labelledById,
|
|
22268
|
+
"aria-describedby": error ? "".concat(name, "-error-message") : undefined,
|
|
22269
|
+
onKeyDown: function onKeyDown(e) {
|
|
22270
|
+
return handleClick(e, onChange);
|
|
22271
|
+
},
|
|
22272
|
+
onFocus: function onFocus() {
|
|
22273
|
+
return setFocused(true);
|
|
22274
|
+
},
|
|
22275
|
+
onBlur: function onBlur() {
|
|
22276
|
+
return setFocused(false);
|
|
22277
|
+
}
|
|
22280
22278
|
}), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
|
|
22281
22279
|
"aria-hidden": "true",
|
|
22282
22280
|
error: error,
|
|
@@ -47170,7 +47168,7 @@ var PartialAmountField = function PartialAmountField(_ref) {
|
|
|
47170
47168
|
extraStyles: "display: block;",
|
|
47171
47169
|
variant: themeValues.detailVariant,
|
|
47172
47170
|
weight: "400"
|
|
47173
|
-
}, lineItem.subDescription
|
|
47171
|
+
}, lineItem.subDescription))),
|
|
47174
47172
|
key: lineItem.id,
|
|
47175
47173
|
field: field,
|
|
47176
47174
|
fieldActions: fieldActions,
|
|
@@ -47182,7 +47180,6 @@ var PartialAmountField = function PartialAmountField(_ref) {
|
|
|
47182
47180
|
placeholder: "$0.00",
|
|
47183
47181
|
formatter: moneyFormat,
|
|
47184
47182
|
isNum: true,
|
|
47185
|
-
isRequired: true,
|
|
47186
47183
|
decorator: /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47187
47184
|
variant: "p"
|
|
47188
47185
|
}, "Amount owed:", " ", /*#__PURE__*/React__default.createElement(Text$1, {
|
|
@@ -48225,7 +48222,9 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48225
48222
|
_ref$initialFocusSele = _ref.initialFocusSelector,
|
|
48226
48223
|
initialFocusSelector = _ref$initialFocusSele === void 0 ? "" : _ref$initialFocusSele,
|
|
48227
48224
|
_ref$isRequired = _ref.isRequired,
|
|
48228
|
-
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired
|
|
48225
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
48226
|
+
_ref$textExtraStyles = _ref.textExtraStyles,
|
|
48227
|
+
textExtraStyles = _ref$textExtraStyles === void 0 ? "" : _ref$textExtraStyles;
|
|
48229
48228
|
var _useState = React.useState(false),
|
|
48230
48229
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48231
48230
|
showTerms = _useState2[0],
|
|
@@ -48267,7 +48266,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48267
48266
|
justify: "flex-start",
|
|
48268
48267
|
align: "center",
|
|
48269
48268
|
nowrap: true,
|
|
48270
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };",
|
|
48269
|
+
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; }; ".concat(textExtraStyles),
|
|
48271
48270
|
id: TermsAndConditionsTitleDivId
|
|
48272
48271
|
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48273
48272
|
color: CHARADE_GREY
|
|
@@ -48331,7 +48330,17 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
48331
48330
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
48332
48331
|
showAccount = _useState4[0],
|
|
48333
48332
|
toggleShowAccount = _useState4[1];
|
|
48333
|
+
var _useState5 = React.useState(false),
|
|
48334
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
48335
|
+
showTermsModal = _useState6[0],
|
|
48336
|
+
setShowTermsModal = _useState6[1];
|
|
48334
48337
|
var showTerms = !!termsContent;
|
|
48338
|
+
var toggleTermsModal = function toggleTermsModal(open) {
|
|
48339
|
+
setShowTermsModal(open);
|
|
48340
|
+
if (open) {
|
|
48341
|
+
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48342
|
+
}
|
|
48343
|
+
};
|
|
48335
48344
|
var nameErrors = _defineProperty({}, required.error, "Name is required");
|
|
48336
48345
|
var routingNumberErrors = _defineProperty(_defineProperty(_defineProperty({}, required.error, "Routing number is required"), hasLength.error, "Routing number must be 9 digits"), isRoutingNumber.error, "Invalid routing number");
|
|
48337
48346
|
var confirmRoutingNumberErrors = _defineProperty(_defineProperty({}, required.error, "Confirm routing number is required"), matchesField.error, "Confirm routing number field must match routing number");
|
|
@@ -48449,24 +48458,29 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
48449
48458
|
onChange: toggleCheckbox,
|
|
48450
48459
|
checked: defaultMethod.value,
|
|
48451
48460
|
hidden: hideDefaultPayment
|
|
48452
|
-
}),
|
|
48453
|
-
childGap: "4px",
|
|
48454
|
-
align: "center"
|
|
48455
|
-
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48461
|
+
}), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48456
48462
|
name: "bank checkbox",
|
|
48457
48463
|
dataQa: "Save checking account to wallet",
|
|
48458
|
-
title: "Save checking account to wallet.",
|
|
48464
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save checking account to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
|
|
48465
|
+
onClick: function onClick(e) {
|
|
48466
|
+
return e.stopPropagation();
|
|
48467
|
+
}
|
|
48468
|
+
}, "View", " ", /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
48469
|
+
link: "Terms and Conditions",
|
|
48470
|
+
terms: termsContent,
|
|
48471
|
+
isOpen: showTermsModal,
|
|
48472
|
+
toggleOpen: toggleTermsModal,
|
|
48473
|
+
initialFocusSelector: ".modal-close-button"
|
|
48474
|
+
}))),
|
|
48459
48475
|
checked: walletCheckboxMarked,
|
|
48460
48476
|
onChange: saveToWallet
|
|
48461
|
-
}), showTerms && /*#__PURE__*/React__default.createElement(
|
|
48462
|
-
singleChild: true
|
|
48463
|
-
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48477
|
+
}), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48464
48478
|
version: "v2",
|
|
48465
48479
|
showCheckbox: false,
|
|
48466
48480
|
description: "View",
|
|
48467
48481
|
terms: termsContent,
|
|
48468
48482
|
initialFocusSelector: ".modal-close-button"
|
|
48469
|
-
})))
|
|
48483
|
+
})));
|
|
48470
48484
|
};
|
|
48471
48485
|
|
|
48472
48486
|
var formConfig$6 = {
|
|
@@ -48521,7 +48535,17 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48521
48535
|
termsContent = _ref.termsContent;
|
|
48522
48536
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
48523
48537
|
isMobile = _useContext.isMobile;
|
|
48538
|
+
var _useState = React.useState(false),
|
|
48539
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48540
|
+
showTermsModal = _useState2[0],
|
|
48541
|
+
setShowTermsModal = _useState2[1];
|
|
48524
48542
|
var showTerms = !!termsContent;
|
|
48543
|
+
var toggleTermsModal = function toggleTermsModal(open) {
|
|
48544
|
+
setShowTermsModal(open);
|
|
48545
|
+
if (open) {
|
|
48546
|
+
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48547
|
+
}
|
|
48548
|
+
};
|
|
48525
48549
|
React.useEffect(function () {
|
|
48526
48550
|
if (deniedCards) {
|
|
48527
48551
|
deniedCards.map(function (card) {
|
|
@@ -48638,24 +48662,29 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48638
48662
|
},
|
|
48639
48663
|
autocompleteValue: "billing postal-code",
|
|
48640
48664
|
isRequired: true
|
|
48641
|
-
})),
|
|
48642
|
-
childGap: "4px",
|
|
48643
|
-
align: "center"
|
|
48644
|
-
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48665
|
+
})), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48645
48666
|
name: "credit card checkbox",
|
|
48646
48667
|
dataQa: "Save credit card to wallet",
|
|
48647
|
-
title: "Save credit card to wallet.",
|
|
48668
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save credit card to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
|
|
48669
|
+
onClick: function onClick(e) {
|
|
48670
|
+
return e.stopPropagation();
|
|
48671
|
+
}
|
|
48672
|
+
}, "View", " ", /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
48673
|
+
link: "Terms and Conditions",
|
|
48674
|
+
terms: termsContent,
|
|
48675
|
+
isOpen: showTermsModal,
|
|
48676
|
+
toggleOpen: toggleTermsModal,
|
|
48677
|
+
initialFocusSelector: ".modal-close-button"
|
|
48678
|
+
}))),
|
|
48648
48679
|
checked: walletCheckboxMarked,
|
|
48649
48680
|
onChange: saveToWallet
|
|
48650
|
-
}), showTerms && /*#__PURE__*/React__default.createElement(
|
|
48651
|
-
singleChild: true
|
|
48652
|
-
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48681
|
+
}), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48653
48682
|
version: "v2",
|
|
48654
48683
|
showCheckbox: false,
|
|
48655
48684
|
description: "View",
|
|
48656
48685
|
terms: termsContent,
|
|
48657
48686
|
initialFocusSelector: ".modal-close-button"
|
|
48658
|
-
})))
|
|
48687
|
+
})));
|
|
48659
48688
|
};
|
|
48660
48689
|
var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
|
|
48661
48690
|
|