@bigbinary/neeto-form-frontend 4.4.48 → 4.4.49
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.
- package/app/javascript/src/translations/en.json +3 -0
- package/dist/.ready +1 -1
- package/dist/BuildForm.js +41 -19
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +2 -2
- package/dist/UrlBuilder.js +2 -2
- package/dist/cjs/BuildForm.js +40 -18
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +2 -2
- package/dist/cjs/UrlBuilder.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{utils-CvWFiOOa.js → utils-fwFV6wY2.js} +20 -4
- package/dist/cjs/utils-fwFV6wY2.js.map +1 -0
- package/dist/cjs/v2/BuildForm.js +71 -23
- package/dist/cjs/v2/BuildForm.js.map +1 -1
- package/dist/cjs/v2/ExternalForm.js +2 -2
- package/dist/cjs/v2/UrlBuilder.js +2 -2
- package/dist/cjs/v2/index.js +2 -2
- package/dist/cjs/v2/{utils-B6gAGQwC.js → utils-ByVT_m97.js} +20 -4
- package/dist/cjs/v2/utils-ByVT_m97.js.map +1 -0
- package/dist/cjs/v2/{yup-Rnk6JNb8.js → yup-B8wj6wiJ.js} +22 -9
- package/dist/cjs/v2/yup-B8wj6wiJ.js.map +1 -0
- package/dist/cjs/{yup-DvB9BGdG.js → yup-BxKE7dIP.js} +22 -9
- package/dist/cjs/yup-BxKE7dIP.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{utils-Dk_rwO1y.js → utils-B1PS7L37.js} +20 -4
- package/dist/utils-B1PS7L37.js.map +1 -0
- package/dist/v2/BuildForm.js +73 -25
- package/dist/v2/BuildForm.js.map +1 -1
- package/dist/v2/ExternalForm.js +2 -2
- package/dist/v2/UrlBuilder.js +2 -2
- package/dist/v2/index.js +2 -2
- package/dist/v2/{utils-CJ9PZpF1.js → utils-B7UPP2PR.js} +20 -4
- package/dist/v2/utils-B7UPP2PR.js.map +1 -0
- package/dist/v2/{yup-DItlKUzb.js → yup-Dxe5WpM2.js} +21 -10
- package/dist/v2/yup-Dxe5WpM2.js.map +1 -0
- package/dist/{yup-7qmI_2fI.js → yup-CWzW88_S.js} +21 -10
- package/dist/yup-CWzW88_S.js.map +1 -0
- package/package.json +3 -3
- package/dist/cjs/utils-CvWFiOOa.js.map +0 -1
- package/dist/cjs/v2/utils-B6gAGQwC.js.map +0 -1
- package/dist/cjs/v2/yup-Rnk6JNb8.js.map +0 -1
- package/dist/cjs/yup-DvB9BGdG.js.map +0 -1
- package/dist/utils-Dk_rwO1y.js.map +0 -1
- package/dist/v2/utils-CJ9PZpF1.js.map +0 -1
- package/dist/v2/yup-DItlKUzb.js.map +0 -1
- package/dist/yup-7qmI_2fI.js.map +0 -1
package/dist/v2/ExternalForm.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
package/dist/v2/UrlBuilder.js
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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,
|
|
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
|
-
},
|
|
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-
|
|
2858
|
+
//# sourceMappingURL=utils-B7UPP2PR.js.map
|