@mxenabled/connect-widget 0.15.0 → 0.15.2
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 +52 -0
- package/dist/index.es.js.map +1 -1
- package/dist/lastBuild.txt +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -74372,6 +74372,31 @@ const ConfirmDetails = (props) => {
|
|
|
74372
74372
|
);
|
|
74373
74373
|
return () => subscription.unsubscribe();
|
|
74374
74374
|
}, [isSubmitting]);
|
|
74375
|
+
useEffect(() => {
|
|
74376
|
+
const handleFocus = (event) => {
|
|
74377
|
+
const focusedElement = event.target;
|
|
74378
|
+
if (containerRef.current && focusedElement) {
|
|
74379
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
74380
|
+
const elementRect = focusedElement.getBoundingClientRect();
|
|
74381
|
+
const stickyHeader = document.querySelector('[data-test="navigation-header"]');
|
|
74382
|
+
const stickyHeaderHeight = stickyHeader ? stickyHeader.offsetHeight : 0;
|
|
74383
|
+
if (elementRect.top < containerRect.top + stickyHeaderHeight || // Account for sticky header
|
|
74384
|
+
elementRect.bottom > containerRect.bottom) {
|
|
74385
|
+
focusedElement.scrollIntoView({
|
|
74386
|
+
behavior: "smooth",
|
|
74387
|
+
block: "center"
|
|
74388
|
+
});
|
|
74389
|
+
if (stickyHeaderHeight > 0) {
|
|
74390
|
+
window.scrollBy(0, -stickyHeaderHeight);
|
|
74391
|
+
}
|
|
74392
|
+
}
|
|
74393
|
+
}
|
|
74394
|
+
};
|
|
74395
|
+
containerRef.current?.addEventListener("focusin", handleFocus);
|
|
74396
|
+
return () => {
|
|
74397
|
+
containerRef.current?.removeEventListener("focusin", handleFocus);
|
|
74398
|
+
};
|
|
74399
|
+
}, [containerRef]);
|
|
74375
74400
|
const handleEdit = (focus) => fadeOut(containerRef.current, "up", 300).then(() => onEditForm(focus));
|
|
74376
74401
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, children: [
|
|
74377
74402
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SlideDown, { delay: getNextDelay(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: styles.header, children: /* @__PURE__ */ jsxRuntimeExports.jsx(x, { "data-test": "title-header", style: styles.title, truncate: false, variant: "H2", children: __("Review your information") }) }) }),
|
|
@@ -76158,6 +76183,33 @@ const ManualAccountForm = React__default.forwardRef(
|
|
|
76158
76183
|
});
|
|
76159
76184
|
return schema;
|
|
76160
76185
|
}
|
|
76186
|
+
useEffect(() => {
|
|
76187
|
+
const handleFocus = (event) => {
|
|
76188
|
+
const focusedElement = event.target;
|
|
76189
|
+
if (formRef.current && focusedElement !== null) {
|
|
76190
|
+
const containerRect = formRef.current.getBoundingClientRect();
|
|
76191
|
+
const elementRect = focusedElement.getBoundingClientRect();
|
|
76192
|
+
const stickyHeader = document.querySelector(
|
|
76193
|
+
'[data-test="navigation-header"]'
|
|
76194
|
+
);
|
|
76195
|
+
const stickyHeaderHeight = stickyHeader ? stickyHeader.offsetHeight : 0;
|
|
76196
|
+
if (elementRect.top < containerRect.top + stickyHeaderHeight || // Account for sticky header
|
|
76197
|
+
elementRect.bottom > containerRect.bottom) {
|
|
76198
|
+
focusedElement.scrollIntoView({
|
|
76199
|
+
behavior: "smooth",
|
|
76200
|
+
block: "center"
|
|
76201
|
+
});
|
|
76202
|
+
if (stickyHeaderHeight > 0) {
|
|
76203
|
+
window.scrollBy(0, -stickyHeaderHeight);
|
|
76204
|
+
}
|
|
76205
|
+
}
|
|
76206
|
+
}
|
|
76207
|
+
};
|
|
76208
|
+
formRef.current?.addEventListener("focusin", handleFocus);
|
|
76209
|
+
return () => {
|
|
76210
|
+
formRef.current?.addEventListener("focusin", handleFocus);
|
|
76211
|
+
};
|
|
76212
|
+
}, [formRef]);
|
|
76161
76213
|
useEffect(() => {
|
|
76162
76214
|
if (!saving) return () => {
|
|
76163
76215
|
};
|