@itcase/forms 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/form/Field/FileInput/FileInput.css +1 -0
- package/dist/itcase-forms.cjs.js +156 -124
- package/dist/itcase-forms.esm.js +157 -125
- package/package.json +8 -8
package/dist/itcase-forms.cjs.js
CHANGED
|
@@ -1325,6 +1325,10 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1325
1325
|
prefix: 'border-color_',
|
|
1326
1326
|
propsKey: 'borderColor'
|
|
1327
1327
|
});
|
|
1328
|
+
var borderColorHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
1329
|
+
prefix: 'border-color_hover_',
|
|
1330
|
+
propsKey: 'borderColorHover'
|
|
1331
|
+
});
|
|
1328
1332
|
var borderTypeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
1329
1333
|
prefix: 'border_type_',
|
|
1330
1334
|
propsKey: 'borderType'
|
|
@@ -1350,7 +1354,7 @@ var FileInputDropzone = /*#__PURE__*/React__default.default.memo(function FileIn
|
|
|
1350
1354
|
}), /*#__PURE__*/React__default.default.createElement("input", Object.assign({}, getInputProps(), {
|
|
1351
1355
|
name: inputName
|
|
1352
1356
|
})), /*#__PURE__*/React__default.default.createElement("div", {
|
|
1353
|
-
className: clsx__default.default('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderTypeClass)
|
|
1357
|
+
className: clsx__default.default('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderColorHoverClass, borderTypeClass)
|
|
1354
1358
|
}, files.map(function (file, i) {
|
|
1355
1359
|
return /*#__PURE__*/React__default.default.createElement("aside", {
|
|
1356
1360
|
className: clsx__default.default('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderTypeClass),
|
|
@@ -1440,6 +1444,7 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1440
1444
|
size = props.size,
|
|
1441
1445
|
borderWidth = props.borderWidth,
|
|
1442
1446
|
borderColor = props.borderColor,
|
|
1447
|
+
borderColorHover = props.borderColorHover,
|
|
1443
1448
|
borderType = props.borderType,
|
|
1444
1449
|
label = props.label,
|
|
1445
1450
|
thumbBorderWidth = props.thumbBorderWidth,
|
|
@@ -1502,6 +1507,7 @@ var FileInput = /*#__PURE__*/React__default.default.memo(function FileInput(prop
|
|
|
1502
1507
|
hintTitle: hintTitle,
|
|
1503
1508
|
borderWidth: borderWidth,
|
|
1504
1509
|
borderColor: borderColor,
|
|
1510
|
+
borderColorHover: borderColorHover,
|
|
1505
1511
|
borderType: borderType,
|
|
1506
1512
|
thumbBorderWidth: thumbBorderWidth,
|
|
1507
1513
|
thumbBorderColor: thumbBorderColor,
|
|
@@ -2139,8 +2145,12 @@ TextareaField.propTypes = {
|
|
|
2139
2145
|
inputProps: PropTypes__default.default.object
|
|
2140
2146
|
};
|
|
2141
2147
|
|
|
2142
|
-
function focusOnError(formElementsList, errors) {
|
|
2148
|
+
var focusOnError = function focusOnError(formElementsList, errors) {
|
|
2143
2149
|
var selectsIds = Object.keys(errors).map(function (fieldName) {
|
|
2150
|
+
if (fieldName === finalForm.FORM_ERROR) {
|
|
2151
|
+
// TODO: get from somewhere
|
|
2152
|
+
return 'notification__item_status_error';
|
|
2153
|
+
}
|
|
2144
2154
|
return "react-select-id_" + fieldName + "-input";
|
|
2145
2155
|
});
|
|
2146
2156
|
var errorFieldElement = formElementsList.find(function (element) {
|
|
@@ -2154,9 +2164,14 @@ function focusOnError(formElementsList, errors) {
|
|
|
2154
2164
|
if (!errorFieldElement && errorsList.length) {
|
|
2155
2165
|
var errorElement;
|
|
2156
2166
|
try {
|
|
2157
|
-
|
|
2158
|
-
if (
|
|
2159
|
-
errorElement = document.querySelector(
|
|
2167
|
+
var fieldName = errorsList[0];
|
|
2168
|
+
if (fieldName === finalForm.FORM_ERROR) {
|
|
2169
|
+
errorElement = document.querySelector('notification__item_status_error');
|
|
2170
|
+
} else {
|
|
2171
|
+
errorElement = document.querySelector("#" + fieldName + "-error");
|
|
2172
|
+
if (!errorElement) {
|
|
2173
|
+
errorElement = document.querySelector("#id_" + fieldName);
|
|
2174
|
+
}
|
|
2160
2175
|
}
|
|
2161
2176
|
} catch (err) {
|
|
2162
2177
|
console.warn(err);
|
|
@@ -2176,31 +2191,42 @@ function focusOnError(formElementsList, errors) {
|
|
|
2176
2191
|
});
|
|
2177
2192
|
}
|
|
2178
2193
|
return null;
|
|
2179
|
-
}
|
|
2194
|
+
};
|
|
2180
2195
|
var focusOnErrorDecorator = createDecorator__default.default(null, focusOnError);
|
|
2181
|
-
function setErrorsMutator(args, state) {
|
|
2196
|
+
var setErrorsMutator = function setErrorsMutator(args, state) {
|
|
2182
2197
|
var fieldName = args[0],
|
|
2183
2198
|
data = args[1];
|
|
2184
|
-
var
|
|
2199
|
+
var submitError = data.submitError;
|
|
2200
|
+
var fieldError = data.error;
|
|
2185
2201
|
if (fieldName === 'non_field_errors') {
|
|
2186
|
-
state.formState.error = fieldError;
|
|
2187
2202
|
// state.formState.invalid = true
|
|
2188
2203
|
// state.formState.valid = false
|
|
2189
|
-
state.formState.
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2204
|
+
state.formState.error = fieldError;
|
|
2205
|
+
state.formState.submitError = submitError;
|
|
2206
|
+
} else if (fieldName in state.fields) {
|
|
2207
|
+
if (fieldError) {
|
|
2208
|
+
var _Object$assign;
|
|
2209
|
+
var errorsState = Object.assign({}, state.formState.errors, (_Object$assign = {}, _Object$assign[fieldName] = fieldError, _Object$assign));
|
|
2210
|
+
state.fields[fieldName].touched = true;
|
|
2211
|
+
state.fields[fieldName].error = fieldError;
|
|
2212
|
+
state.formState.errors = errorsState;
|
|
2213
|
+
}
|
|
2214
|
+
if (submitError) {
|
|
2215
|
+
var _Object$assign2;
|
|
2216
|
+
var submitErrorsState = Object.assign({}, state.formState.submitErrors, (_Object$assign2 = {}, _Object$assign2[fieldName] = submitError, _Object$assign2));
|
|
2217
|
+
|
|
2218
|
+
// state.fields[fieldName].submitFailed = true
|
|
2219
|
+
// state.fields[fieldName].submitSucceeded = false
|
|
2220
|
+
state.fields[fieldName].submitError = submitError;
|
|
2221
|
+
state.formState.submitErrors = submitErrorsState;
|
|
2222
|
+
state.formState.submitFailed = true;
|
|
2223
|
+
state.formState.submitSucceeded = false;
|
|
2224
|
+
state.formState.lastSubmittedValues = state.formState.values;
|
|
2225
|
+
}
|
|
2197
2226
|
}
|
|
2198
|
-
}
|
|
2199
|
-
function
|
|
2200
|
-
|
|
2201
|
-
}
|
|
2202
|
-
function _sendFormDataToServer() {
|
|
2203
|
-
_sendFormDataToServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2227
|
+
};
|
|
2228
|
+
var sendFormDataToServer = /*#__PURE__*/function () {
|
|
2229
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2204
2230
|
var response, _error$response, _error$response2, formErrors;
|
|
2205
2231
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2206
2232
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2226,9 +2252,9 @@ function _sendFormDataToServer() {
|
|
|
2226
2252
|
formErrors[finalForm.FORM_ERROR] = 'Something went wrong';
|
|
2227
2253
|
}
|
|
2228
2254
|
if (typeof ((_error$response2 = _context.t0.response) == null ? void 0 : _error$response2.data) === 'object') {
|
|
2229
|
-
Object.entries(_context.t0.response.data).forEach(function (
|
|
2230
|
-
var fieldName =
|
|
2231
|
-
errorsList =
|
|
2255
|
+
Object.entries(_context.t0.response.data).forEach(function (_ref2) {
|
|
2256
|
+
var fieldName = _ref2[0],
|
|
2257
|
+
errorsList = _ref2[1];
|
|
2232
2258
|
formErrors[fieldName] = errorsList[0];
|
|
2233
2259
|
});
|
|
2234
2260
|
}
|
|
@@ -2243,8 +2269,10 @@ function _sendFormDataToServer() {
|
|
|
2243
2269
|
}
|
|
2244
2270
|
}, _callee, null, [[0, 7]]);
|
|
2245
2271
|
}));
|
|
2246
|
-
return
|
|
2247
|
-
|
|
2272
|
+
return function sendFormDataToServer(_x, _x2) {
|
|
2273
|
+
return _ref.apply(this, arguments);
|
|
2274
|
+
};
|
|
2275
|
+
}();
|
|
2248
2276
|
|
|
2249
2277
|
var formTypes = {
|
|
2250
2278
|
checkbox: 'checkbox',
|
|
@@ -2347,7 +2375,7 @@ function generateField(field, config, props) {
|
|
|
2347
2375
|
}
|
|
2348
2376
|
}
|
|
2349
2377
|
|
|
2350
|
-
var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function (props, ref) {
|
|
2378
|
+
var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalForm(props, ref) {
|
|
2351
2379
|
var additionalProps = props.additionalProps,
|
|
2352
2380
|
after = props.after,
|
|
2353
2381
|
before = props.before,
|
|
@@ -2444,105 +2472,110 @@ var FinalForm = /*#__PURE__*/React__default.default.forwardRef(function (props,
|
|
|
2444
2472
|
decorators: [focusOnErrorDecorator],
|
|
2445
2473
|
initialValues: initialValues,
|
|
2446
2474
|
initialValuesEqual: initialValuesEqual,
|
|
2475
|
+
mutators: mutators,
|
|
2476
|
+
render: function render(_ref) {
|
|
2477
|
+
var handleSubmit = _ref.handleSubmit,
|
|
2478
|
+
submitError = _ref.submitError,
|
|
2479
|
+
modifiedSinceLastSubmit = _ref.modifiedSinceLastSubmit,
|
|
2480
|
+
form = _ref.form;
|
|
2481
|
+
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2482
|
+
style: formStyles,
|
|
2483
|
+
className: clsx__default.default(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2484
|
+
name: formName,
|
|
2485
|
+
"data-tour": dataTour,
|
|
2486
|
+
ref: function ref() {
|
|
2487
|
+
return onRefFormInstance(form);
|
|
2488
|
+
},
|
|
2489
|
+
onSubmit: handleSubmit,
|
|
2490
|
+
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2491
|
+
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2492
|
+
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2493
|
+
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2494
|
+
}, before, title && /*#__PURE__*/React__default.default.createElement(Title.Title, {
|
|
2495
|
+
className: "form__title",
|
|
2496
|
+
size: titleTextSize,
|
|
2497
|
+
textColor: titleTextColor,
|
|
2498
|
+
textWeight: titleTextWeight
|
|
2499
|
+
}, title), description && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2500
|
+
className: "form__description",
|
|
2501
|
+
size: descriptionSize,
|
|
2502
|
+
textColor: descriptionTextColor,
|
|
2503
|
+
textWeight: descriptionTextWeight
|
|
2504
|
+
}, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
|
|
2505
|
+
text: form.getState().submitError,
|
|
2506
|
+
status: "error"
|
|
2507
|
+
}), onChangeFormValues && /*#__PURE__*/React__default.default.createElement(reactFinalForm.FormSpy, {
|
|
2508
|
+
subscription: {
|
|
2509
|
+
values: true
|
|
2510
|
+
},
|
|
2511
|
+
onChange: onChangeFormValues
|
|
2512
|
+
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
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__default.default.createElement(Loader.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__default.default.createElement(Group$1.Group, {
|
|
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__default.default.createElement(Button.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__default.default.createElement(Button.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__default.default.createElement(Button.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
|
+
},
|
|
2447
2571
|
subscription: {
|
|
2448
2572
|
submitting: true,
|
|
2449
|
-
pristine: true
|
|
2573
|
+
pristine: true,
|
|
2574
|
+
modifiedSinceLastSubmit: true,
|
|
2575
|
+
submitError: true
|
|
2450
2576
|
},
|
|
2451
|
-
mutators: mutators,
|
|
2452
2577
|
validate: validate,
|
|
2453
2578
|
onSubmit: onSubmit
|
|
2454
|
-
}, function (_ref) {
|
|
2455
|
-
var handleSubmit = _ref.handleSubmit,
|
|
2456
|
-
form = _ref.form;
|
|
2457
|
-
return /*#__PURE__*/React__default.default.createElement("form", {
|
|
2458
|
-
style: formStyles,
|
|
2459
|
-
className: clsx__default.default(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2460
|
-
name: formName,
|
|
2461
|
-
"data-tour": dataTour,
|
|
2462
|
-
ref: function ref() {
|
|
2463
|
-
return onRefFormInstance(form);
|
|
2464
|
-
},
|
|
2465
|
-
onSubmit: handleSubmit,
|
|
2466
|
-
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2467
|
-
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2468
|
-
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2469
|
-
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2470
|
-
}, before, title && /*#__PURE__*/React__default.default.createElement(Title.Title, {
|
|
2471
|
-
className: "form__title",
|
|
2472
|
-
size: titleTextSize,
|
|
2473
|
-
textColor: titleTextColor,
|
|
2474
|
-
textWeight: titleTextWeight
|
|
2475
|
-
}, title), description && /*#__PURE__*/React__default.default.createElement(Text.Text, {
|
|
2476
|
-
className: "form__description",
|
|
2477
|
-
size: descriptionSize,
|
|
2478
|
-
textColor: descriptionTextColor,
|
|
2479
|
-
textWeight: descriptionTextWeight
|
|
2480
|
-
}, description), form.getState().submitError && /*#__PURE__*/React__default.default.createElement(Notification.NotificationItem, {
|
|
2481
|
-
text: form.getState().submitError,
|
|
2482
|
-
status: "error"
|
|
2483
|
-
}), onChangeFormValues && /*#__PURE__*/React__default.default.createElement(reactFinalForm.FormSpy, {
|
|
2484
|
-
subscription: {
|
|
2485
|
-
values: true
|
|
2486
|
-
},
|
|
2487
|
-
onChange: onChangeFormValues
|
|
2488
|
-
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2489
|
-
direction: "vertical",
|
|
2490
|
-
gap: fieldsGap || groupGap,
|
|
2491
|
-
className: "form__wrapper"
|
|
2492
|
-
}, Object.keys(config).map(function (key) {
|
|
2493
|
-
return generateField(config[key], {
|
|
2494
|
-
key: key
|
|
2495
|
-
}, additionalProps[config[key].name]);
|
|
2496
|
-
}), isLoading && /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, loader ? loader : /*#__PURE__*/React__default.default.createElement(Loader.Loader, {
|
|
2497
|
-
className: "form__loader",
|
|
2498
|
-
set: loaderSet,
|
|
2499
|
-
fill: loaderFill,
|
|
2500
|
-
itemFill: loaderItemFill,
|
|
2501
|
-
text: loaderText
|
|
2502
|
-
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React__default.default.createElement(Group$1.Group, {
|
|
2503
|
-
fill: buttonFill,
|
|
2504
|
-
justifyContent: buttonJustifyContent,
|
|
2505
|
-
direction: buttonDirection,
|
|
2506
|
-
padding: buttonPadding,
|
|
2507
|
-
gap: buttonGap,
|
|
2508
|
-
className: "form__button",
|
|
2509
|
-
dataTour: dataTourButtons
|
|
2510
|
-
}, primaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2511
|
-
width: "fill",
|
|
2512
|
-
className: "form__button-item",
|
|
2513
|
-
fill: primaryButtonFill,
|
|
2514
|
-
fillHover: primaryButtonFillHover,
|
|
2515
|
-
size: primaryButtonSize,
|
|
2516
|
-
labelTextColor: primaryButtonLabelTextColor,
|
|
2517
|
-
labelSize: primaryButtonLabelSize,
|
|
2518
|
-
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2519
|
-
label: primaryButtonLabel,
|
|
2520
|
-
dataTour: dataTourPrimaryButton
|
|
2521
|
-
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2522
|
-
width: "fill",
|
|
2523
|
-
className: "form__button-item",
|
|
2524
|
-
fill: secondaryButtonFill,
|
|
2525
|
-
fillHover: secondaryButtonFillHover,
|
|
2526
|
-
size: secondaryButtonSize,
|
|
2527
|
-
labelTextColor: secondaryButtonLabelTextColor,
|
|
2528
|
-
labelSize: secondaryButtonLabelSize,
|
|
2529
|
-
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2530
|
-
label: secondaryButtonLabel,
|
|
2531
|
-
onClick: onClickSecondaryButton,
|
|
2532
|
-
dataTour: dataTourSecondaryButton
|
|
2533
|
-
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React__default.default.createElement(Button.Button, {
|
|
2534
|
-
width: "fill",
|
|
2535
|
-
className: "form__button-item",
|
|
2536
|
-
fill: tertiaryButtonFill,
|
|
2537
|
-
fillHover: tertiaryButtonFillHover,
|
|
2538
|
-
size: tertiaryButtonSize,
|
|
2539
|
-
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2540
|
-
labelSize: tertiaryButtonLabelSize,
|
|
2541
|
-
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2542
|
-
label: tertiaryButtonLabel,
|
|
2543
|
-
onClick: onClickTertiaryButton,
|
|
2544
|
-
dataTour: dataTourTertiaryButton
|
|
2545
|
-
}) : tertiaryButton), after);
|
|
2546
2579
|
});
|
|
2547
2580
|
});
|
|
2548
2581
|
FinalForm.propTypes = {
|
|
@@ -2593,7 +2626,6 @@ FinalForm.defaultProps = {
|
|
|
2593
2626
|
direction: 'vertical',
|
|
2594
2627
|
disableFieldsAutoComplete: false
|
|
2595
2628
|
};
|
|
2596
|
-
FinalForm.displayName = 'FinalForm';
|
|
2597
2629
|
|
|
2598
2630
|
Object.defineProperty(exports, 'Field', {
|
|
2599
2631
|
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';
|
|
@@ -1315,6 +1315,10 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1315
1315
|
prefix: 'border-color_',
|
|
1316
1316
|
propsKey: 'borderColor'
|
|
1317
1317
|
});
|
|
1318
|
+
var borderColorHoverClass = useDeviceTargetClass(props, {
|
|
1319
|
+
prefix: 'border-color_hover_',
|
|
1320
|
+
propsKey: 'borderColorHover'
|
|
1321
|
+
});
|
|
1318
1322
|
var borderTypeClass = useDeviceTargetClass(props, {
|
|
1319
1323
|
prefix: 'border_type_',
|
|
1320
1324
|
propsKey: 'borderType'
|
|
@@ -1340,7 +1344,7 @@ var FileInputDropzone = /*#__PURE__*/React.memo(function FileInputDropzone(props
|
|
|
1340
1344
|
}), /*#__PURE__*/React.createElement("input", Object.assign({}, getInputProps(), {
|
|
1341
1345
|
name: inputName
|
|
1342
1346
|
})), /*#__PURE__*/React.createElement("div", {
|
|
1343
|
-
className: clsx('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderTypeClass)
|
|
1347
|
+
className: clsx('form-dropzone__dropzone-wrapper', fillClass, fillHoverClass, borderWidthClass, borderColorClass, borderColorHoverClass, borderTypeClass)
|
|
1344
1348
|
}, files.map(function (file, i) {
|
|
1345
1349
|
return /*#__PURE__*/React.createElement("aside", {
|
|
1346
1350
|
className: clsx('form-dropzone__thumb', fillClass, thumbBorderWidthClass, thumbBorderColorClass, thumbBorderTypeClass),
|
|
@@ -1430,6 +1434,7 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1430
1434
|
size = props.size,
|
|
1431
1435
|
borderWidth = props.borderWidth,
|
|
1432
1436
|
borderColor = props.borderColor,
|
|
1437
|
+
borderColorHover = props.borderColorHover,
|
|
1433
1438
|
borderType = props.borderType,
|
|
1434
1439
|
label = props.label,
|
|
1435
1440
|
thumbBorderWidth = props.thumbBorderWidth,
|
|
@@ -1492,6 +1497,7 @@ var FileInput = /*#__PURE__*/React.memo(function FileInput(props) {
|
|
|
1492
1497
|
hintTitle: hintTitle,
|
|
1493
1498
|
borderWidth: borderWidth,
|
|
1494
1499
|
borderColor: borderColor,
|
|
1500
|
+
borderColorHover: borderColorHover,
|
|
1495
1501
|
borderType: borderType,
|
|
1496
1502
|
thumbBorderWidth: thumbBorderWidth,
|
|
1497
1503
|
thumbBorderColor: thumbBorderColor,
|
|
@@ -2129,8 +2135,12 @@ TextareaField.propTypes = {
|
|
|
2129
2135
|
inputProps: PropTypes.object
|
|
2130
2136
|
};
|
|
2131
2137
|
|
|
2132
|
-
function focusOnError(formElementsList, errors) {
|
|
2138
|
+
var focusOnError = function focusOnError(formElementsList, errors) {
|
|
2133
2139
|
var selectsIds = Object.keys(errors).map(function (fieldName) {
|
|
2140
|
+
if (fieldName === FORM_ERROR) {
|
|
2141
|
+
// TODO: get from somewhere
|
|
2142
|
+
return 'notification__item_status_error';
|
|
2143
|
+
}
|
|
2134
2144
|
return "react-select-id_" + fieldName + "-input";
|
|
2135
2145
|
});
|
|
2136
2146
|
var errorFieldElement = formElementsList.find(function (element) {
|
|
@@ -2144,9 +2154,14 @@ function focusOnError(formElementsList, errors) {
|
|
|
2144
2154
|
if (!errorFieldElement && errorsList.length) {
|
|
2145
2155
|
var errorElement;
|
|
2146
2156
|
try {
|
|
2147
|
-
|
|
2148
|
-
if (
|
|
2149
|
-
errorElement = document.querySelector(
|
|
2157
|
+
var fieldName = errorsList[0];
|
|
2158
|
+
if (fieldName === FORM_ERROR) {
|
|
2159
|
+
errorElement = document.querySelector('notification__item_status_error');
|
|
2160
|
+
} else {
|
|
2161
|
+
errorElement = document.querySelector("#" + fieldName + "-error");
|
|
2162
|
+
if (!errorElement) {
|
|
2163
|
+
errorElement = document.querySelector("#id_" + fieldName);
|
|
2164
|
+
}
|
|
2150
2165
|
}
|
|
2151
2166
|
} catch (err) {
|
|
2152
2167
|
console.warn(err);
|
|
@@ -2166,31 +2181,42 @@ function focusOnError(formElementsList, errors) {
|
|
|
2166
2181
|
});
|
|
2167
2182
|
}
|
|
2168
2183
|
return null;
|
|
2169
|
-
}
|
|
2184
|
+
};
|
|
2170
2185
|
var focusOnErrorDecorator = createDecorator(null, focusOnError);
|
|
2171
|
-
function setErrorsMutator(args, state) {
|
|
2186
|
+
var setErrorsMutator = function setErrorsMutator(args, state) {
|
|
2172
2187
|
var fieldName = args[0],
|
|
2173
2188
|
data = args[1];
|
|
2174
|
-
var
|
|
2189
|
+
var submitError = data.submitError;
|
|
2190
|
+
var fieldError = data.error;
|
|
2175
2191
|
if (fieldName === 'non_field_errors') {
|
|
2176
|
-
state.formState.error = fieldError;
|
|
2177
2192
|
// state.formState.invalid = true
|
|
2178
2193
|
// state.formState.valid = false
|
|
2179
|
-
state.formState.
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2194
|
+
state.formState.error = fieldError;
|
|
2195
|
+
state.formState.submitError = submitError;
|
|
2196
|
+
} else if (fieldName in state.fields) {
|
|
2197
|
+
if (fieldError) {
|
|
2198
|
+
var _Object$assign;
|
|
2199
|
+
var errorsState = Object.assign({}, state.formState.errors, (_Object$assign = {}, _Object$assign[fieldName] = fieldError, _Object$assign));
|
|
2200
|
+
state.fields[fieldName].touched = true;
|
|
2201
|
+
state.fields[fieldName].error = fieldError;
|
|
2202
|
+
state.formState.errors = errorsState;
|
|
2203
|
+
}
|
|
2204
|
+
if (submitError) {
|
|
2205
|
+
var _Object$assign2;
|
|
2206
|
+
var submitErrorsState = Object.assign({}, state.formState.submitErrors, (_Object$assign2 = {}, _Object$assign2[fieldName] = submitError, _Object$assign2));
|
|
2207
|
+
|
|
2208
|
+
// state.fields[fieldName].submitFailed = true
|
|
2209
|
+
// state.fields[fieldName].submitSucceeded = false
|
|
2210
|
+
state.fields[fieldName].submitError = submitError;
|
|
2211
|
+
state.formState.submitErrors = submitErrorsState;
|
|
2212
|
+
state.formState.submitFailed = true;
|
|
2213
|
+
state.formState.submitSucceeded = false;
|
|
2214
|
+
state.formState.lastSubmittedValues = state.formState.values;
|
|
2215
|
+
}
|
|
2187
2216
|
}
|
|
2188
|
-
}
|
|
2189
|
-
function
|
|
2190
|
-
|
|
2191
|
-
}
|
|
2192
|
-
function _sendFormDataToServer() {
|
|
2193
|
-
_sendFormDataToServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2217
|
+
};
|
|
2218
|
+
var sendFormDataToServer = /*#__PURE__*/function () {
|
|
2219
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, data) {
|
|
2194
2220
|
var response, _error$response, _error$response2, formErrors;
|
|
2195
2221
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2196
2222
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2216,9 +2242,9 @@ function _sendFormDataToServer() {
|
|
|
2216
2242
|
formErrors[FORM_ERROR] = 'Something went wrong';
|
|
2217
2243
|
}
|
|
2218
2244
|
if (typeof ((_error$response2 = _context.t0.response) == null ? void 0 : _error$response2.data) === 'object') {
|
|
2219
|
-
Object.entries(_context.t0.response.data).forEach(function (
|
|
2220
|
-
var fieldName =
|
|
2221
|
-
errorsList =
|
|
2245
|
+
Object.entries(_context.t0.response.data).forEach(function (_ref2) {
|
|
2246
|
+
var fieldName = _ref2[0],
|
|
2247
|
+
errorsList = _ref2[1];
|
|
2222
2248
|
formErrors[fieldName] = errorsList[0];
|
|
2223
2249
|
});
|
|
2224
2250
|
}
|
|
@@ -2233,8 +2259,10 @@ function _sendFormDataToServer() {
|
|
|
2233
2259
|
}
|
|
2234
2260
|
}, _callee, null, [[0, 7]]);
|
|
2235
2261
|
}));
|
|
2236
|
-
return
|
|
2237
|
-
|
|
2262
|
+
return function sendFormDataToServer(_x, _x2) {
|
|
2263
|
+
return _ref.apply(this, arguments);
|
|
2264
|
+
};
|
|
2265
|
+
}();
|
|
2238
2266
|
|
|
2239
2267
|
var formTypes = {
|
|
2240
2268
|
checkbox: 'checkbox',
|
|
@@ -2337,7 +2365,7 @@ function generateField(field, config, props) {
|
|
|
2337
2365
|
}
|
|
2338
2366
|
}
|
|
2339
2367
|
|
|
2340
|
-
var FinalForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
2368
|
+
var FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
|
|
2341
2369
|
var additionalProps = props.additionalProps,
|
|
2342
2370
|
after = props.after,
|
|
2343
2371
|
before = props.before,
|
|
@@ -2434,105 +2462,110 @@ var FinalForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2434
2462
|
decorators: [focusOnErrorDecorator],
|
|
2435
2463
|
initialValues: initialValues,
|
|
2436
2464
|
initialValuesEqual: initialValuesEqual,
|
|
2465
|
+
mutators: mutators,
|
|
2466
|
+
render: function render(_ref) {
|
|
2467
|
+
var handleSubmit = _ref.handleSubmit,
|
|
2468
|
+
submitError = _ref.submitError,
|
|
2469
|
+
modifiedSinceLastSubmit = _ref.modifiedSinceLastSubmit,
|
|
2470
|
+
form = _ref.form;
|
|
2471
|
+
return /*#__PURE__*/React.createElement("form", {
|
|
2472
|
+
style: formStyles,
|
|
2473
|
+
className: clsx(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2474
|
+
name: formName,
|
|
2475
|
+
"data-tour": dataTour,
|
|
2476
|
+
ref: function ref() {
|
|
2477
|
+
return onRefFormInstance(form);
|
|
2478
|
+
},
|
|
2479
|
+
onSubmit: handleSubmit,
|
|
2480
|
+
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2481
|
+
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2482
|
+
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2483
|
+
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2484
|
+
}, before, title && /*#__PURE__*/React.createElement(Title, {
|
|
2485
|
+
className: "form__title",
|
|
2486
|
+
size: titleTextSize,
|
|
2487
|
+
textColor: titleTextColor,
|
|
2488
|
+
textWeight: titleTextWeight
|
|
2489
|
+
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
2490
|
+
className: "form__description",
|
|
2491
|
+
size: descriptionSize,
|
|
2492
|
+
textColor: descriptionTextColor,
|
|
2493
|
+
textWeight: descriptionTextWeight
|
|
2494
|
+
}, description), submitError && !modifiedSinceLastSubmit && /*#__PURE__*/React.createElement(NotificationItem, {
|
|
2495
|
+
text: form.getState().submitError,
|
|
2496
|
+
status: "error"
|
|
2497
|
+
}), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
|
|
2498
|
+
subscription: {
|
|
2499
|
+
values: true
|
|
2500
|
+
},
|
|
2501
|
+
onChange: onChangeFormValues
|
|
2502
|
+
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2503
|
+
direction: "vertical",
|
|
2504
|
+
gap: fieldsGap || groupGap,
|
|
2505
|
+
className: "form__wrapper"
|
|
2506
|
+
}, Object.keys(config).map(function (key) {
|
|
2507
|
+
return generateField(config[key], {
|
|
2508
|
+
key: key
|
|
2509
|
+
}, additionalProps[config[key].name]);
|
|
2510
|
+
}), isLoading && (loader || /*#__PURE__*/React.createElement(Loader, {
|
|
2511
|
+
className: "form__loader",
|
|
2512
|
+
set: loaderSet,
|
|
2513
|
+
fill: loaderFill,
|
|
2514
|
+
itemFill: loaderItemFill,
|
|
2515
|
+
text: loaderText
|
|
2516
|
+
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2517
|
+
fill: buttonFill,
|
|
2518
|
+
justifyContent: buttonJustifyContent,
|
|
2519
|
+
direction: buttonDirection,
|
|
2520
|
+
padding: buttonPadding,
|
|
2521
|
+
gap: buttonGap,
|
|
2522
|
+
className: "form__button",
|
|
2523
|
+
dataTour: dataTourButtons
|
|
2524
|
+
}, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2525
|
+
width: "fill",
|
|
2526
|
+
className: "form__button-item",
|
|
2527
|
+
fill: primaryButtonFill,
|
|
2528
|
+
fillHover: primaryButtonFillHover,
|
|
2529
|
+
size: primaryButtonSize,
|
|
2530
|
+
labelTextColor: primaryButtonLabelTextColor,
|
|
2531
|
+
labelSize: primaryButtonLabelSize,
|
|
2532
|
+
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2533
|
+
label: primaryButtonLabel,
|
|
2534
|
+
dataTour: dataTourPrimaryButton
|
|
2535
|
+
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2536
|
+
width: "fill",
|
|
2537
|
+
className: "form__button-item",
|
|
2538
|
+
fill: secondaryButtonFill,
|
|
2539
|
+
fillHover: secondaryButtonFillHover,
|
|
2540
|
+
size: secondaryButtonSize,
|
|
2541
|
+
labelTextColor: secondaryButtonLabelTextColor,
|
|
2542
|
+
labelSize: secondaryButtonLabelSize,
|
|
2543
|
+
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2544
|
+
label: secondaryButtonLabel,
|
|
2545
|
+
onClick: onClickSecondaryButton,
|
|
2546
|
+
dataTour: dataTourSecondaryButton
|
|
2547
|
+
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2548
|
+
width: "fill",
|
|
2549
|
+
className: "form__button-item",
|
|
2550
|
+
fill: tertiaryButtonFill,
|
|
2551
|
+
fillHover: tertiaryButtonFillHover,
|
|
2552
|
+
size: tertiaryButtonSize,
|
|
2553
|
+
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2554
|
+
labelSize: tertiaryButtonLabelSize,
|
|
2555
|
+
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2556
|
+
label: tertiaryButtonLabel,
|
|
2557
|
+
onClick: onClickTertiaryButton,
|
|
2558
|
+
dataTour: dataTourTertiaryButton
|
|
2559
|
+
}) : tertiaryButton), after);
|
|
2560
|
+
},
|
|
2437
2561
|
subscription: {
|
|
2438
2562
|
submitting: true,
|
|
2439
|
-
pristine: true
|
|
2563
|
+
pristine: true,
|
|
2564
|
+
modifiedSinceLastSubmit: true,
|
|
2565
|
+
submitError: true
|
|
2440
2566
|
},
|
|
2441
|
-
mutators: mutators,
|
|
2442
2567
|
validate: validate,
|
|
2443
2568
|
onSubmit: onSubmit
|
|
2444
|
-
}, function (_ref) {
|
|
2445
|
-
var handleSubmit = _ref.handleSubmit,
|
|
2446
|
-
form = _ref.form;
|
|
2447
|
-
return /*#__PURE__*/React.createElement("form", {
|
|
2448
|
-
style: formStyles,
|
|
2449
|
-
className: clsx(className, 'form', set && "form_set_" + set, type && "form_type_" + type, directionClass, fillClass, shapeClass, elevationClass),
|
|
2450
|
-
name: formName,
|
|
2451
|
-
"data-tour": dataTour,
|
|
2452
|
-
ref: function ref() {
|
|
2453
|
-
return onRefFormInstance(form);
|
|
2454
|
-
},
|
|
2455
|
-
onSubmit: handleSubmit,
|
|
2456
|
-
autoComplete: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2457
|
-
autoCorrect: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2458
|
-
autoCapitalize: disableFieldsAutoComplete ? 'off' : undefined,
|
|
2459
|
-
spellCheck: disableFieldsAutoComplete ? 'false' : undefined
|
|
2460
|
-
}, before, title && /*#__PURE__*/React.createElement(Title, {
|
|
2461
|
-
className: "form__title",
|
|
2462
|
-
size: titleTextSize,
|
|
2463
|
-
textColor: titleTextColor,
|
|
2464
|
-
textWeight: titleTextWeight
|
|
2465
|
-
}, title), description && /*#__PURE__*/React.createElement(Text, {
|
|
2466
|
-
className: "form__description",
|
|
2467
|
-
size: descriptionSize,
|
|
2468
|
-
textColor: descriptionTextColor,
|
|
2469
|
-
textWeight: descriptionTextWeight
|
|
2470
|
-
}, description), form.getState().submitError && /*#__PURE__*/React.createElement(NotificationItem, {
|
|
2471
|
-
text: form.getState().submitError,
|
|
2472
|
-
status: "error"
|
|
2473
|
-
}), onChangeFormValues && /*#__PURE__*/React.createElement(FormSpy, {
|
|
2474
|
-
subscription: {
|
|
2475
|
-
values: true
|
|
2476
|
-
},
|
|
2477
|
-
onChange: onChangeFormValues
|
|
2478
|
-
}), Boolean(Object.keys(config).length) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2479
|
-
direction: "vertical",
|
|
2480
|
-
gap: fieldsGap || groupGap,
|
|
2481
|
-
className: "form__wrapper"
|
|
2482
|
-
}, Object.keys(config).map(function (key) {
|
|
2483
|
-
return generateField(config[key], {
|
|
2484
|
-
key: key
|
|
2485
|
-
}, additionalProps[config[key].name]);
|
|
2486
|
-
}), isLoading && /*#__PURE__*/React.createElement(React.Fragment, null, loader ? loader : /*#__PURE__*/React.createElement(Loader, {
|
|
2487
|
-
className: "form__loader",
|
|
2488
|
-
set: loaderSet,
|
|
2489
|
-
fill: loaderFill,
|
|
2490
|
-
itemFill: loaderItemFill,
|
|
2491
|
-
text: loaderText
|
|
2492
|
-
}))), (primaryButtonLabel || primaryButton || secondaryButtonLabel || secondaryButton || tertiaryButton || tertiaryButtonLabel) && /*#__PURE__*/React.createElement(Group$1, {
|
|
2493
|
-
fill: buttonFill,
|
|
2494
|
-
justifyContent: buttonJustifyContent,
|
|
2495
|
-
direction: buttonDirection,
|
|
2496
|
-
padding: buttonPadding,
|
|
2497
|
-
gap: buttonGap,
|
|
2498
|
-
className: "form__button",
|
|
2499
|
-
dataTour: dataTourButtons
|
|
2500
|
-
}, primaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2501
|
-
width: "fill",
|
|
2502
|
-
className: "form__button-item",
|
|
2503
|
-
fill: primaryButtonFill,
|
|
2504
|
-
fillHover: primaryButtonFillHover,
|
|
2505
|
-
size: primaryButtonSize,
|
|
2506
|
-
labelTextColor: primaryButtonLabelTextColor,
|
|
2507
|
-
labelSize: primaryButtonLabelSize,
|
|
2508
|
-
labelTextWeight: primaryButtonLabelTextWeight,
|
|
2509
|
-
label: primaryButtonLabel,
|
|
2510
|
-
dataTour: dataTourPrimaryButton
|
|
2511
|
-
}) : primaryButton, secondaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2512
|
-
width: "fill",
|
|
2513
|
-
className: "form__button-item",
|
|
2514
|
-
fill: secondaryButtonFill,
|
|
2515
|
-
fillHover: secondaryButtonFillHover,
|
|
2516
|
-
size: secondaryButtonSize,
|
|
2517
|
-
labelTextColor: secondaryButtonLabelTextColor,
|
|
2518
|
-
labelSize: secondaryButtonLabelSize,
|
|
2519
|
-
labelTextWeight: secondaryButtonLabelTextWeight,
|
|
2520
|
-
label: secondaryButtonLabel,
|
|
2521
|
-
onClick: onClickSecondaryButton,
|
|
2522
|
-
dataTour: dataTourSecondaryButton
|
|
2523
|
-
}) : secondaryButton, tertiaryButtonLabel ? /*#__PURE__*/React.createElement(Button, {
|
|
2524
|
-
width: "fill",
|
|
2525
|
-
className: "form__button-item",
|
|
2526
|
-
fill: tertiaryButtonFill,
|
|
2527
|
-
fillHover: tertiaryButtonFillHover,
|
|
2528
|
-
size: tertiaryButtonSize,
|
|
2529
|
-
labelTextColor: tertiaryButtonLabelTextColor,
|
|
2530
|
-
labelSize: tertiaryButtonLabelSize,
|
|
2531
|
-
labelTextWeight: tertiaryButtonLabelTextWeight,
|
|
2532
|
-
label: tertiaryButtonLabel,
|
|
2533
|
-
onClick: onClickTertiaryButton,
|
|
2534
|
-
dataTour: dataTourTertiaryButton
|
|
2535
|
-
}) : tertiaryButton), after);
|
|
2536
2569
|
});
|
|
2537
2570
|
});
|
|
2538
2571
|
FinalForm.propTypes = {
|
|
@@ -2583,6 +2616,5 @@ FinalForm.defaultProps = {
|
|
|
2583
2616
|
direction: 'vertical',
|
|
2584
2617
|
disableFieldsAutoComplete: false
|
|
2585
2618
|
};
|
|
2586
|
-
FinalForm.displayName = 'FinalForm';
|
|
2587
2619
|
|
|
2588
2620
|
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.14",
|
|
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",
|