@semcore/feedback-form 6.40.0 → 16.0.0-prerelease.11

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 (47) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/lib/cjs/FeedbackForm.js +9 -11
  3. package/lib/cjs/FeedbackForm.js.map +1 -1
  4. package/lib/cjs/component/checkbox-button/CheckboxButton.js +5 -7
  5. package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
  6. package/lib/cjs/component/feedback-item/FeedbackItem.js +4 -4
  7. package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
  8. package/lib/cjs/component/feedback-rating/FeedbackRating.js +6 -8
  9. package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
  10. package/lib/cjs/component/slider-rating/SliderRating.js +13 -17
  11. package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
  12. package/lib/cjs/style/slider-rating.shadow.css +1 -6
  13. package/lib/es6/FeedbackForm.js +9 -9
  14. package/lib/es6/FeedbackForm.js.map +1 -1
  15. package/lib/es6/component/checkbox-button/CheckboxButton.js +5 -5
  16. package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
  17. package/lib/es6/component/feedback-item/FeedbackItem.js +4 -4
  18. package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
  19. package/lib/es6/component/feedback-rating/FeedbackRating.js +6 -6
  20. package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
  21. package/lib/es6/component/slider-rating/SliderRating.js +13 -15
  22. package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
  23. package/lib/es6/style/slider-rating.shadow.css +1 -6
  24. package/lib/esm/FeedbackForm.mjs +124 -107
  25. package/lib/esm/component/checkbox-button/CheckboxButton.mjs +47 -41
  26. package/lib/esm/component/feedback-item/FeedbackItem.mjs +44 -33
  27. package/lib/esm/component/feedback-rating/FeedbackRating.mjs +288 -244
  28. package/lib/esm/component/slider-rating/SliderRating.mjs +168 -134
  29. package/lib/esm/component/submit-button/SubmitButton.mjs +14 -12
  30. package/lib/esm/index.mjs +4 -4
  31. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
  32. package/lib/esm/translations/de.json.mjs +20 -14
  33. package/lib/esm/translations/en.json.mjs +20 -14
  34. package/lib/esm/translations/es.json.mjs +20 -14
  35. package/lib/esm/translations/fr.json.mjs +20 -14
  36. package/lib/esm/translations/it.json.mjs +20 -14
  37. package/lib/esm/translations/ja.json.mjs +20 -14
  38. package/lib/esm/translations/ko.json.mjs +20 -14
  39. package/lib/esm/translations/nl.json.mjs +20 -14
  40. package/lib/esm/translations/pl.json.mjs +20 -14
  41. package/lib/esm/translations/pt.json.mjs +20 -14
  42. package/lib/esm/translations/sv.json.mjs +20 -14
  43. package/lib/esm/translations/tr.json.mjs +20 -14
  44. package/lib/esm/translations/vi.json.mjs +20 -14
  45. package/lib/esm/translations/zh.json.mjs +20 -14
  46. package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -1
  47. package/package.json +16 -19
