@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/dist/index.esm.js CHANGED
@@ -22148,7 +22148,7 @@ var ENTER = 13;
22148
22148
  var ESCAPE = 27;
22149
22149
  var SPACEBAR = 32;
22150
22150
 
22151
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22151
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon", "customAriaLabel"];
22152
22152
  var CheckboxContainer = styled.span.withConfig({
22153
22153
  displayName: "Checkbox__CheckboxContainer",
22154
22154
  componentId: "sc-36kqbv-0"
@@ -22220,6 +22220,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22220
22220
  _ref5$hasIconOverride = _ref5.hasIconOverride,
22221
22221
  hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
22222
22222
  Icon = _ref5.icon,
22223
+ customAriaLabel = _ref5.customAriaLabel,
22223
22224
  rest = _objectWithoutProperties(_ref5, _excluded$x);
22224
22225
  var _useState = useState(false),
22225
22226
  _useState2 = _slicedToArray(_useState, 2),
@@ -22230,9 +22231,12 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22230
22231
  func();
22231
22232
  }
22232
22233
  };
22233
- var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22234
- var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22235
- var ariaLabel = ariaLabelledById ? undefined : name;
22234
+ var normalizeName = name ? name.replace(/\s+/g, "-") : "";
22235
+ var checkboxId = "checkbox-".concat(normalizeName);
22236
+ var titleId = title ? "checkboxlabel-".concat(normalizeName) : undefined;
22237
+ var ariaLabelledById = customAriaLabel ? undefined : labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22238
+ var ariaLabel = ariaLabelledById ? undefined : customAriaLabel !== null && customAriaLabel !== void 0 ? customAriaLabel : name;
22239
+ var errorMessageNormalized = error ? "".concat(normalizeName, "-error-message") : undefined;
22236
22240
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22237
22241
  ref: ref,
22238
22242
  padding: "0",
@@ -22243,7 +22247,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22243
22247
  "aria-invalid": error,
22244
22248
  "aria-label": ariaLabel,
22245
22249
  "aria-labelledby": ariaLabelledById,
22246
- "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22250
+ "aria-describedby": errorMessageNormalized,
22247
22251
  onFocus: function onFocus() {
22248
22252
  return setFocused(true);
22249
22253
  },
@@ -22261,7 +22265,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22261
22265
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22262
22266
  "data-qa": "Checkbox"
22263
22267
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22264
- id: "checkbox-".concat(name),
22268
+ id: checkboxId,
22265
22269
  disabled: disabled,
22266
22270
  name: name,
22267
22271
  checked: checked,
@@ -27021,7 +27025,7 @@ var NavFooter = function NavFooter(_ref) {
27021
27025
  background: backgroundColor,
27022
27026
  minHeight: footerMinHeight,
27023
27027
  minWidth: "100%",
27024
- extraStyles: isMobile ? "overflow: hidden;" : "height: ".concat(footerMinHeight, "; > * { height: 100%; };")
27028
+ extraStyles: isMobile ? "" : "min-height: ".concat(footerMinHeight, "; > * { min-height: 100%; };")
27025
27029
  }, rest), /*#__PURE__*/React__default.createElement(Center, {
27026
27030
  maxWidth: footerWidth || "76.5rem"
27027
27031
  }, /*#__PURE__*/React__default.createElement(Cover, {
@@ -47162,7 +47166,7 @@ var PartialAmountField = function PartialAmountField(_ref) {
47162
47166
  extraStyles: "display: block;",
47163
47167
  variant: themeValues.detailVariant,
47164
47168
  weight: "400"
47165
- }, lineItem.subDescription, " payment amount"))),
47169
+ }, lineItem.subDescription))),
47166
47170
  key: lineItem.id,
47167
47171
  field: field,
47168
47172
  fieldActions: fieldActions,
