@bigbinary/neeto-form-frontend 4.4.48 → 4.4.50

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 (83) hide show
  1. package/app/javascript/src/translations/ar.json +6 -3
  2. package/app/javascript/src/translations/bg.json +6 -3
  3. package/app/javascript/src/translations/ca.json +6 -3
  4. package/app/javascript/src/translations/cs.json +6 -3
  5. package/app/javascript/src/translations/da.json +6 -3
  6. package/app/javascript/src/translations/de.json +6 -3
  7. package/app/javascript/src/translations/en.json +3 -0
  8. package/app/javascript/src/translations/es-MX.json +6 -3
  9. package/app/javascript/src/translations/es.json +6 -3
  10. package/app/javascript/src/translations/et.json +6 -3
  11. package/app/javascript/src/translations/fi.json +6 -3
  12. package/app/javascript/src/translations/fil.json +6 -3
  13. package/app/javascript/src/translations/fr.json +6 -3
  14. package/app/javascript/src/translations/he.json +6 -3
  15. package/app/javascript/src/translations/hi.json +6 -3
  16. package/app/javascript/src/translations/hr.json +6 -3
  17. package/app/javascript/src/translations/hu.json +6 -3
  18. package/app/javascript/src/translations/id.json +6 -3
  19. package/app/javascript/src/translations/it.json +6 -3
  20. package/app/javascript/src/translations/ja.json +6 -3
  21. package/app/javascript/src/translations/ko.json +6 -3
  22. package/app/javascript/src/translations/lv.json +6 -3
  23. package/app/javascript/src/translations/nl.json +6 -3
  24. package/app/javascript/src/translations/pl.json +6 -3
  25. package/app/javascript/src/translations/pt-BR.json +6 -3
  26. package/app/javascript/src/translations/pt.json +6 -3
  27. package/app/javascript/src/translations/ro.json +6 -3
  28. package/app/javascript/src/translations/ru.json +6 -3
  29. package/app/javascript/src/translations/sk.json +6 -3
  30. package/app/javascript/src/translations/sl.json +6 -3
  31. package/app/javascript/src/translations/sv.json +6 -3
  32. package/app/javascript/src/translations/th.json +6 -3
  33. package/app/javascript/src/translations/tr.json +6 -3
  34. package/app/javascript/src/translations/uk.json +6 -3
  35. package/app/javascript/src/translations/vi.json +6 -3
  36. package/app/javascript/src/translations/zh-CN.json +6 -3
  37. package/app/javascript/src/translations/zh-TW.json +6 -3
  38. package/dist/.ready +1 -1
  39. package/dist/BuildForm.js +41 -19
  40. package/dist/BuildForm.js.map +1 -1
  41. package/dist/ExternalForm.js +2 -2
  42. package/dist/UrlBuilder.js +2 -2
  43. package/dist/cjs/BuildForm.js +40 -18
  44. package/dist/cjs/BuildForm.js.map +1 -1
  45. package/dist/cjs/ExternalForm.js +2 -2
  46. package/dist/cjs/UrlBuilder.js +2 -2
  47. package/dist/cjs/index.js +2 -2
  48. package/dist/cjs/{utils-CvWFiOOa.js → utils-fwFV6wY2.js} +20 -4
  49. package/dist/cjs/utils-fwFV6wY2.js.map +1 -0
  50. package/dist/cjs/v2/BuildForm.js +71 -23
  51. package/dist/cjs/v2/BuildForm.js.map +1 -1
  52. package/dist/cjs/v2/ExternalForm.js +2 -2
  53. package/dist/cjs/v2/UrlBuilder.js +2 -2
  54. package/dist/cjs/v2/index.js +2 -2
  55. package/dist/cjs/v2/{utils-B6gAGQwC.js → utils-ByVT_m97.js} +20 -4
  56. package/dist/cjs/v2/utils-ByVT_m97.js.map +1 -0
  57. package/dist/cjs/v2/{yup-Rnk6JNb8.js → yup-B8wj6wiJ.js} +22 -9
  58. package/dist/cjs/v2/yup-B8wj6wiJ.js.map +1 -0
  59. package/dist/cjs/{yup-DvB9BGdG.js → yup-BxKE7dIP.js} +22 -9
  60. package/dist/cjs/yup-BxKE7dIP.js.map +1 -0
  61. package/dist/index.js +2 -2
  62. package/dist/{utils-Dk_rwO1y.js → utils-B1PS7L37.js} +20 -4
  63. package/dist/utils-B1PS7L37.js.map +1 -0
  64. package/dist/v2/BuildForm.js +73 -25
  65. package/dist/v2/BuildForm.js.map +1 -1
  66. package/dist/v2/ExternalForm.js +2 -2
  67. package/dist/v2/UrlBuilder.js +2 -2
  68. package/dist/v2/index.js +2 -2
  69. package/dist/v2/{utils-CJ9PZpF1.js → utils-B7UPP2PR.js} +20 -4
  70. package/dist/v2/utils-B7UPP2PR.js.map +1 -0
  71. package/dist/v2/{yup-DItlKUzb.js → yup-Dxe5WpM2.js} +21 -10
  72. package/dist/v2/yup-Dxe5WpM2.js.map +1 -0
  73. package/dist/{yup-7qmI_2fI.js → yup-CWzW88_S.js} +21 -10
  74. package/dist/yup-CWzW88_S.js.map +1 -0
  75. package/package.json +3 -3
  76. package/dist/cjs/utils-CvWFiOOa.js.map +0 -1
  77. package/dist/cjs/v2/utils-B6gAGQwC.js.map +0 -1
  78. package/dist/cjs/v2/yup-Rnk6JNb8.js.map +0 -1
  79. package/dist/cjs/yup-DvB9BGdG.js.map +0 -1
  80. package/dist/utils-Dk_rwO1y.js.map +0 -1
  81. package/dist/v2/utils-CJ9PZpF1.js.map +0 -1
  82. package/dist/v2/yup-DItlKUzb.js.map +0 -1
  83. package/dist/yup-7qmI_2fI.js.map +0 -1
