@bigbinary/neeto-form-frontend 3.14.8 → 4.0.0-beta

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.
Files changed (48) hide show
  1. package/README.md +5 -3
  2. package/dist/BuildForm.js +27 -17
  3. package/dist/BuildForm.js.map +1 -1
  4. package/dist/ExternalForm.js +5 -5
  5. package/dist/ExternalForm.js.map +1 -1
  6. package/dist/Submission.js +2 -2
  7. package/dist/Submission.js.map +1 -1
  8. package/dist/UrlBuilder.js +4 -4
  9. package/dist/{buildForm-CXy5L1RP.js → buildForm-BwhLCvEE.js} +2 -2
  10. package/dist/{buildForm-CXy5L1RP.js.map → buildForm-BwhLCvEE.js.map} +1 -1
  11. package/dist/{buildForm-DNCW7prR.js → buildForm-CsVQHcC7.js} +2 -2
  12. package/dist/{buildForm-DNCW7prR.js.map → buildForm-CsVQHcC7.js.map} +1 -1
  13. package/dist/cjs/BuildForm.js +27 -17
  14. package/dist/cjs/BuildForm.js.map +1 -1
  15. package/dist/cjs/ExternalForm.js +5 -5
  16. package/dist/cjs/ExternalForm.js.map +1 -1
  17. package/dist/cjs/Submission.js +2 -2
  18. package/dist/cjs/Submission.js.map +1 -1
  19. package/dist/cjs/UrlBuilder.js +4 -4
  20. package/dist/cjs/hooks.js +4 -4
  21. package/dist/cjs/index.js +6 -6
  22. package/dist/{constants-b1EQ6-AS.js → constants-51SEJjzI.js} +2 -2
  23. package/dist/constants-51SEJjzI.js.map +1 -0
  24. package/dist/{constants-BVZZfXua.js → constants-C9wKMfgo.js} +2 -2
  25. package/dist/constants-C9wKMfgo.js.map +1 -0
  26. package/dist/{constants-CrLEqZUc.js → constants-Dmtgr5z3.js} +3 -3
  27. package/dist/{constants-CrLEqZUc.js.map → constants-Dmtgr5z3.js.map} +1 -1
  28. package/dist/{constants-CuzR2B5C.js → constants-gYwz1n9Z.js} +3 -3
  29. package/dist/{constants-CuzR2B5C.js.map → constants-gYwz1n9Z.js.map} +1 -1
  30. package/dist/hooks.js +4 -4
  31. package/dist/{index-BARvqe7c.js → index-D4URTv1p.js} +2 -2
  32. package/dist/{index-BARvqe7c.js.map → index-D4URTv1p.js.map} +1 -1
  33. package/dist/{index-BkNaYmLc.js → index-DnHrq-hl.js} +2 -2
  34. package/dist/{index-BkNaYmLc.js.map → index-DnHrq-hl.js.map} +1 -1
  35. package/dist/index.js +6 -6
  36. package/dist/main.css +1 -1
  37. package/dist/main.css.map +1 -1
  38. package/dist/{useFormSubmission-CYqHLtkA.js → useFormSubmission-BGNEnxvm.js} +2 -2
  39. package/dist/{useFormSubmission-CYqHLtkA.js.map → useFormSubmission-BGNEnxvm.js.map} +1 -1
  40. package/dist/{useFormSubmission-DMoyM44A.js → useFormSubmission-BUPnuOSG.js} +2 -2
  41. package/dist/{useFormSubmission-DMoyM44A.js.map → useFormSubmission-BUPnuOSG.js.map} +1 -1
  42. package/dist/{utils-3vf7iBuC.js → utils-Bhu45zuy.js} +4 -4
  43. package/dist/{utils-3vf7iBuC.js.map → utils-Bhu45zuy.js.map} +1 -1
  44. package/dist/{utils-E-UQc-9z.js → utils-DsI2Nrwl.js} +4 -4
  45. package/dist/{utils-E-UQc-9z.js.map → utils-DsI2Nrwl.js.map} +1 -1
  46. package/package.json +17 -15
  47. package/dist/constants-BVZZfXua.js.map +0 -1
  48. package/dist/constants-b1EQ6-AS.js.map +0 -1
@@ -5,14 +5,14 @@ var classnames = require('classnames');
5
5
  var neetoCist = require('@bigbinary/neeto-cist');
6
6
  var Spinner = require('@bigbinary/neetoui/Spinner');
7
7
  var ramda = require('ramda');
8
- var constants = require('../constants-BVZZfXua.js');
9
- var constants$1 = require('../constants-CrLEqZUc.js');
8
+ var constants = require('../constants-C9wKMfgo.js');
9
+ var constants$1 = require('../constants-Dmtgr5z3.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-CXy5L1RP.js');
15
+ var buildForm = require('../buildForm-BwhLCvEE.js');
16
16
  var shallow = require('zustand/shallow');
