@thecb/components 9.3.0-beta.1 → 9.3.1-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
@@ -22130,9 +22130,7 @@ var Checkbox = function Checkbox(_ref4) {
22130
22130
  extraStyles = _ref4.extraStyles,
22131
22131
  textExtraStyles = _ref4.textExtraStyles,
22132
22132
  _ref4$dataQa = _ref4.dataQa,
22133
- dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa,
22134
- _ref4$isRequired = _ref4.isRequired,
22135
- isRequired = _ref4$isRequired === void 0 ? false : _ref4$isRequired;
22133
+ dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa;
22136
22134
 
22137
22135
  var _useState = React.useState(false),
22138
22136
  _useState2 = _slicedToArray(_useState, 2),
@@ -22186,8 +22184,7 @@ var Checkbox = function Checkbox(_ref4) {
22186
22184
  errorStyles: themeValues.errorStyles,
22187
22185
  disabledStyles: themeValues.disabledStyles,
22188
22186
  disabledCheckedStyles: themeValues.disabledCheckedStyles,
22189
- focusedStyles: themeValues.focusedStyles,
22190
- "aria-required": isRequired
22187
+ focusedStyles: themeValues.focusedStyles
22191
22188
  }, /*#__PURE__*/React__default.createElement(CheckboxIcon, {
22192
22189
  viewBox: "0 0 24 24",
22193
22190
  disabled: disabled,
@@ -23771,11 +23768,7 @@ var Dropdown = function Dropdown(_ref8) {
23771
23768
  _ref8$smoothScroll = _ref8.smoothScroll,
23772
23769
  smoothScroll = _ref8$smoothScroll === void 0 ? true : _ref8$smoothScroll,
23773
23770
  _ref8$ariaInvalid = _ref8.ariaInvalid,
23774
- ariaInvalid = _ref8$ariaInvalid === void 0 ? false : _ref8$ariaInvalid,
23775
- _ref8$isRequired = _ref8.isRequired,
23776
- isRequired = _ref8$isRequired === void 0 ? false : _ref8$isRequired;
23777
-
23778
- var required = options.required || isRequired;
23771
+ ariaInvalid = _ref8$ariaInvalid === void 0 ? false : _ref8$ariaInvalid;
23779
23772
 
23780
23773
  var _useState = React.useState(""),
23781
23774
  _useState2 = _slicedToArray(_useState, 2),
@@ -24024,8 +24017,7 @@ var Dropdown = function Dropdown(_ref8) {
24024
24017
  "aria-labelledby": ariaLabelledby,
24025
24018
  "aria-describedby": ariaDescribedby,
24026
24019
  "aria-expanded": isOpen,
24027
- "aria-required": required,
24028
- required: required,
24020
+ "aria-required": options.required,
24029
24021
  "aria-invalid": ariaInvalid,
24030
24022
  background: isOpen ? themeValues.hoverColor : WHITE,
24031
24023
  borderRadius: "2px",
@@ -24047,14 +24039,14 @@ var Dropdown = function Dropdown(_ref8) {
24047
24039
  },
24048
24040
  padding: "12px",
24049
24041
  placeholder: getSelection(),
24042
+ required: options.required,
24050
24043
  role: "combobox",
24051
24044
  themeValues: themeValues,
24052
24045
  title: hasTitles ? getSelection() : null,
24053
24046
  type: "text",
24054
24047
  tabIndex: 0,
24055
24048
  value: inputValue,
24056
- width: "100%",
24057
- disabled: disabledValues.includes(inputValue)
24049
+ width: "100%"
24058
24050
  }), /*#__PURE__*/React__default.createElement(IconWrapper, {
24059
24051
  open: isOpen,
24060
24052
  onClick: _onClick
@@ -24065,8 +24057,7 @@ var Dropdown = function Dropdown(_ref8) {
24065
24057
  widthFitOptions: widthFitOptions,
24066
24058
  tabIndex: 0,
24067
24059
  role: "listbox",
24068
- id: "".concat(ariaLabelledby, "_listbox"),
24069
- required: required
24060
+ id: "".concat(ariaLabelledby, "_listbox")
24070
24061
  }, /*#__PURE__*/React__default.createElement(Stack, {
24071
24062
  childGap: "0",
24072
24063
  as: "ul"
@@ -24212,9 +24203,7 @@ var FormSelect = function FormSelect(_ref) {
24212
24203
  _ref$dataQa = _ref.dataQa,
24213
24204
  dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
24214
24205
  _ref$widthFitOptions = _ref.widthFitOptions,
24215
- widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
24216
- _ref$isRequired = _ref.isRequired,
24217
- isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
24206
+ widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions;
24218
24207
 
24219
24208
  var _useState = React.useState(false),
24220
24209
  _useState2 = _slicedToArray(_useState, 2),
@@ -24222,17 +24211,6 @@ var FormSelect = function FormSelect(_ref) {
24222
24211
  setOpen = _useState2[1];
24223
24212
 
24224
24213
  var dropdownRef = React.useRef(null);
24225
- var required = (options === null || options === void 0 ? void 0 : options.required) || isRequired;
24226
- var labelId = React.useMemo(function () {
24227
- return function (labelTextWhenNoError) {
24228
- return createIdFromString(labelTextWhenNoError);
24229
- };
24230
- }, [labelTextWhenNoError]);
24231
- var descriptionId = React.useMemo(function () {
24232
- return function (field, labelTextWhenNoError) {
24233
- return field.hasErrors && field.dirty ? labelId(labelTextWhenNoError) + "error-message" : "";
24234
- };
24235
- }, [field, labelTextWhenNoError]);
24236
24214
 
24237
24215
  var handleClickAway = function handleClickAway(event) {
24238
24216
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
@@ -24248,8 +24226,8 @@ var FormSelect = function FormSelect(_ref) {
24248
24226
  });
24249
24227
  return /*#__PURE__*/React__default.createElement(SelectContainer, {
24250
24228
  ref: dropdownRef,
24251
- "aria-role": "group",
24252
24229
  disabled: disabled,
24230
+ "aria-disabled": disabled,
24253
24231
  "data-qa": dataQa
24254
24232
  }, /*#__PURE__*/React__default.createElement(Box, {
24255
24233
  padding: "0",
@@ -24263,10 +24241,10 @@ var FormSelect = function FormSelect(_ref) {
24263
24241
  color: themeValues.labelColor,
24264
24242
  weight: themeValues.fontWeight,
24265
24243
  extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
24266
- id: labelId(labelTextWhenNoError)
24244
+ id: createIdFromString(labelTextWhenNoError)
24267
24245
  }, labelTextWhenNoError))), /*#__PURE__*/React__default.createElement(Dropdown$1, {
24268
- ariaLabelledby: labelId(labelTextWhenNoError),
24269
- ariaDescribedby: descriptionId(field, labelTextWhenNoError),
24246
+ ariaLabelledby: createIdFromString(labelTextWhenNoError),
24247
+ ariaDescribedby: createIdFromString(labelTextWhenNoError, "error message"),
24270
24248
  maxHeight: dropdownMaxHeight,
24271
24249
  widthFitOptions: widthFitOptions,
24272
24250
  hasTitles: hasTitles,
@@ -24287,8 +24265,7 @@ var FormSelect = function FormSelect(_ref) {
24287
24265
  },
24288
24266
  disabled: disabled,
24289
24267
  autocompleteValue: autocompleteValue,
24290
- smoothScroll: smoothScroll,
24291
- isRequired: required
24268
+ smoothScroll: smoothScroll
24292
24269
  }), /*#__PURE__*/React__default.createElement(Stack, {
24293
24270
  direction: "row",
24294
24271
  justify: "space-between"
@@ -25058,9 +25035,7 @@ var CountryDropdown = function CountryDropdown(_ref) {
25058
25035
  showErrors = _ref.showErrors,
25059
25036
  onChange = _ref.onChange,
25060
25037
  _ref$dataQa = _ref.dataQa,
25061
- dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
25062
- _ref$isRequired = _ref.isRequired,
25063
- isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
25038
+ dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa;
25064
25039
  return /*#__PURE__*/React__default.createElement(FormSelect$1, {
25065
25040
  options: options,
25066
25041
  field: field,
@@ -25070,8 +25045,7 @@ var CountryDropdown = function CountryDropdown(_ref) {
25070
25045
  errorMessages: errorMessages,
25071
25046
  showErrors: showErrors,
25072
25047
  onChange: onChange,
25073
- autocompleteValue: "country-name",
25074
- isRequired: isRequired
25048
+ autocompleteValue: "country-name"
25075
25049
  });
25076
25050
  };
25077
25051
 
@@ -25916,7 +25890,7 @@ var fallbackValues$k = {
25916
25890
  };
25917
25891
 
25918
25892
  var _excluded$p = ["showErrors", "themeValues"],
25919
- _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
25893
+ _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa"];
25920
25894
  var InputField = styled__default.input.withConfig({
25921
25895
  displayName: "FormInput__InputField",
25922
25896
  componentId: "sc-l094r1-0"
@@ -26003,12 +25977,8 @@ var FormInput = function FormInput(_ref15) {
26003
25977
  removeFromValue = _ref15.removeFromValue,
26004
25978
  _ref15$dataQa = _ref15.dataQa,
26005
25979
  dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
26006
- _ref15$isRequired = _ref15.isRequired,
26007
- isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
26008
25980
  props = _objectWithoutProperties(_ref15, _excluded2);
26009
25981
 
26010
- var required = isRequired || (props === null || props === void 0 ? void 0 : props.required);
26011
-
26012
25982
  var _useState = React.useState(false),
26013
25983
  _useState2 = _slicedToArray(_useState, 2),
26014
25984
  showPassword = _useState2[0],
@@ -26093,8 +26063,7 @@ var FormInput = function FormInput(_ref15) {
26093
26063
  $customHeight: customHeight,
26094
26064
  $extraStyles: extraStyles,
26095
26065
  "data-qa": dataQa || labelTextWhenNoError,
26096
- autoComplete: autocompleteValue,
26097
- required: required
26066
+ autoComplete: autocompleteValue
26098
26067
  }, props)) : /*#__PURE__*/React__default.createElement(InputField, _extends({
26099
26068
  "aria-labelledby": createIdFromString(labelTextWhenNoError),
26100
26069
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
@@ -26113,8 +26082,7 @@ var FormInput = function FormInput(_ref15) {
26113
26082
  $customHeight: customHeight,
26114
26083
  $extraStyles: extraStyles,
26115
26084
  "data-qa": dataQa || labelTextWhenNoError,
26116
- autoComplete: autocompleteValue,
26117
- required: required
26085
+ autoComplete: autocompleteValue
26118
26086
  }, props))), /*#__PURE__*/React__default.createElement(Stack, {
26119
26087
  direction: "row",
26120
26088
  justify: "space-between",
@@ -38048,9 +38016,7 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
38048
38016
  field = _ref.field,
38049
38017
  fieldActions = _ref.fieldActions,
38050
38018
  showErrors = _ref.showErrors,
38051
- countryCode = _ref.countryCode,
38052
- _ref$isRequired = _ref.isRequired,
38053
- isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
38019
+ countryCode = _ref.countryCode;
38054
38020
  var placeholder = countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
38055
38021
  var options = [placeholder].concat(_toConsumableArray(getOptions(countryCode)));
38056
38022
  return /*#__PURE__*/React__default.createElement(FormSelect$1, {
@@ -38060,8 +38026,7 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
38060
38026
  labelTextWhenNoError: labelTextWhenNoError,
38061
38027
  errorMessages: errorMessages,
38062
38028
  showErrors: showErrors,
38063
- autocompleteValue: "address-level1",
38064
- isRequired: isRequired
38029
+ autocompleteValue: "address-level1"
38065
38030
  });
38066
38031
  };
38067
38032
 
@@ -39387,7 +39352,6 @@ var AddressForm = function AddressForm(_ref) {
39387
39352
  labelTextWhenNoError: "Country",
39388
39353
  errorMessages: countryErrorMessages,
39389
39354
  field: fields.country,
39390
- isRequired: true,
39391
39355
  onChange: function onChange(value) {
39392
39356
  actions.fields.country.set(value); // temporary measure to not dirty fields until
39393
39357
  // we can write a reset function for fields
@@ -39412,8 +39376,7 @@ var AddressForm = function AddressForm(_ref) {
39412
39376
  return e.key === "Enter" && handleSubmit(e);
39413
39377
  },
39414
39378
  autocompleteValue: "address-line1",
39415
- dataQa: "Address",
39416
- isRequired: true
39379
+ dataQa: "Address"
39417
39380
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
39418
39381
  labelTextWhenNoError: "Apt, Suite, Unit, Floor, etc. (Optional)",
39419
39382
  field: fields.street2,
@@ -39423,8 +39386,7 @@ var AddressForm = function AddressForm(_ref) {
39423
39386
  return e.key === "Enter" && handleSubmit(e);
39424
39387
  },
39425
39388
  autocompleteValue: "address-line2",
39426
- dataQa: "Address Line 2",
39427
- isRequired: false
39389
+ dataQa: "Address Line 2"
39428
39390
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
39429
39391
  labelTextWhenNoError: "City",
39430
39392
  errorMessages: cityErrorMessages,
@@ -39435,8 +39397,7 @@ var AddressForm = function AddressForm(_ref) {
39435
39397
  return e.key === "Enter" && handleSubmit(e);
39436
39398
  },
39437
39399
  autocompleteValue: "address-level2",
39438
- dataQa: "City",
39439
- isRequired: true
39400
+ dataQa: "City"
39440
39401
  }), /*#__PURE__*/React__default.createElement(FormStateDropdown, {
39441
39402
  labelTextWhenNoError: isUS ? "State" : "State or Province",
39442
39403
  errorMessages: stateProvinceErrorMessages,
@@ -39447,8 +39408,7 @@ var AddressForm = function AddressForm(_ref) {
39447
39408
  onKeyDown: function onKeyDown(e) {
39448
39409
  return e.key === "Enter" && handleSubmit(e);
39449
39410
  },
39450
- dataQa: "State or Province",
39451
- isRequired: true
39411
+ dataQa: "State or Province"
39452
39412
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
39453
39413
  isNum: isUS,
39454
39414
  formatter: isUS ? zipFormat : null,
@@ -39461,8 +39421,7 @@ var AddressForm = function AddressForm(_ref) {
39461
39421
  return e.key === "Enter" && handleSubmit(e);
39462
39422
  },
39463
39423
  autocompleteValue: "postal-code",
39464
- dataQa: "Zip code",
39465
- isRequired: true
39424
+ dataQa: "Zip code"
39466
39425
  }), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
39467
39426
  name: "address checkbox",
39468
39427
  title: "Save address to wallet",
@@ -47747,8 +47706,7 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47747
47706
  title: "Terms and Conditions",
47748
47707
  error: error,
47749
47708
  checked: isChecked,
47750
- onChange: onCheck,
47751
- isRequired: true
47709
+ onChange: onCheck
47752
47710
  }), /*#__PURE__*/React__default.createElement(Box, {
47753
47711
  padding: "0 0 0 58px"
47754
47712
  }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
@@ -47861,8 +47819,7 @@ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47861
47819
  checked: isChecked,
47862
47820
  onChange: onCheck,
47863
47821
  checkboxMargin: checkboxMargin,
47864
- extraStyles: "align-self: flex-start;",
47865
- isRequired: true
47822
+ extraStyles: "align-self: flex-start;"
47866
47823
  }), /*#__PURE__*/React__default.createElement(Stack, {
47867
47824
  childGap: "0.25rem",
47868
47825
  fullHeight: true
@@ -47968,8 +47925,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47968
47925
  onKeyDown: function onKeyDown(e) {
47969
47926
  return e.key === "Enter" && handleSubmit(e);
47970
47927
  },
47971
- autocompleteValue: "name",
47972
- isRequired: true
47928
+ autocompleteValue: "name"
47973
47929
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
47974
47930
  labelTextWhenNoError: "Routing number",
47975
47931
  dataQa: "Routing number",
@@ -47991,8 +47947,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47991
47947
  },
47992
47948
  onKeyDown: function onKeyDown(e) {
47993
47949
  return e.key === "Enter" && handleSubmit(e);
47994
- },
47995
- isRequired: true
47950
+ }
47996
47951
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
47997
47952
  labelTextWhenNoError: "Confirm routing number",
47998
47953
  dataQa: "Confirm routing number",
@@ -48003,7 +47958,6 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48003
47958
  onKeyDown: function onKeyDown(e) {
48004
47959
  return e.key === "Enter" && handleSubmit(e);
48005
47960
  },
48006
- isRequired: true,
48007
47961
  isNum: true
48008
47962
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
48009
47963
  labelTextWhenNoError: "Account number",
@@ -48012,7 +47966,6 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48012
47966
  field: fields.accountNumber,
48013
47967
  fieldActions: actions.fields.accountNumber,
48014
47968
  showErrors: showErrors,
48015
- isRequired: true,
48016
47969
  isNum: true,
48017
47970
  helperModal: function helperModal() {
48018
47971
  return /*#__PURE__*/React__default.createElement(AccountAndRoutingModal$1, {
@@ -48031,7 +47984,6 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48031
47984
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
48032
47985
  labelTextWhenNoError: "Confirm account number",
48033
47986
  dataQa: "Confirm account number",
48034
- isRequired: true,
48035
47987
  errorMessages: confirmAccountNumberErrors,
48036
47988
  field: fields.confirmAccountNumber,
48037
47989
  fieldActions: actions.fields.confirmAccountNumber,
@@ -48042,7 +47994,6 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48042
47994
  isNum: true
48043
47995
  }), allowBankAccountType && /*#__PURE__*/React__default.createElement(FormSelect$1, {
48044
47996
  labelTextWhenNoError: "Account type",
48045
- isRequired: true,
48046
47997
  dataQa: "Account type",
48047
47998
  options: [{
48048
47999
  text: "Select account type",
@@ -48080,8 +48031,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
48080
48031
  version: "v2",
48081
48032
  showCheckbox: false,
48082
48033
  description: "View",
48083
- terms: termsContent,
48084
- isRequired: true
48034
+ terms: termsContent
48085
48035
  })))));
48086
48036
  };
48087
48037
 
@@ -48174,7 +48124,6 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48174
48124
  "aria-label": "Card payment"
48175
48125
  }, /*#__PURE__*/React__default.createElement(FormInputColumn, null, !hideZipCode && /*#__PURE__*/React__default.createElement(CountryDropdown, {
48176
48126
  labelTextWhenNoError: "Country",
48177
- isRequired: true,
48178
48127
  errorMessages: countryErrorMessages,
48179
48128
  field: fields.country,
48180
48129
  onChange: function onChange(value) {
@@ -48610,7 +48559,9 @@ var RadioSection = function RadioSection(_ref) {
48610
48559
  openHeight = _ref$openHeight === void 0 ? "auto" : _ref$openHeight,
48611
48560
  _ref$containerStyles = _ref.containerStyles,
48612
48561
  containerStyles = _ref$containerStyles === void 0 ? "" : _ref$containerStyles,
48613
- ariaDescribedBy = _ref.ariaDescribedBy;
48562
+ ariaDescribedBy = _ref.ariaDescribedBy,
48563
+ _ref$ariaLabel = _ref.ariaLabel,
48564
+ ariaLabel = _ref$ariaLabel === void 0 ? "Please select an option." : _ref$ariaLabel;
48614
48565
 
48615
48566
  var handleKeyDown = function handleKeyDown(id, e) {
48616
48567
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 || (e === null || e === void 0 ? void 0 : e.keyCode) === 32) {
@@ -48666,7 +48617,8 @@ var RadioSection = function RadioSection(_ref) {
48666
48617
  extraStyles: containerStyles
48667
48618
  }, /*#__PURE__*/React__default.createElement(Stack, {
48668
48619
  childGap: "0",
48669
- role: "radiogroup"
48620
+ role: "radiogroup",
48621
+ "aria-label": ariaLabel
48670
48622
  }, sections.filter(function (section) {
48671
48623
  return !section.hidden;
48672
48624
  }).map(function (section) {