@bigbinary/neeto-form-frontend 4.4.19 → 4.4.21

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.
@@ -25,8 +25,8 @@ import { a as isBlank, g as getComponentDisplayName, p as parseServerError } fro
25
25
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
26
26
  import Check from '@bigbinary/neeto-icons/Check';
27
27
  import { jsx, jsxs } from 'react/jsx-runtime';
28
- import { C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, a as QUESTION_KIND } from './yup-CBPWSDXh.js';
29
- import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, a as generateInitValues, f as generateFormResponse, h as clearLocalStorageValues } from './utils-NwGbGewW.js';
28
+ import { C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, a as QUESTION_KIND } from './yup-HtJir_DP.js';
29
+ import { c as clientI18nInstance, d as getWithExpiry, e as clearEmailVerificationDetails, F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, a as generateInitValues, f as generateFormResponse, h as clearLocalStorageValues } from './utils-DDqyUd-y.js';
30
30
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
31
31
  import '@babel/runtime/helpers/toConsumableArray';
32
32
  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 { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-NwGbGewW.js';
13
+ import { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-DDqyUd-y.js';
14
14
  import { d as usePublicForm } from './constants-Cj0XxE8a.js';
15
15
  import { parsePhoneNumber } from 'libphonenumber-js';
16
- import { Q as QUESTIONS_WITHOUT_FIELD_CODE, a as QUESTION_KIND } from './yup-CBPWSDXh.js';
16
+ import { Q as QUESTIONS_WITHOUT_FIELD_CODE, a as QUESTION_KIND } from './yup-HtJir_DP.js';
17
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
18
  import './index-DhtQJpD_.js';
19
19
  import '@babel/runtime/helpers/typeof';
@@ -6,7 +6,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
6
6
  var Spinner = require('@bigbinary/neetoui/Spinner');
7
7
  var ramda = require('ramda');
8
8
  var constants = require('../constants-D5JlvWws.js');
9
- var yup = require('../yup-COZendlM.js');
9
+ var yup = require('../yup-C_bfpTXI.js');
10
10
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
11
11
  var React = require('react');
12
12
  var dnd = require('@hello-pangea/dnd');
@@ -23,6 +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 Equals = require('@bigbinary/neeto-icons/Equals');
26
27
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
27
28
  var index = require('../index-Beo6ztaM.js');
28
29
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
@@ -335,7 +336,8 @@ var Card = function Card(_ref) {
335
336
  allQuestionKinds: allQuestionKinds,
336
337
  item: question
337
338
  }),
338
- isSingular = _getActiveKindDetails.isSingular;
339
+ isSingular = _getActiveKindDetails.isSingular,
340
+ KindIcon = _getActiveKindDetails.icon;
339
341
  var questionLabel = yup.buildDisplayLabel(question);
340
342
  React.useEffect(function () {
341
343
  var element = questionLabelRef.current;
@@ -343,62 +345,60 @@ var Card = function Card(_ref) {
343
345
  setIsTooltipEnabled(yup.isElementOverflowing(element));
344
346
  }, [questionLabel]);
345
347
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
346
- className: "flex items-center gap-0.5",
347
- children: [canManageQuestions && /*#__PURE__*/jsxRuntime.jsx(yup.Drag, {
348
- className: "neeto-ui-text-gray-400 hover:neeto-ui-text-gray-500 transition-all ease-in-out duration-300 shrink-0 cursor-grab -ml-1",
349
- size: 16
350
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
351
- "data-testid": "neeto-form-engine-".concat(neetoCist.slugify(questionLabel)),
352
- className: classnames("neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-white neeto-form-nano-form__card flex h-10 grow items-center justify-between gap-1 border p-2 overflow-hidden", {
353
- "neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
354
- }),
355
- onClick: function onClick() {
356
- return onSelect(question);
357
- },
358
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
359
- className: "flex min-w-0 grow items-center gap-1",
360
- children: /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
361
- content: questionLabel,
362
- disabled: !isTooltipEnabled,
363
- position: "top",
364
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
365
- className: "line-clamp-2 min-w-0 grow truncate break-words",
366
- "data-testid": "".concat(neetoCist.slugify(questionLabel), "-question-card-label"),
367
- lineHeight: "snug",
368
- ref: questionLabelRef,
369
- style: "body2",
370
- weight: "medium",
371
- children: questionLabel
372
- })
348
+ "data-testid": "neeto-form-engine-".concat(neetoCist.slugify(questionLabel)),
349
+ className: classnames("neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-white neeto-form-nano-form__card flex h-10 w-full items-center justify-between gap-2 overflow-hidden border p-2", {
350
+ "neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
351
+ }),
352
+ onClick: function onClick() {
353
+ return onSelect(question);
354
+ },
355
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
356
+ className: "flex min-w-0 grow items-center gap-2",
357
+ children: [KindIcon && /*#__PURE__*/jsxRuntime.jsx(KindIcon, {
358
+ className: "neeto-ui-text-gray-600 shrink-0",
359
+ "data-testid": "question-card-kind-icon",
360
+ size: 16
361
+ }), /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
362
+ content: questionLabel,
363
+ disabled: !isTooltipEnabled,
364
+ position: "top",
365
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
366
+ className: "min-w-0 grow truncate",
367
+ "data-testid": "".concat(neetoCist.slugify(questionLabel), "-question-card-label"),
368
+ lineHeight: "snug",
369
+ ref: questionLabelRef,
370
+ style: "body2",
371
+ weight: "medium",
372
+ children: questionLabel
373
373
  })
374
- }), canManageQuestions && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
375
- dropdownButtonProps: {
376
- className: "shrink-0"
377
- },
378
- dropdownProps: {
379
- strategy: "fixed"
380
- },
381
- menuItems: [{
382
- "data-testid": "edit-question",
383
- key: "edit",
384
- label: t("neetoForm.common.edit"),
385
- onClick: onEdit
386
- }, {
387
- "data-testid": "clone-question",
388
- key: "clone",
389
- label: t("neetoForm.common.clone"),
390
- isVisible: !isSingular && index.isFunction(onClone),
391
- onClick: onClone
392
- }].concat(_toConsumableArray(extraMenuItems), [{
393
- "data-testid": "delete-question",
394
- key: "delete",
395
- label: t("neetoForm.common.delete"),
396
- isVisible: index.isFunction(onDelete),
397
- onClick: function onClick() {
398
- return onDelete(question);
399
- }
400
- }])
401
374
  })]
