@semcore/feedback-form 16.2.0 → 17.0.0-prerelease.18

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/FeedbackForm.js +108 -120
  3. package/lib/cjs/FeedbackForm.js.map +1 -1
  4. package/lib/cjs/component/checkbox-button/CheckboxButton.js +48 -45
  5. package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
  6. package/lib/cjs/component/feedback-item/FeedbackItem.js +33 -35
  7. package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
  8. package/lib/cjs/component/feedback-rating/FeedbackRating.js +240 -274
  9. package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
  10. package/lib/cjs/component/feedback-rating/FeedbackRating.type.js.map +1 -1
  11. package/lib/cjs/component/slider-rating/SliderRating.js +146 -147
  12. package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
  13. package/lib/cjs/component/submit-button/SubmitButton.js +12 -9
  14. package/lib/cjs/component/submit-button/SubmitButton.js.map +1 -1
  15. package/lib/cjs/index.d.js +3 -3
  16. package/lib/cjs/index.d.js.map +1 -1
  17. package/lib/cjs/index.js +5 -5
  18. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
  19. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  20. package/lib/es6/FeedbackForm.js +101 -113
  21. package/lib/es6/FeedbackForm.js.map +1 -1
  22. package/lib/es6/component/checkbox-button/CheckboxButton.js +44 -41
  23. package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
  24. package/lib/es6/component/feedback-item/FeedbackItem.js +29 -31
  25. package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
  26. package/lib/es6/component/feedback-rating/FeedbackRating.js +220 -254
  27. package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
  28. package/lib/es6/component/feedback-rating/FeedbackRating.type.js.map +1 -1
  29. package/lib/es6/component/slider-rating/SliderRating.js +138 -139
  30. package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
  31. package/lib/es6/component/submit-button/SubmitButton.js +11 -8
  32. package/lib/es6/component/submit-button/SubmitButton.js.map +1 -1
  33. package/lib/es6/index.d.js +0 -3
  34. package/lib/es6/index.d.js.map +1 -1
  35. package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
  36. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  37. package/lib/esm/FeedbackForm.mjs +101 -101
  38. package/lib/esm/component/checkbox-button/CheckboxButton.mjs +47 -39
  39. package/lib/esm/component/feedback-item/FeedbackItem.mjs +29 -23
  40. package/lib/esm/component/feedback-rating/FeedbackRating.mjs +223 -234
  41. package/lib/esm/component/slider-rating/SliderRating.mjs +139 -129
  42. package/lib/esm/component/submit-button/SubmitButton.mjs +11 -8
  43. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
  44. package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -3
  45. package/lib/types/component/feedback-rating/FeedbackRating.d.ts +11 -189
  46. package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +7 -9
  47. package/lib/types/component/slider-rating/SliderRating.d.ts +1 -1
  48. package/lib/types/index.d.ts +1 -3
  49. package/package.json +17 -16
@@ -1,13 +1,7 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
1
  import _extends from "@babel/runtime/helpers/esm/extends";
4
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/esm/createClass";
6
- import _callSuper from "@babel/runtime/helpers/esm/callSuper";
7
- import _inherits from "@babel/runtime/helpers/esm/inherits";
8
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- import { createComponent, sstyled, assignProps, Component } from "@semcore/core";
10
- import { Box, Flex } from "@semcore/base-components";
3
+ import { createComponent, Component, sstyled, assignProps } from "@semcore/core";
4
+ import { Flex, Box } from "@semcore/base-components";
11
5
  import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
12
6
  import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
13
7
  import CheckM from "@semcore/icon/Check/m";
@@ -17,86 +11,75 @@ import Input from "@semcore/input";
17
11
  import Link from "@semcore/link";
18
12
  import Modal from "@semcore/modal";
19
13
  import SemcoreNotice from "@semcore/notice";
20
- import { NoticeBubbleContainer, NoticeBubbleManager } from "@semcore/notice-bubble";
14
+ import { NoticeBubbleManager, NoticeBubbleContainer } from "@semcore/notice-bubble";
21
15
  import SpinContainer from "@semcore/spin-container";