@@ -1,310 +1,354 @@
1
- import x from "@babel/runtime/helpers/esm/objectSpread2";
2
- import Z from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import I from "@babel/runtime/helpers/esm/extends";
4
- import ee from "@babel/runtime/helpers/esm/classCallCheck";
5
- import te from "@babel/runtime/helpers/esm/createClass";
6
- import f from "@babel/runtime/helpers/esm/assertThisInitialized";
7
- import re from "@babel/runtime/helpers/esm/inherits";
8
- import ne from "@babel/runtime/helpers/esm/createSuper";
9
- import s from "@babel/runtime/helpers/esm/defineProperty";
10
- import { sstyled as ae } from "@semcore/utils/lib/core/index";
11
- import ie, { sstyled as B, assignProps as z, Component as oe } from "@semcore/core";
12
- import e from "react";
13
- import { Field as H, Form as le } from "react-final-form";
14
- import se from "final-form-focus";
15
- import me from "@semcore/spin-container";
16
- import ce from "@semcore/utils/lib/enhances/i18nEnhance";
17
- import ue from "@semcore/utils/lib/uniqueID";
18
- import u from "@semcore/notice";
19
- import de from "@semcore/icon/Check/m";
20
- import pe from "@semcore/icon/Warning/m";
21
- import { Text as P } from "@semcore/typography";
22
- import fe from "@semcore/illustration/Feedback";
23
- import he from "@semcore/link";
24
- import W from "../slider-rating/SliderRating.mjs";
25
- import ge from "@semcore/modal";
26
- import be from "@semcore/textarea";
27
- import { Flex as k, Box as N } from "@semcore/flex-box";
28
- import { FeedbackItem as ve } from "../feedback-item/FeedbackItem.mjs";
29
- import { SubmitButton as ke } from "../submit-button/SubmitButton.mjs";
30
- import ye from "../checkbox-button/CheckboxButton.mjs";
31
- import j from "@semcore/input";
32
- import { localizedMessages as A } from "../../translations/__intergalactic-dynamic-locales.mjs";
33
- import { NoticeBubbleManager as Ce, NoticeBubbleContainer as Ee } from "@semcore/notice-bubble";
34
- var xe = ["header", "submitText", "formConfig", "notificationText", "notificationTitle", "learnMoreLink", "Children", "styles", "forwardRef", "status", "theme", "background", "rating", "visible", "onVisibleChange", "notificationVisible", "onNotificationClose", "getI18nText", "errorFeedbackEmail", "modalWidth"], _e = (
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ 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 _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
7
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
8
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
+ import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
11
+ import React from "react";
12
+ import { Field, Form } from "react-final-form";
13
+ import createFocusDecorator from "final-form-focus";
14
+ import SpinContainer from "@semcore/spin-container";
15
+ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
16
+ import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
17
+ import Notice from "@semcore/notice";
18
+ import CheckM from "@semcore/icon/Check/m";
19
+ import WarnM from "@semcore/icon/Warning/m";
20
+ import { Text } from "@semcore/typography";
21
+ import FeedbackIllustration from "@semcore/illustration/Feedback";
22
+ import Link from "@semcore/link";
23
+ import SliderRating from "../slider-rating/SliderRating.mjs";
24
+ import Modal from "@semcore/modal";
25
+ import Textarea from "@semcore/textarea";
26
+ import { Flex, Box } from "@semcore/flex-box";
27
+ import { FeedbackItem } from "../feedback-item/FeedbackItem.mjs";
28
+ import { SubmitButton } from "../submit-button/SubmitButton.mjs";
29
+ import CheckboxButton from "../checkbox-button/CheckboxButton.mjs";
30
+ import Input from "@semcore/input";
31
+ import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
32
+ import { NoticeBubbleManager, NoticeBubbleContainer } from "@semcore/notice-bubble";
33
+ var _excluded = ["header", "submitText", "formConfig", "notificationText", "notificationTitle", "learnMoreLink", "Children", "styles", "forwardRef", "status", "theme", "background", "rating", "visible", "onVisibleChange", "notificationVisible", "onNotificationClose", "getI18nText", "errorFeedbackEmail", "modalWidth"];
34
+ var style = (
35
35
  /*__reshadow_css_start__*/
36
- (ae.insert(
36
+ (sstyled.insert(
37
37
  /*__inner_css_start__*/
38
- ".___SFeedbackRating_ztp5p_gg_ ul{margin:0;padding:0;list-style:none}.___SFeedbackRating_ztp5p_gg_ li{list-style:none}",
39
- "ztp5p_gg_"
38
+ ".___SFeedbackRating_kmztw_gg_ ul{margin:0;padding:0;list-style:none}.___SFeedbackRating_kmztw_gg_ li{list-style:none}",
39
+ "kmztw_gg_"
40
40
  ), {
41
- __SFeedbackRating: "___SFeedbackRating_ztp5p_gg_"
41
+ "__SFeedbackRating": "___SFeedbackRating_kmztw_gg_"
42
42
  })
43
- ), y = /* @__PURE__ */ function(b) {
44
- re(o, b);
45
- var p = ne(o);
46
- function o() {
47
- var n;
48
- ee(this, o);
49
- for (var i = arguments.length, v = new Array(i), a = 0; a < i; a++)
50
- v[a] = arguments[a];
51
- return n = p.call.apply(p, [this].concat(v)), s(f(n), "state", {
52
- error: !1
53
- }), s(f(n), "manager", new Ce()), s(f(n), "focusDecorator", se()), s(f(n), "handleChangeRating", function(t) {
54
- n.asProps.onVisibleChange(!0, t);
55
- }), s(f(n), "handelCloseModal", function() {
56
- n.asProps.onVisibleChange(!1, n.asProps.rating);
57
- }), s(f(n), "handleChange", function(t) {
58
- return function(r, m) {
59
- t(m);
43
+ );
44
+ var FeedbackRatingRoot = /* @__PURE__ */ function(_Component) {
45
+ _inherits(FeedbackRatingRoot2, _Component);
46
+ var _super = _createSuper(FeedbackRatingRoot2);
47
+ function FeedbackRatingRoot2() {
48
+ var _this;
49
+ _classCallCheck(this, FeedbackRatingRoot2);
50
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+ _this = _super.call.apply(_super, [this].concat(args));
54
+ _defineProperty(_assertThisInitialized(_this), "state", {
55
+ error: false
56
+ });
57
+ _defineProperty(_assertThisInitialized(_this), "manager", new NoticeBubbleManager());
58
+ _defineProperty(_assertThisInitialized(_this), "focusDecorator", createFocusDecorator());
59
+ _defineProperty(_assertThisInitialized(_this), "handleChangeRating", function(rating) {
60
+ _this.asProps.onVisibleChange(true, rating);
61
+ });
62
+ _defineProperty(_assertThisInitialized(_this), "handelCloseModal", function() {
63
+ _this.asProps.onVisibleChange(false, _this.asProps.rating);
64
+ });
65
+ _defineProperty(_assertThisInitialized(_this), "handleChange", function(fn) {
66
+ return function(value, e) {
67
+ fn(e);
60
68
  };
61
- }), s(f(n), "renderCheckbox", function(t, r) {
62
- var m = n.props.initialValues[t.key];
63
- return /* @__PURE__ */ e.createElement(H, {
64
- name: t.key,
65
- initialValue: m,
69
+ });
70
+ _defineProperty(_assertThisInitialized(_this), "renderCheckbox", function(config, index) {
71
+ var initialValue = _this.props.initialValues[config.key];
72
+ return /* @__PURE__ */ React.createElement(Field, {
73
+ name: config.key,
74
+ initialValue,
66
75
  type: "checkbox",
67
- key: t.key
68
- }, function(h) {
69
- var g = h.input;
70
- return /* @__PURE__ */ e.createElement(E.Checkbox, I({}, g, {
71
- id: t.key,
72
- label: t.label,
73
- onChange: function(l, F) {
74
- return g.onChange(F);
76
+ 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);
75
84
  },
76
- focused: r === 0
85
+ focused: index === 0
77
86
  }));
78
87
  });
79
- }), s(f(n), "renderTextField", function(t) {
80
- var r, m = n.props.initialValues[t.key], h = typeof t.label == "string" ? /* @__PURE__ */ e.createElement(P, {
88
+ });
89
+ _defineProperty(_assertThisInitialized(_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, {
81
93
  mb: 2,
82
94
  size: 200
83
- }, t.label) : t.label, g = ((r = t.description) === null || r === void 0 ? void 0 : r.type) === e.Fragment;
84
- return /* @__PURE__ */ e.createElement(k, {
95
+ }, config.label) : config.label;
96
+ var isDescriptionReactFragment = ((_config$description = config.description) === null || _config$description === void 0 ? void 0 : _config$description.type) === React.Fragment;
97
+ return /* @__PURE__ */ React.createElement(Flex, {
85
98
  direction: "column"
86
- }, /* @__PURE__ */ e.createElement(k, {
99
+ }, /* @__PURE__ */ React.createElement(Flex, {
87
100
  tag: "label",
88
101
  mt: 4,
89
- htmlFor: t.key,
90
- key: t.key
91
- }, h), /* @__PURE__ */ e.createElement(E.Item, {
92
- name: t.key,
93
- validate: t.validate,
94
- initialValue: m,
102
+ htmlFor: config.key,
103
+ key: config.key
104
+ }, label), /* @__PURE__ */ React.createElement(FeedbackRating.Item, {
105
+ name: config.key,
106
+ validate: config.validate,
107
+ initialValue,
95
108
  placement: "left-start",
96
109
  flip: {
97
110
  fallbackPlacements: ["right-start", "bottom"]
98
111
  },
99
- "aria-describedby": t.description ? t.key + "-description" : void 0
100
- }, function(_) {
101
- var l = _.input;
102
- return t.type === "textarea" ? /* @__PURE__ */ e.createElement(be, I({}, l, {
103
- h: 80,
104
- onChange: n.handleChange(l.onChange),
105
- id: t.key
106
- })) : t.type === "input" || t.type === "email" ? (t.type === "email" && (l.autoComplete = "email", l.type = "email"), /* @__PURE__ */ e.createElement(j, {
107
- state: l.state
108
- }, /* @__PURE__ */ e.createElement(j.Value, I({}, l, {
109
- onChange: n.handleChange(l.onChange),
110
- id: t.key
111
- })))) : null;
112
- }), t.description && /* @__PURE__ */ e.createElement(N, {
112
+ "aria-describedby": config.description ? config.key + "-description" : void 0
113
+ }, function(_ref8) {
114
+ var input = _ref8.input;
115
+ if (config.type === "textarea") {
116
+ return /* @__PURE__ */ React.createElement(Textarea, _extends({}, input, {
117
+ h: 80,
118
+ onChange: _this.handleChange(input.onChange),
119
+ id: config.key
120
+ }));
121
+ }
122
+ if (config.type === "input" || config.type === "email") {
123
+ if (config.type === "email") {
124
+ input.autoComplete = "email";
125
+ input.type = "email";
126
+ }
127
+ return /* @__PURE__ */ React.createElement(Input, {
128
+ state: input.state
129
+ }, /* @__PURE__ */ React.createElement(Input.Value, _extends({}, input, {
130
+ onChange: _this.handleChange(input.onChange),
131
+ id: config.key
132
+ })));
133
+ }
134
+ return null;
135
+ }), config.description && /* @__PURE__ */ React.createElement(Box, {
113
136
  mt: 2
114
- }, typeof t.description == "string" || g ? /* @__PURE__ */ e.createElement(P, {
137
+ }, typeof config.description === "string" || isDescriptionReactFragment ? /* @__PURE__ */ React.createElement(Text, {
115
138
  size: 200,
116
139
  color: "text-secondary",
117
- id: t.key + "-description"
118
- }, t.description) : t.description));
119
- }), n;
140
+ id: config.key + "-description"
141
+ }, config.description) : config.description));
142
+ });
143
+ return _this;
120
144
  }
121
- return te(o, [{
145
+ _createClass(FeedbackRatingRoot2, [{
122
146
  key: "headerId",
123
- get: function() {
124
- var i = this.asProps.uid;
125
- return "".concat(i, "-feedback-rating-header");
147
+ get: function get() {
148
+ var uid = this.asProps.uid;
149
+ return "".concat(uid, "-feedback-rating-header");
126
150
  }
127
151
  }, {
128
152
  key: "getHeaderProps",
129
- value: function() {
153
+ value: function getHeaderProps() {
130
154
  return {
131
155
  id: this.headerId
132
156
  };
133
157
  }
134
158
  }, {
135
159
  key: "getItemProps",
136
- value: function() {
137
- var i = this.asProps.validateOnBlur;
160
+ value: function getItemProps() {
161
+ var validateOnBlur = this.asProps.validateOnBlur;
138
162
  return {
139
- validateOnBlur: i
163
+ validateOnBlur
140
164
  };
141
165
  }
142
166
  }, {
143
167
  key: "getNoticeTextId",
144
- value: function() {
145
- var i = this.asProps.uid;
146
- return "".concat(i, "-feedback-rating-notice");
168
+ value: function getNoticeTextId() {
169
+ var uid = this.asProps.uid;
170
+ return "".concat(uid, "-feedback-rating-notice");
147
171
  }
148
172
  }, {
149
173
  key: "componentDidUpdate",
150
- value: function(i) {
151
- var v = this, a = this.asProps, t = a.status, r = a.getI18nText;
152
- i.status !== t && (this.setState({
153
- error: !1
154
- }), t === "success" ? setTimeout(function() {
155
- v.manager.add({
156
- icon: /* @__PURE__ */ e.createElement(de, {
157
- color: "green-400"
158
- }),
159
- children: r("successMessage"),
160
- initialAnimation: !0,
161
- duration: 5e3
174
+ value: function componentDidUpdate(prevProps) {
175
+ var _this2 = this;
176
+ var _this$asProps = this.asProps, status = _this$asProps.status, getI18nText = _this$asProps.getI18nText;
177
+ if (prevProps.status !== status) {
178
+ this.setState({
179
+ error: false
162
180
  });
163
- }, 300) : t === "error" && this.setState({
164
- error: !0
165
- }));
181
+ if (status === "success") {
182
+ setTimeout(function() {
183
+ _this2.manager.add({
184
+ icon: /* @__PURE__ */ React.createElement(CheckM, {
185
+ color: "green-400"
186
+ }),
187
+ children: getI18nText("successMessage"),
188
+ initialAnimation: true,
189
+ duration: 5e3
190
+ });
191
+ }, 300);
192
+ } else if (status === "error") {
193
+ this.setState({
194
+ error: true
195
+ });
196
+ }
197
+ }
166
198
  }
167
199
  }, {
168
200
  key: "render",
169
- value: function() {
170
- var i = this.asProps, v = this.asProps, a, t = this, r = this.asProps, m = r.header, h = r.submitText, g = r.formConfig, _ = r.notificationText, l = r.notificationTitle, F = r.learnMoreLink;
171
- r.Children;
172
- var w = r.styles, $ = r.forwardRef, T = r.status, O = r.theme, U = r.background, R = r.rating, q = r.visible;
173
- r.onVisibleChange;
174
- var G = r.notificationVisible, J = r.onNotificationClose, S = r.getI18nText, K = r.errorFeedbackEmail, M = r.modalWidth, L = Z(r, xe), Q = ge, X = g.filter(function(d) {
175
- return d.type === "checkbox";
176
- }), Y = g.filter(function(d) {
177
- return d.type === "textarea" || d.type === "input" || d.type === "email";
178
- }), D = this.getNoticeTextId();
179
- return a = B(w), /* @__PURE__ */ e.createElement(N, z({}, v), /* @__PURE__ */ e.createElement(u, a.cn("Notice", {
180
- visible: G,
181
- "aria-label": S("leaveFeedback"),
182
- tag: k,
183
- alignItems: l ? "flex-start" : "center"
184
- }), /* @__PURE__ */ e.createElement(u.Label, {
185
- mr: 3,
186
- "aria-hidden": !0
187
- }, /* @__PURE__ */ e.createElement(fe, a.cn("FeedbackIllustration", {}))), /* @__PURE__ */ e.createElement(u.Content, null, l ? /* @__PURE__ */ e.createElement(u.Title, null, l) : null, /* @__PURE__ */ e.createElement(u.Text, {
188
- tag: k,
189
- alignItems: l ? "flex-start" : "center"
190
- }, /* @__PURE__ */ e.createElement(P, a.cn("Text", {
201
+ value: function render() {
202
+ var _ref = this.asProps, _ref2 = this.asProps, _ref4, _this3 = this;
203
+ 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;
204
+ _this$asProps2.Children;
205
+ 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;
206
+ _this$asProps2.onVisibleChange;
207
+ var notificationVisible = _this$asProps2.notificationVisible, onNotificationClose = _this$asProps2.onNotificationClose, getI18nText = _this$asProps2.getI18nText, errorFeedbackEmail = _this$asProps2.errorFeedbackEmail, modalWidth = _this$asProps2.modalWidth, other = _objectWithoutProperties(_this$asProps2, _excluded);
208
+ var SFeedbackRating = Modal;
209
+ var checkboxFields = formConfig.filter(function(item) {
210
+ return item.type === "checkbox";
211
+ });
212
+ var textFields = formConfig.filter(function(item) {
213
+ return item.type === "textarea" || item.type === "input" || item.type === "email";
214
+ });
215
+ var notificationId = this.getNoticeTextId();
216
+ return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(Box, assignProps({}, _ref2), /* @__PURE__ */ React.createElement(Notice, _ref4.cn("Notice", {
217
+ "visible": notificationVisible,
218
+ "aria-label": getI18nText("leaveFeedback"),
219
+ "tag": Flex,
220
+ "alignItems": notificationTitle ? "flex-start" : "center"
221
+ }), /* @__PURE__ */ React.createElement(Notice.Label, {
191
222
  mr: 3,
192
- id: D
193
- }), _), /* @__PURE__ */ e.createElement(u.Actions, {
223
+ "aria-hidden": true
224
+ }, /* @__PURE__ */ React.createElement(FeedbackIllustration, _ref4.cn("FeedbackIllustration", {}))), /* @__PURE__ */ React.createElement(Notice.Content, null, notificationTitle ? /* @__PURE__ */ React.createElement(Notice.Title, null, notificationTitle) : null, /* @__PURE__ */ React.createElement(Notice.Text, {
225
+ tag: Flex,
226
+ alignItems: notificationTitle ? "flex-start" : "center"
227
+ }, /* @__PURE__ */ React.createElement(Text, _ref4.cn("Text", {
228
+ "mr": 3,
229
+ "id": notificationId
230
+ }), notificationText), /* @__PURE__ */ React.createElement(Notice.Actions, {
194
231
  mt: 0
195
- }, /* @__PURE__ */ e.createElement(W, a.cn("SliderRating", {
196
- value: R,
197
- onChange: this.handleChangeRating,
198
- "aria-labelledby": D
199
- }))), F && /* @__PURE__ */ e.createElement(he, a.cn("Link", {
200
- ml: 3,
201
- href: F
202
- }), S("learnMore")))), /* @__PURE__ */ e.createElement(u.Close, {
203
- onClick: J
204
- })), /* @__PURE__ */ e.createElement(Q, a.cn("SFeedbackRating", x({}, z({
205
- visible: q,
206
- onClose: this.handelCloseModal,
207
- p: 0,
208
- "use:w": M ?? 440,
232
+ }, /* @__PURE__ */ React.createElement(SliderRating, _ref4.cn("SliderRating", {
233
+ "value": rating,
234
+ "onChange": this.handleChangeRating,
235
+ "aria-labelledby": notificationId
236
+ }))), learnMoreLink && /* @__PURE__ */ React.createElement(Link, _ref4.cn("Link", {
237
+ "ml": 3,
238
+ "href": learnMoreLink
239
+ }), getI18nText("learnMore")))), /* @__PURE__ */ React.createElement(Notice.Close, {
240
+ onClick: onNotificationClose
241
+ })), /* @__PURE__ */ React.createElement(SFeedbackRating, _ref4.cn("SFeedbackRating", _objectSpread({}, assignProps({
242
+ "visible": visible,
243
+ "onClose": this.handelCloseModal,
244
+ "p": 0,
245
+ "use:w": modalWidth !== null && modalWidth !== void 0 ? modalWidth : 440,
209
246
  "aria-labelledby": this.headerId
210
- }, i))), /* @__PURE__ */ e.createElement(le, a.cn("Form", x({
211
- decorators: [this.focusDecorator]
212
- }, L)), function(d) {
213
- var c;
214
- return c = B(w), /* @__PURE__ */ e.createElement(me, c.cn("SpinContainer", {
215
- background: U,
216
- theme: O,
217
- size: "xl",
218
- loading: T !== "loading" ? d.submitting : T === "loading",
219
- p: 1,
220
- m: 9
221
- }), /* @__PURE__ */ e.createElement(k, c.cn("Flex", {
222
- justifyContent: "center"
223
- }), /* @__PURE__ */ e.createElement(W, c.cn("SliderRating", {
224
- value: R,
225
- readonly: !0
226
- }))), (m == null ? void 0 : m.type) === E.Header ? m : /* @__PURE__ */ e.createElement(E.Header, null, m), /* @__PURE__ */ e.createElement(N, c.cn("Box", x(x({
227
- tag: "form",
228
- noValidate: !0,
229
- method: "POST",
230
- ref: $
231
- }, L), {}, {
232
- onSubmit: d.handleSubmit
233
- })), /* @__PURE__ */ e.createElement(H, c.cn("Field", {
234
- name: "rating",
235
- initialValue: R
236
- }), function(C) {
237
- var V = C.input;
238
- return /* @__PURE__ */ e.createElement("input", I({}, V, {
247
+ }, _ref))), /* @__PURE__ */ React.createElement(Form, _ref4.cn("Form", _objectSpread({
248
+ "decorators": [this.focusDecorator]
249
+ }, other)), function(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 || 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({
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
+ }), function(_ref9) {
274
+ var input = _ref9.input;
275
+ return /* @__PURE__ */ React.createElement("input", _extends({}, input, {
239
276
  type: "hidden"
240
277
  }));
241
- }), /* @__PURE__ */ e.createElement("div", c.cn("div", {
242
- role: "group",
243
- "aria-labelledby": t.headerId
244
- }), X.map(function(C, V) {
245
- return t.renderCheckbox(C, V);
246
- })), Y.map(function(C) {
247
- return t.renderTextField(C);
248
- }), t.state.error && /* @__PURE__ */ e.createElement(u, c.cn("Notice", {
249
- theme: "warning",
250
- mt: 4,
251
- mb: 4
252
- }), /* @__PURE__ */ e.createElement(u.Label, null, /* @__PURE__ */ e.createElement(pe, c.cn("WarnM", {}))), /* @__PURE__ */ e.createElement(u.Content, null, S("errorMessage", {
253
- email: K
254
- }))), /* @__PURE__ */ e.createElement(k, c.cn("Flex", {
255
- mt: 4,
256
- justifyContent: "center"
257
- }), /* @__PURE__ */ e.createElement(E.Submit, {
258
- loading: T !== "loading" ? d.submitting : T === "loading",
278
+ }), /* @__PURE__ */ React.createElement("div", _ref5.cn("div", {
279
+ "role": "group",
280
+ "aria-labelledby": _this3.headerId
281
+ }), checkboxFields.map(function(formConfigItem, index) {
282
+ return _this3.renderCheckbox(formConfigItem, index);
283
+ })), textFields.map(function(formConfigItem) {
284
+ return _this3.renderTextField(formConfigItem);
285
+ }), _this3.state.error && /* @__PURE__ */ React.createElement(Notice, _ref5.cn("Notice", {
286
+ "theme": "warning",
287
+ "mt": 4,
288
+ "mb": 4
289
+ }), /* @__PURE__ */ React.createElement(Notice.Label, null, /* @__PURE__ */ React.createElement(WarnM, _ref5.cn("WarnM", {}))), /* @__PURE__ */ React.createElement(Notice.Content, null, getI18nText("errorMessage", {
290
+ email: errorFeedbackEmail
291
+ }))), /* @__PURE__ */ React.createElement(Flex, _ref5.cn("Flex", {
292
+ "mt": 4,
293
+ "justifyContent": "center"
294
+ }), /* @__PURE__ */ React.createElement(FeedbackRating.Submit, {
295
+ loading: status !== "loading" ? api.submitting : status === "loading",
259
296
  size: "l"
260
- }, h ?? S("submitButton")))));
261
- })), /* @__PURE__ */ e.createElement(Ee, a.cn("NoticeBubbleContainer", {
262
- manager: this.manager
297
+ }, submitText !== null && submitText !== void 0 ? submitText : getI18nText("submitButton")))));
298
+ })), /* @__PURE__ */ React.createElement(NoticeBubbleContainer, _ref4.cn("NoticeBubbleContainer", {
299
+ "manager": this.manager
263
300
  })));
264
301
  }
265
- }]), o;
266
- }(oe);
267
- s(y, "displayName", "FeedbackRatingForm");
268
- s(y, "style", _e);
269
- s(y, "enhance", [ce(A), ue()]);
270
- s(y, "defaultProps", {
271
- onSubmit: function() {
302
+ }]);
303
+ return FeedbackRatingRoot2;
304
+ }(Component);
305
+ _defineProperty(FeedbackRatingRoot, "displayName", "FeedbackRatingForm");
306
+ _defineProperty(FeedbackRatingRoot, "style", style);
307
+ _defineProperty(FeedbackRatingRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
308
+ _defineProperty(FeedbackRatingRoot, "defaultProps", {
309
+ onSubmit: function onSubmit() {
272
310
  },
273
- i18n: A,
311
+ i18n: localizedMessages,
274
312
  locale: "en"
275
313
  });
276
- s(y, "validate", {
277
- description: function(p) {
314
+ _defineProperty(FeedbackRatingRoot, "validate", {
315
+ description: function description(error) {
278
316
  return function() {
279
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", n = o.split(/\s+/), i = n.join(" ");
280
- if (o && (i.length < 10 || n.length < 3))
281
- return p;
317
+ var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
318
+ var words = value.split(/\s+/);
319
+ var symbols = words.join(" ");
320
+ if (Boolean(value) && (symbols.length < 10 || words.length < 3)) {
321
+ return error;
322
+ }
282
323
  };
283
324
  },
284
- email: function(p) {
325
+ email: function email(error) {
285
326
  return function() {
286
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
287
- if (o && !/.+@.+\..+/i.test(String(o).toLowerCase()))
288
- return p;
327
+ var value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
328
+ if (Boolean(value) && !/.+@.+\..+/i.test(String(value).toLowerCase())) {
329
+ return error;
330
+ }
289
331
  };
290
332
  }
291
333
  });
292
- function Fe(b) {
293
- var p = arguments[0], o, n = b.styles, i = P;
294
- return o = B(n), /* @__PURE__ */ e.createElement(i, o.cn("SHeader", x({}, z({
295
- size: 300,
296
- tag: "h2",
297
- mb: 4,
298
- mt: 4,
299
- textAlign: "center"
300
- }, p))));
334
+ function Header(props) {
335
+ var _ref3 = arguments[0], _ref6;
336
+ var styles = props.styles;
337
+ var SHeader = Text;
338
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SHeader, _ref6.cn("SHeader", _objectSpread({}, assignProps({
339
+ "size": 300,
340
+ "tag": "h2",
341
+ "mb": 4,
342
+ "mt": 4,
343
+ "textAlign": "center"
344
+ }, _ref3))));
301
345
  }
302
- var E = ie(y, {
303
- Header: Fe,
304
- Item: ve,
305
- Checkbox: ye,
306
- Submit: ke
346
+ var FeedbackRating = createComponent(FeedbackRatingRoot, {
347
+ Header,
348
+ Item: FeedbackItem,
349
+ Checkbox: CheckboxButton,
350
+ Submit: SubmitButton
307
351
  });
308
352
  export {
309
- E as default
353
+ FeedbackRating as default
310
354
  };