@thecb/components 9.0.3 → 9.0.4-beta.1

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
@@ -47851,6 +47851,13 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47851
47851
 
47852
47852
  var accountTypeErrors = _defineProperty({}, required.error, "Account type is required");
47853
47853
 
47854
+ useEffect$1(function () {
47855
+ var firstFocusableField = document.getElementById("first-focusable-ach-input");
47856
+
47857
+ if (firstFocusableField) {
47858
+ firstFocusableField.focus();
47859
+ }
47860
+ }, []);
47854
47861
  return /*#__PURE__*/React.createElement(FormContainer$1, {
47855
47862
  variant: variant,
47856
47863
  role: "form",
@@ -47865,7 +47872,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47865
47872
  onKeyDown: function onKeyDown(e) {
47866
47873
  return e.key === "Enter" && handleSubmit(e);
47867
47874
  },
47868
- autocompleteValue: "name"
47875
+ autocompleteValue: "name",
47876
+ id: "first-focusable-ach-input"
47869
47877
  }), /*#__PURE__*/React.createElement(FormInput$1, {
47870
47878
  labelTextWhenNoError: "Routing number",
47871
47879
  dataQa: "Routing number",
@@ -48050,13 +48058,20 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48050
48058
 
48051
48059
  var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
48052
48060
 
48053
- var creditCardNumberErrors = (_creditCardNumberErro = {}, _defineProperty(_creditCardNumberErro, required.error, "Credit card number is required"), _defineProperty(_creditCardNumberErro, hasLength.error, "Credit card number is invalid"), _defineProperty(_creditCardNumberErro, matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted")), _creditCardNumberErro);
48061
+ var creditCardNumberErrors = (_creditCardNumberErro = {}, _defineProperty(_creditCardNumberErro, required.error, "Credit card number is required"), _defineProperty(_creditCardNumberErro, hasLength.error, "Credit card number is invalid"), _defineProperty(_creditCardNumberErro, matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted.")), _creditCardNumberErro);
48054
48062
  var expirationDateErrors = (_expirationDateErrors = {}, _defineProperty(_expirationDateErrors, required.error, "Expiration date is required"), _defineProperty(_expirationDateErrors, hasLength.error, "Expiration date is invalid"), _defineProperty(_expirationDateErrors, isValidMonth.error, "Expiration month is invalid"), _defineProperty(_expirationDateErrors, dateAfterToday.error, "Expiration date is invalid"), _expirationDateErrors);
48055
48063
  var cvvErrors = (_cvvErrors = {}, _defineProperty(_cvvErrors, required.error, "CVV is required"), _defineProperty(_cvvErrors, hasLength.error, "CVV is invalid"), _cvvErrors);
48056
48064
  var zipCodeErrors = (_zipCodeErrors = {}, _defineProperty(_zipCodeErrors, required.error, "Zip code is required"), _defineProperty(_zipCodeErrors, hasLength.error, "Zip code is invalid"), _zipCodeErrors);
48057
48065
 
48058
48066
  var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
48059
48067
 
48068
+ useEffect$1(function () {
48069
+ var firstFocusableField = document.getElementById("first-focusable-card-input");
48070
+
48071
+ if (firstFocusableField) {
48072
+ firstFocusableField.focus();
48073
+ }
48074
+ }, []);
48060
48075
  var isUS = fields.country.rawValue === "US";
48061
48076
  return /*#__PURE__*/React.createElement(FormContainer$1, {
48062
48077
  variant: variant,
@@ -48086,7 +48101,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48086
48101
  onKeyDown: function onKeyDown(e) {
48087
48102
  return e.key === "Enter" && handleSubmit(e);
48088
48103
  },
48089
- autocompleteValue: "cc-name"
48104
+ autocompleteValue: "cc-name",
48105
+ id: "first-focusable-card-input"
48090
48106
  }), /*#__PURE__*/React.createElement(FormInput$1, {
48091
48107
  labelTextWhenNoError: "Credit card number",
48092
48108
  dataQa: "Credit card number",
@@ -48546,7 +48562,19 @@ var RadioSection = function RadioSection(_ref) {
48546
48562
  var _useState = useState(null),
48547
48563
  _useState2 = _slicedToArray(_useState, 2),
48548
48564
  focused = _useState2[0],
48549
- setFocused = _useState2[1];
48565
+ setFocused = _useState2[1]; // useEffect(() => {
48566
+ // if (toggledContentRef && toggledContentRef?.current) {
48567
+ // const inputEl = toggledContentRef.current?.querySelector(
48568
+ // `[tabindex="0"]`
48569
+ // );
48570
+ // if (inputEl) {
48571
+ // inputEl?.focus();
48572
+ // } else {
48573
+ // toggledContentRef.current.focus();
48574
+ // }
48575
+ // }
48576
+ // }, [toggledContentRef.current]);
48577
+
48550
48578
 
48551
48579
  return /*#__PURE__*/React.createElement(Box, {
48552
48580
  padding: "1px",
@@ -48620,11 +48648,13 @@ var RadioSection = function RadioSection(_ref) {
48620
48648
  align: "center"
48621
48649
  }, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
48622
48650
  padding: section.titleIcon ? "0 0 0 8px" : "0"
48623
- }, /*#__PURE__*/React.createElement(Text$1, {
48651
+ }, /*#__PURE__*/React.createElement(Text$1, _extends({
48624
48652
  as: "label",
48625
48653
  htmlFor: "radio-input-".concat(idString(section)),
48626
48654
  color: CHARADE_GREY
48627
- }, section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
48655
+ }, _objectSpread2({}, section !== null && section !== void 0 && section.titleLabel ? {
48656
+ "aria-label": section.titleLabel
48657
+ } : {})), section.title))), section.rightIcons && /*#__PURE__*/React.createElement(Cluster, {
48628
48658
  childGap: "0.5rem",
48629
48659
  "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
48630
48660
  role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null