@thecb/components 12.1.0-beta.12 → 12.1.0-beta.13

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/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 titleId = title ? "checkboxlabel-".concat(name) : undefined;
22242
- var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22243
- var ariaLabel = ariaLabelledById ? undefined : name;
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": error ? "".concat(name, "-error-message") : undefined,
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: "checkbox-".concat(name),
22276
+ id: checkboxId,
22273
22277
  disabled: disabled,
22274
22278
  name: name,
22275
22279
  checked: checked,
@@ -48195,6 +48199,10 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48195
48199
  };
48196
48200
 
48197
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;}"]);
48198
48206
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48199
48207
  var _ref$showCheckbox = _ref.showCheckbox,
48200
48208
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48236,6 +48244,21 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48236
48244
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48237
48245
  }
48238
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
+ }
48239
48262
  return /*#__PURE__*/React__default.createElement(Box, {
48240
48263
  padding: displayInline ? "0" : "1.5rem",
48241
48264
  minWidth: displayInline ? "0" : "100%",
@@ -48448,25 +48471,33 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48448
48471
  onChange: toggleCheckbox,
48449
48472
  checked: defaultMethod.value,
48450
48473
  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, {
48474
+ }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48456
48475
  name: "bank checkbox",
48457
48476
  dataQa: "Save checking account to wallet",
48458
- title: "Save checking account to wallet.",
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(Cover, {
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,25 +48669,33 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48638
48669
  },
48639
48670
  autocompleteValue: "billing postal-code",
48640
48671
  isRequired: true
48641
- })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48642
- childGap: "4px",
48643
- align: "center",
48644
- overflow: true
48645
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48672
+ })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48646
48673
  name: "credit card checkbox",
48647
48674
  dataQa: "Save credit card to wallet",
48648
- title: "Save credit card to wallet.",
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
+ }))),
48649
48690
  checked: walletCheckboxMarked,
48650
48691
  onChange: saveToWallet
48651
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48652
- singleChild: true
48653
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48692
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48654
48693
  version: "v2",
48655
48694
  showCheckbox: false,
48656
- description: "View",
48695
+ description: "View ",
48657
48696
  terms: termsContent,
48658
48697
  initialFocusSelector: ".modal-close-button"
48659
- })))));
48698
+ })));
48660
48699
  };
48661
48700
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48662
48701