@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.d.ts CHANGED
@@ -598,6 +598,12 @@ interface AlertProps {
598
598
  innerContentPadding?: string;
599
599
  iconPadding?: string;
600
600
  contentFullHeight?: boolean;
601
+ ariaRole?: string;
602
+ ariaAtomic?: boolean;
603
+ ariaLive?: string;
604
+ ariaLabelledBy?: string;
605
+ headingAs?: string;
606
+ headingId?: string;
601
607
  }
602
608
 
603
609
  declare const Alert: React.FC<Expand<AlertProps> &
package/dist/index.esm.js CHANGED
@@ -19818,7 +19818,13 @@ var Alert = function Alert(_ref) {
19818
19818
  _ref$ariaAtomic = _ref.ariaAtomic,
19819
19819
  ariaAtomic = _ref$ariaAtomic === void 0 ? true : _ref$ariaAtomic,
19820
19820
  _ref$ariaLive = _ref.ariaLive,
19821
- ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive;
19821
+ ariaLive = _ref$ariaLive === void 0 ? "polite" : _ref$ariaLive,
19822
+ _ref$ariaLabelledBy = _ref.ariaLabelledBy,
19823
+ ariaLabelledBy = _ref$ariaLabelledBy === void 0 ? null : _ref$ariaLabelledBy,
19824
+ _ref$headingAs = _ref.headingAs,
19825
+ headingAs = _ref$headingAs === void 0 ? null : _ref$headingAs,
19826
+ _ref$headingId = _ref.headingId,
19827
+ headingId = _ref$headingId === void 0 ? null : _ref$headingId;
19822
19828
  var Icon = AlertIcons[variant];
19823
19829
  var contentPadding = maxContentWidth ? "".concat(padding, " 1rem") : innerContentPadding;
19824
19830
  var content = /*#__PURE__*/React__default.createElement(Sidebar, {
@@ -19849,11 +19855,15 @@ var Alert = function Alert(_ref) {
19849
19855
  }, textOverride ? textOverride : /*#__PURE__*/React__default.createElement(Stack, {
19850
19856
  fullHeight: true,
19851
19857
  childGap: "0"
19852
- }, /*#__PURE__*/React__default.createElement(Text$1, {
19858
+ }, /*#__PURE__*/React__default.createElement(Text$1, _extends({
19853
19859
  variant: enableSmallText ? "pS" : "p",
19854
19860
  color: themeValues.text,
19855
19861
  weight: "600"
19856
- }, heading), /*#__PURE__*/React__default.createElement(Text$1, {
19862
+ }, headingAs ? {
19863
+ as: headingAs
19864
+ } : {}, headingId ? {
19865
+ id: headingId
19866
+ } : {}), heading), /*#__PURE__*/React__default.createElement(Text$1, {
19857
19867
  variant: "pS",
19858
19868
  color: themeValues.text
19859
19869
  }, text), children))), /*#__PURE__*/React__default.createElement(Cluster, {
@@ -19887,6 +19897,8 @@ var Alert = function Alert(_ref) {
19887
19897
  "aria-atomic": ariaAtomic
19888
19898
  } : {}, ariaRole !== null ? {
19889
19899
  role: ariaRole
19900
+ } : {}, ariaLabelledBy !== null ? {
19901
+ "aria-labelledby": ariaLabelledBy
19890
19902
  } : {}), maxContentWidth ? /*#__PURE__*/React__default.createElement(Center, {
19891
19903
  maxWidth: maxContentWidth
19892
19904
  }, content) : content);
@@ -22148,7 +22160,7 @@ var ENTER = 13;
22148
22160
  var ESCAPE = 27;
22149
22161
  var SPACEBAR = 32;
22150
22162
 
22151
- var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon", "customAriaLabel"];
22163
+ var _excluded$x = ["title", "name", "checked", "onChange", "disabled", "themeValues", "hidden", "error", "isRequired", "checkboxMargin", "extraStyles", "textExtraStyles", "labelledById", "dataQa", "checkboxExtraStyles", "hasIconOverride", "icon"];
22152
22164
  var CheckboxContainer = styled.span.withConfig({
22153
22165
  displayName: "Checkbox__CheckboxContainer",
22154
22166
  componentId: "sc-36kqbv-0"
@@ -22220,7 +22232,6 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22220
22232
  _ref5$hasIconOverride = _ref5.hasIconOverride,
22221
22233
  hasIconOverride = _ref5$hasIconOverride === void 0 ? false : _ref5$hasIconOverride,
22222
22234
  Icon = _ref5.icon,
22223
- customAriaLabel = _ref5.customAriaLabel,
22224
22235
  rest = _objectWithoutProperties(_ref5, _excluded$x);
22225
22236
  var _useState = useState(false),
22226
22237
  _useState2 = _slicedToArray(_useState, 2),
@@ -22231,12 +22242,9 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22231
22242
  func();
22232
22243
  }
22233
22244
  };
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;
22245
+ var titleId = title ? "checkboxlabel-".concat(name) : undefined;
22246
+ var ariaLabelledById = labelledById !== null && labelledById !== void 0 ? labelledById : titleId;
22247
+ var ariaLabel = ariaLabelledById ? undefined : name;
22240
22248
  return /*#__PURE__*/React__default.createElement(Box, _extends({
22241
22249
  ref: ref,
22242
22250
  padding: "0",
@@ -22247,7 +22255,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22247
22255
  "aria-invalid": error,
22248
22256
  "aria-label": ariaLabel,
22249
22257
  "aria-labelledby": ariaLabelledById,
22250
- "aria-describedby": errorMessageNormalized,
22258
+ "aria-describedby": error ? "".concat(name, "-error-message") : undefined,
22251
22259
  onFocus: function onFocus() {
22252
22260
  return setFocused(true);
22253
22261
  },
@@ -22265,7 +22273,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref5, ref) {
22265
22273
  }, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
22266
22274
  "data-qa": "Checkbox"
22267
22275
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
22268
- id: checkboxId,
22276
+ id: "checkbox-".concat(name),
22269
22277
  disabled: disabled,
22270
22278
  name: name,
22271
22279
  checked: checked,
@@ -48191,10 +48199,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48191
48199
  };
48192
48200
 
48193
48201
  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;}"]);
48198
48202
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48199
48203
  var _ref$showCheckbox = _ref.showCheckbox,
48200
48204
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -48236,21 +48240,6 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48236
48240
  useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48237
48241
  }
48238
48242
  };
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
- }
48254
48243
  return /*#__PURE__*/React__default.createElement(Box, {
48255
48244
  padding: displayInline ? "0" : "1.5rem",
48256
48245
  minWidth: displayInline ? "0" : "100%",
@@ -48463,33 +48452,24 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48463
48452
  onChange: toggleCheckbox,
48464
48453
  checked: defaultMethod.value,
48465
48454
  hidden: hideDefaultPayment
48466
- }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48455
+ }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48456
+ childGap: "4px",
48457
+ align: "center"
48458
+ }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48467
48459
  name: "bank checkbox",
