@itcase/forms 1.1.5 → 1.1.6
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/Checkbox/Checkbox.css +2 -13
- package/dist/css/form/Field/Code/Code.css +36 -0
- package/dist/css/form/Field/Password/Password.css +9 -0
- package/dist/css/form/Field/RadioGroup/RadioGroup.css +17 -4
- package/dist/css/form/Field/Switch/Switch.css +44 -12
- package/dist/css/form/Form/Form.css +4 -20
- package/dist/css/form/Form/css/__item/form__item.css +2 -0
- package/dist/css/form/FormField/FormField.css +68 -10
- package/dist/itcase-forms.cjs.js +162 -161
- package/dist/itcase-forms.esm.js +162 -161
- package/package.json +13 -6
- package/dist/css/form/Form/css/__item/form__item_state_error.css +0 -6
- package/dist/css/form/Form/css/__item/form__item_state_required.css +0 -6
- package/dist/css/form/Form/css/__item/form__item_state_success.css +0 -6
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -36,7 +36,6 @@ var Button = require('@itcase/ui/components/Button');
|
|
|
36
36
|
var Group$1 = require('@itcase/ui/components/Group');
|
|
37
37
|
var Notification = require('@itcase/ui/components/Notification');
|
|
38
38
|
var createDecorator = require('final-form-focus');
|
|
39
|
-
require('apisauce');
|
|
40
39
|
|
|
41
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
41
|
|
|
@@ -192,18 +191,10 @@ function FieldWrapperBase(props) {
|
|
|
192
191
|
isHidden,
|
|
193
192
|
isRequired,
|
|
194
193
|
isValidState,
|
|
195
|
-
set,
|
|
196
194
|
children
|
|
197
195
|
} = props;
|
|
198
196
|
const formFieldClass = React$1.useMemo(() => clsx__default.default(className, isValidState && 'form__item_state_success', isRequired && 'form__item_state_required', isDisabled && 'form__item_state_disabled', metaActive && 'form__item_state_focus', inputValue && 'form__item_state_filled', isErrorState && `form__item_state_${errorKey}`), [className, isErrorState, isValidState, isRequired, metaActive, inputValue, isDisabled, metaError]);
|
|
199
197
|
const fieldClass = React$1.useMemo(() => clsx__default.default(fieldClassName, isValidState && `${fieldClassName}_state_success`, metaActive && `${fieldClassName}_state_focus`, inputValue && `${fieldClassName}_state_filled`, isDisabled && `${fieldClassName}_state_disabled`, isErrorState && `${fieldClassName}_state_${errorKey}`), [fieldClassName, isErrorState, isValidState, metaActive, inputValue, isDisabled, metaError]);
|
|
200
|
-
const validationAppearance = React$1.useMemo(() => {
|
|
201
|
-
return {
|
|
202
|
-
textColor: props[`${errorKey}MessageTextColor`],
|
|
203
|
-
textSize: props[`${errorKey}MessageTextSize`],
|
|
204
|
-
textWeight: props[`${errorKey}MessageTextWeight`]
|
|
205
|
-
};
|
|
206
|
-
}, [errorKey, isErrorState]);
|
|
207
198
|
const sizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
208
199
|
prefix: 'form-field_size_',
|
|
209
200
|
propsKey: 'size'
|
|
@@ -236,7 +227,7 @@ function FieldWrapperBase(props) {
|
|
|
236
227
|
styles: formFieldStyles
|
|
237
228
|
} = useStyles.useStyles(props);
|
|
238
229
|
return /*#__PURE__*/React__default.default.createElement(Tag, {
|
|
239
|
-
className: clsx__default.default(formFieldClass, 'form__item', 'form-field', type && `form-field_type_${type}`,
|
|
230
|
+
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),
|
|
240
231
|
"data-test-id": `${inputName}Field`,
|
|
241
232
|
"data-tour": dataTour,
|
|
242
233
|
style: formFieldStyles
|
|
@@ -568,8 +559,8 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
|
|
|
568
559
|
meta: meta
|
|
569
560
|
});
|
|
570
561
|
const updatedInputProps = useValidationAppearanceInputProps({
|
|
571
|
-
|
|
572
|
-
|
|
562
|
+
inputProps: inputProps,
|
|
563
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
573
564
|
});
|
|
574
565
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
575
566
|
className: clsx__default.default('form-field_type_choice', 'form__item_type_choice', classNameGroupItem),
|
|
@@ -707,35 +698,28 @@ const CodeField = /*#__PURE__*/React__default.default.memo(function CodeField(pr
|
|
|
707
698
|
const {
|
|
708
699
|
isErrorState,
|
|
709
700
|
isValidState,
|
|
710
|
-
errorKey
|
|
711
|
-
errorMessage
|
|
712
|
-
} = useFieldValidationState({
|
|
701
|
+
errorKey} = useFieldValidationState({
|
|
713
702
|
fieldProps: fieldProps,
|
|
714
703
|
input: input,
|
|
715
704
|
meta: meta
|
|
716
705
|
});
|
|
717
706
|
const updatedInputProps = useValidationAppearanceInputProps({
|
|
718
|
-
|
|
719
|
-
|
|
707
|
+
inputProps: inputProps,
|
|
708
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
720
709
|
});
|
|
721
710
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
722
711
|
className: clsx__default.default('form-field_type_code', 'form__item_type_code', classNameGroupItem),
|
|
723
712
|
fieldClassName: 'form-code',
|
|
724
713
|
inputName: input.name,
|
|
725
714
|
inputValue: input.value,
|
|
726
|
-
isRequired: isRequired,
|
|
727
|
-
isDisabled: isDisabled,
|
|
728
715
|
metaActive: meta.active,
|
|
729
|
-
metaError: meta.error,
|
|
730
716
|
showMessage: showMessage,
|
|
731
|
-
|
|
732
|
-
isValidState: isValidState
|
|
733
|
-
errorKey: errorKey,
|
|
734
|
-
errorMessage: errorMessage
|
|
717
|
+
isRequired: isRequired,
|
|
718
|
+
isValidState: isValidState
|
|
735
719
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Code.Code, Object.assign({
|
|
736
|
-
autoComplete: "nope",
|
|
737
720
|
name: input.name,
|
|
738
721
|
isDisabled: isDisabled,
|
|
722
|
+
autoComplete: "nope",
|
|
739
723
|
value: input.value,
|
|
740
724
|
onBlur: input.onBlur,
|
|
741
725
|
onChange: input.onChange,
|
|
@@ -744,22 +728,61 @@ const CodeField = /*#__PURE__*/React__default.default.memo(function CodeField(pr
|
|
|
744
728
|
});
|
|
745
729
|
});
|
|
746
730
|
|
|
731
|
+
// import { icon14 } from '@itcase/icons/default' // , icon16, icon24
|
|
732
|
+
|
|
747
733
|
const defaultDatepickerProps = {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
734
|
+
datePickerProps: {
|
|
735
|
+
dateFormat: 'dd/MM/yyyy - HH:mm',
|
|
736
|
+
daySize: 'xs',
|
|
737
|
+
dayTextColor: 'surfaceTextPrimary',
|
|
738
|
+
dayTextShape: 'rounded',
|
|
739
|
+
dayTextSize: 'm',
|
|
740
|
+
disablePastDays: true,
|
|
741
|
+
iconFillSize: 24,
|
|
742
|
+
iconItemFill: 'surfaceItemPrimary',
|
|
743
|
+
// iconLeft: icon14.ChevronLeft,
|
|
744
|
+
// iconRight: icon14.ChevronRight,
|
|
745
|
+
iconSize: 14,
|
|
746
|
+
monthsShown: 2,
|
|
747
|
+
monthTextColor: 'surfaceTextPrimary',
|
|
748
|
+
monthTextSize: 'm',
|
|
749
|
+
monthTextWeight: 400,
|
|
750
|
+
placeholderTextColor: 'surfaceTextSecondary',
|
|
751
|
+
readOnly: false,
|
|
752
|
+
selectsRange: false,
|
|
753
|
+
showTimeSelect: true,
|
|
754
|
+
timeCaption: 'Время',
|
|
755
|
+
timeFormat: 'p',
|
|
756
|
+
timeIntervals: 60,
|
|
757
|
+
yearTextColor: 'surfaceTextPrimary',
|
|
758
|
+
yearTextSize: 'm',
|
|
759
|
+
yearTextWeight: 400,
|
|
760
|
+
isClearable: true,
|
|
761
|
+
isStartDefaultNull: true
|
|
762
|
+
},
|
|
763
|
+
fieldProps: {
|
|
764
|
+
width: 'fill',
|
|
765
|
+
size: 'xl',
|
|
766
|
+
labelTextColor: 'surfaceTextPrimary',
|
|
767
|
+
labelTextSize: 's',
|
|
768
|
+
labelTextWeight: 'normal',
|
|
769
|
+
textColor: 'surfaceTextPrimary',
|
|
770
|
+
helpText: 'Supporting text',
|
|
771
|
+
helpTextColor: 'surfaceTextPrimary',
|
|
772
|
+
helpTextSize: 's',
|
|
773
|
+
helpTextWeight: 'normal',
|
|
774
|
+
showMessage: true
|
|
775
|
+
},
|
|
776
|
+
inputProps: {
|
|
777
|
+
size: 'm',
|
|
778
|
+
borderColor: 'surfaceBorderSecondary',
|
|
779
|
+
textColor: 'surfaceTextPrimary',
|
|
780
|
+
textSize: 'm',
|
|
781
|
+
textWeight: 'normal',
|
|
782
|
+
caret: 'accentItemSecondary',
|
|
783
|
+
placeholder: 'Placeholder',
|
|
784
|
+
placeholderTextColor: 'surfaceTextQuaternary'
|
|
785
|
+
}
|
|
763
786
|
};
|
|
764
787
|
|
|
765
788
|
function DatePickerField(props) {
|
|
@@ -821,23 +844,23 @@ function DatePickerField(props) {
|
|
|
821
844
|
className: clsx__default.default('form-field_type_datepicker', 'form__item_type_datepicker', classNameGroupItem),
|
|
822
845
|
errorKey: errorKey,
|
|
823
846
|
errorMessage: errorMessage,
|
|
847
|
+
isErrorState: isErrorState,
|
|
848
|
+
metaError: meta.error,
|
|
849
|
+
isDisabled: isDisabled,
|
|
824
850
|
fieldClassName: "form-datepicker",
|
|
825
851
|
inputName: input.name,
|
|
826
852
|
inputValue: input.value || '',
|
|
827
|
-
isDisabled: isDisabled,
|
|
828
|
-
isErrorState: isErrorState,
|
|
829
|
-
isRequired: isRequired,
|
|
830
|
-
isValidState: isValidState,
|
|
831
853
|
metaActive: meta.active,
|
|
832
|
-
|
|
833
|
-
|
|
854
|
+
showMessage: showMessage,
|
|
855
|
+
isRequired: isRequired,
|
|
856
|
+
isValidState: isValidState
|
|
834
857
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(DatePicker.DatePickerInput, {
|
|
858
|
+
name: input.name,
|
|
859
|
+
isDisabled: isDisabled,
|
|
835
860
|
datePickerProps: datePickerProps,
|
|
861
|
+
endValue: datePickerProps.selectsRange ? input.value.endDate : null,
|
|
836
862
|
inputProps: updatedInputProps,
|
|
837
|
-
isDisabled: isDisabled,
|
|
838
|
-
name: input.name,
|
|
839
863
|
value: datePickerProps.selectsRange ? input.value.startDate : input.value,
|
|
840
|
-
endValue: datePickerProps.selectsRange ? input.value.endDate : null,
|
|
841
864
|
onBlur: input.onBlur,
|
|
842
865
|
onChange: onChangeField,
|
|
843
866
|
onFocus: input.onFocus
|
|
@@ -846,26 +869,38 @@ function DatePickerField(props) {
|
|
|
846
869
|
}
|
|
847
870
|
|
|
848
871
|
const defaultDropzoneProps = {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
872
|
+
dropzoneProps: {
|
|
873
|
+
size: 'normal',
|
|
874
|
+
fill: 'surfacePrimary',
|
|
875
|
+
borderColor: 'surfaceBorderTertiary',
|
|
876
|
+
borderColorHover: 'surfaceBorderQuaternary',
|
|
877
|
+
hintTitle: 'Перетащите изображение или выберите файл с компьютера',
|
|
878
|
+
hintTitleTextColor: 'surfaceTextPrimary',
|
|
879
|
+
hintTitleTextSize: 'm',
|
|
880
|
+
removeThumbText: 'удалить',
|
|
881
|
+
removeThumbTextColor: 'errorTextPrimary',
|
|
882
|
+
removeThumbTextHoverColor: 'errorTextPrimaryHover',
|
|
883
|
+
removeThumbTextSize: 's',
|
|
884
|
+
shape: 'rounded',
|
|
885
|
+
showFilename: true,
|
|
886
|
+
thumbBorderColor: 'surfaceBorderTertiary',
|
|
887
|
+
thumbBorderColorHover: 'surfaceBorderQuaternary',
|
|
888
|
+
thumbBorderWidth: 1,
|
|
889
|
+
thumbNameTextColor: 'surfaceTextPrimary',
|
|
890
|
+
thumbNameTextSize: 's',
|
|
891
|
+
isPreviews: true
|
|
892
|
+
},
|
|
893
|
+
fieldProps: {
|
|
894
|
+
size: 'l',
|
|
895
|
+
labelTextColor: 'surfaceTextPrimary',
|
|
896
|
+
labelTextSize: 's',
|
|
897
|
+
labelTextWeight: 'normal',
|
|
898
|
+
helpText: 'Supporting text',
|
|
899
|
+
helpTextColor: 'surfaceTextPrimary',
|
|
900
|
+
helpTextSize: 's',
|
|
901
|
+
helpTextWeight: 'normal',
|
|
902
|
+
showMessage: true
|
|
903
|
+
}
|
|
869
904
|
};
|
|
870
905
|
|
|
871
906
|
/* globals File, FileReader, URL, console */
|
|
@@ -1753,11 +1788,11 @@ const RadioGroup = /*#__PURE__*/React__default.default.memo(function RadioGroup(
|
|
|
1753
1788
|
meta: meta
|
|
1754
1789
|
});
|
|
1755
1790
|
const updatedInputProps = useValidationAppearanceInputProps({
|
|
1756
|
-
|
|
1757
|
-
|
|
1791
|
+
inputProps: inputProps,
|
|
1792
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1758
1793
|
});
|
|
1759
1794
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
1760
|
-
className:
|
|
1795
|
+
className: clsx__default.default('form-field_type_radio', 'form__item_type_radio"', classNameGroupItem),
|
|
1761
1796
|
errorKey: errorKey,
|
|
1762
1797
|
errorMessage: errorMessage,
|
|
1763
1798
|
isErrorState: isErrorState,
|
|
@@ -1791,13 +1826,13 @@ const defaultSegmentedProps = {
|
|
|
1791
1826
|
|
|
1792
1827
|
function SegmentedField(props) {
|
|
1793
1828
|
const {
|
|
1794
|
-
options,
|
|
1795
|
-
isRequired,
|
|
1796
1829
|
name,
|
|
1830
|
+
isDisabled,
|
|
1797
1831
|
fieldProps,
|
|
1798
1832
|
inputProps,
|
|
1799
|
-
|
|
1800
|
-
showMessage
|
|
1833
|
+
options,
|
|
1834
|
+
showMessage,
|
|
1835
|
+
isRequired
|
|
1801
1836
|
} = props;
|
|
1802
1837
|
const {
|
|
1803
1838
|
change
|
|
@@ -1820,8 +1855,8 @@ function SegmentedField(props) {
|
|
|
1820
1855
|
|
|
1821
1856
|
const activeOption = React$1.useMemo(() => {
|
|
1822
1857
|
const emptyOption = {
|
|
1823
|
-
|
|
1824
|
-
|
|
1858
|
+
label: null,
|
|
1859
|
+
value: null
|
|
1825
1860
|
};
|
|
1826
1861
|
if (input.value) {
|
|
1827
1862
|
const currentOption = options.find(option => option.value === input.value);
|
|
@@ -1830,36 +1865,36 @@ function SegmentedField(props) {
|
|
|
1830
1865
|
return emptyOption;
|
|
1831
1866
|
}, [input.value]);
|
|
1832
1867
|
const {
|
|
1833
|
-
isErrorState,
|
|
1834
|
-
isValidState,
|
|
1835
1868
|
errorKey,
|
|
1836
|
-
errorMessage
|
|
1869
|
+
errorMessage,
|
|
1870
|
+
isErrorState,
|
|
1871
|
+
isValidState
|
|
1837
1872
|
} = useFieldValidationState({
|
|
1838
1873
|
fieldProps: fieldProps,
|
|
1839
1874
|
input: input,
|
|
1840
1875
|
meta: meta
|
|
1841
1876
|
});
|
|
1842
1877
|
const updatedInputProps = useValidationAppearanceInputProps({
|
|
1843
|
-
|
|
1844
|
-
|
|
1878
|
+
inputProps: inputProps,
|
|
1879
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
1845
1880
|
});
|
|
1846
1881
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
1847
1882
|
className: clsx__default.default('form-field_type_segmented', 'form__item_type_segmented'),
|
|
1848
1883
|
errorKey: errorKey,
|
|
1849
1884
|
errorMessage: errorMessage,
|
|
1885
|
+
isErrorState: isErrorState,
|
|
1886
|
+
metaError: meta.error,
|
|
1887
|
+
isDisabled: isDisabled,
|
|
1850
1888
|
fieldClassName: "form-segmented",
|
|
1851
1889
|
inputName: input.name,
|
|
1852
1890
|
inputValue: input.value || [],
|
|
1853
|
-
isDisabled: isDisabled,
|
|
1854
|
-
isErrorState: isErrorState,
|
|
1855
|
-
isRequired: isRequired,
|
|
1856
|
-
isValidState: isValidState,
|
|
1857
1891
|
metaActive: meta.active,
|
|
1858
|
-
|
|
1859
|
-
|
|
1892
|
+
showMessage: showMessage,
|
|
1893
|
+
isRequired: isRequired,
|
|
1894
|
+
isValidState: isValidState
|
|
1860
1895
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Segmented.Segmented, Object.assign({
|
|
1861
|
-
activeSegment: activeOption,
|
|
1862
1896
|
isDisabled: isDisabled,
|
|
1897
|
+
activeSegment: activeOption,
|
|
1863
1898
|
segments: options,
|
|
1864
1899
|
setActiveSegment: setActiveSegment
|
|
1865
1900
|
}, updatedInputProps)));
|
|
@@ -1886,16 +1921,6 @@ const defaultSelectProps = {
|
|
|
1886
1921
|
// error
|
|
1887
1922
|
errorInputBorderColor: 'errorBorderPrimary',
|
|
1888
1923
|
headingFill: 'surfaceSecondary',
|
|
1889
|
-
headingTextColor: 'surfaceTextPrimary',
|
|
1890
|
-
headingTextSize: 'm',
|
|
1891
|
-
headingTextWeight: '600',
|
|
1892
|
-
inputBorderColor: 'surfaceBorderTertiary',
|
|
1893
|
-
inputBorderColorHover: 'surfaceBorderQuaternary',
|
|
1894
|
-
inputCaretColor: 'secondaryItemPrimary',
|
|
1895
|
-
inputFill: 'surfacePrimary',
|
|
1896
|
-
inputShape: 'rounded',
|
|
1897
|
-
inputTextColor: 'surfaceTextPrimary',
|
|
1898
|
-
inputTextSize: 'm',
|
|
1899
1924
|
loadingMessage: /*#__PURE__*/React__default.default.createElement(Loader.Loader, {
|
|
1900
1925
|
width: "fill",
|
|
1901
1926
|
height: "fill",
|
|
@@ -1906,33 +1931,7 @@ const defaultSelectProps = {
|
|
|
1906
1931
|
zIndex: "1",
|
|
1907
1932
|
itemFill: "surfaceItemAccent",
|
|
1908
1933
|
set: "simple"
|
|
1909
|
-
})
|
|
1910
|
-
multipleItemFill: 'accentPrimary',
|
|
1911
|
-
multipleItemFillHover: 'accentPrimaryHover',
|
|
1912
|
-
// multipleItemIcon: icon14.Remove,
|
|
1913
|
-
|
|
1914
|
-
multipleItemIconFill: 'accentItemPrimary',
|
|
1915
|
-
multipleItemTextColor: 'accentTextPrimary',
|
|
1916
|
-
multipleItemTextSize: 'm',
|
|
1917
|
-
noOptionsSearchText: 'Ничего не найдено...',
|
|
1918
|
-
noOptionsText: 'Список пуст',
|
|
1919
|
-
noOptionsTextColor: 'surfaceTextPrimary',
|
|
1920
|
-
noOptionsTextSize: 'm',
|
|
1921
|
-
optionBorder: 'none',
|
|
1922
|
-
optionFill: 'surfacePrimary',
|
|
1923
|
-
optionFillHover: 'surfaceHover',
|
|
1924
|
-
optionShape: 'rounded',
|
|
1925
|
-
optionTextColor: 'surfaceTextPrimary',
|
|
1926
|
-
optionTextSize: 'm',
|
|
1927
|
-
placeholder: 'Выбрать...',
|
|
1928
|
-
placeholderTextColor: 'surfaceTextQuaternary',
|
|
1929
|
-
placeholderTextSize: 'm',
|
|
1930
|
-
// appearance depending on the type of error
|
|
1931
|
-
// required
|
|
1932
|
-
requiredInputBorderColor: 'warningBorderPrimary',
|
|
1933
|
-
showBadge: false,
|
|
1934
|
-
showDivider: true,
|
|
1935
|
-
size: 'm'
|
|
1934
|
+
})
|
|
1936
1935
|
};
|
|
1937
1936
|
|
|
1938
1937
|
function getDefaultValue(options, selectValue) {
|
|
@@ -2049,18 +2048,18 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
|
|
|
2049
2048
|
|
|
2050
2049
|
const SwitchField = /*#__PURE__*/React__default.default.memo(function SwitchField(props) {
|
|
2051
2050
|
const {
|
|
2051
|
+
isDisabled,
|
|
2052
2052
|
classNameGroupItem,
|
|
2053
2053
|
fieldProps = {},
|
|
2054
2054
|
inputProps = {},
|
|
2055
|
-
isDisabled,
|
|
2056
|
-
isRequired,
|
|
2057
2055
|
name,
|
|
2058
2056
|
showMessage,
|
|
2057
|
+
isRequired,
|
|
2059
2058
|
onChange
|
|
2060
2059
|
} = props;
|
|
2061
2060
|
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
2062
|
-
|
|
2063
|
-
|
|
2061
|
+
type: "checkbox",
|
|
2062
|
+
name: name
|
|
2064
2063
|
}, function Render({
|
|
2065
2064
|
input,
|
|
2066
2065
|
meta
|
|
@@ -2079,40 +2078,40 @@ const SwitchField = /*#__PURE__*/React__default.default.memo(function SwitchFiel
|
|
|
2079
2078
|
}
|
|
2080
2079
|
}, [onChange, input.onChange]);
|
|
2081
2080
|
const {
|
|
2082
|
-
isErrorState,
|
|
2083
|
-
isValidState,
|
|
2084
2081
|
errorKey,
|
|
2085
|
-
errorMessage
|
|
2082
|
+
errorMessage,
|
|
2083
|
+
isErrorState,
|
|
2084
|
+
isValidState
|
|
2086
2085
|
} = useFieldValidationState({
|
|
2087
2086
|
fieldProps: fieldProps,
|
|
2088
2087
|
input: input,
|
|
2089
2088
|
meta: meta
|
|
2090
2089
|
});
|
|
2091
2090
|
const updatedInputProps = useValidationAppearanceInputProps({
|
|
2092
|
-
|
|
2093
|
-
|
|
2091
|
+
inputProps: inputProps,
|
|
2092
|
+
validationStateKey: isErrorState ? errorKey : 'success'
|
|
2094
2093
|
});
|
|
2095
2094
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
2096
2095
|
className: clsx__default.default('form-field_type_switch', 'form__item_type_switch', classNameGroupItem),
|
|
2097
2096
|
errorKey: errorKey,
|
|
2098
2097
|
errorMessage: errorMessage,
|
|
2098
|
+
isErrorState: isErrorState,
|
|
2099
|
+
metaError: meta.error,
|
|
2100
|
+
isDisabled: isDisabled,
|
|
2099
2101
|
fieldClassName: "form-switch",
|
|
2100
2102
|
inputName: input.name,
|
|
2101
2103
|
inputValue: input.checked,
|
|
2102
|
-
isDisabled: isDisabled,
|
|
2103
|
-
isErrorState: isErrorState,
|
|
2104
|
-
isRequired: isRequired,
|
|
2105
|
-
isValidState: isValidState,
|
|
2106
2104
|
metaActive: meta.active,
|
|
2107
|
-
metaError: meta.error,
|
|
2108
2105
|
showMessage: showMessage,
|
|
2109
|
-
tag: "label"
|
|
2106
|
+
tag: "label",
|
|
2107
|
+
isRequired: isRequired,
|
|
2108
|
+
isValidState: isValidState
|
|
2110
2109
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Switch.Switch, Object.assign({
|
|
2110
|
+
type: "checkbox",
|
|
2111
|
+
name: input.name,
|
|
2112
|
+
isDisabled: isDisabled,
|
|
2111
2113
|
autoComplete: "nope",
|
|
2112
2114
|
checked: input.checked,
|
|
2113
|
-
isDisabled: isDisabled,
|
|
2114
|
-
name: input.name,
|
|
2115
|
-
type: "checkbox",
|
|
2116
2115
|
onBlur: input.onBlur,
|
|
2117
2116
|
onChange: onChangeField,
|
|
2118
2117
|
onFocus: input.onFocus
|
|
@@ -2288,6 +2287,8 @@ const MaskedInputField = /*#__PURE__*/React__default.default.memo(function Maske
|
|
|
2288
2287
|
});
|
|
2289
2288
|
});
|
|
2290
2289
|
|
|
2290
|
+
// import { icon14 } from '@itcase/icons/default'
|
|
2291
|
+
|
|
2291
2292
|
const defaultChipsProps = {
|
|
2292
2293
|
width: 'fill',
|
|
2293
2294
|
borderColor: 'surfaceBorderTertiary',
|
|
@@ -2302,7 +2303,7 @@ const defaultChipsProps = {
|
|
|
2302
2303
|
iconSize: 14,
|
|
2303
2304
|
indicatorFill: 'accentPrimary',
|
|
2304
2305
|
// labelSize: 's',
|
|
2305
|
-
// labelTextActiveColor: 'accentTextPrimary'
|
|
2306
|
+
// labelTextActiveColor: 'accentTextPrimary',зsrc/form/Field/Chips/index.js
|
|
2306
2307
|
// labelTextActiveColorDisabled: 'surfaceTextDisabled',
|
|
2307
2308
|
// labelTextColor: 'surfaceTextPrimary',
|
|
2308
2309
|
// labelTextColorDisabled: 'surfaceTextDisabled',
|
|
@@ -2316,12 +2317,12 @@ function ChipsField(props) {
|
|
|
2316
2317
|
const {
|
|
2317
2318
|
name,
|
|
2318
2319
|
initialValue,
|
|
2320
|
+
isDisabled,
|
|
2319
2321
|
classNameGroupItem,
|
|
2320
2322
|
fieldProps,
|
|
2321
2323
|
inputProps,
|
|
2322
2324
|
options,
|
|
2323
2325
|
showMessage,
|
|
2324
|
-
isDisabled,
|
|
2325
2326
|
isRequired,
|
|
2326
2327
|
onChange
|
|
2327
2328
|
} = props;
|
|
@@ -2376,23 +2377,23 @@ function ChipsField(props) {
|
|
|
2376
2377
|
className: clsx__default.default('form-field_type_chips', 'form__item_type_chips', classNameGroupItem),
|
|
2377
2378
|
errorKey: errorKey,
|
|
2378
2379
|
errorMessage: errorMessage,
|
|
2380
|
+
isErrorState: isErrorState,
|
|
2379
2381
|
metaError: meta.error,
|
|
2382
|
+
isDisabled: isDisabled,
|
|
2380
2383
|
fieldClassName: "form-chips",
|
|
2381
2384
|
inputName: input.name,
|
|
2382
2385
|
inputValue: input.value,
|
|
2383
2386
|
metaActive: meta.active,
|
|
2384
2387
|
showMessage: showMessage,
|
|
2385
|
-
isDisabled: isDisabled,
|
|
2386
|
-
isErrorState: isErrorState,
|
|
2387
2388
|
isRequired: isRequired,
|
|
2388
2389
|
isValidState: isValidState
|
|
2389
2390
|
}, fieldProps), options.map(option => /*#__PURE__*/React__default.default.createElement(Chips.Chips, Object.assign({
|
|
2390
2391
|
className: clsx__default.default(meta.active && 'form-chips_state_focus', meta.error && meta.touched && `form-chips_state_${errorKey}`),
|
|
2391
2392
|
key: option.value,
|
|
2392
2393
|
label: option.label,
|
|
2394
|
+
isDisabled: option.isDisabled,
|
|
2393
2395
|
value: option.value,
|
|
2394
2396
|
isActive: activeOptionsList.some(activeOption => activeOption.value === option.value),
|
|
2395
|
-
isDisabled: option.isDisabled,
|
|
2396
2397
|
onClick: () => onChangeSomeInput(input.value, option.value)
|
|
2397
2398
|
}, updatedInputProps))));
|
|
2398
2399
|
});
|
|
@@ -2641,10 +2642,10 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2641
2642
|
titleTextColor,
|
|
2642
2643
|
titleTextSize,
|
|
2643
2644
|
titleTextWeight,
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2645
|
+
desc,
|
|
2646
|
+
descSize,
|
|
2647
|
+
descTextColor,
|
|
2648
|
+
descTextWeight,
|
|
2648
2649
|
primaryButton,
|
|
2649
2650
|
primaryButtonFill,
|
|
2650
2651
|
primaryButtonFillHover,
|
|
@@ -2748,7 +2749,7 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2748
2749
|
modifiedSinceLastSubmit
|
|
2749
2750
|
}) => {
|
|
2750
2751
|
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2751
|
-
className: clsx__default.default(className, 'form',
|
|
2752
|
+
className: clsx__default.default(className, 'form', type && `form_type_${type}`, buttonPosition && `form_button-position_${buttonPosition}`, directionClass, fillClass, shapeClass, elevationClass),
|
|
2752
2753
|
name: formName,
|
|
2753
2754
|
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2754
2755
|
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
@@ -2766,12 +2767,12 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2766
2767
|
size: titleTextSize,
|
|
2767
2768
|
textColor: titleTextColor,
|
|
2768
2769
|
textWeight: titleTextWeight
|
|
2769
|
-
}, title),
|
|
2770
|
-
className: "
|
|
2771
|
-
size:
|
|
2772
|
-
textColor:
|
|
2773
|
-
textWeight:
|
|
2774
|
-
},
|
|
2770
|
+
}, title), desc && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2771
|
+
className: "form__desc",
|
|
2772
|
+
size: descSize,
|
|
2773
|
+
textColor: descTextColor,
|
|
2774
|
+
textWeight: descTextWeight
|
|
2775
|
+
}, desc), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React__default.default.createElement("div", {
|
|
2775
2776
|
className: clsx__default.default('notification', 'form-notification', notificationType ? `form-notification_type_${notificationType}` : 'form-notification_type_global')
|
|
2776
2777
|
}, /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
|
|
2777
2778
|
className: "form-notification__item",
|