17
17
  var Alert = require('@bigbinary/neetoui/Alert');
18
18
  var reactI18next = require('react-i18next');
@@ -23,7 +23,7 @@ var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
23
23
  var Dropdown = require('@bigbinary/neetoui/Dropdown');
24
24
  var Tooltip = require('@bigbinary/neetoui/Tooltip');
25
25
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
26
- var index = require('../index-BARvqe7c.js');
26
+ var index = require('../index-D4URTv1p.js');
27
27
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
28
28
  var i18next = require('i18next');
29
29
  var uuid = require('uuid');
@@ -226,7 +226,7 @@ var Overview = function Overview(_ref) {
226
226
  availableLanguages = _ref.availableLanguages,
227
227
  additionalActionOptions = _ref.additionalActionOptions;
228
228
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
229
- className: "neeto-form-nano-form-wrapper__overview mb-4 w-full flex-shrink-0 space-y-4 pt-6",
229
+ className: "neeto-form-nano-form-wrapper__overview mb-4 w-full shrink-0 space-y-4 pt-6",
230
230
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
231
231
  className: "flex items-center justify-between",
232
232
  children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
@@ -236,7 +236,7 @@ var Overview = function Overview(_ref) {
236
236
  weight: "neeto-ui-font-semibold",
237
237
  children: title
238
238
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
239
- className: "flex flex-shrink-0 items-center justify-between space-x-1",
239
+ className: "flex shrink-0 items-center justify-between space-x-1",
240
240
  children: [availableLanguages.length > 1 && /*#__PURE__*/jsxRuntime.jsx(ChangeLanguageDropdown, {
241
241
  availableLanguages: availableLanguages
242
242
  }), neetoCist.isPresent(additionalActionOptions) && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
@@ -268,7 +268,8 @@ var Card = function Card(_ref) {
268
268
  onSelect = _ref.onSelect,
269
269
  onEdit = _ref.onEdit,
270
270
  onClone = _ref.onClone,
271
- onDelete = _ref.onDelete;
271
+ onDelete = _ref.onDelete,
272
+ canManageQuestions = _ref.canManageQuestions;
272
273
  var _useState = React.useState(false),
273
274
  _useState2 = _slicedToArray(_useState, 2),
274
275
  isTooltipEnabled = _useState2[0],
@@ -296,15 +297,15 @@ var Card = function Card(_ref) {
296
297
  return onSelect(question);
297
298
  },
298
299
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
299
- className: "flex min-w-0 flex-grow items-center gap-1",
300
- children: [/*#__PURE__*/jsxRuntime.jsx(constants$1.Drag, {
301
- className: "neeto-ui-text-gray-600 flex-shrink-0"
300
+ className: "flex min-w-0 grow items-center gap-1",
301
+ children: [canManageQuestions && /*#__PURE__*/jsxRuntime.jsx(constants$1.Drag, {
302
+ className: "neeto-ui-text-gray-600 shrink-0"
302
303
  }), /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
303
304
  content: questionLabel,
304
305
  disabled: !isTooltipEnabled,
305
306
  position: "top",
306
307
  children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
307
- className: "line-clamp-2 min-w-0 flex-grow truncate break-words",
308
+ className: "line-clamp-2 min-w-0 grow truncate break-words",
308
309
  "data-cy": "".concat(neetoCist.slugify(questionLabel), "-question-card-label"),
309
310
  lineHeight: "snug",
310
311
  ref: questionLabelRef,
@@ -313,7 +314,7 @@ var Card = function Card(_ref) {
313
314
  children: questionLabel
314
315
  })
315
316
  })]
316
- }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
317
+ }), canManageQuestions && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
317
318
  dropdownButtonProps: {
318
319
  className: "shrink-0"
319
320
  },
@@ -355,9 +356,11 @@ var Questions = function Questions(_ref) {
355
356
  onEdit = _ref.onEdit,
356
357
  onClone = _ref.onClone,
357
358
  onDelete = _ref.onDelete,
358
- onSelect = _ref.onSelect;
359
+ onSelect = _ref.onSelect,
360
+ canManageQuestions = _ref.canManageQuestions;
359
361
  return /*#__PURE__*/jsxRuntime.jsx(dnd.Droppable, {
360
362
  droppableId: "droppable",
363
+ isDropDisabled: !canManageQuestions,
361
364
  children: function children(_ref2) {
362
365
  var droppableProps = _ref2.droppableProps,
363
366
  placeholder = _ref2.placeholder,
@@ -370,6 +373,7 @@ var Questions = function Questions(_ref) {
370
373
  return /*#__PURE__*/React.createElement(dnd.Draggable, {
371
374
  index: index,
372
375
  draggableId: "question-".concat((_question$id = question.id) !== null && _question$id !== void 0 ? _question$id : question.nodeId),
376
+ isDragDisabled: !canManageQuestions,
373
377
  key: "question-".concat((_question$id2 = question.id) !== null && _question$id2 !== void 0 ? _question$id2 : question.nodeId)
374
378
  }, function (_ref3) {
375
379
  var draggableProps = _ref3.draggableProps,
@@ -379,6 +383,7 @@ var Questions = function Questions(_ref) {
379
383
  ref: innerRef,
380
384
  children: /*#__PURE__*/jsxRuntime.jsx(Card, {
381
385
  allQuestionKinds: allQuestionKinds,
386
+ canManageQuestions: canManageQuestions,
382
387
  getActiveKindDetails: getActiveKindDetails,
383
388
  onClone: onClone,
384
389
  onEdit: onEdit,
@@ -2185,6 +2190,7 @@ var Form = function Form(_ref) {
2185
2190
  isDisabledFieldLabel = _ref.isDisabledFieldLabel,
2186
2191
  disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
2187
2192
  isFormEnabled = _ref.isFormEnabled,
2193
+ canManageQuestions = _ref.canManageQuestions,
2188
2194
  savedTitle = _ref.savedTitle,
2189
2195
  formTitle = _ref.formTitle,
2190
2196
  formDescription = _ref.formDescription,
@@ -2355,7 +2361,7 @@ var Form = function Form(_ref) {
2355
2361
  description: formDescription,
2356
2362
  title: formTitle
2357
2363
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
2358
- className: "neeto-form-nano-form-wrapper__body min-h-0 w-full flex-grow space-y-6 overflow-y-auto pb-6",
2364
+ className: "neeto-form-nano-form-wrapper__body min-h-0 w-full grow space-y-6 overflow-y-auto pb-6",
2359
2365
  children: neetoCist.isPresent(questions) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
2360
2366
  className: "space-y-6",
2361
2367
  ref: containerRef,
@@ -2374,6 +2380,7 @@ var Form = function Form(_ref) {
2374
2380
  });
2375
2381
  },
2376
2382
  children: /*#__PURE__*/jsxRuntime.jsx(Questions, {
2383
+ canManageQuestions: canManageQuestions,
2377
2384
  getActiveKindDetails: getActiveKindDetails,
2378
2385
  isDeletable: isDeletable,
2379
2386
  questions: questions,
@@ -2384,7 +2391,7 @@ var Form = function Form(_ref) {
2384
2391
  onEdit: handleEdit,
2385
2392
  onSelect: handleSelect
2386
2393
  })
2387
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
2394
+ }), canManageQuestions && /*#__PURE__*/jsxRuntime.jsx("div", {
2388
2395
  className: "mb-8 flex w-full items-center gap-x-1",
2389
2396
  children: /*#__PURE__*/jsxRuntime.jsx(AddQuestion, {
2390
2397
  addQuestionHelpProps: addQuestionHelpProps,
@@ -2395,7 +2402,7 @@ var Form = function Form(_ref) {
2395
2402
  })]
2396
2403
  }) : /*#__PURE__*/jsxRuntime.jsx(AddFirstQuestion, {
2397
2404
  disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2398
- isDisabled: ramda.isEmpty(availableQuestionKinds),
2405
+ isDisabled: ramda.isEmpty(availableQuestionKinds) || !canManageQuestions,
2399
2406
  onAdd: handleAdd
2400
2407
  })
2401
2408
  }), /*#__PURE__*/jsxRuntime.jsx(ManageQuestionPane, {
@@ -2456,7 +2463,9 @@ var BuildForm = function BuildForm(_ref) {
2456
2463
  usesCustomSubmissionComponent = _ref$usesCustomSubmis === void 0 ? false : _ref$usesCustomSubmis,
2457
2464
  _ref$onMutateSuccess = _ref.onMutateSuccess,
2458
2465
  onMutateSuccess = _ref$onMutateSuccess === void 0 ? neetoCist.noop : _ref$onMutateSuccess,
2459
- hostSpecificData = _ref.hostSpecificData;
2466
+ hostSpecificData = _ref.hostSpecificData,
2467
+ _ref$canManageQuestio = _ref.canManageQuestions,
2468
+ canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio;
2460
2469
  var queryClient = reactQuery.useQueryClient();
2461
2470
  var _useForm = constants.useForm({
2462
2471
  formId: id,
@@ -2498,6 +2507,7 @@ var BuildForm = function BuildForm(_ref) {
2498
2507
  additionalActionOptions: additionalActionOptions,
2499
2508
  advancedFeatures: advancedFeatures,
2500
2509
  availableLanguages: availableLanguages,
2510
+ canManageQuestions: canManageQuestions,
2501
2511
  disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2502
2512
  formDescription: formDescription,
2503
2513
  formTitle: formTitle,