@bigbinary/neeto-form-frontend 3.13.0 → 3.13.2

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.
@@ -26,8 +26,8 @@ import { a as isBlank, g as getComponentDisplayName, p as parseServerError } fro
26
26
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
27
27
  import Check from '@bigbinary/neeto-icons/Check';
28
28
  import { jsx, jsxs } from 'react/jsx-runtime';
29
- import { C as CALLOUT_STYLES, b as CALLOUT_POSITIONS } from './constants-T3w90EO4.js';
30
- import { c as clientI18nInstance, d as getWithExpiry, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-CtH5-JaK.js';
29
+ import { C as CALLOUT_STYLES, b as CALLOUT_POSITIONS } from './constants-R6y-Scns.js';
30
+ import { c as clientI18nInstance, d as getWithExpiry, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-sLnx21A2.js';
31
31
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
32
32
  import '@babel/runtime/helpers/toConsumableArray';
33
33
  import '@bigbinary/neeto-commons-frontend/constants';
@@ -10,10 +10,10 @@ import Button from '@bigbinary/neetoui/Button';
10
10
  import NoData from '@bigbinary/neetoui/NoData';
11
11
  import { map, mergeLeft, filter, pluck, isEmpty } from 'ramda';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-CtH5-JaK.js';
13
+ import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-sLnx21A2.js';
14
14
  import { b as usePublicForm } from './constants-DBuFEVFA.js';
15
15
  import { parsePhoneNumber } from 'libphonenumber-js';
16
- import { Q as QUESTIONS_WITHOUT_FIELD_CODE, a as QUESTION_KIND } from './constants-T3w90EO4.js';
16
+ import { Q as QUESTIONS_WITHOUT_FIELD_CODE, a as QUESTION_KIND } from './constants-R6y-Scns.js';
17
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
18
  import './index-BGEdOqsc.js';
19
19
  import '@babel/runtime/helpers/typeof';
@@ -3,10 +3,10 @@
3
3
  var reactQuery = require('@tanstack/react-query');
4
4
  var classnames = require('classnames');
5
5
  var neetoCist = require('@bigbinary/neeto-cist');
6
- var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
6
+ var Spinner = require('@bigbinary/neetoui/Spinner');
7
7
  var ramda = require('ramda');
8
8
  var constants = require('../constants-Dq9-rvtB.js');
9
- var constants$1 = require('../constants-Bx5mJ_UK.js');
9
+ var constants$1 = require('../constants-CDhYxmSQ.js');
10
10
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
11
11
  var React = require('react');
12
12
  var dnd = require('@hello-pangea/dnd');
@@ -28,6 +28,7 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
28
28
  var i18next = require('i18next');
29
29
  var uuid = require('uuid');
30
30
  var NoData = require('@bigbinary/neetoui/NoData');
31
+ var Button = require('@bigbinary/neetoui/Button');
31
32
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
32
33
  var Pane = require('@bigbinary/neetoui/Pane');
33
34
  var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
@@ -38,7 +39,6 @@ var Select = require('@bigbinary/neetoui/formik/Select');
38
39
  var Switch = require('@bigbinary/neetoui/formik/Switch');
39
40
  var Textarea = require('@bigbinary/neetoui/formik/Textarea');
40
41
  var NeetoEditor = require('@bigbinary/neeto-editor/Editor');
41
- var Button = require('@bigbinary/neetoui/Button');
42
42
  var Input = require('@bigbinary/neetoui/formik/Input');
43
43
  var utils$1 = require('@bigbinary/neeto-editor/utils');
44
44
  var yup = require('yup');
@@ -570,20 +570,37 @@ var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
570
570
  };
571
571
  var formatQuestionAttributesForClone = ramda.when(isChoiceQuestion, ramda.assoc("isCloning", true));
572
572
 
573
+ var HelpText = reactUtils.withT(function (_ref) {
574
+ var t = _ref.t,
575
+ href = _ref.href;
576
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
577
+ children: [t("neetoForm.questions.common.helpText.learnAbout"), " ", /*#__PURE__*/jsxRuntime.jsx(Button, {
578
+ href: href,
579
+ label: t("neetoForm.questions.common.helpText.howToAddNewQuestions"),
580
+ style: "link",
581
+ target: "_blank"
582
+ })]
583
+ });
584
+ });
585
+
573
586
  var AddFirstQuestion = function AddFirstQuestion(_ref) {
574
587
  var onAdd = _ref.onAdd,
575
588
  isDisabled = _ref.isDisabled,
576
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps;
589
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps;
577
590
  var _useTranslation = reactI18next.useTranslation(),
578
591
  t = _useTranslation.t;
579
- var tooltipProps = constants$1.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
592
+ var _disabledAddButtonHel = disabledAddButtonHelpPopoverProps.helpLinkProps,
593
+ _disabledAddButtonHel2 = _disabledAddButtonHel === void 0 ? {} : _disabledAddButtonHel,
594
+ href = _disabledAddButtonHel2.href;
580
595
  return /*#__PURE__*/jsxRuntime.jsx("div", {
581
596
  className: "flex h-full flex-col items-center justify-center py-8",
582
597
  children: /*#__PURE__*/jsxRuntime.jsx(NoData, {
583
- showTooltipWhenButtonDisabled: true,
584
598
  className: "min-h-80",
585
- title: t("neetoForm.questions.common.noData"),
586
- primaryButtonProps: constants$1.buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps)
599
+ helpText: neetoCist.isPresent(href) ? /*#__PURE__*/jsxRuntime.jsx(HelpText, {
600
+ href: href
601
+ }) : null,
602
+ primaryButtonProps: constants$1.buildAddQuestionButtonProps(onAdd, isDisabled),
603
+ title: t("neetoForm.questions.common.noData")
587
604
  })
588
605
  });
