@bigbinary/neeto-form-frontend 4.4.56-beta1 → 4.4.57-beta1

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.
Files changed (94) hide show
  1. package/app/javascript/src/translations/en.json +13 -3
  2. package/dist/.ready +1 -1
  3. package/dist/BuildForm.js +182 -95
  4. package/dist/BuildForm.js.map +1 -1
  5. package/dist/ExternalForm.js +7 -5
  6. package/dist/ExternalForm.js.map +1 -1
  7. package/dist/Submission.js +2 -2
  8. package/dist/UrlBuilder.js +7 -5
  9. package/dist/UrlBuilder.js.map +1 -1
  10. package/dist/{buildForm-BqKMWFdE.js → buildForm-BB_dcXDi.js} +2 -2
  11. package/dist/{buildForm-BqKMWFdE.js.map → buildForm-BB_dcXDi.js.map} +1 -1
  12. package/dist/cjs/BuildForm.js +181 -94
  13. package/dist/cjs/BuildForm.js.map +1 -1
  14. package/dist/cjs/ExternalForm.js +7 -5
  15. package/dist/cjs/ExternalForm.js.map +1 -1
  16. package/dist/cjs/Submission.js +2 -2
  17. package/dist/cjs/UrlBuilder.js +7 -5
  18. package/dist/cjs/UrlBuilder.js.map +1 -1
  19. package/dist/cjs/{buildForm-DiDVkK8P.js → buildForm-CioN98io.js} +2 -2
  20. package/dist/cjs/{buildForm-DiDVkK8P.js.map → buildForm-CioN98io.js.map} +1 -1
  21. package/dist/cjs/{constants-kGV0icLG.js → constants-B53NE3ql.js} +3 -1
  22. package/dist/cjs/constants-B53NE3ql.js.map +1 -0
  23. package/dist/cjs/{date-BUwzbZsS.js → date-MW59oHM9.js} +2 -2
  24. package/dist/cjs/{date-BUwzbZsS.js.map → date-MW59oHM9.js.map} +1 -1
  25. package/dist/cjs/hooks.js +4 -4
  26. package/dist/cjs/{index-RnO4qcoz.js → index-GEt7Ofup.js} +2 -2
  27. package/dist/cjs/{index-RnO4qcoz.js.map → index-GEt7Ofup.js.map} +1 -1
  28. package/dist/cjs/index.js +12 -9
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/{useFormSubmission-DWTuEPab.js → useFormSubmission-BPdtoVVy.js} +2 -2
  31. package/dist/cjs/{useFormSubmission-DWTuEPab.js.map → useFormSubmission-BPdtoVVy.js.map} +1 -1
  32. package/dist/cjs/{utils-DkzQcu6R.js → utils-zVNwUbdx.js} +43 -6
  33. package/dist/cjs/utils-zVNwUbdx.js.map +1 -0
  34. package/dist/cjs/v2/BuildForm.js +175 -90
  35. package/dist/cjs/v2/BuildForm.js.map +1 -1
  36. package/dist/cjs/v2/ExternalForm.js +3 -3
  37. package/dist/cjs/v2/Submission.js +1 -1
  38. package/dist/cjs/v2/UrlBuilder.js +3 -3
  39. package/dist/cjs/v2/{constants-C4Oe48TD.js → constants-CpQQ4jip.js} +3 -1
  40. package/dist/cjs/v2/constants-CpQQ4jip.js.map +1 -0
  41. package/dist/cjs/v2/index.js +4 -3
  42. package/dist/cjs/v2/index.js.map +1 -1
  43. package/dist/cjs/v2/{utils-DF4T4m5g.js → utils-CjowRPXH.js} +41 -4
  44. package/dist/cjs/v2/utils-CjowRPXH.js.map +1 -0
  45. package/dist/cjs/v2/{yup-BYZxGYQT.js → yup-DSCAoUTF.js} +58 -6
  46. package/dist/cjs/v2/yup-DSCAoUTF.js.map +1 -0
  47. package/dist/cjs/{yup-Cy_8XyN-.js → yup-BPzvBMfE.js} +61 -7
  48. package/dist/cjs/yup-BPzvBMfE.js.map +1 -0
  49. package/dist/{constants-BRmVk1mZ.js → constants-CA-b_gMT.js} +3 -1
  50. package/dist/constants-CA-b_gMT.js.map +1 -0
  51. package/dist/{date-HX6MOG5J.js → date-D1QLSrIi.js} +2 -2
  52. package/dist/{date-HX6MOG5J.js.map → date-D1QLSrIi.js.map} +1 -1
  53. package/dist/hooks.js +4 -4
  54. package/dist/{index-NfnqZDHF.js → index-COGLnVTU.js} +2 -2
  55. package/dist/{index-NfnqZDHF.js.map → index-COGLnVTU.js.map} +1 -1
  56. package/dist/index.js +12 -9
  57. package/dist/index.js.map +1 -1
  58. package/dist/main.css +1 -1
  59. package/dist/main.css.map +1 -1
  60. package/dist/{useFormSubmission-CgvPp7VH.js → useFormSubmission-xjwrmkmE.js} +2 -2
  61. package/dist/{useFormSubmission-CgvPp7VH.js.map → useFormSubmission-xjwrmkmE.js.map} +1 -1
  62. package/dist/{utils-CZKXpXMw.js → utils-CMGhbRpZ.js} +43 -6
  63. package/dist/utils-CMGhbRpZ.js.map +1 -0
  64. package/dist/v2/BuildForm.js +177 -92
  65. package/dist/v2/BuildForm.js.map +1 -1
  66. package/dist/v2/ExternalForm.js +3 -3
  67. package/dist/v2/Submission.js +1 -1
  68. package/dist/v2/UrlBuilder.js +3 -3
  69. package/dist/v2/{constants-TtWNOnaI.js → constants-BI0YYyVc.js} +3 -1
  70. package/dist/v2/constants-BI0YYyVc.js.map +1 -0
  71. package/dist/v2/index.js +4 -3
  72. package/dist/v2/index.js.map +1 -1
  73. package/dist/v2/main.css +1 -1
  74. package/dist/v2/main.css.map +1 -1
  75. package/dist/v2/{utils-DlcYlVi6.js → utils-UvAB6bbG.js} +41 -4
  76. package/dist/v2/utils-UvAB6bbG.js.map +1 -0
  77. package/dist/v2/{yup-eAZgNU6P.js → yup-BaiHo-7Z.js} +58 -9
  78. package/dist/v2/yup-BaiHo-7Z.js.map +1 -0
  79. package/dist/{yup-Cl8wC8xx.js → yup-CzoKyYgO.js} +60 -9
  80. package/dist/yup-CzoKyYgO.js.map +1 -0
  81. package/package.json +3 -1
  82. package/types.d.ts +1 -0
  83. package/dist/cjs/constants-kGV0icLG.js.map +0 -1
  84. package/dist/cjs/utils-DkzQcu6R.js.map +0 -1
  85. package/dist/cjs/v2/constants-C4Oe48TD.js.map +0 -1
  86. package/dist/cjs/v2/utils-DF4T4m5g.js.map +0 -1
  87. package/dist/cjs/v2/yup-BYZxGYQT.js.map +0 -1
  88. package/dist/cjs/yup-Cy_8XyN-.js.map +0 -1
  89. package/dist/constants-BRmVk1mZ.js.map +0 -1
  90. package/dist/utils-CZKXpXMw.js.map +0 -1
  91. package/dist/v2/constants-TtWNOnaI.js.map +0 -1
  92. package/dist/v2/utils-DlcYlVi6.js.map +0 -1
  93. package/dist/v2/yup-eAZgNU6P.js.map +0 -1
  94. package/dist/yup-Cl8wC8xx.js.map +0 -1
