@bigbinary/neeto-form-frontend 3.13.1 → 3.13.3

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.
@@ -108,6 +108,10 @@
108
108
  },
109
109
  "common": {
110
110
  "noData": "There are no questions to show",
111
+ "helpText": {
112
+ "learnAbout": "Learn about",
113
+ "howToAddNewQuestions": "how to add new questions"
114
+ },
111
115
  "primaryPanel": {
112
116
  "addQuestion": "Add question",
113
117
  "noQuestionLeft": "No more question fields to add"
package/dist/BuildForm.js CHANGED
@@ -4,11 +4,11 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, hyphenate
4
4
  import Spinner from '@bigbinary/neetoui/Spinner';
5
5
  import { equals, path, curry, assoc, prop, dissoc, when, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, paths, difference, split, last, either, T, F } from 'ramda';
6
6
  import { j as useDeleteQuestion, Q as QUESTION_TYPES, a as useForm, k as useCreateQuestion, l as useUpdateQuestion, C as CAPTCHA_TYPES, m as useReorderQuestions, i as QUERY_KEYS } from './constants-DBuFEVFA.js';
7
- import { d as buildDisplayLabel, e as INDEPENDENT_LABELS_MAP, f as QUESTION_ACTIONS, i as isElementOverflowing, D as Drag, h as SELECTABLE_KINDS, j as isAutoGeneratedQuestion, k as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, l as RESERVED_FIELD_CODES, L as LABEL_FIELDS, m as isDefaultLanguage, n as buildDisabledAddButtonTooltipProps, o as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, p as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, q as NON_HIDEABLE_FIELDS, r as NON_READ_ONLY_FIELDS, s as RICH_TEXT_QUESTIONS, t as FILE_TYPES_MAP, u as FILE_GROUPS, M as MINIMUM_OPTIONS, w as RATING_OPTIONS, x as STAR_RATING_MIN_VALUE_OPTIONS, y as STAR_RATING_MAX_VALUE_OPTIONS, z as STAR_RATING_ICONS_MAP, A as buildReorderPayload, B as isMandatoryField, G as QUESTION_KINDS, a as QUESTION_KIND, H as getActiveQuestionKindDetails, J as DEFAULT_AVAILABLE_LANGUAGES, K as DEFAULT_ADVANCED_FEATURES, O as QUESTIONS_INITIAL_VALUE } from './constants-T3w90EO4.js';
7
+ import { d as buildDisplayLabel, e as INDEPENDENT_LABELS_MAP, f as QUESTION_ACTIONS, i as isElementOverflowing, D as Drag, h as SELECTABLE_KINDS, j as isAutoGeneratedQuestion, k as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, l as RESERVED_FIELD_CODES, L as LABEL_FIELDS, m as isDefaultLanguage, n as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, o as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, p as NON_HIDEABLE_FIELDS, q as NON_READ_ONLY_FIELDS, r as RICH_TEXT_QUESTIONS, s as FILE_TYPES_MAP, t as FILE_GROUPS, M as MINIMUM_OPTIONS, u as RATING_OPTIONS, w as STAR_RATING_MIN_VALUE_OPTIONS, x as STAR_RATING_MAX_VALUE_OPTIONS, y as STAR_RATING_ICONS_MAP, z as buildDisabledAddButtonHelpPopoverProps, A as buildReorderPayload, B as isMandatoryField, G as QUESTION_KINDS, a as QUESTION_KIND, H as getActiveQuestionKindDetails, J as DEFAULT_AVAILABLE_LANGUAGES, K as DEFAULT_ADVANCED_FEATURES, O as QUESTIONS_INITIAL_VALUE } from './constants-R6y-Scns.js';
8
8
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
9
9
  import { useState, useRef, useEffect, createElement } from 'react';
10
10
  import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
11
- import { isMetaKeyPressed, withT, useStateWithDependency, useFuncDebounce, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
11
+ import { withT, isMetaKeyPressed, useStateWithDependency, useFuncDebounce, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
12
12
  import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
13
13
  import { a as useBuildFormStore } from './buildForm-DQ2wgwuW.js';
14
14
  import { shallow } from 'zustand/shallow';
@@ -26,6 +26,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
26
26
  import { t } from 'i18next';
27
27
  import { v4 } from 'uuid';
28
28
  import NoData from '@bigbinary/neetoui/NoData';
29
+ import Button from '@bigbinary/neetoui/Button';
29
30
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
30
31
  import Pane from '@bigbinary/neetoui/Pane';
31
32
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
@@ -36,7 +37,6 @@ import Select from '@bigbinary/neetoui/formik/Select';
36
37
  import Switch from '@bigbinary/neetoui/formik/Switch';
37
38
  import Textarea from '@bigbinary/neetoui/formik/Textarea';
38
39
  import NeetoEditor from '@bigbinary/neeto-editor/Editor';
39
- import Button from '@bigbinary/neetoui/Button';
40
40
  import Input from '@bigbinary/neetoui/formik/Input';
41
41
  import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
42
42
  import * as yup from 'yup';
@@ -549,20 +549,37 @@ var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
549
549
  };
550
550
  var formatQuestionAttributesForClone = when(isChoiceQuestion, assoc("isCloning", true));
551
551
 
552
+ var HelpText = withT(function (_ref) {
553
+ var t = _ref.t,
554
+ href = _ref.href;
555
+ return /*#__PURE__*/jsxs(Fragment, {
556
+ children: [t("neetoForm.questions.common.helpText.learnAbout"), " ", /*#__PURE__*/jsx(Button, {
557
+ href: href,
558
+ label: t("neetoForm.questions.common.helpText.howToAddNewQuestions"),
559
+ style: "link",
560
+ target: "_blank"
561
+ })]
562
+ });
563
+ });
564
+
552
565
  var AddFirstQuestion = function AddFirstQuestion(_ref) {
553
566
  var onAdd = _ref.onAdd,
554
567
  isDisabled = _ref.isDisabled,
555
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps;
568
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps;
556
569
  var _useTranslation = useTranslation(),
557
570
  t = _useTranslation.t;
558
- var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
571
+ var _disabledAddButtonHel = disabledAddButtonHelpPopoverProps.helpLinkProps,
572
+ _disabledAddButtonHel2 = _disabledAddButtonHel === void 0 ? {} : _disabledAddButtonHel,
573
+ href = _disabledAddButtonHel2.href;
559
574
  return /*#__PURE__*/jsx("div", {
560
575
  className: "flex h-full flex-col items-center justify-center py-8",
561
576
  children: /*#__PURE__*/jsx(NoData, {
562
- showTooltipWhenButtonDisabled: true,
563
577
  className: "min-h-80",
564
- title: t("neetoForm.questions.common.noData"),
565
- primaryButtonProps: buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
578
+ helpText: isPresent(href) ? /*#__PURE__*/jsx(HelpText, {
579
+ href: href
580
+ }) : null,
581
+ primaryButtonProps: buildAddQuestionButtonProps(onAdd, isDisabled),
582
+ title: t("neetoForm.questions.common.noData")
566
583
  })
567
584
  });
568
585
  };
@@ -2096,17 +2113,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
2096
2113
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2097
2114
  var AddQuestion = function AddQuestion(_ref) {
2098
2115
  var onAdd = _ref.onAdd,
2099
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2116
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
2100
2117
  isDisabled = _ref.isDisabled,
2101
2118
  addQuestionHelpProps = _ref.addQuestionHelpProps;
2102
- var tooltipProps = buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
2119
+ var helpPopoverProps = isDisabled ? buildDisabledAddButtonHelpPopoverProps(disabledAddButtonHelpPopoverProps) : {};
2103
2120
  return /*#__PURE__*/jsxs("div", {
2104
2121
  className: "mb-8 flex w-full items-center gap-x-1",
2105
- children: [/*#__PURE__*/jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
2106
- children: /*#__PURE__*/jsx("span", {
2107
- children: /*#__PURE__*/jsx(Button, _objectSpread({}, buildAddQuestionButtonProps(onAdd, isDisabled)))
2108
- })
2109
- })), isPresent(addQuestionHelpProps) && /*#__PURE__*/jsx("span", {
2122
+ children: [/*#__PURE__*/jsx(Button, _objectSpread({}, buildAddQuestionButtonProps(onAdd, isDisabled))), isDisabled && /*#__PURE__*/jsx(HelpPopover, _objectSpread({}, helpPopoverProps)), isPresent(addQuestionHelpProps) && !isDisabled && /*#__PURE__*/jsx("span", {
2110
2123
  children: /*#__PURE__*/jsx(HelpPopover, _objectSpread({}, addQuestionHelpProps))
2111
2124
  })]
2112
2125
  });
@@ -2121,7 +2134,7 @@ var Form = function Form(_ref) {
2121
2134
  isKindAlreadyActive = _ref.isKindAlreadyActive,
2122
2135
  getActiveKindDetails = _ref.getActiveKindDetails,
2123
2136
  isDisabledFieldLabel = _ref.isDisabledFieldLabel,
2124
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2137
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
2125
2138
  isFormEnabled = _ref.isFormEnabled,
2126
2139
  savedTitle = _ref.savedTitle,
2127
2140
  formTitle = _ref.formTitle,
@@ -2326,13 +2339,13 @@ var Form = function Form(_ref) {
2326
2339
  className: "mb-8 flex w-full items-center gap-x-1",
2327
2340
  children: /*#__PURE__*/jsx(AddQuestion, {
2328
2341
  addQuestionHelpProps: addQuestionHelpProps,
2329
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2342
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2330
2343
  isDisabled: isEmpty(availableQuestionKinds),
2331
2344
  onAdd: handleAdd
2332
2345
  })
2333
2346
  })]
2334
2347
  }) : /*#__PURE__*/jsx(AddFirstQuestion, {
2335
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2348
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2336
2349
  isDisabled: isEmpty(availableQuestionKinds),
2337
2350
  onAdd: handleAdd
2338
2351
  })
@@ -2380,7 +2393,8 @@ var BuildForm = function BuildForm(_ref) {
2380
2393
  onLanguageChange = _ref$onLanguageChange === void 0 ? noop : _ref$onLanguageChange,
2381
2394
  _ref$addQuestionHelpP = _ref.addQuestionHelpProps,
2382
2395
  addQuestionHelpProps = _ref$addQuestionHelpP === void 0 ? {} : _ref$addQuestionHelpP,
2383
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2396
+ _ref$disabledAddButto = _ref.disabledAddButtonHelpPopoverProps,
2397
+ disabledAddButtonHelpPopoverProps = _ref$disabledAddButto === void 0 ? {} : _ref$disabledAddButto,
2384
2398
  _ref$additionalAction = _ref.additionalActionOptions,
2385
2399
  additionalActionOptions = _ref$additionalAction === void 0 ? [] : _ref$additionalAction,
2386
2400
  _ref$allowAdditionalG = _ref.allowAdditionalGuests,
@@ -2435,7 +2449,7 @@ var BuildForm = function BuildForm(_ref) {
2435
2449
  additionalActionOptions: additionalActionOptions,
2436
2450
  advancedFeatures: advancedFeatures,
2437
2451
  availableLanguages: availableLanguages,
2438
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2452
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2439
2453
  formDescription: formDescription,
2440
2454
  formTitle: formTitle,
2441
2455
  getActiveKindDetails: getActiveKindDetails,