@bigbinary/neeto-form-frontend 2.2.0-beta1 → 2.2.0-beta2

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
@@ -4,7 +4,7 @@ import React__default, { useState, createElement, useRef, useEffect, forwardRef,
4
4
  import { useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
5
5
  import classnames from 'classnames';
6
6
  import { useFormikContext, useField, FieldArray, Form as Form$3, Formik, Field, FastField } from 'formik';
7
- import { filterNonNull, noop as noop$1, findBy, toLabelAndValue, isPresent as isPresent$1, truncate, slugify, filterBy, removeBy, isNotPresent, isNotEmpty, findById, notEqualsDeep } from '@bigbinary/neeto-cist';
7
+ import { filterNonNull, noop as noop$1, findBy, toLabelAndValue, isPresent as isPresent$1, truncate, slugify, filterBy, hyphenate, removeBy, isNotPresent, isNotEmpty, findById, notEqualsDeep } from '@bigbinary/neeto-cist';
8
8
  import { buildUrl, showThumbsUpToastr, withEventTargetValue, getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
9
9
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
10
10
  import { assoc, mergeLeft, compose, isEmpty, trim, useWith, path, split, isNotNil, either, isNil, values, equals, modify, prop, range, includes, __, reduce, reject, keys, pick, omit, pluck, without, difference, pipe as pipe$1, last, not, toLower, map, clamp as clamp$2, identity, filter as filter$1 } from 'ramda';
@@ -34,12 +34,13 @@ import Form$2 from '@bigbinary/neetoui/formik/Form';
34
34
  import Select from '@bigbinary/neetoui/formik/Select';
35
35
  import Textarea from '@bigbinary/neetoui/formik/Textarea';
36
36
  import Switch from '@bigbinary/neetoui/formik/Switch';
37
- import { Info, Delete, Plus, Check, Close, FileGeneric } from '@bigbinary/neeto-icons';
38
37
  import Button$1 from '@bigbinary/neetoui/Button';
38
+ import Accordion from '@bigbinary/neetoui/Accordion';
39
39
  import Input from '@bigbinary/neetoui/formik/Input';
40
40
  import * as yup from 'yup';
41
41
  import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
42
42
  import Checkbox from '@bigbinary/neetoui/Checkbox';
43
+ import { Delete, Plus, Check, Close, FileGeneric } from '@bigbinary/neeto-icons';
43
44
  import Label from '@bigbinary/neetoui/Label';
44
45
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
45
46
  import _regeneratorRuntime from '@babel/runtime/regenerator';
@@ -389,7 +390,7 @@ var RATING_VALUES = {
389
390
  }
390
391
  };
391
392
  var SCHEMA_LESS_QUESTION_KINDS = [QUESTION_KIND.PARAGRAPH.value];
392
- var RATING_OPTIONS = [{
393
+ var RATING_OPTIONS$1 = [{
393
394
  icon: SvgHappyFace,
394
395
  modifier: "happy",
395
396
  value: RATING_VALUES.GOOD.value
@@ -951,6 +952,121 @@ var useBuildFormState = function useBuildFormState() {
951
952
  return useBuildFormStore(prop("formState"));
952
953
  };
953
954
 
955
+ var _excluded$c = ["size", "color"],
956
+ _excluded2 = ["size", "color"],
957
+ _excluded3 = ["size", "color"],
958
+ _excluded4 = ["size", "color"];
959
+ function ownKeys$y(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; }
960
+ function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
961
+ var BadSmiley = function BadSmiley(props) {
962
+ var size = props.size,
963
+ color = props.color,
964
+ other = _objectWithoutProperties$1(props, _excluded$c);
965
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
966
+ fill: "none",
967
+ height: size,
968
+ viewBox: "0 0 48 48",
969
+ width: size
970
+ }, other), {}, {
971
+ children: [/*#__PURE__*/jsx("path", {
972
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24c13.234 0 24-10.767 24-24S37.234 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.082 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
973
+ fill: color
974
+ }), /*#__PURE__*/jsx("path", {
975
+ d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0c0-.575.468-1.044 1.043-1.044s1.044.469 1.044 1.044c0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 010-2.087 1.045 1.045 0 010 2.087zM24 29.218a13.677 13.677 0 00-10.168 4.52 1.043 1.043 0 101.553 1.394A11.587 11.587 0 0124 31.305c3.3 0 6.44 1.394 8.614 3.826a1.045 1.045 0 001.473.082 1.044 1.044 0 00.082-1.473c-2.57-2.874-6.277-4.523-10.169-4.523z",
976
+ fill: color
977
+ })]
978
+ }));
979
+ };
980
+ BadSmiley.defaultProps = {
981
+ color: "currentColor",
982
+ size: 24,
983
+ strokeWidth: "1.5"
984
+ };
985
+ var OkaySmiley = function OkaySmiley(props) {
986
+ var size = props.size,
987
+ color = props.color,
988
+ other = _objectWithoutProperties$1(props, _excluded2);
989
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
990
+ fill: "none",
991
+ height: size,
992
+ viewBox: "0 0 48 48",
993
+ width: size
994
+ }, other), {}, {
995
+ children: [/*#__PURE__*/jsx("path", {
996
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
997
+ fill: color
998
+ }), /*#__PURE__*/jsx("path", {
999
+ d: "M15.652 22.956a3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13zm0-4.174c.575 0 1.044.469 1.044 1.044 0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043c0-.575.468-1.044 1.043-1.044zm16.696-2.086a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 01-1.044-1.043c0-.575.469-1.044 1.044-1.044a1.044 1.044 0 010 2.087zm2.087 8.349h-20.87a1.044 1.044 0 000 2.086h20.87a1.044 1.044 0 000-2.086z",
1000
+ fill: color
1001
+ })]
1002
+ }));
1003
+ };
1004
+ OkaySmiley.defaultProps = {
1005
+ color: "currentColor",
1006
+ size: 24,
1007
+ strokeWidth: "1.5"
1008
+ };
1009
+ var GoodSmiley = function GoodSmiley(props) {
1010
+ var size = props.size,
1011
+ color = props.color,
1012
+ other = _objectWithoutProperties$1(props, _excluded3);
1013
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1014
+ fill: "none",
1015
+ height: size,
1016
+ viewBox: "0 0 48 48",
1017
+ width: size
1018
+ }, other), {}, {
1019
+ children: [/*#__PURE__*/jsx("path", {
1020
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1021
+ fill: color
1022
+ }), /*#__PURE__*/jsx("path", {
1023
+ d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0a1.044 1.044 0 012.087 0c0 .575-.469 1.044-1.044 1.044a1.045 1.045 0 01-1.043-1.044zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.174a1.045 1.045 0 01-1.044-1.044 1.044 1.044 0 111.044 1.044zm.265 8.695c-2.175 2.432-5.314 3.826-8.613 3.826a11.59 11.59 0 01-8.615-3.827 1.043 1.043 0 10-1.553 1.394A13.677 13.677 0 0024 35.478c3.892 0 7.599-1.648 10.17-4.521a1.043 1.043 0 10-1.557-1.392z",
1024
+ fill: color
1025
+ })]
1026
+ }));
1027
+ };
1028
+ GoodSmiley.defaultProps = {
1029
+ color: "currentColor",
1030
+ size: 24,
1031
+ strokeWidth: "1.5"
1032
+ };
1033
+ var Drag = function Drag(props) {
1034
+ var size = props.size,
1035
+ color = props.color,
1036
+ other = _objectWithoutProperties$1(props, _excluded4);
1037
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1038
+ fill: "none",
1039
+ height: size,
1040
+ viewBox: "0 0 24 24",
1041
+ width: size
1042
+ }, other), {}, {
1043
+ children: [/*#__PURE__*/jsx("g", {
1044
+ clipPath: "url(#clip0_6290_43)",
1045
+ fill: color,
1046
+ stroke: color,
1047
+ strokeLinecap: "round",
1048
+ strokeLinejoin: "round",
1049
+ strokeWidth: "1.5",
1050
+ children: /*#__PURE__*/jsx("path", {
1051
+ d: "M8 12a1 1 0 102 0 1 1 0 00-2 0zM8 18a1 1 0 102 0 1 1 0 00-2 0zM8 6a1 1 0 102 0 1 1 0 00-2 0zM14 12a1 1 0 102 0 1 1 0 00-2 0zM14 18a1 1 0 102 0 1 1 0 00-2 0zM14 6a1 1 0 102 0 1 1 0 00-2 0z"
1052
+ })
1053
+ }), /*#__PURE__*/jsx("defs", {
1054
+ children: /*#__PURE__*/jsx("clipPath", {
1055
+ id: "clip0_6290_43",
1056
+ children: /*#__PURE__*/jsx("path", {
1057
+ d: "M0 0H24V24H0z",
1058
+ fill: color
1059
+ })
1060
+ })
1061
+ })]
1062
+ }));
1063
+ };
1064
+ Drag.defaultProps = {
1065
+ color: "currentColor",
1066
+ size: 24,
1067
+ strokeWidth: "1.5"
1068
+ };
1069
+
954
1070
  var getActiveQuestionKindDetails = function getActiveQuestionKindDetails(_ref) {
955
1071
  var allQuestionKinds = _ref.allQuestionKinds,
956
1072
  item = _ref.item;
@@ -1007,6 +1123,19 @@ var FILE_GROUPS = [{
1007
1123
  label: t$3("neetoForm.fileTypes.audioVideo"),
1008
1124
  name: FILE_TYPES.AUDIO_VIDEO
1009
1125
  }];
1126
+ var RATING_OPTIONS = [{
1127
+ icon: GoodSmiley,
1128
+ name: "highestRatingLabel",
1129
+ color: "#00ba88"
1130
+ }, {
1131
+ icon: OkaySmiley,
1132
+ name: "averageRatingLabel",
1133
+ color: "#f3cd82"
1134
+ }, {
1135
+ icon: BadSmiley,
1136
+ name: "lowestRatingLabel",
1137
+ color: "#f56a58"
1138
+ }];
1010
1139
 
1011
1140
  var NAME$1 = QUESTION_TYPES.NAME,
1012
1141
  PHONE$1 = QUESTION_TYPES.PHONE,
@@ -1365,121 +1494,6 @@ var Overview = function Overview(_ref) {
1365
1494
  });
