@bigbinary/neeto-form-frontend 4.1.9 → 4.2.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.
- package/app/javascript/src/translations/en.json +5 -1
- package/dist/BuildForm.js +103 -60
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +5 -4
- package/dist/ExternalForm.js.map +1 -1
- package/dist/Submission.js +2 -2
- package/dist/Submission.js.map +1 -1
- package/dist/UrlBuilder.js +3 -2
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-BwhLCvEE.js → buildForm-CooylMLL.js} +3 -2
- package/dist/buildForm-CooylMLL.js.map +1 -0
- package/dist/{buildForm-CsVQHcC7.js → buildForm-DcE5kFvR.js} +3 -2
- package/dist/buildForm-DcE5kFvR.js.map +1 -0
- package/dist/cjs/BuildForm.js +103 -60
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +5 -4
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/Submission.js +2 -2
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +3 -2
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/{constants-DXeRH2r2.js → constants-BjWWA3Oq.js} +11 -2
- package/dist/constants-BjWWA3Oq.js.map +1 -0
- package/dist/{constants-D0zli_cv.js → constants-QPLZ_r-D.js} +10 -3
- package/dist/constants-QPLZ_r-D.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/{utils-C-ermU02.js → utils-BwFLBXs2.js} +114 -39
- package/dist/utils-BwFLBXs2.js.map +1 -0
- package/dist/{utils-CdeIdZRi.js → utils-GRfGBny0.js} +114 -39
- package/dist/utils-GRfGBny0.js.map +1 -0
- package/package.json +17 -17
- package/dist/buildForm-BwhLCvEE.js.map +0 -1
- package/dist/buildForm-CsVQHcC7.js.map +0 -1
- package/dist/constants-D0zli_cv.js.map +0 -1
- package/dist/constants-DXeRH2r2.js.map +0 -1
- package/dist/utils-C-ermU02.js.map +0 -1
- package/dist/utils-CdeIdZRi.js.map +0 -1
package/dist/cjs/BuildForm.js
CHANGED
|
@@ -6,13 +6,13 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
6
6
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
7
7
|
var ramda = require('ramda');
|
|
8
8
|
var constants = require('../constants-C9wKMfgo.js');
|
|
9
|
-
var constants$1 = require('../constants-
|
|
9
|
+
var constants$1 = require('../constants-BjWWA3Oq.js');
|
|
10
10
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var dnd = require('@hello-pangea/dnd');
|
|
13
13
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
14
14
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
15
|
-
var buildForm = require('../buildForm-
|
|
15
|
+
var buildForm = require('../buildForm-CooylMLL.js');
|
|
16
16
|
var shallow = require('zustand/shallow');
|
|
17
17
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
18
18
|
var reactI18next = require('react-i18next');
|
|
@@ -55,6 +55,7 @@ var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
|
55
55
|
var Checkbox$1 = require('@bigbinary/neetoui/formik/Checkbox');
|
|
56
56
|
var Checkbox = require('@bigbinary/neetoui/Checkbox');
|
|
57
57
|
var OptionFields = require('@bigbinary/neeto-molecules/OptionFields');
|
|
58
|
+
var Slider = require('@bigbinary/neetoui/Slider');
|
|
58
59
|
require('@bigbinary/neeto-commons-frontend/constants');
|
|
59
60
|
require('axios');
|
|
60
61
|
require('dompurify');
|
|
@@ -161,14 +162,14 @@ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
|
|
|
161
162
|
onClose: onClose,
|
|
162
163
|
children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
|
|
163
164
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
164
|
-
"data-
|
|
165
|
+
"data-testid": "delete-sms-reminder-modal-header",
|
|
165
166
|
style: "h2",
|
|
166
167
|
weight: "medium",
|
|
167
168
|
children: ramda.path(["smsReminder", "deleteModal", "title"], hostSpecificData)
|
|
168
169
|
})
|
|
169
170
|
}), /*#__PURE__*/jsxRuntime.jsx(Modal.Body, {
|
|
170
171
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
171
|
-
"data-
|
|
172
|
+
"data-testid": "delete-sms-reminder-modal-description",
|
|
172
173
|
style: "body2",
|
|
173
174
|
children: ramda.path(["smsReminder", "deleteModal", "description"], hostSpecificData)
|
|
174
175
|
})
|
|
@@ -230,7 +231,7 @@ var Overview = function Overview(_ref) {
|
|
|
230
231
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
231
232
|
className: "flex items-center justify-between",
|
|
232
233
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
233
|
-
"data-
|
|
234
|
+
"data-testid": "neeto-form-engine-overview-title",
|
|
234
235
|
lineHeight: "neeto-ui-leading-normal",
|
|
235
236
|
style: "h2",
|
|
236
237
|
weight: "neeto-ui-font-semibold",
|
|
@@ -252,7 +253,7 @@ var Overview = function Overview(_ref) {
|
|
|
252
253
|
})]
|
|
253
254
|
})]
|
|
254
255
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
255
|
-
"data-
|
|
256
|
+
"data-testid": "neeto-form-engine-overview-description",
|
|
256
257
|
style: "body2",
|
|
257
258
|
children: description
|
|
258
259
|
})]
|
|
@@ -289,7 +290,7 @@ var Card = function Card(_ref) {
|
|
|
289
290
|
setIsTooltipEnabled(constants$1.isElementOverflowing(element));
|
|
290
291
|
}, [questionLabel]);
|
|
291
292
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
292
|
-
"data-
|
|
293
|
+
"data-testid": "neeto-form-engine-".concat(neetoCist.slugify(questionLabel)),
|
|
293
294
|
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-1 border p-2", {
|
|
294
295
|
"neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
|
|
295
296
|
}),
|
|
@@ -306,7 +307,7 @@ var Card = function Card(_ref) {
|
|
|
306
307
|
position: "top",
|
|
307
308
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
308
309
|
className: "line-clamp-2 min-w-0 grow truncate break-words",
|
|
309
|
-
"data-
|
|
310
|
+
"data-testid": "".concat(neetoCist.slugify(questionLabel), "-question-card-label"),
|
|
310
311
|
lineHeight: "snug",
|
|
311
312
|
ref: questionLabelRef,
|
|
312
313
|
style: "body2",
|
|
@@ -322,18 +323,18 @@ var Card = function Card(_ref) {
|
|
|
322
323
|
strategy: "fixed"
|
|
323
324
|
},
|
|
324
325
|
menuItems: [{
|
|
325
|
-
"data-
|
|
326
|
+
"data-testid": "edit-question",
|
|
326
327
|
key: "edit",
|
|
327
328
|
label: t("neetoForm.common.edit"),
|
|
328
329
|
onClick: onEdit
|
|
329
330
|
}, {
|
|
330
|
-
"data-
|
|
331
|
+
"data-testid": "clone-question",
|
|
331
332
|
key: "clone",
|
|
332
333
|
label: t("neetoForm.common.clone"),
|
|
333
334
|
isVisible: !isSingular && index.isFunction(onClone),
|
|
334
335
|
onClick: onClone
|
|
335
336
|
}, {
|
|
336
|
-
"data-
|
|
337
|
+
"data-testid": "delete-question",
|
|
337
338
|
key: "delete",
|
|
338
339
|
label: t("neetoForm.common.delete"),
|
|
339
340
|
isVisible: index.isFunction(onDelete),
|
|
@@ -811,13 +812,13 @@ var Properties = function Properties(_ref) {
|
|
|
811
812
|
var Block = function Block(_ref) {
|
|
812
813
|
var title = _ref.title,
|
|
813
814
|
children = _ref.children,
|
|
814
|
-
|
|
815
|
+
dataTestid = _ref.dataTestid;
|
|
815
816
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
816
817
|
className: "mt-4 space-y-4",
|
|
817
|
-
"data-
|
|
818
|
+
"data-testid": dataTestid,
|
|
818
819
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
819
820
|
className: "flex items-center justify-between",
|
|
820
|
-
"data-
|
|
821
|
+
"data-testid": "properties-header",
|
|
821
822
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
822
823
|
lineHeight: "normal",
|
|
823
824
|
style: "body1",
|
|
@@ -1105,7 +1106,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1105
1106
|
kind: kind,
|
|
1106
1107
|
questionProps: questionProps
|
|
1107
1108
|
}), isSettingsBlockVisible && /*#__PURE__*/jsxRuntime.jsxs(Block, {
|
|
1108
|
-
|
|
1109
|
+
dataTestid: "settings-card",
|
|
1109
1110
|
title: t("neetoForm.common.settings"),
|
|
1110
1111
|
children: [!isImmutable && /*#__PURE__*/jsxRuntime.jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1111
1112
|
label: t("neetoForm.common.hideQuestion"),
|
|
@@ -1118,7 +1119,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1118
1119
|
})]
|
|
1119
1120
|
}), (shouldShowFieldCode || canMarkResponsesAsReadOnly) && /*#__PURE__*/jsxRuntime.jsx(Accordion, {
|
|
1120
1121
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
1121
|
-
"data-
|
|
1122
|
+
"data-testid": "advanced-properties-card",
|
|
1122
1123
|
defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
|
|
1123
1124
|
,
|
|
1124
1125
|
children: /*#__PURE__*/jsxRuntime.jsx(Accordion.Item, {
|
|
@@ -1255,7 +1256,7 @@ var Add = function Add(_ref) {
|
|
|
1255
1256
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1256
1257
|
children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
|
|
1257
1258
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1258
|
-
"data-
|
|
1259
|
+
"data-testid": "add-question-pane-header",
|
|
1259
1260
|
style: "h2",
|
|
1260
1261
|
children: t("neetoForm.questions.common.primaryPanel.addQuestion")
|
|
1261
1262
|
})
|
|
@@ -1332,7 +1333,7 @@ var Edit = function Edit(_ref) {
|
|
|
1332
1333
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1333
1334
|
children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
|
|
1334
1335
|
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1335
|
-
"data-
|
|
1336
|
+
"data-testid": "edit-question-pane-header",
|
|
1336
1337
|
style: "h2",
|
|
1337
1338
|
children: t("neetoForm.questions.common.editQuestion")
|
|
1338
1339
|
})
|
|
@@ -1389,11 +1390,11 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1389
1390
|
otherProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
1390
1391
|
return /*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
1391
1392
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1392
|
-
"data-
|
|
1393
|
+
"data-testid": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-toggle-label"),
|
|
1393
1394
|
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, otherProps), {}, {
|
|
1394
1395
|
name: name
|
|
1395
1396
|
})), {}, {
|
|
1396
|
-
"data-
|
|
1397
|
+
"data-testid": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-switch")
|
|
1397
1398
|
})), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1398
1399
|
component: "span",
|
|
1399
1400
|
style: "body1",
|
|
@@ -1455,7 +1456,7 @@ var STYLES = {
|
|
|
1455
1456
|
};
|
|
1456
1457
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1457
1458
|
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1458
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1459
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "".concat(utils.hyphenize(props.data.label), "-remove-icon"))),
|
|
1459
1460
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1460
1461
|
size: 16
|
|
1461
1462
|
})
|
|
@@ -1476,7 +1477,7 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1476
1477
|
rest = _children.slice(1);
|
|
1477
1478
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1478
1479
|
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1479
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1480
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "multi-domain-input-container")),
|
|
1480
1481
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
1481
1482
|
style: "secondary",
|
|
1482
1483
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1487,7 +1488,7 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1487
1488
|
};
|
|
1488
1489
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1489
1490
|
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1490
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1491
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "clear-all-button")),
|
|
1491
1492
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1492
1493
|
className: "cursor-pointer",
|
|
1493
1494
|
size: 16
|
|
@@ -1608,7 +1609,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1608
1609
|
className: "neeto-ui-email-input__label-wrapper",
|
|
1609
1610
|
children: /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
1610
1611
|
className: "neeto-ui-email-input__label",
|
|
1611
|
-
"data-
|
|
1612
|
+
"data-testid": "".concat(utils.hyphenize(label), "-input-label"),
|
|
1612
1613
|
children: label
|
|
1613
1614
|
})
|
|
1614
1615
|
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$3({
|
|
@@ -1641,7 +1642,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1641
1642
|
value: value
|
|
1642
1643
|
}, otherProps))), !!error && /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
1643
1644
|
className: "neeto-ui-input__error",
|
|
1644
|
-
"data-
|
|
1645
|
+
"data-testid": "".concat(utils.hyphenize(label), "-input-error"),
|
|
1645
1646
|
children: [formatErrorMessage(error), isFilterDomainsLinkVisible && /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1646
1647
|
className: "neeto-ui-font-semibold cursor-pointer",
|
|
1647
1648
|
onClick: handleFilterDomains,
|
|
@@ -1649,7 +1650,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1649
1650
|
})]
|
|
1650
1651
|
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
1651
1652
|
className: "neeto-ui-input__help-text",
|
|
1652
|
-
"data-
|
|
1653
|
+
"data-testid": "".concat(utils.hyphenize(label), "-input-help"),
|
|
1653
1654
|
children: t("neetoForm.domainRestriction.helpText")
|
|
1654
1655
|
})]
|
|
1655
1656
|
});
|
|
@@ -1740,7 +1741,7 @@ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
|
|
|
1740
1741
|
popoverDescription = _mergeLeft.popoverDescription;
|
|
1741
1742
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1742
1743
|
className: "flex flex-col space-y-4",
|
|
1743
|
-
"data-
|
|
1744
|
+
"data-testid": "".concat(neetoCist.hyphenate(switchName), "-container"),
|
|
1744
1745
|
children: [/*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
|
|
1745
1746
|
name: switchName,
|
|
1746
1747
|
title: /*#__PURE__*/jsxRuntime.jsx(TitleWithHelpPopover, {
|
|
@@ -1764,7 +1765,7 @@ var VerifyEmails = function VerifyEmails() {
|
|
|
1764
1765
|
title = _mergeLeft.title,
|
|
1765
1766
|
popoverDescription = _mergeLeft.popoverDescription;
|
|
1766
1767
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1767
|
-
"data-
|
|
1768
|
+
"data-testid": "email-verification-switch-container",
|
|
1768
1769
|
children: /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1769
1770
|
name: "isVerificationEnabled",
|
|
1770
1771
|
label: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
@@ -1813,7 +1814,7 @@ var FileGroup = function FileGroup(_ref) {
|
|
|
1813
1814
|
checked: checked,
|
|
1814
1815
|
label: label,
|
|
1815
1816
|
name: name,
|
|
1816
|
-
"data-
|
|
1817
|
+
"data-testid": "neeto-form-engine-file-type-".concat(name),
|
|
1817
1818
|
id: name,
|
|
1818
1819
|
onChange: handleAllowedFileTypesChange
|
|
1819
1820
|
});
|
|
@@ -1895,12 +1896,17 @@ var Options = function Options(_ref) {
|
|
|
1895
1896
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1896
1897
|
t = _useTranslation.t;
|
|
1897
1898
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1898
|
-
var _store$formState;
|
|
1899
|
+
var _store$formState, _store$formState2;
|
|
1899
1900
|
return {
|
|
1900
|
-
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
1901
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1902
|
+
isPictureChoiceEnabled: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["isPictureChoiceEnabled"]
|
|
1901
1903
|
};
|
|
1902
1904
|
}, shallow.shallow),
|
|
1903
|
-
selectedLanguage = _useBuildFormStore.selectedLanguage
|
|
1905
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
1906
|
+
isPictureChoiceEnabled = _useBuildFormStore.isPictureChoiceEnabled;
|
|
1907
|
+
var _useFormikContext = formik.useFormikContext(),
|
|
1908
|
+
values = _useFormikContext.values,
|
|
1909
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1904
1910
|
var name = "optionsAttributes";
|
|
1905
1911
|
var _useField = formik.useField(name),
|
|
1906
1912
|
_useField2 = _slicedToArray(_useField, 3);
|
|
@@ -1919,24 +1925,56 @@ var Options = function Options(_ref) {
|
|
|
1919
1925
|
var isManageOptionDisabled = index.isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1920
1926
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1921
1927
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1928
|
+
var isDropdown = values.kind === constants.QUESTION_TYPES.DROPDOWN;
|
|
1929
|
+
var isPictureChoice = isPictureChoiceEnabled && !isDropdown && (values.isPictureChoice || constants$1.DEFAULT_CHOICE_QUESTION_ATTRIBUTES.isPictureChoice);
|
|
1930
|
+
var imageHeight = values.imageHeight || constants$1.DEFAULT_CHOICE_QUESTION_ATTRIBUTES.imageHeight;
|
|
1931
|
+
var handleImageHeightChange = function handleImageHeightChange(value) {
|
|
1932
|
+
setFieldValue("imageHeight", value);
|
|
1933
|
+
};
|
|
1922
1934
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1923
|
-
className: "w-full",
|
|
1924
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1935
|
+
className: "w-full space-y-4",
|
|
1936
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1937
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread$2(_objectSpread$2({
|
|
1938
|
+
className: "mb-2 block"
|
|
1939
|
+
}, optionLabelProps), {}, {
|
|
1940
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1941
|
+
})), /*#__PURE__*/jsxRuntime.jsx(OptionFields, {
|
|
1942
|
+
isPictureChoice: isPictureChoice,
|
|
1943
|
+
name: name,
|
|
1944
|
+
shouldDestroy: true,
|
|
1945
|
+
destroyFlagName: "_destroy",
|
|
1946
|
+
disabled: isManageOptionDisabled,
|
|
1947
|
+
draggable: !isManageOptionDisabled,
|
|
1948
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1949
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1950
|
+
isNewItemsPrefilled: constants$1.isDefaultLanguage(selectedLanguage),
|
|
1951
|
+
minOptions: constants$1.MINIMUM_OPTIONS,
|
|
1952
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1953
|
+
onChange: setOptionsAttributes
|
|
1954
|
+
})]
|
|
1955
|
+
}), !isDropdown && isPictureChoiceEnabled && /*#__PURE__*/jsxRuntime.jsxs(Block, {
|
|
1956
|
+
title: t("neetoForm.questions.common.questionFields.field.pictureChoiceSettings"),
|
|
1957
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1958
|
+
name: "isPictureChoice",
|
|
1959
|
+
label: t("neetoForm.questions.common.questionFields.field.addPicturesToOptions")
|
|
1960
|
+
}), isPictureChoice && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1961
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1962
|
+
name: "shouldFitImages",
|
|
1963
|
+
label: t("neetoForm.questions.common.questionFields.field.fitImages")
|
|
1964
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1965
|
+
className: "mt-4",
|
|
1966
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1967
|
+
style: "body2",
|
|
1968
|
+
weight: "medium",
|
|
1969
|
+
children: t("neetoForm.questions.common.questionFields.field.imageHeight")
|
|
1970
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Slider, {
|
|
1971
|
+
max: constants$1.IMAGE_HEIGHT_SLIDER_DEFAULTS.max,
|
|
1972
|
+
min: constants$1.IMAGE_HEIGHT_SLIDER_DEFAULTS.min,
|
|
1973
|
+
value: imageHeight,
|
|
1974
|
+
onChange: handleImageHeightChange
|
|
1975
|
+
})]
|
|
1976
|
+
})]
|
|
1977
|
+
})]
|
|
1940
1978
|
})]
|
|
1941
1979
|
});
|
|
1942
1980
|
};
|
|
@@ -1965,7 +2003,7 @@ var Rating = function Rating() {
|
|
|
1965
2003
|
size: 48
|
|
1966
2004
|
}), /*#__PURE__*/jsxRuntime.jsx(InputWithMaxLength, {
|
|
1967
2005
|
name: name,
|
|
1968
|
-
"data-
|
|
2006
|
+
"data-testid": "neeto-form-engine-".concat(neetoCist.hyphenate(name))
|
|
1969
2007
|
})]
|
|
1970
2008
|
}, name);
|
|
1971
2009
|
})
|
|
@@ -1989,7 +2027,7 @@ var StarRating = function StarRating() {
|
|
|
1989
2027
|
className: "flex space-x-4",
|
|
1990
2028
|
children: [/*#__PURE__*/jsxRuntime.jsx(Select, {
|
|
1991
2029
|
className: "w-1/2",
|
|
1992
|
-
"data-
|
|
2030
|
+
"data-testid": "neeto-form-engine-star-rating-min-value",
|
|
1993
2031
|
label: t("neetoForm.common.start"),
|
|
1994
2032
|
name: "minValue",
|
|
1995
2033
|
options: constants$1.STAR_RATING_MIN_VALUE_OPTIONS,
|
|
@@ -1998,7 +2036,7 @@ var StarRating = function StarRating() {
|
|
|
1998
2036
|
}
|
|
1999
2037
|
}), /*#__PURE__*/jsxRuntime.jsx(Select, {
|
|
2000
2038
|
className: "w-1/2",
|
|
2001
|
-
"data-
|
|
2039
|
+
"data-testid": "neeto-form-engine-star-rating-max-value",
|
|
2002
2040
|
label: t("neetoForm.common.end"),
|
|
2003
2041
|
name: "maxValue",
|
|
2004
2042
|
options: constants$1.STAR_RATING_MAX_VALUE_OPTIONS,
|
|
@@ -2016,7 +2054,7 @@ var StarRating = function StarRating() {
|
|
|
2016
2054
|
IconType = _ref2[1];
|
|
2017
2055
|
var isActive = name === iconType;
|
|
2018
2056
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2019
|
-
"data-
|
|
2057
|
+
"data-testid": "neeto-form-engine-rating-icon-".concat(name),
|
|
2020
2058
|
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", {
|
|
2021
2059
|
"neeto-ui-text-gray-800 neeto-ui-bg-gray-200": !isActive,
|
|
2022
2060
|
"neeto-ui-text-white neeto-ui-bg-gray-800": isActive
|
|
@@ -2100,7 +2138,7 @@ var buildDefaultValueForKind = function buildDefaultValueForKind(questionKind) {
|
|
|
2100
2138
|
var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
|
|
2101
2139
|
return helpUrl ? {
|
|
2102
2140
|
helpIconProps: {
|
|
2103
|
-
"data-
|
|
2141
|
+
"data-testid": "help-popover-button",
|
|
2104
2142
|
popoverProps: {
|
|
2105
2143
|
description: i18next.t("neetoForm.questions.common.questionFields.field.hideQuestionHelpDescription"),
|
|
2106
2144
|
helpLinkProps: {
|
|
@@ -2114,7 +2152,7 @@ var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
|
|
|
2114
2152
|
var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHostSwitchLabelProps(helpUrl) {
|
|
2115
2153
|
return {
|
|
2116
2154
|
helpIconProps: {
|
|
2117
|
-
"data-
|
|
2155
|
+
"data-testid": "help-popover-button",
|
|
2118
2156
|
popoverProps: {
|
|
2119
2157
|
description: i18next.t("neetoForm.questions.common.questionFields.field.responseVisibleOnlyToHostHelpDescription"),
|
|
2120
2158
|
helpLinkProps: {
|
|
@@ -2128,7 +2166,7 @@ var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHo
|
|
|
2128
2166
|
var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
2129
2167
|
return {
|
|
2130
2168
|
helpIconProps: {
|
|
2131
|
-
"data-
|
|
2169
|
+
"data-testid": "help-popover-button",
|
|
2132
2170
|
popoverProps: {
|
|
2133
2171
|
description: i18next.t("neetoForm.questions.common.questionFields.field.readOnlyHelpDescription"),
|
|
2134
2172
|
helpLinkProps: helpUrl ? {
|
|
@@ -2209,7 +2247,8 @@ var Form = function Form(_ref) {
|
|
|
2209
2247
|
usesCustomSubmissionComponent = _ref.usesCustomSubmissionComponent,
|
|
2210
2248
|
questionsFromCache = _ref.questionsFromCache,
|
|
2211
2249
|
onMutateSuccess = _ref.onMutateSuccess,
|
|
2212
|
-
advancedFeatures = _ref.advancedFeatures
|
|
2250
|
+
advancedFeatures = _ref.advancedFeatures,
|
|
2251
|
+
isPictureChoiceEnabled = _ref.isPictureChoiceEnabled;
|
|
2213
2252
|
var containerRef = React.useRef();
|
|
2214
2253
|
var _useStateWithDependen = reactUtils.useStateWithDependency(questionsFromCache),
|
|
2215
2254
|
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
@@ -2283,9 +2322,10 @@ var Form = function Form(_ref) {
|
|
|
2283
2322
|
hostSpecificData: hostSpecificData,
|
|
2284
2323
|
onMutateSuccess: onMutateSuccess,
|
|
2285
2324
|
advancedFeatures: advancedFeatures,
|
|
2286
|
-
onLanguageChange: onLanguageChange
|
|
2325
|
+
onLanguageChange: onLanguageChange,
|
|
2326
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled
|
|
2287
2327
|
});
|
|
2288
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange]);
|
|
2328
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange, isPictureChoiceEnabled]);
|
|
2289
2329
|
var handleSelect = function handleSelect(question) {
|
|
2290
2330
|
setSelectedQuestion(question);
|
|
2291
2331
|
};
|
|
@@ -2468,7 +2508,9 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2468
2508
|
onMutateSuccess = _ref$onMutateSuccess === void 0 ? neetoCist.noop : _ref$onMutateSuccess,
|
|
2469
2509
|
hostSpecificData = _ref.hostSpecificData,
|
|
2470
2510
|
_ref$canManageQuestio = _ref.canManageQuestions,
|
|
2471
|
-
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio
|
|
2511
|
+
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio,
|
|
2512
|
+
_ref$isPictureChoiceE = _ref.isPictureChoiceEnabled,
|
|
2513
|
+
isPictureChoiceEnabled = _ref$isPictureChoiceE === void 0 ? false : _ref$isPictureChoiceE;
|
|
2472
2514
|
var queryClient = reactQuery.useQueryClient();
|
|
2473
2515
|
var _useForm = constants.useForm({
|
|
2474
2516
|
formId: id,
|
|
@@ -2520,6 +2562,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2520
2562
|
isDisabledFieldLabel: isDisabledFieldLabel,
|
|
2521
2563
|
isFormEnabled: isFormEnabled,
|
|
2522
2564
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2565
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled,
|
|
2523
2566
|
isRequiredField: isRequiredField,
|
|
2524
2567
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2525
2568
|
kindUniqueOn: kindUniqueOn,
|