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

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
@@ -19826,7 +19826,13 @@ var Alert = function Alert(_ref) {
19826
19826
  _ref$ariaAtomic = _ref.ariaAtomic,
19827
19827
  ariaAtomic = _ref$ariaAtomic === void 0 ? true : _ref$ariaAtomic,
19828
19828
  _ref$ariaLive = _ref.ariaLive,
19829
- ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive;
19829
+ ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive,
19830
+ _ref$ariaLabelledBy = _ref.ariaLabelledBy,
19831
+ ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? null : _ref$ariaLabelledBy,
19832
+ _ref$headingAs = _ref.headingAs,
19833
+ headingAs = _ref$headingAs === void 0 ? null : _ref$headingAs,
19834
+ _ref$headingId = _ref.headingId,
19835
+ headingId = _ref$headingId === void 0 ? null : _ref$headingId;
19830
19836
  var Icon = AlertIcons[variant];
19831
19837
  var contentPadding = maxContentWidth ? "".concat(padding, " 1rem") : innerContentPadding;
19832
19838
  var content = /*#__PURE__*/React__default.createElement(Sidebar, {
@@ -19857,11 +19863,15 @@ var Alert = function Alert(_ref) {
19857
19863
  }, textOverride ? textOverride : /*#__PURE__*/React__default.createElement(Stack, {
19858
19864
  fullHeight: true,
19859
19865
  childGap: "0"
19860
- }, /*#__PURE__*/React__default.createElement(Text$1, {
19866
+ }, /*#__PURE__*/React__default.createElement(Text$1, _extends({
19861
19867
  variant: enableSmallText ? "pS" : "p",
19862
19868
  color: themeValues.text,
19863
19869
  weight: "600"
19864
- }, heading), /*#__PURE__*/React__default.createElement(Text$1, {
19870
+ }, headingAs ? {
19871
+ as: headingAs
19872
+ } : {}, headingId ? {
19873
+ id: headingId
19874
+ } : {}), heading), /*#__PURE__*/React__default.createElement(Text$1, {
19865
19875
  variant: "pS",
19866
19876
  color: themeValues.text
19867
19877
  }, text), children))), /*#__PURE__*/React__default.createElement(Cluster, {
@@ -19895,6 +19905,8 @@ var Alert = function Alert(_ref) {
19895
19905
  "aria-atomic": ariaAtomic
19896
19906
  } : {}, ariaRole !== null ? {
19897
19907
  role: ariaRole
19908
+ } : {}, ariaLabelledBy !== null ? {
19909
+ "aria-labelledby": ariaLabelledBy
19898
19910
  } : {}), maxContentWidth ? /*#__PURE__*/React__default.createElement(Center, {
19899
19911
  maxWidth: maxContentWidth
19900
19912
  }, content) : content);
@@ -22156,7 +22168,7 @@ var ENTER = 13;
22156
22168
  var ESCAPE = 27;
22157
22169
  var SPACEBAR = 32;
22158
22170
 
22159
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon", "customAriaLabel"];
22171
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22160
22172
  var CheckboxContainer = styled__default.span.withConfig({
22161
22173
  displayName: "Checkbox__CheckboxContainer",
22162
22174
  componentId: "sc-36kqbv-0"
@@ -22228,7 +22240,6 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22228
22240
  _ref5$hasIconOverride = _ref5.hasIconOverride,
22229
22241
  hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
22230
22242
  Icon = _ref5.icon,
22231
- customAriaLabel = _ref5.customAriaLabel,
22232
22243
  rest = _objectWithoutProperties(_ref5, _excluded$x);
22233
22244
  var _useState = React.useState(false),
22234
22245
  _useState2 = _slicedToArray(_useState, 2),
@@ -22239,12 +22250,9 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22239
22250
  func();
22240
22251
  }
22241
22252
  };
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;
22253
+ var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22254
+ var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22255
+ var ariaLabel = ariaLabelledById ? undefined : name;
22248
22256
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22249
22257
  ref: ref,
22250
22258
  padding: "0",
@@ -22255,7 +22263,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22255
22263
  "aria-invalid": error,
22256
22264
  "aria-label": ariaLabel,
22257
22265
  "aria-labelledby": ariaLabelledById,
22258
- "aria-describedby": errorMessageNormalized,
22266
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22259
22267
  onFocus: function onFocus() {
22260
22268
  return setFocused(true);
22261
22269
  },
@@ -22273,7 +22281,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22273
22281
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22274
22282
  "data-qa": "Checkbox"
22275
22283
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22276
- id: checkboxId,
22284
+ id: "checkbox-".concat(name),
22277
22285
  disabled: disabled,
22278
22286
  name: name,
22279
22287
  checked: checked,
@@ -48199,10 +48207,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48199
48207
  };
48200
48208
 
48201
48209
  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;}"]);
48206
48210
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48207
48211
  var _ref$showCheckbox = _ref.showCheckbox,
48208
48212
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48244,21 +48248,6 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48244
48248
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48245
48249
  }
48246
48250
  };
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
- }
48262
48251
  return /*#__PURE__*/React__default.createElement(Box, {
48263
48252
  padding: displayInline ? "0" : "1.5rem",
48264
48253
  minWidth: displayInline ? "0" : "100%",
@@ -48471,33 +48460,24 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48471
48460
  onChange: toggleCheckbox,
48472
48461
  checked: defaultMethod.value,
48473
48462
  hidden: hideDefaultPayment
48474
- }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48463
+ }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48464
+ childGap: "4px",
48465
+ align: "center"
48466
+ }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48475
48467
  name: "bank checkbox",
48476
48468
  dataQa: "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
- }))),
48469
+ title: "Save checking account to wallet.",
48492
48470
  checked: walletCheckboxMarked,
48493
48471
  onChange: saveToWallet
48494
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48472
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48473
+ singleChild: true
48474
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48495
48475
  version: "v2",
48496
48476
  showCheckbox: false,
48497
- description: "View ",
48477
+ description: "View",
48498
48478
  terms: termsContent,
48499
48479
  initialFocusSelector: ".modal-close-button"
48500
- })));
48480
+ })))));
48501
48481
  };
48502
48482
 
48503
48483
  var formConfig$6 = {
@@ -48669,33 +48649,24 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48669
48649
  },
48670
48650
  autocompleteValue: "billing postal-code",
48671
48651
  isRequired: true
48672
- })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48652
+ })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48653
+ childGap: "4px",
48654
+ align: "center"
48655
+ }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48673
48656
  name: "credit card checkbox",
48674
48657
  dataQa: "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
- }))),
48658
+ title: "Save credit card to wallet.",
48690
48659
  checked: walletCheckboxMarked,
48691
48660
  onChange: saveToWallet
48692
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48661
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48662
+ singleChild: true
48663
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48693
48664
  version: "v2",
48694
48665
  showCheckbox: false,
48695
- description: "View ",
48666
+ description: "View",
48696
48667
  terms: termsContent,
48697
48668
  initialFocusSelector: ".modal-close-button"
48698
- })));
48669
+ })))));
48699
48670
  };
48700
48671
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48701
48672