@itcase/forms 1.1.44 → 1.1.46
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.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--dadata-success-border: var(--color-success-border-primary);
|
|
3
|
+
--dadata-success-border-hover: var(--color-surface-border-quaternary);
|
|
4
|
+
--dadata-error-border: var(--color-error-border-primary);
|
|
5
|
+
--dadata-focus-background: var(--color-surface-primary);
|
|
6
|
+
--dadata-focus-border: var(--color-surface-border-quaternary);
|
|
7
|
+
}
|
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -34,6 +34,7 @@ var Segmented = require('@itcase/ui/components/Segmented');
|
|
|
34
34
|
var Select = require('@itcase/ui/components/Select');
|
|
35
35
|
var Switch = require('@itcase/ui/components/Switch');
|
|
36
36
|
var Textarea = require('@itcase/ui/components/Textarea');
|
|
37
|
+
var Dadata = require('@itcase/ui/components/Dadata');
|
|
37
38
|
var Group = require('@itcase/ui/components/Group');
|
|
38
39
|
var Notification = require('@itcase/ui/components/Notification');
|
|
39
40
|
var createDecorator = require('final-form-focus');
|
|
@@ -535,7 +536,7 @@ const defaultChipsProps = {
|
|
|
535
536
|
// Error
|
|
536
537
|
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
537
538
|
// Required
|
|
538
|
-
requiredAppearance: '
|
|
539
|
+
requiredAppearance: 'warningPrimary sizeM solid rounded'
|
|
539
540
|
// Success
|
|
540
541
|
// successAppearance: 'successPrimary sizeM solid rounded',
|
|
541
542
|
};
|
|
@@ -544,7 +545,6 @@ function FormFieldChips(props) {
|
|
|
544
545
|
const {
|
|
545
546
|
name,
|
|
546
547
|
initialValue,
|
|
547
|
-
isDisabled,
|
|
548
548
|
classNameGroupItem,
|
|
549
549
|
emptyMessage,
|
|
550
550
|
emptyMessageTextColor,
|
|
@@ -553,6 +553,7 @@ function FormFieldChips(props) {
|
|
|
553
553
|
inputProps,
|
|
554
554
|
options,
|
|
555
555
|
showMessage,
|
|
556
|
+
isDisabled,
|
|
556
557
|
isRequired,
|
|
557
558
|
onChange
|
|
558
559
|
} = props;
|
|
@@ -581,8 +582,8 @@ function FormFieldChips(props) {
|
|
|
581
582
|
const {
|
|
582
583
|
errorKey,
|
|
583
584
|
errorMessage,
|
|
584
|
-
isErrorState,
|
|
585
585
|
successKey,
|
|
586
|
+
isErrorState,
|
|
586
587
|
isValidState
|
|
587
588
|
} = useFieldValidationState({
|
|
588
589
|
fieldProps: fieldProps,
|
|
@@ -608,14 +609,14 @@ function FormFieldChips(props) {
|
|
|
608
609
|
className: clsx__default.default('form-field_chips', 'form__item_chips', classNameGroupItem),
|
|
609
610
|
errorKey: errorKey,
|
|
610
611
|
errorMessage: errorMessage,
|
|
611
|
-
isErrorState: isErrorState,
|
|
612
|
-
metaError: meta.error,
|
|
613
|
-
isDisabled: isDisabled,
|
|
614
612
|
fieldClassName: "form-chips",
|
|
615
613
|
inputName: input.name,
|
|
616
614
|
inputValue: input.value,
|
|
617
615
|
metaActive: meta.active,
|
|
616
|
+
metaError: meta.error,
|
|
618
617
|
showMessage: showMessage,
|
|
618
|
+
isDisabled: isDisabled,
|
|
619
|
+
isErrorState: isErrorState,
|
|
619
620
|
isRequired: isRequired,
|
|
620
621
|
isValidState: isValidState
|
|
621
622
|
}, fieldProps), options.length ? /*#__PURE__*/React__default.default.createElement(Chips.ChipsGroup, {
|
|
@@ -626,9 +627,9 @@ function FormFieldChips(props) {
|
|
|
626
627
|
className: clsx__default.default(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
627
628
|
key: option.value,
|
|
628
629
|
label: option.label,
|
|
629
|
-
isDisabled: option.isDisabled,
|
|
630
630
|
value: option.value,
|
|
631
631
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
632
|
+
isDisabled: option.isDisabled,
|
|
632
633
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
633
634
|
}, updatedInputProps)))) : /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
634
635
|
size: emptyMessageTextSize,
|
|
@@ -1767,7 +1768,8 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
|
|
|
1767
1768
|
value,
|
|
1768
1769
|
setUnmaskedValue
|
|
1769
1770
|
} = reactImask.useIMask(optionsMask, {
|
|
1770
|
-
|
|
1771
|
+
defaultValue: initialValue,
|
|
1772
|
+
onAccept: (_newValue, event, element) => {
|
|
1771
1773
|
if (element) {
|
|
1772
1774
|
input.onChange(event._unmaskedValue);
|
|
1773
1775
|
}
|
|
@@ -1778,13 +1780,6 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
|
|
|
1778
1780
|
setUnmaskedValue(input.value.replace(unmasked, ''));
|
|
1779
1781
|
}
|
|
1780
1782
|
}, [input.value]);
|
|
1781
|
-
|
|
1782
|
-
// useEffect(() => {
|
|
1783
|
-
// if (unmaskedValue !== input.value) {
|
|
1784
|
-
// input.onChange(unmaskedValue)
|
|
1785
|
-
// }
|
|
1786
|
-
// }, [unmaskedValue])
|
|
1787
|
-
|
|
1788
1783
|
const {
|
|
1789
1784
|
errorKey,
|
|
1790
1785
|
errorMessage,
|
|
@@ -1806,7 +1801,7 @@ const FormFieldMaskedInput = /*#__PURE__*/React__default.default.memo(function F
|
|
|
1806
1801
|
errorMessage: errorMessage,
|
|
1807
1802
|
fieldClassName: 'form-maskedInput',
|
|
1808
1803
|
inputName: input.name,
|
|
1809
|
-
inputValue: input.value,
|
|
1804
|
+
inputValue: input.value || unmasked,
|
|
1810
1805
|
metaActive: meta.active,
|
|
1811
1806
|
metaError: meta.error,
|
|
1812
1807
|
showMessage: showMessage,
|
|
@@ -2398,6 +2393,102 @@ const FormFieldTextarea = /*#__PURE__*/React__default.default.memo(function Form
|
|
|
2398
2393
|
});
|
|
2399
2394
|
});
|
|
2400
2395
|
|
|
2396
|
+
const defaultDadataInputProps = {
|
|
2397
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
2398
|
+
// useValidationAppearanceInputProps
|
|
2399
|
+
// Error
|
|
2400
|
+
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
2401
|
+
// Success
|
|
2402
|
+
successAppearance: 'successPrimary sizeM solid rounded',
|
|
2403
|
+
// Required
|
|
2404
|
+
requiredAppearance: 'requirePrimary sizeM solid rounded'
|
|
2405
|
+
};
|
|
2406
|
+
|
|
2407
|
+
const FormFieldDadataInput = /*#__PURE__*/React__default.default.memo(function FormFieldDadataInput(props) {
|
|
2408
|
+
const {
|
|
2409
|
+
name,
|
|
2410
|
+
initialValue,
|
|
2411
|
+
isDisabled,
|
|
2412
|
+
classNameGroupItem,
|
|
2413
|
+
fieldProps,
|
|
2414
|
+
inputProps,
|
|
2415
|
+
parse,
|
|
2416
|
+
showMessage,
|
|
2417
|
+
token,
|
|
2418
|
+
isRequired,
|
|
2419
|
+
onDadataAutocomplete
|
|
2420
|
+
} = props;
|
|
2421
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2422
|
+
const hint = `Check your form config at field "${name}".`;
|
|
2423
|
+
if (!token) {
|
|
2424
|
+
const message = `FormFieldDadataInput: 'token' prop is missing, instead got ${token}.`;
|
|
2425
|
+
throw new Error(message + '\n' + hint);
|
|
2426
|
+
}
|
|
2427
|
+
if (!onDadataAutocomplete) {
|
|
2428
|
+
const message = `FormFieldDadataInput: 'onDadataAutocomplete' prop is missing, instead got ${onDadataAutocomplete}.`;
|
|
2429
|
+
throw new Error(message + '\n' + hint);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
2433
|
+
name: name,
|
|
2434
|
+
initialValue: initialValue,
|
|
2435
|
+
parse: parse
|
|
2436
|
+
}, function Render({
|
|
2437
|
+
input,
|
|
2438
|
+
meta
|
|
2439
|
+
}) {
|
|
2440
|
+
/** Note:
|
|
2441
|
+
* Create "Render" function by "eslint-react-hooks/rules-of-hooks":
|
|
2442
|
+
* React Hooks cannot be called inside a callback.
|
|
2443
|
+
* React Hooks must be called in a React function component or a
|
|
2444
|
+
* custom React Hook function.
|
|
2445
|
+
*/
|
|
2446
|
+
|
|
2447
|
+
const {
|
|
2448
|
+
errorKey,
|
|
2449
|
+
errorMessage,
|
|
2450
|
+
isErrorState,
|
|
2451
|
+
successKey,
|
|
2452
|
+
isValidState
|
|
2453
|
+
} = useFieldValidationState({
|
|
2454
|
+
fieldProps: fieldProps,
|
|
2455
|
+
input: input,
|
|
2456
|
+
meta: meta
|
|
2457
|
+
});
|
|
2458
|
+
const updatedInputProps = useValidationAppearanceInputProps({
|
|
2459
|
+
inputProps: inputProps,
|
|
2460
|
+
validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
|
|
2461
|
+
});
|
|
2462
|
+
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
2463
|
+
className: clsx__default.default('form-field_input-dadata', 'form__item_input-dadata', classNameGroupItem),
|
|
2464
|
+
errorKey: errorKey,
|
|
2465
|
+
errorMessage: errorMessage,
|
|
2466
|
+
isErrorState: isErrorState,
|
|
2467
|
+
metaError: meta.error,
|
|
2468
|
+
isDisabled: isDisabled,
|
|
2469
|
+
fieldClassName: "form-dadata",
|
|
2470
|
+
inputName: input.name,
|
|
2471
|
+
inputValue: input.value || '',
|
|
2472
|
+
metaActive: meta.active,
|
|
2473
|
+
showMessage: showMessage,
|
|
2474
|
+
isRequired: isRequired,
|
|
2475
|
+
isValidState: isValidState
|
|
2476
|
+
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Dadata.Dadata
|
|
2477
|
+
// dataTestId={`${input.name}FieldInputDadata`}
|
|
2478
|
+
// className={clsx(
|
|
2479
|
+
// meta.active && 'input-dadata_state_focus',
|
|
2480
|
+
// meta.error && meta.touched && `input-dadata_state_${errorKey}`,
|
|
2481
|
+
// )}
|
|
2482
|
+
, {
|
|
2483
|
+
input: input,
|
|
2484
|
+
inputProps: updatedInputProps,
|
|
2485
|
+
meta: meta,
|
|
2486
|
+
setValue: onDadataAutocomplete,
|
|
2487
|
+
token: token
|
|
2488
|
+
}));
|
|
2489
|
+
});
|
|
2490
|
+
});
|
|
2491
|
+
|
|
2401
2492
|
const formTypes = {
|
|
2402
2493
|
password: 'password',
|
|
2403
2494
|
code: 'code',
|
|
@@ -2407,6 +2498,7 @@ const formTypes = {
|
|
|
2407
2498
|
checkbox: 'checkbox',
|
|
2408
2499
|
chips: 'chips',
|
|
2409
2500
|
choice: 'choice',
|
|
2501
|
+
dadataInput: 'dadataInput',
|
|
2410
2502
|
datePicker: 'datePicker',
|
|
2411
2503
|
dateRangePicker: 'dateRangePicker',
|
|
2412
2504
|
fileInput: 'fileInput',
|
|
@@ -2509,6 +2601,12 @@ function generateField(field, config, props) {
|
|
|
2509
2601
|
key: config.key
|
|
2510
2602
|
}, field, props));
|
|
2511
2603
|
}
|
|
2604
|
+
case formTypes.dadataInput:
|
|
2605
|
+
{
|
|
2606
|
+
return /*#__PURE__*/React__default.default.createElement(FormFieldDadataInput, Object.assign({
|
|
2607
|
+
key: config.key
|
|
2608
|
+
}, field, props));
|
|
2609
|
+
}
|
|
2512
2610
|
case formTypes.group:
|
|
2513
2611
|
{
|
|
2514
2612
|
return /*#__PURE__*/React__default.default.createElement(FormBlockGroup, Object.assign({
|
|
@@ -3151,6 +3249,7 @@ exports.FormFieldChips = FormFieldChips;
|
|
|
3151
3249
|
exports.FormFieldChoice = FormFieldChoice;
|
|
3152
3250
|
exports.FormFieldCode = FormFieldCode;
|
|
3153
3251
|
exports.FormFieldCustom = FormFieldCustom;
|
|
3252
|
+
exports.FormFieldDadataInput = FormFieldDadataInput;
|
|
3154
3253
|
exports.FormFieldDatePicker = FormFieldDatePicker;
|
|
3155
3254
|
exports.FormFieldFileInput = FormFieldFileInput;
|
|
3156
3255
|
exports.FormFieldInput = FormFieldInput;
|
|
@@ -3167,6 +3266,7 @@ exports.defaultCheckboxProps = defaultCheckboxProps;
|
|
|
3167
3266
|
exports.defaultChipsProps = defaultChipsProps;
|
|
3168
3267
|
exports.defaultChoiceProps = defaultChoiceProps;
|
|
3169
3268
|
exports.defaultCodeProps = defaultCodeProps;
|
|
3269
|
+
exports.defaultDadataInputProps = defaultDadataInputProps;
|
|
3170
3270
|
exports.defaultDatepickerProps = defaultDatepickerProps;
|
|
3171
3271
|
exports.defaultDropzoneProps = defaultDropzoneProps;
|
|
3172
3272
|
exports.defaultFieldProps = defaultFieldProps;
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -33,6 +33,7 @@ import { Segmented } from '@itcase/ui/components/Segmented';
|
|
|
33
33
|
import { Select } from '@itcase/ui/components/Select';
|
|
34
34
|
import { Switch } from '@itcase/ui/components/Switch';
|
|
35
35
|
import { Textarea } from '@itcase/ui/components/Textarea';
|
|
36
|
+
import { Dadata } from '@itcase/ui/components/Dadata';
|
|
36
37
|
import { Group } from '@itcase/ui/components/Group';
|
|
37
38
|
import { Notification } from '@itcase/ui/components/Notification';
|
|
38
39
|
import createDecorator from 'final-form-focus';
|
|
@@ -524,7 +525,7 @@ const defaultChipsProps = {
|
|
|
524
525
|
// Error
|
|
525
526
|
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
526
527
|
// Required
|
|
527
|
-
requiredAppearance: '
|
|
528
|
+
requiredAppearance: 'warningPrimary sizeM solid rounded'
|
|
528
529
|
// Success
|
|
529
530
|
// successAppearance: 'successPrimary sizeM solid rounded',
|
|
530
531
|
};
|
|
@@ -533,7 +534,6 @@ function FormFieldChips(props) {
|
|
|
533
534
|
const {
|
|
534
535
|
name,
|
|
535
536
|
initialValue,
|
|
536
|
-
isDisabled,
|
|
537
537
|
classNameGroupItem,
|
|
538
538
|
emptyMessage,
|
|
539
539
|
emptyMessageTextColor,
|
|
@@ -542,6 +542,7 @@ function FormFieldChips(props) {
|
|
|
542
542
|
inputProps,
|
|
543
543
|
options,
|
|
544
544
|
showMessage,
|
|
545
|
+
isDisabled,
|
|
545
546
|
isRequired,
|
|
546
547
|
onChange
|
|
547
548
|
} = props;
|
|
@@ -570,8 +571,8 @@ function FormFieldChips(props) {
|
|
|
570
571
|
const {
|
|
571
572
|
errorKey,
|
|
572
573
|
errorMessage,
|
|
573
|
-
isErrorState,
|
|
574
574
|
successKey,
|
|
575
|
+
isErrorState,
|
|
575
576
|
isValidState
|
|
576
577
|
} = useFieldValidationState({
|
|
577
578
|
fieldProps: fieldProps,
|
|
@@ -597,14 +598,14 @@ function FormFieldChips(props) {
|
|
|
597
598
|
className: clsx('form-field_chips', 'form__item_chips', classNameGroupItem),
|
|
598
599
|
errorKey: errorKey,
|
|
599
600
|
errorMessage: errorMessage,
|
|
600
|
-
isErrorState: isErrorState,
|
|
601
|
-
metaError: meta.error,
|
|
602
|
-
isDisabled: isDisabled,
|
|
603
601
|
fieldClassName: "form-chips",
|
|
604
602
|
inputName: input.name,
|
|
605
603
|
inputValue: input.value,
|
|
606
604
|
metaActive: meta.active,
|
|
605
|
+
metaError: meta.error,
|
|
607
606
|
showMessage: showMessage,
|
|
607
|
+
isDisabled: isDisabled,
|
|
608
|
+
isErrorState: isErrorState,
|
|
608
609
|
isRequired: isRequired,
|
|
609
610
|
isValidState: isValidState
|
|
610
611
|
}, fieldProps), options.length ? /*#__PURE__*/React.createElement(ChipsGroup, {
|
|
@@ -615,9 +616,9 @@ function FormFieldChips(props) {
|
|
|
615
616
|
className: clsx(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
616
617
|
key: option.value,
|
|
617
618
|
label: option.label,
|
|
618
|
-
isDisabled: option.isDisabled,
|
|
619
619
|
value: option.value,
|
|
620
620
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
621
|
+
isDisabled: option.isDisabled,
|
|
621
622
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
622
623
|
}, updatedInputProps)))) : /*#__PURE__*/React.createElement(Text, {
|
|
623
624
|
size: emptyMessageTextSize,
|
|
@@ -1756,7 +1757,8 @@ const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInp
|
|
|
1756
1757
|
value,
|
|
1757
1758
|
setUnmaskedValue
|
|
1758
1759
|
} = useIMask(optionsMask, {
|
|
1759
|
-
|
|
1760
|
+
defaultValue: initialValue,
|
|
1761
|
+
onAccept: (_newValue, event, element) => {
|
|
1760
1762
|
if (element) {
|
|
1761
1763
|
input.onChange(event._unmaskedValue);
|
|
1762
1764
|
}
|
|
@@ -1767,13 +1769,6 @@ const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInp
|
|
|
1767
1769
|
setUnmaskedValue(input.value.replace(unmasked, ''));
|
|
1768
1770
|
}
|
|
1769
1771
|
}, [input.value]);
|
|
1770
|
-
|
|
1771
|
-
// useEffect(() => {
|
|
1772
|
-
// if (unmaskedValue !== input.value) {
|
|
1773
|
-
// input.onChange(unmaskedValue)
|
|
1774
|
-
// }
|
|
1775
|
-
// }, [unmaskedValue])
|
|
1776
|
-
|
|
1777
1772
|
const {
|
|
1778
1773
|
errorKey,
|
|
1779
1774
|
errorMessage,
|
|
@@ -1795,7 +1790,7 @@ const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInp
|
|
|
1795
1790
|
errorMessage: errorMessage,
|
|
1796
1791
|
fieldClassName: 'form-maskedInput',
|
|
1797
1792
|
inputName: input.name,
|
|
1798
|
-
inputValue: input.value,
|
|
1793
|
+
inputValue: input.value || unmasked,
|
|
1799
1794
|
metaActive: meta.active,
|
|
1800
1795
|
metaError: meta.error,
|
|
1801
1796
|
showMessage: showMessage,
|
|
@@ -2387,6 +2382,102 @@ const FormFieldTextarea = /*#__PURE__*/React.memo(function FormFieldTextarea(pro
|
|
|
2387
2382
|
});
|
|
2388
2383
|
});
|
|
2389
2384
|
|
|
2385
|
+
const defaultDadataInputProps = {
|
|
2386
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
2387
|
+
// useValidationAppearanceInputProps
|
|
2388
|
+
// Error
|
|
2389
|
+
errorAppearance: 'errorPrimary sizeM solid rounded',
|
|
2390
|
+
// Success
|
|
2391
|
+
successAppearance: 'successPrimary sizeM solid rounded',
|
|
2392
|
+
// Required
|
|
2393
|
+
requiredAppearance: 'requirePrimary sizeM solid rounded'
|
|
2394
|
+
};
|
|
2395
|
+
|
|
2396
|
+
const FormFieldDadataInput = /*#__PURE__*/React.memo(function FormFieldDadataInput(props) {
|
|
2397
|
+
const {
|
|
2398
|
+
name,
|
|
2399
|
+
initialValue,
|
|
2400
|
+
isDisabled,
|
|
2401
|
+
classNameGroupItem,
|
|
2402
|
+
fieldProps,
|
|
2403
|
+
inputProps,
|
|
2404
|
+
parse,
|
|
2405
|
+
showMessage,
|
|
2406
|
+
token,
|
|
2407
|
+
isRequired,
|
|
2408
|
+
onDadataAutocomplete
|
|
2409
|
+
} = props;
|
|
2410
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2411
|
+
const hint = `Check your form config at field "${name}".`;
|
|
2412
|
+
if (!token) {
|
|
2413
|
+
const message = `FormFieldDadataInput: 'token' prop is missing, instead got ${token}.`;
|
|
2414
|
+
throw new Error(message + '\n' + hint);
|
|
2415
|
+
}
|
|
2416
|
+
if (!onDadataAutocomplete) {
|
|
2417
|
+
const message = `FormFieldDadataInput: 'onDadataAutocomplete' prop is missing, instead got ${onDadataAutocomplete}.`;
|
|
2418
|
+
throw new Error(message + '\n' + hint);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
2422
|
+
name: name,
|
|
2423
|
+
initialValue: initialValue,
|
|
2424
|
+
parse: parse
|
|
2425
|
+
}, function Render({
|
|
2426
|
+
input,
|
|
2427
|
+
meta
|
|
2428
|
+
}) {
|
|
2429
|
+
/** Note:
|
|
2430
|
+
* Create "Render" function by "eslint-react-hooks/rules-of-hooks":
|
|
2431
|
+
* React Hooks cannot be called inside a callback.
|
|
2432
|
+
* React Hooks must be called in a React function component or a
|
|
2433
|
+
* custom React Hook function.
|
|
2434
|
+
*/
|
|
2435
|
+
|
|
2436
|
+
const {
|
|
2437
|
+
errorKey,
|
|
2438
|
+
errorMessage,
|
|
2439
|
+
isErrorState,
|
|
2440
|
+
successKey,
|
|
2441
|
+
isValidState
|
|
2442
|
+
} = useFieldValidationState({
|
|
2443
|
+
fieldProps: fieldProps,
|
|
2444
|
+
input: input,
|
|
2445
|
+
meta: meta
|
|
2446
|
+
});
|
|
2447
|
+
const updatedInputProps = useValidationAppearanceInputProps({
|
|
2448
|
+
inputProps: inputProps,
|
|
2449
|
+
validationStateKey: isErrorState ? errorKey : isValidState ? successKey : null
|
|
2450
|
+
});
|
|
2451
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
2452
|
+
className: clsx('form-field_input-dadata', 'form__item_input-dadata', classNameGroupItem),
|
|
2453
|
+
errorKey: errorKey,
|
|
2454
|
+
errorMessage: errorMessage,
|
|
2455
|
+
isErrorState: isErrorState,
|
|
2456
|
+
metaError: meta.error,
|
|
2457
|
+
isDisabled: isDisabled,
|
|
2458
|
+
fieldClassName: "form-dadata",
|
|
2459
|
+
inputName: input.name,
|
|
2460
|
+
inputValue: input.value || '',
|
|
2461
|
+
metaActive: meta.active,
|
|
2462
|
+
showMessage: showMessage,
|
|
2463
|
+
isRequired: isRequired,
|
|
2464
|
+
isValidState: isValidState
|
|
2465
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Dadata
|
|
2466
|
+
// dataTestId={`${input.name}FieldInputDadata`}
|
|
2467
|
+
// className={clsx(
|
|
2468
|
+
// meta.active && 'input-dadata_state_focus',
|
|
2469
|
+
// meta.error && meta.touched && `input-dadata_state_${errorKey}`,
|
|
2470
|
+
// )}
|
|
2471
|
+
, {
|
|
2472
|
+
input: input,
|
|
2473
|
+
inputProps: updatedInputProps,
|
|
2474
|
+
meta: meta,
|
|
2475
|
+
setValue: onDadataAutocomplete,
|
|
2476
|
+
token: token
|
|
2477
|
+
}));
|
|
2478
|
+
});
|
|
2479
|
+
});
|
|
2480
|
+
|
|
2390
2481
|
const formTypes = {
|
|
2391
2482
|
password: 'password',
|
|
2392
2483
|
code: 'code',
|
|
@@ -2396,6 +2487,7 @@ const formTypes = {
|
|
|
2396
2487
|
checkbox: 'checkbox',
|
|
2397
2488
|
chips: 'chips',
|
|
2398
2489
|
choice: 'choice',
|
|
2490
|
+
dadataInput: 'dadataInput',
|
|
2399
2491
|
datePicker: 'datePicker',
|
|
2400
2492
|
dateRangePicker: 'dateRangePicker',
|
|
2401
2493
|
fileInput: 'fileInput',
|
|
@@ -2498,6 +2590,12 @@ function generateField(field, config, props) {
|
|
|
2498
2590
|
key: config.key
|
|
2499
2591
|
}, field, props));
|
|
2500
2592
|
}
|
|
2593
|
+
case formTypes.dadataInput:
|
|
2594
|
+
{
|
|
2595
|
+
return /*#__PURE__*/React.createElement(FormFieldDadataInput, Object.assign({
|
|
2596
|
+
key: config.key
|
|
2597
|
+
}, field, props));
|
|
2598
|
+
}
|
|
2501
2599
|
case formTypes.group:
|
|
2502
2600
|
{
|
|
2503
2601
|
return /*#__PURE__*/React.createElement(FormBlockGroup, Object.assign({
|
|
@@ -3118,4 +3216,4 @@ const getErrorsForFinalForm = error => {
|
|
|
3118
3216
|
return formErrors;
|
|
3119
3217
|
};
|
|
3120
3218
|
|
|
3121
|
-
export { DEFAULT_MESSAGES_FIELDS, FieldWrapper, FieldWrapperBase, FinalForm, FormBlockGroup, FormFieldCheckbox, FormFieldChips, FormFieldChoice, FormFieldCode, FormFieldCustom, FormFieldDatePicker, FormFieldFileInput, FormFieldInput, FormFieldMaskedInput, FormFieldPassword, FormFieldRadioGroup, FormFieldSegmented, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, addRequiredFieldsParamToSchema, dateValidation, defaultCheckboxProps, defaultChipsProps, defaultChoiceProps, defaultCodeProps, defaultDatepickerProps, defaultDropzoneProps, defaultFieldProps, defaultFieldSizeL, defaultFieldSizeM, defaultFieldSizeS, defaultFieldSizeXL, defaultGroupProps, defaultInputProps, defaultPasswordProps, defaultRadioProps, defaultSegmentedProps, defaultSelectProps, defaultSwitchProps, defaultTextareaProps, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, getErrorsForFinalForm, parseNumericField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
|
|
3219
|
+
export { DEFAULT_MESSAGES_FIELDS, FieldWrapper, FieldWrapperBase, FinalForm, FormBlockGroup, FormFieldCheckbox, FormFieldChips, FormFieldChoice, FormFieldCode, FormFieldCustom, FormFieldDadataInput, FormFieldDatePicker, FormFieldFileInput, FormFieldInput, FormFieldMaskedInput, FormFieldPassword, FormFieldRadioGroup, FormFieldSegmented, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, addRequiredFieldsParamToSchema, dateValidation, defaultCheckboxProps, defaultChipsProps, defaultChoiceProps, defaultCodeProps, defaultDadataInputProps, defaultDatepickerProps, defaultDropzoneProps, defaultFieldProps, defaultFieldSizeL, defaultFieldSizeM, defaultFieldSizeS, defaultFieldSizeXL, defaultGroupProps, defaultInputProps, defaultPasswordProps, defaultRadioProps, defaultSegmentedProps, defaultSelectProps, defaultSwitchProps, defaultTextareaProps, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, getErrorsForFinalForm, parseNumericField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/forms",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.46",
|
|
4
4
|
"description": "Forms fields, inputs, etc.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"registry": "https://registry.npmjs.org/"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@itcase/common": "^1.2.
|
|
35
|
+
"@itcase/common": "^1.2.32",
|
|
36
36
|
"@itcase/config": "^1.0.57",
|
|
37
|
-
"@itcase/icons": "^1.2.
|
|
38
|
-
"@itcase/storybook-config": "^1.2.
|
|
39
|
-
"@itcase/tokens-am": "^1.1.
|
|
37
|
+
"@itcase/icons": "^1.2.23",
|
|
38
|
+
"@itcase/storybook-config": "^1.2.13",
|
|
39
|
+
"@itcase/tokens-am": "^1.1.20",
|
|
40
40
|
"@itcase/tokens-baikal": "^1.1.17",
|
|
41
|
-
"@itcase/ui": "^1.8.
|
|
42
|
-
"axios": "^1.
|
|
41
|
+
"@itcase/ui": "^1.8.145",
|
|
42
|
+
"axios": "^1.12.2",
|
|
43
43
|
"clsx": "^2.1.1",
|
|
44
44
|
"final-form": "4.20.10",
|
|
45
45
|
"final-form-focus": "1.1.2",
|
|
46
|
-
"libphonenumber-js": "^1.12.
|
|
46
|
+
"libphonenumber-js": "^1.12.23",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"luxon": "^3.7.2",
|
|
49
49
|
"react": "^18.3.1",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"@babel/core": "^7.28.4",
|
|
60
60
|
"@babel/preset-env": "^7.28.3",
|
|
61
61
|
"@babel/preset-react": "^7.27.1",
|
|
62
|
-
"@commitlint/cli": "^
|
|
63
|
-
"@commitlint/config-conventional": "^
|
|
64
|
-
"@itcase/lint": "^1.1.
|
|
62
|
+
"@commitlint/cli": "^20.1.0",
|
|
63
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
64
|
+
"@itcase/lint": "^1.1.67",
|
|
65
65
|
"@rollup/plugin-babel": "^6.0.4",
|
|
66
66
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
67
67
|
"@rollup/plugin-json": "^6.1.0",
|
|
68
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
68
|
+
"@rollup/plugin-node-resolve": "^16.0.2",
|
|
69
69
|
"@semantic-release/changelog": "^6.0.3",
|
|
70
70
|
"@semantic-release/git": "^10.0.1",
|
|
71
71
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
@@ -74,17 +74,17 @@
|
|
|
74
74
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
75
75
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
76
76
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
77
|
-
"eslint": "9.
|
|
77
|
+
"eslint": "9.37.0",
|
|
78
78
|
"husky": "^9.1.7",
|
|
79
|
-
"lint-staged": "^16.
|
|
79
|
+
"lint-staged": "^16.2.3",
|
|
80
80
|
"postcss": "^8.5.6",
|
|
81
81
|
"prettier": "3.6.2",
|
|
82
|
-
"rollup": "^4.
|
|
82
|
+
"rollup": "^4.52.4",
|
|
83
83
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
84
|
-
"semantic-release": "^24.2.
|
|
85
|
-
"storybook": "^9.1.
|
|
86
|
-
"stylelint": "^16.
|
|
87
|
-
"typescript": "^5.9.
|
|
88
|
-
"yup": "^1.7.
|
|
84
|
+
"semantic-release": "^24.2.9",
|
|
85
|
+
"storybook": "^9.1.10",
|
|
86
|
+
"stylelint": "^16.25.0",
|
|
87
|
+
"typescript": "^5.9.3",
|
|
88
|
+
"yup": "^1.7.1"
|
|
89
89
|
}
|
|
90
90
|
}
|