589
606
  };
@@ -2117,17 +2134,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
2117
2134
  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; }
2118
2135
  var AddQuestion = function AddQuestion(_ref) {
2119
2136
  var onAdd = _ref.onAdd,
2120
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2137
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
2121
2138
  isDisabled = _ref.isDisabled,
2122
2139
  addQuestionHelpProps = _ref.addQuestionHelpProps;
2123
- var tooltipProps = constants$1.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
2140
+ var helpPopoverProps = isDisabled ? constants$1.buildDisabledAddButtonHelpPopoverProps(disabledAddButtonHelpPopoverProps) : {};
2124
2141
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
2125
2142
  className: "mb-8 flex w-full items-center gap-x-1",
2126
- children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
2127
- children: /*#__PURE__*/jsxRuntime.jsx("span", {
2128
- children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({}, constants$1.buildAddQuestionButtonProps(onAdd, isDisabled)))
2129
- })
2130
- })), neetoCist.isPresent(addQuestionHelpProps) && /*#__PURE__*/jsxRuntime.jsx("span", {
2143
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({}, constants$1.buildAddQuestionButtonProps(onAdd, isDisabled))), isDisabled && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread({}, helpPopoverProps)), neetoCist.isPresent(addQuestionHelpProps) && !isDisabled && /*#__PURE__*/jsxRuntime.jsx("span", {
2131
2144
  children: /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread({}, addQuestionHelpProps))
2132
2145
  })]
2133
2146
  });
@@ -2142,7 +2155,7 @@ var Form = function Form(_ref) {
2142
2155
  isKindAlreadyActive = _ref.isKindAlreadyActive,
2143
2156
  getActiveKindDetails = _ref.getActiveKindDetails,
2144
2157
  isDisabledFieldLabel = _ref.isDisabledFieldLabel,
2145
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2158
+ disabledAddButtonHelpPopoverProps = _ref.disabledAddButtonHelpPopoverProps,
2146
2159
  isFormEnabled = _ref.isFormEnabled,
2147
2160
  savedTitle = _ref.savedTitle,
2148
2161
  formTitle = _ref.formTitle,
@@ -2347,13 +2360,13 @@ var Form = function Form(_ref) {
2347
2360
  className: "mb-8 flex w-full items-center gap-x-1",
2348
2361
  children: /*#__PURE__*/jsxRuntime.jsx(AddQuestion, {
2349
2362
  addQuestionHelpProps: addQuestionHelpProps,
2350
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2363
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2351
2364
  isDisabled: ramda.isEmpty(availableQuestionKinds),
2352
2365
  onAdd: handleAdd
2353
2366
  })
2354
2367
  })]
2355
2368
  }) : /*#__PURE__*/jsxRuntime.jsx(AddFirstQuestion, {
2356
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2369
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2357
2370
  isDisabled: ramda.isEmpty(availableQuestionKinds),
2358
2371
  onAdd: handleAdd
2359
2372
  })
@@ -2401,7 +2414,8 @@ var BuildForm = function BuildForm(_ref) {
2401
2414
  onLanguageChange = _ref$onLanguageChange === void 0 ? neetoCist.noop : _ref$onLanguageChange,
2402
2415
  _ref$addQuestionHelpP = _ref.addQuestionHelpProps,
2403
2416
  addQuestionHelpProps = _ref$addQuestionHelpP === void 0 ? {} : _ref$addQuestionHelpP,
2404
- disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
2417
+ _ref$disabledAddButto = _ref.disabledAddButtonHelpPopoverProps,
2418
+ disabledAddButtonHelpPopoverProps = _ref$disabledAddButto === void 0 ? {} : _ref$disabledAddButto,
2405
2419
  _ref$additionalAction = _ref.additionalActionOptions,
2406
2420
  additionalActionOptions = _ref$additionalAction === void 0 ? [] : _ref$additionalAction,
2407
2421
  _ref$allowAdditionalG = _ref.allowAdditionalGuests,
@@ -2431,7 +2445,7 @@ var BuildForm = function BuildForm(_ref) {
2431
2445
  if (isLoading || isQuestionsLoading && !isQuestionsPending) {
2432
2446
  return /*#__PURE__*/jsxRuntime.jsx("div", {
2433
2447
  className: "flex h-full w-full items-center justify-center py-6",
2434
- children: /*#__PURE__*/jsxRuntime.jsx(PageLoader, {})
2448
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
2435
2449
  });
2436
2450
  }
2437
2451
  var onValueChange = function onValueChange(questions) {
@@ -2456,7 +2470,7 @@ var BuildForm = function BuildForm(_ref) {
2456
2470
  additionalActionOptions: additionalActionOptions,
2457
2471
  advancedFeatures: advancedFeatures,
2458
2472
  availableLanguages: availableLanguages,
2459
- disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2473
+ disabledAddButtonHelpPopoverProps: disabledAddButtonHelpPopoverProps,
2460
2474
  formDescription: formDescription,
2461
2475
  formTitle: formTitle,
2462
2476
  getActiveKindDetails: getActiveKindDetails,