@typeolymp/ui-components 1.16.5 → 1.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -12171,25 +12171,42 @@ var Form = React$3.forwardRef(function (props, ref) {
12171
12171
  }
12172
12172
  });
12173
12173
  }); };
12174
- var onSubmit = function () {
12175
- var isValid = true;
12176
- var feedback = {};
12177
- for (var _i = 0, _a = props.fields; _i < _a.length; _i++) {
12178
- var field = _a[_i];
12179
- if (field.validator) {
12180
- feedback[field.name] = field.validator(values[field.name]);
12181
- if (feedback[field.name].status === "error")
12182
- isValid = false;
12174
+ var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
12175
+ var isValid, feedback, _i, _a, field, _b, _c;
12176
+ return __generator(this, function (_d) {
12177
+ switch (_d.label) {
12178
+ case 0:
12179
+ isValid = true;
12180
+ feedback = {};
12181
+ _i = 0, _a = props.fields;
12182
+ _d.label = 1;
12183
+ case 1:
12184
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
12185
+ field = _a[_i];
12186
+ if (!field.validator) return [3 /*break*/, 3];
12187
+ _b = feedback;
12188
+ _c = field.name;
12189
+ return [4 /*yield*/, field.validator(values[field.name])];
12190
+ case 2:
12191
+ _b[_c] = _d.sent();
12192
+ if (feedback[field.name].status === "error")
12193
+ isValid = false;
12194
+ _d.label = 3;
12195
+ case 3:
12196
+ _i++;
12197
+ return [3 /*break*/, 1];
12198
+ case 4:
12199
+ setFeedback(feedback);
12200
+ if (isValid && !!props.onSubmit) {
12201
+ props.onSubmit(values);
12202
+ }
12203
+ else if (!!props.onError) {
12204
+ props.onError(feedback);
12205
+ }
12206
+ return [2 /*return*/];
12183
12207
  }
12184
- }
12185
- setFeedback(feedback);
12186
- if (isValid && !!props.onSubmit) {
12187
- props.onSubmit(values);
12188
- }
12189
- else if (!!props.onError) {
12190
- props.onError(feedback);
12191
- }
12192
- };
12208
+ });
12209
+ }); };
12193
12210
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.title && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Heading, __assign$2({ type: "h4" }, { children: props.title })), jsxRuntime.jsx(Spacer, { vertical: 15 })] })), props.description && (jsxRuntime.jsx(DescriptionWrapper, { children: typeof props.description === "string" ? (jsxRuntime.jsx(Paragraph, __assign$2({ color: "darkGray", weight: "regular" }, { children: htmlReactParser(props.description) }))) : (props.description) })), jsxRuntime.jsx(FormWrapper, { children: props.fields.map(function (field, index) {
12194
12211
  switch (field.type) {
12195
12212
  case "text":