@itcase/forms 1.0.49 → 1.0.51
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
|
@@ -114,30 +114,33 @@ function FieldWrapperBase(props) {
|
|
|
114
114
|
beforeItem,
|
|
115
115
|
children,
|
|
116
116
|
className,
|
|
117
|
+
dataTour,
|
|
117
118
|
desc,
|
|
118
|
-
descTextSize,
|
|
119
119
|
descTextColor,
|
|
120
|
+
descTextSize,
|
|
120
121
|
descTextWidth,
|
|
121
|
-
divider,
|
|
122
122
|
dividerDirection,
|
|
123
123
|
dividerFill,
|
|
124
124
|
dividerSize,
|
|
125
125
|
dividerWidth,
|
|
126
|
+
errorMessageTextColor,
|
|
127
|
+
errorMessageTextSize,
|
|
128
|
+
errorMessageTextWeight,
|
|
126
129
|
fieldClassName,
|
|
127
130
|
id,
|
|
128
131
|
inputName,
|
|
129
132
|
inputValue,
|
|
133
|
+
isDisabled,
|
|
134
|
+
isHidden,
|
|
130
135
|
isRequired,
|
|
131
136
|
label,
|
|
132
|
-
|
|
137
|
+
labelHidden,
|
|
133
138
|
labelTextColor,
|
|
139
|
+
labelTextSize,
|
|
134
140
|
labelTextWidth,
|
|
135
|
-
errorMessageTextSize,
|
|
136
|
-
errorMessageTextWeight,
|
|
137
|
-
errorMessageTextColor,
|
|
138
141
|
message,
|
|
139
|
-
messageTextSize,
|
|
140
142
|
messageTextColor,
|
|
143
|
+
messageTextSize,
|
|
141
144
|
messageTextWeight,
|
|
142
145
|
metaActive,
|
|
143
146
|
metaError,
|
|
@@ -147,14 +150,11 @@ function FieldWrapperBase(props) {
|
|
|
147
150
|
metaTouched,
|
|
148
151
|
metaValid,
|
|
149
152
|
set,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
isDisabled,
|
|
154
|
-
isHidden,
|
|
153
|
+
showDivider,
|
|
154
|
+
showErrorsOnSubmit,
|
|
155
|
+
showMessage,
|
|
155
156
|
tag: Tag,
|
|
156
|
-
|
|
157
|
-
showErrorsOnSubmit
|
|
157
|
+
type
|
|
158
158
|
} = props;
|
|
159
159
|
const error = metaError || !metaModifiedSinceLastSubmit && metaSubmitError || false;
|
|
160
160
|
const showError = useMemo(() => {
|
|
@@ -223,13 +223,13 @@ function FieldWrapperBase(props) {
|
|
|
223
223
|
className: clsx('form-field__content', inputFillClass, inputShapeClass)
|
|
224
224
|
}, /*#__PURE__*/React.createElement("div", {
|
|
225
225
|
className: clsx('form-field__content-inner', fieldClass)
|
|
226
|
-
}, beforeItem, children, afterItem),
|
|
226
|
+
}, beforeItem, children, afterItem), showDivider && /*#__PURE__*/React.createElement(Divider, {
|
|
227
227
|
className: "form-field__item-divider",
|
|
228
228
|
width: dividerWidth,
|
|
229
229
|
direction: dividerDirection,
|
|
230
230
|
size: dividerSize,
|
|
231
231
|
fill: dividerFill
|
|
232
|
-
})),
|
|
232
|
+
})), showMessage && /*#__PURE__*/React.createElement("div", {
|
|
233
233
|
className: "form-field__message"
|
|
234
234
|
}, Boolean(showError) && error && typeof error === 'string' && /*#__PURE__*/React.createElement(Text, {
|
|
235
235
|
className: "form-field__message-item form-field__message-item_type-error",
|
|
@@ -248,10 +248,10 @@ function FieldWrapperBase(props) {
|
|
|
248
248
|
}, '\u00A0')), after);
|
|
249
249
|
}
|
|
250
250
|
FieldWrapperBase.defaultProps = {
|
|
251
|
-
|
|
252
|
-
type: 'normal',
|
|
251
|
+
errorMessageTextColor: 'errorTextSecondary',
|
|
253
252
|
errorMessageTextSize: 's',
|
|
254
|
-
|
|
253
|
+
tag: 'div',
|
|
254
|
+
type: 'normal'
|
|
255
255
|
};
|
|
256
256
|
FieldWrapperBase.propTypes = {
|
|
257
257
|
after: PropTypes.any,
|
|
@@ -261,14 +261,19 @@ FieldWrapperBase.propTypes = {
|
|
|
261
261
|
beforeItem: PropTypes.any,
|
|
262
262
|
children: PropTypes.any,
|
|
263
263
|
className: PropTypes.string,
|
|
264
|
+
dataTour: PropTypes.string,
|
|
264
265
|
desc: PropTypes.string,
|
|
265
|
-
descTextSize: PropTypes.string,
|
|
266
266
|
descTextColor: PropTypes.string,
|
|
267
|
+
descTextSize: PropTypes.string,
|
|
267
268
|
descTextWidth: PropTypes.string,
|
|
268
269
|
dividerDirection: PropTypes.string,
|
|
269
270
|
dividerFill: PropTypes.string,
|
|
270
271
|
dividerSize: PropTypes.string,
|
|
271
272
|
dividerWidth: PropTypes.string,
|
|
273
|
+
errorMessageTextColor: PropTypes.string,
|
|
274
|
+
errorMessageTextSize: PropTypes.string,
|
|
275
|
+
errorMessageTextWeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
276
|
+
errorMessageTextWidth: PropTypes.string,
|
|
272
277
|
fieldClassName: PropTypes.string,
|
|
273
278
|
id: PropTypes.string,
|
|
274
279
|
inputName: PropTypes.string,
|
|
@@ -276,18 +281,20 @@ FieldWrapperBase.propTypes = {
|
|
|
276
281
|
inputOnChange: PropTypes.func,
|
|
277
282
|
inputOnFocus: PropTypes.func,
|
|
278
283
|
inputValue: PropTypes.any,
|
|
284
|
+
isDisabled: PropTypes.bool,
|
|
285
|
+
isHidden: PropTypes.bool,
|
|
279
286
|
isRequired: PropTypes.bool,
|
|
280
287
|
itemType: PropTypes.string,
|
|
281
288
|
label: PropTypes.any,
|
|
282
|
-
|
|
289
|
+
labelHidden: PropTypes.string,
|
|
283
290
|
labelTextColor: PropTypes.string,
|
|
291
|
+
labelTextSize: PropTypes.string,
|
|
284
292
|
labelTextWidth: PropTypes.string,
|
|
285
|
-
errorMessageTextSize: PropTypes.string,
|
|
286
|
-
errorMessageTextWidth: PropTypes.string,
|
|
287
|
-
errorMessageTextColor: PropTypes.string,
|
|
288
293
|
message: PropTypes.string,
|
|
289
294
|
messageSize: PropTypes.string,
|
|
290
295
|
messageTextColor: PropTypes.string,
|
|
296
|
+
messageTextSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
297
|
+
messageTextWeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
291
298
|
messageTextWidth: PropTypes.string,
|
|
292
299
|
metaActive: PropTypes.bool,
|
|
293
300
|
metaError: PropTypes.string,
|
|
@@ -297,7 +304,10 @@ FieldWrapperBase.propTypes = {
|
|
|
297
304
|
metaTouched: PropTypes.bool,
|
|
298
305
|
metaValid: PropTypes.bool,
|
|
299
306
|
set: PropTypes.string,
|
|
307
|
+
showDivider: PropTypes.bool,
|
|
300
308
|
showErrorsOnSubmit: PropTypes.bool,
|
|
309
|
+
showMessage: PropTypes.bool,
|
|
310
|
+
tag: PropTypes.oneOfType([PropTypes.elementType, PropTypes.string]),
|
|
301
311
|
type: PropTypes.string
|
|
302
312
|
};
|
|
303
313
|
function FieldWrapper(props) {
|
|
@@ -315,44 +325,24 @@ function FieldWrapper(props) {
|
|
|
315
325
|
}, []);
|
|
316
326
|
return /*#__PURE__*/React.createElement(FieldWrapperBase, props);
|
|
317
327
|
}
|
|
318
|
-
FieldWrapper.propTypes =
|
|
319
|
-
autoComplete: PropTypes.string,
|
|
320
|
-
children: PropTypes.any,
|
|
321
|
-
className: PropTypes.string,
|
|
322
|
-
fieldClassName: PropTypes.string,
|
|
323
|
-
hint: PropTypes.string,
|
|
324
|
-
inputName: PropTypes.string,
|
|
325
|
-
inputOnBlur: PropTypes.func,
|
|
326
|
-
inputOnChange: PropTypes.func,
|
|
327
|
-
inputOnFocus: PropTypes.func,
|
|
328
|
-
inputValue: PropTypes.any,
|
|
329
|
-
isRequired: PropTypes.bool,
|
|
330
|
-
itemType: PropTypes.string,
|
|
331
|
-
label: PropTypes.any,
|
|
332
|
-
metaActive: PropTypes.bool,
|
|
333
|
-
metaError: PropTypes.string,
|
|
334
|
-
metaModifiedSinceLastSubmit: PropTypes.bool,
|
|
335
|
-
metaSubmitError: PropTypes.string,
|
|
336
|
-
metaSubmitFailed: PropTypes.bool,
|
|
337
|
-
metaTouched: PropTypes.bool,
|
|
338
|
-
metaValid: PropTypes.bool,
|
|
339
|
-
showErrorsOnSubmit: PropTypes.bool
|
|
340
|
-
};
|
|
328
|
+
FieldWrapper.propTypes = FieldWrapperBase.propTypes;
|
|
341
329
|
|
|
342
330
|
const CheckboxField = /*#__PURE__*/React.memo(function CheckboxField(props) {
|
|
343
331
|
const {
|
|
344
|
-
|
|
345
|
-
isDisabled,
|
|
346
|
-
isRequired,
|
|
347
|
-
onChange,
|
|
332
|
+
classNameGroupItem,
|
|
348
333
|
fieldProps,
|
|
334
|
+
initialValue,
|
|
349
335
|
inputProps,
|
|
350
|
-
|
|
351
|
-
|
|
336
|
+
isDisabled,
|
|
337
|
+
isRequired,
|
|
338
|
+
name,
|
|
339
|
+
showMessage,
|
|
340
|
+
onChange
|
|
352
341
|
} = props;
|
|
353
342
|
return /*#__PURE__*/React.createElement(Field, {
|
|
354
343
|
name: name,
|
|
355
|
-
type: "checkbox"
|
|
344
|
+
type: "checkbox",
|
|
345
|
+
initialValue: initialValue
|
|
356
346
|
}, ({
|
|
357
347
|
input,
|
|
358
348
|
meta
|
|
@@ -378,7 +368,7 @@ const CheckboxField = /*#__PURE__*/React.memo(function CheckboxField(props) {
|
|
|
378
368
|
metaTouched: meta.touched,
|
|
379
369
|
metaValid: meta.valid,
|
|
380
370
|
tag: "label",
|
|
381
|
-
|
|
371
|
+
showMessage: showMessage
|
|
382
372
|
}, fieldProps), /*#__PURE__*/React.createElement(Checkbox, Object.assign({
|
|
383
373
|
autoComplete: "nope",
|
|
384
374
|
checked: input.checked,
|
|
@@ -392,14 +382,18 @@ const CheckboxField = /*#__PURE__*/React.memo(function CheckboxField(props) {
|
|
|
392
382
|
});
|
|
393
383
|
});
|
|
394
384
|
CheckboxField.defaultProps = {
|
|
395
|
-
|
|
396
|
-
|
|
385
|
+
fieldProps: {},
|
|
386
|
+
inputProps: {}
|
|
397
387
|
};
|
|
398
388
|
CheckboxField.propTypes = {
|
|
389
|
+
initialValue: PropTypes.bool,
|
|
390
|
+
classNameGroupItem: PropTypes.string,
|
|
399
391
|
fieldProps: PropTypes.object,
|
|
400
392
|
inputProps: PropTypes.object,
|
|
393
|
+
isDisabled: PropTypes.bool,
|
|
401
394
|
isRequired: PropTypes.bool,
|
|
402
395
|
name: PropTypes.string,
|
|
396
|
+
showMessage: PropTypes.bool,
|
|
403
397
|
onChange: PropTypes.func
|
|
404
398
|
};
|
|
405
399
|
|
|
@@ -407,7 +401,7 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
407
401
|
const {
|
|
408
402
|
classNameGroupItem,
|
|
409
403
|
fieldProps,
|
|
410
|
-
|
|
404
|
+
showMessage,
|
|
411
405
|
initialValue,
|
|
412
406
|
inputProps,
|
|
413
407
|
isMultiple,
|
|
@@ -463,7 +457,7 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
463
457
|
metaSubmitFailed: meta.submitFailed,
|
|
464
458
|
metaTouched: meta.touched,
|
|
465
459
|
metaValid: meta.valid,
|
|
466
|
-
|
|
460
|
+
showMessage: showMessage
|
|
467
461
|
}, fieldProps), /*#__PURE__*/React.createElement(Choice, Object.assign({
|
|
468
462
|
className: clsx(meta.active && 'form-choice_state_focus', meta.error && meta.touched && 'form-choice_state_error'),
|
|
469
463
|
options: options,
|
|
@@ -481,7 +475,7 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
481
475
|
ChoiceField.propTypes = {
|
|
482
476
|
classNameGroupItem: PropTypes.string,
|
|
483
477
|
fieldProps: PropTypes.object,
|
|
484
|
-
|
|
478
|
+
showMessage: PropTypes.bool,
|
|
485
479
|
initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
486
480
|
inputProps: PropTypes.object,
|
|
487
481
|
isMultiple: PropTypes.bool,
|
|
@@ -500,12 +494,14 @@ const CustomField = /*#__PURE__*/React.memo(function CustomField(props) {
|
|
|
500
494
|
isDisabled,
|
|
501
495
|
isRequired,
|
|
502
496
|
name,
|
|
497
|
+
initialValue,
|
|
503
498
|
fieldProps,
|
|
504
499
|
classNameGroupItem,
|
|
505
|
-
|
|
500
|
+
showMessage
|
|
506
501
|
} = props;
|
|
507
502
|
return /*#__PURE__*/React.createElement(Field, {
|
|
508
|
-
name: name
|
|
503
|
+
name: name,
|
|
504
|
+
initialValue: initialValue
|
|
509
505
|
}, ({
|
|
510
506
|
input,
|
|
511
507
|
meta
|
|
@@ -523,7 +519,7 @@ const CustomField = /*#__PURE__*/React.memo(function CustomField(props) {
|
|
|
523
519
|
metaSubmitFailed: meta.submitFailed,
|
|
524
520
|
metaTouched: meta.touched,
|
|
525
521
|
metaValid: meta.valid,
|
|
526
|
-
|
|
522
|
+
showMessage: showMessage
|
|
527
523
|
}, fieldProps), /*#__PURE__*/React.createElement(Component, Object.assign({}, props, {
|
|
528
524
|
isDisabled: isDisabled,
|
|
529
525
|
input: input,
|
|
@@ -535,10 +531,15 @@ CustomField.defaultProps = {
|
|
|
535
531
|
fieldProps: {}
|
|
536
532
|
};
|
|
537
533
|
CustomField.propTypes = {
|
|
538
|
-
|
|
539
|
-
|
|
534
|
+
Component: PropTypes.element,
|
|
535
|
+
classNameGroupItem: PropTypes.string,
|
|
540
536
|
fieldProps: PropTypes.object,
|
|
541
|
-
|
|
537
|
+
initialValue: PropTypes.any,
|
|
538
|
+
inputProps: PropTypes.object,
|
|
539
|
+
isDisabled: PropTypes.bool,
|
|
540
|
+
isRequired: PropTypes.bool,
|
|
541
|
+
name: PropTypes.string.isRequired,
|
|
542
|
+
showMessage: PropTypes.bool
|
|
542
543
|
};
|
|
543
544
|
|
|
544
545
|
const CodeField = /*#__PURE__*/React.memo(function CodeField(props) {
|
|
@@ -547,12 +548,14 @@ const CodeField = /*#__PURE__*/React.memo(function CodeField(props) {
|
|
|
547
548
|
isDisabled,
|
|
548
549
|
name,
|
|
549
550
|
fieldProps,
|
|
551
|
+
initialValue,
|
|
550
552
|
inputProps,
|
|
551
553
|
classNameGroupItem,
|
|
552
|
-
|
|
554
|
+
showMessage
|
|
553
555
|
} = props;
|
|
554
556
|
return /*#__PURE__*/React.createElement(Field, {
|
|
555
|
-
name: name
|
|
557
|
+
name: name,
|
|
558
|
+
initialValue: initialValue
|
|
556
559
|
}, ({
|
|
557
560
|
input,
|
|
558
561
|
meta
|
|
@@ -570,7 +573,7 @@ const CodeField = /*#__PURE__*/React.memo(function CodeField(props) {
|
|
|
570
573
|
metaSubmitFailed: meta.submitFailed,
|
|
571
574
|
metaTouched: meta.touched,
|
|
572
575
|
metaValid: meta.valid,
|
|
573
|
-
|
|
576
|
+
showMessage: showMessage
|
|
574
577
|
}, fieldProps), /*#__PURE__*/React.createElement(Code, Object.assign({
|
|
575
578
|
autoComplete: "nope",
|
|
576
579
|
name: input.name,
|
|
@@ -586,10 +589,14 @@ CodeField.defaultProps = {
|
|
|
586
589
|
fieldProps: {}
|
|
587
590
|
};
|
|
588
591
|
CodeField.propTypes = {
|
|
589
|
-
|
|
590
|
-
isRequired: PropTypes.bool,
|
|
592
|
+
classNameGroupItem: PropTypes.string,
|
|
591
593
|
fieldProps: PropTypes.object,
|
|
592
|
-
|
|
594
|
+
initialValue: PropTypes.string,
|
|
595
|
+
inputProps: PropTypes.object,
|
|
596
|
+
isDisabled: PropTypes.bool,
|
|
597
|
+
isRequired: PropTypes.bool,
|
|
598
|
+
name: PropTypes.string.isRequired,
|
|
599
|
+
showMessage: PropTypes.bool
|
|
593
600
|
};
|
|
594
601
|
|
|
595
602
|
function DatePickerField(props) {
|
|
@@ -608,7 +615,7 @@ function DatePickerField(props) {
|
|
|
608
615
|
iconRevealableShow,
|
|
609
616
|
iconRevealableHide,
|
|
610
617
|
iconShape,
|
|
611
|
-
|
|
618
|
+
showMessage,
|
|
612
619
|
onChange,
|
|
613
620
|
classNameGroupItem
|
|
614
621
|
} = props;
|
|
@@ -638,7 +645,7 @@ function DatePickerField(props) {
|
|
|
638
645
|
metaSubmitFailed: meta.submitFailed,
|
|
639
646
|
metaTouched: meta.touched,
|
|
640
647
|
metaValid: meta.valid,
|
|
641
|
-
|
|
648
|
+
showMessage: showMessage
|
|
642
649
|
}, fieldProps), /*#__PURE__*/React.createElement(DatePickerInput, {
|
|
643
650
|
name: input.name,
|
|
644
651
|
value: input.value || '',
|
|
@@ -776,7 +783,7 @@ const FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(pro
|
|
|
776
783
|
removeThumbText,
|
|
777
784
|
hintTitle,
|
|
778
785
|
hintDescription,
|
|
779
|
-
|
|
786
|
+
showFilename,
|
|
780
787
|
isPreviews,
|
|
781
788
|
loadingText,
|
|
782
789
|
dropzoneProps = {},
|
|
@@ -966,7 +973,7 @@ const FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(pro
|
|
|
966
973
|
textColor: thumbNameTextColor,
|
|
967
974
|
textWrap: thumbNameTextWrap,
|
|
968
975
|
textWeight: thumbNameTextWeight
|
|
969
|
-
}, fileErrorText || file.error)),
|
|
976
|
+
}, fileErrorText || file.error)), showFilename && /*#__PURE__*/React.createElement("div", {
|
|
970
977
|
className: "form-dropzone__thumb-name"
|
|
971
978
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
972
979
|
size: thumbNameTextSize,
|
|
@@ -1035,7 +1042,7 @@ FileInputDropzone.propTypes = {
|
|
|
1035
1042
|
inputName: PropTypes.string,
|
|
1036
1043
|
inputValue: PropTypes.any,
|
|
1037
1044
|
isPreviews: PropTypes.bool,
|
|
1038
|
-
|
|
1045
|
+
showFilename: PropTypes.bool,
|
|
1039
1046
|
loadingText: PropTypes.string,
|
|
1040
1047
|
metaError: PropTypes.string,
|
|
1041
1048
|
metaTouched: PropTypes.bool,
|
|
@@ -1084,10 +1091,10 @@ const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1084
1091
|
hintDescriptionTextColor,
|
|
1085
1092
|
hintDescriptionTextWrap,
|
|
1086
1093
|
hintDescriptionTextWeight,
|
|
1087
|
-
|
|
1094
|
+
showMessage,
|
|
1088
1095
|
thumbDirection,
|
|
1089
1096
|
hintDescription,
|
|
1090
|
-
|
|
1097
|
+
showFilename,
|
|
1091
1098
|
fileErrorText,
|
|
1092
1099
|
dropzoneProps,
|
|
1093
1100
|
maxFiles,
|
|
@@ -1120,7 +1127,7 @@ const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1120
1127
|
metaSubmitFailed: meta.submitFailed,
|
|
1121
1128
|
metaTouched: meta.touched,
|
|
1122
1129
|
metaValid: meta.valid,
|
|
1123
|
-
|
|
1130
|
+
showMessage: showMessage,
|
|
1124
1131
|
width: width
|
|
1125
1132
|
}, fieldProps), /*#__PURE__*/React.createElement(FileInputDropzone, {
|
|
1126
1133
|
dropzoneProps: dropzoneProps,
|
|
@@ -1166,7 +1173,7 @@ const FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1166
1173
|
errorMessageTextColor: errorMessageTextColor,
|
|
1167
1174
|
isPreviews: isPreviews,
|
|
1168
1175
|
shape: shape,
|
|
1169
|
-
|
|
1176
|
+
showFilename: showFilename,
|
|
1170
1177
|
metaError: meta.error,
|
|
1171
1178
|
metaTouched: meta.touched,
|
|
1172
1179
|
removeThumbText: removeThumbText,
|
|
@@ -1192,7 +1199,7 @@ FileInput.propTypes = {
|
|
|
1192
1199
|
inputClass: PropTypes.string,
|
|
1193
1200
|
isPreviews: PropTypes.bool,
|
|
1194
1201
|
isRequired: PropTypes.bool,
|
|
1195
|
-
|
|
1202
|
+
showFilename: PropTypes.bool,
|
|
1196
1203
|
label: PropTypes.any,
|
|
1197
1204
|
removeThumbText: PropTypes.string,
|
|
1198
1205
|
onAddFiles: PropTypes.func,
|
|
@@ -1217,7 +1224,7 @@ const Group = /*#__PURE__*/React.memo(function Group(props) {
|
|
|
1217
1224
|
messageTextColor,
|
|
1218
1225
|
children,
|
|
1219
1226
|
dataTour,
|
|
1220
|
-
|
|
1227
|
+
showGroupMessage,
|
|
1221
1228
|
name,
|
|
1222
1229
|
showErrorsOnSubmit
|
|
1223
1230
|
} = props;
|
|
@@ -1248,7 +1255,7 @@ const Group = /*#__PURE__*/React.memo(function Group(props) {
|
|
|
1248
1255
|
textWeight: labelTextWeight
|
|
1249
1256
|
}, label)), /*#__PURE__*/React.createElement("div", {
|
|
1250
1257
|
className: "form__group-items"
|
|
1251
|
-
}, children), after),
|
|
1258
|
+
}, children), after), showGroupMessage && /*#__PURE__*/React.createElement(React.Fragment, null, Boolean(showError) && /*#__PURE__*/React.createElement(Text, {
|
|
1252
1259
|
className: "form__group-message form__group-message_type-error",
|
|
1253
1260
|
size: errorMessageTextSize,
|
|
1254
1261
|
textWeight: errorMessageTextWeight,
|
|
@@ -1296,10 +1303,11 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
|
|
|
1296
1303
|
iconBorderHover,
|
|
1297
1304
|
iconFill,
|
|
1298
1305
|
iconFillHover,
|
|
1299
|
-
iconRevealableShow,
|
|
1300
1306
|
iconRevealableHide,
|
|
1307
|
+
iconRevealableShow,
|
|
1301
1308
|
iconShape,
|
|
1302
|
-
|
|
1309
|
+
initialValue,
|
|
1310
|
+
showMessage,
|
|
1303
1311
|
onChange,
|
|
1304
1312
|
classNameGroupItem
|
|
1305
1313
|
} = props;
|
|
@@ -1317,7 +1325,8 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
|
|
|
1317
1325
|
}, [setIsRevealed]);
|
|
1318
1326
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1319
1327
|
name: name,
|
|
1320
|
-
parse: parse
|
|
1328
|
+
parse: parse,
|
|
1329
|
+
initialValue: initialValue
|
|
1321
1330
|
}, ({
|
|
1322
1331
|
input,
|
|
1323
1332
|
meta
|
|
@@ -1342,7 +1351,7 @@ const InputField = /*#__PURE__*/React.memo(function InputField(props) {
|
|
|
1342
1351
|
metaSubmitFailed: meta.submitFailed,
|
|
1343
1352
|
metaTouched: meta.touched,
|
|
1344
1353
|
metaValid: meta.valid,
|
|
1345
|
-
|
|
1354
|
+
showMessage: showMessage
|
|
1346
1355
|
}, fieldProps), /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
1347
1356
|
className: clsx(meta.active && 'input_state_focus', meta.error && meta.touched && 'input_state_error'),
|
|
1348
1357
|
autoComplete: "nope",
|
|
@@ -1371,6 +1380,7 @@ InputField.defaultProps = {
|
|
|
1371
1380
|
};
|
|
1372
1381
|
InputField.propTypes = {
|
|
1373
1382
|
fieldProps: PropTypes.object,
|
|
1383
|
+
initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1374
1384
|
inputProps: PropTypes.object,
|
|
1375
1385
|
isPassword: PropTypes.bool,
|
|
1376
1386
|
isRequired: PropTypes.bool,
|
|
@@ -1390,7 +1400,7 @@ function RadioGroupItem(props) {
|
|
|
1390
1400
|
if (event.target.checked) {
|
|
1391
1401
|
onChange(option.value);
|
|
1392
1402
|
}
|
|
1393
|
-
}, []);
|
|
1403
|
+
}, [onChange]);
|
|
1394
1404
|
return /*#__PURE__*/React.createElement(RadioButton, Object.assign({
|
|
1395
1405
|
className: "form-radio__item",
|
|
1396
1406
|
checked: option.value === input.value,
|
|
@@ -1520,15 +1530,15 @@ RadioGroupList.propTypes = {
|
|
|
1520
1530
|
|
|
1521
1531
|
const RadioGroup = /*#__PURE__*/React.memo(function RadioGroup(props) {
|
|
1522
1532
|
const {
|
|
1523
|
-
isRequired,
|
|
1524
|
-
name,
|
|
1525
|
-
options,
|
|
1526
|
-
fieldProps,
|
|
1527
1533
|
editableProps,
|
|
1534
|
+
fieldProps,
|
|
1528
1535
|
inputProps,
|
|
1529
|
-
onChange,
|
|
1530
1536
|
isDisabled,
|
|
1531
|
-
|
|
1537
|
+
isRequired,
|
|
1538
|
+
name,
|
|
1539
|
+
options,
|
|
1540
|
+
showMessage,
|
|
1541
|
+
onChange
|
|
1532
1542
|
} = props;
|
|
1533
1543
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1534
1544
|
name: name
|
|
@@ -1549,7 +1559,7 @@ const RadioGroup = /*#__PURE__*/React.memo(function RadioGroup(props) {
|
|
|
1549
1559
|
metaSubmitFailed: meta.submitFailed,
|
|
1550
1560
|
metaTouched: meta.touched,
|
|
1551
1561
|
metaValid: meta.valid,
|
|
1552
|
-
|
|
1562
|
+
showMessage: showMessage
|
|
1553
1563
|
}, fieldProps), /*#__PURE__*/React.createElement(RadioGroupList, {
|
|
1554
1564
|
input: input,
|
|
1555
1565
|
options: options,
|
|
@@ -1560,22 +1570,23 @@ const RadioGroup = /*#__PURE__*/React.memo(function RadioGroup(props) {
|
|
|
1560
1570
|
})));
|
|
1561
1571
|
});
|
|
1562
1572
|
RadioGroup.defaultProps = {
|
|
1563
|
-
fieldProps: {},
|
|
1564
1573
|
editableProps: {},
|
|
1574
|
+
fieldProps: {},
|
|
1565
1575
|
inputProps: {},
|
|
1566
1576
|
options: []
|
|
1567
1577
|
};
|
|
1568
1578
|
RadioGroup.propTypes = {
|
|
1569
|
-
|
|
1579
|
+
editableProps: PropTypes.object,
|
|
1570
1580
|
fieldProps: PropTypes.object,
|
|
1571
1581
|
inputProps: PropTypes.object,
|
|
1572
|
-
|
|
1582
|
+
isDisabled: PropTypes.bool,
|
|
1573
1583
|
isRequired: PropTypes.bool,
|
|
1584
|
+
name: PropTypes.string.isRequired,
|
|
1574
1585
|
options: PropTypes.array,
|
|
1586
|
+
showMessage: PropTypes.bool,
|
|
1575
1587
|
onChange: PropTypes.func
|
|
1576
1588
|
};
|
|
1577
1589
|
|
|
1578
|
-
// const SegmentedField = React.memo(
|
|
1579
1590
|
function SegmentedField(props) {
|
|
1580
1591
|
const {
|
|
1581
1592
|
options,
|
|
@@ -1584,11 +1595,14 @@ function SegmentedField(props) {
|
|
|
1584
1595
|
fieldProps,
|
|
1585
1596
|
inputProps,
|
|
1586
1597
|
isDisabled,
|
|
1587
|
-
|
|
1598
|
+
showMessage
|
|
1588
1599
|
} = props;
|
|
1589
1600
|
const {
|
|
1590
1601
|
change
|
|
1591
1602
|
} = useForm();
|
|
1603
|
+
const setActiveSegment = useCallback(option => {
|
|
1604
|
+
change(name, option.value);
|
|
1605
|
+
}, [change]);
|
|
1592
1606
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1593
1607
|
name: name
|
|
1594
1608
|
}, ({
|
|
@@ -1606,9 +1620,6 @@ function SegmentedField(props) {
|
|
|
1606
1620
|
}
|
|
1607
1621
|
return emptyOption;
|
|
1608
1622
|
}, [input.value]);
|
|
1609
|
-
const setActiveSegment = useCallback(option => {
|
|
1610
|
-
change(name, option.value);
|
|
1611
|
-
}, [change]);
|
|
1612
1623
|
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1613
1624
|
className: clsx('form-field_type_segmented', 'form__item_type_segmented'),
|
|
1614
1625
|
fieldClassName: "form-segmented",
|
|
@@ -1623,7 +1634,7 @@ function SegmentedField(props) {
|
|
|
1623
1634
|
metaSubmitFailed: meta.submitFailed,
|
|
1624
1635
|
metaTouched: meta.touched,
|
|
1625
1636
|
metaValid: meta.valid,
|
|
1626
|
-
|
|
1637
|
+
showMessage: showMessage
|
|
1627
1638
|
}, fieldProps), /*#__PURE__*/React.createElement(Segmented, Object.assign({
|
|
1628
1639
|
segments: options,
|
|
1629
1640
|
isDisabled: isDisabled,
|
|
@@ -1632,18 +1643,18 @@ function SegmentedField(props) {
|
|
|
1632
1643
|
}, inputProps)));
|
|
1633
1644
|
});
|
|
1634
1645
|
}
|
|
1635
|
-
// )
|
|
1636
|
-
|
|
1637
1646
|
SegmentedField.propTypes = {
|
|
1638
|
-
options: PropTypes.array.isRequired,
|
|
1639
|
-
name: PropTypes.string.isRequired,
|
|
1640
1647
|
className: PropTypes.string,
|
|
1648
|
+
fieldProps: PropTypes.object,
|
|
1641
1649
|
inputClass: PropTypes.string,
|
|
1650
|
+
inputProps: PropTypes.object,
|
|
1651
|
+
isDisabled: PropTypes.bool,
|
|
1642
1652
|
isRequired: PropTypes.bool,
|
|
1643
1653
|
label: PropTypes.string,
|
|
1654
|
+
name: PropTypes.string.isRequired,
|
|
1655
|
+
options: PropTypes.array.isRequired,
|
|
1644
1656
|
placeholder: PropTypes.string,
|
|
1645
|
-
|
|
1646
|
-
inputProps: PropTypes.object
|
|
1657
|
+
showMessage: PropTypes.bool
|
|
1647
1658
|
};
|
|
1648
1659
|
|
|
1649
1660
|
function getDefaultValue(options, selectValue) {
|
|
@@ -1668,13 +1679,13 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1668
1679
|
const {
|
|
1669
1680
|
classNameGroupItem,
|
|
1670
1681
|
fieldProps,
|
|
1671
|
-
hideMessage,
|
|
1672
1682
|
isDisabled,
|
|
1673
1683
|
isRequired,
|
|
1674
1684
|
name,
|
|
1675
1685
|
options,
|
|
1676
1686
|
selectProps,
|
|
1677
1687
|
selectRef,
|
|
1688
|
+
showMessage,
|
|
1678
1689
|
onChange
|
|
1679
1690
|
} = props;
|
|
1680
1691
|
return /*#__PURE__*/React.createElement(Field, {
|
|
@@ -1720,7 +1731,7 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1720
1731
|
metaSubmitFailed: meta.submitFailed,
|
|
1721
1732
|
metaTouched: meta.touched,
|
|
1722
1733
|
metaValid: meta.valid,
|
|
1723
|
-
|
|
1734
|
+
showMessage: showMessage
|
|
1724
1735
|
}, fieldProps), /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
1725
1736
|
className: "form-select-item",
|
|
1726
1737
|
instanceId: `id_${input.name}`,
|
|
@@ -1733,25 +1744,30 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1733
1744
|
});
|
|
1734
1745
|
});
|
|
1735
1746
|
SelectField.propTypes = {
|
|
1736
|
-
|
|
1737
|
-
|
|
1747
|
+
classNameGroupItem: PropTypes.string,
|
|
1748
|
+
fieldProps: PropTypes.object,
|
|
1749
|
+
isDisabled: PropTypes.bool,
|
|
1738
1750
|
isRequired: PropTypes.bool,
|
|
1739
1751
|
label: PropTypes.any,
|
|
1740
1752
|
messageType: PropTypes.string,
|
|
1753
|
+
name: PropTypes.string.isRequired,
|
|
1741
1754
|
options: PropTypes.array,
|
|
1755
|
+
selectProps: PropTypes.object,
|
|
1756
|
+
selectRef: PropTypes.any,
|
|
1757
|
+
showMessage: PropTypes.bool,
|
|
1742
1758
|
onChange: PropTypes.func
|
|
1743
1759
|
};
|
|
1744
1760
|
|
|
1745
1761
|
const SwitchField = /*#__PURE__*/React.memo(function SwitchField(props) {
|
|
1746
1762
|
const {
|
|
1747
|
-
|
|
1748
|
-
isDisabled,
|
|
1749
|
-
isRequired,
|
|
1750
|
-
onChange,
|
|
1763
|
+
classNameGroupItem,
|
|
1751
1764
|
fieldProps,
|
|
1752
1765
|
inputProps,
|
|
1753
|
-
|
|
1754
|
-
|
|
1766
|
+
isDisabled,
|
|
1767
|
+
isRequired,
|
|
1768
|
+
name,
|
|
1769
|
+
showMessage,
|
|
1770
|
+
onChange
|
|
1755
1771
|
} = props;
|
|
1756
1772
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1757
1773
|
name: name,
|
|
@@ -1780,7 +1796,7 @@ const SwitchField = /*#__PURE__*/React.memo(function SwitchField(props) {
|
|
|
1780
1796
|
metaSubmitFailed: meta.submitFailed,
|
|
1781
1797
|
metaTouched: meta.touched,
|
|
1782
1798
|
metaValid: meta.valid,
|
|
1783
|
-
|
|
1799
|
+
showMessage: showMessage,
|
|
1784
1800
|
tag: "label"
|
|
1785
1801
|
}, fieldProps), /*#__PURE__*/React.createElement(Switch, Object.assign({
|
|
1786
1802
|
autoComplete: "nope",
|
|
@@ -1795,14 +1811,17 @@ const SwitchField = /*#__PURE__*/React.memo(function SwitchField(props) {
|
|
|
1795
1811
|
});
|
|
1796
1812
|
});
|
|
1797
1813
|
SwitchField.defaultProps = {
|
|
1798
|
-
|
|
1799
|
-
|
|
1814
|
+
fieldProps: {},
|
|
1815
|
+
inputProps: {}
|
|
1800
1816
|
};
|
|
1801
1817
|
SwitchField.propTypes = {
|
|
1818
|
+
classNameGroupItem: PropTypes.string,
|
|
1802
1819
|
fieldProps: PropTypes.object,
|
|
1803
1820
|
inputProps: PropTypes.object,
|
|
1821
|
+
isDisabled: PropTypes.bool,
|
|
1804
1822
|
isRequired: PropTypes.bool,
|
|
1805
1823
|
name: PropTypes.string,
|
|
1824
|
+
showMessage: PropTypes.bool,
|
|
1806
1825
|
onChange: PropTypes.func
|
|
1807
1826
|
};
|
|
1808
1827
|
|
|
@@ -1814,7 +1833,7 @@ const TextareaField = /*#__PURE__*/React.memo(function TextareaField(props) {
|
|
|
1814
1833
|
fieldProps,
|
|
1815
1834
|
inputProps,
|
|
1816
1835
|
classNameGroupItem,
|
|
1817
|
-
|
|
1836
|
+
showMessage
|
|
1818
1837
|
} = props;
|
|
1819
1838
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1820
1839
|
name: name
|
|
@@ -1835,7 +1854,7 @@ const TextareaField = /*#__PURE__*/React.memo(function TextareaField(props) {
|
|
|
1835
1854
|
metaSubmitFailed: meta.submitFailed,
|
|
1836
1855
|
metaTouched: meta.touched,
|
|
1837
1856
|
metaValid: meta.valid,
|
|
1838
|
-
|
|
1857
|
+
showMessage: showMessage
|
|
1839
1858
|
}, fieldProps), /*#__PURE__*/React.createElement(Textarea, Object.assign({
|
|
1840
1859
|
autoComplete: "nope",
|
|
1841
1860
|
name: input.name,
|
|
@@ -1851,10 +1870,13 @@ TextareaField.defaultProps = {
|
|
|
1851
1870
|
fieldProps: {}
|
|
1852
1871
|
};
|
|
1853
1872
|
TextareaField.propTypes = {
|
|
1854
|
-
|
|
1855
|
-
isRequired: PropTypes.bool,
|
|
1873
|
+
classNameGroupItem: PropTypes.string,
|
|
1856
1874
|
fieldProps: PropTypes.object,
|
|
1857
|
-
inputProps: PropTypes.object
|
|
1875
|
+
inputProps: PropTypes.object,
|
|
1876
|
+
isDisabled: PropTypes.bool,
|
|
1877
|
+
isRequired: PropTypes.bool,
|
|
1878
|
+
name: PropTypes.string.isRequired,
|
|
1879
|
+
showMessage: PropTypes.bool
|
|
1858
1880
|
};
|
|
1859
1881
|
|
|
1860
1882
|
const focusOnError = (formElementsList, errors) => {
|
|
@@ -2064,7 +2086,7 @@ function generateField(field, config, props) {
|
|
|
2064
2086
|
}, field, props), Object.entries(field.group).map(([key, value]) => {
|
|
2065
2087
|
const groupProps = {
|
|
2066
2088
|
...value,
|
|
2067
|
-
|
|
2089
|
+
showMessage: field.showMessage,
|
|
2068
2090
|
classNameGroupItem: value.classNameGroupItem || 'form__group-item'
|
|
2069
2091
|
};
|
|
2070
2092
|
return generateField(groupProps, {
|