@mxenabled/connect-widget 0.13.0 → 0.13.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.es.js CHANGED
@@ -79572,6 +79572,8 @@ const reducer$3 = (state, action) => {
79572
79572
  };
79573
79573
  const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79574
79574
  const containerRef = useRef(null);
79575
+ const firstInputRef = useRef(null);
79576
+ const secondInputRef = useRef(null);
79575
79577
  useAnalyticsPath(...PageviewInfo.CONNECT_MICRODEPOSITS_VERIFY_DEPOSITS);
79576
79578
  const { api } = useApi();
79577
79579
  const initialForm = { firstAmount: "", secondAmount: "" };
@@ -79613,6 +79615,13 @@ const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79613
79615
  );
79614
79616
  return () => subscription.unsubscribe();
79615
79617
  }, [state.isSubmitting]);
79618
+ useEffect(() => {
79619
+ if (errors.firstAmount) {
79620
+ firstInputRef.current.focus();
79621
+ } else if (errors.secondAmount) {
79622
+ secondInputRef.current.focus();
79623
+ }
79624
+ }, [errors]);
79616
79625
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
79617
79626
  /* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: styles.header, children: [
79618
79627
  /* @__PURE__ */ jsxRuntimeExports.jsx(x, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Enter deposit amounts") }),
@@ -79651,7 +79660,11 @@ const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79651
79660
  error: !!errors.firstAmount,
79652
79661
  helperText: errors.firstAmount,
79653
79662
  id: schema.firstAmount.label,
79654
- inputProps: { "data-test": "amount-1-input" },
79663
+ inputProps: {
79664
+ "data-test": "amount-1-input",
79665
+ "aria-describedby": errors.firstAmount ? "firstAmount-error" : void 0
79666
+ },
79667
+ inputRef: firstInputRef,
79655
79668
  label: schema.firstAmount.label,
79656
79669
  name: "firstAmount",
79657
79670
  onChange: handleTextInputChange,
@@ -79667,7 +79680,11 @@ const VerifyDeposits = ({ microdeposit, onSuccess }) => {
79667
79680
  error: !!errors.secondAmount,
79668
79681
  helperText: errors.secondAmount,
79669
79682
  id: schema.secondAmount.label,
79670
- inputProps: { "data-test": "amount-2-input" },
79683
+ inputProps: {
79684
+ "data-test": "amount-2-input",
79685
+ "aria-describedby": errors.secondAmount ? "secondAmount-error" : void 0
79686
+ },
79687
+ inputRef: secondInputRef,
79671
79688
  label: schema.secondAmount.label,
79672
79689
  name: "secondAmount",
79673
79690
  onChange: handleTextInputChange,