@itcase/forms 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/itcase-forms.cjs.js +114 -68
- package/dist/itcase-forms.esm.js +111 -65
- package/package.json +24 -24
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -411,22 +411,29 @@ CheckboxField.propTypes = {
|
|
|
411
411
|
|
|
412
412
|
const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceField(props) {
|
|
413
413
|
const {
|
|
414
|
-
options,
|
|
415
414
|
classNameGroupItem,
|
|
416
415
|
fieldProps,
|
|
416
|
+
hideMessage,
|
|
417
|
+
initialValue,
|
|
417
418
|
inputProps,
|
|
418
419
|
isMultiple,
|
|
419
420
|
isRequired,
|
|
420
|
-
initialValue,
|
|
421
421
|
label,
|
|
422
|
-
name,
|
|
423
422
|
messageType,
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
name,
|
|
424
|
+
options,
|
|
425
|
+
placeholder,
|
|
426
|
+
onChange
|
|
426
427
|
} = props;
|
|
427
428
|
const {
|
|
428
429
|
change
|
|
429
430
|
} = reactFinalForm.useForm();
|
|
431
|
+
const setActiveSegment = React.useCallback((option, isChecked) => {
|
|
432
|
+
change(name, isChecked && option.value);
|
|
433
|
+
if (onChange) {
|
|
434
|
+
onChange(option.value, name, isChecked);
|
|
435
|
+
}
|
|
436
|
+
}, [change]);
|
|
430
437
|
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
431
438
|
name: name,
|
|
432
439
|
initialValue: initialValue
|
|
@@ -445,9 +452,6 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
|
|
|
445
452
|
}
|
|
446
453
|
return emptyOption;
|
|
447
454
|
}, [input.value]);
|
|
448
|
-
const setActiveSegment = React.useCallback(option => {
|
|
449
|
-
change(name, option.value);
|
|
450
|
-
}, [change]);
|
|
451
455
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
452
456
|
className: clsx__default.default('form-field_type_choice', 'form__item_type_choice', classNameGroupItem),
|
|
453
457
|
fieldClassName: "form-choice",
|
|
@@ -467,7 +471,7 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
|
|
|
467
471
|
}, fieldProps), /*#__PURE__*/React__default.default.createElement(Choice.Choice, Object.assign({
|
|
468
472
|
className: clsx__default.default(meta.active && 'form-choice_state_focus', meta.error && meta.touched && 'form-choice_state_error'),
|
|
469
473
|
options: options,
|
|
470
|
-
|
|
474
|
+
name: input.name,
|
|
471
475
|
inputValue: input.value || [],
|
|
472
476
|
isMultiple: isMultiple,
|
|
473
477
|
isRequired: isRequired,
|
|
@@ -478,14 +482,22 @@ const ChoiceField = /*#__PURE__*/React__default.default.memo(function ChoiceFiel
|
|
|
478
482
|
});
|
|
479
483
|
});
|
|
480
484
|
ChoiceField.propTypes = {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
+
classNameGroupItem: PropTypes__default.default.string,
|
|
486
|
+
fieldProps: PropTypes__default.default.object,
|
|
487
|
+
hideMessage: PropTypes__default.default.bool,
|
|
488
|
+
initialValue: PropTypes__default.default.string,
|
|
489
|
+
inputProps: PropTypes__default.default.object,
|
|
485
490
|
isMultiple: PropTypes__default.default.bool,
|
|
486
491
|
isRequired: PropTypes__default.default.bool,
|
|
487
492
|
label: PropTypes__default.default.string,
|
|
488
|
-
|
|
493
|
+
messageType: PropTypes__default.default.string,
|
|
494
|
+
name: PropTypes__default.default.string,
|
|
495
|
+
options: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
|
|
496
|
+
value: PropTypes__default.default.string,
|
|
497
|
+
label: PropTypes__default.default.string
|
|
498
|
+
})),
|
|
499
|
+
placeholder: PropTypes__default.default.string,
|
|
500
|
+
onChange: PropTypes__default.default.func
|
|
489
501
|
};
|
|
490
502
|
|
|
491
503
|
const CustomField = /*#__PURE__*/React__default.default.memo(function CustomField(props) {
|
|
@@ -707,7 +719,6 @@ async function convertToFiles(inputValue, isPreviews) {
|
|
|
707
719
|
// })
|
|
708
720
|
// }
|
|
709
721
|
}
|
|
710
|
-
|
|
711
722
|
return newFiles;
|
|
712
723
|
}
|
|
713
724
|
function setFileDataURL(file, resolve) {
|
|
@@ -1640,16 +1651,15 @@ function getDefaultValue(options, selectValue) {
|
|
|
1640
1651
|
}
|
|
1641
1652
|
const SelectField = /*#__PURE__*/React__default.default.memo(function SelectField(props) {
|
|
1642
1653
|
const {
|
|
1654
|
+
classNameGroupItem,
|
|
1655
|
+
fieldProps,
|
|
1656
|
+
hideMessage,
|
|
1643
1657
|
isRequired,
|
|
1644
|
-
key,
|
|
1645
1658
|
name,
|
|
1646
1659
|
options,
|
|
1647
|
-
fieldProps,
|
|
1648
1660
|
selectProps,
|
|
1649
1661
|
selectRef,
|
|
1650
|
-
onChange
|
|
1651
|
-
classNameGroupItem,
|
|
1652
|
-
hideMessage
|
|
1662
|
+
onChange
|
|
1653
1663
|
} = props;
|
|
1654
1664
|
return /*#__PURE__*/React__default.default.createElement(reactFinalForm.Field, {
|
|
1655
1665
|
name: name
|
|
@@ -1657,12 +1667,6 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
|
|
|
1657
1667
|
input,
|
|
1658
1668
|
meta
|
|
1659
1669
|
}) => {
|
|
1660
|
-
const onChangeField = React.useCallback(value => {
|
|
1661
|
-
input.onChange(value);
|
|
1662
|
-
if (onChange) {
|
|
1663
|
-
onChange(value, input.name);
|
|
1664
|
-
}
|
|
1665
|
-
}, [onChange]);
|
|
1666
1670
|
const [selectedOptions, setSelectedOptions] = React.useState(null);
|
|
1667
1671
|
const defaultValue = React.useMemo(() => {
|
|
1668
1672
|
const optionsValues = getDefaultValue(options, input.value);
|
|
@@ -1674,12 +1678,18 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
|
|
|
1674
1678
|
}
|
|
1675
1679
|
return optionsValues;
|
|
1676
1680
|
}, [input.value]);
|
|
1677
|
-
React.
|
|
1681
|
+
const onChangeField = React.useCallback(value => {
|
|
1682
|
+
input.onChange(value);
|
|
1683
|
+
if (onChange) {
|
|
1684
|
+
onChange(value, input.name);
|
|
1685
|
+
}
|
|
1686
|
+
}, [onChange]);
|
|
1678
1687
|
const onChangeValue = React.useCallback((option, actionMeta) => {
|
|
1679
1688
|
const value = Array.isArray(option) ? option.map(o => o.value) : option?.value || null;
|
|
1680
1689
|
setSelectedOptions(option);
|
|
1681
1690
|
onChangeField(value);
|
|
1682
1691
|
}, [onChangeField]);
|
|
1692
|
+
React.useEffect(() => setSelectedOptions(defaultValue), [defaultValue]);
|
|
1683
1693
|
return /*#__PURE__*/React__default.default.createElement(FieldWrapper, Object.assign({
|
|
1684
1694
|
className: clsx__default.default('form-field_type_select', 'form__item_type_select', classNameGroupItem),
|
|
1685
1695
|
fieldClassName: 'form-select',
|
|
@@ -1700,8 +1710,7 @@ const SelectField = /*#__PURE__*/React__default.default.memo(function SelectFiel
|
|
|
1700
1710
|
value: selectedOptions,
|
|
1701
1711
|
onChange: onChangeValue,
|
|
1702
1712
|
options: options,
|
|
1703
|
-
ref: selectRef
|
|
1704
|
-
key: key
|
|
1713
|
+
ref: selectRef
|
|
1705
1714
|
}, selectProps)));
|
|
1706
1715
|
});
|
|
1707
1716
|
});
|
|
@@ -2048,11 +2057,17 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2048
2057
|
after,
|
|
2049
2058
|
before,
|
|
2050
2059
|
buttonDirection,
|
|
2060
|
+
buttonFill,
|
|
2051
2061
|
buttonGap,
|
|
2062
|
+
buttonJustifyContent,
|
|
2052
2063
|
buttonPadding,
|
|
2053
|
-
groupGap,
|
|
2054
2064
|
className,
|
|
2055
2065
|
config,
|
|
2066
|
+
dataTour,
|
|
2067
|
+
dataTourButtons,
|
|
2068
|
+
dataTourPrimaryButton,
|
|
2069
|
+
dataTourSecondaryButton,
|
|
2070
|
+
dataTourTertiaryButton,
|
|
2056
2071
|
description,
|
|
2057
2072
|
descriptionSize,
|
|
2058
2073
|
descriptionTextColor,
|
|
@@ -2060,60 +2075,54 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
|
|
|
2060
2075
|
disableFieldsAutoComplete,
|
|
2061
2076
|
fieldsGap,
|
|
2062
2077
|
formName,
|
|
2078
|
+
groupGap,
|
|
2063
2079
|
initialValues,
|
|
2064
2080
|
initialValuesEqual,
|
|
2065
2081
|
isLoading,
|
|
2082
|
+
language,
|
|
2066
2083
|
loader,
|
|
2067
|
-
loaderSet,
|
|
2068
2084
|
loaderFill,
|
|
2069
2085
|
loaderItemFill,
|
|
2086
|
+
loaderSet,
|
|
2070
2087
|
loaderText,
|
|
2071
|
-
language,
|
|
2072
2088
|
mutators,
|
|
2089
|
+
notificationCloseButton,
|
|
2090
|
+
notificationType,
|
|
2073
2091
|
onChangeFormValues,
|
|
2074
2092
|
onClickSecondaryButton,
|
|
2075
2093
|
onClickTertiaryButton,
|
|
2076
2094
|
onSubmit,
|
|
2077
2095
|
primaryButton,
|
|
2078
|
-
primaryButtonLabel,
|
|
2079
|
-
secondaryButton,
|
|
2080
|
-
secondaryButtonLabel,
|
|
2081
2096
|
primaryButtonFill,
|
|
2082
2097
|
primaryButtonFillHover,
|
|
2083
|
-
|
|
2084
|
-
secondaryButtonFillHover,
|
|
2085
|
-
primaryButtonSize,
|
|
2086
|
-
primaryButtonLabelTextColor,
|
|
2098
|
+
primaryButtonLabel,
|
|
2087
2099
|
primaryButtonLabelSize,
|
|
2100
|
+
primaryButtonLabelTextColor,
|
|
2088
2101
|
primaryButtonLabelTextWeight,
|
|
2089
|
-
|
|
2090
|
-
|
|
2102
|
+
primaryButtonSize,
|
|
2103
|
+
secondaryButton,
|
|
2104
|
+
secondaryButtonFill,
|
|
2105
|
+
secondaryButtonFillHover,
|
|
2106
|
+
secondaryButtonLabel,
|
|
2091
2107
|
secondaryButtonLabelSize,
|
|
2108
|
+
secondaryButtonLabelTextColor,
|
|
2092
2109
|
secondaryButtonLabelTextWeight,
|
|
2110
|
+
secondaryButtonSize,
|
|
2111
|
+
set,
|
|
2093
2112
|
tertiaryButton,
|
|
2094
2113
|
tertiaryButtonFill,
|
|
2095
2114
|
tertiaryButtonFillHover,
|
|
2096
|
-
|
|
2097
|
-
tertiaryButtonLabelTextColor,
|
|
2115
|
+
tertiaryButtonLabel,
|
|
2098
2116
|
tertiaryButtonLabelSize,
|
|
2117
|
+
tertiaryButtonLabelTextColor,
|
|
2099
2118
|
tertiaryButtonLabelTextWeight,
|
|
2100
|
-
|
|
2101
|
-
set,
|
|
2102
|
-
type,
|
|
2103
|
-
buttonJustifyContent,
|
|
2119
|
+
tertiaryButtonSize,
|
|
2104
2120
|
title,
|
|
2105
|
-
notificationType,
|
|
2106
|
-
notificationCloseButton,
|
|
2107
|
-
buttonFill,
|
|
2108
|
-
titleTextSize,
|
|
2109
2121
|
titleTextColor,
|
|
2122
|
+
titleTextSize,
|
|
2110
2123
|
titleTextWeight,
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
dataTourButtons,
|
|
2114
|
-
dataTourPrimaryButton,
|
|
2115
|
-
dataTourSecondaryButton,
|
|
2116
|
-
dataTourTertiaryButton
|
|
2124
|
+
type,
|
|
2125
|
+
validationSchema
|
|
2117
2126
|
} = props;
|
|
2118
2127
|
const validate = useYupValidationSchema(validationSchema, language);
|
|
2119
2128
|
const onRefFormInstance = React.useCallback(formInstance => {
|
|
@@ -2257,37 +2266,74 @@ FinalForm.propTypes = {
|
|
|
2257
2266
|
additionalProps: PropTypes__default.default.object,
|
|
2258
2267
|
after: PropTypes__default.default.any,
|
|
2259
2268
|
before: PropTypes__default.default.any,
|
|
2269
|
+
buttonDirection: PropTypes__default.default.string,
|
|
2270
|
+
buttonFill: PropTypes__default.default.string,
|
|
2260
2271
|
buttonGap: PropTypes__default.default.string,
|
|
2272
|
+
buttonJustifyContent: PropTypes__default.default.string,
|
|
2273
|
+
buttonPadding: PropTypes__default.default.string,
|
|
2261
2274
|
className: PropTypes__default.default.string,
|
|
2262
2275
|
config: PropTypes__default.default.object,
|
|
2276
|
+
dataTour: PropTypes__default.default.string,
|
|
2277
|
+
dataTourButtons: PropTypes__default.default.string,
|
|
2278
|
+
dataTourPrimaryButton: PropTypes__default.default.string,
|
|
2279
|
+
dataTourSecondaryButton: PropTypes__default.default.string,
|
|
2280
|
+
dataTourTertiaryButton: PropTypes__default.default.string,
|
|
2263
2281
|
description: PropTypes__default.default.string,
|
|
2264
2282
|
descriptionSize: PropTypes__default.default.string,
|
|
2265
2283
|
descriptionTextColor: PropTypes__default.default.string,
|
|
2266
2284
|
descriptionTextWeight: PropTypes__default.default.string,
|
|
2267
|
-
disableFieldsAutoComplete: PropTypes__default.default.
|
|
2285
|
+
disableFieldsAutoComplete: PropTypes__default.default.bool,
|
|
2268
2286
|
fieldsGap: PropTypes__default.default.string,
|
|
2269
2287
|
formName: PropTypes__default.default.string,
|
|
2288
|
+
groupGap: PropTypes__default.default.string,
|
|
2270
2289
|
initialValues: PropTypes__default.default.any,
|
|
2271
2290
|
initialValuesEqual: PropTypes__default.default.any,
|
|
2272
|
-
language: PropTypes__default.default.string,
|
|
2273
2291
|
isLoading: PropTypes__default.default.bool,
|
|
2292
|
+
language: PropTypes__default.default.string,
|
|
2293
|
+
loader: PropTypes__default.default.element,
|
|
2294
|
+
loaderFill: PropTypes__default.default.string,
|
|
2295
|
+
loaderItemFill: PropTypes__default.default.string,
|
|
2296
|
+
loaderSet: PropTypes__default.default.string,
|
|
2274
2297
|
loaderText: PropTypes__default.default.string,
|
|
2275
2298
|
mutators: PropTypes__default.default.any,
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
primaryButton: PropTypes__default.default.string,
|
|
2299
|
+
notificationCloseButton: PropTypes__default.default.element,
|
|
2300
|
+
notificationType: PropTypes__default.default.string,
|
|
2301
|
+
primaryButton: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.element]),
|
|
2280
2302
|
primaryButtonFill: PropTypes__default.default.string,
|
|
2303
|
+
primaryButtonFillHover: PropTypes__default.default.string,
|
|
2281
2304
|
primaryButtonLabel: PropTypes__default.default.string,
|
|
2282
|
-
|
|
2305
|
+
primaryButtonLabelSize: PropTypes__default.default.string,
|
|
2306
|
+
primaryButtonLabelTextColor: PropTypes__default.default.string,
|
|
2307
|
+
primaryButtonLabelTextWeight: PropTypes__default.default.string,
|
|
2308
|
+
primaryButtonSize: PropTypes__default.default.string,
|
|
2309
|
+
secondaryButton: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.element]),
|
|
2283
2310
|
secondaryButtonFill: PropTypes__default.default.string,
|
|
2311
|
+
secondaryButtonFillHover: PropTypes__default.default.string,
|
|
2284
2312
|
secondaryButtonLabel: PropTypes__default.default.string,
|
|
2313
|
+
secondaryButtonLabelSize: PropTypes__default.default.string,
|
|
2314
|
+
secondaryButtonLabelTextColor: PropTypes__default.default.string,
|
|
2315
|
+
secondaryButtonLabelTextWeight: PropTypes__default.default.string,
|
|
2316
|
+
secondaryButtonSize: PropTypes__default.default.string,
|
|
2285
2317
|
set: PropTypes__default.default.string,
|
|
2318
|
+
tertiaryButton: PropTypes__default.default.element,
|
|
2319
|
+
tertiaryButtonFill: PropTypes__default.default.string,
|
|
2320
|
+
tertiaryButtonFillHover: PropTypes__default.default.string,
|
|
2321
|
+
tertiaryButtonLabel: PropTypes__default.default.string,
|
|
2322
|
+
tertiaryButtonLabelSize: PropTypes__default.default.string,
|
|
2323
|
+
tertiaryButtonLabelTextColor: PropTypes__default.default.string,
|
|
2324
|
+
tertiaryButtonLabelTextWeight: PropTypes__default.default.string,
|
|
2325
|
+
tertiaryButtonSize: PropTypes__default.default.string,
|
|
2286
2326
|
title: PropTypes__default.default.string,
|
|
2287
2327
|
titleSize: PropTypes__default.default.string,
|
|
2288
2328
|
titleTextColor: PropTypes__default.default.string,
|
|
2329
|
+
titleTextSize: PropTypes__default.default.string,
|
|
2289
2330
|
titleTextWeight: PropTypes__default.default.string,
|
|
2290
|
-
|
|
2331
|
+
type: PropTypes__default.default.string,
|
|
2332
|
+
validationSchema: PropTypes__default.default.object,
|
|
2333
|
+
onChangeFormValues: PropTypes__default.default.func,
|
|
2334
|
+
onClickSecondaryButton: PropTypes__default.default.func,
|
|
2335
|
+
onClickTertiaryButton: PropTypes__default.default.func,
|
|
2336
|
+
onSubmit: PropTypes__default.default.func
|
|
2291
2337
|
};
|
|
2292
2338
|
FinalForm.defaultProps = {
|
|
2293
2339
|
additionalProps: {},
|
|
@@ -2302,15 +2348,15 @@ FinalForm.defaultProps = {
|
|
|
2302
2348
|
disableFieldsAutoComplete: false
|
|
2303
2349
|
};
|
|
2304
2350
|
|
|
2305
|
-
Object.defineProperty(exports,
|
|
2351
|
+
Object.defineProperty(exports, "Field", {
|
|
2306
2352
|
enumerable: true,
|
|
2307
2353
|
get: function () { return reactFinalForm.Field; }
|
|
2308
2354
|
});
|
|
2309
|
-
Object.defineProperty(exports,
|
|
2355
|
+
Object.defineProperty(exports, "useForm", {
|
|
2310
2356
|
enumerable: true,
|
|
2311
2357
|
get: function () { return reactFinalForm.useForm; }
|
|
2312
2358
|
});
|
|
2313
|
-
Object.defineProperty(exports,
|
|
2359
|
+
Object.defineProperty(exports, "useFormState", {
|
|
2314
2360
|
enumerable: true,
|
|
2315
2361
|
get: function () { return reactFinalForm.useFormState; }
|
|
2316
2362
|
});
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -401,22 +401,29 @@ CheckboxField.propTypes = {
|
|
|
401
401
|
|
|
402
402
|
const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
403
403
|
const {
|
|
404
|
-
options,
|
|
405
404
|
classNameGroupItem,
|
|
406
405
|
fieldProps,
|
|
406
|
+
hideMessage,
|
|
407
|
+
initialValue,
|
|
407
408
|
inputProps,
|
|
408
409
|
isMultiple,
|
|
409
410
|
isRequired,
|
|
410
|
-
initialValue,
|
|
411
411
|
label,
|
|
412
|
-
name,
|
|
413
412
|
messageType,
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
name,
|
|
414
|
+
options,
|
|
415
|
+
placeholder,
|
|
416
|
+
onChange
|
|
416
417
|
} = props;
|
|
417
418
|
const {
|
|
418
419
|
change
|
|
419
420
|
} = useForm();
|
|
421
|
+
const setActiveSegment = useCallback((option, isChecked) => {
|
|
422
|
+
change(name, isChecked && option.value);
|
|
423
|
+
if (onChange) {
|
|
424
|
+
onChange(option.value, name, isChecked);
|
|
425
|
+
}
|
|
426
|
+
}, [change]);
|
|
420
427
|
return /*#__PURE__*/React.createElement(Field, {
|
|
421
428
|
name: name,
|
|
422
429
|
initialValue: initialValue
|
|
@@ -435,9 +442,6 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
435
442
|
}
|
|
436
443
|
return emptyOption;
|
|
437
444
|
}, [input.value]);
|
|
438
|
-
const setActiveSegment = useCallback(option => {
|
|
439
|
-
change(name, option.value);
|
|
440
|
-
}, [change]);
|
|
441
445
|
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
442
446
|
className: clsx('form-field_type_choice', 'form__item_type_choice', classNameGroupItem),
|
|
443
447
|
fieldClassName: "form-choice",
|
|
@@ -457,7 +461,7 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
457
461
|
}, fieldProps), /*#__PURE__*/React.createElement(Choice, Object.assign({
|
|
458
462
|
className: clsx(meta.active && 'form-choice_state_focus', meta.error && meta.touched && 'form-choice_state_error'),
|
|
459
463
|
options: options,
|
|
460
|
-
|
|
464
|
+
name: input.name,
|
|
461
465
|
inputValue: input.value || [],
|
|
462
466
|
isMultiple: isMultiple,
|
|
463
467
|
isRequired: isRequired,
|
|
@@ -468,14 +472,22 @@ const ChoiceField = /*#__PURE__*/React.memo(function ChoiceField(props) {
|
|
|
468
472
|
});
|
|
469
473
|
});
|
|
470
474
|
ChoiceField.propTypes = {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
+
classNameGroupItem: PropTypes.string,
|
|
476
|
+
fieldProps: PropTypes.object,
|
|
477
|
+
hideMessage: PropTypes.bool,
|
|
478
|
+
initialValue: PropTypes.string,
|
|
479
|
+
inputProps: PropTypes.object,
|
|
475
480
|
isMultiple: PropTypes.bool,
|
|
476
481
|
isRequired: PropTypes.bool,
|
|
477
482
|
label: PropTypes.string,
|
|
478
|
-
|
|
483
|
+
messageType: PropTypes.string,
|
|
484
|
+
name: PropTypes.string,
|
|
485
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
486
|
+
value: PropTypes.string,
|
|
487
|
+
label: PropTypes.string
|
|
488
|
+
})),
|
|
489
|
+
placeholder: PropTypes.string,
|
|
490
|
+
onChange: PropTypes.func
|
|
479
491
|
};
|
|
480
492
|
|
|
481
493
|
const CustomField = /*#__PURE__*/React.memo(function CustomField(props) {
|
|
@@ -697,7 +709,6 @@ async function convertToFiles(inputValue, isPreviews) {
|
|
|
697
709
|
// })
|
|
698
710
|
// }
|
|
699
711
|
}
|
|
700
|
-
|
|
701
712
|
return newFiles;
|
|
702
713
|
}
|
|
703
714
|
function setFileDataURL(file, resolve) {
|
|
@@ -1630,16 +1641,15 @@ function getDefaultValue(options, selectValue) {
|
|
|
1630
1641
|
}
|
|
1631
1642
|
const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
1632
1643
|
const {
|
|
1644
|
+
classNameGroupItem,
|
|
1645
|
+
fieldProps,
|
|
1646
|
+
hideMessage,
|
|
1633
1647
|
isRequired,
|
|
1634
|
-
key,
|
|
1635
1648
|
name,
|
|
1636
1649
|
options,
|
|
1637
|
-
fieldProps,
|
|
1638
1650
|
selectProps,
|
|
1639
1651
|
selectRef,
|
|
1640
|
-
onChange
|
|
1641
|
-
classNameGroupItem,
|
|
1642
|
-
hideMessage
|
|
1652
|
+
onChange
|
|
1643
1653
|
} = props;
|
|
1644
1654
|
return /*#__PURE__*/React.createElement(Field, {
|
|
1645
1655
|
name: name
|
|
@@ -1647,12 +1657,6 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1647
1657
|
input,
|
|
1648
1658
|
meta
|
|
1649
1659
|
}) => {
|
|
1650
|
-
const onChangeField = useCallback(value => {
|
|
1651
|
-
input.onChange(value);
|
|
1652
|
-
if (onChange) {
|
|
1653
|
-
onChange(value, input.name);
|
|
1654
|
-
}
|
|
1655
|
-
}, [onChange]);
|
|
1656
1660
|
const [selectedOptions, setSelectedOptions] = useState(null);
|
|
1657
1661
|
const defaultValue = useMemo(() => {
|
|
1658
1662
|
const optionsValues = getDefaultValue(options, input.value);
|
|
@@ -1664,12 +1668,18 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1664
1668
|
}
|
|
1665
1669
|
return optionsValues;
|
|
1666
1670
|
}, [input.value]);
|
|
1667
|
-
|
|
1671
|
+
const onChangeField = useCallback(value => {
|
|
1672
|
+
input.onChange(value);
|
|
1673
|
+
if (onChange) {
|
|
1674
|
+
onChange(value, input.name);
|
|
1675
|
+
}
|
|
1676
|
+
}, [onChange]);
|
|
1668
1677
|
const onChangeValue = useCallback((option, actionMeta) => {
|
|
1669
1678
|
const value = Array.isArray(option) ? option.map(o => o.value) : option?.value || null;
|
|
1670
1679
|
setSelectedOptions(option);
|
|
1671
1680
|
onChangeField(value);
|
|
1672
1681
|
}, [onChangeField]);
|
|
1682
|
+
useEffect(() => setSelectedOptions(defaultValue), [defaultValue]);
|
|
1673
1683
|
return /*#__PURE__*/React.createElement(FieldWrapper, Object.assign({
|
|
1674
1684
|
className: clsx('form-field_type_select', 'form__item_type_select', classNameGroupItem),
|
|
1675
1685
|
fieldClassName: 'form-select',
|
|
@@ -1690,8 +1700,7 @@ const SelectField = /*#__PURE__*/React.memo(function SelectField(props) {
|
|
|
1690
1700
|
value: selectedOptions,
|
|
1691
1701
|
onChange: onChangeValue,
|
|
1692
1702
|
options: options,
|
|
1693
|
-
ref: selectRef
|
|
1694
|
-
key: key
|
|
1703
|
+
ref: selectRef
|
|
1695
1704
|
}, selectProps)));
|
|
1696
1705
|
});
|
|
1697
1706
|
});
|
|
@@ -2038,11 +2047,17 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2038
2047
|
after,
|
|
2039
2048
|
before,
|
|
2040
2049
|
buttonDirection,
|
|
2050
|
+
buttonFill,
|
|
2041
2051
|
buttonGap,
|
|
2052
|
+
buttonJustifyContent,
|
|
2042
2053
|
buttonPadding,
|
|
2043
|
-
groupGap,
|
|
2044
2054
|
className,
|
|
2045
2055
|
config,
|
|
2056
|
+
dataTour,
|
|
2057
|
+
dataTourButtons,
|
|
2058
|
+
dataTourPrimaryButton,
|
|
2059
|
+
dataTourSecondaryButton,
|
|
2060
|
+
dataTourTertiaryButton,
|
|
2046
2061
|
description,
|
|
2047
2062
|
descriptionSize,
|
|
2048
2063
|
descriptionTextColor,
|
|
@@ -2050,60 +2065,54 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
|
2050
2065
|
disableFieldsAutoComplete,
|
|
2051
2066
|
fieldsGap,
|
|
2052
2067
|
formName,
|
|
2068
|
+
groupGap,
|
|
2053
2069
|
initialValues,
|
|
2054
2070
|
initialValuesEqual,
|
|
2055
2071
|
isLoading,
|
|
2072
|
+
language,
|
|
2056
2073
|
loader,
|
|
2057
|
-
loaderSet,
|
|
2058
2074
|
loaderFill,
|
|
2059
2075
|
loaderItemFill,
|
|
2076
|
+
loaderSet,
|
|
2060
2077
|
loaderText,
|
|
2061
|
-
language,
|
|
2062
2078
|
mutators,
|
|
2079
|
+
notificationCloseButton,
|
|
2080
|
+
notificationType,
|
|
2063
2081
|
onChangeFormValues,
|
|
2064
2082
|
onClickSecondaryButton,
|
|
2065
2083
|
onClickTertiaryButton,
|
|
2066
2084
|
onSubmit,
|
|
2067
2085
|
primaryButton,
|
|
2068
|
-
primaryButtonLabel,
|
|
2069
|
-
secondaryButton,
|
|
2070
|
-
secondaryButtonLabel,
|
|
2071
2086
|
primaryButtonFill,
|
|
2072
2087
|
primaryButtonFillHover,
|
|
2073
|
-
|
|
2074
|
-
secondaryButtonFillHover,
|
|
2075
|
-
primaryButtonSize,
|
|
2076
|
-
primaryButtonLabelTextColor,
|
|
2088
|
+
primaryButtonLabel,
|
|
2077
2089
|
primaryButtonLabelSize,
|
|
2090
|
+
primaryButtonLabelTextColor,
|
|
2078
2091
|
primaryButtonLabelTextWeight,
|
|
2079
|
-
|
|
2080
|
-
|
|
2092
|
+
primaryButtonSize,
|
|
2093
|
+
secondaryButton,
|
|
2094
|
+
secondaryButtonFill,
|
|
2095
|
+
secondaryButtonFillHover,
|
|
2096
|
+
secondaryButtonLabel,
|
|
2081
2097
|
secondaryButtonLabelSize,
|
|
2098
|
+
secondaryButtonLabelTextColor,
|
|
2082
2099
|
secondaryButtonLabelTextWeight,
|
|
2100
|
+
secondaryButtonSize,
|
|
2101
|
+
set,
|
|
2083
2102
|
tertiaryButton,
|
|
2084
2103
|
tertiaryButtonFill,
|
|
2085
2104
|
tertiaryButtonFillHover,
|
|
2086
|
-
|
|
2087
|
-
tertiaryButtonLabelTextColor,
|
|
2105
|
+
tertiaryButtonLabel,
|
|
2088
2106
|
tertiaryButtonLabelSize,
|
|
2107
|
+
tertiaryButtonLabelTextColor,
|
|
2089
2108
|
tertiaryButtonLabelTextWeight,
|
|
2090
|
-
|
|
2091
|
-
set,
|
|
2092
|
-
type,
|
|
2093
|
-
buttonJustifyContent,
|
|
2109
|
+
tertiaryButtonSize,
|
|
2094
2110
|
title,
|
|
2095
|
-
notificationType,
|
|
2096
|
-
notificationCloseButton,
|
|
2097
|
-
buttonFill,
|
|
2098
|
-
titleTextSize,
|
|
2099
2111
|
titleTextColor,
|
|
2112
|
+
titleTextSize,
|
|
2100
2113
|
titleTextWeight,
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
dataTourButtons,
|
|
2104
|
-
dataTourPrimaryButton,
|
|
2105
|
-
dataTourSecondaryButton,
|
|
2106
|
-
dataTourTertiaryButton
|
|
2114
|
+
type,
|
|
2115
|
+
validationSchema
|
|
2107
2116
|
} = props;
|
|
2108
2117
|
const validate = useYupValidationSchema(validationSchema, language);
|
|
2109
2118
|
const onRefFormInstance = useCallback(formInstance => {
|
|
@@ -2247,37 +2256,74 @@ FinalForm.propTypes = {
|
|
|
2247
2256
|
additionalProps: PropTypes.object,
|
|
2248
2257
|
after: PropTypes.any,
|
|
2249
2258
|
before: PropTypes.any,
|
|
2259
|
+
buttonDirection: PropTypes.string,
|
|
2260
|
+
buttonFill: PropTypes.string,
|
|
2250
2261
|
buttonGap: PropTypes.string,
|
|
2262
|
+
buttonJustifyContent: PropTypes.string,
|
|
2263
|
+
buttonPadding: PropTypes.string,
|
|
2251
2264
|
className: PropTypes.string,
|
|
2252
2265
|
config: PropTypes.object,
|
|
2266
|
+
dataTour: PropTypes.string,
|
|
2267
|
+
dataTourButtons: PropTypes.string,
|
|
2268
|
+
dataTourPrimaryButton: PropTypes.string,
|
|
2269
|
+
dataTourSecondaryButton: PropTypes.string,
|
|
2270
|
+
dataTourTertiaryButton: PropTypes.string,
|
|
2253
2271
|
description: PropTypes.string,
|
|
2254
2272
|
descriptionSize: PropTypes.string,
|
|
2255
2273
|
descriptionTextColor: PropTypes.string,
|
|
2256
2274
|
descriptionTextWeight: PropTypes.string,
|
|
2257
|
-
disableFieldsAutoComplete: PropTypes.
|
|
2275
|
+
disableFieldsAutoComplete: PropTypes.bool,
|
|
2258
2276
|
fieldsGap: PropTypes.string,
|
|
2259
2277
|
formName: PropTypes.string,
|
|
2278
|
+
groupGap: PropTypes.string,
|
|
2260
2279
|
initialValues: PropTypes.any,
|
|
2261
2280
|
initialValuesEqual: PropTypes.any,
|
|
2262
|
-
language: PropTypes.string,
|
|
2263
2281
|
isLoading: PropTypes.bool,
|
|
2282
|
+
language: PropTypes.string,
|
|
2283
|
+
loader: PropTypes.element,
|
|
2284
|
+
loaderFill: PropTypes.string,
|
|
2285
|
+
loaderItemFill: PropTypes.string,
|
|
2286
|
+
loaderSet: PropTypes.string,
|
|
2264
2287
|
loaderText: PropTypes.string,
|
|
2265
2288
|
mutators: PropTypes.any,
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
primaryButton: PropTypes.string,
|
|
2289
|
+
notificationCloseButton: PropTypes.element,
|
|
2290
|
+
notificationType: PropTypes.string,
|
|
2291
|
+
primaryButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
2270
2292
|
primaryButtonFill: PropTypes.string,
|
|
2293
|
+
primaryButtonFillHover: PropTypes.string,
|
|
2271
2294
|
primaryButtonLabel: PropTypes.string,
|
|
2272
|
-
|
|
2295
|
+
primaryButtonLabelSize: PropTypes.string,
|
|
2296
|
+
primaryButtonLabelTextColor: PropTypes.string,
|
|
2297
|
+
primaryButtonLabelTextWeight: PropTypes.string,
|
|
2298
|
+
primaryButtonSize: PropTypes.string,
|
|
2299
|
+
secondaryButton: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
2273
2300
|
secondaryButtonFill: PropTypes.string,
|
|
2301
|
+
secondaryButtonFillHover: PropTypes.string,
|
|
2274
2302
|
secondaryButtonLabel: PropTypes.string,
|
|
2303
|
+
secondaryButtonLabelSize: PropTypes.string,
|
|
2304
|
+
secondaryButtonLabelTextColor: PropTypes.string,
|
|
2305
|
+
secondaryButtonLabelTextWeight: PropTypes.string,
|
|
2306
|
+
secondaryButtonSize: PropTypes.string,
|
|
2275
2307
|
set: PropTypes.string,
|
|
2308
|
+
tertiaryButton: PropTypes.element,
|
|
2309
|
+
tertiaryButtonFill: PropTypes.string,
|
|
2310
|
+
tertiaryButtonFillHover: PropTypes.string,
|
|
2311
|
+
tertiaryButtonLabel: PropTypes.string,
|
|
2312
|
+
tertiaryButtonLabelSize: PropTypes.string,
|
|
2313
|
+
tertiaryButtonLabelTextColor: PropTypes.string,
|
|
2314
|
+
tertiaryButtonLabelTextWeight: PropTypes.string,
|
|
2315
|
+
tertiaryButtonSize: PropTypes.string,
|
|
2276
2316
|
title: PropTypes.string,
|
|
2277
2317
|
titleSize: PropTypes.string,
|
|
2278
2318
|
titleTextColor: PropTypes.string,
|
|
2319
|
+
titleTextSize: PropTypes.string,
|
|
2279
2320
|
titleTextWeight: PropTypes.string,
|
|
2280
|
-
|
|
2321
|
+
type: PropTypes.string,
|
|
2322
|
+
validationSchema: PropTypes.object,
|
|
2323
|
+
onChangeFormValues: PropTypes.func,
|
|
2324
|
+
onClickSecondaryButton: PropTypes.func,
|
|
2325
|
+
onClickTertiaryButton: PropTypes.func,
|
|
2326
|
+
onSubmit: PropTypes.func
|
|
2281
2327
|
};
|
|
2282
2328
|
FinalForm.defaultProps = {
|
|
2283
2329
|
additionalProps: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/forms",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "Forms fields, inputs, etc.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@itcase/common": "^1.1.10",
|
|
34
|
-
"@itcase/ui": "^1.0.
|
|
34
|
+
"@itcase/ui": "^1.0.84",
|
|
35
35
|
"axios": "^1.6.2",
|
|
36
36
|
"clsx": "^2.0.0",
|
|
37
37
|
"date-fns": "2.0.0-alpha.7",
|
|
38
38
|
"final-form": "^4.20.10",
|
|
39
39
|
"final-form-focus": "^1.1.2",
|
|
40
|
-
"libphonenumber-js": "^1.10.
|
|
40
|
+
"libphonenumber-js": "^1.10.51",
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
42
|
"luxon": "^3.4.4",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
@@ -49,37 +49,37 @@
|
|
|
49
49
|
"react-select": "^5.8.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@babel/core": "^7.23.
|
|
52
|
+
"@babel/core": "^7.23.6",
|
|
53
53
|
"@babel/eslint-parser": "^7.23.3",
|
|
54
|
-
"@babel/preset-env": "^7.23.
|
|
54
|
+
"@babel/preset-env": "^7.23.6",
|
|
55
55
|
"@babel/preset-react": "^7.23.3",
|
|
56
|
-
"@commitlint/cli": "^18.4.
|
|
57
|
-
"@commitlint/config-conventional": "^18.4.
|
|
56
|
+
"@commitlint/cli": "^18.4.3",
|
|
57
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
58
58
|
"@rollup/plugin-babel": "^6.0.4",
|
|
59
59
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
60
|
-
"@rollup/plugin-json": "^6.0
|
|
60
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
61
61
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
62
62
|
"@rollup/plugin-terser": "^0.4.4",
|
|
63
63
|
"@semantic-release/git": "^10.0.1",
|
|
64
64
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
65
65
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
66
|
-
"eslint": "8.
|
|
67
|
-
"eslint-config-prettier": "^9.
|
|
66
|
+
"eslint": "8.55.0",
|
|
67
|
+
"eslint-config-prettier": "^9.1.0",
|
|
68
68
|
"eslint-config-standard": "^17.1.0",
|
|
69
|
-
"eslint-plugin-import": "^2.29.
|
|
70
|
-
"eslint-plugin-n": "^16.
|
|
69
|
+
"eslint-plugin-import": "^2.29.1",
|
|
70
|
+
"eslint-plugin-n": "^16.4.0",
|
|
71
71
|
"eslint-plugin-prettier": "^5.0.1",
|
|
72
72
|
"eslint-plugin-promise": "^6.1.1",
|
|
73
73
|
"eslint-plugin-react": "^7.33.2",
|
|
74
74
|
"eslint-plugin-standard": "^5.0.0",
|
|
75
75
|
"husky": "^8.0.3",
|
|
76
|
-
"lint-staged": "^15.
|
|
77
|
-
"npm": "^10.2.
|
|
76
|
+
"lint-staged": "^15.2.0",
|
|
77
|
+
"npm": "^10.2.5",
|
|
78
78
|
"postcss-aspect-ratio-polyfill": "^2.0.0",
|
|
79
|
-
"postcss-cli": "^
|
|
79
|
+
"postcss-cli": "^11.0.0",
|
|
80
80
|
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
81
|
-
"postcss-dark-theme-class": "^1.
|
|
82
|
-
"postcss-discard-duplicates": "^6.0.
|
|
81
|
+
"postcss-dark-theme-class": "^1.1.0",
|
|
82
|
+
"postcss-discard-duplicates": "^6.0.1",
|
|
83
83
|
"postcss-each": "^1.1.0",
|
|
84
84
|
"postcss-easings": "^4.0.0",
|
|
85
85
|
"postcss-extend-rule": "^4.0.0",
|
|
@@ -96,14 +96,14 @@
|
|
|
96
96
|
"postcss-pxtorem": "^6.0.0",
|
|
97
97
|
"postcss-responsive-type": "github:ITCase/postcss-responsive-type",
|
|
98
98
|
"postcss-sort-media-queries": "^5.2.0",
|
|
99
|
-
"prettier": "^3.1.
|
|
100
|
-
"react-datepicker": "^4.
|
|
101
|
-
"rollup": "^4.
|
|
99
|
+
"prettier": "^3.1.1",
|
|
100
|
+
"react-datepicker": "^4.24.0",
|
|
101
|
+
"rollup": "^4.9.0",
|
|
102
102
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
103
|
-
"semantic-release": "^22.0.
|
|
104
|
-
"stylelint": "^
|
|
105
|
-
"stylelint-config-standard": "^
|
|
103
|
+
"semantic-release": "^22.0.12",
|
|
104
|
+
"stylelint": "^16.0.2",
|
|
105
|
+
"stylelint-config-standard": "^35.0.0",
|
|
106
106
|
"stylelint-no-unsupported-browser-features": "^7.0.0",
|
|
107
|
-
"stylelint-order": "^6.0.
|
|
107
|
+
"stylelint-order": "^6.0.4"
|
|
108
108
|
}
|
|
109
109
|
}
|