@itcase/forms 1.1.51 → 1.1.53
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/dist/css/form/Field/InputNumber/FormFieldInputNumber.css +52 -0
- package/dist/css/styles/main.css +188 -0
- package/dist/itcase-forms.cjs.js +204 -118
- package/dist/itcase-forms.esm.js +203 -119
- package/package.json +9 -9
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -16,6 +16,7 @@ var Chips = require('@itcase/ui/components/Chips');
|
|
|
16
16
|
var Choice = require('@itcase/ui/components/Choice');
|
|
17
17
|
var Code = require('@itcase/ui/components/Code');
|
|
18
18
|
var Icon = require('@itcase/ui/components/Icon');
|
|
19
|
+
var Dadata = require('@itcase/ui/components/Dadata');
|
|
19
20
|
var DatePicker = require('@itcase/ui/components/DatePicker');
|
|
20
21
|
var useDevicePropsGenerator = require('@itcase/ui/hooks/useDevicePropsGenerator');
|
|
21
22
|
var axios = require('axios');
|
|
@@ -27,6 +28,7 @@ var Button = require('@itcase/ui/components/Button');
|
|
|
27
28
|
var Loader = require('@itcase/ui/components/Loader');
|
|
28
29
|
var Title = require('@itcase/ui/components/Title');
|
|
29
30
|
var Input = require('@itcase/ui/components/Input');
|
|
31
|
+
var InputNumber = require('@itcase/ui/components/InputNumber');
|
|
30
32
|
var reactImask = require('react-imask');
|
|
31
33
|
var InputPassword = require('@itcase/ui/components/InputPassword');
|
|
32
34
|
var Radio = require('@itcase/ui/components/Radio');
|
|
@@ -34,7 +36,6 @@ var Segmented = require('@itcase/ui/components/Segmented');
|
|
|
34
36
|
var Select = require('@itcase/ui/components/Select');
|
|
35
37
|
var Switch = require('@itcase/ui/components/Switch');
|
|
36
38
|
var Textarea = require('@itcase/ui/components/Textarea');
|
|
37
|
-
var Dadata = require('@itcase/ui/components/Dadata');
|
|
38
39
|
var Group = require('@itcase/ui/components/Group');
|
|
39
40
|
var Notification = require('@itcase/ui/components/Notification');
|
|
40
41
|
var createDecorator = require('final-form-focus');
|
|
@@ -383,12 +384,12 @@ function FieldWrapperBase(props) {
|
|
|
383
384
|
const errorTextWeight = props[`${errorKey}MessageTextWeight`];
|
|
384
385
|
return /*#__PURE__*/React__default.default.createElement(Tag, {
|
|
385
386
|
className: clsx__default.default(formFieldClass, 'form__item', 'form-field', type && `form-field_type_${type}`, sizeClass, fillClass, shapeClass, isDisabled && `form-field_state_disabled`, isHidden && `form-field_state_hidden`, directionClass, widthClass),
|
|
386
|
-
"data-testid": `${inputName}
|
|
387
|
+
"data-testid": `${inputName}-field`,
|
|
387
388
|
"data-tour": dataTour,
|
|
388
389
|
style: formFieldStyles
|
|
389
390
|
}, before, (label || labelHidden) && /*#__PURE__*/React__default.default.createElement("div", {
|
|
390
391
|
className: clsx__default.default('form-field__label'),
|
|
391
|
-
"data-testid": `${inputName}
|
|
392
|
+
"data-testid": `${inputName}-field-label`,
|
|
392
393
|
htmlFor: id
|
|
393
394
|
}, /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
394
395
|
size: labelTextSize,
|
|
@@ -398,7 +399,7 @@ function FieldWrapperBase(props) {
|
|
|
398
399
|
sizeTablet: labelTextSizeTablet
|
|
399
400
|
}, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React__default.default.createElement("div", {
|
|
400
401
|
className: "form-field__desc",
|
|
401
|
-
"data-testid": `${inputName}
|
|
402
|
+
"data-testid": `${inputName}-field-desc`
|
|
402
403
|
}, /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
403
404
|
size: descTextSize,
|
|
404
405
|
textColor: descTextColor,
|
|
@@ -415,24 +416,24 @@ function FieldWrapperBase(props) {
|
|
|
415
416
|
fill: dividerFill
|
|
416
417
|
})), showMessage && /*#__PURE__*/React__default.default.createElement("div", {
|
|
417
418
|
className: "form-field__message",
|
|
418
|
-
"data-testid": `${inputName}
|
|
419
|
+
"data-testid": `${inputName}-field-message`
|
|
419
420
|
}, isErrorState && errorMessage && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
420
421
|
id: `${inputName}-error`,
|
|
421
422
|
className: "form-field__message-item form-field__message-item_type-error",
|
|
422
|
-
dataTestId: `${inputName}
|
|
423
|
+
dataTestId: `${inputName}-field-message-error`,
|
|
423
424
|
size: errorTextSize,
|
|
424
425
|
textColor: errorTextColor,
|
|
425
426
|
textWeight: errorTextWeight
|
|
426
427
|
}, errorMessage), Boolean(helpText) && (!isErrorState || !errorMessage) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
427
428
|
className: "form-field__message-item form-field__message-item_type_help-text",
|
|
428
|
-
dataTestId: `${inputName}
|
|
429
|
+
dataTestId: `${inputName}-field-message-help-text`,
|
|
429
430
|
size: helpTextSize,
|
|
430
431
|
textColor: isValidState ? helpTextColorSuccess : helpTextColor,
|
|
431
432
|
textWeight: helpTextWeight,
|
|
432
433
|
sizeMobile: helpTextSizeMobile
|
|
433
434
|
}, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
434
435
|
className: "form-field__message-item form-field__message-item_type_help-text",
|
|
435
|
-
dataTestId: `${inputName}
|
|
436
|
+
dataTestId: `${inputName}field-message-help-text`,
|
|
436
437
|
size: messageTextSize
|
|
437
438
|
}, '\u00A0')), after);
|
|
438
439
|
}
|
|
@@ -898,6 +899,102 @@ const FormFieldCustom = /*#__PURE__*/React__default.default.memo(function FormFi
|
|
|
898
899
|
});
|
|
899
900
|
});
|
|
900
901
|
|
|
902
|
+
const defaultDadataInputProps = {
|
|
903
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
904
|
+
// useValidationAppearanceInputProps
|
|
905
|
+
// Error
|
|
906
|
+
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
907
|
+
// Success
|
|
908
|
+
successAppearance: 'successPrimary sizeM solid rounded',
|
|
909
|
+
// Required
|
|
910
|
+
requiredAppearance: 'requirePrimary sizeM solid rounded'
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
const FormFieldDadataInput = /*#__PURE__*/React__default.default.memo(function FormFieldDadataInput(props) {
|
|
914
|
+
const {
|
|
915
|
+
name,
|
|
916
|
+
initialValue,
|
|
917
|
+
isDisabled,
|
|
918
|
+
classNameGroupItem,
|
|
919
|
+
fieldProps,
|
|
920
|
+
inputProps,
|
|
921
|
+
parse,
|
|
922
|
+
showMessage,
|
|
923
|
+
token,
|
|
924
|
+
isRequired,
|
|
925
|
+
onDadataAutocomplete
|
|
926
|
+
} = props;
|
|
927
|
+
if (process.env.NODE_ENV === 'development') {
|
|
928
|
+
const hint = `Check your form config at field "${name}".`;
|
|
929
|
+
if (!token) {
|
|
930
|
+
const message = `FormFieldDadataInput: 'token' prop is missing, instead got ${token}.`;
|
|
931
|
+
throw new Error(message + '\n' + hint);
|
|
932
|
+
}
|
|
933
|
+
if (!onDadataAutocomplete) {
|
|
934
|
+
const message = `FormFieldDadataInput: 'onDadataAutocomplete' prop is missing, instead got ${onDadataAutocomplete}.`;
|
|
935
|
+
throw new Error(message + '\n' + hint);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
939
|
+
name: name,
|
|
940
|
+
initialValue: initialValue,
|
|
941
|
+
parse: parse
|
|
942
|
+
}, function Render({
|
|
943
|
+
input,
|
|
944
|
+
meta
|
|
945
|
+
}) {
|
|
946
|
+
/** Note:
|
|
947
|
+
* Create "Render" function by "eslint-react-hooks/rules-of-hooks":
|
|
948
|
+
* React Hooks cannot be called inside a callback.
|
|
949
|
+
* React Hooks must be called in a React function component or a
|
|
950
|
+
* custom React Hook function.
|
|
951
|
+
*/
|
|
952
|
+
|
|
953
|
+
const {
|
|
954
|
+
errorKey,
|
|
955
|
+
errorMessage,
|
|
956
|
+
isErrorState,
|
|
957
|
+
successKey,
|
|
958
|
+
isValidState
|
|
959
|
+
} = useFieldValidationState({
|
|
960
|
+
fieldProps: fieldProps,
|
|
961
|
+
input: input,
|
|
962
|
+
meta: meta
|
|
963
|
+
});
|
|
964
|
+
const updatedInputProps = useValidationAppearanceInputProps({
|
|
965
|
+
inputProps: inputProps,
|
|
966
|
+
validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
|
|
967
|
+
});
|
|
968
|
+
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
969
|
+
className: clsx__default.default('form-field_input-dadata', 'form__item_input-dadata', classNameGroupItem),
|
|
970
|
+
errorKey: errorKey,
|
|
971
|
+
errorMessage: errorMessage,
|
|
972
|
+
isErrorState: isErrorState,
|
|
973
|
+
metaError: meta.error,
|
|
974
|
+
isDisabled: isDisabled,
|
|
975
|
+
fieldClassName: "form-dadata",
|
|
976
|
+
inputName: input.name,
|
|
977
|
+
inputValue: input.value || '',
|
|
978
|
+
metaActive: meta.active,
|
|
979
|
+
showMessage: showMessage,
|
|
980
|
+
isRequired: isRequired,
|
|
981
|
+
isValidState: isValidState
|
|
982
|
+
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Dadata.Dadata
|
|
983
|
+
// dataTestId={`${input.name}FieldInputDadata`}
|
|
984
|
+
// className={clsx(
|
|
985
|
+
// meta.active && 'input-dadata_state_focus',
|
|
986
|
+
// meta.error && meta.touched && `input-dadata_state_${errorKey}`,
|
|
987
|
+
// )}
|
|
988
|
+
, {
|
|
989
|
+
input: input,
|
|
990
|
+
inputProps: updatedInputProps,
|
|
991
|
+
meta: meta,
|
|
992
|
+
setValue: onDadataAutocomplete,
|
|
993
|
+
token: token
|
|
994
|
+
}));
|
|
995
|
+
});
|
|
996
|
+
});
|
|
997
|
+
|
|
901
998
|
const defaultDatepickerProps = {
|
|
902
999
|
appearance: 'surfacePrimary sizeS',
|
|
903
1000
|
dateFormat: 'dd/MM/yyyy - HH:mm',
|
|
@@ -1725,7 +1822,7 @@ const FormFieldInput = /*#__PURE__*/React__default.default.memo(function FormFie
|
|
|
1725
1822
|
isValidState: isValidState
|
|
1726
1823
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Input.Input, Object.assign({
|
|
1727
1824
|
className: clsx__default.default(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
|
|
1728
|
-
dataTestId: `${input.name}
|
|
1825
|
+
dataTestId: `${input.name}-field-input`,
|
|
1729
1826
|
type: "text",
|
|
1730
1827
|
name: input.name,
|
|
1731
1828
|
autoComplete: "nope",
|
|
@@ -1747,6 +1844,77 @@ const FormFieldInput = /*#__PURE__*/React__default.default.memo(function FormFie
|
|
|
1747
1844
|
});
|
|
1748
1845
|
});
|
|
1749
1846
|
|
|
1847
|
+
const defaultInputNumberProps = {
|
|
1848
|
+
appearance: 'surfaceSecondary sizeM solid rounded',
|
|
1849
|
+
width: 'fill'
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
const FormFieldInputNumber = /*#__PURE__*/React__default.default.memo(function FormFieldInputNumber(props) {
|
|
1853
|
+
const {
|
|
1854
|
+
type = 'custom',
|
|
1855
|
+
name,
|
|
1856
|
+
initialValue,
|
|
1857
|
+
classNameGroupItem,
|
|
1858
|
+
fieldProps = {},
|
|
1859
|
+
inputProps = {},
|
|
1860
|
+
parse,
|
|
1861
|
+
showMessage,
|
|
1862
|
+
isDisabled,
|
|
1863
|
+
isRequired,
|
|
1864
|
+
onChange
|
|
1865
|
+
} = props;
|
|
1866
|
+
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
1867
|
+
name: name,
|
|
1868
|
+
initialValue: initialValue,
|
|
1869
|
+
parse: parse
|
|
1870
|
+
}, function Render({
|
|
1871
|
+
input,
|
|
1872
|
+
meta
|
|
1873
|
+
}) {
|
|
1874
|
+
const onChangeField = React.useCallback(event => {
|
|
1875
|
+
input.onChange(event);
|
|
1876
|
+
if (onChange) {
|
|
1877
|
+
onChange(event.target.value);
|
|
1878
|
+
}
|
|
1879
|
+
}, [onChange, input.onChange]);
|
|
1880
|
+
const {
|
|
1881
|
+
errorKey,
|
|
1882
|
+
errorMessage,
|
|
1883
|
+
isErrorState,
|
|
1884
|
+
isValidState
|
|
1885
|
+
} = useFieldValidationState({
|
|
1886
|
+
fieldProps: fieldProps,
|
|
1887
|
+
input: input,
|
|
1888
|
+
meta: meta
|
|
1889
|
+
});
|
|
1890
|
+
const updatedInputProps = useValidationAppearanceInputProps({
|
|
1891
|
+
inputProps: inputProps
|
|
1892
|
+
});
|
|
1893
|
+
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
1894
|
+
className: clsx__default.default('form-field_input-number', 'form__item_input-number', classNameGroupItem),
|
|
1895
|
+
errorKey: errorKey,
|
|
1896
|
+
errorMessage: errorMessage,
|
|
1897
|
+
fieldClassName: "form-input-number",
|
|
1898
|
+
inputName: input.name,
|
|
1899
|
+
inputValue: input.value || '',
|
|
1900
|
+
metaActive: meta.active,
|
|
1901
|
+
metaError: meta.error,
|
|
1902
|
+
showMessage: showMessage,
|
|
1903
|
+
isDisabled: isDisabled,
|
|
1904
|
+
isErrorState: isErrorState,
|
|
1905
|
+
isRequired: isRequired,
|
|
1906
|
+
isValidState: isValidState
|
|
1907
|
+
}, fieldProps), /*#__PURE__*/React__default.default.createElement(InputNumber.InputNumber, Object.assign({
|
|
1908
|
+
className: clsx__default.default(meta.active && 'input_state_focus', (meta.submitFailed || meta.touched) && meta.error && `input_state_${errorKey}`),
|
|
1909
|
+
dataTestId: `${input.name}FieldInputNumber`,
|
|
1910
|
+
type: type,
|
|
1911
|
+
name: input.name,
|
|
1912
|
+
value: input.value || 0,
|
|
1913
|
+
onChange: onChangeField
|
|
1914
|
+
}, updatedInputProps)));
|
|
1915
|
+
});
|
|
1916
|
+
});
|
|
1917
|
+
|
|
1750
1918
|
const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function FormFieldMaskedInput(props) {
|
|
1751
1919
|
const {
|
|
1752
1920
|
name,
|
|
@@ -1922,7 +2090,7 @@ const FormFieldPassword = /*#__PURE__*/React__default.default.memo(function Form
|
|
|
1922
2090
|
isValidState: isValidState
|
|
1923
2091
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(InputPassword.InputPassword, Object.assign({
|
|
1924
2092
|
className: clsx__default.default(meta.active && 'input-password_state_focus', meta.error && meta.touched && `input-password_state_${errorKey}`),
|
|
1925
|
-
dataTestId: `${input.name}
|
|
2093
|
+
dataTestId: `${input.name}-field-input-password`,
|
|
1926
2094
|
name: input.name,
|
|
1927
2095
|
autoComplete: "nope",
|
|
1928
2096
|
value: input.value || '',
|
|
@@ -2348,11 +2516,11 @@ const defaultTextareaProps = {
|
|
|
2348
2516
|
const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function FormFieldTextarea(props) {
|
|
2349
2517
|
const {
|
|
2350
2518
|
name,
|
|
2351
|
-
isDisabled,
|
|
2352
2519
|
classNameGroupItem,
|
|
2353
2520
|
fieldProps = {},
|
|
2354
2521
|
inputProps = {},
|
|
2355
2522
|
showMessage,
|
|
2523
|
+
isDisabled,
|
|
2356
2524
|
isRequired
|
|
2357
2525
|
} = props;
|
|
2358
2526
|
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
@@ -2371,8 +2539,8 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
|
|
|
2371
2539
|
const {
|
|
2372
2540
|
errorKey,
|
|
2373
2541
|
errorMessage,
|
|
2374
|
-
isErrorState,
|
|
2375
2542
|
successKey,
|
|
2543
|
+
isErrorState,
|
|
2376
2544
|
isValidState
|
|
2377
2545
|
} = useFieldValidationState({
|
|
2378
2546
|
fieldProps: fieldProps,
|
|
@@ -2387,23 +2555,23 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
|
|
|
2387
2555
|
className: clsx__default.default('form-field_textarea', 'form__item_textarea', classNameGroupItem),
|
|
2388
2556
|
errorKey: errorKey,
|
|
2389
2557
|
errorMessage: errorMessage,
|
|
2390
|
-
isErrorState: isErrorState,
|
|
2391
|
-
metaError: meta.error,
|
|
2392
|
-
isDisabled: isDisabled,
|
|
2393
2558
|
fieldClassName: 'form-textarea',
|
|
2394
2559
|
inputName: input.name,
|
|
2395
2560
|
inputValue: input.value,
|
|
2396
2561
|
metaActive: meta.active,
|
|
2562
|
+
metaError: meta.error,
|
|
2397
2563
|
showMessage: showMessage,
|
|
2564
|
+
isDisabled: isDisabled,
|
|
2565
|
+
isErrorState: isErrorState,
|
|
2398
2566
|
isRequired: isRequired,
|
|
2399
2567
|
isValidState: isValidState
|
|
2400
2568
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Textarea.Textarea, Object.assign({
|
|
2401
|
-
dataTestId: `${input.name}FieldTextarea`,
|
|
2402
2569
|
className: clsx__default.default(meta.active && 'textarea_state_focus', meta.error && meta.touched && `textarea_state_${errorKey}`),
|
|
2570
|
+
dataTestId: `${input.name}-field-textarea`,
|
|
2403
2571
|
name: input.name,
|
|
2404
|
-
isDisabled: isDisabled,
|
|
2405
2572
|
autoComplete: "nope",
|
|
2406
2573
|
value: input.value || '',
|
|
2574
|
+
isDisabled: isDisabled,
|
|
2407
2575
|
onBlur: input.onBlur,
|
|
2408
2576
|
onChange: input.onChange,
|
|
2409
2577
|
onFocus: input.onFocus
|
|
@@ -2411,108 +2579,12 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
|
|
|
2411
2579
|
});
|
|
2412
2580
|
});
|
|
2413
2581
|
|
|
2414
|
-
const defaultDadataInputProps = {
|
|
2415
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
2416
|
-
// useValidationAppearanceInputProps
|
|
2417
|
-
// Error
|
|
2418
|
-
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
2419
|
-
// Success
|
|
2420
|
-
successAppearance: 'successPrimary sizeM solid rounded',
|
|
2421
|
-
// Required
|
|
2422
|
-
requiredAppearance: 'requirePrimary sizeM solid rounded'
|
|
2423
|
-
};
|
|
2424
|
-
|
|
2425
|
-
const FormFieldDadataInput = /*#__PURE__*/React__default.default.memo(function FormFieldDadataInput(props) {
|
|
2426
|
-
const {
|
|
2427
|
-
name,
|
|
2428
|
-
initialValue,
|
|
2429
|
-
isDisabled,
|
|
2430
|
-
classNameGroupItem,
|
|
2431
|
-
fieldProps,
|
|
2432
|
-
inputProps,
|
|
2433
|
-
parse,
|
|
2434
|
-
showMessage,
|
|
2435
|
-
token,
|
|
2436
|
-
isRequired,
|
|
2437
|
-
onDadataAutocomplete
|
|
2438
|
-
} = props;
|
|
2439
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2440
|
-
const hint = `Check your form config at field "${name}".`;
|
|
2441
|
-
if (!token) {
|
|
2442
|
-
const message = `FormFieldDadataInput: 'token' prop is missing, instead got ${token}.`;
|
|
2443
|
-
throw new Error(message + '\n' + hint);
|
|
2444
|
-
}
|
|
2445
|
-
if (!onDadataAutocomplete) {
|
|
2446
|
-
const message = `FormFieldDadataInput: 'onDadataAutocomplete' prop is missing, instead got ${onDadataAutocomplete}.`;
|
|
2447
|
-
throw new Error(message + '\n' + hint);
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
2451
|
-
name: name,
|
|
2452
|
-
initialValue: initialValue,
|
|
2453
|
-
parse: parse
|
|
2454
|
-
}, function Render({
|
|
2455
|
-
input,
|
|
2456
|
-
meta
|
|
2457
|
-
}) {
|
|
2458
|
-
/** Note:
|
|
2459
|
-
* Create "Render" function by "eslint-react-hooks/rules-of-hooks":
|
|
2460
|
-
* React Hooks cannot be called inside a callback.
|
|
2461
|
-
* React Hooks must be called in a React function component or a
|
|
2462
|
-
* custom React Hook function.
|
|
2463
|
-
*/
|
|
2464
|
-
|
|
2465
|
-
const {
|
|
2466
|
-
errorKey,
|
|
2467
|
-
errorMessage,
|
|
2468
|
-
isErrorState,
|
|
2469
|
-
successKey,
|
|
2470
|
-
isValidState
|
|
2471
|
-
} = useFieldValidationState({
|
|
2472
|
-
fieldProps: fieldProps,
|
|
2473
|
-
input: input,
|
|
2474
|
-
meta: meta
|
|
2475
|
-
});
|
|
2476
|
-
const updatedInputProps = useValidationAppearanceInputProps({
|
|
2477
|
-
inputProps: inputProps,
|
|
2478
|
-
validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
|
|
2479
|
-
});
|
|
2480
|
-
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
2481
|
-
className: clsx__default.default('form-field_input-dadata', 'form__item_input-dadata', classNameGroupItem),
|
|
2482
|
-
errorKey: errorKey,
|
|
2483
|
-
errorMessage: errorMessage,
|
|
2484
|
-
isErrorState: isErrorState,
|
|
2485
|
-
metaError: meta.error,
|
|
2486
|
-
isDisabled: isDisabled,
|
|
2487
|
-
fieldClassName: "form-dadata",
|
|
2488
|
-
inputName: input.name,
|
|
2489
|
-
inputValue: input.value || '',
|
|
2490
|
-
metaActive: meta.active,
|
|
2491
|
-
showMessage: showMessage,
|
|
2492
|
-
isRequired: isRequired,
|
|
2493
|
-
isValidState: isValidState
|
|
2494
|
-
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Dadata.Dadata
|
|
2495
|
-
// dataTestId={`${input.name}FieldInputDadata`}
|
|
2496
|
-
// className={clsx(
|
|
2497
|
-
// meta.active && 'input-dadata_state_focus',
|
|
2498
|
-
// meta.error && meta.touched && `input-dadata_state_${errorKey}`,
|
|
2499
|
-
// )}
|
|
2500
|
-
, {
|
|
2501
|
-
input: input,
|
|
2502
|
-
inputProps: updatedInputProps,
|
|
2503
|
-
meta: meta,
|
|
2504
|
-
setValue: onDadataAutocomplete,
|
|
2505
|
-
token: token
|
|
2506
|
-
}));
|
|
2507
|
-
});
|
|
2508
|
-
});
|
|
2509
|
-
|
|
2510
2582
|
const formTypes = {
|
|
2583
|
+
custom: 'custom',
|
|
2511
2584
|
password: 'password',
|
|
2512
2585
|
code: 'code',
|
|
2513
2586
|
text: 'text',
|
|
2514
2587
|
textarea: 'textarea',
|
|
2515
|
-
custom: 'custom',
|
|
2516
2588
|
checkbox: 'checkbox',
|
|
2517
2589
|
chips: 'chips',
|
|
2518
2590
|
choice: 'choice',
|
|
@@ -2521,6 +2593,7 @@ const formTypes = {
|
|
|
2521
2593
|
dateRangePicker: 'dateRangePicker',
|
|
2522
2594
|
fileInput: 'fileInput',
|
|
2523
2595
|
group: 'group',
|
|
2596
|
+
inputNumber: 'inputNumber',
|
|
2524
2597
|
maskedInput: 'maskedInput',
|
|
2525
2598
|
radioGroup: 'radioGroup',
|
|
2526
2599
|
segmented: 'segmented',
|
|
@@ -2625,6 +2698,12 @@ function generateField(field, config, props) {
|
|
|
2625
2698
|
key: config.key
|
|
2626
2699
|
}, field, props));
|
|
2627
2700
|
}
|
|
2701
|
+
case formTypes.inputNumber:
|
|
2702
|
+
{
|
|
2703
|
+
return /*#__PURE__*/React__default.default.createElement(FormFieldInputNumber, Object.assign({
|
|
2704
|
+
key: config.key
|
|
2705
|
+
}, field, props));
|
|
2706
|
+
}
|
|
2628
2707
|
case formTypes.group:
|
|
2629
2708
|
{
|
|
2630
2709
|
return /*#__PURE__*/React__default.default.createElement(FormBlockGroup, Object.assign({
|
|
@@ -2762,6 +2841,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2762
2841
|
dataTestId,
|
|
2763
2842
|
dataTour,
|
|
2764
2843
|
type,
|
|
2844
|
+
name,
|
|
2765
2845
|
initialValues,
|
|
2766
2846
|
initialValuesEqual,
|
|
2767
2847
|
config,
|
|
@@ -2812,6 +2892,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2812
2892
|
primaryButtonAppearance,
|
|
2813
2893
|
primaryButtonFill,
|
|
2814
2894
|
primaryButtonFillHover,
|
|
2895
|
+
primaryButtonHtmlType,
|
|
2815
2896
|
primaryButtonIsDisabled,
|
|
2816
2897
|
primaryButtonIsLoading,
|
|
2817
2898
|
primaryButtonLabel,
|
|
@@ -2819,6 +2900,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2819
2900
|
primaryButtonLabelTextColor,
|
|
2820
2901
|
primaryButtonLabelTextWeight,
|
|
2821
2902
|
primaryButtonSize,
|
|
2903
|
+
primarySecondaryHtmlType,
|
|
2822
2904
|
renderFieldsWrapper = wrapperChildren => wrapperChildren,
|
|
2823
2905
|
secondaryButton,
|
|
2824
2906
|
secondaryButtonAppearance,
|
|
@@ -2877,14 +2959,14 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2877
2959
|
}) => {
|
|
2878
2960
|
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2879
2961
|
className: clsx__default.default(className, 'form', type && `form_type_${type}`, widthClass && `width_${widthClass}`, heightClass && `height_${heightClass}`, titlePosition && `form_title-position_${titlePosition}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass && `direction_${directionClass}`, fillClass && `fill_${fillClass}`, shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, elevationClass && `elevation_${elevationClass}`),
|
|
2880
|
-
name: formName
|
|
2962
|
+
name: formName || 'form'
|
|
2881
2963
|
// We no need set reference to html element, we need reference to "final-form" instance
|
|
2882
2964
|
,
|
|
2883
2965
|
ref: () => onRefFormInstance(form),
|
|
2884
2966
|
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2885
2967
|
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2886
2968
|
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2887
|
-
"data-testid": dataTestId,
|
|
2969
|
+
"data-testid": dataTestId || name,
|
|
2888
2970
|
"data-tour": dataTour,
|
|
2889
2971
|
spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
|
|
2890
2972
|
style: formStyles,
|
|
@@ -2941,7 +3023,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2941
3023
|
}, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2942
3024
|
appearance: primaryButtonAppearance,
|
|
2943
3025
|
className: "form__button-item",
|
|
2944
|
-
dataTestId: dataTestIdPrimaryButton,
|
|
3026
|
+
dataTestId: dataTestIdPrimaryButton || (name ? `${name}-primary` : 'form-primary'),
|
|
2945
3027
|
dataTour: dataTourPrimaryButton,
|
|
2946
3028
|
width: "fill",
|
|
2947
3029
|
size: primaryButtonSize,
|
|
@@ -2951,12 +3033,13 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2951
3033
|
labelTextColor: primaryButtonLabelTextColor,
|
|
2952
3034
|
labelTextSize: primaryButtonLabelSize,
|
|
2953
3035
|
labelTextWeight: primaryButtonLabelTextWeight,
|
|
3036
|
+
htmlType: primaryButtonHtmlType || 'submit',
|
|
2954
3037
|
loading: primaryButtonIsLoading,
|
|
2955
3038
|
isDisabled: primaryButtonIsDisabled
|
|
2956
3039
|
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2957
3040
|
appearance: secondaryButtonAppearance,
|
|
2958
3041
|
className: "form__button-item",
|
|
2959
|
-
dataTestId: dataTestIdSecondaryButton,
|
|
3042
|
+
dataTestId: dataTestIdSecondaryButton || (name ? `${name}-secondary` : 'form-secondary'),
|
|
2960
3043
|
dataTour: dataTourSecondaryButton,
|
|
2961
3044
|
width: "fill",
|
|
2962
3045
|
size: secondaryButtonSize,
|
|
@@ -2966,6 +3049,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2966
3049
|
labelTextColor: secondaryButtonLabelTextColor,
|
|
2967
3050
|
labelTextSize: secondaryButtonLabelSize,
|
|
2968
3051
|
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
3052
|
+
htmlType: primarySecondaryHtmlType,
|
|
2969
3053
|
loading: secondaryButtonIsLoading,
|
|
2970
3054
|
isDisabled: secondaryButtonIsDisabled,
|
|
2971
3055
|
onClick: onClickSecondaryButton
|
|
@@ -3272,6 +3356,7 @@ exports.FormFieldDadataInput = FormFieldDadataInput;
|
|
|
3272
3356
|
exports.FormFieldDatePicker = FormFieldDatePicker;
|
|
3273
3357
|
exports.FormFieldFileInput = FormFieldFileInput;
|
|
3274
3358
|
exports.FormFieldInput = FormFieldInput;
|
|
3359
|
+
exports.FormFieldInputNumber = FormFieldInputNumber;
|
|
3275
3360
|
exports.FormFieldMaskedInput = FormFieldMaskedInput;
|
|
3276
3361
|
exports.FormFieldPassword = FormFieldPassword;
|
|
3277
3362
|
exports.FormFieldRadioGroup = FormFieldRadioGroup;
|
|
@@ -3294,6 +3379,7 @@ exports.defaultFieldSizeM = defaultFieldSizeM;
|
|
|
3294
3379
|
exports.defaultFieldSizeS = defaultFieldSizeS;
|
|
3295
3380
|
exports.defaultFieldSizeXL = defaultFieldSizeXL;
|
|
3296
3381
|
exports.defaultGroupProps = defaultGroupProps;
|
|
3382
|
+
exports.defaultInputNumberProps = defaultInputNumberProps;
|
|
3297
3383
|
exports.defaultInputProps = defaultInputProps;
|
|
3298
3384
|
exports.defaultPasswordProps = defaultPasswordProps;
|
|
3299
3385
|
exports.defaultRadioProps = defaultRadioProps;
|