@@ -60,7 +60,8 @@
60
60
  "domains": "Domains",
61
61
  "viewHelpArticle": "View help article",
62
62
  "splitAsFirstAndLastNames": "Split into \"First name\" and \"Last name\"",
63
- "field": "Field"
63
+ "field": "Field",
64
+ "headingImageAltText": "{{title}} heading image"
64
65
  },
65
66
  "fields": {
66
67
  "mcf": "Multiple choice",
@@ -87,7 +88,9 @@
87
88
  "spot": "Number of group booking spots",
88
89
  "opinionScale": "Opinion scale",
89
90
  "address": "Address",
90
- "yesNo": "Yes/No"
91
+ "yesNo": "Yes/No",
92
+ "heading": "Heading",
93
+ "divider": "Divider"
91
94
  },
92
95
  "questionTooltips": {
93
96
  "number": "Accept numeric values, including integers and decimals.",
@@ -186,6 +189,12 @@
186
189
  "yesNo": {
187
190
  "showIcons": "Show icons"
188
191
  },
192
+ "heading": {
193
+ "title": "Title",
194
+ "description": "Description",
195
+ "image": "Image",
196
+ "imageWidth": "Image width (%)"
197
+ },
189
198
  "address": {
190
199
  "fields": "Address fields",
191
200
  "field": "Address field",
@@ -244,7 +253,8 @@
244
253
  "mustBeOrLessThanOrEqualTo": "Must be less than or equal to {{value}}",
245
254
  "emailNotVerified": "Email verification is required",
246
255
  "removeDuplicates": "Please remove duplicate entries",
247
- "allFieldsRequired": "All fields are required"
256
+ "allFieldsRequired": "All fields are required",
257
+ "headingCantBeEmpty": "Add a title, description or image to the heading"
248
258
  },
249
259
  "fileTypes": {
250
260
  "documents": "Documents",
package/dist/.ready CHANGED
@@ -1 +1 @@
1
- Built at 2026-10-05T11:30:16.930Z
1
+ Built at 2026-10-05T17:05:19.359Z
package/dist/BuildForm.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { useQueryClient } from '@tanstack/react-query';
2
2
  import classnames from 'classnames';
3
- import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, findById, findIndexById, hyphenate, noop, nullSafe, modifyBy, removeBy } from '@bigbinary/neeto-cist';
3
+ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, noop, findById, findIndexById, hyphenate, nullSafe, modifyBy, removeBy } from '@bigbinary/neeto-cist';
4
4
  import Spinner from '@bigbinary/neetoui/Spinner';