@@ -18,8 +18,8 @@ import { I18nextProvider, useTranslation } from 'react-i18next';
18
18
  import { d as usePublicForm, g as useCreateSubmission, h as useUpdateSubmission, f as useSubmission, Q as QUERY_KEYS } from './useFormApi-B5a0zkAT.js';
19
19
  import { g as getComponentDisplayName } from './index-CUrkh_zd.js';
20
20
  import { jsx, jsxs } from 'react/jsx-runtime';
21
- 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-CJ9PZpF1.js';
22
- import { i as isBlank, C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, Q as QUESTION_KIND, p as parseServerError } from './yup-DItlKUzb.js';
21
+ 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-B7UPP2PR.js';
22
+ import { i as isBlank, C as CALLOUT_POSITIONS, b as CALLOUT_STYLES, L as LAST_ELEMENTS_THRESHOLD, Q as QUESTION_KIND, p as parseServerError } from './yup-Dxe5WpM2.js';
23
23
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
24
24
  import { withT } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
25
25
  import '@babel/runtime/helpers/toConsumableArray';
@@ -10,9 +10,9 @@ import PageLoader from '@bigbinary/neeto-molecules/v2/PageLoader';
10
10
  import { mergeLeft, map, filter, pluck, isEmpty } from 'ramda';
11
11
  import { useTranslation } from 'react-i18next';
12
12
  import { d as usePublicForm } from './useFormApi-B5a0zkAT.js';