@@ -47174,7 +47178,6 @@ var PartialAmountField = function PartialAmountField(_ref) {
47174
47178
  placeholder: "$0.00",
47175
47179
  formatter: moneyFormat,
47176
47180
  isNum: true,
47177
- isRequired: true,
47178
47181
  decorator: /*#__PURE__*/React__default.createElement(Text$1, {
47179
47182
  variant: "p"
47180
47183
  }, "Amount owed:", " ", /*#__PURE__*/React__default.createElement(Text$1, {
@@ -48188,6 +48191,10 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48188
48191
  };
48189
48192
 
48190
48193
  var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
48194
+ var InlineTermsWrapper = styled.span.withConfig({
48195
+ displayName: "TermsAndConditionsControlV2__InlineTermsWrapper",
48196
+ componentId: "sc-16np073-0"
48197
+ })(["display:inline;> div{display:inline;}.modal-trigger{display:inline !important;}"]);
48191
48198
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48192
48199
  var _ref$showCheckbox = _ref.showCheckbox,
48193
48200
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48229,6 +48236,21 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48229
48236
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48230
48237
  }
48231
48238
  };
48239
+ if (!showCheckbox && displayInline) {
48240
+ return /*#__PURE__*/React__default.createElement(InlineTermsWrapper, {
48241
+ id: TermsAndConditionsTitleDivId
48242
+ }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48243
+ color: CHARADE_GREY
48244
+ }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48245
+ link: linkText,
48246
+ terms: terms,
48247
+ isOpen: showTerms,
48248
+ toggleOpen: toggleTerms,
48249
+ linkVariant: modalVariant,
48250
+ title: modalTitle,
48251
+ initialFocusSelector: initialFocusSelector
48252
+ }));
48253
+ }
48232
48254
  return /*#__PURE__*/React__default.createElement(Box, {
48233
48255
  padding: displayInline ? "0" : "1.5rem",
48234
48256
  minWidth: displayInline ? "0" : "100%",
@@ -48441,24 +48463,33 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48441
48463
  onChange: toggleCheckbox,
48442
48464
  checked: defaultMethod.value,
48443
48465
  hidden: hideDefaultPayment
48444
- }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48445
- childGap: "4px",
48446
- align: "center"
48447
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48466
+ }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48448
48467
  name: "bank checkbox",
48449
48468
  dataQa: "Save checking account to wallet",
48450
- title: "Save checking account to wallet.",
48469
+ customAriaLabel: "Save checking account to wallet (optional).",
48470
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save checking account to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
48471
+ onClick: function onClick(e) {
48472
+ return e.stopPropagation();
48473
+ },
48474
+ style: {
48475
+ display: "inline"
48476
+ }
48477
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48478
+ version: "v2",
48479
+ showCheckbox: false,
48480
+ description: "View ",
48481
+ terms: termsContent,
48482
+ initialFocusSelector: ".modal-close-button"
48483
+ }))),
48451
48484
  checked: walletCheckboxMarked,
48452
48485
  onChange: saveToWallet
48453
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48454
- singleChild: true
48455
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48486
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48456
48487
  version: "v2",
48457
48488
  showCheckbox: false,
48458
- description: "View",
48489
+ description: "View ",
48459
48490
  terms: termsContent,
48460
48491
  initialFocusSelector: ".modal-close-button"
48461
- })))));
48492
+ })));
48462
48493
  };
48463
48494
 
48464
48495
  var formConfig$6 = {
@@ -48630,24 +48661,33 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48630
48661
  },
48631
48662
  autocompleteValue: "billing postal-code",
48632
48663
  isRequired: true
48633
- })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48634
- childGap: "4px",
48635
- align: "center"
48636
- }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48637
- name: "credit card checkbox",
48664
+ })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48665
+ name: "bank checkbox",
48638
48666
  dataQa: "Save credit card to wallet",
48639
- title: "Save credit card to wallet.",
48667
+ customAriaLabel: "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
+ style: {
48673
+ display: "inline"
48674
+ }
48675
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48676
+ version: "v2",
48677
+ showCheckbox: false,
48678
+ description: "View ",
48679
+ terms: termsContent,
48680
+ initialFocusSelector: ".modal-close-button"
48681
+ }))),
48640
48682
  checked: walletCheckboxMarked,
48641
48683
  onChange: saveToWallet
48642
- }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48643
- singleChild: true
48644
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48684
+ }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48645
48685
  version: "v2",
48646
48686
  showCheckbox: false,
48647
- description: "View",
48687
+ description: "View ",
48648
48688
  terms: termsContent,
48649
48689
  initialFocusSelector: ".modal-close-button"
48650
- })))));
48690
+ })));
48651
48691
  };
48652
48692
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48653
48693