@thecb/components 9.2.5-beta.0 → 9.2.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
@@ -23791,7 +23791,9 @@ var Dropdown = function Dropdown(_ref13) {
23791
23791
  _ref13$smoothScroll = _ref13.smoothScroll,
23792
23792
  smoothScroll = _ref13$smoothScroll === void 0 ? true : _ref13$smoothScroll,
23793
23793
  _ref13$ariaInvalid = _ref13.ariaInvalid,
23794
- ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid;
23794
+ ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid,
23795
+ _ref13$isRequired = _ref13.isRequired,
23796
+ isRequired = _ref13$isRequired === void 0 ? false : _ref13$isRequired;
23795
23797
 
23796
23798
  var _useState = useState(""),
23797
23799
  _useState2 = _slicedToArray(_useState, 2),
@@ -23988,7 +23990,9 @@ var Dropdown = function Dropdown(_ref13) {
23988
23990
  }
23989
23991
 
23990
23992
  setFilteredOptions(options.filter(function (option) {
23991
- return option.value.toLowerCase().match(inputValue.toLowerCase()) || option.text.toLowerCase().match(inputValue.toLowerCase());
23993
+ var _option$value, _option$value$toLower, _option$text, _option$text$toLowerC;
23994
+
23995
+ return (option === null || option === void 0 ? void 0 : (_option$value = option.value) === null || _option$value === void 0 ? void 0 : (_option$value$toLower = _option$value.toLowerCase()) === null || _option$value$toLower === void 0 ? void 0 : _option$value$toLower.indexOf(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase())) >= 0 || ((_option$text = option.text) === null || _option$text === void 0 ? void 0 : (_option$text$toLowerC = _option$text.toLowerCase()) === null || _option$text$toLowerC === void 0 ? void 0 : _option$text$toLowerC.indexOf(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase())) >= 0;
23992
23996
  }));
23993
23997
  }, [inputValue]);
