@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.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/FeedbackForm.js +108 -120
- package/lib/cjs/FeedbackForm.js.map +1 -1
- package/lib/cjs/component/checkbox-button/CheckboxButton.js +48 -45
- package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/cjs/component/feedback-item/FeedbackItem.js +33 -35
- package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.js +240 -274
- package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/lib/cjs/component/slider-rating/SliderRating.js +146 -147
- package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/cjs/component/submit-button/SubmitButton.js +12 -9
- package/lib/cjs/component/submit-button/SubmitButton.js.map +1 -1
- package/lib/cjs/index.d.js +3 -3
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +5 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/FeedbackForm.js +101 -113
- package/lib/es6/FeedbackForm.js.map +1 -1
- package/lib/es6/component/checkbox-button/CheckboxButton.js +44 -41
- package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/es6/component/feedback-item/FeedbackItem.js +29 -31
- package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.js +220 -254
- package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/lib/es6/component/slider-rating/SliderRating.js +138 -139
- package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/es6/component/submit-button/SubmitButton.js +11 -8
- package/lib/es6/component/submit-button/SubmitButton.js.map +1 -1
- package/lib/es6/index.d.js +0 -3
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/FeedbackForm.mjs +101 -101
- package/lib/esm/component/checkbox-button/CheckboxButton.mjs +47 -39
- package/lib/esm/component/feedback-item/FeedbackItem.mjs +29 -23
- package/lib/esm/component/feedback-rating/FeedbackRating.mjs +223 -234
- package/lib/esm/component/slider-rating/SliderRating.mjs +139 -129
- package/lib/esm/component/submit-button/SubmitButton.mjs +11 -8
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -3
- package/lib/types/component/feedback-rating/FeedbackRating.d.ts +11 -189
- package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +7 -9
- package/lib/types/component/slider-rating/SliderRating.d.ts +1 -1
- package/lib/types/index.d.ts +1 -3
- 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
|
-
|
|
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": "
|
|
37
|
-
"__SHeader": "
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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(
|
|
56
|
-
_defineProperty(
|
|
57
|
-
_defineProperty(
|
|
43
|
+
_defineProperty(this, "manager", new NoticeBubbleManager());
|
|
44
|
+
_defineProperty(this, "focusDecorator", createFocusDecorator());
|
|
45
|
+
_defineProperty(this, "handleChangeRating", rating => {
|
|
58
46
|
if (rating > 0) {
|
|
59
|
-
|
|
47
|
+
this.asProps.onVisibleChange(true, rating);
|
|
60
48
|
}
|
|
61
49
|
});
|
|
62
|
-
_defineProperty(
|
|
63
|
-
|
|
50
|
+
_defineProperty(this, "handelCloseModal", () => {
|
|
51
|
+
this.asProps.onVisibleChange(false, this.asProps.rating);
|
|
64
52
|
});
|
|
65
|
-
_defineProperty(
|
|
66
|
-
|
|
67
|
-
fn(e);
|
|
68
|
-
};
|
|
53
|
+
_defineProperty(this, "handleChange", fn => (_value, e) => {
|
|
54
|
+
fn(e);
|
|
69
55
|
});
|
|
70
|
-
_defineProperty(
|
|
71
|
-
|
|
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
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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(
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
114
|
-
|
|
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:
|
|
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:
|
|
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
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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:
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
|
242
|
+
"use:w": modalWidth ?? 440,
|
|
271
243
|
"aria-labelledby": this.headerId
|
|
272
|
-
}, _ref)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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:
|
|
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:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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
|
-
|
|
371
|
-
Header
|
|
336
|
+
const FeedbackRating = createComponent(FeedbackRatingRoot, {
|
|
337
|
+
Header,
|
|
372
338
|
Item: FeedbackItem,
|
|
373
339
|
Checkbox: CheckboxButton,
|
|
374
340
|
Submit: SubmitButton
|