@thecb/components 10.7.2-beta.1 → 10.7.3-beta.0

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
@@ -24998,6 +24998,15 @@ var Dropdown = function Dropdown(_ref13) {
24998
24998
  }
24999
24999
  }
25000
25000
  };
25001
+ var handleOnBlur = function handleOnBlur(inputVal) {
25002
+ var selectedRefExists = selectedRef !== undefined && selectedRef.current !== null;
25003
+ var inputRequired = options.required || isRequired;
25004
+ var hasSelectedValue = value || selectedRefExists;
25005
+ // Select the empty value to trigger a validation error if it's required.
25006
+ if (inputRequired && !hasSelectedValue && inputVal === "") {
25007
+ onSelect("");
25008
+ }
25009
+ };
25001
25010
  React.useEffect(function () {
25002
25011
  var selectedRefExists = selectedRef !== undefined && selectedRef.current !== null;
25003
25012
  if (isOpen && selectedRefExists && !focusedByClick) {
@@ -25096,6 +25105,9 @@ var Dropdown = function Dropdown(_ref13) {
25096
25105
  setInputChangedByAutofill(true);
25097
25106
  }
25098
25107
  },
25108
+ onBlur: function onBlur(e) {
25109
+ return handleOnBlur(e.target.value);
25110
+ },
25099
25111
  padding: "12px 25px 12px 12px",
25100
25112
  placeholder: getSelection(),
25101
25113
  required: options.required || isRequired,
@@ -27037,6 +27049,12 @@ var FormInput = function FormInput(_ref15) {
27037
27049
  }
27038
27050
  return fieldActions.set(value);
27039
27051
  };
27052
+ var handleOnBlur = function handleOnBlur(value) {
27053
+ // Sets the empty value to trigger a validation error if it's required.
27054
+ if (isRequired && value === "") {
27055
+ setValue("");
27056
+ }
27057
+ };
27040
27058
  return /*#__PURE__*/React__default.createElement(Stack, {
27041
27059
  childGap: "0.25rem"
27042
27060
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -27090,6 +27108,9 @@ var FormInput = function FormInput(_ref15) {
27090
27108
  onChange: function onChange(value) {
27091
27109
  return setValue(value);
27092
27110
  },
27111
+ onBlur: function onBlur(e) {
27112
+ return handleOnBlur(e.target.value);
27113
+ },
27093
27114
  type: type,
27094
27115
  value: field.rawValue,
27095
27116
  pattern: isNum ? "[0-9]*" : "",
@@ -27110,6 +27131,9 @@ var FormInput = function FormInput(_ref15) {
27110
27131
  onChange: function onChange(e) {
27111
27132
  return setValue(e.target.value);
27112
27133
  },
27134
+ onBlur: function onBlur(e) {
27135
+ return handleOnBlur(e.target.value);
27136
+ },
27113
27137
  type: type === "password" && showPassword ? "text" : type,
27114
27138
  value: field.rawValue,
27115
27139
  pattern: isNum ? "[0-9]*" : "",
@@ -39734,7 +39758,11 @@ var WalletName = function WalletName(_ref) {
39734
39758
  _ref$linkButtonExtraS = _ref.linkButtonExtraStyles,
39735
39759
  linkButtonExtraStyles = _ref$linkButtonExtraS === void 0 ? "" : _ref$linkButtonExtraS,
39736
39760
  _ref$isLoading = _ref.isLoading,
39737
- isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
39761
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
39762
+ _ref$dataQa = _ref.dataQa,
39763
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
39764
+ _ref$actionTextPositi = _ref.actionTextPositionMobile,
39765
+ actionTextPositionMobile = _ref$actionTextPositi === void 0 ? "outside" : _ref$actionTextPositi;
39738
39766
  var _useContext = React.useContext(styled.ThemeContext),
39739
39767
  isMobile = _useContext.isMobile;
39740
39768
  return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(Module$1, {
@@ -39757,17 +39785,18 @@ var WalletName = function WalletName(_ref) {
39757
39785
  radius: "10",
39758
39786
  cx: "12",
39759
39787
  cy: "12"
39760
- })) : mainText && /*#__PURE__*/React__default.createElement(Text$1, null, mainText)), !isMobile && /*#__PURE__*/React__default.createElement(Box, {
39788
+ })) : mainText && /*#__PURE__*/React__default.createElement(Text$1, null, mainText)), (actionTextPositionMobile === "inside" || !isMobile) && /*#__PURE__*/React__default.createElement(Box, {
39761
39789
  padding: "0"
39762
39790
  }, text && /*#__PURE__*/React__default.createElement(Text$1, {
39763
39791
  variant: "pXS"
39764
39792
  }, text), (text || actionText) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\xA0"), action && actionText && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
39765
39793
  disabled: disableAction,
39766
39794
  text: actionText,
39795
+ dataQa: dataQa,
39767
39796
  action: action,
39768
39797
  variant: "smallGhost",
39769
39798
  extraStyles: "\n margin: 0;\n min-width: 0;\n span {font-size: 0.75rem;}\n ".concat(linkButtonExtraStyles, "\n ")
39770
- })))), isMobile && /*#__PURE__*/React__default.createElement(Cluster, {
39799
+ })))), !!isMobile && actionTextPositionMobile === "outside" && /*#__PURE__*/React__default.createElement(Cluster, {
39771
39800
  align: "center",
39772
39801
  justify: text || actionText ? "flex-end" : "flex-start",
39773
39802
  extraStyles: "margin-top: 0.5rem;"
@@ -47503,7 +47532,11 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
47503
47532
  buttonGroupStyles = _ref.buttonGroupStyles,
47504
47533
  _ref$hideAdditionalBu = _ref.hideAdditionalButton,
47505
47534
  hideAdditionalButton = _ref$hideAdditionalBu === void 0 ? false : _ref$hideAdditionalBu,
47506
- additionalButton = _ref.additionalButton;
47535
+ additionalButton = _ref.additionalButton,
47536
+ _ref$nextButtonTestId = _ref.nextButtonTestId,
47537
+ nextButtonTestId = _ref$nextButtonTestId === void 0 ? null : _ref$nextButtonTestId,
47538
+ _ref$backButtonTestId = _ref.backButtonTestId,
47539
+ backButtonTestId = _ref$backButtonTestId === void 0 ? null : _ref$backButtonTestId;
47507
47540
  var _useContext = React.useContext(styled.ThemeContext),
47508
47541
  isMobile = _useContext.isMobile;
47509
47542
  var backButton = !!cancelURL && !!cancelText ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
@@ -47511,7 +47544,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
47511
47544
  url: cancelURL,
47512
47545
  variant: backButtonVariant,
47513
47546
  extraStyles: isMobile && "flex-grow: 1",
47514
- dataQa: cancelText,
47547
+ dataQa: backButtonTestId || cancelText,
47515
47548
  "aria-labelledby": "".concat(kebabCaseString(cancelText), "-button"),
47516
47549
  role: "link"
47517
47550
  }) : backButtonAction && /*#__PURE__*/React__default.createElement(ButtonWithAction, {
@@ -47528,7 +47561,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
47528
47561
  text: redirectText,
47529
47562
  variant: forwardButtonVariant,
47530
47563
  extraStyles: isMobile && "flex-grow: 1",
47531
- dataQa: redirectText,
47564
+ dataQa: nextButtonTestId || redirectText,
47532
47565
  disabled: isForwardButtonDisabled,
47533
47566
  "aria-labelledby": "".concat(kebabCaseString(redirectText), "-button"),
47534
47567
  role: forwardButtonAriaRole
@@ -47538,7 +47571,7 @@ var PaymentButtonBar = function PaymentButtonBar(_ref) {
47538
47571
  action: forwardButtonAction,
47539
47572
  isLoading: forwardButtonLoading,
47540
47573
  extraStyles: isMobile && "flex-grow: 1",
47541
- dataQa: forwardButtonText,
47574
+ dataQa: nextButtonTestId || forwardButtonText,
47542
47575
  disabled: isForwardButtonDisabled,
47543
47576
  "aria-labelledby": "".concat(kebabCaseString(forwardButtonText), "-button"),
47544
47577
  role: forwardButtonAriaRole
@@ -48304,9 +48337,9 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48304
48337
  var showTerms = !!termsContent;
48305
48338
  var nameErrors = _defineProperty({}, required.error, "Name is required");
48306
48339
  var routingNumberErrors = _defineProperty(_defineProperty(_defineProperty({}, required.error, "Routing number is required"), hasLength.error, "Routing number must be 9 digits"), isRoutingNumber.error, "Invalid routing number");
48307
- var confirmRoutingNumberErrors = _defineProperty({}, matchesField.error, "Confirm routing number field must match routing number");
48340
+ var confirmRoutingNumberErrors = _defineProperty(_defineProperty({}, required.error, "Confirm routing number is required"), matchesField.error, "Confirm routing number field must match routing number");
48308
48341
  var accountNumberErrors = _defineProperty(_defineProperty({}, required.error, "Account number is required"), hasLength.error, "Account number must be between 5 and 17 digits");
48309
- var confirmAccountNumberErrors = _defineProperty({}, matchesField.error, "Confirm account number field must match account number");
48342
+ var confirmAccountNumberErrors = _defineProperty(_defineProperty({}, required.error, "Confirm account number is required"), matchesField.error, "Confirm account number field must match account number");
48310
48343
  var accountTypeErrors = _defineProperty({}, required.error, "Account type is required");
48311
48344
  return /*#__PURE__*/React__default.createElement(FormContainer$1, {
48312
48345
  variant: variant,
@@ -48448,7 +48481,7 @@ var formConfig$6 = {
48448
48481
  constraints: [onlyIntegers(), hasLength(0, 9)]
48449
48482
  },
48450
48483
  confirmRoutingNumber: {
48451
- validators: [matchesField("routingNumber")],
48484
+ validators: [required(), matchesField("routingNumber")],
48452
48485
  constraints: [onlyIntegers(), hasLength(0, 9)]
48453
48486
  },
48454
48487
  accountNumber: {
@@ -48456,7 +48489,7 @@ var formConfig$6 = {
48456
48489
  constraints: [onlyIntegers(), hasLength(0, 17)]
48457
48490
  },
48458
48491
  confirmAccountNumber: {
48459
- validators: [matchesField("accountNumber")],
48492
+ validators: [required(), matchesField("accountNumber")],
48460
48493
  constraints: [onlyIntegers(), hasLength(0, 17)]
48461
48494
  },
48462
48495
  accountType: {
@@ -49062,7 +49095,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
49062
49095
  }, section.content))));
49063
49096
  };
49064
49097
 
49065
- var _excluded$E = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired", "groupedSections"];
49098
+ var _excluded$E = ["themeValues", "isMobile", "supportsTouch", "sections", "openSection", "toggleOpenSection", "staggeredAnimation", "initiallyOpen", "openHeight", "containerStyles", "ariaDescribedBy", "isSectionRequired", "groupedSections", "borderOverride"];
49066
49099
 
49067
49100
  /**
49068
49101
  - The RadioSection component takes either a flat array (via the 'sections'
@@ -49110,6 +49143,7 @@ var RadioSection = function RadioSection(_ref) {
49110
49143
  _ref$isSectionRequire = _ref.isSectionRequired,
49111
49144
  isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire,
49112
49145
  groupedSections = _ref.groupedSections,
49146
+ borderOverride = _ref.borderOverride,
49113
49147
  rest = _objectWithoutProperties(_ref, _excluded$E);
49114
49148
  var _useState = React.useState(null),
49115
49149
  _useState2 = _slicedToArray(_useState, 2),
@@ -49142,7 +49176,7 @@ var RadioSection = function RadioSection(_ref) {
49142
49176
  };
49143
49177
  return /*#__PURE__*/React__default.createElement(Box, _extends({
49144
49178
  padding: "1px",
49145
- border: "1px solid ".concat(themeValues.borderColor),
49179
+ border: borderOverride || "1px solid ".concat(themeValues.borderColor),
49146
49180
  borderRadius: "4px",
49147
49181
  extraStyles: containerStyles,
49148
49182
  role: "radiogroup",