1366
1495
  };
1367
1496
 
1368
- var _excluded$c = ["size", "color"],
1369
- _excluded2 = ["size", "color"],
1370
- _excluded3 = ["size", "color"],
1371
- _excluded4 = ["size", "color"];
1372
- function ownKeys$y(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; }
1373
- function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1374
- var BadSmiley = function BadSmiley(props) {
1375
- var size = props.size,
1376
- color = props.color,
1377
- other = _objectWithoutProperties$1(props, _excluded$c);
1378
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1379
- fill: "none",
1380
- height: size,
1381
- viewBox: "0 0 48 48",
1382
- width: size
1383
- }, other), {}, {
1384
- children: [/*#__PURE__*/jsx("path", {
1385
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24c13.234 0 24-10.767 24-24S37.234 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.082 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1386
- fill: color
1387
- }), /*#__PURE__*/jsx("path", {
1388
- d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0c0-.575.468-1.044 1.043-1.044s1.044.469 1.044 1.044c0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 010-2.087 1.045 1.045 0 010 2.087zM24 29.218a13.677 13.677 0 00-10.168 4.52 1.043 1.043 0 101.553 1.394A11.587 11.587 0 0124 31.305c3.3 0 6.44 1.394 8.614 3.826a1.045 1.045 0 001.473.082 1.044 1.044 0 00.082-1.473c-2.57-2.874-6.277-4.523-10.169-4.523z",
1389
- fill: color
1390
- })]
1391
- }));
1392
- };
1393
- BadSmiley.defaultProps = {
1394
- color: "currentColor",
1395
- size: 24,
1396
- strokeWidth: "1.5"
1397
- };
1398
- var OkaySmiley = function OkaySmiley(props) {
1399
- var size = props.size,
1400
- color = props.color,
1401
- other = _objectWithoutProperties$1(props, _excluded2);
1402
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1403
- fill: "none",
1404
- height: size,
1405
- viewBox: "0 0 48 48",
1406
- width: size
1407
- }, other), {}, {
1408
- children: [/*#__PURE__*/jsx("path", {
1409
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1410
- fill: color
1411
- }), /*#__PURE__*/jsx("path", {
1412
- d: "M15.652 22.956a3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13zm0-4.174c.575 0 1.044.469 1.044 1.044 0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043c0-.575.468-1.044 1.043-1.044zm16.696-2.086a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 01-1.044-1.043c0-.575.469-1.044 1.044-1.044a1.044 1.044 0 010 2.087zm2.087 8.349h-20.87a1.044 1.044 0 000 2.086h20.87a1.044 1.044 0 000-2.086z",
1413
- fill: color
1414
- })]
1415
- }));
1416
- };
1417
- OkaySmiley.defaultProps = {
1418
- color: "currentColor",
1419
- size: 24,
1420
- strokeWidth: "1.5"
1421
- };
1422
- var GoodSmiley = function GoodSmiley(props) {
1423
- var size = props.size,
1424
- color = props.color,
1425
- other = _objectWithoutProperties$1(props, _excluded3);
1426
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1427
- fill: "none",
1428
- height: size,
1429
- viewBox: "0 0 48 48",
1430
- width: size
1431
- }, other), {}, {
1432
- children: [/*#__PURE__*/jsx("path", {
1433
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1434
- fill: color
1435
- }), /*#__PURE__*/jsx("path", {
1436
- d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0a1.044 1.044 0 012.087 0c0 .575-.469 1.044-1.044 1.044a1.045 1.045 0 01-1.043-1.044zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.174a1.045 1.045 0 01-1.044-1.044 1.044 1.044 0 111.044 1.044zm.265 8.695c-2.175 2.432-5.314 3.826-8.613 3.826a11.59 11.59 0 01-8.615-3.827 1.043 1.043 0 10-1.553 1.394A13.677 13.677 0 0024 35.478c3.892 0 7.599-1.648 10.17-4.521a1.043 1.043 0 10-1.557-1.392z",
1437
- fill: color
1438
- })]
1439
- }));
1440
- };
1441
- GoodSmiley.defaultProps = {
1442
- color: "currentColor",
1443
- size: 24,
1444
- strokeWidth: "1.5"
1445
- };
1446
- var Drag = function Drag(props) {
1447
- var size = props.size,
1448
- color = props.color,
1449
- other = _objectWithoutProperties$1(props, _excluded4);
1450
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1451
- fill: "none",
1452
- height: size,
1453
- viewBox: "0 0 24 24",
1454
- width: size
1455
- }, other), {}, {
1456
- children: [/*#__PURE__*/jsx("g", {
1457
- clipPath: "url(#clip0_6290_43)",
1458
- fill: color,
1459
- stroke: color,
1460
- strokeLinecap: "round",
1461
- strokeLinejoin: "round",
1462
- strokeWidth: "1.5",
1463
- children: /*#__PURE__*/jsx("path", {
1464
- d: "M8 12a1 1 0 102 0 1 1 0 00-2 0zM8 18a1 1 0 102 0 1 1 0 00-2 0zM8 6a1 1 0 102 0 1 1 0 00-2 0zM14 12a1 1 0 102 0 1 1 0 00-2 0zM14 18a1 1 0 102 0 1 1 0 00-2 0zM14 6a1 1 0 102 0 1 1 0 00-2 0z"
1465
- })
1466
- }), /*#__PURE__*/jsx("defs", {
1467
- children: /*#__PURE__*/jsx("clipPath", {
1468
- id: "clip0_6290_43",
1469
- children: /*#__PURE__*/jsx("path", {
1470
- d: "M0 0H24V24H0z",
1471
- fill: color
1472
- })
1473
- })
1474
- })]
1475
- }));
1476
- };
1477
- Drag.defaultProps = {
1478
- color: "currentColor",
1479
- size: 24,
1480
- strokeWidth: "1.5"
1481
- };
1482
-
1483
1497
  var validateEditorContent = function validateEditorContent(editorRef) {
1484
1498
  return function () {
1485
1499
  var _editorRef$current;
@@ -2060,31 +2074,27 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
2060
2074
 
2061
2075
  var FieldCode = withT(function (_ref) {
2062
2076
  var t = _ref.t;
2063
- return /*#__PURE__*/jsx("div", {
2064
- children: /*#__PURE__*/jsx(InputWithMaxLength, {
2065
- required: true,
2066
- label: t("neetoForm.questions.common.questionFields.field.fieldCode"),
2067
- name: "fieldCode",
2068
- helpText: /*#__PURE__*/jsx(Trans, {
2069
- i18nKey: "neetoForm.questions.common.questionFields.field.fieldCodeHelpDescription",
2070
- components: {
2071
- Link: /*#__PURE__*/jsx(Button$1, {
2072
- className: "text-xs",
2073
- href: FIELD_CODE_DOC,
2074
- style: "link",
2075
- target: "_blank"
2076
- })
2077
- }
2078
- }),
2079
- labelProps: {
2080
- helpIconProps: {
2081
- icon: Info,
2082
- className: "cursor-pointer",
2083
- onClick: function onClick() {
2084
- return window.open(FIELD_CODE_DOC, "_blank");
2077
+ return /*#__PURE__*/jsx(Accordion, {
2078
+ className: "neeto-form-nano-advanced-properties-accordion",
2079
+ "data-cy": "advanced-properties-card",
2080
+ children: /*#__PURE__*/jsx(Accordion.Item, {
2081
+ title: t("neetoForm.common.advancedProperties"),
2082
+ children: /*#__PURE__*/jsx(InputWithMaxLength, {
2083
+ required: true,
2084
+ label: t("neetoForm.questions.common.questionFields.field.fieldCode"),
2085
+ name: "fieldCode",
2086
+ helpText: /*#__PURE__*/jsx(Trans, {
2087
+ i18nKey: "neetoForm.questions.common.questionFields.field.fieldCodeHelpDescription",
2088
+ components: {
2089
+ Link: /*#__PURE__*/jsx(Button$1, {
2090
+ className: "text-xs",
2091
+ href: FIELD_CODE_DOC,
2092
+ style: "link",
2093
+ target: "_blank"
2094
+ })
2085
2095
  }
2086
- }
2087
- }
2096
+ })
2097
+ })
2088
2098
  })
2089
2099
  });
2090
2100
  });
@@ -2127,19 +2137,28 @@ var Form$1 = function Form(_ref) {
2127
2137
  var shouldShowPlaceholder = includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
2128
2138
  var hasAdditionalData = includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
2129
2139
  var shouldShowFieldCode = enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE);
2130
- var handleKindChange = function handleKindChange(_ref3) {
2131
- var label = _ref3.label,
2132
- value = _ref3.value;
2140
+ var handleKindChange = function handleKindChange(option) {
2141
+ var data = buildQuestionData(option);
2142
+ updateFormState(data);
2143
+ };
2144
+ var buildQuestionData = function buildQuestionData(option) {
2145
+ if (isNil(option)) {
2146
+ return INITIAL_VALUES;
2147
+ }
2148
+ var label = option.label,
2149
+ value = option.value;
2133
2150
  var kind = extractKindFromOption(value);
2134
2151
  var questionKind = getQuestionKind(availableQuestionKinds, {
2135
2152
  type: kind,
2136
2153
  label: label
2137
2154
  });
2138
- var data = createFieldData({
2155
+ return createFieldData({
2139
2156
  kind: questionKind,
2140
2157
  isRequired: isRequired,
2141
2158
  questions: questions
2142
2159
  });
2160
+ };
2161
+ var updateFormState = function updateFormState(data) {
2143
2162
  setValues(data);
2144
2163
  setErrors({});
2145
2164
  setTouched({});
@@ -2180,11 +2199,7 @@ var Form$1 = function Form(_ref) {
2180
2199
  dataCy: "settings-card",
2181
2200
  title: t("neetoForm.common.settings"),
2182
2201
  children: /*#__PURE__*/jsx(RequiredSwitch, {})
2183
- }), shouldShowFieldCode && /*#__PURE__*/jsx(Block, {
2184
- dataCy: "advanced-properties-card",
2185
- title: t("neetoForm.common.advancedProperties"),
2186
- children: /*#__PURE__*/jsx(FieldCode, {})
2187
- })]
2202
+ }), shouldShowFieldCode && /*#__PURE__*/jsx(FieldCode, {})]
2188
2203
  })]
2189
2204
  })
2190
2205
  });
