@thecb/components 6.1.0-beta.7 → 6.1.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
@@ -6100,17 +6100,9 @@ var safeChildren = function safeChildren(children) {
6100
6100
 
6101
6101
  return unsafeValues.includes(children) ? replacement : children;
6102
6102
  };
6103
- var generateClickHandler = function generateClickHandler(form, handleErrors, submitForm, resetErrors) {
6103
+ var generateClickHandler = function generateClickHandler(form, handleErrors, submitForm) {
6104
6104
  return function (e) {
6105
6105
  e.preventDefault();
6106
-
6107
- if (resetErrors) {
6108
- console.log("reset errors", resetErrors); // if provided, will reset error state tracker
6109
- // allows hooks that depend on error state to re-run
6110
-
6111
- resetErrors(false);
6112
- }
6113
-
6114
6106
  var formHasError = Object.values(form.fields).reduce(function (acc, curr) {
6115
6107
  return acc || curr.hasErrors;
6116
6108
  }, false);
@@ -43665,18 +43657,15 @@ var index$4 = /*#__PURE__*/Object.freeze({
43665
43657
 
43666
43658
  var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
43667
43659
  var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
43668
- console.log("hey show errors", hasErrors); // Only move focus when "hasErrors" is true
43660
+ // Only move focus when "hasErrors" is true
43669
43661
  // "hasErrors" is managed by container page of form
43670
43662
  // typically set to "true" on attempted form submission, if errors exist
43671
-
43663
+ // Reset errors, if provided, resets the error state tracking in order to properly re-run
43672
43664
  React.useEffect(function () {
43673
- console.log("inside use effect show errors", hasErrors);
43674
-
43675
43665
  if (hasErrors) {
43676
43666
  var _inputsWithErrors$;
43677
43667
 
43678
43668
  var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
43679
- console.log("inputs with errors is", inputsWithErrors);
43680
43669
  inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
43681
43670
  }
43682
43671