@bigbinary/neeto-form-frontend 4.4.18 → 4.4.20
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/README.md +1 -1
- package/app/javascript/src/translations/ar.json +8 -2
- package/app/javascript/src/translations/bg.json +8 -2
- package/app/javascript/src/translations/ca.json +8 -2
- package/app/javascript/src/translations/cs.json +8 -2
- package/app/javascript/src/translations/da.json +8 -2
- package/app/javascript/src/translations/de.json +8 -2
- package/app/javascript/src/translations/en.json +7 -1
- package/app/javascript/src/translations/es-MX.json +8 -2
- package/app/javascript/src/translations/es.json +8 -2
- package/app/javascript/src/translations/et.json +8 -2
- package/app/javascript/src/translations/fi.json +8 -2
- package/app/javascript/src/translations/fil.json +8 -2
- package/app/javascript/src/translations/fr.json +8 -2
- package/app/javascript/src/translations/he.json +8 -2
- package/app/javascript/src/translations/hi.json +8 -2
- package/app/javascript/src/translations/hr.json +8 -2
- package/app/javascript/src/translations/hu.json +8 -2
- package/app/javascript/src/translations/id.json +8 -2
- package/app/javascript/src/translations/it.json +8 -2
- package/app/javascript/src/translations/ja.json +8 -2
- package/app/javascript/src/translations/ko.json +8 -2
- package/app/javascript/src/translations/nl.json +8 -2
- package/app/javascript/src/translations/pl.json +8 -2
- package/app/javascript/src/translations/pt-BR.json +8 -2
- package/app/javascript/src/translations/pt.json +8 -2
- package/app/javascript/src/translations/ro.json +8 -2
- package/app/javascript/src/translations/ru.json +8 -2
- package/app/javascript/src/translations/sk.json +8 -2
- package/app/javascript/src/translations/sl.json +8 -2
- package/app/javascript/src/translations/sv.json +8 -2
- package/app/javascript/src/translations/th.json +8 -2
- package/app/javascript/src/translations/tr.json +8 -2
- package/app/javascript/src/translations/uk.json +8 -2
- package/app/javascript/src/translations/vi.json +8 -2
- package/app/javascript/src/translations/zh-CN.json +8 -2
- package/app/javascript/src/translations/zh-TW.json +8 -2
- package/dist/.ready +1 -1
- package/dist/BuildForm.js +173 -94
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +24 -2
- package/dist/ExternalForm.js.map +1 -1
- package/dist/UrlBuilder.js +24 -2
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/cjs/BuildForm.js +173 -94
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +24 -2
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +24 -2
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/index.js +26 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/{utils-QSMxxdQN.js → utils-C-U-wBCy.js} +2 -2
- package/dist/{utils-QSMxxdQN.js.map → utils-C-U-wBCy.js.map} +1 -1
- package/dist/{utils-H7u9B9Jq.js → utils-D-rs56Yi.js} +2 -2
- package/dist/{utils-H7u9B9Jq.js.map → utils-D-rs56Yi.js.map} +1 -1
- package/dist/{yup-DfKhsn0t.js → yup-DhAn6Gfl.js} +82 -58
- package/dist/yup-DhAn6Gfl.js.map +1 -0
- package/dist/{yup-B3JGBWm7.js → yup-bkiiTZT4.js} +83 -58
- package/dist/yup-bkiiTZT4.js.map +1 -0
- package/package.json +16 -16
- package/dist/yup-B3JGBWm7.js.map +0 -1
- package/dist/yup-DfKhsn0t.js.map +0 -1
package/dist/BuildForm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, findById,
|
|
|
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, append, pluck, test, paths, difference, prop, startsWith, split, last, either, F, T } from 'ramda';
|
|
6
6
|
import { k as useDeleteQuestion, Q as QUESTION_TYPES, b as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-Cj0XxE8a.js';
|
|
7
|
-
import { j as QUESTION_ACTIONS, k as INDEPENDENT_LABELS_MAP, l as buildDisplayLabel, m as isElementOverflowing, n as
|
|
7
|
+
import { j as QUESTION_ACTIONS, k as INDEPENDENT_LABELS_MAP, l as buildDisplayLabel, m as isElementOverflowing, n as SELECTABLE_KINDS, o as isAutoGeneratedQuestion, p as isRichTextQuestion, q as SPOT_QUESTION_FIELD_CODE, N as NON_BASIC_LATIN_CHARACTERS_REGEX, r as RESERVED_FIELD_CODES, s as renameKey, f as LABEL_FIELDS, t as isDefaultLanguage, u as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, M as MIN_WORDS_SWITCH_LABEL_PROPS, w as MIN_WORDS, x as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, y as NON_HIDEABLE_FIELDS, z as NON_READ_ONLY_FIELDS, O as OPINION_LABEL_MAX_LENGTH, B as RICH_TEXT_QUESTIONS, e as ADDRESS_FIELD_WIDTHS, A as ADDRESS_FIELD_TYPES, G as generateDefaultOptions, H as MINIMUM_ADDRESS_FIELDS, J as getDeletedRecords, K as randomId, T as getActiveRecords, U as FILE_TYPES_MAP, V as FILE_GROUPS, W as OPINION_SCALE_MIN_VALUE_OPTIONS, X as OPINION_SCALE_MAX_VALUE_OPTIONS, D as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, Y as MINIMUM_OPTIONS, Z as IMAGE_HEIGHT_SLIDER_DEFAULTS, _ as RATING_OPTIONS, $ as STAR_RATING_MIN_VALUE_OPTIONS, a0 as STAR_RATING_MAX_VALUE_OPTIONS, a1 as STAR_RATING_ICONS_MAP, a2 as buildDisabledAddButtonHelpPopoverProps, a3 as buildReorderPayload, a4 as QUESTIONS_INITIAL_VALUE, a5 as isMandatoryField, a6 as QUESTION_KINDS, a as QUESTION_KIND, a7 as getActiveQuestionKindDetails, a8 as DEFAULT_AVAILABLE_LANGUAGES, a9 as DEFAULT_ADVANCED_FEATURES } from './yup-bkiiTZT4.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';
|
|
@@ -21,6 +21,7 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
21
21
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
22
22
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
23
23
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
24
|
+
import Equals from '@bigbinary/neeto-icons/Equals';
|
|
24
25
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
25
26
|
import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-DhtQJpD_.js';
|
|
26
27
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
@@ -58,6 +59,28 @@ import Slider from '@bigbinary/neetoui/Slider';
|
|
|
58
59
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
59
60
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
60
61
|
import 'axios';
|
|
62
|
+
import '@bigbinary/neeto-icons/Address';
|
|
63
|
+
import '@bigbinary/neeto-icons/Calendar';
|
|
64
|
+
import '@bigbinary/neeto-icons/Captcha';
|
|
65
|
+
import '@bigbinary/neeto-icons/Checkbox';
|
|
66
|
+
import '@bigbinary/neeto-icons/DropdownClosed';
|
|
67
|
+
import '@bigbinary/neeto-icons/Email';
|
|
68
|
+
import '@bigbinary/neeto-icons/FileUpload';
|
|
69
|
+
import '@bigbinary/neeto-icons/Group';
|
|
70
|
+
import '@bigbinary/neeto-icons/Hash';
|
|
71
|
+
import '@bigbinary/neeto-icons/Header';
|
|
72
|
+
import '@bigbinary/neeto-icons/Location';
|
|
73
|
+
import '@bigbinary/neeto-icons/LongText';
|
|
74
|
+
import '@bigbinary/neeto-icons/MessageSquare';
|
|
75
|
+
import '@bigbinary/neeto-icons/NeetoInvisible';
|
|
76
|
+
import '@bigbinary/neeto-icons/PhoneRing';
|
|
77
|
+
import '@bigbinary/neeto-icons/Radio';
|
|
78
|
+
import '@bigbinary/neeto-icons/Rating';
|
|
79
|
+
import '@bigbinary/neeto-icons/Scale';
|
|
80
|
+
import '@bigbinary/neeto-icons/Sms';
|
|
81
|
+
import '@bigbinary/neeto-icons/Terms';
|
|
82
|
+
import '@bigbinary/neeto-icons/TextLines';
|
|
83
|
+
import '@bigbinary/neeto-icons/UserRoundedRect';
|
|
61
84
|
import 'dompurify';
|
|
62
85
|
import '@bigbinary/neeto-icons/Plus';
|
|
63
86
|
import 'zustand';
|
|
@@ -292,7 +315,8 @@ var Card = function Card(_ref) {
|
|
|
292
315
|
allQuestionKinds: allQuestionKinds,
|
|
293
316
|
item: question
|
|
294
317
|
}),
|
|
295
|
-
isSingular = _getActiveKindDetails.isSingular
|
|
318
|
+
isSingular = _getActiveKindDetails.isSingular,
|
|
319
|
+
KindIcon = _getActiveKindDetails.icon;
|
|
296
320
|
var questionLabel = buildDisplayLabel(question);
|
|
297
321
|
useEffect(function () {
|
|
298
322
|
var element = questionLabelRef.current;
|
|
@@ -300,68 +324,66 @@ var Card = function Card(_ref) {
|
|
|
300
324
|
setIsTooltipEnabled(isElementOverflowing(element));
|
|
301
325
|
}, [questionLabel]);
|
|
302
326
|
return /*#__PURE__*/jsxs("div", {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
children: questionLabel
|
|
329
|
-
})
|
|
327
|
+
"data-testid": "neeto-form-engine-".concat(slugify(questionLabel)),
|
|
328
|
+
className: classnames("neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-white neeto-form-nano-form__card flex h-10 w-full items-center justify-between gap-2 overflow-hidden border p-2", {
|
|
329
|
+
"neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
|
|
330
|
+
}),
|
|
331
|
+
onClick: function onClick() {
|
|
332
|
+
return onSelect(question);
|
|
333
|
+
},
|
|
334
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
335
|
+
className: "flex min-w-0 grow items-center gap-2",
|
|
336
|
+
children: [KindIcon && /*#__PURE__*/jsx(KindIcon, {
|
|
337
|
+
className: "neeto-ui-text-gray-600 shrink-0",
|
|
338
|
+
"data-testid": "question-card-kind-icon",
|
|
339
|
+
size: 16
|
|
340
|
+
}), /*#__PURE__*/jsx(Tooltip, {
|
|
341
|
+
content: questionLabel,
|
|
342
|
+
disabled: !isTooltipEnabled,
|
|
343
|
+
position: "top",
|
|
344
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
345
|
+
className: "min-w-0 grow truncate",
|
|
346
|
+
"data-testid": "".concat(slugify(questionLabel), "-question-card-label"),
|
|
347
|
+
lineHeight: "snug",
|
|
348
|
+
ref: questionLabelRef,
|
|
349
|
+
style: "body2",
|
|
350
|
+
weight: "medium",
|
|
351
|
+
children: questionLabel
|
|
330
352
|
})
|
|
331
|
-
}), canManageQuestions && /*#__PURE__*/jsx(MoreDropdown, {
|
|
332
|
-
dropdownButtonProps: {
|
|
333
|
-
className: "shrink-0"
|
|
334
|
-
},
|
|
335
|
-
dropdownProps: {
|
|
336
|
-
strategy: "fixed"
|
|
337
|
-
},
|
|
338
|
-
menuItems: [{
|
|
339
|
-
"data-testid": "edit-question",
|
|
340
|
-
key: "edit",
|
|
341
|
-
label: t("neetoForm.common.edit"),
|
|
342
|
-
onClick: onEdit
|
|
343
|
-
}, {
|
|
344
|
-
"data-testid": "clone-question",
|
|
345
|
-
key: "clone",
|
|
346
|
-
label: t("neetoForm.common.clone"),
|
|
347
|
-
isVisible: !isSingular && isFunction(onClone),
|
|
348
|
-
onClick: onClone
|
|
349
|
-
}].concat(_toConsumableArray(extraMenuItems), [{
|
|
350
|
-
"data-testid": "delete-question",
|
|
351
|
-
key: "delete",
|
|
352
|
-
label: t("neetoForm.common.delete"),
|
|
353
|
-
isVisible: isFunction(onDelete),
|
|
354
|
-
onClick: function onClick() {
|
|
355
|
-
return onDelete(question);
|
|
356
|
-
}
|
|
357
|
-
}])
|
|
358
353
|
})]
|
|
354
|
+
}), canManageQuestions && /*#__PURE__*/jsx(MoreDropdown, {
|
|
355
|
+
dropdownButtonProps: {
|
|
356
|
+
className: "shrink-0"
|
|
357
|
+
},
|
|
358
|
+
dropdownProps: {
|
|
359
|
+
strategy: "fixed"
|
|
360
|
+
},
|
|
361
|
+
menuItems: [{
|
|
362
|
+
"data-testid": "edit-question",
|
|
363
|
+
key: "edit",
|
|
364
|
+
label: t("neetoForm.common.edit"),
|
|
365
|
+
onClick: onEdit
|
|
366
|
+
}, {
|
|
367
|
+
"data-testid": "clone-question",
|
|
368
|
+
key: "clone",
|
|
369
|
+
label: t("neetoForm.common.clone"),
|
|
370
|
+
isVisible: !isSingular && isFunction(onClone),
|
|
371
|
+
onClick: onClone
|
|
372
|
+
}].concat(_toConsumableArray(extraMenuItems), [{
|
|
373
|
+
"data-testid": "delete-question",
|
|
374
|
+
key: "delete",
|
|
375
|
+
label: t("neetoForm.common.delete"),
|
|
376
|
+
isVisible: isFunction(onDelete),
|
|
377
|
+
onClick: function onClick() {
|
|
378
|
+
return onDelete(question);
|
|
379
|
+
}
|
|
380
|
+
}])
|
|
359
381
|
})]
|
|
360
382
|
});
|
|
361
383
|
};
|
|
362
384
|
|
|
363
|
-
function ownKeys$
|
|
364
|
-
function _objectSpread$
|
|
385
|
+
function ownKeys$j(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; }
|
|
386
|
+
function _objectSpread$j(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$j(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$j(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
365
387
|
var Questions = function Questions(_ref) {
|
|
366
388
|
var questions = _ref.questions,
|
|
367
389
|
isDeletable = _ref.isDeletable,
|
|
@@ -381,7 +403,7 @@ var Questions = function Questions(_ref) {
|
|
|
381
403
|
var droppableProps = _ref2.droppableProps,
|
|
382
404
|
placeholder = _ref2.placeholder,
|
|
383
405
|
innerRef = _ref2.innerRef;
|
|
384
|
-
return /*#__PURE__*/jsxs("div", _objectSpread$
|
|
406
|
+
return /*#__PURE__*/jsxs("div", _objectSpread$j(_objectSpread$j({}, droppableProps), {}, {
|
|
385
407
|
className: "space-y-2",
|
|
386
408
|
ref: innerRef,
|
|
387
409
|
children: [questions.map(function (question, index) {
|
|
@@ -396,20 +418,30 @@ var Questions = function Questions(_ref) {
|
|
|
396
418
|
var draggableProps = _ref3.draggableProps,
|
|
397
419
|
dragHandleProps = _ref3.dragHandleProps,
|
|
398
420
|
innerRef = _ref3.innerRef;
|
|
399
|
-
return /*#__PURE__*/
|
|
421
|
+
return /*#__PURE__*/jsxs("div", _objectSpread$j(_objectSpread$j({}, draggableProps), {}, {
|
|
422
|
+
className: "flex items-center gap-1",
|
|
400
423
|
ref: innerRef,
|
|
401
|
-
children: /*#__PURE__*/jsx(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
424
|
+
children: [canManageQuestions && /*#__PURE__*/jsx("span", _objectSpread$j(_objectSpread$j({}, dragHandleProps), {}, {
|
|
425
|
+
className: "neeto-ui-text-gray-400 hover:neeto-ui-text-gray-500 shrink-0 cursor-grab transition-all duration-300 ease-in-out",
|
|
426
|
+
"data-testid": "question-card-drag-handle",
|
|
427
|
+
children: /*#__PURE__*/jsx(Equals, {
|
|
428
|
+
size: 16
|
|
429
|
+
})
|
|
430
|
+
})), /*#__PURE__*/jsx("div", {
|
|
431
|
+
className: "min-w-0 grow",
|
|
432
|
+
children: /*#__PURE__*/jsx(Card, {
|
|
433
|
+
allQuestionKinds: allQuestionKinds,
|
|
434
|
+
canManageQuestions: canManageQuestions,
|
|
435
|
+
getActiveKindDetails: getActiveKindDetails,
|
|
436
|
+
onClone: onClone,
|
|
437
|
+
onEdit: onEdit,
|
|
438
|
+
onSelect: onSelect,
|
|
439
|
+
question: question,
|
|
440
|
+
extraMenuItems: (_getQuestionMenuExtra = getQuestionMenuExtras === null || getQuestionMenuExtras === void 0 ? void 0 : getQuestionMenuExtras(question)) !== null && _getQuestionMenuExtra !== void 0 ? _getQuestionMenuExtra : [],
|
|
441
|
+
isActive: equals(selectedQuestion, question),
|
|
442
|
+
onDelete: isDeletable(question) && onDelete
|
|
443
|
+
})
|
|
444
|
+
})]
|
|
413
445
|
}));
|
|
414
446
|
});
|
|
415
447
|
}), placeholder]
|
|
@@ -431,8 +463,8 @@ var arrayHelpers = {
|
|
|
431
463
|
};
|
|
432
464
|
|
|
433
465
|
var _excluded$b = ["fields"];
|
|
434
|
-
function ownKeys$
|
|
435
|
-
function _objectSpread$
|
|
466
|
+
function ownKeys$i(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; }
|
|
467
|
+
function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
436
468
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
437
469
|
return includes(question === null || question === void 0 ? void 0 : question.kind, SELECTABLE_KINDS);
|
|
438
470
|
};
|
|
@@ -517,7 +549,7 @@ var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
|
517
549
|
var nextItems = _toConsumableArray(items);
|
|
518
550
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
519
551
|
var orderedItems = nextItems.map(function (item, index) {
|
|
520
|
-
return _objectSpread$
|
|
552
|
+
return _objectSpread$i(_objectSpread$i({}, item), {}, {
|
|
521
553
|
displayOrder: index
|
|
522
554
|
});
|
|
523
555
|
});
|
|
@@ -539,7 +571,7 @@ var createFieldData = function createFieldData(_ref5) {
|
|
|
539
571
|
selectedLanguage: selectedLanguage,
|
|
540
572
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
541
573
|
});
|
|
542
|
-
return _objectSpread$
|
|
574
|
+
return _objectSpread$i(_objectSpread$i(_objectSpread$i({}, modifiedDefaultValues), {}, {
|
|
543
575
|
metadata: metadata
|
|
544
576
|
}, typeof isRequired === "boolean" && {
|
|
545
577
|
isRequired: isRequired
|
|
@@ -571,7 +603,7 @@ var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
|
571
603
|
var newQuestionLabel = isRichTextQuestion(kind) ? label : t("neetoForm.common.clonedElementLabel", {
|
|
572
604
|
label: label
|
|
573
605
|
});
|
|
574
|
-
return _objectSpread$
|
|
606
|
+
return _objectSpread$i(_objectSpread$i({}, defaultAttributes), {}, {
|
|
575
607
|
isRequired: isRequired,
|
|
576
608
|
kind: kind,
|
|
577
609
|
label: newQuestionLabel,
|
|
@@ -684,9 +716,34 @@ var useHelpDoc = function useHelpDoc(key) {
|
|
|
684
716
|
return useBuildFormStore(path(["formState", "helpDocUrls", key]));
|
|
685
717
|
};
|
|
686
718
|
|
|
719
|
+
var KindOption = function KindOption(_ref) {
|
|
720
|
+
var label = _ref.label,
|
|
721
|
+
description = _ref.description,
|
|
722
|
+
Icon = _ref.icon;
|
|
723
|
+
return /*#__PURE__*/jsxs("div", {
|
|
724
|
+
className: "flex items-start gap-2",
|
|
725
|
+
children: [Icon && /*#__PURE__*/jsx(Icon, {
|
|
726
|
+
className: "neeto-ui-text-gray-700 mt-0.5 shrink-0",
|
|
727
|
+
"data-testid": "kind-option-icon",
|
|
728
|
+
size: 16
|
|
729
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
730
|
+
className: "flex min-w-0 flex-col",
|
|
731
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
732
|
+
style: "body2",
|
|
733
|
+
children: label
|
|
734
|
+
}), description && /*#__PURE__*/jsx(Typography, {
|
|
735
|
+
className: "neeto-ui-text-gray-600 mt-0.5",
|
|
736
|
+
"data-testid": "kind-option-description",
|
|
737
|
+
style: "body3",
|
|
738
|
+
children: description
|
|
739
|
+
})]
|
|
740
|
+
})]
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
|
|
687
744
|
var _excluded$a = ["label", "name"];
|
|
688
|
-
function ownKeys$
|
|
689
|
-
function _objectSpread$
|
|
745
|
+
function ownKeys$h(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; }
|
|
746
|
+
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
690
747
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
691
748
|
var label = _ref.label,
|
|
692
749
|
name = _ref.name,
|
|
@@ -705,7 +762,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
705
762
|
var end = element.value.length;
|
|
706
763
|
element.setSelectionRange(end, end);
|
|
707
764
|
};
|
|
708
|
-
return /*#__PURE__*/jsx(Textarea$1, _objectSpread$
|
|
765
|
+
return /*#__PURE__*/jsx(Textarea$1, _objectSpread$h({
|
|
709
766
|
label: label,
|
|
710
767
|
name: name,
|
|
711
768
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -719,8 +776,8 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
719
776
|
}, otherProps));
|
|
720
777
|
};
|
|
721
778
|
|
|
722
|
-
function ownKeys$
|
|
723
|
-
function _objectSpread$
|
|
779
|
+
function ownKeys$g(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; }
|
|
780
|
+
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
724
781
|
var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
725
782
|
var kind = _ref.kind,
|
|
726
783
|
isLabelDisabled = _ref.isLabelDisabled,
|
|
@@ -734,14 +791,14 @@ var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
|
734
791
|
var shouldShowPlaceholder = includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
|
|
735
792
|
return /*#__PURE__*/jsxs("div", {
|
|
736
793
|
className: "space-y-4",
|
|
737
|
-
children: [/*#__PURE__*/jsx(FormikAdaptiveInput, _objectSpread$
|
|
794
|
+
children: [/*#__PURE__*/jsx(FormikAdaptiveInput, _objectSpread$g({
|
|
738
795
|
required: true,
|
|
739
796
|
disabled: isLabelDisabled,
|
|
740
797
|
label: t("neetoForm.questions.common.questionFields.field.question"),
|
|
741
798
|
name: "label",
|
|
742
799
|
placeholder: DEFAULT_PLACEHOLDERS[kind],
|
|
743
800
|
onChange: withEventTargetValue(handleLabelChange)
|
|
744
|
-
}, labelProps)), shouldShowPlaceholder && /*#__PURE__*/jsx(FormikAdaptiveInput, _objectSpread$
|
|
801
|
+
}, labelProps)), shouldShowPlaceholder && /*#__PURE__*/jsx(FormikAdaptiveInput, _objectSpread$g({
|
|
745
802
|
className: "neeto-form-nano-placeholder-input neeto-form-nano-placeholder-input-".concat(kind),
|
|
746
803
|
name: "placeholder",
|
|
747
804
|
label: t("neetoForm.questions.common.questionFields.field.placeholder")
|
|
@@ -749,8 +806,8 @@ var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
|
749
806
|
});
|
|
750
807
|
};
|
|
751
808
|
|
|
752
|
-
function ownKeys$
|
|
753
|
-
function _objectSpread$
|
|
809
|
+
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; }
|
|
810
|
+
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; }
|
|
754
811
|
var Name = function Name(_ref) {
|
|
755
812
|
var isLabelDisabled = _ref.isLabelDisabled,
|
|
756
813
|
_handleLabelChange = _ref.handleLabelChange;
|
|
@@ -770,7 +827,7 @@ var Name = function Name(_ref) {
|
|
|
770
827
|
label: t("neetoForm.common.splitAsFirstAndLastNames"),
|
|
771
828
|
name: "isSplitMode"
|
|
772
829
|
}), isSplitMode && !usesCustomSubmissionComponent ? /*#__PURE__*/jsxs(Fragment, {
|
|
773
|
-
children: [/*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$
|
|
830
|
+
children: [/*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$f(_objectSpread$f({}, commonProps), {}, {
|
|
774
831
|
handleLabelChange: function handleLabelChange(value) {
|
|
775
832
|
return _handleLabelChange(value, LABEL_FIELDS.FIRST_NAME);
|
|
776
833
|
},
|
|
@@ -782,7 +839,7 @@ var Name = function Name(_ref) {
|
|
|
782
839
|
label: t("neetoForm.questions.common.questionFields.field.firstNamePlaceholder"),
|
|
783
840
|
name: "firstNamePlaceholder"
|
|
784
841
|
}
|
|
785
|
-
})), /*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$
|
|
842
|
+
})), /*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$f(_objectSpread$f({}, commonProps), {}, {
|
|
786
843
|
handleLabelChange: function handleLabelChange(value) {
|
|
787
844
|
return _handleLabelChange(value, LABEL_FIELDS.LAST_NAME);
|
|
788
845
|
},
|
|
@@ -795,7 +852,7 @@ var Name = function Name(_ref) {
|
|
|
795
852
|
name: "lastNamePlaceholder"
|
|
796
853
|
}
|
|
797
854
|
}))]
|
|
798
|
-
}) : /*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$
|
|
855
|
+
}) : /*#__PURE__*/jsx(LabelWithPlaceholder, _objectSpread$f(_objectSpread$f({}, commonProps), {}, {
|
|
799
856
|
labelProps: {
|
|
800
857
|
name: LABEL_FIELDS.FULL_NAME
|
|
801
858
|
},
|
|
@@ -940,8 +997,8 @@ var RequiredSwitch = withT(function (_ref) {
|
|
|
940
997
|
});
|
|
941
998
|
|
|
942
999
|
var _excluded$9 = ["maxLength"];
|
|
943
|
-
function ownKeys$
|
|
944
|
-
function _objectSpread$
|
|
1000
|
+
function ownKeys$e(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; }
|
|
1001
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
945
1002
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
946
1003
|
var maxLength = _ref.maxLength,
|
|
947
1004
|
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
@@ -955,7 +1012,7 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
955
1012
|
}
|
|
956
1013
|
}, [value, maxLength, setValue]);
|
|
957
1014
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
958
|
-
return /*#__PURE__*/jsx(Input, _objectSpread$
|
|
1015
|
+
return /*#__PURE__*/jsx(Input, _objectSpread$e(_objectSpread$e({}, props), shouldShowMaxLength && {
|
|
959
1016
|
maxLength: maxLength
|
|
960
1017
|
}));
|
|
961
1018
|
};
|
|
@@ -1015,6 +1072,8 @@ var Textarea = function Textarea() {
|
|
|
1015
1072
|
});
|
|
1016
1073
|
};
|
|
1017
1074
|
|
|
1075
|
+
function ownKeys$d(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; }
|
|
1076
|
+
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1018
1077
|
var Form$1 = function Form(_ref) {
|
|
1019
1078
|
var questions = _ref.questions,
|
|
1020
1079
|
initialFocusRef = _ref.initialFocusRef,
|
|
@@ -1136,10 +1195,15 @@ var Form$1 = function Form(_ref) {
|
|
|
1136
1195
|
isClearable: true,
|
|
1137
1196
|
isSearchable: true,
|
|
1138
1197
|
defaultValue: buildDefaultValueForKind(questionKind),
|
|
1198
|
+
filterOption: filterKindOption,
|
|
1139
1199
|
innerRef: initialFocusRef,
|
|
1140
1200
|
isDisabled: isEdit,
|
|
1141
1201
|
name: "kind",
|
|
1142
1202
|
options: buildKindOptions(questionKinds),
|
|
1203
|
+
formatOptionLabel: function formatOptionLabel(option, _ref3) {
|
|
1204
|
+
var context = _ref3.context;
|
|
1205
|
+
return context === "menu" ? /*#__PURE__*/jsx(KindOption, _objectSpread$d({}, option)) : option.label;
|
|
1206
|
+
},
|
|
1143
1207
|
label: t("neetoForm.questions.common.questionFields.field.questionType"),
|
|
1144
1208
|
onChange: handleKindChange
|
|
1145
1209
|
}), isRichTextQuestion(kind) ? /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -2644,16 +2708,31 @@ var getQuestionKind = function getQuestionKind(questionKinds, pattern) {
|
|
|
2644
2708
|
var buildKindOptions = function buildKindOptions(kinds) {
|
|
2645
2709
|
return kinds.map(function (_ref3) {
|
|
2646
2710
|
var label = _ref3.label,
|
|
2647
|
-
type = _ref3.type
|
|
2711
|
+
type = _ref3.type,
|
|
2712
|
+
icon = _ref3.icon,
|
|
2713
|
+
description = _ref3.description,
|
|
2714
|
+
searchTerms = _ref3.searchTerms;
|
|
2648
2715
|
return {
|
|
2649
2716
|
label: label,
|
|
2650
2717
|
value: transformValueForOption({
|
|
2651
2718
|
label: label,
|
|
2652
2719
|
type: type
|
|
2653
|
-
})
|
|
2720
|
+
}),
|
|
2721
|
+
icon: icon,
|
|
2722
|
+
description: description,
|
|
2723
|
+
searchTerms: searchTerms
|
|
2654
2724
|
};
|
|
2655
2725
|
});
|
|
2656
2726
|
};
|
|
2727
|
+
var filterKindOption = function filterKindOption(option, rawInput) {
|
|
2728
|
+
var _option$data$searchTe, _option$data;
|
|
2729
|
+
var query = rawInput === null || rawInput === void 0 ? void 0 : rawInput.trim().toLowerCase();
|
|
2730
|
+
if (!query) return true;
|
|
2731
|
+
var searchTerms = (_option$data$searchTe = (_option$data = option.data) === null || _option$data === void 0 ? void 0 : _option$data.searchTerms) !== null && _option$data$searchTe !== void 0 ? _option$data$searchTe : [];
|
|
2732
|
+
return searchTerms.some(function (term) {
|
|
2733
|
+
return term.includes(query);
|
|
2734
|
+
});
|
|
2735
|
+
};
|
|
2657
2736
|
var extractKindFromOption = pipe(split("-"), last);
|
|
2658
2737
|
var buildDefaultValueForKind = function buildDefaultValueForKind(questionKind) {
|
|
2659
2738
|
return isPresent(questionKind) ? {
|