@typeolymp/ui-components 1.19.12 → 1.19.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/build/index.js CHANGED
@@ -14778,8 +14778,8 @@ var templateObject_1$y, templateObject_2$u;
14778
14778
 
14779
14779
  var DataSummary = function (_a) {
14780
14780
  var title = _a.title, data = _a.data, onEdit = _a.onEdit, locale = _a.locale;
14781
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Container$l, { children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Heading, __assign$2({ type: "h5" }, { children: title })), onEdit && (jsxRuntime.jsx("div", __assign$2({ onClick: onEdit }, { children: jsxRuntime.jsx(Heading, __assign$2({ type: "h6", color: "gray" }, { children: translations[locale]["Edit"] })) })))] }), jsxRuntime.jsx(Data, { children: data === null || data === void 0 ? void 0 : data.map(function (item) {
14782
- return item instanceof Object ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(Paragraph, __assign$2({ weight: "regular" }, { children: [item.label, ":"] })), jsxRuntime.jsx(Paragraph, __assign$2({ weight: "regular" }, { children: item.value }))] }, "".concat(item.label, "-").concat(item.value))) : (jsxRuntime.jsx(Paragraph, __assign$2({ weight: "regular" }, { children: item })));
14781
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(Container$l, { children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Heading, __assign$2({ type: "h5" }, { children: title })), onEdit && (jsxRuntime.jsx("div", __assign$2({ onClick: onEdit }, { children: jsxRuntime.jsx(Heading, __assign$2({ type: "h6", color: "gray" }, { children: translations[locale]["Edit"] })) })))] }), jsxRuntime.jsx(Data, { children: data === null || data === void 0 ? void 0 : data.map(function (item, index) {
14782
+ return item instanceof Object ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(Paragraph, __assign$2({ weight: "regular" }, { children: [item.label, ":"] })), jsxRuntime.jsx(Paragraph, __assign$2({ weight: "regular" }, { children: item.value }))] }, "".concat(item.label, "-").concat(item.value, "-").concat(index))) : (jsxRuntime.jsx(Paragraph, __assign$2({ weight: "regular" }, { children: item }), "".concat(item, "-").concat(index)));
14783
14783
  }) })] }) }));
14784
14784
  };
14785
14785
 
@@ -47893,6 +47893,7 @@ var Form = React$3.forwardRef(function (props, ref) {
47893
47893
  var _a = React$3.useState({}), values = _a[0], setValues = _a[1];
47894
47894
  var _b = React$3.useState({}), feedback = _b[0], setFeedback = _b[1];
47895
47895
  React$3.useImperativeHandle(ref, function () { return ({
47896
+ validateForm: validateForm,
47896
47897
  resetForm: resetForm,
47897
47898
  }); });
47898
47899
  React$3.useEffect(function () {
@@ -48034,7 +48035,7 @@ var Form = React$3.forwardRef(function (props, ref) {
48034
48035
  }
48035
48036
  });
48036
48037
  }); };
48037
- var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
48038
+ var validateForm = function () { return __awaiter(void 0, void 0, void 0, function () {
48038
48039
  var isValid, feedback, _i, _a, field, _b, _c;
48039
48040
  return __generator(this, function (_d) {
48040
48041
  switch (_d.label) {
@@ -48060,12 +48061,21 @@ var Form = React$3.forwardRef(function (props, ref) {
48060
48061
  return [3 /*break*/, 1];
48061
48062
  case 4:
48062
48063
  setFeedback(feedback);
48063
- if (isValid && !!props.onSubmit) {
48064
+ return [2 /*return*/, { isValid: isValid, feedback: feedback }];
48065
+ }
48066
+ });
48067
+ }); };
48068
+ var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
48069
+ var _a, isValid, feedback;
48070
+ return __generator(this, function (_b) {
48071
+ switch (_b.label) {
48072
+ case 0: return [4 /*yield*/, validateForm()];
48073
+ case 1:
48074
+ _a = _b.sent(), isValid = _a.isValid, feedback = _a.feedback;
48075
+ if (isValid && !!props.onSubmit)
48064
48076
  props.onSubmit(values);
48065
- }
48066
- else if (!!props.onError) {
48077
+ else if (!!props.onError)
48067
48078
  props.onError(feedback);
48068
- }
48069
48079
  return [2 /*return*/];
48070
48080
  }
48071
48081
  });