@thecb/components 12.1.0-beta.1 → 12.1.0-beta.11
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 +70 -30
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +70 -30
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -2
- package/src/components/atoms/checkbox/Checkbox.js +13 -5
- package/src/components/atoms/nav-footer/NavFooter.js +2 -2
- package/src/components/molecules/partial-amount-form/PartialAmountField.js +1 -2
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +36 -24
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +36 -23
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +29 -0
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
|
@@ -22156,7 +22156,7 @@ var ENTER = 13;
|
|
|
22156
22156
|
var ESCAPE = 27;
|
|
22157
22157
|
var SPACEBAR = 32;
|
|
22158
22158
|
|
|
22159
|
-
var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
|
|
22159
|
+
var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon", "customAriaLabel"];
|
|
22160
22160
|
var CheckboxContainer = styled__default.span.withConfig({
|
|
22161
22161
|
displayName: "Checkbox__CheckboxContainer",
|
|
22162
22162
|
componentId: "sc-36kqbv-0"
|
|
@@ -22228,6 +22228,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
22228
22228
|
_ref5$hasIconOverride = _ref5.hasIconOverride,
|
|
22229
22229
|
hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
|
|
22230
22230
|
Icon = _ref5.icon,
|
|
22231
|
+
customAriaLabel = _ref5.customAriaLabel,
|
|
22231
22232
|
rest = _objectWithoutProperties(_ref5, _excluded$x);
|
|
22232
22233
|
var _useState = React.useState(false),
|
|
22233
22234
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -22238,9 +22239,12 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
22238
22239
|
func();
|
|
22239
22240
|
}
|
|
22240
22241
|
};
|
|
22241
|
-
var
|
|
22242
|
-
var
|
|
22243
|
-
var
|
|
22242
|
+
var normalizeName = name ? name.replace(/\s+/g, "-") : "";
|
|
22243
|
+
var checkboxId = "checkbox-".concat(normalizeName);
|
|
22244
|
+
var titleId = title ? "checkboxlabel-".concat(normalizeName) : undefined;
|
|
22245
|
+
var ariaLabelledById = customAriaLabel ? undefined : labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
|
|
22246
|
+
var ariaLabel = ariaLabelledById ? undefined : customAriaLabel !== null && customAriaLabel !== void 0 ? customAriaLabel : name;
|
|
22247
|
+
var errorMessageNormalized = error ? "".concat(normalizeName, "-error-message") : undefined;
|
|
22244
22248
|
return /*#__PURE__*/React__default.createElement(Box, _extends({
|
|
22245
22249
|
ref: ref,
|
|
22246
22250
|
padding: "0",
|
|
@@ -22251,7 +22255,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
22251
22255
|
"aria-invalid": error,
|
|
22252
22256
|
"aria-label": ariaLabel,
|
|
22253
22257
|
"aria-labelledby": ariaLabelledById,
|
|
22254
|
-
"aria-describedby":
|
|
22258
|
+
"aria-describedby": errorMessageNormalized,
|
|
22255
22259
|
onFocus: function onFocus() {
|
|
22256
22260
|
return setFocused(true);
|
|
22257
22261
|
},
|
|
@@ -22269,7 +22273,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
22269
22273
|
}, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
|
|
22270
22274
|
"data-qa": "Checkbox"
|
|
22271
22275
|
}, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
|
|
22272
|
-
id:
|
|
22276
|
+
id: checkboxId,
|
|
22273
22277
|
disabled: disabled,
|
|
22274
22278
|
name: name,
|
|
22275
22279
|
checked: checked,
|
|
@@ -27029,7 +27033,7 @@ var NavFooter = function NavFooter(_ref) {
|
|
|
27029
27033
|
background: backgroundColor,
|
|
27030
27034
|
minHeight: footerMinHeight,
|
|
27031
27035
|
minWidth: "100%",
|
|
27032
|
-
extraStyles: isMobile ? "
|
|
27036
|
+
extraStyles: isMobile ? "" : "min-height: ".concat(footerMinHeight, "; > * { min-height: 100%; };")
|
|
27033
27037
|
}, rest), /*#__PURE__*/React__default.createElement(Center, {
|
|
27034
27038
|
maxWidth: footerWidth || "76.5rem"
|
|
27035
27039
|
}, /*#__PURE__*/React__default.createElement(Cover, {
|
|
@@ -47170,7 +47174,7 @@ var PartialAmountField = function PartialAmountField(_ref) {
|
|
|
47170
47174
|
extraStyles: "display: block;",
|
|
47171
47175
|
variant: themeValues.detailVariant,
|
|
47172
47176
|
weight: "400"
|
|
47173
|
-
}, lineItem.subDescription
|
|
47177
|
+
}, lineItem.subDescription))),
|
|
47174
47178
|
key: lineItem.id,
|
|
47175
47179
|
field: field,
|
|
47176
47180
|
fieldActions: fieldActions,
|
|
@@ -47182,7 +47186,6 @@ var PartialAmountField = function PartialAmountField(_ref) {
|
|
|
47182
47186
|
placeholder: "$0.00",
|
|
47183
47187
|
formatter: moneyFormat,
|
|
47184
47188
|
isNum: true,
|
|
47185
|
-
isRequired: true,
|
|
47186
47189
|
decorator: /*#__PURE__*/React__default.createElement(Text$1, {
|
|
47187
47190
|
variant: "p"
|
|
47188
47191
|
}, "Amount owed:", " ", /*#__PURE__*/React__default.createElement(Text$1, {
|
|
@@ -48196,6 +48199,10 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
48196
48199
|
};
|
|
48197
48200
|
|
|
48198
48201
|
var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
|
|
48202
|
+
var InlineTermsWrapper = styled__default.span.withConfig({
|
|
48203
|
+
displayName: "TermsAndConditionsControlV2__InlineTermsWrapper",
|
|
48204
|
+
componentId: "sc-16np073-0"
|
|
48205
|
+
})(["display:inline;> div{display:inline;}.modal-trigger{display:inline !important;}"]);
|
|
48199
48206
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48200
48207
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48201
48208
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -48237,6 +48244,21 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
|
48237
48244
|
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48238
48245
|
}
|
|
48239
48246
|
};
|
|
48247
|
+
if (!showCheckbox && displayInline) {
|
|
48248
|
+
return /*#__PURE__*/React__default.createElement(InlineTermsWrapper, {
|
|
48249
|
+
id: TermsAndConditionsTitleDivId
|
|
48250
|
+
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48251
|
+
color: CHARADE_GREY
|
|
48252
|
+
}, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
48253
|
+
link: linkText,
|
|
48254
|
+
terms: terms,
|
|
48255
|
+
isOpen: showTerms,
|
|
48256
|
+
toggleOpen: toggleTerms,
|
|
48257
|
+
linkVariant: modalVariant,
|
|
48258
|
+
title: modalTitle,
|
|
48259
|
+
initialFocusSelector: initialFocusSelector
|
|
48260
|
+
}));
|
|
48261
|
+
}
|
|
48240
48262
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48241
48263
|
padding: displayInline ? "0" : "1.5rem",
|
|
48242
48264
|
minWidth: displayInline ? "0" : "100%",
|
|
@@ -48449,24 +48471,33 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
48449
48471
|
onChange: toggleCheckbox,
|
|
48450
48472
|
checked: defaultMethod.value,
|
|
48451
48473
|
hidden: hideDefaultPayment
|
|
48452
|
-
}),
|
|
48453
|
-
childGap: "4px",
|
|
48454
|
-
align: "center"
|
|
48455
|
-
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48474
|
+
}), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48456
48475
|
name: "bank checkbox",
|
|
48457
48476
|
dataQa: "Save checking account to wallet",
|
|
48458
|
-
|
|
48477
|
+
customAriaLabel: "Save checking account to wallet (optional).",
|
|
48478
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save checking account to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
|
|
48479
|
+
onClick: function onClick(e) {
|
|
48480
|
+
return e.stopPropagation();
|
|
48481
|
+
},
|
|
48482
|
+
style: {
|
|
48483
|
+
display: "inline"
|
|
48484
|
+
}
|
|
48485
|
+
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48486
|
+
version: "v2",
|
|
48487
|
+
showCheckbox: false,
|
|
48488
|
+
description: "View ",
|
|
48489
|
+
terms: termsContent,
|
|
48490
|
+
initialFocusSelector: ".modal-close-button"
|
|
48491
|
+
}))),
|
|
48459
48492
|
checked: walletCheckboxMarked,
|
|
48460
48493
|
onChange: saveToWallet
|
|
48461
|
-
}), showTerms && /*#__PURE__*/React__default.createElement(
|
|
48462
|
-
singleChild: true
|
|
48463
|
-
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48494
|
+
}), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48464
48495
|
version: "v2",
|
|
48465
48496
|
showCheckbox: false,
|
|
48466
|
-
description: "View",
|
|
48497
|
+
description: "View ",
|
|
48467
48498
|
terms: termsContent,
|
|
48468
48499
|
initialFocusSelector: ".modal-close-button"
|
|
48469
|
-
})))
|
|
48500
|
+
})));
|
|
48470
48501
|
};
|
|
48471
48502
|
|
|
48472
48503
|
var formConfig$6 = {
|
|
@@ -48638,24 +48669,33 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
48638
48669
|
},
|
|
48639
48670
|
autocompleteValue: "billing postal-code",
|
|
48640
48671
|
isRequired: true
|
|
48641
|
-
})),
|
|
48642
|
-
|
|
48643
|
-
align: "center"
|
|
48644
|
-
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48645
|
-
name: "credit card checkbox",
|
|
48672
|
+
})), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48673
|
+
name: "bank checkbox",
|
|
48646
48674
|
dataQa: "Save credit card to wallet",
|
|
48647
|
-
|
|
48675
|
+
customAriaLabel: "Save credit card to wallet (optional).",
|
|
48676
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save credit card to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
|
|
48677
|
+
onClick: function onClick(e) {
|
|
48678
|
+
return e.stopPropagation();
|
|
48679
|
+
},
|
|
48680
|
+
style: {
|
|
48681
|
+
display: "inline"
|
|
48682
|
+
}
|
|
48683
|
+
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48684
|
+
version: "v2",
|
|
48685
|
+
showCheckbox: false,
|
|
48686
|
+
description: "View ",
|
|
48687
|
+
terms: termsContent,
|
|
48688
|
+
initialFocusSelector: ".modal-close-button"
|
|
48689
|
+
}))),
|
|
48648
48690
|
checked: walletCheckboxMarked,
|
|
48649
48691
|
onChange: saveToWallet
|
|
48650
|
-
}), showTerms && /*#__PURE__*/React__default.createElement(
|
|
48651
|
-
singleChild: true
|
|
48652
|
-
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48692
|
+
}), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
48653
48693
|
version: "v2",
|
|
48654
48694
|
showCheckbox: false,
|
|
48655
|
-
description: "View",
|
|
48695
|
+
description: "View ",
|
|
48656
48696
|
terms: termsContent,
|
|
48657
48697
|
initialFocusSelector: ".modal-close-button"
|
|
48658
|
-
})))
|
|
48698
|
+
})));
|
|
48659
48699
|
};
|
|
48660
48700
|
var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
|
|
48661
48701
|
|