@usefillo/dom 0.5.1 → 0.5.3

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.js CHANGED
@@ -887,9 +887,10 @@ function isAutoSubmitBlock(block) {
887
887
  return isField(block) && (block.kind === "select" || block.kind === "dropdown" || block.kind === "checkbox" || block.kind === "rating" || block.kind === "linear_scale");
888
888
  }
889
889
  function needsExplicitSubmit(visible) {
890
- if (visible.length === 0) return false;
891
- if (visible.length > 1) return true;
892
- return !isAutoSubmitBlock(visible[0]);
890
+ const interactive = visible.filter((b) => !(isField(b) && b.kind === "hidden"));
891
+ if (interactive.length === 0) return false;
892
+ if (interactive.length > 1) return true;
893
+ return !isAutoSubmitBlock(interactive[0]);
893
894
  }
894
895
  function defaultFieldRenderer(context) {
895
896
  if (context.field.kind === "hidden") return null;
@@ -916,8 +917,8 @@ function shouldAutoSubmit(field, value, api, uploading) {
916
917
  })();
917
918
  if (!hasDiscreteAnswer) return false;
918
919
  const nextData = { ...api.data, [field.id]: value };
919
- const visible = visibleFields(api.form, nextData);
920
- if (visible.length !== 1 || visible[0]?.id !== field.id) return false;
920
+ const interactive = visibleFields(api.form, nextData).filter((f) => f.kind !== "hidden");
921
+ if (interactive.length !== 1 || interactive[0]?.id !== field.id) return false;
921
922
  return validateResponse(api.form, nextData).ok;
922
923
  }
923
924
  var DomFormController = class {