@@ -2387,6 +2402,7 @@ var FileGroup = function FileGroup(_ref) {
2387
2402
  checked: checked,
2388
2403
  label: label,
2389
2404
  name: name,
2405
+ "data-cy": "neeto-form-engine-file-type-".concat(name),
2390
2406
  id: name,
2391
2407
  onChange: handleAllowedFileTypesChange
2392
2408
  });
@@ -2565,6 +2581,7 @@ var Options = function Options(_ref) {
2565
2581
  var _option$id;
2566
2582
  return !option._destroy && /*#__PURE__*/jsxs("div", {
2567
2583
  className: "flex items-start gap-1",
2584
+ "data-cy": "neeto-form-engine-option-".concat(index),
2568
2585
  children: [/*#__PURE__*/jsx(InputWithMaxLength, {
2569
2586
  required: true,
2570
2587
  disabled: freezeOptions,
@@ -2593,6 +2610,7 @@ var Options = function Options(_ref) {
2593
2610
  }), !freezeOptions && /*#__PURE__*/jsx("div", {
2594
2611
  className: "mt-3 w-full",
2595
2612
  children: /*#__PURE__*/jsx(Button$1, {
2613
+ "data-cy": "neeto-form-engine-add-option-button",
2596
2614
  icon: Plus,
2597
2615
  iconPosition: "left",
2598
2616
  size: "small",
@@ -2621,30 +2639,22 @@ var Rating$2 = function Rating() {
2621
2639
  className: "flex flex-col",
2622
2640
  children: /*#__PURE__*/jsx("div", {
2623
2641
  className: "w-full",
2624
- children: /*#__PURE__*/jsxs("div", {
2642
+ children: /*#__PURE__*/jsx("div", {
2625
2643
  className: "flex gap-6",
2626
- children: [/*#__PURE__*/jsxs(RatingItem, {
2627
- children: [/*#__PURE__*/jsx(GoodSmiley, {
2628
- color: "#00ba88",
2629
- size: 48
2630
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2631
- name: "highestRatingLabel"
2632
- })]
2633
- }), /*#__PURE__*/jsxs(RatingItem, {
2634
- children: [/*#__PURE__*/jsx(OkaySmiley, {
2635
- color: "#f3cd82",
2636
- size: 48
2637
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2638
- name: "averageRatingLabel"
2639
- })]
2640
- }), /*#__PURE__*/jsxs(RatingItem, {
2641
- children: [/*#__PURE__*/jsx(BadSmiley, {
2642
- color: "#f56a58",
2643
- size: 48
2644
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2645
- name: "lowestRatingLabel"
2646
- })]
2647
- })]
2644
+ children: RATING_OPTIONS.map(function (_ref2) {
2645
+ var Icon = _ref2.icon,
2646
+ name = _ref2.name,
2647
+ color = _ref2.color;
2648
+ return /*#__PURE__*/jsxs(RatingItem, {
2649
+ children: [/*#__PURE__*/jsx(Icon, {
2650
+ color: color,
2651
+ size: 48
2652
+ }), /*#__PURE__*/jsx(InputWithMaxLength, {
2653
+ name: name,
2654
+ "data-cy": "neeto-form-engine-".concat(hyphenate(name))
2655
+ })]
2656
+ }, name);
2657
+ })
2648
2658
  })
2649
2659
  })
2650
2660
  });
@@ -2665,6 +2675,7 @@ var StarRating$2 = function StarRating() {
2665
2675
  className: "flex space-x-4",
2666
2676
  children: [/*#__PURE__*/jsx(Select, {
2667
2677
  className: "w-1/2",
2678
+ "data-cy": "neeto-form-engine-star-rating-min-value",
2668
2679
  label: t("neetoForm.common.start"),
2669
2680
  name: "minValue",
2670
2681
  options: STAR_RATING_MIN_VALUE_OPTIONS,
@@ -2673,6 +2684,7 @@ var StarRating$2 = function StarRating() {
2673
2684
  }
2674
2685
  }), /*#__PURE__*/jsx(Select, {
2675
2686
  className: "w-1/2",
2687
+ "data-cy": "neeto-form-engine-star-rating-max-value",
2676
2688
  label: t("neetoForm.common.end"),
2677
2689
  name: "maxValue",
2678
2690
  options: STAR_RATING_MAX_VALUE_OPTIONS,
@@ -2690,6 +2702,7 @@ var StarRating$2 = function StarRating() {
2690
2702
  IconType = _ref2[1];
2691
2703
  var isActive = name === iconType;
2692
2704
  return /*#__PURE__*/jsx("div", {
2705
+ "data-cy": "neeto-form-engine-rating-icon-".concat(name),
2693
2706
  className: classnames("flex h-10 w-10 items-center justify-center gap-2", "neeto-ui-border-gray-800 neeto-ui-rounded-full cursor-pointer border", "transition-all duration-300 ease-in-out", {
2694
2707
  "neeto-ui-text-gray-800 neeto-ui-bg-gray-200": !isActive,
2695
2708
  "neeto-ui-text-white neeto-ui-bg-gray-800": isActive
@@ -2799,6 +2812,7 @@ var AddQuestion = withT(function (_ref) {
2799
2812
  content: (disabledAddButtonTooltipProps === null || disabledAddButtonTooltipProps === void 0 ? void 0 : disabledAddButtonTooltipProps.content) || t("neetoForm.questions.common.primaryPanel.noQuestionLeft"),
2800
2813
  children: /*#__PURE__*/jsx("span", {
2801
2814
  children: /*#__PURE__*/jsx(Button$1, {
2815
+ "data-cy": "neeto-form-engine-add-question",
2802
2816
  disabled: isDisabled,
2803
2817
  icon: Plus,
2804
2818
  iconPosition: "left",
@@ -3124,7 +3138,9 @@ var BuildForm = function BuildForm(_ref) {
3124
3138
  questions = _ref2.questions,
3125
3139
  isQuestionsLoading = _ref2.isQuestionsLoading;
3126
3140
  useEffect(function () {
3127
- onUpdate === null || onUpdate === void 0 || onUpdate(data);
3141
+ if (data) {
3142
+ onUpdate === null || onUpdate === void 0 || onUpdate(data);
3143
+ }
3128
3144
  }, [data]);
3129
3145
  if (isLoading || showLoader && isQuestionsLoading) {
3130
3146
  return /*#__PURE__*/jsx("div", {
@@ -13473,6 +13489,7 @@ var Choices = function Choices(_ref) {
13473
13489
  var Component = isCheckBox ? Checkbox : Radio.Item;
13474
13490
  return /*#__PURE__*/jsxs("div", {
13475
13491
  className: "neeto-form-engine-choices__wrapper",
13492
+ "data-cy": "".concat(hyphenate(label), "-select-container-wrapper"),
13476
13493
  children: [/*#__PURE__*/jsx("label", {
13477
13494
  className: "neeto-form-engine-label",
13478
13495
  children: label
@@ -13628,7 +13645,7 @@ var Rating = function Rating(_ref) {
13628
13645
  };
13629
13646
  var render = function render() {
13630
13647
  var labels = [highestRatingLabel, averageRatingLabel, lowestRatingLabel];
13631
- return RATING_OPTIONS.map(function (_ref2, index) {
13648
+ return RATING_OPTIONS$1.map(function (_ref2, index) {
13632
13649
  var Icon = _ref2.icon,
13633
13650
  modifier = _ref2.modifier,
13634
13651
  rating = _ref2.value;