@thecb/components 9.1.3 → 9.1.4-beta.5

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
@@ -12398,7 +12398,7 @@ if (typeof window !== "undefined") {
12398
12398
  var MotionWrapper = styled(motion.div).withConfig({
12399
12399
  displayName: "Motionstyled__MotionWrapper",
12400
12400
  componentId: "sc-1m6r1io-0"
12401
- })(["position:", ";display:", ";box-sizing:border-box;padding:", ";border:", ";border-color:", ";border-size:", ";border-style:", ";border-width:", ";border-radius:", ";background-color:", ";box-shadow:", ";min-height:", ";min-width:", ";height:", ";width:", ";text-align:", ";margin:", ";&:hover,&:focus{", ";}&:active{", ";}&:disabled{", ";}", ";"], function (_ref) {
12401
+ })(["position:", ";display:", ";box-sizing:border-box;padding:", ";border:", ";border-color:", ";border-width:", ";border-style:", ";border-width:", ";border-radius:", ";background-color:", ";box-shadow:", ";min-height:", ";min-width:", ";height:", ";width:", ";text-align:", ";margin:", ";&:hover,&:focus{", ";}&:active{", ";}&:disabled{", ";}", ";"], function (_ref) {
12402
12402
  var position = _ref.position;
12403
12403
  return position;
12404
12404
  }, function (_ref2) {
@@ -24195,7 +24195,9 @@ var FormSelect = function FormSelect(_ref) {
24195
24195
  _ref$dataQa = _ref.dataQa,
24196
24196
  dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
24197
24197
  _ref$widthFitOptions = _ref.widthFitOptions,
24198
- widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions;
24198
+ widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
24199
+ _ref$isRequired = _ref.isRequired,
24200
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
24199
24201
 
24200
24202
  var _useState = useState(false),
24201
24203
  _useState2 = _slicedToArray(_useState, 2),
@@ -24257,7 +24259,8 @@ var FormSelect = function FormSelect(_ref) {
24257
24259
  },
24258
24260
  disabled: disabled,
24259
24261
  autocompleteValue: autocompleteValue,
24260
- smoothScroll: smoothScroll
24262
+ smoothScroll: smoothScroll,
24263
+ required: isRequired
24261
24264
  }), /*#__PURE__*/React.createElement(Stack, {
24262
24265
  direction: "row",
24263
24266
  justify: "space-between"
@@ -25027,7 +25030,9 @@ var CountryDropdown = function CountryDropdown(_ref) {
25027
25030
  showErrors = _ref.showErrors,
25028
25031
  onChange = _ref.onChange,
25029
25032
  _ref$dataQa = _ref.dataQa,
25030
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
25033
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
25034
+ _ref$isRequired = _ref.isRequired,
25035
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
25031
25036
  return /*#__PURE__*/React.createElement(FormSelect$1, {
25032
25037
  options: options,
25033
25038
  field: field,
@@ -25037,7 +25042,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
25037
25042
  errorMessages: errorMessages,
25038
25043
  showErrors: showErrors,
25039
25044
  onChange: onChange,
25040
- autocompleteValue: "country-name"
25045
+ autocompleteValue: "country-name",
25046
+ isRequired: isRequired
25041
25047
  });
25042
25048
  };
25043
25049
 
@@ -25882,7 +25888,7 @@ var fallbackValues$k = {
25882
25888
  };
25883
25889
 
25884
25890
  var _excluded$p = ["showErrors", "themeValues"],
25885
- _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa"];
25891
+ _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
25886
25892
  var InputField = styled.input.withConfig({
25887
25893
  displayName: "FormInput__InputField",
25888
25894
  componentId: "sc-l094r1-0"
@@ -25969,6 +25975,8 @@ var FormInput = function FormInput(_ref15) {
25969
25975
  removeFromValue = _ref15.removeFromValue,
25970
25976
  _ref15$dataQa = _ref15.dataQa,
25971
25977
  dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
25978
+ _ref15$isRequired = _ref15.isRequired,
25979
+ isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
25972
25980
  props = _objectWithoutProperties(_ref15, _excluded2);
25973
25981
 
25974
25982
  var _useState = useState(false),
@@ -26055,7 +26063,8 @@ var FormInput = function FormInput(_ref15) {
26055
26063
  $customHeight: customHeight,
26056
26064
  $extraStyles: extraStyles,
26057
26065
  "data-qa": dataQa || labelTextWhenNoError,
26058
- autoComplete: autocompleteValue
26066
+ autoComplete: autocompleteValue,
26067
+ required: isRequired
26059
26068
  }, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
26060
26069
  "aria-labelledby": createIdFromString(labelTextWhenNoError),
26061
26070
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
@@ -26074,7 +26083,8 @@ var FormInput = function FormInput(_ref15) {
26074
26083
  $customHeight: customHeight,
26075
26084
  $extraStyles: extraStyles,
26076
26085
  "data-qa": dataQa || labelTextWhenNoError,
26077
- autoComplete: autocompleteValue
26086
+ autoComplete: autocompleteValue,
26087
+ required: isRequired
26078
26088
  }, props))), /*#__PURE__*/React.createElement(Stack, {
26079
26089
  direction: "row",
26080
26090
  justify: "space-between",
@@ -47849,7 +47859,7 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
47849
47859
  };
47850
47860
 
47851
47861
  var PaymentFormACH = function PaymentFormACH(_ref) {
47852
- var _routingNumberErrors, _accountNumberErrors;
47862
+ var _routingNumberErrors, _confirmRoutingNumber, _accountNumberErrors, _confirmAccountNumber;
47853
47863
 
47854
47864
  var _ref$variant = _ref.variant,
47855
47865
  variant = _ref$variant === void 0 ? "default" : _ref$variant,
@@ -47892,15 +47902,19 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47892
47902
  var nameErrors = _defineProperty({}, required.error, "Name is required");
47893
47903
 
47894
47904
  var routingNumberErrors = (_routingNumberErrors = {}, _defineProperty(_routingNumberErrors, required.error, "Routing number is required"), _defineProperty(_routingNumberErrors, hasLength.error, "Routing number must be 9 digits"), _defineProperty(_routingNumberErrors, isRoutingNumber.error, "Invalid routing number"), _routingNumberErrors);
47895
-
47896
- var confirmRoutingNumberErrors = _defineProperty({}, matchesField.error, "Confirm routing number field must match routing number");
47897
-
47905
+ var confirmRoutingNumberErrors = (_confirmRoutingNumber = {}, _defineProperty(_confirmRoutingNumber, matchesField.error, "Confirm routing number field must match routing number"), _defineProperty(_confirmRoutingNumber, required.error, "Confirm routing number is required"), _confirmRoutingNumber);
47898
47906
  var accountNumberErrors = (_accountNumberErrors = {}, _defineProperty(_accountNumberErrors, required.error, "Account number is required"), _defineProperty(_accountNumberErrors, hasLength.error, "Account number must be between 5 and 17 digits"), _accountNumberErrors);
47899
-
47900
- var confirmAccountNumberErrors = _defineProperty({}, matchesField.error, "Confirm account number field must match account number");
47907
+ var confirmAccountNumberErrors = (_confirmAccountNumber = {}, _defineProperty(_confirmAccountNumber, matchesField.error, "Confirm account number field must match account number"), _defineProperty(_confirmAccountNumber, required.error, "Confirm account number is required"), _confirmAccountNumber);
47901
47908
 
47902
47909
  var accountTypeErrors = _defineProperty({}, required.error, "Account type is required");
47903
47910
 
47911
+ var getIsRequiredFromValidators = useCallback(function (field) {
47912
+ var _field$validators;
47913
+
47914
+ return !!(field !== null && field !== void 0 && (_field$validators = field.validators) !== null && _field$validators !== void 0 && _field$validators.find(function (validator) {
47915
+ return validator.type === "validator/REQUIRED";
47916
+ }));
47917
+ }, []);
47904
47918
  return /*#__PURE__*/React.createElement(FormContainer$1, {
47905
47919
  variant: variant,
47906
47920
  role: "form",
@@ -47915,7 +47929,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47915
47929
  onKeyDown: function onKeyDown(e) {
47916
47930
  return e.key === "Enter" && handleSubmit(e);
47917
47931
  },
47918
- autocompleteValue: "name"
47932
+ autocompleteValue: "name",
47933
+ isRequired: getIsRequiredFromValidators(fields.name)
47919
47934
  }), /*#__PURE__*/React.createElement(FormInput$1, {
47920
47935
  labelTextWhenNoError: "Routing number",
47921
47936
  dataQa: "Routing number",
@@ -47923,6 +47938,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47923
47938
  field: fields.routingNumber,
47924
47939
  fieldActions: actions.fields.routingNumber,
47925
47940
  showErrors: showErrors,
47941
+ isRequired: getIsRequiredFromValidators(fields.routingNumber),
47926
47942
  isNum: true,
47927
47943
  helperModal: function helperModal() {
47928
47944
  return /*#__PURE__*/React.createElement(AccountAndRoutingModal$1, {
@@ -47948,6 +47964,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47948
47964
  onKeyDown: function onKeyDown(e) {
47949
47965
  return e.key === "Enter" && handleSubmit(e);
47950
47966
  },
47967
+ isRequired: getIsRequiredFromValidators(fields.confirmRoutingNumber),
47951
47968
  isNum: true
47952
47969
  }), /*#__PURE__*/React.createElement(FormInput$1, {
47953
47970
  labelTextWhenNoError: "Account number",
@@ -47956,6 +47973,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47956
47973
  field: fields.accountNumber,
47957
47974
  fieldActions: actions.fields.accountNumber,
47958
47975
  showErrors: showErrors,
47976
+ isRequired: getIsRequiredFromValidators(fields.accountNumber),
47959
47977
  isNum: true,
47960
47978
  helperModal: function helperModal() {
47961
47979
  return /*#__PURE__*/React.createElement(AccountAndRoutingModal$1, {
@@ -47981,6 +47999,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47981
47999
  onKeyDown: function onKeyDown(e) {
47982
48000
  return e.key === "Enter" && handleSubmit(e);
47983
48001
  },
48002
+ isRequired: getIsRequiredFromValidators(fields.confirmAccountNumber),
47984
48003
  isNum: true
47985
48004
  }), allowBankAccountType && /*#__PURE__*/React.createElement(FormSelect$1, {
47986
48005
  labelTextWhenNoError: "Account type",
@@ -47998,7 +48017,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47998
48017
  fieldActions: actions.fields.accountType,
47999
48018
  showErrors: showErrors,
48000
48019
  errorMessages: accountTypeErrors,
48001
- field: fields.accountType
48020
+ field: fields.accountType,
48021
+ isRequired: getIsRequiredFromValidators(fields.accountType)
48002
48022
  }), !hideDefaultPayment && /*#__PURE__*/React.createElement(Checkbox$1, {
48003
48023
  title: "Save as Default Payment Method",
48004
48024
  dataQa: "default-payment-ach",
@@ -48034,7 +48054,7 @@ var formConfig$6 = {
48034
48054
  constraints: [onlyIntegers(), hasLength(0, 9)]
48035
48055
  },
48036
48056
  confirmRoutingNumber: {
48037
- validators: [matchesField("routingNumber")],
48057
+ validators: [matchesField("routingNumber"), required()],
48038
48058
  constraints: [onlyIntegers(), hasLength(0, 9)]
48039
48059
  },
48040
48060
  accountNumber: {
@@ -48042,7 +48062,7 @@ var formConfig$6 = {
48042
48062
  constraints: [onlyIntegers(), hasLength(0, 17)]
48043
48063
  },
48044
48064
  confirmAccountNumber: {
48045
- validators: [matchesField("accountNumber")],
48065
+ validators: [matchesField("accountNumber"), required()],
48046
48066
  constraints: [onlyIntegers(), hasLength(0, 17)]
48047
48067
  },
48048
48068
  accountType: {
@@ -48083,6 +48103,13 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48083
48103
  isMobile = _useContext.isMobile;
48084
48104
 
48085
48105
  var showTerms = !!termsContent;
48106
+ var getIsRequiredFromValidators = useCallback(function (field) {
48107
+ var _field$validators;
48108
+
48109
+ return !!(field !== null && field !== void 0 && (_field$validators = field.validators) !== null && _field$validators !== void 0 && _field$validators.find(function (validator) {
48110
+ return validator.type === "validator/REQUIRED";
48111
+ }));
48112
+ }, []);
48086
48113
  useEffect$1(function () {
48087
48114
  if (deniedCards) {
48088
48115
  deniedCards.map(function (card) {
@@ -48125,7 +48152,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48125
48152
  }
48126
48153
  },
48127
48154
  showErrors: showErrors,
48128
- dataQa: "Country"
48155
+ dataQa: "Country",
48156
+ isRequired: getIsRequiredFromValidators(fields.country)
48129
48157
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48130
48158
  labelTextWhenNoError: "Name on card",
48131
48159
  dataQa: "Name on card",
@@ -48136,7 +48164,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48136
48164
  onKeyDown: function onKeyDown(e) {
48137
48165
  return e.key === "Enter" && handleSubmit(e);
48138
48166
  },
48139
- autocompleteValue: "cc-name"
48167
+ autocompleteValue: "cc-name",
48168
+ isRequired: getIsRequiredFromValidators(fields.nameOnCard)
48140
48169
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48141
48170
  labelTextWhenNoError: "Credit card number",
48142
48171
  dataQa: "Credit card number",
@@ -48149,7 +48178,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48149
48178
  return e.key === "Enter" && handleSubmit(e);
48150
48179
  },
48151
48180
  isNum: true,
48152
- autocompleteValue: "cc-number"
48181
+ autocompleteValue: "cc-number",
48182
+ isRequired: getIsRequiredFromValidators(fields.creditCardNumber)
48153
48183
  }), /*#__PURE__*/React.createElement(FormInputRow, {
48154
48184
  breakpoint: isMobile ? "1000rem" : "21rem",
48155
48185
  childGap: isMobile ? "0rem" : "1rem"
@@ -48167,7 +48197,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48167
48197
  isNum: true,
48168
48198
  removeFromValue: /\// // removes "/" from browser autofill
48169
48199
  ,
48170
- autocompleteValue: "cc-exp"
48200
+ autocompleteValue: "cc-exp",
48201
+ isRequired: getIsRequiredFromValidators(fields.expirationDate)
48171
48202
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48172
48203
  labelTextWhenNoError: "CVV",
48173
48204
  dataQa: "CVV",
@@ -48180,7 +48211,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48180
48211
  onKeyDown: function onKeyDown(e) {
48181
48212
  return e.key === "Enter" && handleSubmit(e);
48182
48213
  },
48183
- autocompleteValue: "cc-csc"
48214
+ autocompleteValue: "cc-csc",
48215
+ isRequired: getIsRequiredFromValidators(fields.cvv)
48184
48216
  })), !hideZipCode && /*#__PURE__*/React.createElement(Box, {
48185
48217
  padding: isMobile ? "0" : "0 0.5rem 0 0",
48186
48218
  width: isMobile ? "100%" : "50%"
@@ -48196,7 +48228,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48196
48228
  onKeyDown: function onKeyDown(e) {
48197
48229
  return e.key === "Enter" && handleSubmit(e);
48198
48230
  },
48199
- autocompleteValue: "billing postal-code"
48231
+ autocompleteValue: "billing postal-code",
48232
+ isRequired: getIsRequiredFromValidators(fields.zipCode)
48200
48233
  })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React.createElement(Cluster, {
48201
48234
  childGap: "4px",
48202
48235
  align: "center"
@@ -48627,7 +48660,8 @@ var RadioSection = function RadioSection(_ref) {
48627
48660
  extraStyles: borderStyles,
48628
48661
  role: "radio",
48629
48662
  "aria-checked": openSection === section.id,
48630
- "aria-disabled": section.disabled
48663
+ disabled: section.disabled,
48664
+ required: section === null || section === void 0 ? void 0 : section.required
48631
48665
  }, /*#__PURE__*/React.createElement(Stack, {
48632
48666
  childGap: "0"
48633
48667
  }, /*#__PURE__*/React.createElement(Box, {
@@ -48657,6 +48691,8 @@ var RadioSection = function RadioSection(_ref) {
48657
48691
  }, !section.hideRadioButton && /*#__PURE__*/React.createElement(Box, {
48658
48692
  padding: "0"
48659
48693
  }, /*#__PURE__*/React.createElement(RadioButton$2, {
48694
+ role: "radio",
48695
+ required: !!(section !== null && section !== void 0 && section.required),
48660
48696
  id: "radio-input-".concat(idString(section)),
48661
48697
  name: idString(section),
48662
48698
  ariaDescribedBy: ariaDescribedBy,