@thecb/components 12.1.0-beta.14 → 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);
@@ -22155,9 +22167,8 @@ var ARROW_DOWN = 40;
22155
22167
  var ENTER = 13;
22156
22168
  var ESCAPE = 27;
22157
22169
  var SPACEBAR = 32;
22158
- var SPACE_KEY = " ";
22159
22170
 
22160
- 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"];
22161
22172
  var CheckboxContainer = styled__default.span.withConfig({
22162
22173
  displayName: "Checkbox__CheckboxContainer",
22163
22174
  componentId: "sc-36kqbv-0"
@@ -22229,24 +22240,19 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22229
22240
  _ref5$hasIconOverride = _ref5.hasIconOverride,
22230
22241
  hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
22231
22242
  Icon = _ref5.icon,
22232
- customAriaLabel = _ref5.customAriaLabel,
22233
22243
  rest = _objectWithoutProperties(_ref5, _excluded$x);
22234
22244
  var _useState = React.useState(false),
22235
22245
  _useState2 = _slicedToArray(_useState, 2),
22236
22246
  focused = _useState2[0],
22237
22247
  setFocused = _useState2[1];
22238
22248
  var handleClick = function handleClick(e, func) {
22239
- if (e.key === SPACE_KEY) {
22240
- e.preventDefault();
22249
+ if (e.keyCode === ENTER) {
22241
22250
  func();
22242
22251
  }
22243
22252
  };
22244
- var normalizeName = name ? name.replace(/\s+/g, "-") : "";
22245
- var checkboxId = "checkbox-".concat(normalizeName);
22246
- var titleId = title ? "checkboxlabel-".concat(normalizeName) : undefined;
22247
- var ariaLabelledById = customAriaLabel ? undefined : labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22248
- var ariaLabel = ariaLabelledById ? undefined : customAriaLabel !== null && customAriaLabel !== void 0 ? customAriaLabel : name;
22249
- 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;
22250
22256
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22251
22257
  ref: ref,
22252
22258
  padding: "0",
@@ -22257,7 +22263,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22257
22263
  "aria-invalid": error,
22258
22264
  "aria-label": ariaLabel,
22259
22265
  "aria-labelledby": ariaLabelledById,
22260
- "aria-describedby": errorMessageNormalized,
22266
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22261
22267
  onFocus: function onFocus() {
22262
22268
  return setFocused(true);
22263
22269
  },
@@ -22275,7 +22281,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
22275
22281
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22276
22282
  "data-qa": "Checkbox"
22277
22283
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22278
- id: checkboxId,
22284
+ id: "checkbox-".concat(name),
22279
22285
  disabled: disabled,
22280
22286
  name: name,
22281
22287
  checked: checked,
@@ -48201,10 +48207,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48201
48207
  };
48202
48208
 
48203
48209
  var TermsAndConditionsTitleDivId = "terms-and-conditions-title";
48204
- var InlineTermsWrapper = styled__default.span.withConfig({
48205
- displayName: "TermsAndConditionsControlV2__InlineTermsWrapper",
48206
- componentId: "sc-16np073-0"
48207
- })(["display:inline;> div{display:inline;}.modal-trigger{display:inline !important;}"]);
48208
48210
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48209
48211
  var _ref$showCheckbox = _ref.showCheckbox,
48210
48212
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48246,21 +48248,6 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48246
48248
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48247
48249
  }
48248
48250
  };
48249
- if (!showCheckbox && displayInline) {
48250
- return /*#__PURE__*/React__default.createElement(InlineTermsWrapper, {
48251
- id: TermsAndConditionsTitleDivId
48252
- }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48253
- color: CHARADE_GREY
48254
- }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48255
- link: linkText,
48256
- terms: terms,
48257
- isOpen: showTerms,
48258
- toggleOpen: toggleTerms,
48259
- linkVariant: modalVariant,
48260
- title: modalTitle,
48261
- initialFocusSelector: initialFocusSelector
48262
- }));
48263
- }
48264
48251
  return /*#__PURE__*/React__default.createElement(Box, {
48265
48252
  padding: displayInline ? "0" : "1.5rem",
48266
48253
  minWidth: displayInline ? "0" : "100%",
@@ -48473,33 +48460,24 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48473
48460
  onChange: toggleCheckbox,
48474
48461
  checked: defaultMethod.value,
48475
48462
  hidden: hideDefaultPayment
48476
- }), 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, {
48477
48467
  name: "bank checkbox",
48478
48468
  dataQa: "Save checking account to wallet",
48479
- customAriaLabel: "Save checking account to wallet (optional).",
48480
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save checking account to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
48481
- onClick: function onClick(e) {
48482
- return e.stopPropagation();
48483
- },
48484
- style: {
48485
- display: "inline"
48486
- }
48487
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48488
- version: "v2",
48489
- showCheckbox: false,
48490
- description: "View ",
48491
- terms: termsContent,
48492
- initialFocusSelector: ".modal-close-button"
48493
- }))),
48469
+ title: "Save checking account to wallet.",
48494
48470
  checked: walletCheckboxMarked,
48495
48471
  onChange: saveToWallet
48496
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48472
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48473
+ singleChild: true
48474
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48497
48475
  version: "v2",
48498
48476
  showCheckbox: false,
48499
- description: "View ",
48477
+ description: "View",
48500
48478
  terms: termsContent,
48501
48479
  initialFocusSelector: ".modal-close-button"
48502
- })));
48480
+ })))));
48503
48481
  };
48504
48482
 
48505
48483
  var formConfig$6 = {
@@ -48671,33 +48649,24 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48671
48649
  },
48672
48650
  autocompleteValue: "billing postal-code",
48673
48651
  isRequired: true
48674
- })), 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, {
48675
48656
  name: "credit card checkbox",
48676
48657
  dataQa: "Save credit card to wallet",
48677
- customAriaLabel: "Save credit card to wallet (optional).",
48678
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Save credit card to wallet (optional).", " ", showTerms && /*#__PURE__*/React__default.createElement("span", {
48679
- onClick: function onClick(e) {
48680
- return e.stopPropagation();
48681
- },
48682
- style: {
48683
- display: "inline"
48684
- }
48685
- }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48686
- version: "v2",
48687
- showCheckbox: false,
48688
- description: "View ",
48689
- terms: termsContent,
48690
- initialFocusSelector: ".modal-close-button"
48691
- }))),
48658
+ title: "Save credit card to wallet.",
48692
48659
  checked: walletCheckboxMarked,
48693
48660
  onChange: saveToWallet
48694
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48661
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48662
+ singleChild: true
48663
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48695
48664
  version: "v2",
48696
48665
  showCheckbox: false,
48697
- description: "View ",
48666
+ description: "View",
48698
48667
  terms: termsContent,
48699
48668
  initialFocusSelector: ".modal-close-button"
48700
- })));
48669
+ })))));
48701
48670
  };
48702
48671
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48703
48672