@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.es.js CHANGED
@@ -3971,7 +3971,9 @@ var Wrapper$9 = styled.div(templateObject_1$O || (templateObject_1$O = __makeTem
3971
3971
  var onClick = _a.onClick;
3972
3972
  return (onClick ? "pointer" : "default");
3973
3973
  }, function (_a) {
3974
- var color = _a.color;
3974
+ var color = _a.color, onClick = _a.onClick;
3975
+ if (!onClick)
3976
+ return;
3975
3977
  switch (color) {
3976
3978
  default:
3977
3979
  case "gray":
@@ -12144,25 +12146,42 @@ var Form = forwardRef(function (props, ref) {
12144
12146
  }
12145
12147
  });
12146
12148
  }); };
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;
12149
+ var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
12150
+ var isValid, feedback, _i, _a, field, _b, _c;
12151
+ return __generator(this, function (_d) {
12152
+ switch (_d.label) {
12153
+ case 0:
12154
+ isValid = true;
12155
+ feedback = {};
12156
+ _i = 0, _a = props.fields;
12157
+ _d.label = 1;
12158
+ case 1:
12159
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
12160
+ field = _a[_i];
12161
+ if (!field.validator) return [3 /*break*/, 3];
12162
+ _b = feedback;
12163
+ _c = field.name;
12164
+ return [4 /*yield*/, field.validator(values[field.name])];
12165
+ case 2:
12166
+ _b[_c] = _d.sent();
12167
+ if (feedback[field.name].status === "error")
12168
+ isValid = false;
12169
+ _d.label = 3;
12170
+ case 3:
12171
+ _i++;
12172
+ return [3 /*break*/, 1];
12173
+ case 4:
12174
+ setFeedback(feedback);
12175
+ if (isValid && !!props.onSubmit) {
12176
+ props.onSubmit(values);
12177
+ }
12178
+ else if (!!props.onError) {
12179
+ props.onError(feedback);
12180
+ }
12181
+ return [2 /*return*/];
12156
12182
  }
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
- };
12183
+ });
12184
+ }); };
12166
12185
  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
12186
  switch (field.type) {
12168
12187
  case "text":