@bigbinary/neeto-form-frontend 1.2.52 → 1.2.54

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.
@@ -38,7 +38,9 @@
38
38
  "addAdditionalGuests": "Add additional guests",
39
39
  "unanswered": "Unanswered",
40
40
  "hobbies": "Hobbies",
41
- "country": "Country"
41
+ "country": "Country",
42
+ "addGuests": "Add guests",
43
+ "addGuestsHelper": "Enter emails separated by comma."
42
44
  },
43
45
  "fields": {
44
46
  "mcf": "Multiple choice",
package/dist/index.cjs.js CHANGED
@@ -806,6 +806,7 @@ var QUESTIONS_INITIAL_VALUE = {
806
806
  title: ""
807
807
  };
808
808
  var RESERVED_FIELD_CODES = ["month", "date", "time"];
809
+ var SELECTABLE_KINDS = ["radio", "checkbox", "dropdown"];
809
810
 
810
811
  function _arrayWithHoles$3(arr) {
811
812
  if (Array.isArray(arr)) return arr;
@@ -12006,13 +12007,23 @@ var formValidationSchema = yup.object().shape({
12006
12007
  }
12007
12008
  }),
12008
12009
  kind: yup.string().required(),
12009
- fieldCode: yup.string().trim().notOneOf(RESERVED_FIELD_CODES, i18next__default["default"].t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
12010
- return QUESTIONS_WITHOUT_FIELD_CODE.includes(kind) ? schema.notRequired() : requiredLabelValidation(schema, i18next__default["default"].t("neetoForm.questions.common.questionFields.field.fieldCode"));
12010
+ fieldCode: yup.string().when("_destroy", {
12011
+ is: true,
12012
+ otherwise: function otherwise(schema) {
12013
+ return schema.trim().notOneOf(RESERVED_FIELD_CODES, i18next__default["default"].t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
12014
+ return QUESTIONS_WITHOUT_FIELD_CODE.includes(kind) ? schema.notRequired() : requiredLabelValidation(schema, i18next__default["default"].t("neetoForm.questions.common.questionFields.field.fieldCode"));
12015
+ });
12016
+ }
12011
12017
  }),
12012
- optionsAttributes: yup.array().when("kind", function (kind, schema) {
12013
- return ["radio", "checkbox", "dropdown"].includes(kind) ? schema.of(yup.object().shape({
12014
- label: requiredLabelValidation(yup.string(), i18next__default["default"].t("neetoForm.questions.common.questionFields.field.option"))
12015
- })) : schema.notRequired();
12018
+ optionsAttributes: yup.array().when("_destroy", {
12019
+ is: true,
12020
+ otherwise: function otherwise(schema) {
12021
+ return schema.when("kind", function (kind, schema) {
12022
+ return SELECTABLE_KINDS.includes(kind) ? schema.of(yup.object().shape({
12023
+ label: requiredLabelValidation(yup.string(), i18next__default["default"].t("neetoForm.questions.common.questionFields.field.option"))
12024
+ })) : schema.notRequired();
12025
+ });
12026
+ }
12016
12027
  }),
12017
12028
  highestRatingLabel: yup.string().nullable(),
12018
12029
  averageRatingLabel: yup.string().nullable(),
@@ -15991,6 +16002,7 @@ var validateFieldValue = function validateFieldValue(_ref12) {
15991
16002
  };
15992
16003
 
15993
16004
  var MultipleEmailInput = function MultipleEmailInput(_ref) {
16005
+ var _React$createElement;
15994
16006
  var question = _ref.question,
15995
16007
  customValidator = _ref.customValidator;
15996
16008
  var name = question.id,
@@ -15998,6 +16010,8 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
15998
16010
  isRequired = question.isRequired,
15999
16011
  nodeId = question.nodeId;
16000
16012
  var label = fieldWithFallback(question, "label");
16013
+ var _useTranslation = reactI18next.useTranslation(),
16014
+ t = _useTranslation.t;
16001
16015
  var _useField = formik.useField({
16002
16016
  name: name || nodeId,
16003
16017
  validate: validateFieldValue({
@@ -16025,6 +16039,7 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
16025
16039
  isRequired: isRequired,
16026
16040
  label: label,
16027
16041
  error: meta.touched ? meta.error : "",
16042
+ helpText: t("neetoForm.common.addGuestsHelper"),
16028
16043
  name: field.name,
16029
16044
  placeholder: fieldWithFallback(question, "placeholder"),
16030
16045
  value: field.value,
@@ -16032,13 +16047,11 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
16032
16047
  return setTouched(true);
16033
16048
  },
16034
16049
  onChange: setValue
16035
- }) : /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
16036
- label: label,
16037
- style: "secondary",
16038
- onClick: function onClick() {
16039
- return setIsInputVisible(true);
16040
- }
16041
- })));
16050
+ }) : /*#__PURE__*/React__default["default"].createElement(neetoui.Button, (_React$createElement = {
16051
+ label: label
16052
+ }, _defineProperty$6(_React$createElement, "label", t("neetoForm.common.addGuests")), _defineProperty$6(_React$createElement, "style", "secondary"), _defineProperty$6(_React$createElement, "onClick", function onClick() {
16053
+ return setIsInputVisible(true);
16054
+ }), _React$createElement))));
16042
16055
  };
16043
16056
 
16044
16057
  function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }