@wix/form-public 0.478.0 → 0.480.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
@@ -51034,6 +51034,14 @@ var CHALLENGES_FIELD_TYPE_SET = new Set(CHALLENGES_FIELD_TYPES2);
51034
51034
  function isChallengesFieldType(identifier) {
51035
51035
  return identifier != null && CHALLENGES_FIELD_TYPE_SET.has(identifier);
51036
51036
  }
51037
+ var CHALLENGES_IMAGE_CHOICE_FIELD_TYPE = "QUIZ_IMAGE_CHOICE";
51038
+ function isChallengesImageChoice(identifier) {
51039
+ return identifier === CHALLENGES_IMAGE_CHOICE_FIELD_TYPE;
51040
+ }
51041
+ var SINGLE_ANSWER_MAX_ITEMS = 1;
51042
+ function isMultipleAnswersOfMaxItems(maxItems) {
51043
+ return maxItems !== SINGLE_ANSWER_MAX_ITEMS;
51044
+ }
51037
51045
 
51038
51046
  // ../form-transformer/dist/esm/lib/to-v1/make-validation-of-input-field.js
51039
51047
  function makeValidationOfInputField(inputOptions) {
@@ -51318,6 +51326,7 @@ function takeWixFileInputViewProperties(fileUpload, validation) {
51318
51326
  throw new Error(`Unknown file format: ${format}`);
51319
51327
  }
51320
51328
  });
51329
+ const labelMedia = toV1QuestionImageProperties(fileUpload.media, fileUpload.mediaSettings);
51321
51330
  return {
51322
51331
  [HideLabelKey]: !fileUpload.showLabel,
51323
51332
  [UploadFileFormatsKey]: fileFormats,
@@ -51333,7 +51342,8 @@ function takeWixFileInputViewProperties(fileUpload, validation) {
51333
51342
  },
51334
51343
  ...fileUpload.explanationText && {
51335
51344
  [ExplanationTextKey]: fileUpload.explanationText
51336
- }
51345
+ },
51346
+ ...labelMedia
51337
51347
  };
51338
51348
  }
51339
51349
  function takeSignatureInputViewProperties(signature) {
@@ -52017,7 +52027,7 @@ function resolveRootProperties(field) {
52017
52027
  fieldType: field.identifier,
52018
52028
  ...makeInputView(field.identifier, field.inputOptions)
52019
52029
  },
52020
- validation: makeValidationOfInputField(field.inputOptions)
52030
+ validation: makeInputValidation(field.identifier, field.inputOptions)
52021
52031
  };
52022
52032
  }
52023
52033
  if (field.displayOptions) {
@@ -52032,11 +52042,28 @@ function resolveRootProperties(field) {
52032
52042
  }
52033
52043
  function makeInputView(identifier, inputOptions) {
52034
52044
  const view = makeViewOfInputField(inputOptions);
52035
- if (isChallengesFieldType(identifier)) {
52036
- const { score, correctAnswers, ...viewWithoutQuizData } = view;
52045
+ if (!isChallengesFieldType(identifier)) {
52046
+ return view;
52047
+ }
52048
+ const { score, correctAnswers, ...viewWithoutQuizData } = view;
52049
+ if (!isChallengesImageChoice(identifier)) {
52037
52050
  return viewWithoutQuizData;
52038
52051
  }
52039
- return view;
52052
+ return {
52053
+ ...viewWithoutQuizData,
52054
+ isMultipleAnswers: isMultipleAnswersOfMaxItems(inputOptions.arrayOptions?.validation?.maxItems)
52055
+ };
52056
+ }
52057
+ function makeInputValidation(identifier, inputOptions) {
52058
+ const validation = makeValidationOfInputField(inputOptions);
52059
+ if (!isChallengesImageChoice(identifier) || !validation.array) {
52060
+ return validation;
52061
+ }
52062
+ const { maxItems: _maxItems, ...array } = validation.array;
52063
+ return {
52064
+ ...validation,
52065
+ array
52066
+ };
52040
52067
  }
52041
52068
 
52042
52069
  // ../form-fields/dist/esm/services/form-view.js