5
5
  import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, values, uniq, join, pathSatisfies, assocPath, dissoc, pluck, append, test, paths, difference, prop, startsWith, split, last, union, either, F, T } from 'ramda';
6
- import { m as useDeleteQuestion, Q as QUESTION_TYPES, b as useForm, n as useCreateQuestion, o as useUpdateQuestion, C as CAPTCHA_TYPES, D as DATE_INPUT_MODES, p as useReorderQuestions, i as QUERY_KEYS } from './constants-BRmVk1mZ.js';
7
- import { m as QUESTION_ACTIONS, n as INDEPENDENT_LABELS_MAP, o as buildDisplayLabel, p as isElementOverflowing, q as SELECTABLE_KINDS, r as isAutoGeneratedQuestion, s as isRichTextQuestion, t as SPOT_QUESTION_FIELD_CODE, N as NON_BASIC_LATIN_CHARACTERS_REGEX, u as RESERVED_FIELD_CODES, v as renameKey, f as LABEL_FIELDS, w as isDefaultLanguage, x as buildAddQuestionButtonProps, y as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, M as MIN_WORDS_SWITCH_LABEL_PROPS, z as MIN_WORDS, B as isImmutableField, a as QUESTIONS_WITHOUT_FIELD_CODE, G as NON_HIDEABLE_FIELDS, H as NON_READ_ONLY_FIELDS, O as OPINION_LABEL_MAX_LENGTH, J as RICH_TEXT_QUESTIONS, e as ADDRESS_FIELD_WIDTHS, A as ADDRESS_FIELD_TYPES, K as generateDefaultOptions, T as MINIMUM_ADDRESS_FIELDS, U as getDeletedRecords, V as randomId, W as getActiveRecords, X as FILE_TYPES_MAP, Z as FILE_GROUPS, _ as OPINION_SCALE_MIN_VALUE_OPTIONS, $ as OPINION_SCALE_MAX_VALUE_OPTIONS, h as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, a0 as MINIMUM_OPTIONS, a1 as IMAGE_HEIGHT_SLIDER_DEFAULTS, a2 as RATING_OPTIONS, a3 as STAR_RATING_MIN_VALUE_OPTIONS, a4 as STAR_RATING_MAX_VALUE_OPTIONS, a5 as STAR_RATING_ICONS_MAP, a6 as YES_NO_ICONS_MAP, a7 as buildDisabledAddButtonHelpPopoverProps, a8 as buildReorderPayload, a9 as QUESTIONS_INITIAL_VALUE, aa as isMandatoryField, ab as QUESTION_KINDS, Q as QUESTION_KIND, ac as getActiveQuestionKindDetails, ad as DEFAULT_AVAILABLE_LANGUAGES, ae as DEFAULT_ADVANCED_FEATURES } from './yup-Cl8wC8xx.js';
6
+ import { m as useDeleteQuestion, Q as QUESTION_TYPES, b as useForm, n as useCreateQuestion, o as useUpdateQuestion, C as CAPTCHA_TYPES, D as DATE_INPUT_MODES, p as useReorderQuestions, i as QUERY_KEYS } from './constants-CA-b_gMT.js';
7
+ import { m as QUESTION_ACTIONS, n as INDEPENDENT_LABELS_MAP, o as buildDisplayLabel, p as isElementOverflowing, q as SELECTABLE_KINDS, r as isAutoGeneratedQuestion, s as isRichTextQuestion, t as isLayoutQuestion, u as SPOT_QUESTION_FIELD_CODE, N as NON_BASIC_LATIN_CHARACTERS_REGEX, v as RESERVED_FIELD_CODES, w as renameKey, f as LABEL_FIELDS, x as isDefaultLanguage, y as buildAddQuestionButtonProps, z as validateEditorContent, H as HEADING_IMAGE_UPLOAD_CONFIG, B as HEADING_IMAGE_WIDTH, F as FIELD_CODES_REJECT_CHARS_REGEX, M as MIN_WORDS_SWITCH_LABEL_PROPS, G as MIN_WORDS, J as isImmutableField, a as QUESTIONS_WITHOUT_FIELD_CODE, K as NON_HIDEABLE_FIELDS, O as NON_READ_ONLY_FIELDS, T as OPINION_LABEL_MAX_LENGTH, U as RICH_TEXT_QUESTIONS, e as ADDRESS_FIELD_WIDTHS, A as ADDRESS_FIELD_TYPES, V as generateDefaultOptions, W as MINIMUM_ADDRESS_FIELDS, X as getDeletedRecords, Z as randomId, _ as getActiveRecords, $ as FILE_TYPES_MAP, a0 as FILE_GROUPS, a1 as OPINION_SCALE_MIN_VALUE_OPTIONS, a2 as OPINION_SCALE_MAX_VALUE_OPTIONS, h as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, a3 as MINIMUM_OPTIONS, a4 as IMAGE_HEIGHT_SLIDER_DEFAULTS, a5 as RATING_OPTIONS, a6 as STAR_RATING_MIN_VALUE_OPTIONS, a7 as STAR_RATING_MAX_VALUE_OPTIONS, a8 as STAR_RATING_ICONS_MAP, a9 as YES_NO_ICONS_MAP, aa as buildDisabledAddButtonHelpPopoverProps, ab as buildReorderPayload, ac as QUESTIONS_INITIAL_VALUE, ad as isMandatoryField, ae as QUESTION_KINDS, Q as QUESTION_KIND, af as getActiveQuestionKindDetails, ag as DEFAULT_AVAILABLE_LANGUAGES, ah as DEFAULT_ADVANCED_FEATURES } from './yup-CzoKyYgO.js';
8
8
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
9
9
  import { useState, useRef, useEffect, createElement } from 'react';