22
16
  import Textarea from "@semcore/textarea";
23
17
  import { Text } from "@semcore/typography";
24
18
  import createFocusDecorator from "final-form-focus";
25
19
  import React from "react";
26
- import { Form, Field } from "react-final-form";
20
+ import { Field, Form } from "react-final-form";
27
21
  import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
28
22
  import CheckboxButton from "../checkbox-button/CheckboxButton.mjs";
29
23
  import { FeedbackItem } from "../feedback-item/FeedbackItem.mjs";
30
24
  import SliderRating from "../slider-rating/SliderRating.mjs";
31
25
  import { SubmitButton } from "../submit-button/SubmitButton.mjs";
32
- var _excluded = ["header", "submitText", "formConfig", "notificationText", "notificationTitle", "learnMoreLink", "Children", "styles", "forwardRef", "status", "theme", "background", "rating", "visible", "onVisibleChange", "notificationVisible", "onNotificationClose", "getI18nText", "errorFeedbackEmail", "modalWidth", "Illustration", "Notice"];
33
26
  /*!__reshadow-styles__:"../../style/feedback-rating.shadow.css"*/
34
- var style = (
27
+ const style = (
35
28
  /*__reshadow_css_start__*/
36
29
  (sstyled.insert(
37
30
  /*__inner_css_start__*/
38
- ".___SFeedbackRating_rhp4z_gg_ ul{margin:0;padding:0;list-style:none}.___SFeedbackRating_rhp4z_gg_ li{list-style:none}.___SFeedbackRating_rhp4z_gg_ .___SHeader_rhp4z_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);font-weight:var(--intergalactic-bold, 700);margin:var(--intergalactic-spacing-4x, 16px)0;text-align:center}",
31
+ ".___SFeedbackRating_lr4d3_gg_ ul{margin:0;padding:0;list-style:none}.___SFeedbackRating_lr4d3_gg_ li{list-style:none}.___SFeedbackRating_lr4d3_gg_ .___SHeader_lr4d3_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);font-weight:var(--intergalactic-bold, 700);margin:var(--intergalactic-spacing-4x, 16px)0;text-align:center}",
39
32
  /*__inner_css_end__*/
40
- "rhp4z_gg_"
33
+ "lr4d3_gg_"
41
34
  ), /*__reshadow_css_end__*/
42
35
  {
43
- "__SFeedbackRating": "___SFeedbackRating_rhp4z_gg_",
44
- "__SHeader": "___SHeader_rhp4z_gg_"
36
+ "__SFeedbackRating": "___SFeedbackRating_lr4d3_gg_",
37
+ "__SHeader": "___SHeader_lr4d3_gg_"
45
38
  })
46
39
  );
47
- var FeedbackRatingRoot = /* @__PURE__ */ (function(_Component) {
48
- function FeedbackRatingRoot2() {
49
- var _this;
50
- _classCallCheck(this, FeedbackRatingRoot2);
51
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
52
- args[_key] = arguments[_key];
53
- }
54
- _this = _callSuper(this, FeedbackRatingRoot2, [].concat(args));
55
- _defineProperty(_this, "state", {
40
+ class FeedbackRatingRoot extends Component {
41
+ constructor(...args) {
42
+ super(...args);
43
+ _defineProperty(this, "state", {
56
44
  error: false
57
45
  });
58
- _defineProperty(_this, "manager", new NoticeBubbleManager());
59
- _defineProperty(_this, "focusDecorator", createFocusDecorator());
60
- _defineProperty(_this, "handleChangeRating", function(rating) {
46
+ _defineProperty(this, "manager", new NoticeBubbleManager());
47
+ _defineProperty(this, "focusDecorator", createFocusDecorator());
48
+ _defineProperty(this, "handleChangeRating", (rating) => {
61
49
  if (rating > 0) {
62
- _this.asProps.onVisibleChange(true, rating);
50
+ this.asProps.onVisibleChange(true, rating);
63
51
  }
64
52
  });
65
- _defineProperty(_this, "handelCloseModal", function() {
66
- _this.asProps.onVisibleChange(false, _this.asProps.rating);
53
+ _defineProperty(this, "handelCloseModal", () => {
54
+ this.asProps.onVisibleChange(false, this.asProps.rating);
67
55
  });
68
- _defineProperty(_this, "handleChange", function(fn) {
69
- return function(_value, e) {
70
- fn(e);
71
- };
56
+ _defineProperty(this, "handleChange", (fn) => (_value, e) => {
57
+ fn(e);
72
58
  });
73
- _defineProperty(_this, "renderCheckbox", function(config, index) {
74
- var initialValue = _this.props.initialValues[config.key];
59
+ _defineProperty(this, "renderCheckbox", (config, index) => {
60
+ const initialValue = this.props.initialValues[config.key];
75
61
  return /* @__PURE__ */ React.createElement(Field, {
76
62
  name: config.key,
77
63
  initialValue,
78
64
  type: "checkbox",
79
65
  key: config.key
80
- }, function(_ref7) {
81
- var input = _ref7.input;
82
- return /* @__PURE__ */ React.createElement(FeedbackRating.Checkbox, _extends({}, input, {
83
- id: config.key,
84
- label: config.label,
85
- onChange: function onChange(_checked, e) {
86
- return input.onChange(e);
87
- },
88
- focused: index === 0
89
- }));
90
- });
66
+ }, ({
67
+ input
68
+ }) => /* @__PURE__ */ React.createElement(FeedbackRating.Checkbox, _extends({}, input, {
69
+ id: config.key,
70
+ label: config.label,
71
+ onChange: (_checked, e) => input.onChange(e),
72
+ focused: index === 0
73
+ })));
91
74
  });
92
- _defineProperty(_this, "renderTextField", function(config) {
93
- var _config$description;
94
- var initialValue = _this.props.initialValues[config.key];
95
- var label = typeof config.label === "string" ? /* @__PURE__ */ React.createElement(Text, {
75
+ _defineProperty(this, "renderTextField", (config) => {
76
+ var _a;
77
+ const initialValue = this.props.initialValues[config.key];
78
+ const label = typeof config.label === "string" ? /* @__PURE__ */ React.createElement(Text, {
96
79
  mb: 2,
97
80
  size: 200
98
81
  }, config.label) : config.label;
99
- var isDescriptionReactFragment = ((_config$description = config.description) === null || _config$description === void 0 ? void 0 : _config$description.type) === React.Fragment;
82
+ const isDescriptionReactFragment = ((_a = config.description) == null ? void 0 : _a.type) === React.Fragment;
100
83
  return /* @__PURE__ */ React.createElement(Flex, {
101
84
  direction: "column"
102
85
  }, /* @__PURE__ */ React.createElement(Flex, {
@@ -113,12 +96,13 @@ var FeedbackRatingRoot = /* @__PURE__ */ (function(_Component) {
113
96
  fallbackPlacements: ["right-start", "bottom"]
114
97
  },
115
98
  "aria-describedby": config.description ? config.key + "-description" : void 0
116
- }, function(_ref8) {
117
- var input = _ref8.input;
99
+ }, ({
100
+ input
101
+ }) => {
118
102
  if (config.type === "textarea") {
119
103
  return /* @__PURE__ */ React.createElement(Textarea, _extends({}, input, {
120
104
  h: 80,
121
- onChange: _this.handleChange(input.onChange),
105
+ onChange: this.handleChange(input.onChange),
122
106
  id: config.key
123
107
  }));
124
108
  }
@@ -130,7 +114,7 @@ var FeedbackRatingRoot = /* @__PURE__ */ (function(_Component) {
130
114
  return /* @__PURE__ */ React.createElement(Input, {
131
115
  state: input.state
132
116
  }, /* @__PURE__ */ React.createElement(Input.Value, _extends({}, input, {
133
- onChange: _this.handleChange(input.onChange),
117
+ onChange: this.handleChange(input.onChange),
134
118
  id: config.key
135
119
  })));
136
120
  }
@@ -143,176 +127,183 @@ var FeedbackRatingRoot = /* @__PURE__ */ (function(_Component) {
143
127
  id: config.key + "-description"
144
128
  }, config.description) : config.description));
145
129
  });
146
- return _this;
147
130
  }
148
- _inherits(FeedbackRatingRoot2, _Component);
149
- return _createClass(FeedbackRatingRoot2, [{
150
- key: "headerId",
151
- get: function get() {
152
- var uid = this.asProps.uid;
153
- return "".concat(uid, "-feedback-rating-header");
154
- }
155
- }, {
156
- key: "getHeaderProps",
157
- value: function getHeaderProps() {
158
- return {
159
- id: this.headerId
160
- };
161
- }
162
- }, {
163
- key: "getItemProps",
164
- value: function getItemProps() {
165
- var validateOnBlur = this.asProps.validateOnBlur;
166
- return {
167
- validateOnBlur
168
- };
169
- }
170
- }, {
171
- key: "getNoticeTextId",
172
- value: function getNoticeTextId() {
173
- var uid = this.asProps.uid;
174
- return "".concat(uid, "-feedback-rating-notice");
175
- }
176
- }, {
177
- key: "componentDidUpdate",
178
- value: function componentDidUpdate(prevProps) {
179
- var _this2 = this;
180
- var _this$asProps = this.asProps, status = _this$asProps.status, getI18nText = _this$asProps.getI18nText;
181
- if (prevProps.status !== status) {
131
+ get headerId() {
132
+ const {
133
+ uid
134
+ } = this.asProps;
135
+ return `${uid}-feedback-rating-header`;
136
+ }
137
+ getHeaderProps() {
138
+ return {
139
+ id: this.headerId
140
+ };
141
+ }
142
+ getItemProps() {
143
+ const {
144
+ validateOnBlur
145
+ } = this.asProps;
146
+ return {
147
+ validateOnBlur
148
+ };
149
+ }
150
+ getNoticeTextId() {
151
+ const {
152
+ uid
153
+ } = this.asProps;
154
+ return `${uid}-feedback-rating-notice`;
155
+ }
156
+ componentDidUpdate(prevProps) {
157
+ const {
158
+ status,
159
+ getI18nText
160
+ } = this.asProps;
161
+ if (prevProps.status !== status) {
162
+ this.setState({
163
+ error: false
164
+ });
165
+ if (status === "success") {
166
+ setTimeout(() => {
167
+ this.manager.add({
168
+ icon: /* @__PURE__ */ React.createElement(CheckM, {
169
+ color: "green-400"
170
+ }),
171
+ children: getI18nText("successMessage"),
172
+ initialAnimation: true,
173
+ duration: 5e3
174
+ });
175
+ }, 300);
176
+ } else if (status === "error") {
182
177
  this.setState({
183
- error: false
178
+ error: true
184
179
  });
185
- if (status === "success") {
186
- setTimeout(function() {
187
- _this2.manager.add({
188
- icon: /* @__PURE__ */ React.createElement(CheckM, {
189
- color: "green-400"
190
- }),
191
- children: getI18nText("successMessage"),
192
- initialAnimation: true,
193
- duration: 5e3
194
- });
195
- }, 300);
196
- } else if (status === "error") {
197
- this.setState({
198
- error: true
199
- });
200
- }
201
180
  }
202
181
  }
203
- }, {
204
- key: "render",
205
- value: function render() {
206
- var _ref = this.asProps, _ref2 = this.asProps, _ref4, _this3 = this;
207
- var _this$asProps2 = this.asProps, header = _this$asProps2.header, submitText = _this$asProps2.submitText, formConfig = _this$asProps2.formConfig, notificationText = _this$asProps2.notificationText, notificationTitle = _this$asProps2.notificationTitle, learnMoreLink = _this$asProps2.learnMoreLink;
208
- _this$asProps2.Children;
209
- var styles = _this$asProps2.styles, forwardRef = _this$asProps2.forwardRef, status = _this$asProps2.status, theme = _this$asProps2.theme, background = _this$asProps2.background, rating = _this$asProps2.rating, visible = _this$asProps2.visible;
210
- _this$asProps2.onVisibleChange;
211
- var notificationVisible = _this$asProps2.notificationVisible, onNotificationClose = _this$asProps2.onNotificationClose, getI18nText = _this$asProps2.getI18nText, errorFeedbackEmail = _this$asProps2.errorFeedbackEmail, modalWidth = _this$asProps2.modalWidth, Illustration = _this$asProps2.Illustration, NoticeComponent = _this$asProps2.Notice, other = _objectWithoutProperties(_this$asProps2, _excluded);
212
- var SFeedbackRating = Modal;
213
- var checkboxFields = formConfig.filter(function(item) {
214
- return item.type === "checkbox";
215
- });
216
- var textFields = formConfig.filter(function(item) {
217
- return item.type === "textarea" || item.type === "input" || item.type === "email";
218
- });
219
- var notificationId = this.getNoticeTextId();
220
- return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(Box, assignProps({}, _ref2), /* @__PURE__ */ React.createElement(NoticeComponent, _ref4.cn("NoticeComponent", {
221
- "visible": notificationVisible,
222
- "aria-label": getI18nText("leaveFeedback"),
223
- "tag": Flex,
224
- "alignItems": notificationTitle ? "flex-start" : "center"
225
- }), /* @__PURE__ */ React.createElement(NoticeComponent.Label, {
226
- mr: 3,
227
- "aria-hidden": true
228
- }, /* @__PURE__ */ React.createElement(Illustration, _ref4.cn("Illustration", {}))), /* @__PURE__ */ React.createElement(NoticeComponent.Content, null, notificationTitle ? /* @__PURE__ */ React.createElement(NoticeComponent.Title, null, notificationTitle) : null, /* @__PURE__ */ React.createElement(NoticeComponent.Text, {
229
- gap: 3,
230
- tag: Flex,
231
- alignItems: notificationTitle ? "flex-start" : "center"
232
- }, /* @__PURE__ */ React.createElement(Text, _ref4.cn("Text", {
233
- "id": notificationId
234
- }), notificationText), /* @__PURE__ */ React.createElement(NoticeComponent.Actions, {
235
- mt: 0
236
- }, /* @__PURE__ */ React.createElement(SliderRating, _ref4.cn("SliderRating", {
237
- "value": rating,
238
- "onChange": this.handleChangeRating,
239
- "aria-labelledby": notificationId
240
- }))), learnMoreLink && /* @__PURE__ */ React.createElement(Link, _ref4.cn("Link", {
241
- "href": learnMoreLink
242
- }), getI18nText("learnMore")))), /* @__PURE__ */ React.createElement(NoticeComponent.Close, {
243
- onClick: onNotificationClose
244
- })), /* @__PURE__ */ React.createElement(SFeedbackRating, _ref4.cn("SFeedbackRating", _objectSpread({}, assignProps({
182
+ }
183
+ render() {
184
+ var _ref = this.asProps, _ref2 = this.asProps, _ref4;
185
+ const {
186
+ header,
187
+ submitText,
188
+ formConfig,
189
+ notificationText,
190
+ notificationTitle,
191
+ learnMoreLink,
192
+ Children: _Children,
193
+ styles,
194
+ forwardRef,
195
+ status,
196
+ theme,
197
+ background,
198
+ rating,
199
+ visible,
200
+ onVisibleChange: _onVisibleChange,
201
+ notificationVisible,
202
+ onNotificationClose,
203
+ getI18nText,
204
+ errorFeedbackEmail,
205
+ modalWidth,
206
+ Illustration,
207
+ Notice: NoticeComponent,
208
+ ...other
209
+ } = this.asProps;
210
+ const SFeedbackRating = Modal;
211
+ const checkboxFields = formConfig.filter((item) => item.type === "checkbox");
212
+ const textFields = formConfig.filter((item) => item.type === "textarea" || item.type === "input" || item.type === "email");
213
+ const notificationId = this.getNoticeTextId();
214
+ return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(Box, assignProps({}, _ref2), /* @__PURE__ */ React.createElement(NoticeComponent, _ref4.cn("NoticeComponent", {
215
+ "visible": notificationVisible,
216
+ "aria-label": getI18nText("leaveFeedback"),
217
+ "tag": Flex,
218
+ "alignItems": notificationTitle ? "flex-start" : "center"
219
+ }), /* @__PURE__ */ React.createElement(NoticeComponent.Label, {
220
+ mr: 3,
221
+ "aria-hidden": true
222
+ }, /* @__PURE__ */ React.createElement(Illustration, _ref4.cn("Illustration", {}))), /* @__PURE__ */ React.createElement(NoticeComponent.Content, null, notificationTitle ? /* @__PURE__ */ React.createElement(NoticeComponent.Title, null, notificationTitle) : null, /* @__PURE__ */ React.createElement(NoticeComponent.Text, {
223
+ gap: 3,
224
+ tag: Flex,
225
+ alignItems: notificationTitle ? "flex-start" : "center"
226
+ }, /* @__PURE__ */ React.createElement(Text, _ref4.cn("Text", {
227
+ "id": notificationId
228
+ }), notificationText), /* @__PURE__ */ React.createElement(NoticeComponent.Actions, {
229
+ mt: 0
230
+ }, /* @__PURE__ */ React.createElement(SliderRating, _ref4.cn("SliderRating", {
231
+ "value": rating,
232
+ "onChange": this.handleChangeRating,
233
+ "aria-labelledby": notificationId
234
+ }))), learnMoreLink && /* @__PURE__ */ React.createElement(Link, _ref4.cn("Link", {
235
+ "href": learnMoreLink
236
+ }), getI18nText("learnMore")))), /* @__PURE__ */ React.createElement(NoticeComponent.Close, {
237
+ onClick: onNotificationClose
238
+ })), /* @__PURE__ */ React.createElement(SFeedbackRating, _ref4.cn("SFeedbackRating", {
239
+ ...assignProps({
245
240
  "visible": visible,
246
241
  "onClose": this.handelCloseModal,
247
242
  "p": 0,
248
- "use:w": modalWidth !== null && modalWidth !== void 0 ? modalWidth : 440,
243
+ "use:w": modalWidth ?? 440,
249
244
  "aria-labelledby": this.headerId
250
- }, _ref))), /* @__PURE__ */ React.createElement(Form, _ref4.cn("Form", _objectSpread({
251
- "decorators": [this.focusDecorator]
252
- }, other)), function(api) {
253
- var _ref5;
254
- return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SpinContainer, _ref5.cn("SpinContainer", {
255
- "background": background,
256
- "theme": theme,
257
- "size": "xl",
258
- "loading": status !== "loading" ? api.submitting : status === "loading",
259
- "p": 1,
260
- "m": 9
261
- }), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
262
- "justifyContent": "center"
263
- }), /* @__PURE__ */ React.createElement(SliderRating, _ref5.cn("SliderRating", {
264
- "value": rating,
265
- "readonly": true
266
- }))), (header === null || header === void 0 ? void 0 : header.type) === FeedbackRating.Header ? header : /* @__PURE__ */ React.createElement(FeedbackRating.Header, null, header), /* @__PURE__ */ React.createElement(Box, _ref5.cn("Box", _objectSpread(_objectSpread({
267
- "tag": "form",
268
- "noValidate": true,
269
- "method": "POST",
270
- "ref": forwardRef
271
- }, other), {}, {
272
- "onSubmit": api.handleSubmit
273
- })), /* @__PURE__ */ React.createElement(Field, _ref5.cn("Field", {
274
- "name": "rating",
275
- "initialValue": rating
276
- }), function(_ref9) {
277
- var input = _ref9.input;
278
- return /* @__PURE__ */ React.createElement("input", _extends({}, input, {
279
- type: "hidden"
280
- }));
281
- }), /* @__PURE__ */ React.createElement("div", _ref5.cn("div", {
282
- "role": "group",
283
- "aria-labelledby": _this3.headerId
284
- }), checkboxFields.map(function(formConfigItem, index) {
285
- return _this3.renderCheckbox(formConfigItem, index);
286
- })), textFields.map(function(formConfigItem) {
287
- return _this3.renderTextField(formConfigItem);
288
- }), _this3.state.error && /* @__PURE__ */ React.createElement(SemcoreNotice, _ref5.cn("SemcoreNotice", {
289
- "theme": "warning",
290
- "mt": 4,
291
- "mb": 4
292
- }), /* @__PURE__ */ React.createElement(SemcoreNotice.Label, null, /* @__PURE__ */ React.createElement(WarnM, _ref5.cn("WarnM", {}))), /* @__PURE__ */ React.createElement(SemcoreNotice.Content, null, getI18nText("errorMessage", {
293
- // todo: Brauer Ilia - think how to fix type
294
- // @ts-ignore
295
- email: /* @__PURE__ */ React.createElement(Link, _ref5.cn("Link", {
296
- "href": "mailto:".concat(errorFeedbackEmail)
297
- }), errorFeedbackEmail)
298
- }))), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
299
- "mt": 4,
300
- "justifyContent": "center"
301
- }), /* @__PURE__ */ React.createElement(FeedbackRating.Submit, {
302
- loading: status !== "loading" ? api.submitting : status === "loading",
303
- size: "l"
304
- }, submitText !== null && submitText !== void 0 ? submitText : getI18nText("submitButton")))));
305
- })), /* @__PURE__ */ React.createElement(NoticeBubbleContainer, _ref4.cn("NoticeBubbleContainer", {
306
- "manager": this.manager
307
- })));
308
- }
309
- }]);
310
- })(Component);
245
+ }, _ref)
246
+ }), /* @__PURE__ */ React.createElement(Form, _ref4.cn("Form", {
247
+ "decorators": [this.focusDecorator],
248
+ ...other
249
+ }), (api) => {
250
+ var _ref5;
251
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SpinContainer, _ref5.cn("SpinContainer", {
252
+ "background": background,
253
+ "theme": theme,
254
+ "size": "xl",
255
+ "loading": status !== "loading" ? api.submitting : status === "loading",
256
+ "p": 1,
257
+ "m": 9
258
+ }), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
259
+ "justifyContent": "center"
260
+ }), /* @__PURE__ */ React.createElement(SliderRating, _ref5.cn("SliderRating", {
261
+ "value": rating,
262
+ "readonly": true
263
+ }))), (header == null ? void 0 : header.type) === FeedbackRating.Header ? header : /* @__PURE__ */ React.createElement(FeedbackRating.Header, null, header), /* @__PURE__ */ React.createElement(Box, _ref5.cn("Box", {
264
+ "tag": "form",
265
+ "noValidate": true,
266
+ "method": "POST",
267
+ "ref": forwardRef,
268
+ ...other,
269
+ "onSubmit": api.handleSubmit
270
+ }), /* @__PURE__ */ React.createElement(Field, _ref5.cn("Field", {
271
+ "name": "rating",
272
+ "initialValue": rating
273
+ }), ({
274
+ input
275
+ }) => /* @__PURE__ */ React.createElement("input", _extends({}, input, {
276
+ type: "hidden"
277
+ }))), /* @__PURE__ */ React.createElement("div", _ref5.cn("div", {
278
+ "role": "group",
279
+ "aria-labelledby": this.headerId
280
+ }), checkboxFields.map((formConfigItem, index) => this.renderCheckbox(formConfigItem, index))), textFields.map((formConfigItem) => this.renderTextField(formConfigItem)), this.state.error && /* @__PURE__ */ React.createElement(SemcoreNotice, _ref5.cn("SemcoreNotice", {
281
+ "theme": "warning",
282
+ "mt": 4,
283
+ "mb": 4
284
+ }), /* @__PURE__ */ React.createElement(SemcoreNotice.Label, null, /* @__PURE__ */ React.createElement(WarnM, _ref5.cn("WarnM", {}))), /* @__PURE__ */ React.createElement(SemcoreNotice.Content, null, getI18nText("errorMessage", {
285
+ // todo: Brauer Ilia - think how to fix type
286
+ // @ts-ignore
287
+ email: /* @__PURE__ */ React.createElement(Link, _ref5.cn("Link", {
288
+ "href": `mailto:${errorFeedbackEmail}`
289
+ }), errorFeedbackEmail)
290
+ }))), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
291
+ "mt": 4,
292
+ "justifyContent": "center"
293
+ }), /* @__PURE__ */ React.createElement(FeedbackRating.Submit, {
294
+ loading: status !== "loading" ? api.submitting : status === "loading",
295
+ size: "l"
296
+ }, submitText ?? getI18nText("submitButton")))));
297
+ })), /* @__PURE__ */ React.createElement(NoticeBubbleContainer, _ref4.cn("NoticeBubbleContainer", {
298
+ "manager": this.manager
299
+ })));
300
+ }
301
+ }
311
302
  _defineProperty(FeedbackRatingRoot, "displayName", "FeedbackRatingForm");
312
303
  _defineProperty(FeedbackRatingRoot, "style", style);
313
304
  _defineProperty(FeedbackRatingRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
314
305
  _defineProperty(FeedbackRatingRoot, "defaultProps", {
315
- onSubmit: function onSubmit() {
306
+ onSubmit: () => {
316
307
  },
317
308
  i18n: localizedMessages,
318
309
  locale: "en",
@@ -320,32 +311,30 @@ _defineProperty(FeedbackRatingRoot, "defaultProps", {
320
311
  Notice: SemcoreNotice
321
312
  });
322
313
  _defineProperty(FeedbackRatingRoot, "validate", {
323
- description: function description(error) {
324
- return function() {
325
- var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
326
- var words = value.split(/\s+/);
327
- var symbols = words.join(" ");
328
- if (Boolean(value) && (symbols.length < 10 || words.length < 3)) {
329
- return error;
330
- }
331
- };
314
+ description: (error) => (value = "") => {
315
+ const words = value.split(/\s+/);
316
+ const symbols = words.join(" ");
317
+ if (Boolean(value) && (symbols.length < 10 || words.length < 3)) {
318
+ return error;
319
+ }
332
320
  },
333
- email: function email(error) {
334
- return function() {
335
- var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
336
- if (Boolean(value) && !/.+@.+\..+/i.test(String(value).toLowerCase())) {
337
- return error;
338
- }
339
- };
321
+ email: (error) => (value = "") => {
322
+ if (Boolean(value) && !/.+@.+\..+/i.test(String(value).toLowerCase())) {
323
+ return error;
324
+ }
340
325
  }
341
326
  });
342
327
  function Header(props) {
343
328
  var _ref3 = arguments[0], _ref6;
344
- var styles = props.styles;
345
- var SHeader = Modal.Title;
346
- return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SHeader, _ref6.cn("SHeader", _objectSpread({}, assignProps({}, _ref3))));
329
+ const {
330
+ styles
331
+ } = props;
332
+ const SHeader = Modal.Title;
333
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SHeader, _ref6.cn("SHeader", {
334
+ ...assignProps({}, _ref3)
335
+ }));
347
336
  }
348
- var FeedbackRating = createComponent(FeedbackRatingRoot, {
337
+ const FeedbackRating = createComponent(FeedbackRatingRoot, {
349
338
  Header,
350
339
  Item: FeedbackItem,
351
340
  Checkbox: CheckboxButton,