@typeolymp/ui-components 1.16.5 → 1.16.7

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
@@ -3998,7 +3998,9 @@ var Wrapper$9 = styled__default["default"].div(templateObject_1$O || (templateOb
3998
3998
  var onClick = _a.onClick;
3999
3999
  return (onClick ? "pointer" : "default");
4000
4000
  }, function (_a) {
4001
- var color = _a.color;
4001
+ var color = _a.color, onClick = _a.onClick;
4002
+ if (!onClick)
4003
+ return;
4002
4004
  switch (color) {
4003
4005
  default:
4004
4006
  case "gray":
@@ -12171,25 +12173,42 @@ var Form = React$3.forwardRef(function (props, ref) {
12171
12173
  }
12172
12174
  });
12173
12175
  }); };
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;
12176
+ var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
12177
+ var isValid, feedback, _i, _a, field, _b, _c;
12178
+ return __generator(this, function (_d) {
12179
+ switch (_d.label) {
12180
+ case 0:
12181
+ isValid = true;
12182
+ feedback = {};
12183
+ _i = 0, _a = props.fields;
12184
+ _d.label = 1;
12185
+ case 1:
12186
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
12187
+ field = _a[_i];
12188
+ if (!field.validator) return [3 /*break*/, 3];
12189
+ _b = feedback;
12190
+ _c = field.name;
12191
+ return [4 /*yield*/, field.validator(values[field.name])];
12192
+ case 2:
12193
+ _b[_c] = _d.sent();
12194
+ if (feedback[field.name].status === "error")
12195
+ isValid = false;
12196
+ _d.label = 3;
12197
+ case 3:
12198
+ _i++;
12199
+ return [3 /*break*/, 1];
12200
+ case 4:
12201
+ setFeedback(feedback);
12202
+ if (isValid && !!props.onSubmit) {
12203
+ props.onSubmit(values);
12204
+ }
12205
+ else if (!!props.onError) {
12206
+ props.onError(feedback);
12207
+ }
12208
+ return [2 /*return*/];
12183
12209
  }
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
- };
12210
+ });
12211
+ }); };
12193
12212
  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
12213
  switch (field.type) {
12195
12214
  case "text":