@thecb/components 12.1.0-beta.2 → 12.1.0-beta.4

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 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
- ### Local import and development
143
+ ### Testing changes locally
144
144
 
145
- If you are developing locally, you can add or make changes to components in the `@thecb/components` package and see those changes in the application running locally by linking the `@thecb/components` package to your application.
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
- - Run `yarn build`
149
- - Run `yarn link`
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
@@ -48330,7 +48330,17 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48330
48330
  _useState4 = _slicedToArray(_useState3, 2),
48331
48331
  showAccount = _useState4[0],
48332
48332
  toggleShowAccount = _useState4[1];
48333
+ var _useState5 = React.useState(false),
48334
+ _useState6 = _slicedToArray(_useState5, 2),
48335
+ showTermsModal = _useState6[0],
48336
+ setShowTermsModal = _useState6[1];
48333
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
+ };
48334
48344
  var nameErrors = _defineProperty({}, required.error, "Name is required");
48335
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");
48336
48346
  var confirmRoutingNumberErrors = _defineProperty(_defineProperty({}, required.error, "Confirm routing number is required"), matchesField.error, "Confirm routing number field must match routing number");
@@ -48448,26 +48458,29 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48448
48458
  onChange: toggleCheckbox,
48449
48459
  checked: defaultMethod.value,
48450
48460
  hidden: hideDefaultPayment
48451
- }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48452
- childGap: "4px",
48453
- align: "center",
48454
- overflow: true
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 (optional).",
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(Cover, {
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
- initialFocusSelector: ".modal-close-button",
48469
- textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48470
- })))));
48482
+ initialFocusSelector: ".modal-close-button"
48483
+ })));
48471
48484
  };
48472
48485
 
48473
48486
  var formConfig$6 = {
@@ -48522,7 +48535,17 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48522
48535
  termsContent = _ref.termsContent;
48523
48536
  var _useContext = React.useContext(styled.ThemeContext),
48524
48537
  isMobile = _useContext.isMobile;
48538
+ var _useState = React.useState(false),
48539
+ _useState2 = _slicedToArray(_useState, 2),
48540
+ showTermsModal = _useState2[0],
48541
+ setShowTermsModal = _useState2[1];
48525
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
+ };
48526
48549
  React.useEffect(function () {
48527
48550
  if (deniedCards) {
48528
48551
  deniedCards.map(function (card) {
@@ -48639,26 +48662,29 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48639
48662
  },
48640
48663
  autocompleteValue: "billing postal-code",
48641
48664
  isRequired: true
48642
- })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48643
- childGap: "4px",
48644
- align: "center",
48645
- overflow: true
48646
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48665
+ })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48647
48666
  name: "credit card checkbox",
48648
48667
  dataQa: "Save credit card to wallet",
48649
- title: "Save credit card to wallet (optional).",
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
+ }))),
48650
48679
  checked: walletCheckboxMarked,
48651
48680
  onChange: saveToWallet
48652
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48653
- singleChild: true
48654
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48681
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48655
48682
  version: "v2",
48656
48683
  showCheckbox: false,
48657
48684
  description: "View",
48658
48685
  terms: termsContent,
48659
- initialFocusSelector: ".modal-close-button",
48660
- textExtraStyles: "vertical-align: middle; margin-left: 40px;" /* determined w 24px checkbox width + 16px margin */
48661
- })))));
48686
+ initialFocusSelector: ".modal-close-button"
48687
+ })));
48662
48688
  };
48663
48689
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48664
48690