bhl-forms 0.0.51 → 0.0.54

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.
@@ -9318,6 +9318,15 @@ function dbg$1() {
9318
9318
  return;
9319
9319
  console.debug(...arguments);
9320
9320
  }
9321
+ var getCoords$1 = (elem) => {
9322
+ var box2 = elem.getBoundingClientRect();
9323
+ return {
9324
+ top: box2.top + window.pageYOffset,
9325
+ right: box2.right + window.pageXOffset,
9326
+ bottom: box2.bottom + window.pageYOffset,
9327
+ left: box2.left + window.pageXOffset
9328
+ };
9329
+ };
9321
9330
  var postJSON = /* @__PURE__ */ function() {
9322
9331
  var _ref = _asyncToGenerator(function* (url3, data2) {
9323
9332
  dbg$1("Post to: " + url3);
@@ -10401,9 +10410,10 @@ function useSteps() {
10401
10410
  }
10402
10411
  if (el) {
10403
10412
  var __tempEl__ = document.createElement("input");
10413
+ var coords = getCoords$1(el);
10404
10414
  __tempEl__.style.position = "absolute";
10405
- __tempEl__.style.top = el.offsetTop + 7 + "px";
10406
- __tempEl__.style.left = el.offsetLeft + "px";
10415
+ __tempEl__.style.top = coords.top + 7 + "px";
10416
+ __tempEl__.style.left = coords.left + "px";
10407
10417
  __tempEl__.style.height = 0;
10408
10418
  __tempEl__.style.opacity = 0;
10409
10419
  document.body.appendChild(__tempEl__);
@@ -10490,14 +10500,14 @@ function useSteps() {
10490
10500
  if (autoFocus) {
10491
10501
  var newNode = steps2[activeStep2.value].node;
10492
10502
  var firstInput = findFirstInput(newNode);
10493
- if (!firstInput) {
10494
- return;
10495
- }
10496
- if (autoFocusTypes.indexOf(firstInput.context.type) === -1) {
10497
- return;
10503
+ if (firstInput && autoFocusTypes.indexOf(firstInput.context.type) > -1) {
10504
+ var elem = document.getElementById(firstInput.context.id);
10505
+ try {
10506
+ focusAndOpenKeyboard(elem);
10507
+ } catch (e2) {
10508
+ console.warn("Failed to autoFocus:", e2);
10509
+ }
10498
10510
  }
10499
- var elem = document.getElementById(firstInput.context.id);
10500
- focusAndOpenKeyboard(elem);
10501
10511
  }
10502
10512
  return true;
10503
10513
  };
@@ -17889,6 +17899,7 @@ var scrollAnchor = (formNode) => () => {
17889
17899
  var anchor = document.getElementById(anchorId);
17890
17900
  if (anchor) {
17891
17901
  var pos = getCoords(anchor);
17902
+ dbg("scrollTo", pos);
17892
17903
  window.scrollTo(pos.right, pos.top);
17893
17904
  }
17894
17905
  }
@@ -22298,6 +22309,7 @@ var init = () => {
22298
22309
  data2.onEnter = (callback) => (e2) => {
22299
22310
  if (e2.key === "Enter" || e2.keyCode === 13) {
22300
22311
  callback();
22312
+ e2.preventDefault();
22301
22313
  }
22302
22314
  };
22303
22315
  var app = createApp(_sfc_main$1, {