@wix/form-public 0.208.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.js CHANGED
@@ -25871,7 +25871,8 @@ var FileFormatMap = {
25871
25871
  Image: "image/*",
25872
25872
  Audio: "audio/*",
25873
25873
  Document: ".ai, .cdr, .csv, .doc, .docb, .docx, .dot, .dotx, .dwg, .eps, .epub, .fla, .gpx, .ical, .icalendar, .ics, .ifb, .indd, .ipynb, .key, .kml, .kmz, .mobi, .mtf, .mtx, .numbers, .odg, .odp, .ods, .odt, .otp, .ots, .ott, .oxps, .pages, .pdf, .pdn, .pkg, .pot, .potx, .pps, .ppsx, .ppt, .pptx, .psd, .pub, .rtf, .sldx, .txt, .json, .vcf, .xcf, .xls, .xlsx, .xlt, .xltx, .xlw, .xps,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel",
25874
- Archive: ".zip, .rar, .tar, .tar.gz, .gz, .gzip, .jar, .7z, .fgz, .webarchive"
25874
+ Archive: ".zip, .rar, .tar, .tar.gz, .gz, .gzip, .jar, .7z, .fgz, .webarchive",
25875
+ Model3D: ".gltf, .glb"
25875
25876
  };
25876
25877
 
25877
25878
  // ../form-fields/dist/esm/utils/date-format-parts.js
@@ -27881,6 +27882,7 @@ function useFormView() {
27881
27882
  }
27882
27883
  return context;
27883
27884
  }
27885
+ var FormValuesContext = /* @__PURE__ */ createContext(void 0);
27884
27886
 
27885
27887
  // ../form-fields/dist/esm/ui/form/components/form/create-form-fields.js
27886
27888
  var createFormFields = (_ref) => {
@@ -27910,16 +27912,18 @@ var createFormFields = (_ref) => {
27910
27912
  }
27911
27913
  }, /* @__PURE__ */ React42__default.createElement(FormViewContext.Provider, {
27912
27914
  value: form
27915
+ }, /* @__PURE__ */ React42__default.createElement(FormValuesContext.Provider, {
27916
+ value: values
27913
27917
  }, /* @__PURE__ */ React42__default.createElement(FormField, {
27914
27918
  key: formField.id,
27915
27919
  field: formField,
27916
27920
  values,
27917
27921
  errors,
27918
- onFieldChange,
27919
27922
  onBlur,
27920
27923
  onFocus,
27924
+ onFieldChange,
27921
27925
  FieldLayout
27922
- }))))));
27926
+ })))))));
27923
27927
  return {
27924
27928
  id: formField.id,
27925
27929
  fieldType: formField.fieldType,
@@ -29187,6 +29191,7 @@ var UploadFileFormat3;
29187
29191
  UploadFileFormat4["AUDIO"] = "AUDIO";
29188
29192
  UploadFileFormat4["DOCUMENT"] = "DOCUMENT";
29189
29193
  UploadFileFormat4["ARCHIVE"] = "ARCHIVE";
29194
+ UploadFileFormat4["MODEL_3D"] = "MODEL_3D";
29190
29195
  })(UploadFileFormat3 || (UploadFileFormat3 = {}));
29191
29196
  var PaymentComponentType;
29192
29197
  (function(PaymentComponentType2) {
@@ -29513,6 +29518,8 @@ function takeWixFileInputViewProperties(fileUpload, validation) {
29513
29518
  return "Document";
29514
29519
  case UploadFileFormat3.ARCHIVE:
29515
29520
  return "Archive";
29521
+ case UploadFileFormat3.MODEL_3D:
29522
+ return "Model3D";
29516
29523
  default:
29517
29524
  throw new Error(`Unknown file format: ${format}`);
29518
29525
  }
@@ -31311,8 +31318,7 @@ var getFieldErrors = async (fieldsToValidate, form, addressTemplates, externalDa
31311
31318
  return fieldErrors;
31312
31319
  };
31313
31320
  var findErrorByNormalizedPath = (fieldsToValidate, errorPath) => {
31314
- const path = errorPath.split("/").length > 2 ? errorPath.split("/").at(0) : errorPath;
31315
- return !!fieldsToValidate.find((field) => path === field.path);
31321
+ return !!fieldsToValidate.find((field) => errorPath === field.path || errorPath.startsWith(`${field.path}/`));
31316
31322
  };
31317
31323
  function setValue(object, path, value) {
31318
31324
  const delimiter = "/";
@@ -32803,7 +32809,7 @@ var NORMALIZED_VALUE = {
32803
32809
  [FIELD_TYPES.MLA_STREET_NAME]: acceptStringValue,
32804
32810
  [FIELD_TYPES.MLA_STREET_NUMBER]: acceptStringValue,
32805
32811
  [FIELD_TYPES.MLA_APARTMENT]: acceptStringValue,
32806
- [FIELD_TYPES.FULL_NAME]: acceptObjectValue,
32812
+ [FIELD_TYPES.FULL_NAME]: acceptFullNameValue,
32807
32813
  [FIELD_TYPES.FULL_NAME_FIRST_NAME]: acceptStringValue,
32808
32814
  [FIELD_TYPES.FULL_NAME_LAST_NAME]: acceptStringValue,
32809
32815
  [FIELD_TYPES.VAT_ID]: normalizeVatIDValue,
@@ -32999,6 +33005,10 @@ function acceptObjectValue({ fieldValue }) {
32999
33005
  }
33000
33006
  return typeof fieldValue === "object" ? fieldValue : EMPTY_VALUE;
33001
33007
  }
33008
+ function acceptFullNameValue(args) {
33009
+ const result2 = acceptObjectValue(args);
33010
+ return result2 === EMPTY_VALUE ? {} : result2;
33011
+ }
33002
33012
  function acceptRatingValue({ fieldValue }) {
33003
33013
  const isEmptyValue = fieldValue === 0 || fieldValue === EMPTY_VALUE;
33004
33014
  if (isEmptyValue) {