@flowgram.ai/form 0.2.14 → 0.2.15

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/esm/index.js CHANGED
@@ -203,6 +203,11 @@ var Glob;
203
203
  })(Glob || (Glob = {}));
204
204
 
205
205
  // src/types/validate.ts
206
+ var FeedbackLevel = /* @__PURE__ */ ((FeedbackLevel2) => {
207
+ FeedbackLevel2["Error"] = "error";
208
+ FeedbackLevel2["Warning"] = "warning";
209
+ return FeedbackLevel2;
210
+ })(FeedbackLevel || {});
206
211
  var ValidateTrigger = /* @__PURE__ */ ((ValidateTrigger2) => {
207
212
  ValidateTrigger2["onChange"] = "onChange";
208
213
  ValidateTrigger2["onBlur"] = "onBlur";
@@ -930,8 +935,8 @@ var FieldModel = class {
930
935
  return {};
931
936
  }
932
937
  const groupedFeedbacks = groupBy(feedbacks, "level");
933
- warnings = warnings.concat(groupedFeedbacks["warning" /* Warning */]);
934
- errors = errors.concat(groupedFeedbacks["error" /* Error */]);
938
+ warnings = warnings.concat(groupedFeedbacks["warning" /* Warning */] || []);
939
+ errors = errors.concat(groupedFeedbacks["error" /* Error */] || []);
935
940
  }
936
941
  return { errors, warnings };
937
942
  }
@@ -1384,8 +1389,14 @@ var FormModel = class {
1384
1389
  });
1385
1390
  const feedback = toFeedback(result, path);
1386
1391
  const field = this.getField(path);
1387
- const errors = feedbackToFieldErrorsOrWarnings(path, feedback);
1388
- const warnings = feedbackToFieldErrorsOrWarnings(path, feedback);
1392
+ const errors = feedbackToFieldErrorsOrWarnings(
1393
+ path,
1394
+ feedback?.level === "error" /* Error */ ? feedback : void 0
1395
+ );
1396
+ const warnings = feedbackToFieldErrorsOrWarnings(
1397
+ path,
1398
+ feedback?.level === "warning" /* Warning */ ? feedback : void 0
1399
+ );
1389
1400
  if (field) {
1390
1401
  field.state.errors = errors;
1391
1402
  field.state.warnings = warnings;
@@ -1639,6 +1650,7 @@ function useCurrentFieldState() {
1639
1650
  return useMemo4(() => toFieldState(fieldModelState), [fieldModelState]);
1640
1651
  }
1641
1652
  export {
1653
+ FeedbackLevel,
1642
1654
  Field,
1643
1655
  FieldArray,
1644
1656
  FieldArrayModel,