@wix/form-public 0.209.0 → 0.210.0

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.cjs CHANGED
@@ -27908,6 +27908,7 @@ function useFormView() {
27908
27908
  }
27909
27909
  return context;
27910
27910
  }
27911
+ var FormValuesContext = /* @__PURE__ */ React42.createContext(void 0);
27911
27912
 
27912
27913
  // ../form-fields/dist/esm/ui/form/components/form/create-form-fields.js
27913
27914
  var createFormFields = (_ref) => {
@@ -27937,16 +27938,18 @@ var createFormFields = (_ref) => {
27937
27938
  }
27938
27939
  }, /* @__PURE__ */ React42__namespace.default.createElement(FormViewContext.Provider, {
27939
27940
  value: form
27941
+ }, /* @__PURE__ */ React42__namespace.default.createElement(FormValuesContext.Provider, {
27942
+ value: values
27940
27943
  }, /* @__PURE__ */ React42__namespace.default.createElement(FormField, {
27941
27944
  key: formField.id,
27942
27945
  field: formField,
27943
27946
  values,
27944
27947
  errors,
27945
- onFieldChange,
27946
27948
  onBlur,
27947
27949
  onFocus,
27950
+ onFieldChange,
27948
27951
  FieldLayout
27949
- }))))));
27952
+ })))))));
27950
27953
  return {
27951
27954
  id: formField.id,
27952
27955
  fieldType: formField.fieldType,
@@ -31341,8 +31344,7 @@ var getFieldErrors = async (fieldsToValidate, form, addressTemplates, externalDa
31341
31344
  return fieldErrors;
31342
31345
  };
31343
31346
  var findErrorByNormalizedPath = (fieldsToValidate, errorPath) => {
31344
- const path = errorPath.split("/").length > 2 ? errorPath.split("/").at(0) : errorPath;
31345
- return !!fieldsToValidate.find((field) => path === field.path);
31347
+ return !!fieldsToValidate.find((field) => errorPath === field.path || errorPath.startsWith(`${field.path}/`));
31346
31348
  };
31347
31349
  function setValue(object, path, value) {
31348
31350
  const delimiter = "/";
@@ -32833,7 +32835,7 @@ var NORMALIZED_VALUE = {
32833
32835
  [FIELD_TYPES.MLA_STREET_NAME]: acceptStringValue,
32834
32836
  [FIELD_TYPES.MLA_STREET_NUMBER]: acceptStringValue,
32835
32837
  [FIELD_TYPES.MLA_APARTMENT]: acceptStringValue,
32836
- [FIELD_TYPES.FULL_NAME]: acceptObjectValue,
32838
+ [FIELD_TYPES.FULL_NAME]: acceptFullNameValue,
32837
32839
  [FIELD_TYPES.FULL_NAME_FIRST_NAME]: acceptStringValue,
32838
32840
  [FIELD_TYPES.FULL_NAME_LAST_NAME]: acceptStringValue,
32839
32841
  [FIELD_TYPES.VAT_ID]: normalizeVatIDValue,
@@ -33029,6 +33031,10 @@ function acceptObjectValue({ fieldValue }) {
33029
33031
  }
33030
33032
  return typeof fieldValue === "object" ? fieldValue : EMPTY_VALUE;
33031
33033
  }
33034
+ function acceptFullNameValue(args) {
33035
+ const result2 = acceptObjectValue(args);
33036
+ return result2 === EMPTY_VALUE ? {} : result2;
33037
+ }
33032
33038
  function acceptRatingValue({ fieldValue }) {
33033
33039
  const isEmptyValue = fieldValue === 0 || fieldValue === EMPTY_VALUE;
33034
33040
  if (isEmptyValue) {