@bigbinary/neeto-molecules 4.0.55 → 4.0.57
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/AuditLogs.js +3 -3
- package/dist/AuditLogs.js.map +1 -1
- package/dist/CalendarView.js +1 -1
- package/dist/{Chevron-DX-gOKBh.js → Chevron-DXA34GCh.js} +2 -2
- package/dist/{Chevron-DX-gOKBh.js.map → Chevron-DXA34GCh.js.map} +1 -1
- package/dist/{Columns-nz-M_1bb.js → Columns-DOnfhbIw.js} +48 -28
- package/dist/Columns-DOnfhbIw.js.map +1 -0
- package/dist/Columns.js +2 -1
- package/dist/Columns.js.map +1 -1
- package/dist/ConfigurePageSidebar.js +1 -1
- package/dist/FloatingActionMenu.js +1 -1
- package/dist/NeetoWidget.js +20 -13
- package/dist/NeetoWidget.js.map +1 -1
- package/dist/OptionFields.js +605 -471
- package/dist/OptionFields.js.map +1 -1
- package/dist/PageLoader.js +2 -2
- package/dist/PageLoader.js.map +1 -1
- package/dist/ShareRecordingPane.js +7 -4
- package/dist/ShareRecordingPane.js.map +1 -1
- package/dist/Sidebar.js +2 -1
- package/dist/Sidebar.js.map +1 -1
- package/dist/SubHeader.js +1 -1
- package/dist/Taxonomy.js +1 -1
- package/dist/cjs/AuditLogs.js +3 -3
- package/dist/cjs/AuditLogs.js.map +1 -1
- package/dist/cjs/CalendarView.js +1 -1
- package/dist/cjs/{Chevron-BF749Dye.js → Chevron-C5y6R4rr.js} +2 -2
- package/dist/cjs/{Chevron-BF749Dye.js.map → Chevron-C5y6R4rr.js.map} +1 -1
- package/dist/cjs/{Columns-B5HcheVn.js → Columns-0RbMPRF0.js} +45 -25
- package/dist/cjs/Columns-0RbMPRF0.js.map +1 -0
- package/dist/cjs/Columns.js +2 -1
- package/dist/cjs/Columns.js.map +1 -1
- package/dist/cjs/ConfigurePageSidebar.js +1 -1
- package/dist/cjs/FloatingActionMenu.js +1 -1
- package/dist/cjs/NeetoWidget.js +20 -13
- package/dist/cjs/NeetoWidget.js.map +1 -1
- package/dist/cjs/OptionFields.js +603 -469
- package/dist/cjs/OptionFields.js.map +1 -1
- package/dist/cjs/PageLoader.js +2 -2
- package/dist/cjs/PageLoader.js.map +1 -1
- package/dist/cjs/ShareRecordingPane.js +7 -4
- package/dist/cjs/ShareRecordingPane.js.map +1 -1
- package/dist/cjs/Sidebar.js +2 -1
- package/dist/cjs/Sidebar.js.map +1 -1
- package/dist/cjs/SubHeader.js +1 -1
- package/dist/cjs/Taxonomy.js +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +1 -1
- package/types/OptionFields.d.ts +3 -0
- package/types/ShareRecordingPane.d.ts +1 -0
- package/dist/Columns-nz-M_1bb.js.map +0 -1
- package/dist/cjs/Columns-B5HcheVn.js.map +0 -1
package/dist/cjs/OptionFields.js
CHANGED
|
@@ -15,17 +15,19 @@ var Textarea = require('@bigbinary/neetoui/Textarea');
|
|
|
15
15
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
16
16
|
var jsxRuntime = require('react/jsx-runtime');
|
|
17
17
|
var i18next = require('i18next');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
21
|
-
var Edit = require('@bigbinary/neeto-icons/Edit');
|
|
18
|
+
var Editor = require('@bigbinary/neeto-editor/Editor');
|
|
19
|
+
var Checkbox$1 = require('@bigbinary/neetoui/Checkbox');
|
|
22
20
|
var Drag = require('@bigbinary/neeto-icons/Drag');
|
|
21
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
23
22
|
var Copy = require('@bigbinary/neeto-icons/Copy');
|
|
24
23
|
var Delete = require('@bigbinary/neeto-icons/Delete');
|
|
25
|
-
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
26
|
-
var Textarea$1 = require('@bigbinary/neetoui/formik/Textarea');
|
|
27
24
|
var ImageUploader = require('@bigbinary/neeto-image-uploader-frontend/ImageUploader');
|
|
28
25
|
var classnames = require('classnames');
|
|
26
|
+
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
27
|
+
var Textarea$1 = require('@bigbinary/neetoui/formik/Textarea');
|
|
28
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
29
|
+
var injectCss = require('./inject-css-B6qYtOJe.js');
|
|
30
|
+
var Edit = require('@bigbinary/neeto-icons/Edit');
|
|
29
31
|
|
|
30
32
|
var BulkOptionModal = function BulkOptionModal(_ref) {
|
|
31
33
|
var isOpen = _ref.isOpen,
|
|
@@ -96,39 +98,407 @@ var BulkOptionModal = function BulkOptionModal(_ref) {
|
|
|
96
98
|
});
|
|
97
99
|
};
|
|
98
100
|
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
var Checkbox = function Checkbox(_ref) {
|
|
102
|
+
var name = _ref.name,
|
|
103
|
+
optionIndex = _ref.optionIndex;
|
|
104
|
+
var checkboxName = name.replace(".label", ".selected");
|
|
105
|
+
var _useField = formik.useField(checkboxName),
|
|
106
|
+
_useField2 = _slicedToArray(_useField, 3),
|
|
107
|
+
value = _useField2[0].value;
|
|
108
|
+
_useField2[1];
|
|
109
|
+
var setValue = _useField2[2].setValue;
|
|
110
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
111
|
+
className: "flex h-8 flex-shrink-0 items-center",
|
|
112
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Checkbox$1, {
|
|
113
|
+
checked: value || false,
|
|
114
|
+
"data-testid": "checkbox-option-".concat(optionIndex),
|
|
115
|
+
onChange: function onChange(e) {
|
|
116
|
+
setValue(e.target.checked);
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
});
|
|
111
120
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
|
|
122
|
+
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; }
|
|
123
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
124
|
+
var DragHandle = function DragHandle(props) {
|
|
125
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$8(_objectSpread$8({
|
|
126
|
+
className: "neeto-ui-text-gray-500 flex h-8 flex-shrink-0 cursor-grab items-center",
|
|
127
|
+
"data-cy": "drag-handle",
|
|
128
|
+
"data-testid": "drag-handle"
|
|
129
|
+
}, props), {}, {
|
|
130
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Drag, {
|
|
131
|
+
size: 16,
|
|
132
|
+
strokeWidth: 2
|
|
133
|
+
})
|
|
134
|
+
}));
|
|
121
135
|
};
|
|
122
136
|
|
|
123
|
-
var
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
var OptionActions = reactUtils.withT(function (_ref) {
|
|
138
|
+
var t = _ref.t,
|
|
139
|
+
disabled = _ref.disabled,
|
|
140
|
+
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
141
|
+
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
142
|
+
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
143
|
+
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
144
|
+
optionIndex = _ref.optionIndex,
|
|
145
|
+
id = _ref.id,
|
|
146
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
147
|
+
onClone = _ref.onClone,
|
|
148
|
+
onDelete = _ref.onDelete,
|
|
149
|
+
_ref$className = _ref.className,
|
|
150
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
|
151
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
152
|
+
className: "flex items-center gap-1 ".concat(className),
|
|
153
|
+
children: [!hideCloneOption && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
className: "p-0.5",
|
|
156
|
+
"data-cy": "clone-option-button-".concat(optionIndex),
|
|
157
|
+
"data-testid": "clone-option-button-".concat(optionIndex),
|
|
158
|
+
icon: Copy,
|
|
159
|
+
size: "small",
|
|
160
|
+
style: "text",
|
|
161
|
+
tooltipProps: {
|
|
162
|
+
content: t("neetoMolecules.common.actions.clone"),
|
|
163
|
+
position: "top",
|
|
164
|
+
touch: ["hold", 500]
|
|
165
|
+
},
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
return onClone(id);
|
|
168
|
+
}
|
|
169
|
+
}), !hideDeleteOption && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
170
|
+
disabled: disabled,
|
|
171
|
+
className: "p-0.5",
|
|
172
|
+
"data-cy": "delete-option-button-".concat(optionIndex),
|
|
173
|
+
"data-testid": "delete-option-button-".concat(optionIndex),
|
|
174
|
+
icon: Delete,
|
|
175
|
+
size: "small",
|
|
176
|
+
style: "text",
|
|
177
|
+
tooltipProps: {
|
|
178
|
+
content: t("neetoMolecules.common.actions.delete"),
|
|
179
|
+
position: "top",
|
|
180
|
+
touch: ["hold", 500]
|
|
181
|
+
},
|
|
182
|
+
onClick: function onClick() {
|
|
183
|
+
return onDelete(id, arrayHelpers);
|
|
184
|
+
}
|
|
185
|
+
})]
|
|
131
186
|
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
function ownKeys$7(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; }
|
|
190
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
191
|
+
var EditorOption = function EditorOption(_ref) {
|
|
192
|
+
var innerRef = _ref.innerRef,
|
|
193
|
+
draggableProps = _ref.draggableProps,
|
|
194
|
+
dragHandleProps = _ref.dragHandleProps,
|
|
195
|
+
isDraggable = _ref.isDraggable,
|
|
196
|
+
optionIndex = _ref.optionIndex,
|
|
197
|
+
isCheckboxEnabled = _ref.isCheckboxEnabled,
|
|
198
|
+
name = _ref.name,
|
|
199
|
+
disabled = _ref.disabled,
|
|
200
|
+
placeholder = _ref.placeholder,
|
|
201
|
+
shouldFocus = _ref.shouldFocus,
|
|
202
|
+
_onChange = _ref.onChange,
|
|
203
|
+
_onBlur = _ref.onBlur,
|
|
204
|
+
id = _ref.id,
|
|
205
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
206
|
+
hideCloneOption = _ref.hideCloneOption,
|
|
207
|
+
hideDeleteOption = _ref.hideDeleteOption,
|
|
208
|
+
onClone = _ref.onClone,
|
|
209
|
+
onDelete = _ref.onDelete;
|
|
210
|
+
var _useField = formik.useField(name),
|
|
211
|
+
_useField2 = _slicedToArray(_useField, 1),
|
|
212
|
+
field = _useField2[0];
|
|
213
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$7(_objectSpread$7({
|
|
214
|
+
ref: innerRef
|
|
215
|
+
}, _objectSpread$7(_objectSpread$7({}, draggableProps), dragHandleProps)), {}, {
|
|
216
|
+
"data-cy": "form-block-options",
|
|
217
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
218
|
+
className: "nf-input-options group relative mb-2 flex items-start gap-1",
|
|
219
|
+
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$7(_objectSpread$7({}, dragHandleProps), {}, {
|
|
220
|
+
"data-testid": "drag-handle-".concat(optionIndex)
|
|
221
|
+
})), isCheckboxEnabled && /*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
222
|
+
name: name,
|
|
223
|
+
optionIndex: optionIndex
|
|
224
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
225
|
+
className: "flex w-full items-start gap-2",
|
|
226
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
227
|
+
disabled: disabled,
|
|
228
|
+
name: name,
|
|
229
|
+
placeholder: placeholder,
|
|
230
|
+
autoFocus: shouldFocus,
|
|
231
|
+
className: "flex-1",
|
|
232
|
+
"data-cy": "editor-option-".concat(optionIndex),
|
|
233
|
+
"data-testid": "editor-option-".concat(optionIndex),
|
|
234
|
+
initialValue: field.value,
|
|
235
|
+
onChange: function onChange(value) {
|
|
236
|
+
return _onChange({
|
|
237
|
+
id: id,
|
|
238
|
+
value: value
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
onBlur: function onBlur(value) {
|
|
242
|
+
_onChange({
|
|
243
|
+
id: id,
|
|
244
|
+
value: value,
|
|
245
|
+
isOnBlur: true
|
|
246
|
+
});
|
|
247
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(id, value);
|
|
248
|
+
}
|
|
249
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
250
|
+
className: "absolute right-2 top-2",
|
|
251
|
+
children: /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
252
|
+
arrayHelpers: arrayHelpers,
|
|
253
|
+
disabled: disabled,
|
|
254
|
+
hideCloneOption: hideCloneOption,
|
|
255
|
+
hideDeleteOption: hideDeleteOption,
|
|
256
|
+
id: id,
|
|
257
|
+
onClone: onClone,
|
|
258
|
+
onDelete: onDelete,
|
|
259
|
+
optionIndex: optionIndex
|
|
260
|
+
})
|
|
261
|
+
})]
|
|
262
|
+
})]
|
|
263
|
+
})
|
|
264
|
+
}));
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
function ownKeys$6(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; }
|
|
268
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
269
|
+
var ImageOption = function ImageOption(_ref) {
|
|
270
|
+
var id = _ref.id,
|
|
271
|
+
name = _ref.name,
|
|
272
|
+
optionIndex = _ref.optionIndex,
|
|
273
|
+
disabled = _ref.disabled,
|
|
274
|
+
placeholder = _ref.placeholder,
|
|
275
|
+
shouldFocus = _ref.shouldFocus,
|
|
276
|
+
onKeyDown = _ref.onKeyDown,
|
|
277
|
+
_onChange = _ref.onChange,
|
|
278
|
+
_onBlur = _ref.onBlur,
|
|
279
|
+
onDelete = _ref.onDelete,
|
|
280
|
+
onClone = _ref.onClone,
|
|
281
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
282
|
+
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
283
|
+
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
284
|
+
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
285
|
+
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
286
|
+
innerRef = _ref.innerRef,
|
|
287
|
+
draggableProps = _ref.draggableProps,
|
|
288
|
+
dragHandleProps = _ref.dragHandleProps,
|
|
289
|
+
isDraggable = _ref.isDraggable,
|
|
290
|
+
isCheckboxEnabled = _ref.isCheckboxEnabled,
|
|
291
|
+
isEditor = _ref.isEditor;
|
|
292
|
+
var imageFieldName = name.replace(".label", ".image");
|
|
293
|
+
var _useField = formik.useField(name),
|
|
294
|
+
_useField2 = _slicedToArray(_useField, 1),
|
|
295
|
+
field = _useField2[0];
|
|
296
|
+
var _useField3 = formik.useField(imageFieldName),
|
|
297
|
+
_useField4 = _slicedToArray(_useField3, 3);
|
|
298
|
+
_useField4[0];
|
|
299
|
+
var image = _useField4[1].value,
|
|
300
|
+
setValue = _useField4[2].setValue;
|
|
301
|
+
var handleImageChange = function handleImageChange(changedImage) {
|
|
302
|
+
var imageValue = ramda.isEmpty(changedImage === null || changedImage === void 0 ? void 0 : changedImage.url) ? null : changedImage;
|
|
303
|
+
setValue(imageValue, false);
|
|
304
|
+
_onChange({
|
|
305
|
+
id: id,
|
|
306
|
+
value: imageValue,
|
|
307
|
+
isOnBlur: false,
|
|
308
|
+
fieldType: "image"
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$6(_objectSpread$6({
|
|
312
|
+
ref: innerRef
|
|
313
|
+
}, _objectSpread$6(_objectSpread$6({}, draggableProps), dragHandleProps)), {}, {
|
|
314
|
+
"data-cy": "form-block-options",
|
|
315
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
316
|
+
className: "nf-input-options group relative mb-2 flex items-start gap-1",
|
|
317
|
+
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$6(_objectSpread$6({}, dragHandleProps), {}, {
|
|
318
|
+
"data-testid": "drag-handle-".concat(optionIndex)
|
|
319
|
+
})), isCheckboxEnabled && /*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
320
|
+
name: name,
|
|
321
|
+
optionIndex: optionIndex
|
|
322
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
323
|
+
className: classnames("flex w-full items-center justify-center", {
|
|
324
|
+
"pointer-events-none opacity-80": disabled
|
|
325
|
+
}),
|
|
326
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
327
|
+
className: "neeto-ui-rounded-lg neeto-ui-border-gray-200 neeto-molecules-option-fields__image-option neeto-ui-bg-white group relative flex w-full flex-col gap-2 border p-2 pr-8",
|
|
328
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
329
|
+
className: "neeto-molecules-option-fields__image-uploader-container flex-shrink-0",
|
|
330
|
+
"data-testid": "picture-choice-option-".concat(optionIndex),
|
|
331
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ImageUploader, {
|
|
332
|
+
className: "neeto-molecules-option-fields__image-uploader w-full",
|
|
333
|
+
isOptionsDisabled: disabled,
|
|
334
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
335
|
+
uploadConfig: IMAGE_UPLOAD_CONFIG,
|
|
336
|
+
onUploadComplete: handleImageChange
|
|
337
|
+
}, image === null || image === void 0 ? void 0 : image.url)
|
|
338
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
339
|
+
className: "w-full",
|
|
340
|
+
children: isEditor ? /*#__PURE__*/jsxRuntime.jsx(Editor, {
|
|
341
|
+
disabled: disabled,
|
|
342
|
+
name: name,
|
|
343
|
+
placeholder: placeholder,
|
|
344
|
+
autoFocus: shouldFocus,
|
|
345
|
+
className: "flex-1",
|
|
346
|
+
"data-cy": "editor-option-".concat(optionIndex),
|
|
347
|
+
"data-testid": "editor-option-".concat(optionIndex),
|
|
348
|
+
initialValue: field.value,
|
|
349
|
+
onChange: function onChange(value) {
|
|
350
|
+
return _onChange({
|
|
351
|
+
id: id,
|
|
352
|
+
value: value
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
onBlur: function onBlur(value) {
|
|
356
|
+
_onChange({
|
|
357
|
+
id: id,
|
|
358
|
+
value: value,
|
|
359
|
+
isOnBlur: true
|
|
360
|
+
});
|
|
361
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(id, value);
|
|
362
|
+
}
|
|
363
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Input, _defineProperty(_defineProperty({
|
|
364
|
+
disabled: disabled,
|
|
365
|
+
name: name,
|
|
366
|
+
onBlur: _onBlur,
|
|
367
|
+
onKeyDown: onKeyDown,
|
|
368
|
+
placeholder: placeholder,
|
|
369
|
+
autoFocus: shouldFocus,
|
|
370
|
+
"data-cy": "option-input-".concat(optionIndex),
|
|
371
|
+
"data-testid": "input-option-".concat(optionIndex),
|
|
372
|
+
onFocus: function onFocus(_ref2) {
|
|
373
|
+
var target = _ref2.target;
|
|
374
|
+
return target.select();
|
|
375
|
+
}
|
|
376
|
+
}, "onBlur", function onBlur(event) {
|
|
377
|
+
_onChange({
|
|
378
|
+
id: id,
|
|
379
|
+
value: event.target.value,
|
|
380
|
+
isOnBlur: true
|
|
381
|
+
});
|
|
382
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(id, event.target.value);
|
|
383
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
384
|
+
args[_key - 1] = arguments[_key];
|
|
385
|
+
}
|
|
386
|
+
field.onBlur.apply(field, [event].concat(args));
|
|
387
|
+
}), "onChange", function onChange(_ref3) {
|
|
388
|
+
var target = _ref3.target;
|
|
389
|
+
return _onChange({
|
|
390
|
+
id: id,
|
|
391
|
+
value: target.value
|
|
392
|
+
});
|
|
393
|
+
}))
|
|
394
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
395
|
+
className: "absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-1 opacity-0 transition-opacity duration-200 group-hover:opacity-100",
|
|
396
|
+
children: /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
397
|
+
arrayHelpers: arrayHelpers,
|
|
398
|
+
disabled: disabled,
|
|
399
|
+
hideCloneOption: hideCloneOption,
|
|
400
|
+
hideDeleteOption: hideDeleteOption,
|
|
401
|
+
id: id,
|
|
402
|
+
onClone: onClone,
|
|
403
|
+
onDelete: onDelete,
|
|
404
|
+
optionIndex: optionIndex
|
|
405
|
+
})
|
|
406
|
+
})]
|
|
407
|
+
})
|
|
408
|
+
})]
|
|
409
|
+
})
|
|
410
|
+
}));
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
function ownKeys$5(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; }
|
|
414
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
415
|
+
var InputOption = function InputOption(_ref) {
|
|
416
|
+
var shouldFocus = _ref.shouldFocus,
|
|
417
|
+
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
418
|
+
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
419
|
+
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
420
|
+
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
421
|
+
innerRef = _ref.innerRef,
|
|
422
|
+
draggableProps = _ref.draggableProps,
|
|
423
|
+
dragHandleProps = _ref.dragHandleProps,
|
|
424
|
+
onKeyDown = _ref.onKeyDown,
|
|
425
|
+
onDelete = _ref.onDelete,
|
|
426
|
+
onClone = _ref.onClone,
|
|
427
|
+
_onChange = _ref.onChange,
|
|
428
|
+
optionIndex = _ref.optionIndex,
|
|
429
|
+
disabled = _ref.disabled,
|
|
430
|
+
isTextArea = _ref.isTextArea,
|
|
431
|
+
id = _ref.id,
|
|
432
|
+
isDraggable = _ref.isDraggable,
|
|
433
|
+
name = _ref.name,
|
|
434
|
+
placeholder = _ref.placeholder,
|
|
435
|
+
_onBlur = _ref.onBlur,
|
|
436
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
437
|
+
_ref$isCheckboxEnable = _ref.isCheckboxEnabled,
|
|
438
|
+
isCheckboxEnabled = _ref$isCheckboxEnable === void 0 ? false : _ref$isCheckboxEnable;
|
|
439
|
+
var Component = isTextArea ? Textarea$1 : Input;
|
|
440
|
+
var _useField = formik.useField(name),
|
|
441
|
+
_useField2 = _slicedToArray(_useField, 1),
|
|
442
|
+
field = _useField2[0];
|
|
443
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$5(_objectSpread$5({
|
|
444
|
+
ref: innerRef
|
|
445
|
+
}, _objectSpread$5(_objectSpread$5({}, draggableProps), dragHandleProps)), {}, {
|
|
446
|
+
"data-cy": "form-block-options",
|
|
447
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
448
|
+
className: "nf-input-options group relative mb-2 flex items-start gap-1",
|
|
449
|
+
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$5(_objectSpread$5({}, dragHandleProps), {}, {
|
|
450
|
+
"data-testid": "drag-handle-".concat(optionIndex)
|
|
451
|
+
})), isCheckboxEnabled && /*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
452
|
+
name: name,
|
|
453
|
+
optionIndex: optionIndex
|
|
454
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
455
|
+
className: "flex w-full items-start gap-2",
|
|
456
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
457
|
+
disabled: disabled,
|
|
458
|
+
name: name,
|
|
459
|
+
onKeyDown: onKeyDown,
|
|
460
|
+
placeholder: placeholder,
|
|
461
|
+
autoFocus: shouldFocus,
|
|
462
|
+
className: "flex-1",
|
|
463
|
+
"data-cy": "option-input-".concat(optionIndex),
|
|
464
|
+
"data-testid": "".concat(isTextArea ? "textarea-option" : "input-option", "-").concat(optionIndex),
|
|
465
|
+
suffix: /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
466
|
+
arrayHelpers: arrayHelpers,
|
|
467
|
+
disabled: disabled,
|
|
468
|
+
hideCloneOption: hideCloneOption,
|
|
469
|
+
hideDeleteOption: hideDeleteOption,
|
|
470
|
+
id: id,
|
|
471
|
+
onClone: onClone,
|
|
472
|
+
onDelete: onDelete,
|
|
473
|
+
optionIndex: optionIndex
|
|
474
|
+
}),
|
|
475
|
+
onChange: function onChange(_ref2) {
|
|
476
|
+
var target = _ref2.target;
|
|
477
|
+
return _onChange({
|
|
478
|
+
id: id,
|
|
479
|
+
value: target.value
|
|
480
|
+
});
|
|
481
|
+
},
|
|
482
|
+
onFocus: function onFocus(_ref3) {
|
|
483
|
+
var target = _ref3.target;
|
|
484
|
+
return target.select();
|
|
485
|
+
},
|
|
486
|
+
onBlur: function onBlur(event) {
|
|
487
|
+
_onChange({
|
|
488
|
+
id: id,
|
|
489
|
+
value: event.target.value,
|
|
490
|
+
isOnBlur: true
|
|
491
|
+
});
|
|
492
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(id, event.target.value);
|
|
493
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
494
|
+
args[_key - 1] = arguments[_key];
|
|
495
|
+
}
|
|
496
|
+
field.onBlur.apply(field, [event].concat(args));
|
|
497
|
+
}
|
|
498
|
+
})
|
|
499
|
+
})]
|
|
500
|
+
})
|
|
501
|
+
}));
|
|
132
502
|
};
|
|
133
503
|
|
|
134
504
|
var getOrderedOptions = function getOrderedOptions() {
|
|
@@ -206,11 +576,160 @@ var getMultiInputError = function getMultiInputError(isMultiInput, meta) {
|
|
|
206
576
|
return null;
|
|
207
577
|
};
|
|
208
578
|
|
|
209
|
-
function ownKeys$
|
|
210
|
-
function _objectSpread$
|
|
579
|
+
function ownKeys$4(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; }
|
|
580
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
581
|
+
var MultiInputOption = reactUtils.withT(function (_ref) {
|
|
582
|
+
var shouldFocus = _ref.shouldFocus,
|
|
583
|
+
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
584
|
+
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
585
|
+
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
586
|
+
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
587
|
+
innerRef = _ref.innerRef,
|
|
588
|
+
draggableProps = _ref.draggableProps,
|
|
589
|
+
dragHandleProps = _ref.dragHandleProps,
|
|
590
|
+
_onKeyDown = _ref.onKeyDown,
|
|
591
|
+
onDelete = _ref.onDelete,
|
|
592
|
+
onClone = _ref.onClone,
|
|
593
|
+
_onChange = _ref.onChange,
|
|
594
|
+
optionIndex = _ref.optionIndex,
|
|
595
|
+
disabled = _ref.disabled,
|
|
596
|
+
id = _ref.id,
|
|
597
|
+
isDraggable = _ref.isDraggable,
|
|
598
|
+
name = _ref.name,
|
|
599
|
+
placeholder = _ref.placeholder,
|
|
600
|
+
_onBlur = _ref.onBlur,
|
|
601
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
602
|
+
_ref$inputConfig = _ref.inputConfig,
|
|
603
|
+
inputConfig = _ref$inputConfig === void 0 ? [] : _ref$inputConfig,
|
|
604
|
+
isCheckboxEnabled = _ref.isCheckboxEnabled;
|
|
605
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$4(_objectSpread$4({
|
|
606
|
+
ref: innerRef
|
|
607
|
+
}, _objectSpread$4(_objectSpread$4({}, draggableProps), dragHandleProps)), {}, {
|
|
608
|
+
"data-cy": "form-block-multi-options",
|
|
609
|
+
"data-testid": "form-block-multi-options",
|
|
610
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
611
|
+
className: "nf-multi-input-options group relative mb-2 flex items-center gap-1",
|
|
612
|
+
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$4(_objectSpread$4({}, dragHandleProps), {}, {
|
|
613
|
+
"data-testid": "drag-handle-".concat(optionIndex)
|
|
614
|
+
})), isCheckboxEnabled && /*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
615
|
+
name: name,
|
|
616
|
+
optionIndex: optionIndex
|
|
617
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
618
|
+
className: "flex flex-1 flex-col gap-2",
|
|
619
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
620
|
+
className: "flex gap-2",
|
|
621
|
+
children: inputConfig.map(function (config, inputIndex) {
|
|
622
|
+
var _field$value;
|
|
623
|
+
var inputName = "".concat(name.replace(".label", ""), ".values.").concat(inputIndex);
|
|
624
|
+
var inputType = config.type || INPUT_TYPES.TEXT;
|
|
625
|
+
var isNumberType = inputType === INPUT_TYPES.NUMBER;
|
|
626
|
+
var _useField = formik.useField(inputName),
|
|
627
|
+
_useField2 = _slicedToArray(_useField, 1),
|
|
628
|
+
field = _useField2[0];
|
|
629
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
630
|
+
className: "flex-1",
|
|
631
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$4(_objectSpread$4({
|
|
632
|
+
disabled: disabled,
|
|
633
|
+
autoFocus: shouldFocus && inputIndex === 0,
|
|
634
|
+
"data-cy": "multi-option-input-".concat(optionIndex, "-").concat(inputIndex),
|
|
635
|
+
"data-testid": "multi-option-input-".concat(optionIndex, "-").concat(inputIndex)
|
|
636
|
+
}, isNumberType && {
|
|
637
|
+
min: config.min,
|
|
638
|
+
max: config.max
|
|
639
|
+
}), {}, {
|
|
640
|
+
name: inputName,
|
|
641
|
+
type: inputType,
|
|
642
|
+
value: (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : config.defaultValue,
|
|
643
|
+
placeholder: config.placeholder || "".concat(placeholder, " ").concat(inputIndex + 1),
|
|
644
|
+
onFocus: function onFocus(_ref2) {
|
|
645
|
+
var target = _ref2.target;
|
|
646
|
+
return target.select();
|
|
647
|
+
},
|
|
648
|
+
onBlur: function onBlur(event) {
|
|
649
|
+
return handleInputBlur(event, {
|
|
650
|
+
id: id,
|
|
651
|
+
inputIndex: inputIndex,
|
|
652
|
+
onChange: _onChange,
|
|
653
|
+
onBlur: _onBlur,
|
|
654
|
+
field: field,
|
|
655
|
+
config: config
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
onChange: function onChange(_ref3) {
|
|
659
|
+
var target = _ref3.target;
|
|
660
|
+
return _onChange({
|
|
661
|
+
id: id,
|
|
662
|
+
value: target.value,
|
|
663
|
+
inputIndex: inputIndex
|
|
664
|
+
});
|
|
665
|
+
},
|
|
666
|
+
onKeyDown: function onKeyDown(event) {
|
|
667
|
+
return isNumberType ? handleNumberKeyDown(event, _onKeyDown) : _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(event);
|
|
668
|
+
}
|
|
669
|
+
}))
|
|
670
|
+
}, inputIndex);
|
|
671
|
+
})
|
|
672
|
+
})
|
|
673
|
+
}), /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
674
|
+
arrayHelpers: arrayHelpers,
|
|
675
|
+
disabled: disabled,
|
|
676
|
+
hideCloneOption: hideCloneOption,
|
|
677
|
+
hideDeleteOption: hideDeleteOption,
|
|
678
|
+
id: id,
|
|
679
|
+
onClone: onClone,
|
|
680
|
+
onDelete: onDelete,
|
|
681
|
+
optionIndex: optionIndex
|
|
682
|
+
})]
|
|
683
|
+
})
|
|
684
|
+
}));
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
var DEFAULT_OPTION_LABEL = i18next.t("neetoMolecules.optionFields.defaultOption");
|
|
688
|
+
var IMAGE_UPLOAD_CONFIG = {
|
|
689
|
+
maxImageSize: 1,
|
|
690
|
+
allowedImageTypes: {
|
|
691
|
+
"image/jpg": [".jpg", ".jpeg"],
|
|
692
|
+
"image/png": [".png"],
|
|
693
|
+
"image/svg": [".svg"]
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
var INPUT_TYPES = {
|
|
697
|
+
TEXT: "text",
|
|
698
|
+
NUMBER: "number"
|
|
699
|
+
};
|
|
700
|
+
var OPTION_ACTIONS = {
|
|
701
|
+
UPDATE_IMAGE: "update_image",
|
|
702
|
+
UPDATE_VALUES: "update_values",
|
|
703
|
+
UPDATE_LABEL: "update_label",
|
|
704
|
+
DELETE: "delete",
|
|
705
|
+
REORDER: "reorder",
|
|
706
|
+
ADD: "add",
|
|
707
|
+
BULK_ADD: "bulk_add",
|
|
708
|
+
CLONE: "clone"
|
|
709
|
+
};
|
|
710
|
+
var OPTION_MAP = {
|
|
711
|
+
multiInput: MultiInputOption,
|
|
712
|
+
pictureChoice: ImageOption,
|
|
713
|
+
editor: EditorOption,
|
|
714
|
+
input: InputOption
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
var FormError = function FormError(_ref) {
|
|
718
|
+
var error = _ref.error;
|
|
719
|
+
if (neetoCist.isNotPresent(error) || typeof error !== "string") return null;
|
|
720
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
721
|
+
className: "neeto-ui-input__error",
|
|
722
|
+
"data-testid": "validation-error-container",
|
|
723
|
+
style: "body3",
|
|
724
|
+
children: error
|
|
725
|
+
});
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
function ownKeys$3(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; }
|
|
729
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
211
730
|
var attachPosition = function attachPosition(options) {
|
|
212
731
|
return options.map(function (option, index) {
|
|
213
|
-
return _objectSpread$
|
|
732
|
+
return _objectSpread$3(_objectSpread$3({}, option), {}, {
|
|
214
733
|
position: index
|
|
215
734
|
});
|
|
216
735
|
});
|
|
@@ -320,7 +839,7 @@ var useOptionFields = function useOptionFields(_ref) {
|
|
|
320
839
|
var handleAddOption = function handleAddOption() {
|
|
321
840
|
var id = randomId();
|
|
322
841
|
var position = options.length;
|
|
323
|
-
var newOption = _objectSpread$
|
|
842
|
+
var newOption = _objectSpread$3(_objectSpread$3({
|
|
324
843
|
id: "draft-".concat(id),
|
|
325
844
|
altId: "alt-".concat(id),
|
|
326
845
|
label: isNewItemsPrefilled ? _generateLabel(itemLabel, options) : "",
|
|
@@ -357,7 +876,7 @@ var useOptionFields = function useOptionFields(_ref) {
|
|
|
357
876
|
var optionToClone = options[index];
|
|
358
877
|
if (!optionToClone) return;
|
|
359
878
|
var newId = randomId();
|
|
360
|
-
var clonedOption = _objectSpread$
|
|
879
|
+
var clonedOption = _objectSpread$3(_objectSpread$3({}, optionToClone), {}, {
|
|
361
880
|
id: "draft-".concat(newId),
|
|
362
881
|
altId: "alt-".concat(newId),
|
|
363
882
|
label: isMultiInput ? optionToClone.label : t("neetoMolecules.optionFields.clonedOption", {
|
|
@@ -398,78 +917,11 @@ var useOptionFields = function useOptionFields(_ref) {
|
|
|
398
917
|
};
|
|
399
918
|
};
|
|
400
919
|
|
|
401
|
-
var css = ".neeto-molecules-option-fields__image-uploader img{max-height:100px}";
|
|
402
|
-
injectCss.n(css,{});
|
|
403
|
-
|
|
404
|
-
function ownKeys$4(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; }
|
|
405
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
406
|
-
var DragHandle = function DragHandle(props) {
|
|
407
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$4(_objectSpread$4({
|
|
408
|
-
className: "neeto-ui-text-gray-500 flex h-8 flex-shrink-0 cursor-grab items-center",
|
|
409
|
-
"data-cy": "drag-handle",
|
|
410
|
-
"data-testid": "drag-handle"
|
|
411
|
-
}, props), {}, {
|
|
412
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Drag, {
|
|
413
|
-
size: 16,
|
|
414
|
-
strokeWidth: 2
|
|
415
|
-
})
|
|
416
|
-
}));
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
var OptionActions = reactUtils.withT(function (_ref) {
|
|
420
|
-
var t = _ref.t,
|
|
421
|
-
disabled = _ref.disabled,
|
|
422
|
-
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
423
|
-
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
424
|
-
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
425
|
-
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
426
|
-
optionIndex = _ref.optionIndex,
|
|
427
|
-
id = _ref.id,
|
|
428
|
-
arrayHelpers = _ref.arrayHelpers,
|
|
429
|
-
onClone = _ref.onClone,
|
|
430
|
-
onDelete = _ref.onDelete,
|
|
431
|
-
_ref$className = _ref.className,
|
|
432
|
-
className = _ref$className === void 0 ? "" : _ref$className;
|
|
433
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
434
|
-
className: "flex items-center gap-1 ".concat(className),
|
|
435
|
-
children: [!hideCloneOption && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
436
|
-
disabled: disabled,
|
|
437
|
-
className: "p-0.5",
|
|
438
|
-
"data-cy": "clone-option-button-".concat(optionIndex),
|
|
439
|
-
"data-testid": "clone-option-button-".concat(optionIndex),
|
|
440
|
-
icon: Copy,
|
|
441
|
-
size: "small",
|
|
442
|
-
style: "text",
|
|
443
|
-
tooltipProps: {
|
|
444
|
-
content: t("neetoMolecules.common.actions.clone"),
|
|
445
|
-
position: "top",
|
|
446
|
-
touch: ["hold", 500]
|
|
447
|
-
},
|
|
448
|
-
onClick: function onClick() {
|
|
449
|
-
return onClone(id);
|
|
450
|
-
}
|
|
451
|
-
}), !hideDeleteOption && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
452
|
-
disabled: disabled,
|
|
453
|
-
className: "p-0.5",
|
|
454
|
-
"data-cy": "delete-option-button-".concat(optionIndex),
|
|
455
|
-
"data-testid": "delete-option-button-".concat(optionIndex),
|
|
456
|
-
icon: Delete,
|
|
457
|
-
size: "small",
|
|
458
|
-
style: "text",
|
|
459
|
-
tooltipProps: {
|
|
460
|
-
content: t("neetoMolecules.common.actions.delete"),
|
|
461
|
-
position: "top",
|
|
462
|
-
touch: ["hold", 500]
|
|
463
|
-
},
|
|
464
|
-
onClick: function onClick() {
|
|
465
|
-
return onDelete(id, arrayHelpers);
|
|
466
|
-
}
|
|
467
|
-
})]
|
|
468
|
-
});
|
|
469
|
-
});
|
|
920
|
+
var css = ".neeto-molecules-option-fields__image-uploader img{max-height:100px}";
|
|
921
|
+
injectCss.n(css,{});
|
|
470
922
|
|
|
471
|
-
function ownKeys$
|
|
472
|
-
function _objectSpread$
|
|
923
|
+
function ownKeys$2(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; }
|
|
924
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
473
925
|
var BlockOption = reactUtils.withT(function (_ref) {
|
|
474
926
|
var t = _ref.t,
|
|
475
927
|
innerRef = _ref.innerRef,
|
|
@@ -486,16 +938,21 @@ var BlockOption = reactUtils.withT(function (_ref) {
|
|
|
486
938
|
id = _ref.id,
|
|
487
939
|
isDraggable = _ref.isDraggable,
|
|
488
940
|
optionIndex = _ref.optionIndex,
|
|
489
|
-
arrayHelpers = _ref.arrayHelpers
|
|
490
|
-
|
|
941
|
+
arrayHelpers = _ref.arrayHelpers,
|
|
942
|
+
isCheckboxEnabled = _ref.isCheckboxEnabled,
|
|
943
|
+
name = _ref.name;
|
|
944
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$2(_objectSpread$2(_objectSpread$2({
|
|
491
945
|
ref: innerRef
|
|
492
946
|
}, draggableProps), dragHandleProps), {}, {
|
|
493
947
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
494
948
|
className: "neeto-ui-border-gray-400 hover:neeto-ui-bg-gray-200 neeto-ui-rounded-sm shadow-xs group relative mb-2 flex h-10 cursor-pointer items-center gap-2 border p-3 transition-colors duration-300 ease-in-out",
|
|
495
949
|
"data-cy": "address-field-block",
|
|
496
|
-
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$
|
|
950
|
+
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$2(_objectSpread$2({}, dragHandleProps), {}, {
|
|
497
951
|
"data-testid": "drag-handle-".concat(optionIndex)
|
|
498
|
-
})), /*#__PURE__*/jsxRuntime.jsx(
|
|
952
|
+
})), isCheckboxEnabled && /*#__PURE__*/jsxRuntime.jsx(Checkbox, {
|
|
953
|
+
name: name,
|
|
954
|
+
optionIndex: optionIndex
|
|
955
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
499
956
|
className: "flex-grow truncate leading-4",
|
|
500
957
|
"data-cy": "address-text-field",
|
|
501
958
|
"data-testid": "address-text-field",
|
|
@@ -533,310 +990,8 @@ var BlockOption = reactUtils.withT(function (_ref) {
|
|
|
533
990
|
}));
|
|
534
991
|
});
|
|
535
992
|
|
|
536
|
-
var ImageOption = function ImageOption(_ref) {
|
|
537
|
-
var id = _ref.id,
|
|
538
|
-
name = _ref.name,
|
|
539
|
-
optionIndex = _ref.optionIndex,
|
|
540
|
-
disabled = _ref.disabled,
|
|
541
|
-
field = _ref.field,
|
|
542
|
-
placeholder = _ref.placeholder,
|
|
543
|
-
shouldFocus = _ref.shouldFocus,
|
|
544
|
-
onKeyDown = _ref.onKeyDown,
|
|
545
|
-
_onChange = _ref.onChange,
|
|
546
|
-
_onBlur = _ref.onBlur,
|
|
547
|
-
onDelete = _ref.onDelete,
|
|
548
|
-
onClone = _ref.onClone,
|
|
549
|
-
arrayHelpers = _ref.arrayHelpers,
|
|
550
|
-
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
551
|
-
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
552
|
-
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
553
|
-
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption;
|
|
554
|
-
var imageFieldName = name.replace(".label", ".image");
|
|
555
|
-
var _useField = formik.useField(imageFieldName),
|
|
556
|
-
_useField2 = _slicedToArray(_useField, 3);
|
|
557
|
-
_useField2[0];
|
|
558
|
-
var image = _useField2[1].value,
|
|
559
|
-
setValue = _useField2[2].setValue;
|
|
560
|
-
var handleImageChange = function handleImageChange(changedImage) {
|
|
561
|
-
var imageValue = ramda.isEmpty(changedImage === null || changedImage === void 0 ? void 0 : changedImage.url) ? null : changedImage;
|
|
562
|
-
setValue(imageValue, false);
|
|
563
|
-
_onChange({
|
|
564
|
-
id: id,
|
|
565
|
-
value: imageValue,
|
|
566
|
-
isOnBlur: false,
|
|
567
|
-
fieldType: "image"
|
|
568
|
-
});
|
|
569
|
-
};
|
|
570
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
571
|
-
className: classnames("flex w-full items-center justify-center", {
|
|
572
|
-
"pointer-events-none opacity-80": disabled
|
|
573
|
-
}),
|
|
574
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
575
|
-
className: "neeto-ui-rounded-lg neeto-ui-border-gray-200 neeto-molecules-option-fields__image-option neeto-ui-bg-white group relative flex w-full flex-col gap-2 border p-2 pr-8",
|
|
576
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
577
|
-
className: "neeto-molecules-option-fields__image-uploader-container flex-shrink-0",
|
|
578
|
-
"data-testid": "picture-choice-option-".concat(optionIndex),
|
|
579
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ImageUploader, {
|
|
580
|
-
className: "neeto-molecules-option-fields__image-uploader w-full",
|
|
581
|
-
isOptionsDisabled: disabled,
|
|
582
|
-
src: image === null || image === void 0 ? void 0 : image.url,
|
|
583
|
-
uploadConfig: IMAGE_UPLOAD_CONFIG,
|
|
584
|
-
onUploadComplete: handleImageChange
|
|
585
|
-
}, image === null || image === void 0 ? void 0 : image.url)
|
|
586
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
587
|
-
className: "w-full",
|
|
588
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Input, _defineProperty({
|
|
589
|
-
disabled: disabled,
|
|
590
|
-
name: name,
|
|
591
|
-
onBlur: _onBlur,
|
|
592
|
-
onKeyDown: onKeyDown,
|
|
593
|
-
placeholder: placeholder,
|
|
594
|
-
autoFocus: shouldFocus,
|
|
595
|
-
"data-cy": "option-input-".concat(optionIndex),
|
|
596
|
-
"data-testid": "input-option-".concat(optionIndex),
|
|
597
|
-
onChange: function onChange(_ref2) {
|
|
598
|
-
var target = _ref2.target;
|
|
599
|
-
return _onChange({
|
|
600
|
-
id: id,
|
|
601
|
-
value: target.value
|
|
602
|
-
});
|
|
603
|
-
},
|
|
604
|
-
onFocus: function onFocus(_ref3) {
|
|
605
|
-
var target = _ref3.target;
|
|
606
|
-
return target.select();
|
|
607
|
-
}
|
|
608
|
-
}, "onBlur", function onBlur(event) {
|
|
609
|
-
_onChange({
|
|
610
|
-
id: id,
|
|
611
|
-
value: event.target.value,
|
|
612
|
-
isOnBlur: true
|
|
613
|
-
});
|
|
614
|
-
_onBlur === null || _onBlur === void 0 || _onBlur(id, event.target.value);
|
|
615
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
616
|
-
args[_key - 1] = arguments[_key];
|
|
617
|
-
}
|
|
618
|
-
field.onBlur.apply(field, [event].concat(args));
|
|
619
|
-
}))
|
|
620
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
621
|
-
className: "absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-1 opacity-0 transition-opacity duration-200 group-hover:opacity-100",
|
|
622
|
-
children: /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
623
|
-
arrayHelpers: arrayHelpers,
|
|
624
|
-
disabled: disabled,
|
|
625
|
-
hideCloneOption: hideCloneOption,
|
|
626
|
-
hideDeleteOption: hideDeleteOption,
|
|
627
|
-
id: id,
|
|
628
|
-
onClone: onClone,
|
|
629
|
-
onDelete: onDelete,
|
|
630
|
-
optionIndex: optionIndex
|
|
631
|
-
})
|
|
632
|
-
})]
|
|
633
|
-
})
|
|
634
|
-
});
|
|
635
|
-
};
|
|
636
|
-
|
|
637
|
-
function ownKeys$2(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; }
|
|
638
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
639
|
-
var InputOption = function InputOption(_ref) {
|
|
640
|
-
var shouldFocus = _ref.shouldFocus,
|
|
641
|
-
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
642
|
-
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
643
|
-
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
644
|
-
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
645
|
-
innerRef = _ref.innerRef,
|
|
646
|
-
draggableProps = _ref.draggableProps,
|
|
647
|
-
dragHandleProps = _ref.dragHandleProps,
|
|
648
|
-
isPictureChoice = _ref.isPictureChoice,
|
|
649
|
-
onKeyDown = _ref.onKeyDown,
|
|
650
|
-
onDelete = _ref.onDelete,
|
|
651
|
-
onClone = _ref.onClone,
|
|
652
|
-
_onChange = _ref.onChange,
|
|
653
|
-
optionIndex = _ref.optionIndex,
|
|
654
|
-
disabled = _ref.disabled,
|
|
655
|
-
isTextArea = _ref.isTextArea,
|
|
656
|
-
id = _ref.id,
|
|
657
|
-
isDraggable = _ref.isDraggable,
|
|
658
|
-
name = _ref.name,
|
|
659
|
-
placeholder = _ref.placeholder,
|
|
660
|
-
_onBlur = _ref.onBlur,
|
|
661
|
-
arrayHelpers = _ref.arrayHelpers;
|
|
662
|
-
var Component = isTextArea ? Textarea$1 : Input;
|
|
663
|
-
var _useField = formik.useField(name),
|
|
664
|
-
_useField2 = _slicedToArray(_useField, 1),
|
|
665
|
-
field = _useField2[0];
|
|
666
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$2(_objectSpread$2({
|
|
667
|
-
ref: innerRef
|
|
668
|
-
}, _objectSpread$2(_objectSpread$2({}, draggableProps), dragHandleProps)), {}, {
|
|
669
|
-
"data-cy": "form-block-options",
|
|
670
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
671
|
-
className: "nf-input-options group relative mb-2 flex items-start gap-1",
|
|
672
|
-
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$2(_objectSpread$2({}, dragHandleProps), {}, {
|
|
673
|
-
"data-testid": "drag-handle-".concat(optionIndex)
|
|
674
|
-
})), isPictureChoice ? /*#__PURE__*/jsxRuntime.jsx(ImageOption, {
|
|
675
|
-
arrayHelpers: arrayHelpers,
|
|
676
|
-
disabled: disabled,
|
|
677
|
-
field: field,
|
|
678
|
-
hideCloneOption: hideCloneOption,
|
|
679
|
-
hideDeleteOption: hideDeleteOption,
|
|
680
|
-
id: id,
|
|
681
|
-
name: name,
|
|
682
|
-
onBlur: _onBlur,
|
|
683
|
-
onChange: _onChange,
|
|
684
|
-
onClone: onClone,
|
|
685
|
-
onDelete: onDelete,
|
|
686
|
-
onKeyDown: onKeyDown,
|
|
687
|
-
optionIndex: optionIndex,
|
|
688
|
-
placeholder: placeholder,
|
|
689
|
-
shouldFocus: shouldFocus
|
|
690
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
691
|
-
disabled: disabled,
|
|
692
|
-
name: name,
|
|
693
|
-
onKeyDown: onKeyDown,
|
|
694
|
-
placeholder: placeholder,
|
|
695
|
-
autoFocus: shouldFocus,
|
|
696
|
-
"data-cy": "option-input-".concat(optionIndex),
|
|
697
|
-
"data-testid": "".concat(isTextArea ? "textarea-option" : "input-option", "-").concat(optionIndex),
|
|
698
|
-
suffix: /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
699
|
-
arrayHelpers: arrayHelpers,
|
|
700
|
-
disabled: disabled,
|
|
701
|
-
hideCloneOption: hideCloneOption,
|
|
702
|
-
hideDeleteOption: hideDeleteOption,
|
|
703
|
-
id: id,
|
|
704
|
-
onClone: onClone,
|
|
705
|
-
onDelete: onDelete,
|
|
706
|
-
optionIndex: optionIndex
|
|
707
|
-
}),
|
|
708
|
-
onChange: function onChange(_ref2) {
|
|
709
|
-
var target = _ref2.target;
|
|
710
|
-
return _onChange({
|
|
711
|
-
id: id,
|
|
712
|
-
value: target.value
|
|
713
|
-
});
|
|
714
|
-
},
|
|
715
|
-
onFocus: function onFocus(_ref3) {
|
|
716
|
-
var target = _ref3.target;
|
|
717
|
-
return target.select();
|
|
718
|
-
},
|
|
719
|
-
onBlur: function onBlur(event) {
|
|
720
|
-
_onChange({
|
|
721
|
-
id: id,
|
|
722
|
-
value: event.target.value,
|
|
723
|
-
isOnBlur: true
|
|
724
|
-
});
|
|
725
|
-
_onBlur === null || _onBlur === void 0 || _onBlur(id, event.target.value);
|
|
726
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
727
|
-
args[_key - 1] = arguments[_key];
|
|
728
|
-
}
|
|
729
|
-
field.onBlur.apply(field, [event].concat(args));
|
|
730
|
-
}
|
|
731
|
-
})]
|
|
732
|
-
})
|
|
733
|
-
}));
|
|
734
|
-
};
|
|
735
|
-
|
|
736
993
|
function ownKeys$1(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; }
|
|
737
994
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
738
|
-
var MultiInputOption = reactUtils.withT(function (_ref) {
|
|
739
|
-
var shouldFocus = _ref.shouldFocus,
|
|
740
|
-
_ref$hideDeleteOption = _ref.hideDeleteOption,
|
|
741
|
-
hideDeleteOption = _ref$hideDeleteOption === void 0 ? false : _ref$hideDeleteOption,
|
|
742
|
-
_ref$hideCloneOption = _ref.hideCloneOption,
|
|
743
|
-
hideCloneOption = _ref$hideCloneOption === void 0 ? false : _ref$hideCloneOption,
|
|
744
|
-
innerRef = _ref.innerRef,
|
|
745
|
-
draggableProps = _ref.draggableProps,
|
|
746
|
-
dragHandleProps = _ref.dragHandleProps,
|
|
747
|
-
_onKeyDown = _ref.onKeyDown,
|
|
748
|
-
onDelete = _ref.onDelete,
|
|
749
|
-
onClone = _ref.onClone,
|
|
750
|
-
_onChange = _ref.onChange,
|
|
751
|
-
optionIndex = _ref.optionIndex,
|
|
752
|
-
disabled = _ref.disabled,
|
|
753
|
-
id = _ref.id,
|
|
754
|
-
isDraggable = _ref.isDraggable,
|
|
755
|
-
name = _ref.name,
|
|
756
|
-
placeholder = _ref.placeholder,
|
|
757
|
-
_onBlur = _ref.onBlur,
|
|
758
|
-
arrayHelpers = _ref.arrayHelpers,
|
|
759
|
-
_ref$inputConfig = _ref.inputConfig,
|
|
760
|
-
inputConfig = _ref$inputConfig === void 0 ? [] : _ref$inputConfig;
|
|
761
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$1(_objectSpread$1({
|
|
762
|
-
ref: innerRef
|
|
763
|
-
}, _objectSpread$1(_objectSpread$1({}, draggableProps), dragHandleProps)), {}, {
|
|
764
|
-
"data-cy": "form-block-multi-options",
|
|
765
|
-
"data-testid": "form-block-multi-options",
|
|
766
|
-
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
767
|
-
className: "nf-multi-input-options group relative mb-2 flex items-center gap-1",
|
|
768
|
-
children: [isDraggable && /*#__PURE__*/jsxRuntime.jsx(DragHandle, _objectSpread$1(_objectSpread$1({}, dragHandleProps), {}, {
|
|
769
|
-
"data-testid": "drag-handle-".concat(optionIndex)
|
|
770
|
-
})), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
771
|
-
className: "flex flex-1 flex-col gap-2",
|
|
772
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
773
|
-
className: "flex gap-2",
|
|
774
|
-
children: inputConfig.map(function (config, inputIndex) {
|
|
775
|
-
var _field$value;
|
|
776
|
-
var inputName = "".concat(name.replace(".label", ""), ".values.").concat(inputIndex);
|
|
777
|
-
var inputType = config.type || INPUT_TYPES.TEXT;
|
|
778
|
-
var isNumberType = inputType === INPUT_TYPES.NUMBER;
|
|
779
|
-
var _useField = formik.useField(inputName),
|
|
780
|
-
_useField2 = _slicedToArray(_useField, 1),
|
|
781
|
-
field = _useField2[0];
|
|
782
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
783
|
-
className: "flex-1",
|
|
784
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$1(_objectSpread$1({
|
|
785
|
-
disabled: disabled,
|
|
786
|
-
autoFocus: shouldFocus && inputIndex === 0,
|
|
787
|
-
"data-cy": "multi-option-input-".concat(optionIndex, "-").concat(inputIndex),
|
|
788
|
-
"data-testid": "multi-option-input-".concat(optionIndex, "-").concat(inputIndex)
|
|
789
|
-
}, isNumberType && {
|
|
790
|
-
min: config.min,
|
|
791
|
-
max: config.max
|
|
792
|
-
}), {}, {
|
|
793
|
-
name: inputName,
|
|
794
|
-
type: inputType,
|
|
795
|
-
value: (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : config.defaultValue,
|
|
796
|
-
placeholder: config.placeholder || "".concat(placeholder, " ").concat(inputIndex + 1),
|
|
797
|
-
onFocus: function onFocus(_ref2) {
|
|
798
|
-
var target = _ref2.target;
|
|
799
|
-
return target.select();
|
|
800
|
-
},
|
|
801
|
-
onBlur: function onBlur(event) {
|
|
802
|
-
return handleInputBlur(event, {
|
|
803
|
-
id: id,
|
|
804
|
-
inputIndex: inputIndex,
|
|
805
|
-
onChange: _onChange,
|
|
806
|
-
onBlur: _onBlur,
|
|
807
|
-
field: field,
|
|
808
|
-
config: config
|
|
809
|
-
});
|
|
810
|
-
},
|
|
811
|
-
onChange: function onChange(_ref3) {
|
|
812
|
-
var target = _ref3.target;
|
|
813
|
-
return _onChange({
|
|
814
|
-
id: id,
|
|
815
|
-
value: target.value,
|
|
816
|
-
inputIndex: inputIndex
|
|
817
|
-
});
|
|
818
|
-
},
|
|
819
|
-
onKeyDown: function onKeyDown(event) {
|
|
820
|
-
return isNumberType ? handleNumberKeyDown(event, _onKeyDown) : _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(event);
|
|
821
|
-
}
|
|
822
|
-
}))
|
|
823
|
-
}, inputIndex);
|
|
824
|
-
})
|
|
825
|
-
})
|
|
826
|
-
}), /*#__PURE__*/jsxRuntime.jsx(OptionActions, {
|
|
827
|
-
arrayHelpers: arrayHelpers,
|
|
828
|
-
disabled: disabled,
|
|
829
|
-
hideCloneOption: hideCloneOption,
|
|
830
|
-
hideDeleteOption: hideDeleteOption,
|
|
831
|
-
id: id,
|
|
832
|
-
onClone: onClone,
|
|
833
|
-
onDelete: onDelete,
|
|
834
|
-
optionIndex: optionIndex
|
|
835
|
-
})]
|
|
836
|
-
})
|
|
837
|
-
}));
|
|
838
|
-
});
|
|
839
|
-
|
|
840
995
|
var OptionField = function OptionField(_ref) {
|
|
841
996
|
var option = _ref.option,
|
|
842
997
|
editable = _ref.editable,
|
|
@@ -850,9 +1005,11 @@ var OptionField = function OptionField(_ref) {
|
|
|
850
1005
|
onEdit = _ref.onEdit,
|
|
851
1006
|
draggable = _ref.draggable,
|
|
852
1007
|
disabled = _ref.disabled,
|
|
1008
|
+
isCheckboxEnabled = _ref.isCheckboxEnabled,
|
|
853
1009
|
isPictureChoice = _ref.isPictureChoice,
|
|
854
1010
|
isTextArea = _ref.isTextArea,
|
|
855
1011
|
isMultiInput = _ref.isMultiInput,
|
|
1012
|
+
isEditor = _ref.isEditor,
|
|
856
1013
|
inputConfig = _ref.inputConfig,
|
|
857
1014
|
shouldFocus = _ref.shouldFocus,
|
|
858
1015
|
isEditable = _ref.isEditable,
|
|
@@ -863,69 +1020,40 @@ var OptionField = function OptionField(_ref) {
|
|
|
863
1020
|
optionIndex = _ref.optionIndex,
|
|
864
1021
|
onBlur = _ref.onBlur,
|
|
865
1022
|
arrayHelpers = _ref.arrayHelpers;
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
arrayHelpers: arrayHelpers,
|
|
869
|
-
dragHandleProps: dragHandleProps,
|
|
870
|
-
draggableProps: draggableProps,
|
|
871
|
-
handleDeleteClick: handleDeleteClick,
|
|
872
|
-
hideCloneOption: hideCloneOption,
|
|
873
|
-
hideDeleteOption: hideDeleteOption,
|
|
874
|
-
innerRef: innerRef,
|
|
875
|
-
onEdit: onEdit,
|
|
876
|
-
optionIndex: optionIndex,
|
|
877
|
-
id: option.id,
|
|
878
|
-
isDraggable: draggable && !disabled,
|
|
879
|
-
label: option.label,
|
|
880
|
-
onClone: handleCloneClick
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
if (isMultiInput) {
|
|
884
|
-
return /*#__PURE__*/jsxRuntime.jsx(MultiInputOption, {
|
|
885
|
-
arrayHelpers: arrayHelpers,
|
|
886
|
-
dragHandleProps: dragHandleProps,
|
|
887
|
-
draggableProps: draggableProps,
|
|
888
|
-
hideCloneOption: hideCloneOption,
|
|
889
|
-
hideDeleteOption: hideDeleteOption,
|
|
890
|
-
innerRef: innerRef,
|
|
891
|
-
inputConfig: inputConfig,
|
|
892
|
-
name: name,
|
|
893
|
-
onBlur: onBlur,
|
|
894
|
-
option: option,
|
|
895
|
-
optionIndex: optionIndex,
|
|
896
|
-
shouldFocus: shouldFocus,
|
|
897
|
-
disabled: !isEditable || disabled,
|
|
898
|
-
id: option.id,
|
|
899
|
-
isDraggable: draggable && !disabled,
|
|
900
|
-
placeholder: generatePlaceholder(itemLabel, optionIndex),
|
|
901
|
-
onChange: handleChange,
|
|
902
|
-
onClone: handleCloneClick,
|
|
903
|
-
onDelete: handleDeleteClick,
|
|
904
|
-
onKeyDown: handleKeyDown
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
return /*#__PURE__*/jsxRuntime.jsx(InputOption, {
|
|
1023
|
+
var commonProps = {
|
|
1024
|
+
id: option.id,
|
|
908
1025
|
arrayHelpers: arrayHelpers,
|
|
909
1026
|
dragHandleProps: dragHandleProps,
|
|
910
1027
|
draggableProps: draggableProps,
|
|
911
1028
|
hideCloneOption: hideCloneOption,
|
|
912
1029
|
hideDeleteOption: hideDeleteOption,
|
|
913
1030
|
innerRef: innerRef,
|
|
914
|
-
|
|
915
|
-
isTextArea: isTextArea,
|
|
1031
|
+
isCheckboxEnabled: isCheckboxEnabled,
|
|
916
1032
|
name: name,
|
|
917
|
-
onBlur: onBlur,
|
|
918
1033
|
optionIndex: optionIndex,
|
|
919
|
-
shouldFocus: shouldFocus,
|
|
920
|
-
disabled: !isEditable || disabled,
|
|
921
|
-
id: option.id,
|
|
922
1034
|
isDraggable: draggable && !disabled,
|
|
1035
|
+
onClone: handleCloneClick
|
|
1036
|
+
};
|
|
1037
|
+
var Component = isMultiInput && OPTION_MAP.multiInput || isPictureChoice && OPTION_MAP.pictureChoice || isEditor && OPTION_MAP.editor || OPTION_MAP.input;
|
|
1038
|
+
return editable ? /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$1(_objectSpread$1({}, _objectSpread$1(_objectSpread$1({}, commonProps), {}, {
|
|
1039
|
+
inputConfig: inputConfig,
|
|
1040
|
+
isEditor: isEditor,
|
|
1041
|
+
isTextArea: isTextArea,
|
|
1042
|
+
onBlur: onBlur,
|
|
1043
|
+
option: option,
|
|
1044
|
+
shouldFocus: shouldFocus
|
|
1045
|
+
})), {}, {
|
|
1046
|
+
disabled: !isEditable || disabled,
|
|
923
1047
|
placeholder: generatePlaceholder(itemLabel, optionIndex),
|
|
924
1048
|
onChange: handleChange,
|
|
925
|
-
onClone: handleCloneClick,
|
|
926
1049
|
onDelete: handleDeleteClick,
|
|
927
1050
|
onKeyDown: handleKeyDown
|
|
928
|
-
})
|
|
1051
|
+
})) : /*#__PURE__*/jsxRuntime.jsx(BlockOption, _objectSpread$1(_objectSpread$1({}, _objectSpread$1(_objectSpread$1({}, commonProps), {}, {
|
|
1052
|
+
handleDeleteClick: handleDeleteClick,
|
|
1053
|
+
onEdit: onEdit
|
|
1054
|
+
})), {}, {
|
|
1055
|
+
label: option.label
|
|
1056
|
+
}));
|
|
929
1057
|
};
|
|
930
1058
|
|
|
931
1059
|
function ownKeys(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; }
|
|
@@ -956,12 +1084,16 @@ var OptionFields = function OptionFields(_ref) {
|
|
|
956
1084
|
isDeleteOptionEnabled = _ref$isDeleteOptionEn === void 0 ? true : _ref$isDeleteOptionEn,
|
|
957
1085
|
_ref$isCloneOptionEna = _ref.isCloneOptionEnabled,
|
|
958
1086
|
isCloneOptionEnabled = _ref$isCloneOptionEna === void 0 ? false : _ref$isCloneOptionEna,
|
|
1087
|
+
_ref$isCheckboxEnable = _ref.isCheckboxEnabled,
|
|
1088
|
+
isCheckboxEnabled = _ref$isCheckboxEnable === void 0 ? false : _ref$isCheckboxEnable,
|
|
959
1089
|
_ref$isPictureChoice = _ref.isPictureChoice,
|
|
960
1090
|
isPictureChoice = _ref$isPictureChoice === void 0 ? false : _ref$isPictureChoice,
|
|
961
1091
|
_ref$isTextArea = _ref.isTextArea,
|
|
962
1092
|
isTextArea = _ref$isTextArea === void 0 ? false : _ref$isTextArea,
|
|
963
1093
|
_ref$isMultiInput = _ref.isMultiInput,
|
|
964
1094
|
isMultiInput = _ref$isMultiInput === void 0 ? false : _ref$isMultiInput,
|
|
1095
|
+
_ref$isEditor = _ref.isEditor,
|
|
1096
|
+
isEditor = _ref$isEditor === void 0 ? false : _ref$isEditor,
|
|
965
1097
|
_ref$inputConfig = _ref.inputConfig,
|
|
966
1098
|
inputConfig = _ref$inputConfig === void 0 ? [] : _ref$inputConfig,
|
|
967
1099
|
_ref$shouldDestroy = _ref.shouldDestroy,
|
|
@@ -1019,7 +1151,7 @@ var OptionFields = function OptionFields(_ref) {
|
|
|
1019
1151
|
// This condition only needed for server id generated types
|
|
1020
1152
|
var isEditable = true;
|
|
1021
1153
|
if (shouldDestroy) isEditable = options.every(ramda.prop("id") || error);
|
|
1022
|
-
var orderedOptions = getOrderedOptions(options
|
|
1154
|
+
var orderedOptions = getOrderedOptions(options);
|
|
1023
1155
|
var filteredOptions = orderedOptions.filter(function (_ref2) {
|
|
1024
1156
|
var deleted = _ref2[destroyFlagName];
|
|
1025
1157
|
return !deleted;
|
|
@@ -1044,7 +1176,9 @@ var OptionFields = function OptionFields(_ref) {
|
|
|
1044
1176
|
itemLabel: itemLabel,
|
|
1045
1177
|
onEdit: onEdit,
|
|
1046
1178
|
onBlur: onBlur,
|
|
1047
|
-
shouldFocus: shouldFocus
|
|
1179
|
+
shouldFocus: shouldFocus,
|
|
1180
|
+
isCheckboxEnabled: isCheckboxEnabled,
|
|
1181
|
+
isEditor: isEditor
|
|
1048
1182
|
};
|
|
1049
1183
|
|
|
1050
1184
|
// To fix the element positioned incorrectly while dragging when in a pane or modal.
|