@itcase/forms 1.0.13 → 1.0.15
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.
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
z-index: 1;
|
|
6
6
|
outline: 0;
|
|
7
7
|
@mixin easing easeOutQuart, all, 0.2s;
|
|
8
|
+
&-wrapper {
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 20px;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
flex-flow: row wrap;
|
|
13
|
+
}
|
|
8
14
|
&_size {
|
|
9
15
|
@each $size in normal, compact {
|
|
10
16
|
&_$(size) {
|
|
@@ -15,6 +21,7 @@
|
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
^&__hint {
|
|
24
|
+
width: 100%;
|
|
18
25
|
min-height: 120px;
|
|
19
26
|
display: flex;
|
|
20
27
|
flex-flow: column nowrap;
|
|
@@ -41,6 +48,7 @@
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
&__thumb {
|
|
51
|
+
flex: 30%;
|
|
44
52
|
display: grid;
|
|
45
53
|
column-gap: 8px;
|
|
46
54
|
grid-template-columns: min-content 1fr;
|
|
@@ -48,8 +56,8 @@
|
|
|
48
56
|
margin: 0 0 16px 0;
|
|
49
57
|
padding: 8px 16px 8px 8px;
|
|
50
58
|
&-image {
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
59
|
+
width: 160px;
|
|
60
|
+
height: 160px;
|
|
53
61
|
grid-column-start: 1;
|
|
54
62
|
grid-row-start: span 2;
|
|
55
63
|
display: flex;
|
|
@@ -220,6 +220,21 @@
|
|
|
220
220
|
margin: 30px 0 0 0;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
+
.form-notification {
|
|
224
|
+
&_type {
|
|
225
|
+
&_sticky {
|
|
226
|
+
z-index: 100;
|
|
227
|
+
position: sticky;
|
|
228
|
+
top: 20px;
|
|
229
|
+
left: 0;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
&__item {
|
|
233
|
+
text-align: center;
|
|
234
|
+
padding: 20px;
|
|
235
|
+
border-radius: 12px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
223
238
|
.form {
|
|
224
239
|
&_type_bottom-button {
|
|
225
240
|
flex: 1;
|
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -1345,6 +1345,10 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1345
1345
|
prefix: 'border-color_',
|
|
1346
1346
|
propsKey: 'thumbBorderColor'
|
|
1347
1347
|
});
|
|
1348
|
+
var thumbBorderColorHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
1349
|
+
prefix: 'border-color_hover_',
|
|
1350
|
+
propsKey: 'thumbBorderColorHover'
|
|
1351
|
+
});
|
|
1348
1352
|
var thumbBorderTypeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
1349
1353
|
prefix: 'border_type_',
|
|
1350
1354
|
propsKey: 'thumbBorderType'
|
|
@@ -1357,7 +1361,7 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1357
1361
|
className: clsx__default.default('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderColorHoverClass, borderTypeClass)
|
|
1358
1362
|
}, files.map(function (file, i) {
|
|
1359
1363
|
return /*#__PURE__*/React__default.default.createElement("aside", {
|
|
1360
|
-
className: clsx__default.default('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderTypeClass),
|
|
1364
|
+
className: clsx__default.default('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderColorHoverClass, thumbBorderTypeClass),
|
|
1361
1365
|
key: "" + (file.id || file.name + "_" + i || 'i' + i)
|
|
1362
1366
|
}, isPreviews && /*#__PURE__*/React__default.default.createElement("div", {
|
|
1363
1367
|
className: "form-dropzone__thumb-image"
|
|
@@ -1449,6 +1453,7 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1449
1453
|
label = props.label,
|
|
1450
1454
|
thumbBorderWidth = props.thumbBorderWidth,
|
|
1451
1455
|
thumbBorderColor = props.thumbBorderColor,
|
|
1456
|
+
thumbBorderColorHover = props.thumbBorderColorHover,
|
|
1452
1457
|
thumbBorderType = props.thumbBorderType,
|
|
1453
1458
|
removeThumbTextHoverColor = props.removeThumbTextHoverColor,
|
|
1454
1459
|
labelTextColor = props.labelTextColor,
|
|
@@ -1511,6 +1516,7 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1511
1516
|
borderType: borderType,
|
|
1512
1517
|
thumbBorderWidth: thumbBorderWidth,
|
|
1513
1518
|
thumbBorderColor: thumbBorderColor,
|
|
1519
|
+
thumbBorderColorHover: thumbBorderColorHover,
|
|
1514
1520
|
thumbBorderType: thumbBorderType,
|
|
1515
1521
|
fill: fill,
|
|
1516
1522
|
size: size,
|
|
@@ -2145,8 +2151,12 @@ TextareaField.propTypes = {
|
|
|
2145
2151
|
inputProps: PropTypes__default.default.object
|
|
2146
2152
|
};
|
|
2147
2153
|
|
|
2148
|
-
function focusOnError(formElementsList, errors) {
|
|
2154
|
+
var focusOnError = function focusOnError(formElementsList, errors) {
|
|
2149
2155
|
var selectsIds = Object.keys(errors).map(function (fieldName) {
|
|
2156
|
+
if (fieldName === finalForm.FORM_ERROR) {
|
|
2157
|
+
// TODO: get from somewhere
|
|
2158
|
+
return 'notification__item_status_error';
|
|
2159
|
+
}
|
|
2150
2160
|
return "react-select-id_" + fieldName + "-input";
|
|
2151
2161
|
});
|
|
2152
2162
|
var errorFieldElement = formElementsList.find(function (element) {
|
|
@@ -2160,9 +2170,14 @@ function focusOnError(formElementsList, errors) {
|
|
|
2160
2170
|
if (!errorFieldElement && errorsList.length) {
|
|
2161
2171
|
var errorElement;
|
|
2162
2172
|
try {
|
|
2163
|
-
|
|
2164
|
-
if (
|
|
2165
|
-
errorElement = document.querySelector(
|
|
2173
|
+
var fieldName = errorsList[0];
|
|
2174
|
+
if (fieldName === finalForm.FORM_ERROR) {
|
|
2175
|
+
errorElement = document.querySelector('notification__item_status_error');
|
|
2176
|
+
} else {
|
|
2177
|
+
errorElement = document.querySelector("#" + fieldName + "-error");
|
|
2178
|
+
if (!errorElement) {
|
|
2179
|
+
errorElement = document.querySelector("#id_" + fieldName);
|
|
2180
|
+
}
|
|
2166
2181
|
}
|
|
2167
2182
|
} catch (err) {
|
|
2168
2183
|
console.warn(err);
|
|
@@ -2182,31 +2197,42 @@ function focusOnError(formElementsList, errors) {
|
|
|
2182
2197
|
});
|
|
2183
2198
|
}
|
|
2184
2199
|
return null;
|
|
2185
|
-
}
|
|
2200
|
+
};
|
|
2186
2201
|
var focusOnErrorDecorator = createDecorator__default.default(null, focusOnError);
|
|
2187
|
-
function setErrorsMutator(args, state) {
|
|
2202
|
+
var setErrorsMutator = function setErrorsMutator(args, state) {
|
|
2188
2203
|
var fieldName = args[0],
|
|
2189
2204
|
data = args[1];
|
|
2190
|
-
var
|
|
2205
|
+
var submitError = data.submitError;
|
|
2206
|
+
var fieldError = data.error;
|
|
2191
2207
|
if (fieldName === 'non_field_errors') {
|
|
2192
|
-
state.formState.error = fieldError;
|
|
2193
2208
|
// state.formState.invalid = true
|
|
2194
2209
|
// state.formState.valid = false
|
|
2195
|
-
state.formState.
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2210
|
+
state.formState.error = fieldError;
|
|
2211
|
+
state.formState.submitError = submitError;
|
|
2212
|
+
} else if (fieldName in state.fields) {
|
|
2213
|
+
if (fieldError) {
|
|
2214
|
+
var _Object$assign;
|
|
2215
|
+
var errorsState = Object.assign({}, state.formState.errors, (_Object$assign = {}, _Object$assign[fieldName] = fieldError, _Object$assign));
|
|
2216
|
+
state.fields[fieldName].touched = true;
|
|
2217
|
+
state.fields[fieldName].error = fieldError;
|
|
2218
|
+
state.formState.errors = errorsState;
|
|
2219
|
+
}
|
|
2220
|
+
if (submitError) {
|
|
2221
|
+
var _Object$assign2;
|
|
2222
|
+
var submitErrorsState = Object.assign({}, state.formState.submitErrors, (_Object$assign2 = {}, _Object$assign2[fieldName] = submitError, _Object$assign2));
|
|
2223
|
+
|
|
2224
|
+
// state.fields[fieldName].submitFailed = true
|
|
2225
|
+
// state.fields[fieldName].submitSucceeded = false
|
|
2226
|
+
state.fields[fieldName].submitError = submitError;
|
|
2227
|
+
state.formState.submitErrors = submitErrorsState;
|
|
2228
|
+
state.formState.submitFailed = true;
|
|
2229
|
+
state.formState.submitSucceeded = false;
|
|
2230
|
+
state.formState.lastSubmittedValues = state.formState.values;
|
|
2231
|
+
}
|
|
2203
2232
|
}
|
|
2204
|
-
}
|
|
2205
|
-
function
|
|
2206
|
-
|
|
2207
|
-
}
|
|
2208
|
-
function _sendFormDataToServer() {
|
|
2209
|
-
_sendFormDataToServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2233
|
+
};
|
|
2234
|
+
var sendFormDataToServer = /*#__PURE__*/function () {
|
|
2235
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2210
2236
|
var response, _error$response, _error$response2, formErrors;
|
|
2211
2237
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2212
2238
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2232,9 +2258,9 @@ function _sendFormDataToServer() {
|
|
|
2232
2258
|
formErrors[finalForm.FORM_ERROR] = 'Something went wrong';
|
|
2233
2259
|
}
|
|
2234
2260
|
if (typeof ((_error$response2 = _context.t0.response) == null ? void 0 : _error$response2.data) === 'object') {
|
|
2235
|
-
Object.entries(_context.t0.response.data).forEach(function (
|
|
2236
|
-
var fieldName =
|
|
2237
|
-
errorsList =
|
|
2261
|
+
Object.entries(_context.t0.response.data).forEach(function (_ref2) {
|
|
2262
|
+
var fieldName = _ref2[0],
|
|
2263
|
+
errorsList = _ref2[1];
|
|
2238
2264
|
formErrors[fieldName] = errorsList[0];
|
|
2239
2265
|
});
|
|
2240
2266
|
}
|
|
@@ -2249,8 +2275,10 @@ function _sendFormDataToServer() {
|
|
|
2249
2275
|
}
|
|
2250
2276
|
}, _callee, null, [[0, 7]]);
|
|
2251
2277
|
}));
|
|
2252
|
-
return
|
|
2253
|
-
|
|
2278
|
+
return function sendFormDataToServer(_x, _x2) {
|
|
2279
|
+
return _ref.apply(this, arguments);
|
|
2280
|
+
};
|
|
2281
|
+
}();
|
|
2254
2282
|
|
|
2255
2283
|
var formTypes = {
|
|
2256
2284
|
checkbox: 'checkbox',
|
|
@@ -2353,7 +2381,7 @@ function generateField(field, config, props) {
|
|
|
2353
2381
|
}
|
|
2354
2382
|
}
|
|
2355
2383
|
|
|
2356
|
-
var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function (props, ref) {
|
|
2384
|
+
var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalForm(props, ref) {
|
|
2357
2385
|
var additionalProps = props.additionalProps,
|
|
2358
2386
|
after = props.after,
|
|
2359
2387
|
before = props.before,
|
|
@@ -2412,6 +2440,7 @@ var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function (props,
|
|
|
2412
2440
|
type = props.type,
|
|
2413
2441
|
buttonJustifyContent = props.buttonJustifyContent,
|
|
2414
2442
|
title = props.title,
|
|
2443
|
+
notificationType = props.notificationType,
|
|
2415
2444
|
buttonFill = props.buttonFill,
|
|
2416
2445
|
titleTextSize = props.titleTextSize,
|
|
2417
2446
|
titleTextColor = props.titleTextColor,
|
|
@@ -2450,105 +2479,113 @@ var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function (props,
|
|
|
2450
2479
|
decorators: [focusOnErrorDecorator],
|
|
2451
2480
|
initialValues: initialValues,
|
|
2452
2481
|
initialValuesEqual: initialValuesEqual,
|
|
2482
|
+
mutators: mutators,
|
|
2483
|
+
render: function render(_ref) {
|
|
2484
|
+
var handleSubmit = _ref.handleSubmit,
|
|
2485
|
+
submitError = _ref.submitError,
|
|
2486
|
+
modifiedSinceLastSubmit = _ref.modifiedSinceLastSubmit,
|
|
2487
|
+
form = _ref.form;
|
|
2488
|
+
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2489
|
+
style: formStyles,
|
|
2490
|
+
className: clsx__default.default(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2491
|
+
name: formName,
|
|
2492
|
+
"data-tour": dataTour,
|
|
2493
|
+
ref: function ref() {
|
|
2494
|
+
return onRefFormInstance(form);
|
|
2495
|
+
},
|
|
2496
|
+
onSubmit: handleSubmit,
|
|
2497
|
+
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2498
|
+
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2499
|
+
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2500
|
+
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2501
|
+
}, before, title && /*#__PURE__*/React__default.default.createElement(Title.Title, {
|
|
2502
|
+
className: "form__title",
|
|
2503
|
+
size: titleTextSize,
|
|
2504
|
+
textColor: titleTextColor,
|
|
2505
|
+
textWeight: titleTextWeight
|
|
2506
|
+
}, title), description && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2507
|
+
className: "form__description",
|
|
2508
|
+
size: descriptionSize,
|
|
2509
|
+
textColor: descriptionTextColor,
|
|
2510
|
+
textWeight: descriptionTextWeight
|
|
2511
|
+
}, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React__default.default.createElement("div", {
|
|
2512
|
+
className: clsx__default.default('notification', 'form-notification', notificationType && "form-notification_type_" + notificationType)
|
|
2513
|
+
}, /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
|
|
2514
|
+
className: "form-notification__item",
|
|
2515
|
+
text: form.getState().submitError,
|
|
2516
|
+
status: "error"
|
|
2517
|
+
})), onChangeFormValues && /*#__PURE__*/React__default.default.createElement(reactFinalForm.FormSpy, {
|
|
2518
|
+
subscription: {
|
|
2519
|
+
values: true
|
|
2520
|
+
},
|
|
2521
|
+
onChange: onChangeFormValues
|
|
2522
|
+
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2523
|
+
direction: "vertical",
|
|
2524
|
+
gap: fieldsGap || groupGap,
|
|
2525
|
+
className: "form__wrapper"
|
|
2526
|
+
}, Object.keys(config).map(function (key) {
|
|
2527
|
+
return generateField(config[key], {
|
|
2528
|
+
key: key
|
|
2529
|
+
}, additionalProps[config[key].name]);
|
|
2530
|
+
}), isLoading && (loader || /*#__PURE__*/React__default.default.createElement(Loader.Loader, {
|
|
2531
|
+
className: "form__loader",
|
|
2532
|
+
set: loaderSet,
|
|
2533
|
+
fill: loaderFill,
|
|
2534
|
+
itemFill: loaderItemFill,
|
|
2535
|
+
text: loaderText
|
|
2536
|
+
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2537
|
+
fill: buttonFill,
|
|
2538
|
+
justifyContent: buttonJustifyContent,
|
|
2539
|
+
direction: buttonDirection,
|
|
2540
|
+
padding: buttonPadding,
|
|
2541
|
+
gap: buttonGap,
|
|
2542
|
+
className: "form__button",
|
|
2543
|
+
dataTour: dataTourButtons
|
|
2544
|
+
}, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2545
|
+
width: "fill",
|
|
2546
|
+
className: "form__button-item",
|
|
2547
|
+
fill: primaryButtonFill,
|
|
2548
|
+
fillHover: primaryButtonFillHover,
|
|
2549
|
+
size: primaryButtonSize,
|
|
2550
|
+
labelTextColor: primaryButtonLabelTextColor,
|
|
2551
|
+
labelSize: primaryButtonLabelSize,
|
|
2552
|
+
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2553
|
+
label: primaryButtonLabel,
|
|
2554
|
+
dataTour: dataTourPrimaryButton
|
|
2555
|
+
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2556
|
+
width: "fill",
|
|
2557
|
+
className: "form__button-item",
|
|
2558
|
+
fill: secondaryButtonFill,
|
|
2559
|
+
fillHover: secondaryButtonFillHover,
|
|
2560
|
+
size: secondaryButtonSize,
|
|
2561
|
+
labelTextColor: secondaryButtonLabelTextColor,
|
|
2562
|
+
labelSize: secondaryButtonLabelSize,
|
|
2563
|
+
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2564
|
+
label: secondaryButtonLabel,
|
|
2565
|
+
onClick: onClickSecondaryButton,
|
|
2566
|
+
dataTour: dataTourSecondaryButton
|
|
2567
|
+
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2568
|
+
width: "fill",
|
|
2569
|
+
className: "form__button-item",
|
|
2570
|
+
fill: tertiaryButtonFill,
|
|
2571
|
+
fillHover: tertiaryButtonFillHover,
|
|
2572
|
+
size: tertiaryButtonSize,
|
|
2573
|
+
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2574
|
+
labelSize: tertiaryButtonLabelSize,
|
|
2575
|
+
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2576
|
+
label: tertiaryButtonLabel,
|
|
2577
|
+
onClick: onClickTertiaryButton,
|
|
2578
|
+
dataTour: dataTourTertiaryButton
|
|
2579
|
+
}) : tertiaryButton), after);
|
|
2580
|
+
},
|
|
2453
2581
|
subscription: {
|
|
2454
2582
|
submitting: true,
|
|
2455
|
-
pristine: true
|
|
2583
|
+
pristine: true,
|
|
2584
|
+
modifiedSinceLastSubmit: true,
|
|
2585
|
+
submitError: true
|
|
2456
2586
|
},
|
|
2457
|
-
mutators: mutators,
|
|
2458
2587
|
validate: validate,
|
|
2459
2588
|
onSubmit: onSubmit
|
|
2460
|
-
}, function (_ref) {
|
|
2461
|
-
var handleSubmit = _ref.handleSubmit,
|
|
2462
|
-
form = _ref.form;
|
|
2463
|
-
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2464
|
-
style: formStyles,
|
|
2465
|
-
className: clsx__default.default(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2466
|
-
name: formName,
|
|
2467
|
-
"data-tour": dataTour,
|
|
2468
|
-
ref: function ref() {
|
|
2469
|
-
return onRefFormInstance(form);
|
|
2470
|
-
},
|
|
2471
|
-
onSubmit: handleSubmit,
|
|
2472
|
-
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2473
|
-
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2474
|
-
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2475
|
-
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2476
|
-
}, before, title && /*#__PURE__*/React__default.default.createElement(Title.Title, {
|
|
2477
|
-
className: "form__title",
|
|
2478
|
-
size: titleTextSize,
|
|
2479
|
-
textColor: titleTextColor,
|
|
2480
|
-
textWeight: titleTextWeight
|
|
2481
|
-
}, title), description && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2482
|
-
className: "form__description",
|
|
2483
|
-
size: descriptionSize,
|
|
2484
|
-
textColor: descriptionTextColor,
|
|
2485
|
-
textWeight: descriptionTextWeight
|
|
2486
|
-
}, description), form.getState().submitError && /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
|
|
2487
|
-
text: form.getState().submitError,
|
|
2488
|
-
status: "error"
|
|
2489
|
-
}), onChangeFormValues && /*#__PURE__*/React__default.default.createElement(reactFinalForm.FormSpy, {
|
|
2490
|
-
subscription: {
|
|
2491
|
-
values: true
|
|
2492
|
-
},
|
|
2493
|
-
onChange: onChangeFormValues
|
|
2494
|
-
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2495
|
-
direction: "vertical",
|
|
2496
|
-
gap: fieldsGap || groupGap,
|
|
2497
|
-
className: "form__wrapper"
|
|
2498
|
-
}, Object.keys(config).map(function (key) {
|
|
2499
|
-
return generateField(config[key], {
|
|
2500
|
-
key: key
|
|
2501
|
-
}, additionalProps[config[key].name]);
|
|
2502
|
-
}), isLoading && /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, loader ? loader : /*#__PURE__*/React__default.default.createElement(Loader.Loader, {
|
|
2503
|
-
className: "form__loader",
|
|
2504
|
-
set: loaderSet,
|
|
2505
|
-
fill: loaderFill,
|
|
2506
|
-
itemFill: loaderItemFill,
|
|
2507
|
-
text: loaderText
|
|
2508
|
-
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2509
|
-
fill: buttonFill,
|
|
2510
|
-
justifyContent: buttonJustifyContent,
|
|
2511
|
-
direction: buttonDirection,
|
|
2512
|
-
padding: buttonPadding,
|
|
2513
|
-
gap: buttonGap,
|
|
2514
|
-
className: "form__button",
|
|
2515
|
-
dataTour: dataTourButtons
|
|
2516
|
-
}, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2517
|
-
width: "fill",
|
|
2518
|
-
className: "form__button-item",
|
|
2519
|
-
fill: primaryButtonFill,
|
|
2520
|
-
fillHover: primaryButtonFillHover,
|
|
2521
|
-
size: primaryButtonSize,
|
|
2522
|
-
labelTextColor: primaryButtonLabelTextColor,
|
|
2523
|
-
labelSize: primaryButtonLabelSize,
|
|
2524
|
-
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2525
|
-
label: primaryButtonLabel,
|
|
2526
|
-
dataTour: dataTourPrimaryButton
|
|
2527
|
-
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2528
|
-
width: "fill",
|
|
2529
|
-
className: "form__button-item",
|
|
2530
|
-
fill: secondaryButtonFill,
|
|
2531
|
-
fillHover: secondaryButtonFillHover,
|
|
2532
|
-
size: secondaryButtonSize,
|
|
2533
|
-
labelTextColor: secondaryButtonLabelTextColor,
|
|
2534
|
-
labelSize: secondaryButtonLabelSize,
|
|
2535
|
-
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2536
|
-
label: secondaryButtonLabel,
|
|
2537
|
-
onClick: onClickSecondaryButton,
|
|
2538
|
-
dataTour: dataTourSecondaryButton
|
|
2539
|
-
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2540
|
-
width: "fill",
|
|
2541
|
-
className: "form__button-item",
|
|
2542
|
-
fill: tertiaryButtonFill,
|
|
2543
|
-
fillHover: tertiaryButtonFillHover,
|
|
2544
|
-
size: tertiaryButtonSize,
|
|
2545
|
-
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2546
|
-
labelSize: tertiaryButtonLabelSize,
|
|
2547
|
-
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2548
|
-
label: tertiaryButtonLabel,
|
|
2549
|
-
onClick: onClickTertiaryButton,
|
|
2550
|
-
dataTour: dataTourTertiaryButton
|
|
2551
|
-
}) : tertiaryButton), after);
|
|
2552
2589
|
});
|
|
2553
2590
|
});
|
|
2554
2591
|
FinalForm.propTypes = {
|
|
@@ -2599,7 +2636,6 @@ FinalForm.defaultProps = {
|
|
|
2599
2636
|
direction: 'vertical',
|
|
2600
2637
|
disableFieldsAutoComplete: false
|
|
2601
2638
|
};
|
|
2602
|
-
FinalForm.displayName = 'FinalForm';
|
|
2603
2639
|
|
|
2604
2640
|
Object.defineProperty(exports, 'Field', {
|
|
2605
2641
|
enumerable: true,
|
package/dist/itcase-forms.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPossiblePhoneNumber } from 'libphonenumber-js';
|
|
2
2
|
import React, { useMemo, useEffect, useCallback, useState } from 'react';
|
|
3
|
-
import { setIn,
|
|
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';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -1335,6 +1335,10 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1335
1335
|
prefix: 'border-color_',
|
|
1336
1336
|
propsKey: 'thumbBorderColor'
|
|
1337
1337
|
});
|
|
1338
|
+
var thumbBorderColorHoverClass = useDeviceTargetClass(props, {
|
|
1339
|
+
prefix: 'border-color_hover_',
|
|
1340
|
+
propsKey: 'thumbBorderColorHover'
|
|
1341
|
+
});
|
|
1338
1342
|
var thumbBorderTypeClass = useDeviceTargetClass(props, {
|
|
1339
1343
|
prefix: 'border_type_',
|
|
1340
1344
|
propsKey: 'thumbBorderType'
|
|
@@ -1347,7 +1351,7 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1347
1351
|
className: clsx('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderColorHoverClass, borderTypeClass)
|
|
1348
1352
|
}, files.map(function (file, i) {
|
|
1349
1353
|
return /*#__PURE__*/React.createElement("aside", {
|
|
1350
|
-
className: clsx('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderTypeClass),
|
|
1354
|
+
className: clsx('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderColorHoverClass, thumbBorderTypeClass),
|
|
1351
1355
|
key: "" + (file.id || file.name + "_" + i || 'i' + i)
|
|
1352
1356
|
}, isPreviews && /*#__PURE__*/React.createElement("div", {
|
|
1353
1357
|
className: "form-dropzone__thumb-image"
|
|
@@ -1439,6 +1443,7 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1439
1443
|
label = props.label,
|
|
1440
1444
|
thumbBorderWidth = props.thumbBorderWidth,
|
|
1441
1445
|
thumbBorderColor = props.thumbBorderColor,
|
|
1446
|
+
thumbBorderColorHover = props.thumbBorderColorHover,
|
|
1442
1447
|
thumbBorderType = props.thumbBorderType,
|
|
1443
1448
|
removeThumbTextHoverColor = props.removeThumbTextHoverColor,
|
|
1444
1449
|
labelTextColor = props.labelTextColor,
|
|
@@ -1501,6 +1506,7 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1501
1506
|
borderType: borderType,
|
|
1502
1507
|
thumbBorderWidth: thumbBorderWidth,
|
|
1503
1508
|
thumbBorderColor: thumbBorderColor,
|
|
1509
|
+
thumbBorderColorHover: thumbBorderColorHover,
|
|
1504
1510
|
thumbBorderType: thumbBorderType,
|
|
1505
1511
|
fill: fill,
|
|
1506
1512
|
size: size,
|
|
@@ -2135,8 +2141,12 @@ TextareaField.propTypes = {
|
|
|
2135
2141
|
inputProps: PropTypes.object
|
|
2136
2142
|
};
|
|
2137
2143
|
|
|
2138
|
-
function focusOnError(formElementsList, errors) {
|
|
2144
|
+
var focusOnError = function focusOnError(formElementsList, errors) {
|
|
2139
2145
|
var selectsIds = Object.keys(errors).map(function (fieldName) {
|
|
2146
|
+
if (fieldName === FORM_ERROR) {
|
|
2147
|
+
// TODO: get from somewhere
|
|
2148
|
+
return 'notification__item_status_error';
|
|
2149
|
+
}
|
|
2140
2150
|
return "react-select-id_" + fieldName + "-input";
|
|
2141
2151
|
});
|
|
2142
2152
|
var errorFieldElement = formElementsList.find(function (element) {
|
|
@@ -2150,9 +2160,14 @@ function focusOnError(formElementsList, errors) {
|
|
|
2150
2160
|
if (!errorFieldElement && errorsList.length) {
|
|
2151
2161
|
var errorElement;
|
|
2152
2162
|
try {
|
|
2153
|
-
|
|
2154
|
-
if (
|
|
2155
|
-
errorElement = document.querySelector(
|
|
2163
|
+
var fieldName = errorsList[0];
|
|
2164
|
+
if (fieldName === FORM_ERROR) {
|
|
2165
|
+
errorElement = document.querySelector('notification__item_status_error');
|
|
2166
|
+
} else {
|
|
2167
|
+
errorElement = document.querySelector("#" + fieldName + "-error");
|
|
2168
|
+
if (!errorElement) {
|
|
2169
|
+
errorElement = document.querySelector("#id_" + fieldName);
|
|
2170
|
+
}
|
|
2156
2171
|
}
|
|
2157
2172
|
} catch (err) {
|
|
2158
2173
|
console.warn(err);
|
|
@@ -2172,31 +2187,42 @@ function focusOnError(formElementsList, errors) {
|
|
|
2172
2187
|
});
|
|
2173
2188
|
}
|
|
2174
2189
|
return null;
|
|
2175
|
-
}
|
|
2190
|
+
};
|
|
2176
2191
|
var focusOnErrorDecorator = createDecorator(null, focusOnError);
|
|
2177
|
-
function setErrorsMutator(args, state) {
|
|
2192
|
+
var setErrorsMutator = function setErrorsMutator(args, state) {
|
|
2178
2193
|
var fieldName = args[0],
|
|
2179
2194
|
data = args[1];
|
|
2180
|
-
var
|
|
2195
|
+
var submitError = data.submitError;
|
|
2196
|
+
var fieldError = data.error;
|
|
2181
2197
|
if (fieldName === 'non_field_errors') {
|
|
2182
|
-
state.formState.error = fieldError;
|
|
2183
2198
|
// state.formState.invalid = true
|
|
2184
2199
|
// state.formState.valid = false
|
|
2185
|
-
state.formState.
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2200
|
+
state.formState.error = fieldError;
|
|
2201
|
+
state.formState.submitError = submitError;
|
|
2202
|
+
} else if (fieldName in state.fields) {
|
|
2203
|
+
if (fieldError) {
|
|
2204
|
+
var _Object$assign;
|
|
2205
|
+
var errorsState = Object.assign({}, state.formState.errors, (_Object$assign = {}, _Object$assign[fieldName] = fieldError, _Object$assign));
|
|
2206
|
+
state.fields[fieldName].touched = true;
|
|
2207
|
+
state.fields[fieldName].error = fieldError;
|
|
2208
|
+
state.formState.errors = errorsState;
|
|
2209
|
+
}
|
|
2210
|
+
if (submitError) {
|
|
2211
|
+
var _Object$assign2;
|
|
2212
|
+
var submitErrorsState = Object.assign({}, state.formState.submitErrors, (_Object$assign2 = {}, _Object$assign2[fieldName] = submitError, _Object$assign2));
|
|
2213
|
+
|
|
2214
|
+
// state.fields[fieldName].submitFailed = true
|
|
2215
|
+
// state.fields[fieldName].submitSucceeded = false
|
|
2216
|
+
state.fields[fieldName].submitError = submitError;
|
|
2217
|
+
state.formState.submitErrors = submitErrorsState;
|
|
2218
|
+
state.formState.submitFailed = true;
|
|
2219
|
+
state.formState.submitSucceeded = false;
|
|
2220
|
+
state.formState.lastSubmittedValues = state.formState.values;
|
|
2221
|
+
}
|
|
2193
2222
|
}
|
|
2194
|
-
}
|
|
2195
|
-
function
|
|
2196
|
-
|
|
2197
|
-
}
|
|
2198
|
-
function _sendFormDataToServer() {
|
|
2199
|
-
_sendFormDataToServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2223
|
+
};
|
|
2224
|
+
var sendFormDataToServer = /*#__PURE__*/function () {
|
|
2225
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2200
2226
|
var response, _error$response, _error$response2, formErrors;
|
|
2201
2227
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2202
2228
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2222,9 +2248,9 @@ function _sendFormDataToServer() {
|
|
|
2222
2248
|
formErrors[FORM_ERROR] = 'Something went wrong';
|
|
2223
2249
|
}
|
|
2224
2250
|
if (typeof ((_error$response2 = _context.t0.response) == null ? void 0 : _error$response2.data) === 'object') {
|
|
2225
|
-
Object.entries(_context.t0.response.data).forEach(function (
|
|
2226
|
-
var fieldName =
|
|
2227
|
-
errorsList =
|
|
2251
|
+
Object.entries(_context.t0.response.data).forEach(function (_ref2) {
|
|
2252
|
+
var fieldName = _ref2[0],
|
|
2253
|
+
errorsList = _ref2[1];
|
|
2228
2254
|
formErrors[fieldName] = errorsList[0];
|
|
2229
2255
|
});
|
|
2230
2256
|
}
|
|
@@ -2239,8 +2265,10 @@ function _sendFormDataToServer() {
|
|
|
2239
2265
|
}
|
|
2240
2266
|
}, _callee, null, [[0, 7]]);
|
|
2241
2267
|
}));
|
|
2242
|
-
return
|
|
2243
|
-
|
|
2268
|
+
return function sendFormDataToServer(_x, _x2) {
|
|
2269
|
+
return _ref.apply(this, arguments);
|
|
2270
|
+
};
|
|
2271
|
+
}();
|
|
2244
2272
|
|
|
2245
2273
|
var formTypes = {
|
|
2246
2274
|
checkbox: 'checkbox',
|
|
@@ -2343,7 +2371,7 @@ function generateField(field, config, props) {
|
|
|
2343
2371
|
}
|
|
2344
2372
|
}
|
|
2345
2373
|
|
|
2346
|
-
var FinalForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
2374
|
+
var FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
2347
2375
|
var additionalProps = props.additionalProps,
|
|
2348
2376
|
after = props.after,
|
|
2349
2377
|
before = props.before,
|
|
@@ -2402,6 +2430,7 @@ var FinalForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2402
2430
|
type = props.type,
|
|
2403
2431
|
buttonJustifyContent = props.buttonJustifyContent,
|
|
2404
2432
|
title = props.title,
|
|
2433
|
+
notificationType = props.notificationType,
|
|
2405
2434
|
buttonFill = props.buttonFill,
|
|
2406
2435
|
titleTextSize = props.titleTextSize,
|
|
2407
2436
|
titleTextColor = props.titleTextColor,
|
|
@@ -2440,105 +2469,113 @@ var FinalForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2440
2469
|
decorators: [focusOnErrorDecorator],
|
|
2441
2470
|
initialValues: initialValues,
|
|
2442
2471
|
initialValuesEqual: initialValuesEqual,
|
|
2472
|
+
mutators: mutators,
|
|
2473
|
+
render: function render(_ref) {
|
|
2474
|
+
var handleSubmit = _ref.handleSubmit,
|
|
2475
|
+
submitError = _ref.submitError,
|
|
2476
|
+
modifiedSinceLastSubmit = _ref.modifiedSinceLastSubmit,
|
|
2477
|
+
form = _ref.form;
|
|
2478
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
2479
|
+
style: formStyles,
|
|
2480
|
+
className: clsx(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2481
|
+
name: formName,
|
|
2482
|
+
"data-tour": dataTour,
|
|
2483
|
+
ref: function ref() {
|
|
2484
|
+
return onRefFormInstance(form);
|
|
2485
|
+
},
|
|
2486
|
+
onSubmit: handleSubmit,
|
|
2487
|
+
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2488
|
+
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2489
|
+
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2490
|
+
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2491
|
+
}, before, title && /*#__PURE__*/React.createElement(Title, {
|
|
2492
|
+
className: "form__title",
|
|
2493
|
+
size: titleTextSize,
|
|
2494
|
+
textColor: titleTextColor,
|
|
2495
|
+
textWeight: titleTextWeight
|
|
2496
|
+
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
2497
|
+
className: "form__description",
|
|
2498
|
+
size: descriptionSize,
|
|
2499
|
+
textColor: descriptionTextColor,
|
|
2500
|
+
textWeight: descriptionTextWeight
|
|
2501
|
+
}, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React.createElement("div", {
|
|
2502
|
+
className: clsx('notification', 'form-notification', notificationType && "form-notification_type_" + notificationType)
|
|
2503
|
+
}, /*#__PURE__*/React.createElement(NotificationItem, {
|
|
2504
|
+
className: "form-notification__item",
|
|
2505
|
+
text: form.getState().submitError,
|
|
2506
|
+
status: "error"
|
|
2507
|
+
})), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
|
|
2508
|
+
subscription: {
|
|
2509
|
+
values: true
|
|
2510
|
+
},
|
|
2511
|
+
onChange: onChangeFormValues
|
|
2512
|
+
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2513
|
+
direction: "vertical",
|
|
2514
|
+
gap: fieldsGap || groupGap,
|
|
2515
|
+
className: "form__wrapper"
|
|
2516
|
+
}, Object.keys(config).map(function (key) {
|
|
2517
|
+
return generateField(config[key], {
|
|
2518
|
+
key: key
|
|
2519
|
+
}, additionalProps[config[key].name]);
|
|
2520
|
+
}), isLoading && (loader || /*#__PURE__*/React.createElement(Loader, {
|
|
2521
|
+
className: "form__loader",
|
|
2522
|
+
set: loaderSet,
|
|
2523
|
+
fill: loaderFill,
|
|
2524
|
+
itemFill: loaderItemFill,
|
|
2525
|
+
text: loaderText
|
|
2526
|
+
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2527
|
+
fill: buttonFill,
|
|
2528
|
+
justifyContent: buttonJustifyContent,
|
|
2529
|
+
direction: buttonDirection,
|
|
2530
|
+
padding: buttonPadding,
|
|
2531
|
+
gap: buttonGap,
|
|
2532
|
+
className: "form__button",
|
|
2533
|
+
dataTour: dataTourButtons
|
|
2534
|
+
}, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2535
|
+
width: "fill",
|
|
2536
|
+
className: "form__button-item",
|
|
2537
|
+
fill: primaryButtonFill,
|
|
2538
|
+
fillHover: primaryButtonFillHover,
|
|
2539
|
+
size: primaryButtonSize,
|
|
2540
|
+
labelTextColor: primaryButtonLabelTextColor,
|
|
2541
|
+
labelSize: primaryButtonLabelSize,
|
|
2542
|
+
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2543
|
+
label: primaryButtonLabel,
|
|
2544
|
+
dataTour: dataTourPrimaryButton
|
|
2545
|
+
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2546
|
+
width: "fill",
|
|
2547
|
+
className: "form__button-item",
|
|
2548
|
+
fill: secondaryButtonFill,
|
|
2549
|
+
fillHover: secondaryButtonFillHover,
|
|
2550
|
+
size: secondaryButtonSize,
|
|
2551
|
+
labelTextColor: secondaryButtonLabelTextColor,
|
|
2552
|
+
labelSize: secondaryButtonLabelSize,
|
|
2553
|
+
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2554
|
+
label: secondaryButtonLabel,
|
|
2555
|
+
onClick: onClickSecondaryButton,
|
|
2556
|
+
dataTour: dataTourSecondaryButton
|
|
2557
|
+
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2558
|
+
width: "fill",
|
|
2559
|
+
className: "form__button-item",
|
|
2560
|
+
fill: tertiaryButtonFill,
|
|
2561
|
+
fillHover: tertiaryButtonFillHover,
|
|
2562
|
+
size: tertiaryButtonSize,
|
|
2563
|
+
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2564
|
+
labelSize: tertiaryButtonLabelSize,
|
|
2565
|
+
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2566
|
+
label: tertiaryButtonLabel,
|
|
2567
|
+
onClick: onClickTertiaryButton,
|
|
2568
|
+
dataTour: dataTourTertiaryButton
|
|
2569
|
+
}) : tertiaryButton), after);
|
|
2570
|
+
},
|
|
2443
2571
|
subscription: {
|
|
2444
2572
|
submitting: true,
|
|
2445
|
-
pristine: true
|
|
2573
|
+
pristine: true,
|
|
2574
|
+
modifiedSinceLastSubmit: true,
|
|
2575
|
+
submitError: true
|
|
2446
2576
|
},
|
|
2447
|
-
mutators: mutators,
|
|
2448
2577
|
validate: validate,
|
|
2449
2578
|
onSubmit: onSubmit
|
|
2450
|
-
}, function (_ref) {
|
|
2451
|
-
var handleSubmit = _ref.handleSubmit,
|
|
2452
|
-
form = _ref.form;
|
|
2453
|
-
return /*#__PURE__*/React.createElement("form", {
|
|
2454
|
-
style: formStyles,
|
|
2455
|
-
className: clsx(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2456
|
-
name: formName,
|
|
2457
|
-
"data-tour": dataTour,
|
|
2458
|
-
ref: function ref() {
|
|
2459
|
-
return onRefFormInstance(form);
|
|
2460
|
-
},
|
|
2461
|
-
onSubmit: handleSubmit,
|
|
2462
|
-
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2463
|
-
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2464
|
-
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2465
|
-
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2466
|
-
}, before, title && /*#__PURE__*/React.createElement(Title, {
|
|
2467
|
-
className: "form__title",
|
|
2468
|
-
size: titleTextSize,
|
|
2469
|
-
textColor: titleTextColor,
|
|
2470
|
-
textWeight: titleTextWeight
|
|
2471
|
-
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
2472
|
-
className: "form__description",
|
|
2473
|
-
size: descriptionSize,
|
|
2474
|
-
textColor: descriptionTextColor,
|
|
2475
|
-
textWeight: descriptionTextWeight
|
|
2476
|
-
}, description), form.getState().submitError && /*#__PURE__*/React.createElement(NotificationItem, {
|
|
2477
|
-
text: form.getState().submitError,
|
|
2478
|
-
status: "error"
|
|
2479
|
-
}), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
|
|
2480
|
-
subscription: {
|
|
2481
|
-
values: true
|
|
2482
|
-
},
|
|
2483
|
-
onChange: onChangeFormValues
|
|
2484
|
-
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2485
|
-
direction: "vertical",
|
|
2486
|
-
gap: fieldsGap || groupGap,
|
|
2487
|
-
className: "form__wrapper"
|
|
2488
|
-
}, Object.keys(config).map(function (key) {
|
|
2489
|
-
return generateField(config[key], {
|
|
2490
|
-
key: key
|
|
2491
|
-
}, additionalProps[config[key].name]);
|
|
2492
|
-
}), isLoading && /*#__PURE__*/React.createElement(React.Fragment, null, loader ? loader : /*#__PURE__*/React.createElement(Loader, {
|
|
2493
|
-
className: "form__loader",
|
|
2494
|
-
set: loaderSet,
|
|
2495
|
-
fill: loaderFill,
|
|
2496
|
-
itemFill: loaderItemFill,
|
|
2497
|
-
text: loaderText
|
|
2498
|
-
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2499
|
-
fill: buttonFill,
|
|
2500
|
-
justifyContent: buttonJustifyContent,
|
|
2501
|
-
direction: buttonDirection,
|
|
2502
|
-
padding: buttonPadding,
|
|
2503
|
-
gap: buttonGap,
|
|
2504
|
-
className: "form__button",
|
|
2505
|
-
dataTour: dataTourButtons
|
|
2506
|
-
}, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2507
|
-
width: "fill",
|
|
2508
|
-
className: "form__button-item",
|
|
2509
|
-
fill: primaryButtonFill,
|
|
2510
|
-
fillHover: primaryButtonFillHover,
|
|
2511
|
-
size: primaryButtonSize,
|
|
2512
|
-
labelTextColor: primaryButtonLabelTextColor,
|
|
2513
|
-
labelSize: primaryButtonLabelSize,
|
|
2514
|
-
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2515
|
-
label: primaryButtonLabel,
|
|
2516
|
-
dataTour: dataTourPrimaryButton
|
|
2517
|
-
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2518
|
-
width: "fill",
|
|
2519
|
-
className: "form__button-item",
|
|
2520
|
-
fill: secondaryButtonFill,
|
|
2521
|
-
fillHover: secondaryButtonFillHover,
|
|
2522
|
-
size: secondaryButtonSize,
|
|
2523
|
-
labelTextColor: secondaryButtonLabelTextColor,
|
|
2524
|
-
labelSize: secondaryButtonLabelSize,
|
|
2525
|
-
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2526
|
-
label: secondaryButtonLabel,
|
|
2527
|
-
onClick: onClickSecondaryButton,
|
|
2528
|
-
dataTour: dataTourSecondaryButton
|
|
2529
|
-
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2530
|
-
width: "fill",
|
|
2531
|
-
className: "form__button-item",
|
|
2532
|
-
fill: tertiaryButtonFill,
|
|
2533
|
-
fillHover: tertiaryButtonFillHover,
|
|
2534
|
-
size: tertiaryButtonSize,
|
|
2535
|
-
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2536
|
-
labelSize: tertiaryButtonLabelSize,
|
|
2537
|
-
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2538
|
-
label: tertiaryButtonLabel,
|
|
2539
|
-
onClick: onClickTertiaryButton,
|
|
2540
|
-
dataTour: dataTourTertiaryButton
|
|
2541
|
-
}) : tertiaryButton), after);
|
|
2542
2579
|
});
|
|
2543
2580
|
});
|
|
2544
2581
|
FinalForm.propTypes = {
|
|
@@ -2589,6 +2626,5 @@ FinalForm.defaultProps = {
|
|
|
2589
2626
|
direction: 'vertical',
|
|
2590
2627
|
disableFieldsAutoComplete: false
|
|
2591
2628
|
};
|
|
2592
|
-
FinalForm.displayName = 'FinalForm';
|
|
2593
2629
|
|
|
2594
2630
|
export { CheckboxField as Checkbox, ChoiceField, CustomField, DatePickerField, FieldWrapper, FieldWrapperBase, FileInput, FinalForm, Group, InputField, RadioGroup, SegmentedField, SelectField, SwitchField as Switch, TextareaField as Textarea, addRequiredFieldsParamToSchema, emailValidation, focusOnError, focusOnErrorDecorator, formTypes, generateField, phoneValidation, sendFormDataToServer, setErrorsMutator, useYupValidationSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/forms",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Forms fields, inputs, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"forms",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@itcase/common": "^1.1.6",
|
|
38
|
-
"@itcase/ui": "^1.0.
|
|
39
|
-
"axios": "^1.
|
|
38
|
+
"@itcase/ui": "^1.0.25",
|
|
39
|
+
"axios": "^1.5.0",
|
|
40
40
|
"clsx": "^2.0.0",
|
|
41
41
|
"date-fns": "2.0.0-alpha.7",
|
|
42
42
|
"final-form": "^4.20.10",
|
|
43
43
|
"final-form-focus": "^1.1.2",
|
|
44
|
-
"libphonenumber-js": "^1.10.
|
|
44
|
+
"libphonenumber-js": "^1.10.43",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
|
-
"luxon": "^3.4.
|
|
46
|
+
"luxon": "^3.4.2",
|
|
47
47
|
"prop-types": "^15.8.1",
|
|
48
48
|
"react": "^18.2.0",
|
|
49
49
|
"react-date-range": "^1.4.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@semantic-release/git": "^10.0.1",
|
|
68
68
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
69
69
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
70
|
-
"eslint": "8.
|
|
70
|
+
"eslint": "8.48.0",
|
|
71
71
|
"eslint-config-prettier": "^9.0.0",
|
|
72
72
|
"eslint-config-standard": "^17.1.0",
|
|
73
73
|
"eslint-plugin-import": "^2.28.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"eslint-plugin-promise": "^6.1.1",
|
|
77
77
|
"eslint-plugin-react": "^7.33.2",
|
|
78
78
|
"eslint-plugin-standard": "^5.0.0",
|
|
79
|
-
"husky": "^8.0.
|
|
79
|
+
"husky": "^8.0.3",
|
|
80
80
|
"npm": "^9.8.1",
|
|
81
81
|
"postcss-aspect-ratio-polyfill": "^2.0.0",
|
|
82
82
|
"postcss-cli": "^10.1.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"postcss-nested-ancestors": "^3.0.0",
|
|
96
96
|
"postcss-normalize": "^10.0.1",
|
|
97
97
|
"postcss-prepend-imports": "^1.0.1",
|
|
98
|
-
"postcss-preset-env": "^9.1.
|
|
98
|
+
"postcss-preset-env": "^9.1.2",
|
|
99
99
|
"postcss-pxtorem": "^6.0.0",
|
|
100
100
|
"postcss-responsive-type": "github:ITCase/postcss-responsive-type",
|
|
101
101
|
"postcss-sort-media-queries": "^5.2.0",
|