@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.es.js CHANGED
@@ -12144,25 +12144,42 @@ var Form = forwardRef(function (props, ref) {
12144
12144
  }
12145
12145
  });
12146
12146
  }); };
12147
- var onSubmit = function () {
12148
- var isValid = true;
12149
- var feedback = {};
12150
- for (var _i = 0, _a = props.fields; _i < _a.length; _i++) {
12151
- var field = _a[_i];
12152
- if (field.validator) {
12153
- feedback[field.name] = field.validator(values[field.name]);
12154
- if (feedback[field.name].status === "error")
12155
- isValid = false;
12147
+ var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
12148
+ var isValid, feedback, _i, _a, field, _b, _c;
12149
+ return __generator(this, function (_d) {
12150
+ switch (_d.label) {
12151
+ case 0:
12152
+ isValid = true;
12153
+ feedback = {};
12154
+ _i = 0, _a = props.fields;
12155
+ _d.label = 1;
12156
+ case 1:
12157
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
12158
+ field = _a[_i];
12159
+ if (!field.validator) return [3 /*break*/, 3];
12160
+ _b = feedback;
12161
+ _c = field.name;
12162
+ return [4 /*yield*/, field.validator(values[field.name])];
12163
+ case 2:
12164
+ _b[_c] = _d.sent();
12165
+ if (feedback[field.name].status === "error")
12166
+ isValid = false;
12167
+ _d.label = 3;
12168
+ case 3:
12169
+ _i++;
12170
+ return [3 /*break*/, 1];
12171
+ case 4:
12172
+ setFeedback(feedback);
12173
+ if (isValid && !!props.onSubmit) {
12174
+ props.onSubmit(values);
12175
+ }
12176
+ else if (!!props.onError) {
12177
+ props.onError(feedback);
12178
+ }
12179
+ return [2 /*return*/];
12156
12180
  }
12157
- }
12158
- setFeedback(feedback);
12159
- if (isValid && !!props.onSubmit) {
12160
- props.onSubmit(values);
12161
- }
12162
- else if (!!props.onError) {
12163
- props.onError(feedback);
12164
- }
12165
- };
12181
+ });
12182
+ }); };
12166
12183
  return (jsxs(Fragment$1, { children: [props.title && (jsxs(Fragment$1, { children: [jsx$1(Heading, __assign$2({ type: "h4" }, { children: props.title })), jsx$1(Spacer, { vertical: 15 })] })), props.description && (jsx$1(DescriptionWrapper, { children: typeof props.description === "string" ? (jsx$1(Paragraph, __assign$2({ color: "darkGray", weight: "regular" }, { children: htmlReactParser(props.description) }))) : (props.description) })), jsx$1(FormWrapper, { children: props.fields.map(function (field, index) {
12167
12184
  switch (field.type) {
12168
12185
  case "text":