@itcase/forms 1.1.26 → 1.1.28
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/itcase-forms.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isPossiblePhoneNumber } from 'libphonenumber-js';
|
|
2
|
-
import React
|
|
2
|
+
import React, { useMemo, useEffect, useState, useCallback } from 'react';
|
|
3
3
|
import { setIn, FORM_ERROR, getIn } from 'final-form';
|
|
4
4
|
import { useForm, Field, Form, FormSpy } from 'react-final-form';
|
|
5
5
|
export { Field, useForm, useFormState } from 'react-final-form';
|
|
@@ -26,6 +26,7 @@ import { Code } from '@itcase/ui/components/Code';
|
|
|
26
26
|
import { Icon } from '@itcase/ui/components/Icon';
|
|
27
27
|
import { DatePickerInput } from '@itcase/ui/components/DatePicker';
|
|
28
28
|
import { Input } from '@itcase/ui/components/Input';
|
|
29
|
+
import { icons24 } from '@itcase/icons/default';
|
|
29
30
|
import { Segmented } from '@itcase/ui/components/Segmented';
|
|
30
31
|
import { Select } from '@itcase/ui/components/Select';
|
|
31
32
|
import { Switch } from '@itcase/ui/components/Switch';
|
|
@@ -338,56 +339,56 @@ function FieldWrapperBase(props) {
|
|
|
338
339
|
const errorTextSize = props[`${errorKey}MessageTextSize`];
|
|
339
340
|
const errorTextColor = props[`${errorKey}MessageTextColor`];
|
|
340
341
|
const errorTextWeight = props[`${errorKey}MessageTextWeight`];
|
|
341
|
-
return /*#__PURE__*/React
|
|
342
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
342
343
|
dataTestId: `${inputName}Field`,
|
|
343
344
|
dataTour: dataTour,
|
|
344
345
|
className: clsx(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),
|
|
345
346
|
style: formFieldStyles
|
|
346
|
-
}, before, (label || labelHidden) && /*#__PURE__*/React
|
|
347
|
+
}, before, (label || labelHidden) && /*#__PURE__*/React.createElement("div", {
|
|
347
348
|
dataTestId: `${inputName}FieldLabel`,
|
|
348
349
|
className: clsx('form-field__label'),
|
|
349
350
|
htmlFor: id
|
|
350
|
-
}, /*#__PURE__*/React
|
|
351
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
351
352
|
size: labelTextSize,
|
|
352
353
|
textColor: labelTextColor,
|
|
353
354
|
textWeight: labelTextWeight,
|
|
354
355
|
sizeMobile: labelTextSizeMobile,
|
|
355
356
|
sizeTablet: labelTextSizeTablet
|
|
356
|
-
}, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React
|
|
357
|
+
}, label, labelHidden && '\u00A0')), desc && /*#__PURE__*/React.createElement("div", {
|
|
357
358
|
className: "form-field__desc",
|
|
358
359
|
dataTestId: `${inputName}FieldDesc`
|
|
359
|
-
}, /*#__PURE__*/React
|
|
360
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
360
361
|
size: descTextSize,
|
|
361
362
|
textColor: descTextColor,
|
|
362
363
|
textWeight: descTextWeight
|
|
363
|
-
}, desc)), /*#__PURE__*/React
|
|
364
|
+
}, desc)), /*#__PURE__*/React.createElement("div", {
|
|
364
365
|
className: clsx('form-field__content', inputFillClass, inputShapeClass)
|
|
365
|
-
}, /*#__PURE__*/React
|
|
366
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
366
367
|
className: clsx('form-field__content-inner', fieldClass)
|
|
367
|
-
}, beforeItem, children, afterItem), showDivider && /*#__PURE__*/React
|
|
368
|
+
}, beforeItem, children, afterItem), showDivider && /*#__PURE__*/React.createElement(Divider, {
|
|
368
369
|
className: "form-field__item-divider",
|
|
369
370
|
width: dividerWidth,
|
|
370
371
|
direction: dividerDirection,
|
|
371
372
|
size: dividerSize,
|
|
372
373
|
fill: dividerFill
|
|
373
|
-
})), showMessage && /*#__PURE__*/React
|
|
374
|
+
})), showMessage && /*#__PURE__*/React.createElement("div", {
|
|
374
375
|
dataTestId: `${inputName}FieldMessage`,
|
|
375
376
|
className: "form-field__message"
|
|
376
|
-
}, isErrorState && errorMessage && /*#__PURE__*/React
|
|
377
|
+
}, isErrorState && errorMessage && /*#__PURE__*/React.createElement(Text, {
|
|
377
378
|
id: `${inputName}-error`,
|
|
378
379
|
dataTestId: `${inputName}FieldMessageError`,
|
|
379
380
|
className: "form-field__message-item form-field__message-item_type-error",
|
|
380
381
|
size: errorTextSize,
|
|
381
382
|
textColor: errorTextColor,
|
|
382
383
|
textWeight: errorTextWeight
|
|
383
|
-
}, errorMessage), Boolean(helpText) && (!isErrorState || !errorMessage) && /*#__PURE__*/React
|
|
384
|
+
}, errorMessage), Boolean(helpText) && (!isErrorState || !errorMessage) && /*#__PURE__*/React.createElement(Text, {
|
|
384
385
|
dataTestId: `${inputName}FieldMessageHelpText`,
|
|
385
386
|
className: "form-field__message-item form-field__message-item_type_help-text",
|
|
386
387
|
size: helpTextSize,
|
|
387
388
|
textColor: isValidState ? helpTextColorSuccess : helpTextColor,
|
|
388
389
|
textWeight: helpTextWeight,
|
|
389
390
|
sizeMobile: helpTextSizeMobile
|
|
390
|
-
}, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React
|
|
391
|
+
}, helpText), (!isErrorState && !helpText || isErrorState && !helpText && !errorMessage) && /*#__PURE__*/React.createElement(Text, {
|
|
391
392
|
dataTestId: `${inputName}FieldMessageHelpText`,
|
|
392
393
|
className: "form-field__message-item form-field__message-item_type_help-text",
|
|
393
394
|
size: messageTextSize
|
|
@@ -406,7 +407,7 @@ function FieldWrapper(props) {
|
|
|
406
407
|
change(inputName, undefined);
|
|
407
408
|
};
|
|
408
409
|
}, []);
|
|
409
|
-
return /*#__PURE__*/React
|
|
410
|
+
return /*#__PURE__*/React.createElement(FieldWrapperBase, props);
|
|
410
411
|
}
|
|
411
412
|
|
|
412
413
|
const defaultDropzoneProps = {
|
|
@@ -430,7 +431,7 @@ const defaultDropzoneProps = {
|
|
|
430
431
|
isPreviews: true
|
|
431
432
|
};
|
|
432
433
|
|
|
433
|
-
const FileInputDropzone = /*#__PURE__*/React
|
|
434
|
+
const FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props) {
|
|
434
435
|
const {
|
|
435
436
|
className,
|
|
436
437
|
maxFiles,
|
|
@@ -613,85 +614,85 @@ const FileInputDropzone = /*#__PURE__*/React$1.memo(function FileInputDropzone(p
|
|
|
613
614
|
thumbNameTextWeight,
|
|
614
615
|
thumbNameTextWrap
|
|
615
616
|
} = propsGenerator;
|
|
616
|
-
return /*#__PURE__*/React
|
|
617
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", getRootProps({
|
|
617
618
|
className: `form-dropzone__dropzone dropzone ${className} form-dropzone__dropzone_size_${size} ${shapeClass}`
|
|
618
|
-
}), /*#__PURE__*/React
|
|
619
|
+
}), /*#__PURE__*/React.createElement("input", Object.assign({}, getInputProps(), {
|
|
619
620
|
name: inputName
|
|
620
|
-
})), /*#__PURE__*/React
|
|
621
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
621
622
|
className: clsx('form-dropzone__dropzone-wrapper', thumbColumn && `form-dropzone__dropzone-wrapper_column_${thumbColumn}`, fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderColorHoverClass, borderTypeClass)
|
|
622
|
-
}, filesList.map((file, index) => /*#__PURE__*/React
|
|
623
|
+
}, filesList.map((file, index) => /*#__PURE__*/React.createElement("aside", {
|
|
623
624
|
className: clsx('form-dropzone__thumb', fillClass, thumbDirectionClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderColorHoverClass, thumbBorderTypeClass),
|
|
624
625
|
key: file.id || `${file.name}_${index}`
|
|
625
|
-
}, isPreviews && !file.error && /*#__PURE__*/React
|
|
626
|
+
}, isPreviews && !file.error && /*#__PURE__*/React.createElement("div", {
|
|
626
627
|
className: "form-dropzone__thumb-image"
|
|
627
|
-
}, /*#__PURE__*/React
|
|
628
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
628
629
|
className: "form-dropzone__thumb-image-inner",
|
|
629
630
|
src: file.preview || file.image,
|
|
630
631
|
onLoad: () => {
|
|
631
632
|
// Revoke data uri after image is loaded
|
|
632
633
|
URL.revokeObjectURL(file.preview);
|
|
633
634
|
}
|
|
634
|
-
})), file.error && /*#__PURE__*/React
|
|
635
|
+
})), file.error && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
635
636
|
size: thumbNameTextSize,
|
|
636
637
|
textColor: thumbNameTextColor,
|
|
637
638
|
textWeight: thumbNameTextWeight,
|
|
638
639
|
textWrap: thumbNameTextWrap
|
|
639
|
-
}, fileErrorText || file.error)), showFilename && /*#__PURE__*/React
|
|
640
|
+
}, fileErrorText || file.error)), showFilename && /*#__PURE__*/React.createElement("div", {
|
|
640
641
|
className: "form-dropzone__thumb-name"
|
|
641
|
-
}, /*#__PURE__*/React
|
|
642
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
642
643
|
className: "form-dropzone__thumb-name-inner",
|
|
643
644
|
size: thumbNameTextSize,
|
|
644
645
|
textColor: thumbNameTextColor,
|
|
645
646
|
textWeight: thumbNameTextWeight,
|
|
646
647
|
textWrap: thumbNameTextWrap
|
|
647
|
-
}, file.name)), fileIsLoading && /*#__PURE__*/React
|
|
648
|
+
}, file.name)), fileIsLoading && /*#__PURE__*/React.createElement("div", {
|
|
648
649
|
className: "form-dropzone__thumb-loader"
|
|
649
|
-
}, /*#__PURE__*/React
|
|
650
|
+
}, /*#__PURE__*/React.createElement(Loader, {
|
|
650
651
|
width: "fill",
|
|
651
652
|
height: "fill",
|
|
652
653
|
fill: "surfacePrimary",
|
|
653
654
|
itemFill: "surfaceItemAccent",
|
|
654
655
|
set: "simple"
|
|
655
|
-
})), /*#__PURE__*/React
|
|
656
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
656
657
|
className: clsx('form-dropzone__thumb-remove')
|
|
657
|
-
}, /*#__PURE__*/React
|
|
658
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
658
659
|
className: "form-dropzone__thumb-remove-text",
|
|
659
660
|
appearance: removeThumbAppearance,
|
|
660
661
|
label: removeThumbText || 'Удалить',
|
|
661
662
|
labelTextWeight: removeThumbTextWeight,
|
|
662
663
|
shape: removeThumbShape,
|
|
663
664
|
onClick: event => removeFile(event, index)
|
|
664
|
-
})))), !filesList.length ? /*#__PURE__*/React
|
|
665
|
+
})))), !filesList.length ? /*#__PURE__*/React.createElement("div", {
|
|
665
666
|
className: "form-dropzone__hint"
|
|
666
|
-
}, /*#__PURE__*/React
|
|
667
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
667
668
|
className: "form-dropzone__hint-title",
|
|
668
669
|
size: hintTitleTextSize,
|
|
669
670
|
textColor: hintTitleTextColor,
|
|
670
671
|
textWeight: hintTitleTextWeight,
|
|
671
672
|
textWrap: hintTitleTextWrap
|
|
672
|
-
}, hintTitle || 'Select a file or drag in form'), hintDescription && /*#__PURE__*/React
|
|
673
|
+
}, hintTitle || 'Select a file or drag in form'), hintDescription && /*#__PURE__*/React.createElement(Text, {
|
|
673
674
|
className: "form-dropzone__hint-text",
|
|
674
675
|
size: hintDescriptionTextSize,
|
|
675
676
|
textColor: hintDescriptionTextColor,
|
|
676
677
|
textWeight: hintDescriptionTextWeight,
|
|
677
678
|
textWrap: hintDescriptionTextWrap
|
|
678
|
-
}, hintDescription)) : /*#__PURE__*/React
|
|
679
|
+
}, hintDescription)) : /*#__PURE__*/React.createElement("div", {
|
|
679
680
|
className: "form-dropzone__hint form-dropzone__hint_type_add-more"
|
|
680
|
-
}, /*#__PURE__*/React
|
|
681
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
681
682
|
className: "form-dropzone__hint-title",
|
|
682
683
|
size: hintTitleTextSize,
|
|
683
684
|
textColor: hintTitleTextColor,
|
|
684
685
|
textWeight: hintTitleTextWeight,
|
|
685
686
|
textWrap: hintTitleTextWrap
|
|
686
|
-
}, hintTitle || 'Select a file or drag in form'), hintDescription && /*#__PURE__*/React
|
|
687
|
+
}, hintTitle || 'Select a file or drag in form'), hintDescription && /*#__PURE__*/React.createElement(Text, {
|
|
687
688
|
className: "form-dropzone__hint-text",
|
|
688
689
|
size: hintDescriptionTextSize,
|
|
689
690
|
textColor: hintDescriptionTextColor,
|
|
690
691
|
textWeight: hintDescriptionTextWeight,
|
|
691
692
|
textWrap: hintDescriptionTextWrap
|
|
692
|
-
}, hintDescription)))), fileError && /*#__PURE__*/React
|
|
693
|
+
}, hintDescription)))), fileError && /*#__PURE__*/React.createElement("div", {
|
|
693
694
|
className: "form-field__message"
|
|
694
|
-
}, /*#__PURE__*/React
|
|
695
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
695
696
|
className: "form-field__message-item form-field__message-item_type_message",
|
|
696
697
|
size: errorMessageTextSize,
|
|
697
698
|
textColor: errorMessageTextColor,
|
|
@@ -770,7 +771,7 @@ function setFileDataURL(file, resolve) {
|
|
|
770
771
|
}
|
|
771
772
|
}
|
|
772
773
|
|
|
773
|
-
const FileInput = /*#__PURE__*/React
|
|
774
|
+
const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
774
775
|
const {
|
|
775
776
|
className,
|
|
776
777
|
name,
|
|
@@ -827,7 +828,7 @@ const FileInput = /*#__PURE__*/React$1.memo(function FileInput(props) {
|
|
|
827
828
|
thumbNameTextWeight,
|
|
828
829
|
thumbNameTextWrap
|
|
829
830
|
} = propsGenerator;
|
|
830
|
-
return /*#__PURE__*/React
|
|
831
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
831
832
|
name: name
|
|
832
833
|
}, function Render({
|
|
833
834
|
input,
|
|
@@ -858,7 +859,7 @@ const FileInput = /*#__PURE__*/React$1.memo(function FileInput(props) {
|
|
|
858
859
|
/** TODO:
|
|
859
860
|
* REFACTOR PROPERTIES
|
|
860
861
|
*/
|
|
861
|
-
return /*#__PURE__*/React
|
|
862
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
862
863
|
className: clsx('form-field_type_dropzone', 'form__item_type_dropzone', classNameGroupItem),
|
|
863
864
|
width: width,
|
|
864
865
|
label: label,
|
|
@@ -875,7 +876,7 @@ const FileInput = /*#__PURE__*/React$1.memo(function FileInput(props) {
|
|
|
875
876
|
showMessage: showMessage,
|
|
876
877
|
isRequired: isRequired,
|
|
877
878
|
isValidState: isValidState
|
|
878
|
-
}, fieldProps), /*#__PURE__*/React
|
|
879
|
+
}, fieldProps), /*#__PURE__*/React.createElement(FileInputDropzone, {
|
|
879
880
|
className: className,
|
|
880
881
|
maxFiles: maxFiles,
|
|
881
882
|
maxSize: maxSize,
|
|
@@ -935,7 +936,7 @@ const defaultGroupProps = {
|
|
|
935
936
|
labelTextWeight: 500
|
|
936
937
|
};
|
|
937
938
|
|
|
938
|
-
const FormBlockGroup = /*#__PURE__*/React
|
|
939
|
+
const FormBlockGroup = /*#__PURE__*/React.memo(function Group(props) {
|
|
939
940
|
const {
|
|
940
941
|
className,
|
|
941
942
|
name,
|
|
@@ -959,7 +960,7 @@ const FormBlockGroup = /*#__PURE__*/React$1.memo(function Group(props) {
|
|
|
959
960
|
isHidden,
|
|
960
961
|
children
|
|
961
962
|
} = props;
|
|
962
|
-
return /*#__PURE__*/React
|
|
963
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
963
964
|
name: name
|
|
964
965
|
}, function Render({
|
|
965
966
|
input,
|
|
@@ -985,37 +986,37 @@ const FormBlockGroup = /*#__PURE__*/React$1.memo(function Group(props) {
|
|
|
985
986
|
inputProps: props,
|
|
986
987
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
987
988
|
});
|
|
988
|
-
return /*#__PURE__*/React
|
|
989
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
989
990
|
className: clsx('form__group', className, isHidden && 'form__group_hidden', column && `form__group_column_${column}`),
|
|
990
991
|
"data-tour": dataTour
|
|
991
|
-
}, /*#__PURE__*/React
|
|
992
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
992
993
|
className: "form__group-wrapper"
|
|
993
|
-
}, before, title && /*#__PURE__*/React
|
|
994
|
+
}, before, title && /*#__PURE__*/React.createElement("div", {
|
|
994
995
|
className: "form__group-title"
|
|
995
|
-
}, /*#__PURE__*/React
|
|
996
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
996
997
|
size: titleTextSize,
|
|
997
998
|
textColor: titleTextColor,
|
|
998
999
|
textWeight: titleTextWeight
|
|
999
|
-
}, title)), label && /*#__PURE__*/React
|
|
1000
|
+
}, title)), label && /*#__PURE__*/React.createElement("div", {
|
|
1000
1001
|
className: "form__group-label"
|
|
1001
|
-
}, /*#__PURE__*/React
|
|
1002
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
1002
1003
|
size: labelTextSize,
|
|
1003
1004
|
textColor: labelTextColor,
|
|
1004
1005
|
textWeight: labelTextWeight
|
|
1005
|
-
}, label)), /*#__PURE__*/React
|
|
1006
|
+
}, label)), /*#__PURE__*/React.createElement("div", {
|
|
1006
1007
|
className: "form__group-items"
|
|
1007
|
-
}, children), after), showGroupMessage && /*#__PURE__*/React
|
|
1008
|
+
}, children), after), showGroupMessage && /*#__PURE__*/React.createElement(React.Fragment, null, isErrorState && errorMessage && /*#__PURE__*/React.createElement(Text, {
|
|
1008
1009
|
className: `form__group-message form__group-message_type-${errorKey}`,
|
|
1009
1010
|
id: `${name}-error`,
|
|
1010
1011
|
size: updatedProps.messageTextSize,
|
|
1011
1012
|
textColor: updatedProps.messageTextColor,
|
|
1012
1013
|
textWeight: updatedProps.messageTextWeight
|
|
1013
|
-
}, errorMessage), Boolean(message) && (!isErrorState || !errorMessage) && /*#__PURE__*/React
|
|
1014
|
+
}, errorMessage), Boolean(message) && (!isErrorState || !errorMessage) && /*#__PURE__*/React.createElement(Text, {
|
|
1014
1015
|
className: "form__group-message",
|
|
1015
1016
|
size: messageTextSize,
|
|
1016
1017
|
textColor: messageTextColor,
|
|
1017
1018
|
textWeight: messageTextWeight
|
|
1018
|
-
}, message), !isErrorState && !message && /*#__PURE__*/React
|
|
1019
|
+
}, message), !isErrorState && !message && /*#__PURE__*/React.createElement(Text, {
|
|
1019
1020
|
className: "form__group-message",
|
|
1020
1021
|
size: messageTextSize
|
|
1021
1022
|
}, '\u00A0')));
|
|
@@ -1034,7 +1035,7 @@ const defaultCheckboxProps = {
|
|
|
1034
1035
|
requiredBorderColor: 'warningBorderSecondary'
|
|
1035
1036
|
};
|
|
1036
1037
|
|
|
1037
|
-
const FormFieldCheckbox = /*#__PURE__*/React
|
|
1038
|
+
const FormFieldCheckbox = /*#__PURE__*/React.memo(function FormFieldCheckbox(props) {
|
|
1038
1039
|
const {
|
|
1039
1040
|
name,
|
|
1040
1041
|
initialValue,
|
|
@@ -1046,7 +1047,7 @@ const FormFieldCheckbox = /*#__PURE__*/React$1.memo(function FormFieldCheckbox(p
|
|
|
1046
1047
|
isRequired,
|
|
1047
1048
|
onChange
|
|
1048
1049
|
} = props;
|
|
1049
|
-
return /*#__PURE__*/React
|
|
1050
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1050
1051
|
type: "checkbox",
|
|
1051
1052
|
name: name,
|
|
1052
1053
|
initialValue: initialValue
|
|
@@ -1081,7 +1082,7 @@ const FormFieldCheckbox = /*#__PURE__*/React$1.memo(function FormFieldCheckbox(p
|
|
|
1081
1082
|
inputProps: inputProps,
|
|
1082
1083
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1083
1084
|
});
|
|
1084
|
-
return /*#__PURE__*/React
|
|
1085
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1085
1086
|
className: clsx('form-field_type_checkbox', 'form__item_type_checkbox', classNameGroupItem),
|
|
1086
1087
|
errorKey: errorKey,
|
|
1087
1088
|
errorMessage: errorMessage,
|
|
@@ -1096,7 +1097,7 @@ const FormFieldCheckbox = /*#__PURE__*/React$1.memo(function FormFieldCheckbox(p
|
|
|
1096
1097
|
tag: "label",
|
|
1097
1098
|
isRequired: isRequired,
|
|
1098
1099
|
isValidState: isValidState
|
|
1099
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1100
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Checkbox, Object.assign({
|
|
1100
1101
|
type: "checkbox",
|
|
1101
1102
|
name: input.name,
|
|
1102
1103
|
isDisabled: isDisabled,
|
|
@@ -1147,7 +1148,7 @@ function FormFieldChips(props) {
|
|
|
1147
1148
|
// update the form value only when the initialValue changes, so use disable eslint to ignore the warning
|
|
1148
1149
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1149
1150
|
}, [initialValue]);
|
|
1150
|
-
return /*#__PURE__*/React
|
|
1151
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1151
1152
|
name: name,
|
|
1152
1153
|
initialValue: initialValue
|
|
1153
1154
|
}, function Render({
|
|
@@ -1179,7 +1180,7 @@ function FormFieldChips(props) {
|
|
|
1179
1180
|
}
|
|
1180
1181
|
return emptyOptionsList;
|
|
1181
1182
|
}, [input.value]);
|
|
1182
|
-
return /*#__PURE__*/React
|
|
1183
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1183
1184
|
className: clsx('form-field_type_chips', 'form__item_type_chips', classNameGroupItem),
|
|
1184
1185
|
errorKey: errorKey,
|
|
1185
1186
|
errorMessage: errorMessage,
|
|
@@ -1193,11 +1194,11 @@ function FormFieldChips(props) {
|
|
|
1193
1194
|
showMessage: showMessage,
|
|
1194
1195
|
isRequired: isRequired,
|
|
1195
1196
|
isValidState: isValidState
|
|
1196
|
-
}, fieldProps), options.length ? /*#__PURE__*/React
|
|
1197
|
+
}, fieldProps), options.length ? /*#__PURE__*/React.createElement(ChipsGroup, {
|
|
1197
1198
|
direction: "horizontal",
|
|
1198
1199
|
gap: "1m",
|
|
1199
1200
|
wrap: "wrap"
|
|
1200
|
-
}, options.map(option => /*#__PURE__*/React
|
|
1201
|
+
}, options.map(option => /*#__PURE__*/React.createElement(Chips, Object.assign({
|
|
1201
1202
|
className: clsx(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
1202
1203
|
key: option.value,
|
|
1203
1204
|
label: option.label,
|
|
@@ -1205,7 +1206,7 @@ function FormFieldChips(props) {
|
|
|
1205
1206
|
value: option.value,
|
|
1206
1207
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
1207
1208
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
1208
|
-
}, updatedInputProps)))) : /*#__PURE__*/React
|
|
1209
|
+
}, updatedInputProps)))) : /*#__PURE__*/React.createElement(Text, {
|
|
1209
1210
|
size: emptyMessageTextSize,
|
|
1210
1211
|
textColor: emptyMessageTextColor
|
|
1211
1212
|
}, emptyMessage));
|
|
@@ -1219,7 +1220,7 @@ const defaultChoiceProps = {
|
|
|
1219
1220
|
requiredBorderColor: 'warningBorderPrimary'
|
|
1220
1221
|
};
|
|
1221
1222
|
|
|
1222
|
-
const FormFieldChoice = /*#__PURE__*/React
|
|
1223
|
+
const FormFieldChoice = /*#__PURE__*/React.memo(function FormFieldChoice(props) {
|
|
1223
1224
|
const {
|
|
1224
1225
|
name,
|
|
1225
1226
|
initialValue,
|
|
@@ -1245,7 +1246,7 @@ const FormFieldChoice = /*#__PURE__*/React$1.memo(function FormFieldChoice(props
|
|
|
1245
1246
|
onChange(option.value, name, isChecked);
|
|
1246
1247
|
}
|
|
1247
1248
|
}, [change, onChange]);
|
|
1248
|
-
return /*#__PURE__*/React
|
|
1249
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1249
1250
|
initialValue: initialValue,
|
|
1250
1251
|
name: name
|
|
1251
1252
|
}, function Render({
|
|
@@ -1283,7 +1284,7 @@ const FormFieldChoice = /*#__PURE__*/React$1.memo(function FormFieldChoice(props
|
|
|
1283
1284
|
inputProps: inputProps,
|
|
1284
1285
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1285
1286
|
});
|
|
1286
|
-
return /*#__PURE__*/React
|
|
1287
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1287
1288
|
className: clsx('form-field_type_choice', 'form__item_type_choice', classNameGroupItem),
|
|
1288
1289
|
label: label,
|
|
1289
1290
|
errorKey: errorKey,
|
|
@@ -1299,7 +1300,7 @@ const FormFieldChoice = /*#__PURE__*/React$1.memo(function FormFieldChoice(props
|
|
|
1299
1300
|
showMessage: showMessage,
|
|
1300
1301
|
isRequired: isRequired,
|
|
1301
1302
|
isValidState: isValidState
|
|
1302
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1303
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Choice, Object.assign({
|
|
1303
1304
|
className: clsx(meta.active && 'form-choice_state_focus', meta.error && meta.touched && `form-choice_state_${errorKey}`),
|
|
1304
1305
|
name: input.name,
|
|
1305
1306
|
isDisabled: isDisabled,
|
|
@@ -1318,7 +1319,7 @@ const defaultCodeProps = {
|
|
|
1318
1319
|
appearance: 'defaultPrimary sizeL solid rounded'
|
|
1319
1320
|
};
|
|
1320
1321
|
|
|
1321
|
-
const FormFieldCode = /*#__PURE__*/React
|
|
1322
|
+
const FormFieldCode = /*#__PURE__*/React.memo(function FormFieldCode(props) {
|
|
1322
1323
|
const {
|
|
1323
1324
|
name,
|
|
1324
1325
|
initialValue,
|
|
@@ -1329,7 +1330,7 @@ const FormFieldCode = /*#__PURE__*/React$1.memo(function FormFieldCode(props) {
|
|
|
1329
1330
|
showMessage,
|
|
1330
1331
|
isRequired
|
|
1331
1332
|
} = props;
|
|
1332
|
-
return /*#__PURE__*/React
|
|
1333
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1333
1334
|
name: name,
|
|
1334
1335
|
initialValue: initialValue
|
|
1335
1336
|
}, function Render({
|
|
@@ -1355,7 +1356,7 @@ const FormFieldCode = /*#__PURE__*/React$1.memo(function FormFieldCode(props) {
|
|
|
1355
1356
|
inputProps: inputProps,
|
|
1356
1357
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1357
1358
|
});
|
|
1358
|
-
return /*#__PURE__*/React
|
|
1359
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1359
1360
|
className: clsx('form-field_type_code', 'form__item_type_code', classNameGroupItem),
|
|
1360
1361
|
fieldClassName: 'form-code',
|
|
1361
1362
|
inputName: input.name,
|
|
@@ -1364,7 +1365,7 @@ const FormFieldCode = /*#__PURE__*/React$1.memo(function FormFieldCode(props) {
|
|
|
1364
1365
|
showMessage: showMessage,
|
|
1365
1366
|
isRequired: isRequired,
|
|
1366
1367
|
isValidState: isValidState
|
|
1367
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1368
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Code, Object.assign({
|
|
1368
1369
|
name: input.name,
|
|
1369
1370
|
isDisabled: isDisabled,
|
|
1370
1371
|
autoComplete: "nope",
|
|
@@ -1376,7 +1377,7 @@ const FormFieldCode = /*#__PURE__*/React$1.memo(function FormFieldCode(props) {
|
|
|
1376
1377
|
});
|
|
1377
1378
|
});
|
|
1378
1379
|
|
|
1379
|
-
const FormFieldCustom = /*#__PURE__*/React
|
|
1380
|
+
const FormFieldCustom = /*#__PURE__*/React.memo(function FormFieldCustom(props) {
|
|
1380
1381
|
const {
|
|
1381
1382
|
Component,
|
|
1382
1383
|
isDisabled,
|
|
@@ -1393,7 +1394,7 @@ const FormFieldCustom = /*#__PURE__*/React$1.memo(function FormFieldCustom(props
|
|
|
1393
1394
|
clearIconSize,
|
|
1394
1395
|
onClickClearIcon
|
|
1395
1396
|
} = props;
|
|
1396
|
-
return /*#__PURE__*/React
|
|
1397
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1397
1398
|
initialValue: initialValue,
|
|
1398
1399
|
name: name
|
|
1399
1400
|
}, function Render({
|
|
@@ -1422,7 +1423,7 @@ const FormFieldCustom = /*#__PURE__*/React$1.memo(function FormFieldCustom(props
|
|
|
1422
1423
|
// For "Custom" field we pass all props. Can contain some special props, we don't known.
|
|
1423
1424
|
inputProps: props
|
|
1424
1425
|
});
|
|
1425
|
-
return /*#__PURE__*/React
|
|
1426
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1426
1427
|
className: clsx('form-field_type_custom', 'form__item_type_custom', classNameGroupItem),
|
|
1427
1428
|
errorKey: errorKey,
|
|
1428
1429
|
errorMessage: errorMessage,
|
|
@@ -1436,11 +1437,11 @@ const FormFieldCustom = /*#__PURE__*/React$1.memo(function FormFieldCustom(props
|
|
|
1436
1437
|
metaActive: meta.active,
|
|
1437
1438
|
metaError: meta.error,
|
|
1438
1439
|
showMessage: showMessage
|
|
1439
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1440
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Component, Object.assign({}, updatedInputProps, {
|
|
1440
1441
|
input: input,
|
|
1441
1442
|
isDisabled: isDisabled,
|
|
1442
1443
|
meta: meta
|
|
1443
|
-
})), clearIcon && /*#__PURE__*/React
|
|
1444
|
+
})), clearIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
1444
1445
|
className: "form-field__icon",
|
|
1445
1446
|
iconFill: clearIconFill,
|
|
1446
1447
|
iconFillHover: clearIconFillHover,
|
|
@@ -1478,7 +1479,7 @@ function FormFieldDatePicker(props) {
|
|
|
1478
1479
|
isRequired,
|
|
1479
1480
|
onChange
|
|
1480
1481
|
} = props;
|
|
1481
|
-
return /*#__PURE__*/React
|
|
1482
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1482
1483
|
name: name
|
|
1483
1484
|
}, function Render({
|
|
1484
1485
|
input,
|
|
@@ -1521,7 +1522,7 @@ function FormFieldDatePicker(props) {
|
|
|
1521
1522
|
inputProps: inputProps,
|
|
1522
1523
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1523
1524
|
});
|
|
1524
|
-
return /*#__PURE__*/React
|
|
1525
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1525
1526
|
className: clsx('form-field_type_datepicker', 'form__item_type_datepicker', classNameGroupItem),
|
|
1526
1527
|
errorKey: errorKey,
|
|
1527
1528
|
errorMessage: errorMessage,
|
|
@@ -1535,7 +1536,7 @@ function FormFieldDatePicker(props) {
|
|
|
1535
1536
|
showMessage: showMessage,
|
|
1536
1537
|
isRequired: isRequired,
|
|
1537
1538
|
isValidState: isValidState
|
|
1538
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1539
|
+
}, fieldProps), /*#__PURE__*/React.createElement(DatePickerInput, {
|
|
1539
1540
|
name: input.name,
|
|
1540
1541
|
isDisabled: isDisabled,
|
|
1541
1542
|
datePickerProps: datePickerProps,
|
|
@@ -1556,7 +1557,7 @@ const defaultInputProps = {
|
|
|
1556
1557
|
requiredBorderColor: 'warningBorderSecondary'
|
|
1557
1558
|
};
|
|
1558
1559
|
|
|
1559
|
-
const FormFieldInput = /*#__PURE__*/React
|
|
1560
|
+
const FormFieldInput = /*#__PURE__*/React.memo(function FormFieldInput(props) {
|
|
1560
1561
|
const {
|
|
1561
1562
|
name,
|
|
1562
1563
|
initialValue,
|
|
@@ -1571,34 +1572,14 @@ const FormFieldInput = /*#__PURE__*/React$1.memo(function FormFieldInput(props)
|
|
|
1571
1572
|
clearIconShape,
|
|
1572
1573
|
clearIconSize,
|
|
1573
1574
|
fieldProps = {},
|
|
1574
|
-
iconFill,
|
|
1575
|
-
iconFillHover,
|
|
1576
|
-
iconRevealableHide,
|
|
1577
|
-
iconRevealableShow,
|
|
1578
|
-
iconShape,
|
|
1579
|
-
iconSize,
|
|
1580
1575
|
inputProps = {},
|
|
1581
1576
|
parse,
|
|
1582
1577
|
showMessage,
|
|
1583
|
-
isPassword,
|
|
1584
1578
|
isRequired,
|
|
1585
|
-
isRevealable,
|
|
1586
1579
|
onChange,
|
|
1587
1580
|
onClickClearIcon
|
|
1588
1581
|
} = props;
|
|
1589
|
-
|
|
1590
|
-
const inputType = useMemo(() => {
|
|
1591
|
-
if (isPassword) {
|
|
1592
|
-
return isRevealed ? 'text' : 'password';
|
|
1593
|
-
} else {
|
|
1594
|
-
return 'text';
|
|
1595
|
-
}
|
|
1596
|
-
}, [isRevealed, isPassword]);
|
|
1597
|
-
const onClickIconReveal = useCallback(event => {
|
|
1598
|
-
event.preventDefault();
|
|
1599
|
-
setIsRevealed(prev => !prev);
|
|
1600
|
-
}, []);
|
|
1601
|
-
return /*#__PURE__*/React$1.createElement(Field, {
|
|
1582
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1602
1583
|
name: name,
|
|
1603
1584
|
initialValue: initialValue,
|
|
1604
1585
|
parse: parse
|
|
@@ -1633,25 +1614,24 @@ const FormFieldInput = /*#__PURE__*/React$1.memo(function FormFieldInput(props)
|
|
|
1633
1614
|
inputProps: inputProps,
|
|
1634
1615
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1635
1616
|
});
|
|
1636
|
-
|
|
1637
|
-
return /*#__PURE__*/React$1.createElement(FieldWrapper, Object.assign({
|
|
1617
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1638
1618
|
className: clsx('form-field_type_input', 'form__item_type_input', classNameGroupItem),
|
|
1639
1619
|
errorKey: errorKey,
|
|
1640
1620
|
errorMessage: errorMessage,
|
|
1641
1621
|
isErrorState: isErrorState,
|
|
1642
1622
|
metaError: meta.error,
|
|
1643
1623
|
isDisabled: isDisabled,
|
|
1644
|
-
fieldClassName:
|
|
1624
|
+
fieldClassName: "form-input",
|
|
1645
1625
|
inputName: input.name,
|
|
1646
1626
|
inputValue: input.value || '',
|
|
1647
1627
|
metaActive: meta.active,
|
|
1648
1628
|
showMessage: showMessage,
|
|
1649
1629
|
isRequired: isRequired,
|
|
1650
1630
|
isValidState: isValidState
|
|
1651
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1631
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
1652
1632
|
dataTestId: `${input.name}FieldInput`,
|
|
1653
1633
|
className: clsx(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
|
|
1654
|
-
type:
|
|
1634
|
+
type: "text",
|
|
1655
1635
|
name: input.name,
|
|
1656
1636
|
isDisabled: isDisabled,
|
|
1657
1637
|
autoComplete: "nope",
|
|
@@ -1659,16 +1639,7 @@ const FormFieldInput = /*#__PURE__*/React$1.memo(function FormFieldInput(props)
|
|
|
1659
1639
|
onBlur: input.onBlur,
|
|
1660
1640
|
onChange: onChangeField,
|
|
1661
1641
|
onFocus: input.onFocus
|
|
1662
|
-
}, updatedInputProps)),
|
|
1663
|
-
className: "form-field__icon",
|
|
1664
|
-
size: iconSize,
|
|
1665
|
-
iconFill: iconFill,
|
|
1666
|
-
iconFillHover: iconFillHover,
|
|
1667
|
-
imageSrc: isRevealed && isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1668
|
-
shape: iconShape,
|
|
1669
|
-
SvgImage: isRevealed && !isIconRevealableString ? iconRevealableHide : iconRevealableShow,
|
|
1670
|
-
onClick: onClickIconReveal
|
|
1671
|
-
}), clearIcon && /*#__PURE__*/React$1.createElement(Icon, {
|
|
1642
|
+
}, updatedInputProps)), clearIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
1672
1643
|
className: "form-field__icon",
|
|
1673
1644
|
size: clearIconSize,
|
|
1674
1645
|
iconFill: clearIconFill,
|
|
@@ -1681,6 +1652,110 @@ const FormFieldInput = /*#__PURE__*/React$1.memo(function FormFieldInput(props)
|
|
|
1681
1652
|
});
|
|
1682
1653
|
});
|
|
1683
1654
|
|
|
1655
|
+
const defaultPasswordProps = {
|
|
1656
|
+
appearance: 'sizeM defaultSecondary solid rounded',
|
|
1657
|
+
iconRevealableHide: icons24.View.HideValue,
|
|
1658
|
+
iconRevealableShow: icons24.View.ShowValue,
|
|
1659
|
+
iconFill: 'surfaceItemQuaternary'
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1662
|
+
const FormFieldPassword = /*#__PURE__*/React.memo(function FormFieldPassword(props) {
|
|
1663
|
+
const {
|
|
1664
|
+
name,
|
|
1665
|
+
initialValue,
|
|
1666
|
+
isDisabled,
|
|
1667
|
+
classNameGroupItem,
|
|
1668
|
+
fieldProps,
|
|
1669
|
+
iconFill,
|
|
1670
|
+
iconFillHover,
|
|
1671
|
+
iconRevealableHide,
|
|
1672
|
+
iconRevealableShow,
|
|
1673
|
+
iconShape,
|
|
1674
|
+
iconSize,
|
|
1675
|
+
inputProps,
|
|
1676
|
+
parse,
|
|
1677
|
+
showMessage,
|
|
1678
|
+
isRequired,
|
|
1679
|
+
onChange
|
|
1680
|
+
} = props;
|
|
1681
|
+
const [isRevealed, setIsRevealed] = useState(false);
|
|
1682
|
+
const inputType = useMemo(() => {
|
|
1683
|
+
return isRevealed ? 'text' : 'password';
|
|
1684
|
+
}, [isRevealed]);
|
|
1685
|
+
const onClickIconReveal = useCallback(event => {
|
|
1686
|
+
event.preventDefault();
|
|
1687
|
+
setIsRevealed(prev => !prev);
|
|
1688
|
+
}, []);
|
|
1689
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1690
|
+
name: name,
|
|
1691
|
+
initialValue: initialValue,
|
|
1692
|
+
parse: parse
|
|
1693
|
+
}, function Render({
|
|
1694
|
+
input,
|
|
1695
|
+
meta
|
|
1696
|
+
}) {
|
|
1697
|
+
/** Note:
|
|
1698
|
+
* Create "Render" function by "eslint-react-hooks/rules-of-hooks":
|
|
1699
|
+
* React Hooks cannot be called inside a callback.
|
|
1700
|
+
* React Hooks must be called in a React function component or a
|
|
1701
|
+
* custom React Hook function.
|
|
1702
|
+
*/
|
|
1703
|
+
|
|
1704
|
+
const onChangeField = useCallback(event => {
|
|
1705
|
+
input.onChange(event);
|
|
1706
|
+
if (onChange) {
|
|
1707
|
+
onChange(event.target.value, input.name);
|
|
1708
|
+
}
|
|
1709
|
+
}, [onChange, input.onChange]);
|
|
1710
|
+
const {
|
|
1711
|
+
isErrorState,
|
|
1712
|
+
isValidState,
|
|
1713
|
+
errorKey,
|
|
1714
|
+
errorMessage
|
|
1715
|
+
} = useFieldValidationState({
|
|
1716
|
+
fieldProps: fieldProps,
|
|
1717
|
+
input: input,
|
|
1718
|
+
meta: meta
|
|
1719
|
+
});
|
|
1720
|
+
const updatedInputProps = useValidationAppearanceInputProps({
|
|
1721
|
+
inputProps: inputProps,
|
|
1722
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1723
|
+
});
|
|
1724
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1725
|
+
className: clsx('form-field_type_input', 'form__item_type_input', classNameGroupItem),
|
|
1726
|
+
errorKey: errorKey,
|
|
1727
|
+
errorMessage: errorMessage,
|
|
1728
|
+
isErrorState: isErrorState,
|
|
1729
|
+
metaError: meta.error,
|
|
1730
|
+
isDisabled: isDisabled,
|
|
1731
|
+
fieldClassName: "form-password",
|
|
1732
|
+
inputName: input.name,
|
|
1733
|
+
inputValue: input.value || '',
|
|
1734
|
+
metaActive: meta.active,
|
|
1735
|
+
showMessage: showMessage,
|
|
1736
|
+
isRequired: isRequired,
|
|
1737
|
+
isValidState: isValidState
|
|
1738
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
1739
|
+
dataTestId: `${input.name}FieldInputPassword`,
|
|
1740
|
+
className: clsx(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
|
|
1741
|
+
type: inputType,
|
|
1742
|
+
name: input.name,
|
|
1743
|
+
isDisabled: isDisabled,
|
|
1744
|
+
autoComplete: "nope",
|
|
1745
|
+
value: input.value || '',
|
|
1746
|
+
onBlur: input.onBlur,
|
|
1747
|
+
onChange: onChangeField,
|
|
1748
|
+
onFocus: input.onFocus
|
|
1749
|
+
}, updatedInputProps)), /*#__PURE__*/React.createElement(Icon, {
|
|
1750
|
+
className: "form-field__icon",
|
|
1751
|
+
size: inputProps.iconSize,
|
|
1752
|
+
iconFill: inputProps.iconFill,
|
|
1753
|
+
SvgImage: isRevealed ? inputProps.iconRevealableHide : inputProps.iconRevealableShow,
|
|
1754
|
+
onClick: onClickIconReveal
|
|
1755
|
+
}));
|
|
1756
|
+
});
|
|
1757
|
+
});
|
|
1758
|
+
|
|
1684
1759
|
const defaultSegmentedProps = {
|
|
1685
1760
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
1686
1761
|
width: 'fill',
|
|
@@ -1704,7 +1779,7 @@ function FormFieldSegmented(props) {
|
|
|
1704
1779
|
const setActiveSegment = useCallback(option => {
|
|
1705
1780
|
change(name, option.value);
|
|
1706
1781
|
}, [change]);
|
|
1707
|
-
return /*#__PURE__*/React
|
|
1782
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1708
1783
|
name: name
|
|
1709
1784
|
}, function Render({
|
|
1710
1785
|
input,
|
|
@@ -1742,7 +1817,7 @@ function FormFieldSegmented(props) {
|
|
|
1742
1817
|
inputProps: inputProps,
|
|
1743
1818
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1744
1819
|
});
|
|
1745
|
-
return /*#__PURE__*/React
|
|
1820
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1746
1821
|
className: clsx('form-field_type_segmented', 'form__item_type_segmented'),
|
|
1747
1822
|
errorKey: errorKey,
|
|
1748
1823
|
errorMessage: errorMessage,
|
|
@@ -1756,7 +1831,7 @@ function FormFieldSegmented(props) {
|
|
|
1756
1831
|
showMessage: showMessage,
|
|
1757
1832
|
isRequired: isRequired,
|
|
1758
1833
|
isValidState: isValidState
|
|
1759
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1834
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Segmented, Object.assign({
|
|
1760
1835
|
isDisabled: isDisabled,
|
|
1761
1836
|
activeSegment: activeOption,
|
|
1762
1837
|
segments: options,
|
|
@@ -1787,7 +1862,7 @@ function getDefaultValue(options, selectValue) {
|
|
|
1787
1862
|
});
|
|
1788
1863
|
return result;
|
|
1789
1864
|
}
|
|
1790
|
-
const FormFieldSelect = /*#__PURE__*/React
|
|
1865
|
+
const FormFieldSelect = /*#__PURE__*/React.memo(function FormFieldSelect(props) {
|
|
1791
1866
|
const {
|
|
1792
1867
|
isDisabled,
|
|
1793
1868
|
isRequired,
|
|
@@ -1802,7 +1877,7 @@ const FormFieldSelect = /*#__PURE__*/React$1.memo(function FormFieldSelect(props
|
|
|
1802
1877
|
onChange,
|
|
1803
1878
|
onInputChange
|
|
1804
1879
|
} = props;
|
|
1805
|
-
return /*#__PURE__*/React
|
|
1880
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1806
1881
|
name: name,
|
|
1807
1882
|
initialValue: initialValue
|
|
1808
1883
|
}, function Render({
|
|
@@ -1854,7 +1929,7 @@ const FormFieldSelect = /*#__PURE__*/React$1.memo(function FormFieldSelect(props
|
|
|
1854
1929
|
inputProps: selectProps,
|
|
1855
1930
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1856
1931
|
});
|
|
1857
|
-
return /*#__PURE__*/React
|
|
1932
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1858
1933
|
className: clsx('form-field_type_select', 'form__item_type_select', classNameGroupItem),
|
|
1859
1934
|
errorKey: errorKey,
|
|
1860
1935
|
errorMessage: errorMessage,
|
|
@@ -1868,7 +1943,7 @@ const FormFieldSelect = /*#__PURE__*/React$1.memo(function FormFieldSelect(props
|
|
|
1868
1943
|
showMessage: showMessage,
|
|
1869
1944
|
isRequired: isRequired,
|
|
1870
1945
|
isValidState: isValidState
|
|
1871
|
-
}, fieldProps), /*#__PURE__*/React
|
|
1946
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
1872
1947
|
className: "form-select-item",
|
|
1873
1948
|
ref: selectRef,
|
|
1874
1949
|
isDisabled: isDisabled,
|
|
@@ -1885,7 +1960,7 @@ const defaultSwitchProps = {
|
|
|
1885
1960
|
appearance: 'defaultPrimary sizeL solid rounded'
|
|
1886
1961
|
};
|
|
1887
1962
|
|
|
1888
|
-
const FormFieldSwitch = /*#__PURE__*/React
|
|
1963
|
+
const FormFieldSwitch = /*#__PURE__*/React.memo(function FormFieldSwitch(props) {
|
|
1889
1964
|
const {
|
|
1890
1965
|
name,
|
|
1891
1966
|
isDisabled,
|
|
@@ -1896,7 +1971,7 @@ const FormFieldSwitch = /*#__PURE__*/React$1.memo(function FormFieldSwitch(props
|
|
|
1896
1971
|
isRequired,
|
|
1897
1972
|
onChange
|
|
1898
1973
|
} = props;
|
|
1899
|
-
return /*#__PURE__*/React
|
|
1974
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1900
1975
|
type: "checkbox",
|
|
1901
1976
|
name: name
|
|
1902
1977
|
}, function Render({
|
|
@@ -1930,7 +2005,7 @@ const FormFieldSwitch = /*#__PURE__*/React$1.memo(function FormFieldSwitch(props
|
|
|
1930
2005
|
inputProps: inputProps,
|
|
1931
2006
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1932
2007
|
});
|
|
1933
|
-
return /*#__PURE__*/React
|
|
2008
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1934
2009
|
className: clsx('form-field_type_switch', 'form__item_type_switch', classNameGroupItem),
|
|
1935
2010
|
errorKey: errorKey,
|
|
1936
2011
|
errorMessage: errorMessage,
|
|
@@ -1945,7 +2020,7 @@ const FormFieldSwitch = /*#__PURE__*/React$1.memo(function FormFieldSwitch(props
|
|
|
1945
2020
|
tag: "label",
|
|
1946
2021
|
isRequired: isRequired,
|
|
1947
2022
|
isValidState: isValidState
|
|
1948
|
-
}, fieldProps), /*#__PURE__*/React
|
|
2023
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Switch, Object.assign({
|
|
1949
2024
|
type: "checkbox",
|
|
1950
2025
|
name: input.name,
|
|
1951
2026
|
isDisabled: isDisabled,
|
|
@@ -1964,7 +2039,7 @@ const defaultTextareaProps = {
|
|
|
1964
2039
|
requiredBorderColor: 'warningBorderSecondary'
|
|
1965
2040
|
};
|
|
1966
2041
|
|
|
1967
|
-
const FormFieldTextarea = /*#__PURE__*/React
|
|
2042
|
+
const FormFieldTextarea = /*#__PURE__*/React.memo(function FormFieldTextarea(props) {
|
|
1968
2043
|
const {
|
|
1969
2044
|
name,
|
|
1970
2045
|
isDisabled,
|
|
@@ -1974,7 +2049,7 @@ const FormFieldTextarea = /*#__PURE__*/React$1.memo(function FormFieldTextarea(p
|
|
|
1974
2049
|
showMessage,
|
|
1975
2050
|
isRequired
|
|
1976
2051
|
} = props;
|
|
1977
|
-
return /*#__PURE__*/React
|
|
2052
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
1978
2053
|
name: name
|
|
1979
2054
|
}, function Render({
|
|
1980
2055
|
input,
|
|
@@ -2001,7 +2076,7 @@ const FormFieldTextarea = /*#__PURE__*/React$1.memo(function FormFieldTextarea(p
|
|
|
2001
2076
|
inputProps: inputProps,
|
|
2002
2077
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
2003
2078
|
});
|
|
2004
|
-
return /*#__PURE__*/React
|
|
2079
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
2005
2080
|
className: clsx('form-field_type_textarea', 'form__item_type_textarea', classNameGroupItem),
|
|
2006
2081
|
errorKey: errorKey,
|
|
2007
2082
|
errorMessage: errorMessage,
|
|
@@ -2015,11 +2090,13 @@ const FormFieldTextarea = /*#__PURE__*/React$1.memo(function FormFieldTextarea(p
|
|
|
2015
2090
|
showMessage: showMessage,
|
|
2016
2091
|
isRequired: isRequired,
|
|
2017
2092
|
isValidState: isValidState
|
|
2018
|
-
}, fieldProps), /*#__PURE__*/React
|
|
2093
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Textarea, Object.assign({
|
|
2094
|
+
dataTestId: `${input.name}FieldTextarea`,
|
|
2095
|
+
className: clsx(meta.active && 'textarea_state_focus', meta.error && meta.touched && `textarea_state_${errorKey}`),
|
|
2019
2096
|
name: input.name,
|
|
2020
2097
|
isDisabled: isDisabled,
|
|
2021
2098
|
autoComplete: "nope",
|
|
2022
|
-
value: input.value,
|
|
2099
|
+
value: input.value || '',
|
|
2023
2100
|
onBlur: input.onBlur,
|
|
2024
2101
|
onChange: input.onChange,
|
|
2025
2102
|
onFocus: input.onFocus
|
|
@@ -2027,7 +2104,7 @@ const FormFieldTextarea = /*#__PURE__*/React$1.memo(function FormFieldTextarea(p
|
|
|
2027
2104
|
});
|
|
2028
2105
|
});
|
|
2029
2106
|
|
|
2030
|
-
const FormFieldMaskedInput = /*#__PURE__*/React
|
|
2107
|
+
const FormFieldMaskedInput = /*#__PURE__*/React.memo(function FormFieldMaskedInput(props) {
|
|
2031
2108
|
const {
|
|
2032
2109
|
name,
|
|
2033
2110
|
initialValue,
|
|
@@ -2046,7 +2123,7 @@ const FormFieldMaskedInput = /*#__PURE__*/React$1.memo(function FormFieldMaskedI
|
|
|
2046
2123
|
isRequired,
|
|
2047
2124
|
onClickClearIcon
|
|
2048
2125
|
} = props;
|
|
2049
|
-
return /*#__PURE__*/React
|
|
2126
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
2050
2127
|
name: name,
|
|
2051
2128
|
initialValue: initialValue
|
|
2052
2129
|
}, function Render({
|
|
@@ -2091,7 +2168,7 @@ const FormFieldMaskedInput = /*#__PURE__*/React$1.memo(function FormFieldMaskedI
|
|
|
2091
2168
|
inputProps: inputProps,
|
|
2092
2169
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
2093
2170
|
});
|
|
2094
|
-
return /*#__PURE__*/React
|
|
2171
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
2095
2172
|
className: clsx('form-field_type_maskedInput', 'form__item_type_maskedInput', classNameGroupItem),
|
|
2096
2173
|
errorKey: errorKey,
|
|
2097
2174
|
errorMessage: errorMessage,
|
|
@@ -2105,13 +2182,13 @@ const FormFieldMaskedInput = /*#__PURE__*/React$1.memo(function FormFieldMaskedI
|
|
|
2105
2182
|
showMessage: showMessage,
|
|
2106
2183
|
isRequired: isRequired,
|
|
2107
2184
|
isValidState: isValidState
|
|
2108
|
-
}, fieldProps), /*#__PURE__*/React
|
|
2185
|
+
}, fieldProps), /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
2109
2186
|
className: clsx(meta.active && 'input_state_focus', meta.error && meta.touched && `input_state_${errorKey}`),
|
|
2110
2187
|
ref: ref,
|
|
2111
2188
|
value: value,
|
|
2112
2189
|
onBlur: input.onBlur,
|
|
2113
2190
|
onFocus: input.onFocus
|
|
2114
|
-
}, updatedInputProps)), clearIcon && /*#__PURE__*/React
|
|
2191
|
+
}, updatedInputProps)), clearIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
2115
2192
|
className: "form-field__icon",
|
|
2116
2193
|
size: clearIconSize,
|
|
2117
2194
|
iconFill: clearIconFill,
|
|
@@ -2219,7 +2296,7 @@ function RadioGroupList(props) {
|
|
|
2219
2296
|
setEditableValue(value);
|
|
2220
2297
|
onChangeSomeInput(value);
|
|
2221
2298
|
}, [onChangeSomeInput]);
|
|
2222
|
-
return /*#__PURE__*/React
|
|
2299
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, options.map(option => option.editable ? /*#__PURE__*/React.createElement(RadioGroupInput, {
|
|
2223
2300
|
key: option.label,
|
|
2224
2301
|
editableProps: editableProps,
|
|
2225
2302
|
input: input,
|
|
@@ -2227,7 +2304,7 @@ function RadioGroupList(props) {
|
|
|
2227
2304
|
option: option,
|
|
2228
2305
|
value: editableValue,
|
|
2229
2306
|
onChange: onChangeEditable
|
|
2230
|
-
}) : /*#__PURE__*/React
|
|
2307
|
+
}) : /*#__PURE__*/React.createElement(RadioGroupItem, {
|
|
2231
2308
|
key: option.value,
|
|
2232
2309
|
input: input,
|
|
2233
2310
|
inputProps: inputProps,
|
|
@@ -2236,7 +2313,7 @@ function RadioGroupList(props) {
|
|
|
2236
2313
|
})));
|
|
2237
2314
|
}
|
|
2238
2315
|
|
|
2239
|
-
const RadioGroup = /*#__PURE__*/React
|
|
2316
|
+
const RadioGroup = /*#__PURE__*/React.memo(function RadioGroup(props) {
|
|
2240
2317
|
const {
|
|
2241
2318
|
name,
|
|
2242
2319
|
isDisabled,
|
|
@@ -2249,7 +2326,7 @@ const RadioGroup = /*#__PURE__*/React$1.memo(function RadioGroup(props) {
|
|
|
2249
2326
|
isRequired,
|
|
2250
2327
|
onChange
|
|
2251
2328
|
} = props;
|
|
2252
|
-
return /*#__PURE__*/React
|
|
2329
|
+
return /*#__PURE__*/React.createElement(Field, {
|
|
2253
2330
|
name: name
|
|
2254
2331
|
}, function Render({
|
|
2255
2332
|
input,
|
|
@@ -2276,7 +2353,7 @@ const RadioGroup = /*#__PURE__*/React$1.memo(function RadioGroup(props) {
|
|
|
2276
2353
|
inputProps: inputProps,
|
|
2277
2354
|
validationStateKey: isErrorState ? errorKey : 'success'
|
|
2278
2355
|
});
|
|
2279
|
-
return /*#__PURE__*/React
|
|
2356
|
+
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
2280
2357
|
className: clsx('form-field_type_radio', 'form__item_type_radio"', classNameGroupItem),
|
|
2281
2358
|
errorKey: errorKey,
|
|
2282
2359
|
errorMessage: errorMessage,
|
|
@@ -2290,7 +2367,7 @@ const RadioGroup = /*#__PURE__*/React$1.memo(function RadioGroup(props) {
|
|
|
2290
2367
|
showMessage: showMessage,
|
|
2291
2368
|
isRequired: isRequired,
|
|
2292
2369
|
isValidState: isValidState
|
|
2293
|
-
}, fieldProps), /*#__PURE__*/React
|
|
2370
|
+
}, fieldProps), /*#__PURE__*/React.createElement(RadioGroupList, {
|
|
2294
2371
|
isDisabled: isDisabled,
|
|
2295
2372
|
editableProps: editableProps,
|
|
2296
2373
|
input: input,
|
|
@@ -2323,91 +2400,97 @@ function generateField(field, config, props) {
|
|
|
2323
2400
|
switch (field.type) {
|
|
2324
2401
|
case formTypes.checkbox:
|
|
2325
2402
|
{
|
|
2326
|
-
return /*#__PURE__*/React
|
|
2403
|
+
return /*#__PURE__*/React.createElement(FormFieldCheckbox, Object.assign({
|
|
2327
2404
|
key: config.key
|
|
2328
2405
|
}, field, props));
|
|
2329
2406
|
}
|
|
2330
2407
|
case formTypes.choice:
|
|
2331
2408
|
{
|
|
2332
|
-
return /*#__PURE__*/React
|
|
2409
|
+
return /*#__PURE__*/React.createElement(FormFieldChoice, Object.assign({
|
|
2333
2410
|
key: config.key
|
|
2334
2411
|
}, field, props));
|
|
2335
2412
|
}
|
|
2336
2413
|
case formTypes.chips:
|
|
2337
2414
|
{
|
|
2338
|
-
return /*#__PURE__*/React
|
|
2415
|
+
return /*#__PURE__*/React.createElement(FormFieldChips, Object.assign({
|
|
2339
2416
|
key: config.key
|
|
2340
2417
|
}, field, props));
|
|
2341
2418
|
}
|
|
2342
2419
|
case formTypes.code:
|
|
2343
2420
|
{
|
|
2344
|
-
return /*#__PURE__*/React
|
|
2421
|
+
return /*#__PURE__*/React.createElement(FormFieldCode, Object.assign({
|
|
2345
2422
|
key: config.key
|
|
2346
2423
|
}, field, props));
|
|
2347
2424
|
}
|
|
2348
2425
|
case formTypes.switch:
|
|
2349
2426
|
{
|
|
2350
|
-
return /*#__PURE__*/React
|
|
2427
|
+
return /*#__PURE__*/React.createElement(FormFieldSwitch, Object.assign({
|
|
2351
2428
|
key: config.key
|
|
2352
2429
|
}, field, props));
|
|
2353
2430
|
}
|
|
2354
2431
|
case formTypes.segmented:
|
|
2355
2432
|
{
|
|
2356
|
-
return /*#__PURE__*/React
|
|
2433
|
+
return /*#__PURE__*/React.createElement(FormFieldSegmented, Object.assign({
|
|
2357
2434
|
key: config.key
|
|
2358
2435
|
}, field, props));
|
|
2359
2436
|
}
|
|
2360
2437
|
case formTypes.datePicker:
|
|
2361
2438
|
{
|
|
2362
|
-
return /*#__PURE__*/React
|
|
2439
|
+
return /*#__PURE__*/React.createElement(FormFieldDatePicker, Object.assign({
|
|
2363
2440
|
key: config.key
|
|
2364
2441
|
}, field, props));
|
|
2365
2442
|
}
|
|
2366
2443
|
case formTypes.fileInput:
|
|
2367
2444
|
{
|
|
2368
|
-
return /*#__PURE__*/React
|
|
2445
|
+
return /*#__PURE__*/React.createElement(FileInput, Object.assign({
|
|
2369
2446
|
key: config.key
|
|
2370
2447
|
}, field, props));
|
|
2371
2448
|
}
|
|
2372
2449
|
case formTypes.radioGroup:
|
|
2373
2450
|
{
|
|
2374
|
-
return /*#__PURE__*/React
|
|
2451
|
+
return /*#__PURE__*/React.createElement(RadioGroup, Object.assign({
|
|
2375
2452
|
key: config.key
|
|
2376
2453
|
}, field, props));
|
|
2377
2454
|
}
|
|
2378
2455
|
case formTypes.select:
|
|
2379
2456
|
{
|
|
2380
|
-
return /*#__PURE__*/React
|
|
2457
|
+
return /*#__PURE__*/React.createElement(FormFieldSelect, Object.assign({
|
|
2381
2458
|
key: config.key
|
|
2382
2459
|
}, field, props));
|
|
2383
2460
|
}
|
|
2384
2461
|
case formTypes.text:
|
|
2385
2462
|
{
|
|
2386
|
-
return /*#__PURE__*/React
|
|
2463
|
+
return /*#__PURE__*/React.createElement(FormFieldInput, Object.assign({
|
|
2464
|
+
key: config.key
|
|
2465
|
+
}, field, props));
|
|
2466
|
+
}
|
|
2467
|
+
case formTypes.password:
|
|
2468
|
+
{
|
|
2469
|
+
return /*#__PURE__*/React.createElement(FormFieldPassword, Object.assign({
|
|
2387
2470
|
key: config.key
|
|
2388
2471
|
}, field, props));
|
|
2389
2472
|
}
|
|
2390
2473
|
case formTypes.textarea:
|
|
2391
2474
|
{
|
|
2392
|
-
return /*#__PURE__*/React
|
|
2475
|
+
return /*#__PURE__*/React.createElement(FormFieldTextarea, Object.assign({
|
|
2393
2476
|
key: config.key
|
|
2394
2477
|
}, field, props));
|
|
2395
2478
|
}
|
|
2396
2479
|
case formTypes.maskedInput:
|
|
2397
2480
|
{
|
|
2398
|
-
return /*#__PURE__*/React
|
|
2481
|
+
return /*#__PURE__*/React.createElement(FormFieldMaskedInput, Object.assign({
|
|
2399
2482
|
key: config.key
|
|
2400
2483
|
}, field, props));
|
|
2401
2484
|
}
|
|
2402
2485
|
case formTypes.custom:
|
|
2403
2486
|
{
|
|
2404
|
-
return /*#__PURE__*/React
|
|
2487
|
+
return /*#__PURE__*/React.createElement(FormFieldCustom, Object.assign({
|
|
2405
2488
|
key: config.key
|
|
2406
2489
|
}, field, props));
|
|
2407
2490
|
}
|
|
2408
2491
|
case formTypes.group:
|
|
2409
2492
|
{
|
|
2410
|
-
return /*#__PURE__*/React
|
|
2493
|
+
return /*#__PURE__*/React.createElement(FormBlockGroup, Object.assign({
|
|
2411
2494
|
key: config.key
|
|
2412
2495
|
}, field, props), Object.entries(field.group).map(([key, value]) => {
|
|
2413
2496
|
const groupProps = {
|
|
@@ -2533,7 +2616,7 @@ const sendFormDataToServer = async (url, data) => {
|
|
|
2533
2616
|
}
|
|
2534
2617
|
};
|
|
2535
2618
|
|
|
2536
|
-
const FinalForm = /*#__PURE__*/React
|
|
2619
|
+
const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
2537
2620
|
const {
|
|
2538
2621
|
className,
|
|
2539
2622
|
type,
|
|
@@ -2639,7 +2722,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2639
2722
|
styles: formStyles,
|
|
2640
2723
|
wrapper: wrapperStyles
|
|
2641
2724
|
} = useStyles(props);
|
|
2642
|
-
return /*#__PURE__*/React
|
|
2725
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
2643
2726
|
initialValues: initialValues,
|
|
2644
2727
|
initialValuesEqual: initialValuesEqual,
|
|
2645
2728
|
render: ({
|
|
@@ -2648,7 +2731,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2648
2731
|
handleSubmit,
|
|
2649
2732
|
modifiedSinceLastSubmit
|
|
2650
2733
|
}) => {
|
|
2651
|
-
return /*#__PURE__*/React
|
|
2734
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
2652
2735
|
className: clsx(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass, fillClass, shapeClass, elevationClass),
|
|
2653
2736
|
name: formName,
|
|
2654
2737
|
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
@@ -2662,39 +2745,39 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2662
2745
|
spellCheck: disableFieldsAutoComplete ? 'false' : undefined,
|
|
2663
2746
|
style: formStyles,
|
|
2664
2747
|
onSubmit: handleSubmit
|
|
2665
|
-
}, before, title && /*#__PURE__*/React
|
|
2748
|
+
}, before, title && /*#__PURE__*/React.createElement(Title, {
|
|
2666
2749
|
className: "form__title",
|
|
2667
2750
|
size: titleTextSize,
|
|
2668
2751
|
fill: titleFill,
|
|
2669
2752
|
textColor: titleTextColor,
|
|
2670
2753
|
textWeight: titleTextWeight
|
|
2671
|
-
}, title), desc && /*#__PURE__*/React
|
|
2754
|
+
}, title), desc && /*#__PURE__*/React.createElement(Text, {
|
|
2672
2755
|
className: "form__desc",
|
|
2673
2756
|
size: descSize,
|
|
2674
2757
|
textColor: descTextColor,
|
|
2675
2758
|
textWeight: descTextWeight
|
|
2676
|
-
}, desc), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React
|
|
2759
|
+
}, desc), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React.createElement("div", {
|
|
2677
2760
|
className: clsx('notification', 'form-notification', notificationType ? `form-notification_${notificationType}` : 'form-notification_global')
|
|
2678
|
-
}, /*#__PURE__*/React
|
|
2761
|
+
}, /*#__PURE__*/React.createElement(Notification, {
|
|
2679
2762
|
className: "form-notification__item",
|
|
2680
2763
|
appearance: "errorPrimary",
|
|
2681
2764
|
title: form.getState().submitError,
|
|
2682
2765
|
titleTextSize: "h6",
|
|
2683
2766
|
status: "error",
|
|
2684
2767
|
closeButton: notificationCloseButton
|
|
2685
|
-
})), onChangeFormValues && /*#__PURE__*/React
|
|
2768
|
+
})), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
|
|
2686
2769
|
subscription: {
|
|
2687
2770
|
values: true
|
|
2688
2771
|
},
|
|
2689
2772
|
onChange: onChangeFormValues
|
|
2690
|
-
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React
|
|
2773
|
+
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(React.Fragment, null, renderFieldsWrapper(/*#__PURE__*/React.createElement(Group, {
|
|
2691
2774
|
className: "form__wrapper",
|
|
2692
2775
|
direction: "vertical",
|
|
2693
2776
|
gap: fieldsGap || groupGap,
|
|
2694
2777
|
style: wrapperStyles
|
|
2695
2778
|
}, Object.keys(config).map(key => generateField(config[key], {
|
|
2696
2779
|
key
|
|
2697
|
-
}, additionalProps[config[key].name])), isLoading && (loader || /*#__PURE__*/React
|
|
2780
|
+
}, additionalProps[config[key].name])), isLoading && (loader || /*#__PURE__*/React.createElement(Loader, {
|
|
2698
2781
|
className: "form__loader",
|
|
2699
2782
|
type: loaderType,
|
|
2700
2783
|
appearance: loaderAppearance,
|
|
@@ -2703,7 +2786,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2703
2786
|
text: loaderText,
|
|
2704
2787
|
itemFill: loaderItemFill,
|
|
2705
2788
|
shape: loaderShape
|
|
2706
|
-
}))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React
|
|
2789
|
+
}))))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group, {
|
|
2707
2790
|
className: "form__button",
|
|
2708
2791
|
direction: buttonDirection,
|
|
2709
2792
|
justifyContent: buttonJustifyContent,
|
|
@@ -2712,7 +2795,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2712
2795
|
gap: buttonGap,
|
|
2713
2796
|
dataTestId: dataTestIdButtons,
|
|
2714
2797
|
dataTour: dataTourButtons
|
|
2715
|
-
}, primaryButtonLabel ? /*#__PURE__*/React
|
|
2798
|
+
}, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2716
2799
|
className: "form__button-item",
|
|
2717
2800
|
appearance: primaryButtonAppearance,
|
|
2718
2801
|
width: "fill",
|
|
@@ -2727,7 +2810,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2727
2810
|
dataTestId: dataTestIdPrimaryButton,
|
|
2728
2811
|
dataTour: dataTourPrimaryButton,
|
|
2729
2812
|
loading: primaryButtonIsLoading
|
|
2730
|
-
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React
|
|
2813
|
+
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2731
2814
|
className: "form__button-item",
|
|
2732
2815
|
appearance: secondaryButtonAppearance,
|
|
2733
2816
|
width: "fill",
|
|
@@ -2743,7 +2826,7 @@ const FinalForm = /*#__PURE__*/React$1.forwardRef(function FinalForm(props, ref)
|
|
|
2743
2826
|
dataTour: dataTourSecondaryButton,
|
|
2744
2827
|
loading: secondaryButtonIsLoading,
|
|
2745
2828
|
onClick: onClickSecondaryButton
|
|
2746
|
-
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React
|
|
2829
|
+
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2747
2830
|
className: "form__button-item",
|
|
2748
2831
|
width: "fill",
|
|
2749
2832
|
size: tertiaryButtonSize,
|
|
@@ -2984,4 +3067,4 @@ const getErrorsForFinalForm = error => {
|
|
|
2984
3067
|
return formErrors;
|
|
2985
3068
|
};
|
|
2986
3069
|
|
|
2987
|
-
export { DEFAULT_MESSAGES_FIELDS, FieldWrapper, FieldWrapperBase, FileInput, FinalForm, FormBlockGroup, FormFieldCheckbox, FormFieldChips, FormFieldChoice, FormFieldCode, FormFieldCustom, FormFieldDatePicker, FormFieldInput, FormFieldMaskedInput, FormFieldSegmented, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, RadioGroup, addRequiredFieldsParamToSchema, dateValidation, defaultCheckboxProps, defaultChipsProps, defaultChoiceProps, defaultCodeProps, defaultDatepickerProps, defaultDropzoneProps, defaultFieldProps, defaultFieldSizeM, defaultFieldSizeXL, defaultGroupProps, defaultInputProps, defaultRadioProps, defaultSegmentedProps, defaultSelectProps, defaultSwitchProps, defaultTextareaProps, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, getErrorsForFinalForm, parseNumericField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
|
|
3070
|
+
export { DEFAULT_MESSAGES_FIELDS, FieldWrapper, FieldWrapperBase, FileInput, FinalForm, FormBlockGroup, FormFieldCheckbox, FormFieldChips, FormFieldChoice, FormFieldCode, FormFieldCustom, FormFieldDatePicker, FormFieldInput, FormFieldMaskedInput, FormFieldPassword, FormFieldSegmented, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, RadioGroup, addRequiredFieldsParamToSchema, dateValidation, defaultCheckboxProps, defaultChipsProps, defaultChoiceProps, defaultCodeProps, defaultDatepickerProps, defaultDropzoneProps, defaultFieldProps, defaultFieldSizeM, defaultFieldSizeXL, defaultGroupProps, defaultInputProps, defaultPasswordProps, defaultRadioProps, defaultSegmentedProps, defaultSelectProps, defaultSwitchProps, defaultTextareaProps, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, getErrorsForFinalForm, parseNumericField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
|