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