bhl-forms 0.0.44 → 0.0.47

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.
@@ -17993,16 +17993,26 @@ function prepData(formData) {
17993
17993
  };
17994
17994
  return data2;
17995
17995
  }
17996
- var isMobile = window.matchMedia("only screen and (max-width: 480px)").matches;
17996
+ window.matchMedia("only screen and (max-width: 480px)").matches;
17997
+ function getCoords(elem) {
17998
+ var box2 = elem.getBoundingClientRect();
17999
+ return {
18000
+ top: box2.top + window.pageYOffset,
18001
+ right: box2.right + window.pageXOffset,
18002
+ bottom: box2.bottom + window.pageYOffset,
18003
+ left: box2.left + window.pageXOffset
18004
+ };
18005
+ }
17997
18006
  var fireStepEvent = (formNode) => (stepResult, stepHistory2, stepQueue2) => {
17998
18007
  if (!stepResult) {
17999
18008
  return;
18000
18009
  }
18001
18010
  var anchorId = formNode.attrs.anchorElement || formNode.id;
18002
- if (anchorId && isMobile) {
18011
+ if (anchorId) {
18003
18012
  var anchor = document.getElementById(anchorId);
18004
18013
  if (anchor) {
18005
- anchor.scrollIntoView(true);
18014
+ var pos = getCoords(anchor);
18015
+ window.scrollTo(pos.right, pos.top);
18006
18016
  }
18007
18017
  }
18008
18018
  var step_values = null;
@@ -18117,6 +18127,21 @@ $({ target: "Object", stat: true }, {
18117
18127
  return obj;
18118
18128
  }
18119
18129
  });
18130
+ if (!Object.fromEntries) {
18131
+ Object.defineProperty(Object, "fromEntries", {
18132
+ value(entries2) {
18133
+ if (!entries2 || !entries2[Symbol.iterator]) {
18134
+ throw new Error("Object.fromEntries() requires a single iterable argument");
18135
+ }
18136
+ var o2 = {};
18137
+ Object.keys(entries2).forEach((key) => {
18138
+ var [k3, v] = entries2[key];
18139
+ o2[k3] = v;
18140
+ });
18141
+ return o2;
18142
+ }
18143
+ });
18144
+ }
18120
18145
  function toInteger(dirtyNumber) {
18121
18146
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
18122
18147
  return NaN;
@@ -22379,6 +22404,11 @@ var init = () => {
22379
22404
  data2.submitUrl = data2.submitUrl || defaultSubmitUrl;
22380
22405
  data2.prepData = data2.prepData || prepData;
22381
22406
  data2.fireStepEvent = data2.fireStepEvent || fireStepEvent;
22407
+ data2.onEnter = (callback) => (e3) => {
22408
+ if (e3.key === "Enter" || e3.keyCode === 13) {
22409
+ callback();
22410
+ }
22411
+ };
22382
22412
  var app = createApp(_sfc_main$1, {
22383
22413
  schema: schemaObj,
22384
22414
  data: data2