@semcore/feedback-form 6.42.2-prerelease.0 → 6.43.0-prerelease.0
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 +22 -28
- package/lib/cjs/FeedbackForm.js.map +1 -1
- package/lib/cjs/component/checkbox-button/CheckboxButton.js +34 -22
- package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/cjs/component/feedback-item/FeedbackItem.js +8 -8
- package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.js +63 -71
- 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 +37 -47
- package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/cjs/component/submit-button/SubmitButton.js +1 -1
- package/lib/cjs/component/submit-button/SubmitButton.js.map +1 -1
- package/lib/cjs/index.d.js +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/checkbox-button.shadow.css +2 -2
- package/lib/cjs/style/feedback-form.shadow.css +3 -3
- package/lib/cjs/style/feedback-rating.shadow.css +8 -0
- package/lib/cjs/style/slider-rating.shadow.css +3 -8
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/FeedbackForm.js +19 -22
- package/lib/es6/FeedbackForm.js.map +1 -1
- package/lib/es6/component/checkbox-button/CheckboxButton.js +31 -16
- package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/es6/component/feedback-item/FeedbackItem.js +7 -7
- package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.js +56 -61
- 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 +33 -40
- package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/es6/component/submit-button/SubmitButton.js +1 -1
- 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/index.js.map +1 -1
- package/lib/es6/style/checkbox-button.shadow.css +2 -2
- package/lib/es6/style/feedback-form.shadow.css +3 -3
- package/lib/es6/style/feedback-rating.shadow.css +8 -0
- package/lib/es6/style/slider-rating.shadow.css +3 -8
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/FeedbackForm.mjs +27 -31
- package/lib/esm/component/checkbox-button/CheckboxButton.mjs +34 -22
- package/lib/esm/component/feedback-item/FeedbackItem.mjs +6 -6
- package/lib/esm/component/feedback-rating/FeedbackRating.mjs +52 -64
- package/lib/esm/component/slider-rating/SliderRating.mjs +37 -45
- package/lib/esm/style/checkbox-button.shadow.css +2 -2
- package/lib/esm/style/feedback-form.shadow.css +3 -3
- package/lib/esm/style/feedback-rating.shadow.css +8 -0
- package/lib/esm/style/slider-rating.shadow.css +3 -8
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -3
- package/lib/types/component/feedback-item/FeedbackItem.d.ts +3 -3
- package/lib/types/component/feedback-rating/FeedbackRating.d.ts +19 -184
- package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +35 -26
- package/lib/types/component/slider-rating/SliderRating.d.ts +3 -3
- package/lib/types/component/submit-button/SubmitButton.d.ts +1 -1
- package/lib/types/index.d.ts +6 -15
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackForm.js","names":["
|
|
1
|
+
{"version":3,"file":"FeedbackForm.js","names":["Box","Button","createComponent","Component","sstyled","Root","NoticeSmart","SpinContainer","createFocusDecorator","React","Field","Form","FeedbackItem","SubmitButton","style","_sstyled","insert","FeedbackForm","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","_inherits","_createClass","key","value","getItemProps","validateOnBlur","asProps","render","SFeedbackForm","_this$asProps","Children","styles","forwardRef","loading","background","theme","other","_objectWithoutProperties","_excluded","createElement","_extends","decorators","focusDecorator","api","_ref4","cn","undefined","submitting","_objectSpread","handleSubmit","origin","onSubmit","description","error","words","split","symbols","join","email","test","String","toLowerCase","Success","props","_ref","arguments[0]","_ref5","SSuccess","SEmail","_assignProps","Cancel","_ref2","_ref6","SCancel","_assignProps2","Notice","_ref3","_ref7","_props$theme","_props$use","use","SNotice","_assignProps3","Item","Submit"],"sources":["../../src/FeedbackForm.jsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport Button from '@semcore/button';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport { NoticeSmart } from '@semcore/notice';\nimport SpinContainer from '@semcore/spin-container';\nimport createFocusDecorator from 'final-form-focus';\nimport React from 'react';\nimport { Field, Form } from 'react-final-form';\n\nimport { FeedbackItem } from './component/feedback-item/FeedbackItem';\nimport { SubmitButton } from './component/submit-button/SubmitButton';\nimport style from './style/feedback-form.shadow.css';\n\nclass FeedbackForm extends Component {\n static displayName = 'FeedbackForm';\n static style = style;\n static FinalForm = {\n Field,\n Form,\n };\n\n static defaultProps = {\n onSubmit: () => {},\n };\n\n static validate = {\n description: (error) => (value = '') => {\n const words = value.split(/\\s+/);\n const symbols = words.join(' ');\n if (symbols.length < 10 || words.length < 3) {\n return error;\n }\n },\n email: (error) => (value = '') => {\n if (!/.+@.+\\..+/i.test(String(value).toLowerCase())) {\n return error;\n }\n },\n };\n\n focusDecorator = createFocusDecorator();\n\n getItemProps() {\n const { validateOnBlur } = this.asProps;\n\n return {\n validateOnBlur,\n };\n }\n\n render() {\n const SFeedbackForm = Box;\n const { Children, styles, forwardRef, loading, background, theme, ...other } = this.asProps;\n\n return (\n <Form decorators={[this.focusDecorator]} {...other}>\n {(api) =>\n sstyled(styles)(\n <SpinContainer\n background={background}\n theme={theme}\n size='xl'\n loading={loading === undefined ? api.submitting : loading}\n >\n <SFeedbackForm\n tag='form'\n noValidate\n method='POST'\n ref={forwardRef}\n {...other}\n onSubmit={api.handleSubmit}\n >\n {typeof Children.origin === 'function' ? Children.origin(api) : <Children />}\n </SFeedbackForm>\n </SpinContainer>,\n )}\n </Form>\n );\n }\n}\n\nfunction Success(props) {\n const { Children, styles } = props;\n const SSuccess = Root;\n const SEmail = 'div';\n\n return sstyled(styles)(\n <SSuccess render={Box} tabIndex={-1}>\n <SEmail aria-hidden={true} />\n <span>\n <Children />\n </span>\n </SSuccess>,\n );\n}\n// because it is used without a wrapper\nSuccess.style = style;\n\nfunction Cancel(props) {\n const { styles } = props;\n const SCancel = Root;\n return sstyled(styles)(<SCancel render={Button} type='reset' use='secondary' theme='muted' />);\n}\n\nfunction Notice(props) {\n const { styles, theme = 'muted', use = 'secondary' } = props;\n const SNotice = Root;\n return sstyled(styles)(<SNotice render={NoticeSmart} use:theme={theme} use:use={use} />);\n}\n\nexport default createComponent(FeedbackForm, {\n Item: FeedbackItem,\n Success,\n Submit: SubmitButton,\n Cancel,\n Notice,\n});\n"],"mappings":";;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,aAAa,MAAM,yBAAyB;AACnD,OAAOC,oBAAoB,MAAM,kBAAkB;AACnD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,K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AA,aAAiC/C,KAAK;IAAA,WAAW6C;EAAG,GAAAJ,KAAA,GAAG,CAAC;AACzF;AAEA,eAAepF,eAAe,CAACe,YAAY,EAAE;EAC3C4E,IAAI,EAAEjF,YAAY;EAClB4D,OAAO,EAAPA,OAAO;EACPsB,MAAM,EAAEjF,YAAY;EACpBmE,MAAM,EAANA,MAAM;EACNK,MAAM,EAANA;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,31 +2,48 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import { sstyled as _sstyled } from "@semcore/
|
|
8
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
9
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
10
10
|
var _excluded = ["styles", "id", "label", "type", "focused"];
|
|
11
|
+
import { Box } from '@semcore/base-components';
|
|
12
|
+
import Checkbox from '@semcore/checkbox';
|
|
13
|
+
import { createComponent, Component, Root, sstyled } from '@semcore/core';
|
|
11
14
|
import React from 'react';
|
|
12
|
-
import createComponent, { Component, Root, sstyled } from '@semcore/core';
|
|
13
|
-
import { Box } from '@semcore/flex-box';
|
|
14
15
|
/*!__reshadow-styles__:"../../style/checkbox-button.shadow.css"*/
|
|
15
|
-
var style = (
|
|
16
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SCheckboxButton_hai4d_gg_{margin-top:var(--intergalactic-spacing-2x, 8px);border:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));border-radius:var(--intergalactic-rounded-medium, 6px)}@supports (color:color(display-p3 0 0 0%)){.___SCheckboxButton_hai4d_gg_{border:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SCheckboxButton_hai4d_gg_{border:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SCheckboxButton_hai4d_gg_ label{width:100%;padding:var(--intergalactic-spacing-3x, 12px);box-sizing:border-box}.___SCheckboxButton_hai4d_gg_.__checked_hai4d_gg_{cursor:pointer;border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386));background-color:rgba(0,143,248,.1)}@supports (color:color(display-p3 0 0 0%)){.___SCheckboxButton_hai4d_gg_.__checked_hai4d_gg_{border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___SCheckboxButton_hai4d_gg_.__checked_hai4d_gg_{border-color:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08334 0.73488 / 0.386))}}}@media (hover:hover){.___SCheckboxButton_hai4d_gg_:hover{cursor:pointer;border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386));background-color:rgba(0,143,248,.1)}@supports (color:color(display-p3 0 0 0%)){.___SCheckboxButton_hai4d_gg_:hover{border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___SCheckboxButton_hai4d_gg_:hover{border-color:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08334 0.73488 / 0.386))}}}.___SCheckboxButton_hai4d_gg_.__checked_hai4d_gg_:hover{background-color:rgba(0,143,248,.2)}}", /*__inner_css_end__*/"hai4d_gg_"),
|
|
16
17
|
/*__reshadow_css_end__*/
|
|
17
18
|
{
|
|
18
|
-
"__SCheckboxButton": "
|
|
19
|
-
"_checked": "
|
|
19
|
+
"__SCheckboxButton": "___SCheckboxButton_hai4d_gg_",
|
|
20
|
+
"_checked": "__checked_hai4d_gg_"
|
|
20
21
|
});
|
|
21
|
-
import Checkbox from '@semcore/checkbox';
|
|
22
22
|
var CheckboxButtonRoot = /*#__PURE__*/function (_Component) {
|
|
23
|
-
_inherits(CheckboxButtonRoot, _Component);
|
|
24
|
-
var _super = _createSuper(CheckboxButtonRoot);
|
|
25
23
|
function CheckboxButtonRoot() {
|
|
24
|
+
var _this;
|
|
26
25
|
_classCallCheck(this, CheckboxButtonRoot);
|
|
27
|
-
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
_this = _callSuper(this, CheckboxButtonRoot, [].concat(args));
|
|
30
|
+
_defineProperty(_this, "checkboxRef", /*#__PURE__*/React.createRef());
|
|
31
|
+
return _this;
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
_inherits(CheckboxButtonRoot, _Component);
|
|
34
|
+
return _createClass(CheckboxButtonRoot, [{
|
|
35
|
+
key: "componentDidMount",
|
|
36
|
+
value: function componentDidMount() {
|
|
37
|
+
var _this2 = this;
|
|
38
|
+
var focused = this.asProps.focused;
|
|
39
|
+
if (focused) {
|
|
40
|
+
setTimeout(function () {
|
|
41
|
+
var _this2$checkboxRef$cu;
|
|
42
|
+
(_this2$checkboxRef$cu = _this2.checkboxRef.current) === null || _this2$checkboxRef$cu === void 0 || _this2$checkboxRef$cu.focus();
|
|
43
|
+
}, 20);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
30
47
|
key: "render",
|
|
31
48
|
value: function render() {
|
|
32
49
|
var _ref = this.asProps,
|
|
@@ -35,22 +52,20 @@ var CheckboxButtonRoot = /*#__PURE__*/function (_Component) {
|
|
|
35
52
|
styles = _this$asProps.styles,
|
|
36
53
|
id = _this$asProps.id,
|
|
37
54
|
label = _this$asProps.label,
|
|
38
|
-
|
|
55
|
+
_type = _this$asProps.type,
|
|
39
56
|
focused = _this$asProps.focused,
|
|
40
57
|
other = _objectWithoutProperties(_this$asProps, _excluded);
|
|
41
|
-
var autoFocus = focused ? 20 : false;
|
|
42
58
|
var SCheckboxButton = Box;
|
|
43
59
|
return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SCheckboxButton, _ref2.cn("SCheckboxButton", _objectSpread({}, _assignProps({
|
|
44
60
|
"__excludeProps": ['onChange', 'id', 'type']
|
|
45
61
|
}, _ref))), /*#__PURE__*/React.createElement(Checkbox, _ref2.cn("Checkbox", _objectSpread({}, other)), /*#__PURE__*/React.createElement(Checkbox.Value, {
|
|
46
|
-
|
|
62
|
+
ref: this.checkboxRef,
|
|
47
63
|
"aria-labelledby": id
|
|
48
64
|
}), /*#__PURE__*/React.createElement(Checkbox.Text, {
|
|
49
65
|
id: id
|
|
50
66
|
}, label)));
|
|
51
67
|
}
|
|
52
68
|
}]);
|
|
53
|
-
return CheckboxButtonRoot;
|
|
54
69
|
}(Component);
|
|
55
70
|
_defineProperty(CheckboxButtonRoot, "style", style);
|
|
56
71
|
var CheckboxButton = createComponent(CheckboxButtonRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxButton.js","names":["
|
|
1
|
+
{"version":3,"file":"CheckboxButton.js","names":["Box","Checkbox","createComponent","Component","Root","sstyled","React","style","_sstyled","insert","CheckboxButtonRoot","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","createRef","_inherits","_createClass","key","value","componentDidMount","_this2","focused","asProps","setTimeout","_this2$checkboxRef$cu","checkboxRef","current","focus","render","_ref","_ref2","_this$asProps","styles","id","label","_type","type","other","_objectWithoutProperties","_excluded","SCheckboxButton","createElement","cn","_objectSpread","_assignProps","Value","ref","Text","CheckboxButton"],"sources":["../../../../src/component/checkbox-button/CheckboxButton.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport Checkbox from '@semcore/checkbox';\nimport { createComponent, Component, Root, sstyled } from '@semcore/core';\nimport React from 'react';\n\nimport style from '../../style/checkbox-button.shadow.css';\nimport type { FeedbackRatingCheckboxProps } from '../feedback-rating/FeedbackRating.type';\n\nclass CheckboxButtonRoot extends Component<FeedbackRatingCheckboxProps> {\n static style = style;\n\n checkboxRef = React.createRef<HTMLInputElement>();\n\n componentDidMount() {\n const { focused } = this.asProps;\n\n if (focused) {\n setTimeout(() => {\n this.checkboxRef.current?.focus();\n }, 20);\n }\n }\n\n render() {\n const { styles, id, label, type: _type, focused, ...other } = this.asProps;\n\n const SCheckboxButton = Root;\n return sstyled(styles)(\n <SCheckboxButton render={Box} __excludeProps={['onChange', 'id', 'type']}>\n <Checkbox {...other}>\n <Checkbox.Value ref={this.checkboxRef} aria-labelledby={id} />\n <Checkbox.Text id={id}>{label}</Checkbox.Text>\n </Checkbox>\n </SCheckboxButton>,\n );\n }\n}\n\nconst CheckboxButton = createComponent(CheckboxButtonRoot);\n\nexport default CheckboxButton;\n"],"mappings":";;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;AAAA;AAAA,IAKpBC,kBAAkB,0BAAAC,UAAA;EAAA,SAAAD,mBAAA;IAAA,IAAAE,KAAA;IAAAC,eAAA,OAAAH,kBAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAQ,UAAA,OAAAV,kBAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAAK,eAA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AsC,KAAA,CAAAY,EAAA,aAAAC,aAAA,KAAKN,KAAK,iBACjBxC,KAAA,CAAA4C,aAAA,CAACjD,QAAQ,CAACqD,KAAK;QAACC,GAAG,EAAE,IAAI,CAACrB,WAAY;QAAC,mBAAiBQ;MAAG,CAAE,CAAC,eAC9DpC,KAAA,CAAA4C,aAAA,CAACjD,QAAQ,CAACuD,IAAI;QAACd,EAAE,EAAEA;MAAG,GAAEC,KAAqB,CACrC,CACK,CAAC;IAEtB;EAAC;AAAA,EA3B8BxC,SAAS;AAAAmB,eAAA,CAApCZ,kBAAkB,WACPH,KAAK;AA6BtB,IAAMkD,cAAc,GAAGvD,eAAe,CAACQ,kBAAkB,CAAC;AAE1D,eAAe+C,cAAc","ignoreList":[]}
|
|
@@ -3,13 +3,13 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["Children", "tag", "uid", "tooltipProps"],
|
|
5
5
|
_excluded2 = ["input", "meta"];
|
|
6
|
+
import { assignProps } from '@semcore/core';
|
|
7
|
+
import pick from '@semcore/core/lib/utils/pick';
|
|
8
|
+
import propsForElement from '@semcore/core/lib/utils/propsForElement';
|
|
9
|
+
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
10
|
+
import Tooltip from '@semcore/tooltip';
|
|
6
11
|
import React from 'react';
|
|
7
12
|
import { Field } from 'react-final-form';
|
|
8
|
-
import Tooltip from '@semcore/tooltip';
|
|
9
|
-
import pick from '@semcore/utils/lib/pick';
|
|
10
|
-
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
11
|
-
import { assignProps } from '@semcore/utils/lib/core';
|
|
12
|
-
import propsForElement from '@semcore/utils/lib/propsForElement';
|
|
13
13
|
var deafultTooltipPropsList = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate'];
|
|
14
14
|
export function FeedbackItem(_ref) {
|
|
15
15
|
var Children = _ref.Children,
|
|
@@ -31,7 +31,7 @@ export function FeedbackItem(_ref) {
|
|
|
31
31
|
var popperId = "".concat(uid, "-error-description");
|
|
32
32
|
var ariaDescribedBy = props['aria-describedby'];
|
|
33
33
|
var inputProps = assignProps(_objectSpread(_objectSpread({}, propsForElement(other)), {}, {
|
|
34
|
-
state: errorState ? 'invalid' : 'normal',
|
|
34
|
+
'state': errorState ? 'invalid' : 'normal',
|
|
35
35
|
'aria-invalid': errorState ? true : false,
|
|
36
36
|
'aria-describedby': meta.active ? errorState ? popperId : ariaDescribedBy : undefined
|
|
37
37
|
}), input);
|
|
@@ -53,7 +53,7 @@ export function FeedbackItem(_ref) {
|
|
|
53
53
|
input: inputProps,
|
|
54
54
|
meta: meta
|
|
55
55
|
}, other))), /*#__PURE__*/React.createElement(Tooltip.Popper, {
|
|
56
|
-
w:
|
|
56
|
+
w: "100%",
|
|
57
57
|
id: popperId
|
|
58
58
|
}, (_meta$error = meta.error) !== null && _meta$error !== void 0 ? _meta$error : lastErrorRef.current));
|
|
59
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackItem.js","names":["
|
|
1
|
+
{"version":3,"file":"FeedbackItem.js","names":["assignProps","pick","propsForElement","uniqueIDEnhancement","Tooltip","React","Field","deafultTooltipPropsList","FeedbackItem","_ref","Children","tag","uid","_ref$tooltipProps","tooltipProps","tooltipPropsList","props","_objectWithoutProperties","_excluded","lastErrorRef","useRef","undefined","createElement","_ref2","_meta$error","input","meta","other","_excluded2","showError","validateOnBlur","submitFailed","invalid","touched","errorState","popperId","concat","ariaDescribedBy","inputProps","_objectSpread","active","error","current","_extends","visible","theme","placement","flip","fallbackPlacements","Trigger","inline","role","__excludeProps","origin","Popper","w","id","enhance"],"sources":["../../../../src/component/feedback-item/FeedbackItem.tsx"],"sourcesContent":["import { assignProps } from '@semcore/core';\nimport pick from '@semcore/core/lib/utils/pick';\nimport propsForElement from '@semcore/core/lib/utils/propsForElement';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport Tooltip from '@semcore/tooltip';\nimport React from 'react';\nimport { Field } from 'react-final-form';\n\nconst deafultTooltipPropsList = [\n 'title',\n 'theme',\n 'strategy',\n 'modifiers',\n 'placement',\n 'interaction',\n 'timeout',\n 'visible',\n 'defaultVisible',\n 'onVisibleChange',\n 'offset',\n 'preventOverflow',\n 'arrow',\n 'flip',\n 'computeStyles',\n 'eventListeners',\n 'onFirstUpdate',\n];\n\nexport function FeedbackItem({\n Children,\n tag,\n uid,\n tooltipProps: tooltipPropsList = deafultTooltipPropsList,\n ...props\n}: any) {\n const tooltipProps = pick(props, tooltipPropsList);\n const lastErrorRef = React.useRef(undefined);\n\n return (\n <Field {...props}>\n {({ input, meta, ...other }) => {\n const showError = other.validateOnBlur === false ? meta.submitFailed : true;\n const invalid = meta.invalid && meta.touched;\n const errorState = showError && invalid;\n const popperId = `${uid}-error-description`;\n const ariaDescribedBy = props['aria-describedby'];\n const inputProps = assignProps(\n {\n ...propsForElement(other),\n 'state': errorState ? 'invalid' : 'normal',\n 'aria-invalid': errorState ? true : false,\n 'aria-describedby': meta.active ? (errorState ? popperId : ariaDescribedBy) : undefined,\n },\n input,\n );\n\n if (meta?.error) lastErrorRef.current = meta.error;\n\n return (\n <Tooltip\n visible={errorState && meta.active}\n theme='warning'\n placement='left'\n flip={{\n fallbackPlacements: ['right', 'bottom'],\n }}\n {...tooltipProps}\n >\n <Tooltip.Trigger\n inline={false}\n role={undefined}\n tag={tag}\n {...(tag ? inputProps : {})}\n __excludeProps={['type', 'aria-describedby']}\n >\n {typeof Children.origin === 'function' &&\n Children.origin({\n input: inputProps,\n meta,\n ...other,\n })}\n </Tooltip.Trigger>\n <Tooltip.Popper w='100%' id={popperId}>\n {meta.error ?? lastErrorRef.current}\n </Too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cAAc,EAAE,CAAC,MAAM,EAAE,kBAAkB;IAAE,IAE5C,OAAO1C,QAAQ,CAAC2C,MAAM,KAAK,UAAU,IACpC3C,QAAQ,CAAC2C,MAAM,CAAAd,aAAA;MACbd,KAAK,EAAEa,UAAU;MACjBZ,IAAI,EAAJA;IAAI,GACDC,KAAK,CACT,CACY,CAAC,eAClBtB,KAAA,CAAAiB,aAAA,CAAClB,OAAO,CAACkD,MAAM;MAACC,CAAC,EAAC,MAAM;MAACC,EAAE,EAAErB;IAAS,IAAAX,WAAA,GACnCE,IAAI,CAACe,KAAK,cAAAjB,WAAA,cAAAA,WAAA,GAAIL,YAAY,CAACuB,OACd,CACT,CAAC;EAEd,CACK,CAAC;AAEZ;AACAlC,YAAY,CAACiD,OAAO,GAAG,CAACtD,mBAAmB,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,78 +3,76 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import
|
|
6
|
+
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
import { sstyled as _sstyled } from "@semcore/
|
|
9
|
+
import { sstyled as _sstyled } from "@semcore/core";
|
|
11
10
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
12
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
13
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
14
|
-
var _excluded = ["header", "submitText", "formConfig", "notificationText", "notificationTitle", "learnMoreLink", "Children", "styles", "forwardRef", "status", "theme", "background", "rating", "visible", "onVisibleChange", "notificationVisible", "onNotificationClose", "getI18nText", "errorFeedbackEmail", "modalWidth"];
|
|
15
|
-
import
|
|
16
|
-
import createComponent,
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import SpinContainer from '@semcore/spin-container';
|
|
20
|
-
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
21
|
-
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
22
|
-
import Notice from '@semcore/notice';
|
|
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
|
+
import { Box, Flex } from '@semcore/base-components';
|
|
15
|
+
import { createComponent, Component, sstyled, Root } from '@semcore/core';
|
|
16
|
+
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
17
|
+
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
23
18
|
import CheckM from '@semcore/icon/Check/m';
|
|
24
19
|
import WarnM from '@semcore/icon/Warning/m';
|
|
25
|
-
import { Text } from '@semcore/typography';
|
|
26
20
|
import FeedbackIllustration from '@semcore/illustration/Feedback';
|
|
21
|
+
import Input from '@semcore/input';
|
|
27
22
|
import Link from '@semcore/link';
|
|
28
|
-
import SliderRating from '../slider-rating/SliderRating';
|
|
29
23
|
import Modal from '@semcore/modal';
|
|
30
|
-
import
|
|
31
|
-
import { Box, Flex } from '@semcore/flex-box';
|
|
32
|
-
import { FeedbackItem } from '../feedback-item/FeedbackItem';
|
|
33
|
-
import { SubmitButton } from '../submit-button/SubmitButton';
|
|
34
|
-
import CheckboxButton from '../checkbox-button/CheckboxButton';
|
|
35
|
-
import Input from '@semcore/input';
|
|
36
|
-
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
24
|
+
import { default as SemcoreNotice } from '@semcore/notice';
|
|
37
25
|
import { NoticeBubbleContainer, NoticeBubbleManager } from '@semcore/notice-bubble';
|
|
26
|
+
import SpinContainer from '@semcore/spin-container';
|
|
27
|
+
import Textarea from '@semcore/textarea';
|
|
28
|
+
import { Text } from '@semcore/typography';
|
|
29
|
+
import createFocusDecorator from 'final-form-focus';
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import { Field, Form } from 'react-final-form';
|
|
38
32
|
/*!__reshadow-styles__:"../../style/feedback-rating.shadow.css"*/
|
|
39
|
-
var style = (
|
|
33
|
+
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SFeedbackRating_13l9c_gg_ ul{margin:0;padding:0;list-style:none}.___SFeedbackRating_13l9c_gg_ li{list-style:none}.___SFeedbackRating_13l9c_gg_ .___SHeader_13l9c_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__*/"13l9c_gg_"),
|
|
40
34
|
/*__reshadow_css_end__*/
|
|
41
35
|
{
|
|
42
|
-
"__SFeedbackRating": "
|
|
36
|
+
"__SFeedbackRating": "___SFeedbackRating_13l9c_gg_",
|
|
37
|
+
"__SHeader": "___SHeader_13l9c_gg_"
|
|
43
38
|
});
|
|
39
|
+
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
40
|
+
import CheckboxButton from '../checkbox-button/CheckboxButton';
|
|
41
|
+
import { FeedbackItem } from '../feedback-item/FeedbackItem';
|
|
42
|
+
import SliderRating from '../slider-rating/SliderRating';
|
|
43
|
+
import { SubmitButton } from '../submit-button/SubmitButton';
|
|
44
44
|
var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
45
|
-
_inherits(FeedbackRatingRoot, _Component);
|
|
46
|
-
var _super = _createSuper(FeedbackRatingRoot);
|
|
47
45
|
function FeedbackRatingRoot() {
|
|
48
46
|
var _this;
|
|
49
47
|
_classCallCheck(this, FeedbackRatingRoot);
|
|
50
48
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
49
|
args[_key] = arguments[_key];
|
|
52
50
|
}
|
|
53
|
-
_this =
|
|
54
|
-
_defineProperty(
|
|
51
|
+
_this = _callSuper(this, FeedbackRatingRoot, [].concat(args));
|
|
52
|
+
_defineProperty(_this, "state", {
|
|
55
53
|
error: false
|
|
56
54
|
});
|
|
57
|
-
_defineProperty(
|
|
58
|
-
_defineProperty(
|
|
59
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(_this, "manager", new NoticeBubbleManager());
|
|
56
|
+
_defineProperty(_this, "focusDecorator", createFocusDecorator());
|
|
57
|
+
_defineProperty(_this, "handleChangeRating", function (rating) {
|
|
60
58
|
if (rating > 0) {
|
|
61
59
|
_this.asProps.onVisibleChange(true, rating);
|
|
62
60
|
}
|
|
63
61
|
});
|
|
64
|
-
_defineProperty(
|
|
62
|
+
_defineProperty(_this, "handelCloseModal", function () {
|
|
65
63
|
_this.asProps.onVisibleChange(false, _this.asProps.rating);
|
|
66
64
|
});
|
|
67
|
-
_defineProperty(
|
|
68
|
-
return function (
|
|
65
|
+
_defineProperty(_this, "handleChange", function (fn) {
|
|
66
|
+
return function (_value, e) {
|
|
69
67
|
fn(e);
|
|
70
68
|
};
|
|
71
69
|
});
|
|
72
|
-
_defineProperty(
|
|
70
|
+
_defineProperty(_this, "renderCheckbox", function (config, index) {
|
|
73
71
|
var initialValue = _this.props.initialValues[config.key];
|
|
74
72
|
return /*#__PURE__*/React.createElement(Field, {
|
|
75
73
|
name: config.key,
|
|
76
74
|
initialValue: initialValue,
|
|
77
|
-
type:
|
|
75
|
+
type: "checkbox",
|
|
78
76
|
key: config.key
|
|
79
77
|
}, function (_ref7) {
|
|
80
78
|
var input = _ref7.input;
|
|
@@ -88,7 +86,7 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
88
86
|
}));
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
|
-
_defineProperty(
|
|
89
|
+
_defineProperty(_this, "renderTextField", function (config) {
|
|
92
90
|
var _config$description;
|
|
93
91
|
var initialValue = _this.props.initialValues[config.key];
|
|
94
92
|
var label = typeof config.label === 'string' ? /*#__PURE__*/React.createElement(Text, {
|
|
@@ -97,12 +95,12 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
97
95
|
}, config.label) : config.label;
|
|
98
96
|
var isDescriptionReactFragment = ((_config$description = config.description) === null || _config$description === void 0 ? void 0 : _config$description.type) === React.Fragment;
|
|
99
97
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
98
|
+
key: config.key,
|
|
100
99
|
direction: "column"
|
|
101
100
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
102
101
|
tag: "label",
|
|
103
102
|
mt: 4,
|
|
104
|
-
htmlFor: config.key
|
|
105
|
-
key: config.key
|
|
103
|
+
htmlFor: config.key
|
|
106
104
|
}, label), /*#__PURE__*/React.createElement(FeedbackRating.Item, {
|
|
107
105
|
name: config.key,
|
|
108
106
|
validate: config.validate,
|
|
@@ -144,7 +142,8 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
144
142
|
});
|
|
145
143
|
return _this;
|
|
146
144
|
}
|
|
147
|
-
|
|
145
|
+
_inherits(FeedbackRatingRoot, _Component);
|
|
146
|
+
return _createClass(FeedbackRatingRoot, [{
|
|
148
147
|
key: "headerId",
|
|
149
148
|
get: function get() {
|
|
150
149
|
var uid = this.asProps.uid;
|
|
@@ -215,7 +214,7 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
215
214
|
notificationText = _this$asProps2.notificationText,
|
|
216
215
|
notificationTitle = _this$asProps2.notificationTitle,
|
|
217
216
|
learnMoreLink = _this$asProps2.learnMoreLink,
|
|
218
|
-
|
|
217
|
+
_Children = _this$asProps2.Children,
|
|
219
218
|
styles = _this$asProps2.styles,
|
|
220
219
|
forwardRef = _this$asProps2.forwardRef,
|
|
221
220
|
status = _this$asProps2.status,
|
|
@@ -223,12 +222,14 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
223
222
|
background = _this$asProps2.background,
|
|
224
223
|
rating = _this$asProps2.rating,
|
|
225
224
|
visible = _this$asProps2.visible,
|
|
226
|
-
|
|
225
|
+
_onVisibleChange = _this$asProps2.onVisibleChange,
|
|
227
226
|
notificationVisible = _this$asProps2.notificationVisible,
|
|
228
227
|
onNotificationClose = _this$asProps2.onNotificationClose,
|
|
229
228
|
getI18nText = _this$asProps2.getI18nText,
|
|
230
229
|
errorFeedbackEmail = _this$asProps2.errorFeedbackEmail,
|
|
231
230
|
modalWidth = _this$asProps2.modalWidth,
|
|
231
|
+
Illustration = _this$asProps2.Illustration,
|
|
232
|
+
NoticeComponent = _this$asProps2.Notice,
|
|
232
233
|
other = _objectWithoutProperties(_this$asProps2, _excluded);
|
|
233
234
|
var SFeedbackRating = Modal;
|
|
234
235
|
var checkboxFields = formConfig.filter(function (item) {
|
|
@@ -238,30 +239,29 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
238
239
|
return item.type === 'textarea' || item.type === 'input' || item.type === 'email';
|
|
239
240
|
});
|
|
240
241
|
var notificationId = this.getNoticeTextId();
|
|
241
|
-
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Box, _assignProps2({}, _ref2), /*#__PURE__*/React.createElement(
|
|
242
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Box, _assignProps2({}, _ref2), /*#__PURE__*/React.createElement(NoticeComponent, _ref4.cn("NoticeComponent", {
|
|
242
243
|
"visible": notificationVisible,
|
|
243
244
|
"aria-label": getI18nText('leaveFeedback'),
|
|
244
245
|
"tag": Flex,
|
|
245
246
|
"alignItems": notificationTitle ? 'flex-start' : 'center'
|
|
246
|
-
}), /*#__PURE__*/React.createElement(
|
|
247
|
+
}), /*#__PURE__*/React.createElement(NoticeComponent.Label, {
|
|
247
248
|
mr: 3,
|
|
248
249
|
"aria-hidden": true
|
|
249
|
-
}, /*#__PURE__*/React.createElement(
|
|
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,
|
|
250
252
|
tag: Flex,
|
|
251
253
|
alignItems: notificationTitle ? 'flex-start' : 'center'
|
|
252
254
|
}, /*#__PURE__*/React.createElement(Text, _ref4.cn("Text", {
|
|
253
|
-
"mr": 3,
|
|
254
255
|
"id": notificationId
|
|
255
|
-
}), notificationText), /*#__PURE__*/React.createElement(
|
|
256
|
+
}), notificationText), /*#__PURE__*/React.createElement(NoticeComponent.Actions, {
|
|
256
257
|
mt: 0
|
|
257
258
|
}, /*#__PURE__*/React.createElement(SliderRating, _ref4.cn("SliderRating", {
|
|
258
259
|
"value": rating,
|
|
259
260
|
"onChange": this.handleChangeRating,
|
|
260
261
|
"aria-labelledby": notificationId
|
|
261
262
|
}))), learnMoreLink && /*#__PURE__*/React.createElement(Link, _ref4.cn("Link", {
|
|
262
|
-
"ml": 3,
|
|
263
263
|
"href": learnMoreLink
|
|
264
|
-
}), getI18nText('learnMore')))), /*#__PURE__*/React.createElement(
|
|
264
|
+
}), getI18nText('learnMore')))), /*#__PURE__*/React.createElement(NoticeComponent.Close, {
|
|
265
265
|
onClick: onNotificationClose
|
|
266
266
|
})), /*#__PURE__*/React.createElement(SFeedbackRating, _ref4.cn("SFeedbackRating", _objectSpread({}, _assignProps({
|
|
267
267
|
"visible": visible,
|
|
@@ -307,11 +307,11 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
307
307
|
return _this3.renderCheckbox(formConfigItem, index);
|
|
308
308
|
})), textFields.map(function (formConfigItem) {
|
|
309
309
|
return _this3.renderTextField(formConfigItem);
|
|
310
|
-
}), _this3.state.error && /*#__PURE__*/React.createElement(
|
|
310
|
+
}), _this3.state.error && /*#__PURE__*/React.createElement(SemcoreNotice, _ref5.cn("SemcoreNotice", {
|
|
311
311
|
"theme": 'warning',
|
|
312
312
|
"mt": 4,
|
|
313
313
|
"mb": 4
|
|
314
|
-
}), /*#__PURE__*/React.createElement(
|
|
314
|
+
}), /*#__PURE__*/React.createElement(SemcoreNotice.Label, null, /*#__PURE__*/React.createElement(WarnM, _ref5.cn("WarnM", {}))), /*#__PURE__*/React.createElement(SemcoreNotice.Content, null, getI18nText('errorMessage', {
|
|
315
315
|
// todo: Brauer Ilia - think how to fix type
|
|
316
316
|
// @ts-ignore
|
|
317
317
|
email: /*#__PURE__*/React.createElement(Link, _ref5.cn("Link", {
|
|
@@ -322,14 +322,13 @@ var FeedbackRatingRoot = /*#__PURE__*/function (_Component) {
|
|
|
322
322
|
"justifyContent": 'center'
|
|
323
323
|
}), /*#__PURE__*/React.createElement(FeedbackRating.Submit, {
|
|
324
324
|
loading: status !== 'loading' ? api.submitting : status === 'loading',
|
|
325
|
-
size:
|
|
325
|
+
size: "l"
|
|
326
326
|
}, submitText !== null && submitText !== void 0 ? submitText : getI18nText('submitButton')))));
|
|
327
327
|
})), /*#__PURE__*/React.createElement(NoticeBubbleContainer, _ref4.cn("NoticeBubbleContainer", {
|
|
328
328
|
"manager": this.manager
|
|
329
329
|
})));
|
|
330
330
|
}
|
|
331
331
|
}]);
|
|
332
|
-
return FeedbackRatingRoot;
|
|
333
332
|
}(Component);
|
|
334
333
|
_defineProperty(FeedbackRatingRoot, "displayName", 'FeedbackRatingForm');
|
|
335
334
|
_defineProperty(FeedbackRatingRoot, "style", style);
|
|
@@ -337,7 +336,9 @@ _defineProperty(FeedbackRatingRoot, "enhance", [i18nEnhance(localizedMessages),
|
|
|
337
336
|
_defineProperty(FeedbackRatingRoot, "defaultProps", {
|
|
338
337
|
onSubmit: function onSubmit() {},
|
|
339
338
|
i18n: localizedMessages,
|
|
340
|
-
locale: 'en'
|
|
339
|
+
locale: 'en',
|
|
340
|
+
Illustration: FeedbackIllustration,
|
|
341
|
+
Notice: SemcoreNotice
|
|
341
342
|
});
|
|
342
343
|
_defineProperty(FeedbackRatingRoot, "validate", {
|
|
343
344
|
description: function description(error) {
|
|
@@ -363,14 +364,8 @@ function Header(props) {
|
|
|
363
364
|
var _ref3 = arguments[0],
|
|
364
365
|
_ref6;
|
|
365
366
|
var styles = props.styles;
|
|
366
|
-
var SHeader =
|
|
367
|
-
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SHeader, _ref6.cn("SHeader", _objectSpread({}, _assignProps3({
|
|
368
|
-
"size": 300,
|
|
369
|
-
"tag": 'h2',
|
|
370
|
-
"mb": 4,
|
|
371
|
-
"mt": 4,
|
|
372
|
-
"textAlign": 'center'
|
|
373
|
-
}, _ref3))));
|
|
367
|
+
var SHeader = Modal.Title;
|
|
368
|
+
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SHeader, _ref6.cn("SHeader", _objectSpread({}, _assignProps3({}, _ref3))));
|
|
374
369
|
}
|
|
375
370
|
var FeedbackRating = createComponent(FeedbackRatingRoot, {
|
|
376
371
|
Header: Header,
|