@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.cjs.js CHANGED
@@ -47859,6 +47859,13 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47859
47859
 
47860
47860
  var accountTypeErrors = _defineProperty({}, required.error, "Account type is required");
47861
47861
 
47862
+ React.useEffect(function () {
47863
+ var firstFocusableField = document.getElementById("first-focusable-ach-input");
47864
+
47865
+ if (firstFocusableField) {
47866
+ firstFocusableField.focus();
47867
+ }
47868
+ }, []);
47862
47869
  return /*#__PURE__*/React__default.createElement(FormContainer$1, {
47863
47870
  variant: variant,
47864
47871
  role: "form",
@@ -47873,7 +47880,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47873
47880
  onKeyDown: function onKeyDown(e) {
47874
47881
  return e.key === "Enter" && handleSubmit(e);
47875
47882
  },
47876
- autocompleteValue: "name"
47883
+ autocompleteValue: "name",
47884
+ id: "first-focusable-ach-input"
47877
47885
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
47878
47886
  labelTextWhenNoError: "Routing number",
47879
47887
  dataQa: "Routing number",
@@ -48058,13 +48066,20 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48058
48066
 
48059
48067
  var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
48060
48068
 
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);
48069
+ 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);
48062
48070
  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);
48063
48071
  var cvvErrors = (_cvvErrors = {}, _defineProperty(_cvvErrors, required.error, "CVV is required"), _defineProperty(_cvvErrors, hasLength.error, "CVV is invalid"), _cvvErrors);
48064
48072
  var zipCodeErrors = (_zipCodeErrors = {}, _defineProperty(_zipCodeErrors, required.error, "Zip code is required"), _defineProperty(_zipCodeErrors, hasLength.error, "Zip code is invalid"), _zipCodeErrors);
48065
48073
 
48066
48074
  var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
48067
48075
 
48076
+ React.useEffect(function () {
48077
+ var firstFocusableField = document.getElementById("first-focusable-card-input");
48078
+
48079
+ if (firstFocusableField) {
48080
+ firstFocusableField.focus();
48081
+ }
48082
+ }, []);
48068
48083
  var isUS = fields.country.rawValue === "US";
48069
48084
  return /*#__PURE__*/React__default.createElement(FormContainer$1, {
48070
48085
  variant: variant,
@@ -48094,7 +48109,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
48094
48109
  onKeyDown: function onKeyDown(e) {
48095
48110
  return e.key === "Enter" && handleSubmit(e);
48096
48111
  },
48097
- autocompleteValue: "cc-name"
48112
+ autocompleteValue: "cc-name",
48113
+ id: "first-focusable-card-input"
48098
48114
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
48099
48115
  labelTextWhenNoError: "Credit card number",
48100
48116
  dataQa: "Credit card number",
@@ -48554,7 +48570,19 @@ var RadioSection = function RadioSection(_ref) {
48554
48570
  var _useState = React.useState(null),
48555
48571
  _useState2 = _slicedToArray(_useState, 2),
48556
48572
  focused = _useState2[0],
48557
- setFocused = _useState2[1];
48573
+ setFocused = _useState2[1]; // useEffect(() => {
48574
+ // if (toggledContentRef && toggledContentRef?.current) {
48575
+ // const inputEl = toggledContentRef.current?.querySelector(
48576
+ // `[tabindex="0"]`
48577
+ // );
48578
+ // if (inputEl) {
48579
+ // inputEl?.focus();
48580
+ // } else {
48581
+ // toggledContentRef.current.focus();
48582
+ // }
48583
+ // }
48584
+ // }, [toggledContentRef.current]);
48585
+
48558
48586
 
48559
48587
  return /*#__PURE__*/React__default.createElement(Box, {
48560
48588
  padding: "1px",
@@ -48628,11 +48656,13 @@ var RadioSection = function RadioSection(_ref) {
48628
48656
  align: "center"
48629
48657
  }, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
48630
48658
  padding: section.titleIcon ? "0 0 0 8px" : "0"
48631
- }, /*#__PURE__*/React__default.createElement(Text$1, {
48659
+ }, /*#__PURE__*/React__default.createElement(Text$1, _extends({
48632
48660
  as: "label",
48633
48661
  htmlFor: "radio-input-".concat(idString(section)),
48634
48662
  color: CHARADE_GREY
48635
- }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
48663
+ }, _objectSpread2({}, section !== null && section !== void 0 && section.titleLabel ? {
48664
+ "aria-label": section.titleLabel
48665
+ } : {})), section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
48636
48666
  childGap: "0.5rem",
48637
48667
  "aria-label": (section === null || section === void 0 ? void 0 : section.rightIconsLabel) || null,
48638
48668
  role: (section === null || section === void 0 ? void 0 : section.rightIconsRole) || null