375
+ }), canManageQuestions && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
376
+ dropdownButtonProps: {
377
+ className: "shrink-0"
378
+ },
379
+ dropdownProps: {
380
+ strategy: "fixed"
381
+ },
382
+ menuItems: [{
383
+ "data-testid": "edit-question",
384
+ key: "edit",
385
+ label: t("neetoForm.common.edit"),
386
+ onClick: onEdit
387
+ }, {
388
+ "data-testid": "clone-question",
389
+ key: "clone",
390
+ label: t("neetoForm.common.clone"),
391
+ isVisible: !isSingular && index.isFunction(onClone),
392
+ onClick: onClone
393
+ }].concat(_toConsumableArray(extraMenuItems), [{
394
+ "data-testid": "delete-question",
395
+ key: "delete",
396
+ label: t("neetoForm.common.delete"),
397
+ isVisible: index.isFunction(onDelete),
398
+ onClick: function onClick() {
399
+ return onDelete(question);
400
+ }
401
+ }])
402
402
  })]
403
403
  });
404
404
  };
@@ -439,20 +439,30 @@ var Questions = function Questions(_ref) {
439
439
  var draggableProps = _ref3.draggableProps,
440
440
  dragHandleProps = _ref3.dragHandleProps,
441
441
  innerRef = _ref3.innerRef;
442
- return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$j(_objectSpread$j(_objectSpread$j({}, draggableProps), dragHandleProps), {}, {
442
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$j(_objectSpread$j({}, draggableProps), {}, {
443
+ className: "flex items-center gap-1",
443
444
  ref: innerRef,
444
- children: /*#__PURE__*/jsxRuntime.jsx(Card, {
445
- allQuestionKinds: allQuestionKinds,
446
- canManageQuestions: canManageQuestions,
447
- getActiveKindDetails: getActiveKindDetails,
448
- onClone: onClone,
449
- onEdit: onEdit,
450
- onSelect: onSelect,
451
- question: question,
452
- extraMenuItems: (_getQuestionMenuExtra = getQuestionMenuExtras === null || getQuestionMenuExtras === void 0 ? void 0 : getQuestionMenuExtras(question)) !== null && _getQuestionMenuExtra !== void 0 ? _getQuestionMenuExtra : [],
453
- isActive: ramda.equals(selectedQuestion, question),
454
- onDelete: isDeletable(question) && onDelete
455
- })
445
+ children: [canManageQuestions && /*#__PURE__*/jsxRuntime.jsx("span", _objectSpread$j(_objectSpread$j({}, dragHandleProps), {}, {
446
+ className: "neeto-ui-text-gray-400 hover:neeto-ui-text-gray-500 shrink-0 cursor-grab transition-all duration-300 ease-in-out",
447
+ "data-testid": "question-card-drag-handle",
448
+ children: /*#__PURE__*/jsxRuntime.jsx(Equals, {
449
+ size: 16
450
+ })
451
+ })), /*#__PURE__*/jsxRuntime.jsx("div", {
452
+ className: "min-w-0 grow",
453
+ children: /*#__PURE__*/jsxRuntime.jsx(Card, {
454
+ allQuestionKinds: allQuestionKinds,
455
+ canManageQuestions: canManageQuestions,
456
+ getActiveKindDetails: getActiveKindDetails,
457
+ onClone: onClone,
458
+ onEdit: onEdit,
459
+ onSelect: onSelect,
460
+ question: question,
461
+ extraMenuItems: (_getQuestionMenuExtra = getQuestionMenuExtras === null || getQuestionMenuExtras === void 0 ? void 0 : getQuestionMenuExtras(question)) !== null && _getQuestionMenuExtra !== void 0 ? _getQuestionMenuExtra : [],
462
+ isActive: ramda.equals(selectedQuestion, question),
463
+ onDelete: isDeletable(question) && onDelete
464
+ })
465
+ })]
456
466
  }));
457
467
  });
458
468
  }), placeholder]