23994
23998
  useEffect$1(function () {
@@ -24062,7 +24066,7 @@ var Dropdown = function Dropdown(_ref13) {
24062
24066
  },
24063
24067
  padding: "12px",
24064
24068
  placeholder: getSelection(),
24065
- required: options.required,
24069
+ required: options.required || isRequired,
24066
24070
  role: "combobox",
24067
24071
  themeValues: themeValues,
24068
24072
  title: hasTitles ? getSelection() : null,
@@ -24230,7 +24234,9 @@ var FormSelect = function FormSelect(_ref) {
24230
24234
  _ref$dataQa = _ref.dataQa,
24231
24235
  dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
24232
24236
  _ref$widthFitOptions = _ref.widthFitOptions,
24233
- widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions;
24237
+ widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
24238
+ _ref$isRequired = _ref.isRequired,
24239
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
24234
24240
 
24235
24241
  var _useState = useState(false),
24236
24242
  _useState2 = _slicedToArray(_useState, 2),
@@ -24292,7 +24298,8 @@ var FormSelect = function FormSelect(_ref) {
24292
24298
  },
24293
24299
  disabled: disabled,
24294
24300
  autocompleteValue: autocompleteValue,
24295
- smoothScroll: smoothScroll
24301
+ smoothScroll: smoothScroll,
24302
+ isRequired: isRequired
24296
24303
  }), /*#__PURE__*/React.createElement(Stack, {
24297
24304
  direction: "row",
24298
24305
  justify: "space-between"
@@ -25063,6 +25070,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
25063
25070
  fieldActions = _ref.fieldActions,
25064
25071
  showErrors = _ref.showErrors,
25065
25072
  onChange = _ref.onChange,
25073
+ _ref$isRequired = _ref.isRequired,
25074
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
25066
25075
  _ref$dataQa = _ref.dataQa,
25067
25076
  dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
25068
25077
  return /*#__PURE__*/React.createElement(FormSelect$1, {
@@ -25074,7 +25083,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
25074
25083
  errorMessages: errorMessages,
25075
25084
  showErrors: showErrors,
25076
25085
  onChange: onChange,
25077
- autocompleteValue: "country-name"
25086
+ autocompleteValue: "country-name",
25087
+ isRequired: isRequired
25078
25088
  });
25079
25089
  };
25080
25090
 
@@ -25921,7 +25931,7 @@ var fallbackValues$k = {
25921
25931
  };
25922
25932
 
25923
25933
  var _excluded$p = ["showErrors", "themeValues"],
25924
- _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa"];
25934
+ _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
25925
25935
  var InputField = styled.input.withConfig({
25926
25936
  displayName: "FormInput__InputField",
25927
25937
  componentId: "sc-l094r1-0"
@@ -26008,6 +26018,8 @@ var FormInput = function FormInput(_ref15) {
26008
26018
  removeFromValue = _ref15.removeFromValue,
26009
26019
  _ref15$dataQa = _ref15.dataQa,
26010
26020
  dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
26021
+ _ref15$isRequired = _ref15.isRequired,
26022
+ isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
26011
26023
  props = _objectWithoutProperties(_ref15, _excluded2);
26012
26024
 
26013
26025
  var _useState = useState(false),
@@ -26094,7 +26106,8 @@ var FormInput = function FormInput(_ref15) {
26094
26106
  $customHeight: customHeight,
26095
26107
  $extraStyles: extraStyles,
26096
26108
  "data-qa": dataQa || labelTextWhenNoError,
26097
- autoComplete: autocompleteValue
26109
+ autoComplete: autocompleteValue,
26110
+ required: isRequired
26098
26111
  }, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
26099
26112
  "aria-labelledby": createIdFromString(labelTextWhenNoError),
26100
26113
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
@@ -26113,7 +26126,8 @@ var FormInput = function FormInput(_ref15) {
26113
26126
  $customHeight: customHeight,
26114
26127
  $extraStyles: extraStyles,
26115
26128
  "data-qa": dataQa || labelTextWhenNoError,
26116
- autoComplete: autocompleteValue
26129
+ autoComplete: autocompleteValue,
26130
+ required: isRequired
26117
26131
  }, props))), /*#__PURE__*/React.createElement(Stack, {
26118
26132
  direction: "row",
26119
26133
  justify: "space-between",
@@ -27355,7 +27369,9 @@ var RadioButton$1 = function RadioButton(_ref2) {
27355
27369
  _ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
27356
27370
  ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
27357
27371
  _ref2$ariaLabel = _ref2.ariaLabel,
27358
- ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel;
27372
+ ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel,
27373
+ _ref2$isRequired = _ref2.isRequired,
27374
+ isRequired = _ref2$isRequired === void 0 ? false : _ref2$isRequired;
27359
27375
  var buttonBorder = {
27360
27376
  onFocused: {
27361
27377
  borderColor: themeValues.activeColor,
@@ -27417,7 +27433,8 @@ var RadioButton$1 = function RadioButton(_ref2) {
27417
27433
  disabled: disabled,
27418
27434
  onClick: toggleRadio,
27419
27435
  "aria-describedby": ariaDescribedBy,
27420
- tabIndex: "-1"
27436
+ tabIndex: "-1",
27437
+ required: isRequired
27421
27438
  }, extraProps)), /*#__PURE__*/React.createElement(Motion, {
27422
27439
  borderWidth: "1px",
27423
27440
  borderStyle: "solid",
@@ -38107,7 +38124,9 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
38107
38124
  field = _ref.field,
38108
38125
  fieldActions = _ref.fieldActions,
38109
38126
  showErrors = _ref.showErrors,
38110
- countryCode = _ref.countryCode;
38127
+ countryCode = _ref.countryCode,
38128
+ _ref$isRequired = _ref.isRequired,
38129
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
38111
38130
  var placeholder = countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
38112
38131
  var options = [placeholder].concat(_toConsumableArray(getOptions(countryCode)));
38113
38132
  return /*#__PURE__*/React.createElement(FormSelect$1, {
@@ -38117,7 +38136,8 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
38117
38136
  labelTextWhenNoError: labelTextWhenNoError,
38118
38137
  errorMessages: errorMessages,
38119
38138
  showErrors: showErrors,
38120
- autocompleteValue: "address-level1"
38139
+ autocompleteValue: "address-level1",
38140
+ isRequired: isRequired
38121
38141
  });
38122
38142
  };
38123
38143
 
@@ -39456,7 +39476,8 @@ var AddressForm = function AddressForm(_ref) {
39456
39476
  }
39457
39477
  },
39458
39478
  showErrors: showErrors,
39459
- dataQa: "Country"
39479
+ dataQa: "Country",
39480
+ isRequired: true
39460
39481
  }), /*#__PURE__*/React.createElement(FormInput$1, {
39461
39482
  labelTextWhenNoError: "Address",
39462
39483
  errorMessages: street1ErrorMessages,
@@ -39467,7 +39488,8 @@ var AddressForm = function AddressForm(_ref) {
39467
39488
  return e.key === "Enter" && handleSubmit(e);
39468
39489
  },
39469
39490
  autocompleteValue: "address-line1",
39470
- dataQa: "Address"
39491
+ dataQa: "Address",
39492
+ isRequired: true
39471
39493
  }), /*#__PURE__*/React.createElement(FormInput$1, {
39472
39494
  labelTextWhenNoError: "Apt, Suite, Unit, Floor, etc. (Optional)",
39473
39495
  field: fields.street2,
@@ -39488,7 +39510,8 @@ var AddressForm = function AddressForm(_ref) {
39488
39510
  return e.key === "Enter" && handleSubmit(e);
39489
39511
  },
39490
39512
  autocompleteValue: "address-level2",
39491
- dataQa: "City"
39513
+ dataQa: "City",
39514
+ isRequired: true
39492
39515
  }), /*#__PURE__*/React.createElement(FormStateDropdown, {
39493
39516
  labelTextWhenNoError: isUS ? "State" : "State or Province",
39494
39517
  errorMessages: stateProvinceErrorMessages,
@@ -39499,7 +39522,8 @@ var AddressForm = function AddressForm(_ref) {
39499
39522
  onKeyDown: function onKeyDown(e) {
39500
39523
  return e.key === "Enter" && handleSubmit(e);
39501
39524
  },
39502
- dataQa: "State or Province"
39525
+ dataQa: "State or Province",
39526
+ isRequired: true
39503
39527
  }), /*#__PURE__*/React.createElement(FormInput$1, {
39504
39528
  isNum: isUS,
39505
39529
  formatter: isUS ? zipFormat : null,
@@ -39512,7 +39536,8 @@ var AddressForm = function AddressForm(_ref) {
39512
39536
  return e.key === "Enter" && handleSubmit(e);
39513
39537
  },
39514
39538
  autocompleteValue: "postal-code",
39515
- dataQa: "Zip code"
39539
+ dataQa: "Zip code",
39540
+ isRequired: true
39516
39541
  }), showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
39517
39542
  name: "address checkbox",
39518
39543
  title: "Save address to wallet",
@@ -40415,7 +40440,9 @@ var EmailForm = function EmailForm(_ref) {
40415
40440
  handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
40416
40441
  showWalletCheckbox = _ref.showWalletCheckbox,
40417
40442
  saveToWallet = _ref.saveToWallet,
40418
- walletCheckboxMarked = _ref.walletCheckboxMarked;
40443
+ walletCheckboxMarked = _ref.walletCheckboxMarked,
40444
+ _ref$isRequired = _ref.isRequired,
40445
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
40419
40446
 
40420
40447
  if (clearOnDismount) {
40421
40448
  useEffect$1(function () {
@@ -40444,7 +40471,8 @@ var EmailForm = function EmailForm(_ref) {
40444
40471
  },
40445
40472
  isEmail: true,
40446
40473
  autocompleteValue: "email",
40447
- dataQa: "Email address"
40474
+ dataQa: "Email address",
40475
+ isRequired: isRequired
40448
40476
  }), showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
40449
40477
  name: "email checkbox",
40450
40478
  title: "Save email address to wallet",
@@ -47980,7 +48008,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47980
48008
  onKeyDown: function onKeyDown(e) {
47981
48009
  return e.key === "Enter" && handleSubmit(e);
47982
48010
  },
47983
- autocompleteValue: "name"
48011
+ autocompleteValue: "name",
48012
+ isRequired: true
47984
48013
  }), /*#__PURE__*/React.createElement(FormInput$1, {
47985
48014
  labelTextWhenNoError: "Routing number",
47986
48015
  dataQa: "Routing number",
@@ -48002,7 +48031,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48002
48031
  },
48003
48032
  onKeyDown: function onKeyDown(e) {
48004
48033
  return e.key === "Enter" && handleSubmit(e);
48005
- }
48034
+ },
48035
+ isRequired: true
48006
48036
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48007
48037
  labelTextWhenNoError: "Confirm routing number",
48008
48038
  dataQa: "Confirm routing number",
@@ -48013,7 +48043,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48013
48043
  onKeyDown: function onKeyDown(e) {
48014
48044
  return e.key === "Enter" && handleSubmit(e);
48015
48045
  },
48016
- isNum: true
48046
+ isNum: true,
48047
+ isRequired: true
48017
48048
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48018
48049
  labelTextWhenNoError: "Account number",
48019
48050
  dataQa: "Account number",
@@ -48035,7 +48066,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48035
48066
  },
48036
48067
  onKeyDown: function onKeyDown(e) {
48037
48068
  return e.key === "Enter" && handleSubmit(e);
48038
- }
48069
+ },
48070
+ isRequired: true
48039
48071
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48040
48072
  labelTextWhenNoError: "Confirm account number",
48041
48073
  dataQa: "Confirm account number",
@@ -48046,6 +48078,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48046
48078
  onKeyDown: function onKeyDown(e) {
48047
48079
  return e.key === "Enter" && handleSubmit(e);
48048
48080
  },
48081
+ isRequired: true,
48049
48082
  isNum: true
48050
48083
  }), allowBankAccountType && /*#__PURE__*/React.createElement(FormSelect$1, {
48051
48084
  labelTextWhenNoError: "Account type",
@@ -48063,7 +48096,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48063
48096
  fieldActions: actions.fields.accountType,
48064
48097
  showErrors: showErrors,
48065
48098
  errorMessages: accountTypeErrors,
48066
- field: fields.accountType
48099
+ field: fields.accountType,
48100
+ isRequired: true
48067
48101
  }), !hideDefaultPayment && /*#__PURE__*/React.createElement(Checkbox$1, {
48068
48102
  title: "Save as Default Payment Method",
48069
48103
  dataQa: "default-payment-ach",
@@ -48201,7 +48235,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48201
48235
  onKeyDown: function onKeyDown(e) {
48202
48236
  return e.key === "Enter" && handleSubmit(e);
48203
48237
  },
48204
- autocompleteValue: "cc-name"
48238
+ autocompleteValue: "cc-name",
48239
+ isRequired: true
48205
48240
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48206
48241
  labelTextWhenNoError: "Credit card number",
48207
48242
  dataQa: "Credit card number",
@@ -48214,7 +48249,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48214
48249
  return e.key === "Enter" && handleSubmit(e);
48215
48250
  },
48216
48251
  isNum: true,
48217
- autocompleteValue: "cc-number"
48252
+ autocompleteValue: "cc-number",
48253
+ isRequired: true
48218
48254
  }), /*#__PURE__*/React.createElement(FormInputRow, {
48219
48255
  breakpoint: isMobile ? "1000rem" : "21rem",
48220
48256
  childGap: isMobile ? "0rem" : "1rem"
@@ -48232,7 +48268,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48232
48268
  isNum: true,
48233
48269
  removeFromValue: /\// // removes "/" from browser autofill
48234
48270
  ,
48235
- autocompleteValue: "cc-exp"
48271
+ autocompleteValue: "cc-exp",
48272
+ isRequired: true
48236
48273
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48237
48274
  labelTextWhenNoError: "CVV",
48238
48275
  dataQa: "CVV",
@@ -48245,7 +48282,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48245
48282
  onKeyDown: function onKeyDown(e) {
48246
48283
  return e.key === "Enter" && handleSubmit(e);
48247
48284
  },
48248
- autocompleteValue: "cc-csc"
48285
+ autocompleteValue: "cc-csc",
48286
+ isRequired: true
48249
48287
  })), !hideZipCode && /*#__PURE__*/React.createElement(Box, {
48250
48288
  padding: isMobile ? "0" : "0 0.5rem 0 0",
48251
48289
  width: isMobile ? "100%" : "50%"
@@ -48261,7 +48299,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48261
48299
  onKeyDown: function onKeyDown(e) {
48262
48300
  return e.key === "Enter" && handleSubmit(e);
48263
48301
  },
48264
- autocompleteValue: "billing postal-code"
48302
+ autocompleteValue: "billing postal-code",
48303
+ isRequired: true
48265
48304
  })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React.createElement(Cluster, {
48266
48305
  childGap: "4px",
48267
48306
  align: "center"
@@ -48454,7 +48493,9 @@ var PhoneForm = function PhoneForm(_ref) {
48454
48493
  handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
48455
48494
  showWalletCheckbox = _ref.showWalletCheckbox,
48456
48495
  saveToWallet = _ref.saveToWallet,
48457
- walletCheckboxMarked = _ref.walletCheckboxMarked;
48496
+ walletCheckboxMarked = _ref.walletCheckboxMarked,
48497
+ _ref$isRequired = _ref.isRequired,
48498
+ isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
48458
48499
 
48459
48500
  if (clearOnDismount) {
48460
48501
  useEffect$1(function () {
@@ -48481,7 +48522,8 @@ var PhoneForm = function PhoneForm(_ref) {
48481
48522
  },
48482
48523
  autocompleteValue: "tel-national",
48483
48524
  dataQa: "Phone number",
48484
- isNum: true
48525
+ isNum: true,
48526
+ isRequired: isRequired
48485
48527
  }), showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
48486
48528
  name: "phone checkbox",
48487
48529
  title: "Save phone number to wallet",
@@ -48614,7 +48656,9 @@ var RadioSection = function RadioSection(_ref) {
48614
48656
  openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
48615
48657
  _ref$containerStyles = _ref.containerStyles,
48616
48658
  containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
48617
- ariaDescribedBy = _ref.ariaDescribedBy;
48659
+ ariaDescribedBy = _ref.ariaDescribedBy,
48660
+ _ref$isSectionRequire = _ref.isSectionRequired,
48661
+ isSectionRequired = _ref$isSectionRequire === void 0 ? false : _ref$isSectionRequire;
48618
48662
 
48619
48663
  var handleKeyDown = function handleKeyDown(id, e) {
48620
48664
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
@@ -48670,7 +48714,8 @@ var RadioSection = function RadioSection(_ref) {
48670
48714
  extraStyles: containerStyles
48671
48715
  }, /*#__PURE__*/React.createElement(Stack, {
48672
48716
  childGap: "0",
48673
- role: "radiogroup"
48717
+ "aria-role": "radiogroup",
48718
+ "aria-required": isSectionRequired
48674
48719
  }, sections.filter(function (section) {
48675
48720
  return !section.hidden;
48676
48721
  }).map(function (section) {
@@ -48692,7 +48737,8 @@ var RadioSection = function RadioSection(_ref) {
48692
48737
  extraStyles: borderStyles,
48693
48738
  role: "radio",
48694
48739
  "aria-checked": openSection === section.id,
48695
- "aria-disabled": section.disabled
48740
+ "aria-disabled": section.disabled,
48741
+ "aria-required": section === null || section === void 0 ? void 0 : section.required
48696
48742
  }, /*#__PURE__*/React.createElement(Stack, {
48697
48743
  childGap: "0"
48698
48744
  }, /*#__PURE__*/React.createElement(Box, {
@@ -48730,7 +48776,8 @@ var RadioSection = function RadioSection(_ref) {
48730
48776
  toggleRadio: section.disabled ? noop : function () {
48731
48777
  return toggleOpenSection(section.id);
48732
48778
  },
48733
- tabIndex: "-1"
48779
+ tabIndex: "-1",
48780
+ isRequired: section === null || section === void 0 ? void 0 : section.required
48734
48781
  })), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
48735
48782
  align: "center"
48736
48783
  }, section.titleIcon), /*#__PURE__*/React.createElement(Box, {