@bigbinary/neeto-form-frontend 1.2.55 → 1.3.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.
@@ -30,7 +30,7 @@
30
30
  "phoneNumberValidation": "phone number starting with country code",
31
31
  "yes": "Yes",
32
32
  "count": "Count",
33
- "icon": "Icon",
33
+ "shape": "Shape",
34
34
  "good": "Good",
35
35
  "okay": "Okay",
36
36
  "bad": "Bad",
@@ -40,7 +40,9 @@
40
40
  "hobbies": "Hobbies",
41
41
  "country": "Country",
42
42
  "addGuests": "Add guests",
43
- "addGuestsHelper": "Enter emails separated by comma."
43
+ "addGuestsHelper": "Enter emails separated by comma.",
44
+ "start": "Start",
45
+ "end": "End"
44
46
  },
45
47
  "fields": {
46
48
  "mcf": "Multiple choice",
package/dist/index.cjs.js CHANGED
@@ -20,8 +20,8 @@ var formik$1 = require('@bigbinary/neetoui/formik');
20
20
  var reactI18next = require('react-i18next');
21
21
  var zustand = require('zustand');
22
22
  var classnames = require('classnames');
23
- var yup = require('yup');
24
23
  var neetoEditor = require('@bigbinary/neeto-editor');
24
+ var yup = require('yup');
25
25
  var useHotkeys = require('@bigbinary/neeto-hotkeys');
26
26
  var dayjs = require('dayjs');
27
27
  var PhoneNumber$1 = require('@bigbinary/neeto-molecules/PhoneNumber');
@@ -10077,7 +10077,8 @@ var Accordion = function Accordion(_ref) {
10077
10077
  showAddQuestionDivider = _ref.showAddQuestionDivider,
10078
10078
  isDeletable = _ref.isDeletable,
10079
10079
  kindUniqueOn = _ref.kindUniqueOn,
10080
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps;
10080
+ disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
10081
+ dragHandleProps = _ref.dragHandleProps;
10081
10082
  var _useState = React$2.useState(false),
10082
10083
  _useState2 = _slicedToArray$3(_useState, 2),
10083
10084
  isAddQuestionOpen = _useState2[0],
@@ -10091,14 +10092,14 @@ var Accordion = function Accordion(_ref) {
10091
10092
  className: classnames__default["default"]("neeto-form-engine-question-accordion relative", {
10092
10093
  "pr-4 md:pr-8": showAddQuestionDivider
10093
10094
  })
10094
- }, /*#__PURE__*/React__default["default"].createElement("div", {
10095
+ }, /*#__PURE__*/React__default["default"].createElement("div", _extends$8({
10095
10096
  "data-cy": "neeto-form-engine-question-accordion-header",
10096
10097
  className: classnames__default["default"]({
10097
10098
  "neeto-form-engine-question-accordion__header flex h-10 cursor-pointer select-none items-center justify-between px-3 py-2": true,
10098
10099
  "neeto-ui-text-gray-700 border": !isExpanded,
10099
10100
  "neeto-ui-bg-gray-800 neeto-ui-text-white rounded-b-none": isExpanded
10100
10101
  })
10101
- }, /*#__PURE__*/React__default["default"].createElement("div", {
10102
+ }, dragHandleProps), /*#__PURE__*/React__default["default"].createElement("div", {
10102
10103
  className: "neeto-form-engine-question-accordion__header-left flex items-center overflow-hidden"
10103
10104
  }, /*#__PURE__*/React__default["default"].createElement("div", {
10104
10105
  className: "flex w-8 items-center"
@@ -10302,6 +10303,39 @@ var Condition$1 = function Condition(_ref) {
10302
10303
  })));
10303
10304
  };
10304
10305
 
10306
+ var getActiveQuestionKindDetails = function getActiveQuestionKindDetails(_ref) {
10307
+ var allQuestionKinds = _ref.allQuestionKinds,
10308
+ item = _ref.item;
10309
+ var kind = item.kind,
10310
+ label = item.label;
10311
+ var _findBy = neetoCist.findBy({
10312
+ type: kind
10313
+ }, allQuestionKinds),
10314
+ FieldComponent = _findBy.component,
10315
+ FieldIcon = _findBy.icon,
10316
+ isSingular = _findBy.isSingular;
10317
+ return {
10318
+ kind: kind,
10319
+ label: label,
10320
+ FieldComponent: FieldComponent,
10321
+ FieldIcon: FieldIcon,
10322
+ isSingular: isSingular
10323
+ };
10324
+ };
10325
+ var generateArray = function generateArray(start, end) {
10326
+ return ramda.range(start, end + 1);
10327
+ };
10328
+
10329
+ var validateEditorContent = function validateEditorContent(editorRef) {
10330
+ return function () {
10331
+ var _editorRef$current;
10332
+ return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current = _editorRef$current.editor) !== null && _editorRef$current !== void 0 && _editorRef$current.isEmpty ? i18next.t("neetoForm.common.thisFieldIsRequired") : "";
10333
+ };
10334
+ };
10335
+ var generateRatingOptions = function generateRatingOptions(range) {
10336
+ return generateArray.apply(void 0, _toConsumableArray$1(range)).map(neetoCist.toLabelAndValue);
10337
+ };
10338
+
10305
10339
  var _FILE_TYPES_MAP;
10306
10340
  var FILE_TYPES = {
10307
10341
  DOCUMENTS: "documents",
@@ -10318,6 +10352,8 @@ var STAR_RATING_ICONS_MAP = {
10318
10352
  trophy: MemoizedTrophy,
10319
10353
  zap: MemoizedZap
10320
10354
  };
10355
+ var STAR_RATING_MAX_VALUE_OPTIONS = generateRatingOptions([3, 10]);
10356
+ var STAR_RATING_MIN_VALUE_OPTIONS = generateRatingOptions([0, 1]);
10321
10357
  var FILE_TYPES_MAP = (_FILE_TYPES_MAP = {}, _defineProperty$6(_FILE_TYPES_MAP, FILE_TYPES.DOCUMENTS, ["pdf", "doc", "docx", "xls", "xlsx", "csv", "txt", "rtf", "html", "zip", "md"]), _defineProperty$6(_FILE_TYPES_MAP, FILE_TYPES.IMAGES, ["jpg", "jpeg", "png", "gif"]), _defineProperty$6(_FILE_TYPES_MAP, FILE_TYPES.AUDIO_VIDEO, ["mp3", "wma", "mpg", "flv", "avi"]), _FILE_TYPES_MAP);
10322
10358
  var DEFAULT_ALLOWED_FILE_TYPES = ramda.values(FILE_TYPES_MAP).flat().join(", ");
10323
10359
  var FILE_GROUPS = [{
@@ -10330,8 +10366,6 @@ var FILE_GROUPS = [{
10330
10366
  label: i18next.t("neetoForm.fileTypes.audioVideo"),
10331
10367
  name: FILE_TYPES.AUDIO_VIDEO
10332
10368
  }];
10333
- var STAR_RATING_MIN_COUNT = 0;
10334
- var STAR_RATING_MAX_COUNT = 10;
10335
10369
 
10336
10370
  var Dropdown$1 = function Dropdown(_ref) {
10337
10371
  var item = _ref.item,
@@ -10982,32 +11016,6 @@ var SingleChoice$1 = function SingleChoice(_ref) {
10982
11016
  }));
10983
11017
  };
10984
11018
 
10985
- var validateEditorContent = function validateEditorContent(editorRef) {
10986
- return function () {
10987
- var _editorRef$current;
10988
- return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current = _editorRef$current.editor) !== null && _editorRef$current !== void 0 && _editorRef$current.isEmpty ? i18next.t("neetoForm.common.thisFieldIsRequired") : "";
10989
- };
10990
- };
10991
- var validateStarRatingCount = function validateStarRatingCount(value) {
10992
- try {
10993
- var schema = yup__namespace.number().integer().transform(function (value) {
10994
- return isNaN(value) ? null : value;
10995
- }).min(STAR_RATING_MIN_COUNT, i18next.t("neetoForm.error.minCount", {
10996
- field: i18next.t("neetoForm.common.count"),
10997
- value: STAR_RATING_MIN_COUNT
10998
- })).max(STAR_RATING_MAX_COUNT, i18next.t("neetoForm.error.maxCount", {
10999
- field: i18next.t("neetoForm.common.count"),
11000
- value: STAR_RATING_MAX_COUNT
11001
- })).nullable().required(i18next.t("neetoForm.common.fieldReq", {
11002
- field: i18next.t("neetoForm.common.count")
11003
- }));
11004
- schema.validateSync(value);
11005
- return undefined;
11006
- } catch (error) {
11007
- return error.message;
11008
- }
11009
- };
11010
-
11011
11019
  var StarRating$3 = function StarRating(_ref) {
11012
11020
  var name = _ref.name,
11013
11021
  isRequired = _ref.isRequired,
@@ -11015,21 +11023,13 @@ var StarRating$3 = function StarRating(_ref) {
11015
11023
  enableFieldCode = _ref.enableFieldCode;
11016
11024
  var _useTranslation = reactI18next.useTranslation(),
11017
11025
  t = _useTranslation.t;
11018
- var _useField = formik.useField("".concat(name, ".shape")),
11026
+ var _useFormikContext = formik.useFormikContext(),
11027
+ setFieldValue = _useFormikContext.setFieldValue;
11028
+ var _useField = formik.useField("".concat(name, ".iconType")),
11019
11029
  _useField2 = _slicedToArray$3(_useField, 3),
11020
- shape = _useField2[0].value;
11030
+ iconType = _useField2[0].value;
11021
11031
  _useField2[1];
11022
- var setShape = _useField2[2].setValue;
11023
- var _useField3 = formik.useField({
11024
- name: "".concat(name, ".count"),
11025
- validate: validateStarRatingCount
11026
- }),
11027
- _useField4 = _slicedToArray$3(_useField3, 3),
11028
- countField = _useField4[0],
11029
- _useField4$ = _useField4[1],
11030
- countTouched = _useField4$.touched,
11031
- countError = _useField4$.error,
11032
- setCount = _useField4[2].setValue;
11032
+ var setIconType = _useField2[2].setValue;
11033
11033
  return /*#__PURE__*/React__default["default"].createElement("div", {
11034
11034
  className: "space-y-4"
11035
11035
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -11040,22 +11040,31 @@ var StarRating$3 = function StarRating(_ref) {
11040
11040
  label: t("neetoForm.questions.common.questionFields.field.question"),
11041
11041
  name: "".concat(name, ".label"),
11042
11042
  rows: 1
11043
- })), /*#__PURE__*/React__default["default"].createElement(InputWithMaxLength, _extends$8({
11044
- required: true
11045
- }, countField, {
11046
- error: countTouched ? countError : "",
11047
- label: t("neetoForm.common.count"),
11048
- max: STAR_RATING_MAX_COUNT,
11049
- min: STAR_RATING_MIN_COUNT,
11050
- type: "number",
11051
- onChange: utils.withEventTargetValue(setCount)
11052
- })), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, null, t("neetoForm.common.icon")), /*#__PURE__*/React__default["default"].createElement("div", {
11043
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
11044
+ className: "flex space-x-4"
11045
+ }, /*#__PURE__*/React__default["default"].createElement(formik$1.Select, {
11046
+ className: "w-1/2",
11047
+ label: t("neetoForm.common.start"),
11048
+ name: "".concat(name, ".minValue"),
11049
+ options: STAR_RATING_MIN_VALUE_OPTIONS,
11050
+ onChange: function onChange(option) {
11051
+ return setFieldValue("".concat(name, ".minValue"), option === null || option === void 0 ? void 0 : option.value);
11052
+ }
11053
+ }), /*#__PURE__*/React__default["default"].createElement(formik$1.Select, {
11054
+ className: "w-1/2",
11055
+ label: t("neetoForm.common.end"),
11056
+ name: "".concat(name, ".maxValue"),
11057
+ options: STAR_RATING_MAX_VALUE_OPTIONS,
11058
+ onChange: function onChange(option) {
11059
+ return setFieldValue("".concat(name, ".maxValue"), option === null || option === void 0 ? void 0 : option.value);
11060
+ }
11061
+ })), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, null, t("neetoForm.common.shape")), /*#__PURE__*/React__default["default"].createElement("div", {
11053
11062
  className: "flex gap-2"
11054
11063
  }, Object.entries(STAR_RATING_ICONS_MAP).map(function (_ref2) {
11055
11064
  var _ref3 = _slicedToArray$3(_ref2, 2),
11056
11065
  name = _ref3[0],
11057
- Shape = _ref3[1];
11058
- var isActive = name === shape;
11066
+ IconType = _ref3[1];
11067
+ var isActive = name === iconType;
11059
11068
  return /*#__PURE__*/React__default["default"].createElement("div", {
11060
11069
  key: name,
11061
11070
  className: classnames__default["default"]("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", {
@@ -11063,9 +11072,9 @@ var StarRating$3 = function StarRating(_ref) {
11063
11072
  "neeto-ui-text-white neeto-ui-bg-gray-800": isActive
11064
11073
  }),
11065
11074
  onClick: function onClick() {
11066
- return setShape(name);
11075
+ return setIconType(name);
11067
11076
  }
11068
- }, /*#__PURE__*/React__default["default"].createElement(Shape, null));
11077
+ }, /*#__PURE__*/React__default["default"].createElement(IconType, null));
11069
11078
  })), !isRequired && /*#__PURE__*/React__default["default"].createElement("div", {
11070
11079
  className: "w-full"
11071
11080
  }, /*#__PURE__*/React__default["default"].createElement(formik$1.Checkbox, {
@@ -11126,19 +11135,30 @@ var Terms$1 = function Terms(_ref) {
11126
11135
  }),
11127
11136
  _useField2 = _slicedToArray$3(_useField, 3),
11128
11137
  value = _useField2[0].value,
11129
- error = _useField2[1].error,
11130
- setValue = _useField2[2].setValue;
11138
+ _useField2$ = _useField2[1],
11139
+ touched = _useField2$.touched,
11140
+ error = _useField2$.error,
11141
+ _useField2$2 = _useField2[2],
11142
+ setTouched = _useField2$2.setTouched,
11143
+ setValue = _useField2$2.setValue;
11131
11144
  useUpdateEditorContent(editorRef, fieldName, value);
11132
11145
  return /*#__PURE__*/React__default["default"].createElement("div", {
11133
11146
  className: "w-full cursor-auto"
11134
11147
  }, /*#__PURE__*/React__default["default"].createElement(neetoEditor.Editor, {
11135
- error: error,
11148
+ className: "px-2 pb-2",
11149
+ contentClassName: "border-none",
11136
11150
  disabled: isLabelDisabled,
11151
+ error: touched ? error : "",
11152
+ errorWrapperClassName: "border-none",
11137
11153
  id: "editor",
11138
11154
  initialValue: value,
11139
11155
  key: fieldName,
11156
+ menuClassName: "border-none",
11140
11157
  name: fieldName,
11141
11158
  ref: editorRef,
11159
+ onBlur: function onBlur() {
11160
+ return setTouched(true);
11161
+ },
11142
11162
  onChange: setValue
11143
11163
  }));
11144
11164
  };
@@ -11361,8 +11381,9 @@ var QUESTION_KINDS = [{
11361
11381
  defaults: {
11362
11382
  label: "",
11363
11383
  isRequired: true,
11364
- count: 5,
11365
- shape: "star"
11384
+ minValue: 1,
11385
+ maxValue: 5,
11386
+ iconType: "star"
11366
11387
  }
11367
11388
  }, {
11368
11389
  type: "rating",
@@ -11446,7 +11467,8 @@ var FormField = function FormField(props) {
11446
11467
  allQuestionKinds = props.allQuestionKinds,
11447
11468
  getActiveKindDetails = props.getActiveKindDetails,
11448
11469
  kindUniqueOn = props.kindUniqueOn,
11449
- disabledAddButtonTooltipProps = props.disabledAddButtonTooltipProps;
11470
+ disabledAddButtonTooltipProps = props.disabledAddButtonTooltipProps,
11471
+ dragHandleProps = props.dragHandleProps;
11450
11472
  var _getActiveKindDetails = getActiveKindDetails({
11451
11473
  allQuestionKinds: allQuestionKinds,
11452
11474
  item: item
@@ -11458,6 +11480,7 @@ var FormField = function FormField(props) {
11458
11480
  isSingular = _getActiveKindDetails.isSingular;
11459
11481
  return /*#__PURE__*/React__default["default"].createElement(Accordion, {
11460
11482
  disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
11483
+ dragHandleProps: dragHandleProps,
11461
11484
  isDeletable: isDeletable,
11462
11485
  isExpanded: isExpanded,
11463
11486
  kindUniqueOn: kindUniqueOn,
@@ -11506,11 +11529,12 @@ var Question = function Question(_ref) {
11506
11529
  var draggableProps = _ref3.draggableProps,
11507
11530
  dragHandleProps = _ref3.dragHandleProps,
11508
11531
  innerRef = _ref3.innerRef;
11509
- return /*#__PURE__*/React__default["default"].createElement("div", _extends$8({}, draggableProps, dragHandleProps, {
11532
+ return /*#__PURE__*/React__default["default"].createElement("div", _extends$8({}, draggableProps, {
11510
11533
  ref: innerRef
11511
11534
  }), /*#__PURE__*/React__default["default"].createElement(FormField, _extends$8({
11512
11535
  allQuestionKinds: allQuestionKinds,
11513
11536
  disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
11537
+ dragHandleProps: dragHandleProps,
11514
11538
  getActiveKindDetails: getActiveKindDetails,
11515
11539
  kindUniqueOn: kindUniqueOn,
11516
11540
  isDeletable: isDeletable(item),
@@ -12000,26 +12024,6 @@ var Form = function Form(_ref) {
12000
12024
  }))));
12001
12025
  };
12002
12026
 
12003
- var getActiveQuestionKindDetails = function getActiveQuestionKindDetails(_ref) {
12004
- var allQuestionKinds = _ref.allQuestionKinds,
12005
- item = _ref.item;
12006
- var kind = item.kind,
12007
- label = item.label;
12008
- var _findBy = neetoCist.findBy({
12009
- type: kind
12010
- }, allQuestionKinds),
12011
- FieldComponent = _findBy.component,
12012
- FieldIcon = _findBy.icon,
12013
- isSingular = _findBy.isSingular;
12014
- return {
12015
- kind: kind,
12016
- label: label,
12017
- FieldComponent: FieldComponent,
12018
- FieldIcon: FieldIcon,
12019
- isSingular: isSingular
12020
- };
12021
- };
12022
-
12023
12027
  /* eslint-disable @bigbinary/neeto/file-name-and-export-name-standards */
12024
12028
  var requiredLabelValidation = function requiredLabelValidation(schema, field) {
12025
12029
  return schema.trim().required(i18next__default["default"].t("neetoForm.common.fieldReq", {
@@ -16176,13 +16180,13 @@ var getMultipleOptionsFromURL = function getMultipleOptionsFromURL(_ref2) {
16176
16180
  });
16177
16181
  };
16178
16182
  var getStarRatingFromUrl = function getStarRatingFromUrl(_ref3) {
16179
- var starCount = _ref3.starCount,
16183
+ var minValue = _ref3.minValue,
16184
+ maxValue = _ref3.maxValue,
16180
16185
  fieldCodes = _ref3.fieldCodes,
16181
16186
  fieldCode = _ref3.fieldCode;
16182
16187
  var fieldCodeValue = fieldCodes[fieldCode];
16183
16188
  var rating = parseInt(fieldCodeValue);
16184
- if (!rating || rating < 0) return "";
16185
- return "".concat(rating >= starCount ? starCount : rating, " / ").concat(starCount);
16189
+ return ramda.isNil(rating) || isNaN(rating) ? "" : ramda.clamp(minValue, maxValue, rating);
16186
16190
  };
16187
16191
  var getAdditionalGuestsFromUrl = function getAdditionalGuestsFromUrl(_ref4) {
16188
16192
  var fieldCodes = _ref4.fieldCodes,
@@ -16239,7 +16243,8 @@ var generateInitValues = function generateInitValues(_ref7) {
16239
16243
  kind = question.kind,
16240
16244
  optionsAttributes = question.optionsAttributes,
16241
16245
  fieldCode = question.fieldCode,
16242
- count = question.count;
16246
+ minValue = question.minValue,
16247
+ maxValue = question.maxValue;
16243
16248
  switch (kind) {
16244
16249
  case QUESTION_KIND.CONDITION.value:
16245
16250
  {
@@ -16327,7 +16332,8 @@ var generateInitValues = function generateInitValues(_ref7) {
16327
16332
  {
16328
16333
  var _valuesMap$id$value4, _valuesMap7;
16329
16334
  initValues[id] = (_valuesMap$id$value4 = (_valuesMap7 = valuesMap) === null || _valuesMap7 === void 0 || (_valuesMap7 = _valuesMap7[id]) === null || _valuesMap7 === void 0 ? void 0 : _valuesMap7.value) !== null && _valuesMap$id$value4 !== void 0 ? _valuesMap$id$value4 : getStarRatingFromUrl({
16330
- starCount: count,
16335
+ minValue: minValue,
16336
+ maxValue: maxValue,
16331
16337
  fieldCodes: fieldCodes,
16332
16338
  fieldCode: fieldCode
16333
16339
  });
@@ -16452,6 +16458,10 @@ var renderButtonsInOrder = function renderButtonsInOrder(buttonsArray, shouldRev
16452
16458
  var orderedButtons = shouldReverse ? buttonsArray.reverse() : buttonsArray;
16453
16459
  return ramda.map(ramda.identity, orderedButtons);
16454
16460
  };
16461
+ var getSelectedRating = function getSelectedRating(value) {
16462
+ var parsedValue = parseInt(value);
16463
+ return isNaN(parsedValue) ? -1 : parsedValue;
16464
+ };
16455
16465
 
16456
16466
  var _excluded$3 = ["value"];
16457
16467
  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; }
@@ -26939,20 +26949,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
26939
26949
  }));
26940
26950
  };
26941
26951
 
26942
- var _excluded$1 = ["value", "shape", "label", "rating", "count"];
26952
+ var _excluded$1 = ["value", "iconType", "label", "rating"];
26943
26953
  var RatingButton = function RatingButton(_ref) {
26944
26954
  var _ref$value = _ref.value,
26945
- value = _ref$value === void 0 ? "0" : _ref$value,
26946
- shape = _ref.shape,
26955
+ value = _ref$value === void 0 ? 0 : _ref$value,
26956
+ iconType = _ref.iconType,
26947
26957
  label = _ref.label,
26948
26958
  rating = _ref.rating,
26949
- count = _ref.count,
26950
26959
  otherProps = _objectWithoutProperties$1(_ref, _excluded$1);
26951
26960
  var handleClick = function handleClick(e) {
26952
26961
  return e.currentTarget.nextElementSibling.click();
26953
26962
  };
26954
- var Icon = ICONS_MAP[shape];
26955
- var selectedRating = value ? String(value).split(" / ")[0] : 0;
26963
+ var Icon = ICONS_MAP[iconType];
26964
+ var selectedRating = getSelectedRating(value);
26956
26965
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("button", {
26957
26966
  className: classnames__default["default"]({
26958
26967
  active: rating === value
@@ -26962,24 +26971,24 @@ var RatingButton = function RatingButton(_ref) {
26962
26971
  }, /*#__PURE__*/React__default["default"].createElement(Icon, {
26963
26972
  size: 24,
26964
26973
  className: classnames__default["default"]("neeto-form-engine-star-rating__icon", {
26965
- "neeto-form-engine-star-rating__icon--active": rating <= Number(selectedRating)
26974
+ "neeto-form-engine-star-rating__icon--active": rating <= selectedRating
26966
26975
  })
26967
26976
  }), /*#__PURE__*/React__default["default"].createElement("label", {
26968
26977
  className: "neeto-form-engine-label"
26969
26978
  }, label)), /*#__PURE__*/React__default["default"].createElement("input", _extends$8({
26970
26979
  hidden: true,
26971
- checked: "".concat(rating, " / ").concat(count) === value,
26980
+ checked: ramda.equals(rating, value),
26972
26981
  type: "radio",
26973
- value: "".concat(rating, " / ").concat(count)
26982
+ value: rating
26974
26983
  }, otherProps)));
26975
26984
  };
26976
26985
  var RatingButton$1 = /*#__PURE__*/React__default["default"].memo(RatingButton);
26977
26986
 
26978
- var _excluded = ["label", "count", "shape", "error"];
26987
+ var _excluded = ["label", "minValue", "maxValue", "error"];
26979
26988
  var StarRating = function StarRating(_ref) {
26980
26989
  var label = _ref.label,
26981
- count = _ref.count,
26982
- shape = _ref.shape,
26990
+ minValue = _ref.minValue,
26991
+ maxValue = _ref.maxValue,
26983
26992
  error = _ref.error,
26984
26993
  props = _objectWithoutProperties$1(_ref, _excluded);
26985
26994
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -26990,15 +26999,13 @@ var StarRating = function StarRating(_ref) {
26990
26999
  className: "neeto-form-engine-label"
26991
27000
  }, label)), /*#__PURE__*/React__default["default"].createElement("div", {
26992
27001
  className: "neeto-form-engine-star-rating__row"
26993
- }, ramda.times(function (index) {
27002
+ }, generateArray(minValue, maxValue).map(function (index) {
26994
27003
  return /*#__PURE__*/React__default["default"].createElement(RatingButton$1, _extends$8({
26995
- count: count,
26996
- shape: shape,
26997
27004
  key: index,
26998
- label: index + 1,
26999
- rating: index + 1
27005
+ label: index,
27006
+ rating: index
27000
27007
  }, props));
27001
- }, count)), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
27008
+ })), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
27002
27009
  className: "neeto-form-engine-input__error",
27003
27010
  "data-cy": "neeto-form-engine-star-rating-error"
27004
27011
  }, error));
@@ -27011,10 +27018,10 @@ var StarRatingField = function StarRatingField(_ref) {
27011
27018
  var name = question.id,
27012
27019
  kind = question.kind,
27013
27020
  isRequired = question.isRequired,
27014
- count = question.count,
27015
- shape = question.shape;
27021
+ minValue = question.minValue,
27022
+ maxValue = question.maxValue,
27023
+ iconType = question.iconType;
27016
27024
  var label = fieldWithFallback(question, "label");
27017
- var sanitizedCount = ramda.clamp(0, 10, parseInt(count)) || 0;
27018
27025
  return /*#__PURE__*/React__default["default"].createElement(formik.Field, {
27019
27026
  name: name,
27020
27027
  validate: validateFieldValue({
@@ -27027,9 +27034,10 @@ var StarRatingField = function StarRatingField(_ref) {
27027
27034
  var meta = _ref2.meta,
27028
27035
  field = _ref2.field;
27029
27036
  return /*#__PURE__*/React__default["default"].createElement(StarRating$1, _extends$8({
27037
+ iconType: iconType,
27038
+ maxValue: maxValue,
27039
+ minValue: minValue,
27030
27040
  name: name,
27031
- shape: shape,
27032
- count: sanitizedCount,
27033
27041
  error: meta.touched ? meta.error : "",
27034
27042
  label: getLabel(label, isRequired)
27035
27043
  }, field));