13
- import { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-CJ9PZpF1.js';
13
+ import { F as FormikWrap, g as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs, a as generateInitValues } from './utils-B7UPP2PR.js';
14
14
  import { parsePhoneNumber } from 'libphonenumber-js';
15
- import { Q as QUESTION_KIND, a as QUESTIONS_WITHOUT_FIELD_CODE } from './yup-DItlKUzb.js';
15
+ import { Q as QUESTION_KIND, a as QUESTIONS_WITHOUT_FIELD_CODE } from './yup-Dxe5WpM2.js';
16
16
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
17
17
  import '@babel/runtime/helpers/toConsumableArray';
18
18
  import '@babel/runtime/helpers/objectWithoutProperties';
package/dist/v2/index.js CHANGED
@@ -24,7 +24,7 @@ import '@babel/runtime/helpers/typeof';
24
24
  import '@bigbinary/neeto-editor/utils';
25
25
  import '@bigbinary/neeto-atoms';
26
26
  import 'classnames';
27
- import './yup-DItlKUzb.js';
27
+ import './yup-Dxe5WpM2.js';
28
28
  import 'react';
29
29
  import 'react/jsx-runtime';
30
30
  import 'lucide-react';
@@ -49,7 +49,7 @@ import '@babel/runtime/regenerator';
49
49
  import '@bigbinary/neeto-molecules/v2/HelpPopover';
50
50
  import '@bigbinary/neeto-hotkeys';
51
51
  import '@bigbinary/neeto-molecules/v2/PageLoader';
52
- import './utils-CJ9PZpF1.js';
52
+ import './utils-B7UPP2PR.js';
53
53
  import 'libphonenumber-js';
54
54
  import '@bigbinary/neeto-editor/v2/EditorContent';
55
55
  import '@bigbinary/neeto-molecules/v2/PhoneNumber';
@@ -2,7 +2,7 @@ import { useEffect, useState, useImperativeHandle, memo, Fragment as Fragment$1
2
2
  import { useFormikContext, useField, Field as Field$1, FastField } from 'formik';
3
3
  import { isPresent, findBy, isNotEmpty, filterBy, findById, isNotPresent, hyphenate, noop, toLabelAndValue, getRandomInt, randomPick, slugify, notEqualsDeep } from '@bigbinary/neeto-cist';
4
4
  import { dayjs, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
5
- import { c as isFunction, d as isEmptyValues, Q as QUESTION_KIND, A as ADDRESS_FIELD_TYPES, S as SPOT_QUESTION_DEFAULT_VALUE, Y as YES_NO_VALUES, P as PARENTHESES_REGEX, R as RATING_VALUES, E as EMAIL_REGEX, e as SCHEMA_LESS_QUESTION_KINDS, f as SIX_DIGIT_NUMBER_REGEX, g as fieldWithFallback, h as ADDRESS_FIELD_WIDTHS, j as LABEL_FIELDS, k as generateArray, D as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, l as RADIO_DESELECT_KEYS, m as RATING_OPTIONS, I as ICONS_MAP, n as YES_NO_DISPLAY_ICONS_MAP } from './yup-DItlKUzb.js';
5
+ import { c as isFunction, d as isEmptyValues, Q as QUESTION_KIND, A as ADDRESS_FIELD_TYPES, S as SPOT_QUESTION_DEFAULT_VALUE, Y as YES_NO_VALUES, P as PARENTHESES_REGEX, R as RATING_VALUES, E as EMAIL_REGEX, e as SCHEMA_LESS_QUESTION_KINDS, I as INTEGER_REGEX, D as DECIMAL_REGEX, f as SIX_DIGIT_NUMBER_REGEX, g as fieldWithFallback, h as ADDRESS_FIELD_WIDTHS, j as LABEL_FIELDS, k as generateArray, l as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, m as RADIO_DESELECT_KEYS, n as RATING_OPTIONS, o as ICONS_MAP, q as YES_NO_DISPLAY_ICONS_MAP } from './yup-Dxe5WpM2.js';
6
6
  import { parsePhoneNumber } from 'libphonenumber-js';
7
7
  import { getFromLocalStorage, setToLocalStorage, removeFromLocalStorage, dayjs as dayjs$1, withEventTargetValue } from '@bigbinary/neeto-commons-frontend/v2/utils';
8
8
  import { pick, mergeRight, omit, isEmpty, max, when, is, last, includes, __, mergeLeft, isNil, clamp, prop, trim, map, zipObj, identity, pluck, values, pipe, dec, equals } from 'ramda';
@@ -672,6 +672,12 @@ var validateTextField = function validateTextField(_ref) {
672
672
  }
673
673
  var requiredError = kind === QUESTION_KIND.SPOT.value ? t("neetoForm.questions.spot.numberOfSpotsRequired") : getRequiredFieldError(label);
674
674
  if (isRequired) schema = schema.trim().required(requiredError);
675
+ if ([QUESTION_KIND.INTEGER.value, QUESTION_KIND.DECIMAL.value].includes(kind)) {
676
+ var pattern = kind === QUESTION_KIND.INTEGER.value ? INTEGER_REGEX : DECIMAL_REGEX;
677
+ schema = schema.test("number", getInvalidFieldError(label), function (value) {
678
+ return isNotPresent(value) || pattern.test(value);
679
+ });
680
+ }
675
681
  if (kind === QUESTION_KIND.SPOT.value) {
676
682
  schema = schema.test("integer-spots", t("neetoForm.questions.spot.mustBeInteger"), function (value) {
677
683
  return isNotPresent(value) || value === "" || Number.isInteger(Number(value));
@@ -2686,15 +2692,25 @@ var TextField = function TextField(_ref) {
2686
2692
  setValue = _useField2$2.setValue,
2687
2693
  setTouched = _useField2$2.setTouched;
2688
2694
  var handleFieldChange = withEventTargetValue(setValue);
2695
+ var isNumber = [QUESTION_KIND.INTEGER.value, QUESTION_KIND.DECIMAL.value].includes(kind);
2696
+ var handleNumberPaste = function handleNumberPaste(event) {
2697
+ event.preventDefault();
2698
+ var text = event.clipboardData.getData("text/plain").replace(/[eE+]/g, "");
2699
+ var value = kind === QUESTION_KIND.INTEGER.value ? parseInt(text) : parseFloat(text);
2700
+ setValue(Number.isNaN(value) ? "" : value);
2701
+ };
2689
2702
  return /*#__PURE__*/jsxs("div", {
2690
2703
  className: "w-full flex flex-col gap-2",
2691
- children: [/*#__PURE__*/jsx(Component, _objectSpread$1(_objectSpread$1({}, _objectSpread$1(_objectSpread$1(_objectSpread$1({
2704
+ children: [/*#__PURE__*/jsx(Component, _objectSpread$1(_objectSpread$1({}, _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({
2692
2705
  type: type
2693
2706
  }, field), {}, {
2694
2707
  autoComplete: autoComplete,
2695
2708
  label: label,
2696
2709
  onKeyDown: onKeyDown
2697
- }, kind === QUESTION_KIND.SPOT.value && _objectSpread$1({
2710
+ }, isNumber && {
2711
+ step: kind === QUESTION_KIND.DECIMAL.value ? "any" : 1,
2712
+ onPaste: handleNumberPaste
2713
+ }), kind === QUESTION_KIND.SPOT.value && _objectSpread$1({
2698
2714
  min: 1
2699
2715
  }, typeof remainingSlotsCount === "number" && remainingSlotsCount >= 0 && {
2700
2716
  max: remainingSlotsCount
@@ -2839,4 +2855,4 @@ var getVisibleOptions = function getVisibleOptions(options) {
2839
2855
  };
2840
2856
 
2841
2857
  export { FormikWrap as F, generateInitValues as a, buildAutoCompleteAttribute as b, clientI18nInstance$1 as c, getWithExpiry as d, clearEmailVerificationDetails as e, generateFormResponse as f, getFieldComponent as g, clearLocalStorageValues as h, mergeRefs as m, renderButtonsInOrder as r };
2842
- //# sourceMappingURL=utils-CJ9PZpF1.js.map
2858
+ //# sourceMappingURL=utils-B7UPP2PR.js.map