48468
48460
  dataQa: "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
- }))),
48461
+ title: "Save checking account to wallet.",
48484
48462
  checked: walletCheckboxMarked,
48485
48463
  onChange: saveToWallet
48486
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48464
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48465
+ singleChild: true
48466
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48487
48467
  version: "v2",
48488
48468
  showCheckbox: false,
48489
- description: "View ",
48469
+ description: "View",
48490
48470
  terms: termsContent,
48491
48471
  initialFocusSelector: ".modal-close-button"
48492
- })));
48472
+ })))));
48493
48473
  };
48494
48474
 
48495
48475
  var formConfig$6 = {
@@ -48661,33 +48641,24 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48661
48641
  },
48662
48642
  autocompleteValue: "billing postal-code",
48663
48643
  isRequired: true
48664
- })), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48644
+ })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
48645
+ childGap: "4px",
48646
+ align: "center"
48647
+ }, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48665
48648
  name: "credit card checkbox",
48666
48649
  dataQa: "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
- }))),
48650
+ title: "Save credit card to wallet.",
48682
48651
  checked: walletCheckboxMarked,
48683
48652
  onChange: saveToWallet
48684
- }), !showWalletCheckbox && showTerms && /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48653
+ }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
48654
+ singleChild: true
48655
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
48685
48656
  version: "v2",
48686
48657
  showCheckbox: false,
48687
- description: "View ",
48658
+ description: "View",
48688
48659
  terms: termsContent,
48689
48660
  initialFocusSelector: ".modal-close-button"
48690
- })));
48661
+ })))));
48691
48662
  };
48692
48663
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
48693
48664