10
10
  import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
11
11
  import { withT, isMetaKeyPressed, useStateWithDependency, useFuncDebounce, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
12
12
  import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
13
- import { a as useBuildFormStore } from './buildForm-BqKMWFdE.js';
13
+ import { a as useBuildFormStore } from './buildForm-BB_dcXDi.js';
14
14
  import { shallow } from 'zustand/shallow';
15
15
  import Alert from '@bigbinary/neetoui/Alert';
16
16
  import { useTranslation, Trans } from 'react-i18next';
@@ -23,7 +23,7 @@ import Tooltip from '@bigbinary/neetoui/Tooltip';
23
23
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
24
24
  import Equals from '@bigbinary/neeto-icons/Equals';
25
25
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
26
- import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-NfnqZDHF.js';
26
+ import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-COGLnVTU.js';
27
27
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
28
28
  import { t } from 'i18next';
29
29
  import { v4 } from 'uuid';
@@ -37,6 +37,9 @@ import Accordion from '@bigbinary/neetoui/Accordion';
37
37
  import Select from '@bigbinary/neetoui/formik/Select';
38
38
  import Switch from '@bigbinary/neetoui/formik/Switch';
39
39
  import Textarea$1 from '@bigbinary/neetoui/formik/Textarea';
40
+ import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
41
+ import Label from '@bigbinary/neetoui/Label';
42
+ import Slider from '@bigbinary/neetoui/Slider';
40
43
  import NeetoEditor from '@bigbinary/neeto-editor/Editor';
41
44
  import Input from '@bigbinary/neetoui/formik/Input';
42
45
  import Switch$1 from '@bigbinary/neetoui/Switch';
@@ -45,7 +48,6 @@ import * as yup from 'yup';
45
48
  import OptionFields from '@bigbinary/neeto-molecules/OptionFields';
46
49
  import { AnimatePresence, motion } from 'framer-motion';
47
50
  import Radio from '@bigbinary/neetoui/formik/Radio';
48
- import Label from '@bigbinary/neetoui/Label';
49
51
  import CreatableSelect from 'react-select/creatable';
50
52
  import _toArray from '@babel/runtime/helpers/toArray';
51
53
  import Close from '@bigbinary/neeto-icons/Close';
@@ -55,7 +57,6 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
55
57
  import _regeneratorRuntime from '@babel/runtime/regenerator';
56
58
  import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
57
59
  import Checkbox from '@bigbinary/neetoui/Checkbox';
58
- import Slider from '@bigbinary/neetoui/Slider';
59
60
  import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
60
61
  import '@bigbinary/neeto-commons-frontend/constants';
61
62
  import 'axios';
@@ -63,6 +64,7 @@ import '@bigbinary/neeto-icons/Address';
63
64
  import '@bigbinary/neeto-icons/Calendar';
64
65
  import '@bigbinary/neeto-icons/Captcha';
65
66
  import '@bigbinary/neeto-icons/Checkbox';
67
+ import '@bigbinary/neeto-icons/Divider';
66
68
  import '@bigbinary/neeto-icons/DropdownClosed';
67
69
  import '@bigbinary/neeto-icons/Email';
68
70
  import '@bigbinary/neeto-icons/FileUpload';
@@ -79,6 +81,7 @@ import '@bigbinary/neeto-icons/Rating';
79
81
  import '@bigbinary/neeto-icons/Scale';
80
82
  import '@bigbinary/neeto-icons/Sms';
81
83
  import '@bigbinary/neeto-icons/Terms';
84
+ import '@bigbinary/neeto-icons/TextH1';
82
85
  import '@bigbinary/neeto-icons/TextLines';
83
86
  import '@bigbinary/neeto-icons/UserRoundedRect';
84
87
  import '@bigbinary/neeto-icons/YesNo';
@@ -683,7 +686,7 @@ var duplicateFieldData = function duplicateFieldData(_ref6) {
683
686
  var _pick = pick(defaultAttributeNames, item),
684
687
  fields = _pick.fields,
685
688
  defaultAttributes = _objectWithoutProperties(_pick, _excluded$b);
686
- var newQuestionLabel = isRichTextQuestion(kind) ? label : t("neetoForm.common.clonedElementLabel", {
689
+ var newQuestionLabel = isRichTextQuestion(kind) || isLayoutQuestion(kind) ? label : t("neetoForm.common.clonedElementLabel", {
687
690
  label: label
688
691
  });
689
692
  return _objectSpread$i(_objectSpread$i({}, defaultAttributes), {}, {
@@ -890,6 +893,159 @@ var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
890
893
  });
891
894
  };
892
895
 
896
+ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
897
+ var editorRef = _ref.editorRef,
898
+ fieldName = _ref.fieldName,
899
+ value = _ref.value,
900
+ _ref$shouldSyncWithQu = _ref.shouldSyncWithQueryData,
901
+ shouldSyncWithQueryData = _ref$shouldSyncWithQu === void 0 ? true : _ref$shouldSyncWithQu;
902
+ var initialStateRef = useRef({
903
+ language: "",
904
+ value: null
905
+ });
906
+ var _useBuildFormStore = useBuildFormStore(function (store) {
907
+ var _store$formState, _store$formState2;
908
+ return {
909
+ formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
910
+ selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"]
911
+ };
912
+ }, shallow),
913
+ formId = _useBuildFormStore.formId,
914
+ language = _useBuildFormStore.selectedLanguage;
915
+ var setEditorContent = function setEditorContent(content) {
916
+ var _editorRef$current$ed;
917
+ return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 || (_editorRef$current$ed = _editorRef$current$ed.commands) === null || _editorRef$current$ed === void 0 ? void 0 : _editorRef$current$ed.setContent(content);
918
+ };
919
+ var _useForm = useForm({
920
+ formId: formId,
921
+ language: language
922
+ }),
923
+ data = _useForm.data;
924
+ useEffect(function () {
925
+ if (!data || !shouldSyncWithQueryData) return;
926
+ var pathArray = fieldName.split(".").map(function (part) {
927
+ var parsedPart = parseInt(part);
928
+ return isNaN(parsedPart) ? part : parsedPart;
929
+ });
930
+ setEditorContent(path(pathArray, data));
931
+ }, [data]);
932
+ useEffect(function () {
933
+ if (initialStateRef.current["language"] !== language) {
934
+ initialStateRef.current["language"] = language;
935
+ initialStateRef.current["value"] = null;
936
+ return;
937
+ }
938
+ if (initialStateRef.current["value"] === null && value !== null) {
939
+ setEditorContent(value);
940
+ initialStateRef.current["value"] = value;
941
+ }
942
+ }, [language, value]);
943
+ };
944
+
945
+ var Editor = function Editor(_ref) {
946
+ var _ref$fieldName = _ref.fieldName,
947
+ fieldName = _ref$fieldName === void 0 ? "label" : _ref$fieldName,
948
+ _ref$isRequired = _ref.isRequired,
949
+ isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
950
+ _ref$shouldSyncWithQu = _ref.shouldSyncWithQueryData,
951
+ shouldSyncWithQueryData = _ref$shouldSyncWithQu === void 0 ? true : _ref$shouldSyncWithQu;
952
+ var editorRef = useRef({
953
+ editor: {}
954
+ });
955
+ var _useField = useField({
956
+ name: fieldName,
957
+ validate: isRequired ? validateEditorContent(editorRef) : noop
958
+ }),
959
+ _useField2 = _slicedToArray(_useField, 3),
960
+ value = _useField2[0].value,
961
+ _useField2$ = _useField2[1],
962
+ touched = _useField2$.touched,
963
+ error = _useField2$.error,
964
+ _useField2$2 = _useField2[2],
965
+ setTouched = _useField2$2.setTouched,
966
+ setValue = _useField2$2.setValue;
967
+ useUpdateEditorContent({
968
+ editorRef: editorRef,
969
+ fieldName: fieldName,
970
+ value: value,
971
+ shouldSyncWithQueryData: shouldSyncWithQueryData
972
+ });
973
+ return /*#__PURE__*/jsx("div", {
974
+ className: "w-full cursor-auto",
975
+ children: /*#__PURE__*/jsx(NeetoEditor, {
976
+ error: touched ? error : "",
977
+ id: fieldName === "label" ? "editor" : "editor-".concat(fieldName),
978
+ initialValue: value,
979
+ name: fieldName,
980
+ ref: editorRef,
981
+ required: isRequired,
982
+ onBlur: function onBlur() {
983
+ return setTouched(true);
984
+ },
985
+ onChange: setValue
986
+ })
987
+ });
988
+ };
989
+
990
+ var Heading = function Heading(_ref) {
991
+ var handleLabelChange = _ref.handleLabelChange,
992
+ isLabelDisabled = _ref.isLabelDisabled;
993
+ var _useTranslation = useTranslation(),
994
+ t = _useTranslation.t;
995
+ var _useField = useField("image"),
996
+ _useField2 = _slicedToArray(_useField, 3),
997
+ image = _useField2[0].value,
998
+ setImage = _useField2[2].setValue;
999
+ var _useField3 = useField("imageWidth"),
1000
+ _useField4 = _slicedToArray(_useField3, 3),
1001
+ imageWidth = _useField4[0].value,
1002
+ setImageWidth = _useField4[2].setValue;
1003
+ var handleImageUpload = function handleImageUpload(uploadedImage) {
1004
+ return setImage(isPresent(uploadedImage === null || uploadedImage === void 0 ? void 0 : uploadedImage.url) ? uploadedImage : null);
1005
+ };
1006
+ return /*#__PURE__*/jsxs("div", {
1007
+ className: "space-y-4",
1008
+ children: [/*#__PURE__*/jsx(FormikAdaptiveInput, {
1009
+ "data-testid": "neeto-form-engine-heading-title",
1010
+ disabled: isLabelDisabled,
1011
+ label: t("neetoForm.questions.heading.title"),
1012
+ name: "label",
1013
+ onChange: withEventTargetValue(handleLabelChange)
1014
+ }), /*#__PURE__*/jsxs("div", {
1015
+ className: "space-y-2",
1016
+ children: [/*#__PURE__*/jsx(Label, {
1017
+ children: t("neetoForm.questions.heading.description")
1018
+ }), /*#__PURE__*/jsx(Editor, {
1019
+ fieldName: "description",
1020
+ isRequired: false,
1021
+ shouldSyncWithQueryData: false
1022
+ })]
1023
+ }), /*#__PURE__*/jsxs("div", {
1024
+ className: "space-y-2",
1025
+ "data-testid": "neeto-form-engine-heading-image",
1026
+ children: [/*#__PURE__*/jsx(Label, {
1027
+ children: t("neetoForm.questions.heading.image")
1028
+ }), /*#__PURE__*/jsx(ImageUploader, {
1029
+ src: image === null || image === void 0 ? void 0 : image.url,
1030
+ uploadConfig: HEADING_IMAGE_UPLOAD_CONFIG,
1031
+ onUploadComplete: handleImageUpload
1032
+ }, image === null || image === void 0 ? void 0 : image.url), (image === null || image === void 0 ? void 0 : image.url) && /*#__PURE__*/jsxs("div", {
1033
+ className: "mt-4",
1034
+ children: [/*#__PURE__*/jsx(Typography, {
1035
+ style: "body2",
1036
+ weight: "medium",
1037
+ children: t("neetoForm.questions.heading.imageWidth")
1038
+ }), /*#__PURE__*/jsx(Slider, {
1039
+ max: HEADING_IMAGE_WIDTH.MAX,
1040
+ min: HEADING_IMAGE_WIDTH.MIN,
1041
+ value: imageWidth,
1042
+ onChange: setImageWidth
1043
+ })]
1044
+ })]
1045
+ })]
1046
+ });
1047
+ };
1048
+
893
1049
  function ownKeys$f(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; }
894
1050
  function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
895
1051
  var Name = function Name(_ref) {
@@ -971,6 +1127,13 @@ var Properties = function Properties(_ref) {
971
1127
  isLabelDisabled: isLabelDisabled
972
1128
  });
973
1129
  }
1130
+ if (kind === QUESTION_TYPES.HEADING) {
1131
+ return /*#__PURE__*/jsx(Heading, {
1132
+ handleLabelChange: handleLabelChange,
1133
+ isLabelDisabled: isLabelDisabled
1134
+ });
1135
+ }
1136
+ if (kind === QUESTION_TYPES.DIVIDER) return null;
974
1137
  return /*#__PURE__*/jsxs("div", {
975
1138
  className: "space-y-4",
976
1139
  children: [/*#__PURE__*/jsx(LabelWithPlaceholder, {
@@ -986,92 +1149,6 @@ var Properties = function Properties(_ref) {
986
1149
  });
987
1150
  };
988
1151
 
989
- var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
990
- var editorRef = _ref.editorRef,
991
- fieldName = _ref.fieldName,
992
- value = _ref.value;
993
- var initialStateRef = useRef({
994
- language: "",
995
- value: null
996
- });
997
- var _useBuildFormStore = useBuildFormStore(function (store) {
998
- var _store$formState, _store$formState2;
999
- return {
1000
- formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
1001
- selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"]
1002
- };
1003
- }, shallow),
1004
- formId = _useBuildFormStore.formId,
1005
- language = _useBuildFormStore.selectedLanguage;
1006
- var setEditorContent = function setEditorContent(content) {
1007
- var _editorRef$current$ed;
1008
- return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 || (_editorRef$current$ed = _editorRef$current$ed.commands) === null || _editorRef$current$ed === void 0 ? void 0 : _editorRef$current$ed.setContent(content);
1009
- };
1010
- var _useForm = useForm({
1011
- formId: formId,
1012
- language: language
1013
- }),
1014
- data = _useForm.data;
1015
- useEffect(function () {
1016
- if (!data) return;
1017
- var pathArray = fieldName.split(".").map(function (part) {
1018
- var parsedPart = parseInt(part);
1019
- return isNaN(parsedPart) ? part : parsedPart;
1020
- });
1021
- setEditorContent(path(pathArray, data));
1022
- }, [data]);
1023
- useEffect(function () {
1024
- if (initialStateRef.current["language"] !== language) {
1025
- initialStateRef.current["language"] = language;
1026
- initialStateRef.current["value"] = null;
1027
- return;
1028
- }
1029
- if (initialStateRef.current["value"] === null && value !== null) {
1030
- setEditorContent(value);
1031
- initialStateRef.current["value"] = value;
1032
- }
1033
- }, [language, value]);
1034
- };
1035
-
1036
- var Editor = function Editor() {
1037
- var editorRef = useRef({
1038
- editor: {}
1039
- });
1040
- var fieldName = "label";
1041
- var _useField = useField({
1042
- name: fieldName,
1043
- validate: validateEditorContent(editorRef)
1044
- }),
1045
- _useField2 = _slicedToArray(_useField, 3),
1046
- value = _useField2[0].value,
1047
- _useField2$ = _useField2[1],
1048
- touched = _useField2$.touched,
1049
- error = _useField2$.error,
1050
- _useField2$2 = _useField2[2],
1051
- setTouched = _useField2$2.setTouched,
1052
- setValue = _useField2$2.setValue;
1053
- useUpdateEditorContent({
1054
- editorRef: editorRef,
1055
- fieldName: fieldName,
1056
- value: value
1057
- });
1058
- return /*#__PURE__*/jsx("div", {
1059
- className: "w-full cursor-auto",
1060
- children: /*#__PURE__*/jsx(NeetoEditor, {
1061
- required: true,
1062
- error: touched ? error : "",
1063
- id: "editor",
1064
- initialValue: value,
1065
- name: fieldName,
1066
- ref: editorRef,
1067
- onBlur: function onBlur() {
1068
- return setTouched(true);
1069
- },
1070
- onChange: setValue
1071
- })
1072
- });
1073
- };
1074
-
1075
1152
  var RequiredSwitch = withT(function (_ref) {
1076
1153
  var t = _ref.t;
1077
1154
  return /*#__PURE__*/jsx("div", {
@@ -1241,7 +1318,7 @@ var Form$1 = function Form(_ref) {
1241
1318
  var shouldShowSendSmsUpdatesSwitch = kind === QUESTION_TYPES.PHONE && showSmsUpdatesToggle;
1242
1319
  var isBasicSettingsVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
1243
1320
  var shouldShowRequiredSwitch = isBasicSettingsVisible && !isImmutable && !includes(kind, [QUESTION_TYPES.PARAGRAPH, QUESTION_TYPES.ADDRESS, QUESTION_TYPES.SPOT]);
1244
- var isSettingsBlockVisible = kind !== QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || canConfigureDecimals || shouldShowSendSmsUpdatesSwitch);
1321
+ var isSettingsBlockVisible = kind !== QUESTION_TYPES.SPOT && !isLayoutQuestion(kind) && (isBasicSettingsVisible || canMarkResponsesAsReadOnly || isTextarea || canConfigureDecimals || shouldShowSendSmsUpdatesSwitch);
1245
1322
  var handleKindChange = function handleKindChange(option) {
1246
1323
  var data = buildQuestionData(option);
1247
1324
  updateFormState(data);
@@ -1380,7 +1457,17 @@ var richTextFieldMissingErrorMessage = function richTextFieldMissingErrorMessage
1380
1457
  field: field
1381
1458
  });
1382
1459
  };
1460
+ var headingContentValidation = function headingContentValidation(schema) {
1461
+ return schema.test("heading-content", t("neetoForm.error.headingCantBeEmpty"), function (label) {
1462
+ var _this$parent = this.parent,
1463
+ description = _this$parent.description,
1464
+ image = _this$parent.image;
1465
+ return isPresent(label === null || label === void 0 ? void 0 : label.trim()) || !isEditorEmpty(description !== null && description !== void 0 ? description : "") || isPresent(image === null || image === void 0 ? void 0 : image.url);
1466
+ });
1467
+ };
1383
1468
  var buildLabelValidationSchema = function buildLabelValidationSchema(kind, schema) {
1469
+ if (kind === QUESTION_TYPES.HEADING) return headingContentValidation(schema);
1470
+ if (kind === QUESTION_TYPES.DIVIDER) return schema.notRequired();
1384
1471
  if (isNameQuestion(kind)) {
1385
1472
  return schema.notRequired();
1386
1473
  }