@mxenabled/connect-widget 0.15.0 → 0.15.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
@@ -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") }) }) }),