@semcore/feedback-form 6.43.0-prerelease.0 → 6.43.0-prerelease.1
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/lib/cjs/FeedbackForm.js +28 -22
- package/lib/cjs/FeedbackForm.js.map +1 -1
- package/lib/cjs/component/checkbox-button/CheckboxButton.js +22 -34
- 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 +71 -63
- 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 +47 -37
- 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/feedback-form.shadow.css +1 -1
- package/lib/cjs/style/feedback-rating.shadow.css +0 -8
- package/lib/cjs/style/slider-rating.shadow.css +6 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/FeedbackForm.js +22 -19
- package/lib/es6/FeedbackForm.js.map +1 -1
- package/lib/es6/component/checkbox-button/CheckboxButton.js +16 -31
- 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 +61 -56
- 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 +40 -33
- 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 +3 -0
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/feedback-form.shadow.css +1 -1
- package/lib/es6/style/feedback-rating.shadow.css +0 -8
- package/lib/es6/style/slider-rating.shadow.css +6 -1
- 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 +31 -27
- package/lib/esm/component/checkbox-button/CheckboxButton.mjs +22 -34
- package/lib/esm/component/feedback-item/FeedbackItem.mjs +6 -6
- package/lib/esm/component/feedback-rating/FeedbackRating.mjs +64 -52
- package/lib/esm/component/slider-rating/SliderRating.mjs +45 -37
- package/lib/esm/style/feedback-form.shadow.css +1 -1
- package/lib/esm/style/feedback-rating.shadow.css +0 -8
- package/lib/esm/style/slider-rating.shadow.css +6 -1
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/component/checkbox-button/CheckboxButton.d.ts +3 -1
- package/lib/types/component/feedback-item/FeedbackItem.d.ts +3 -3
- package/lib/types/component/feedback-rating/FeedbackRating.d.ts +184 -19
- package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +26 -35
- 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 +15 -6
- package/package.json +17 -17
|
@@ -1,67 +1,73 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import { sstyled
|
|
8
|
-
import {
|
|
9
|
-
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
10
|
-
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { assignProps, sstyled as sstyled$1, Component } from "@semcore/core";
|
|
11
10
|
import React from "react";
|
|
11
|
+
import { Box, Flex } from "@semcore/flex-box";
|
|
12
|
+
import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
13
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
14
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
12
15
|
import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
|
|
13
16
|
/*!__reshadow-styles__:"../../style/slider-rating.shadow.css"*/
|
|
14
17
|
var style = (
|
|
15
18
|
/*__reshadow_css_start__*/
|
|
16
19
|
(sstyled.insert(
|
|
17
20
|
/*__inner_css_start__*/
|
|
18
|
-
".
|
|
21
|
+
".___SSliderRating_afqw6_gg_ .___SStar_afqw6_gg_{transition:all calc(var(--intergalactic-duration-control, 200)*1ms) ease-out}.___SSliderRating_afqw6_gg_.__keyboardFocused_afqw6_gg_ .___SStar_afqw6_gg_.__hovered_afqw6_gg_{cursor:pointer;transform:scale(1.3)}@media (hover:hover){.___SSliderRating_afqw6_gg_ .___SStar_afqw6_gg_:hover{cursor:pointer;transform:scale(1.3)}}.___SSliderRating_afqw6_gg_.__keyboardFocused_afqw6_gg_{outline:0;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 18, 193, 0.441))}@media (hover:hover){.___SSliderRating_afqw6_gg_.__readonly_afqw6_gg_ .___SStar_afqw6_gg_:hover{cursor:default;transform:none;transition:none}}.___SStar_afqw6_gg_.__filled_afqw6_gg_:active{animation:wobble .8s ease-in-out}.___SStar_afqw6_gg_ path{fill:var(--intergalactic-slider-rating-normal, rgb(157, 159, 158))}.___SStar_afqw6_gg_.__filled_afqw6_gg_ path{stroke-width:0;fill:var(--intergalactic-slider-rating-hover-active, rgb(168, 106, 254))}",
|
|
19
22
|
/*__inner_css_end__*/
|
|
20
|
-
"
|
|
23
|
+
"afqw6_gg_"
|
|
21
24
|
), /*__reshadow_css_end__*/
|
|
22
25
|
{
|
|
23
|
-
"__SSliderRating": "
|
|
24
|
-
"__SStar": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"__SSliderRating": "___SSliderRating_afqw6_gg_",
|
|
27
|
+
"__SStar": "___SStar_afqw6_gg_",
|
|
28
|
+
"_keyboardFocused": "__keyboardFocused_afqw6_gg_",
|
|
29
|
+
"_hovered": "__hovered_afqw6_gg_",
|
|
30
|
+
"_readonly": "__readonly_afqw6_gg_",
|
|
31
|
+
"_filled": "__filled_afqw6_gg_"
|
|
28
32
|
})
|
|
29
33
|
);
|
|
30
34
|
var MIN = 1;
|
|
31
35
|
var MAX = 5;
|
|
32
|
-
var SliderRatingRoot = /* @__PURE__ */
|
|
36
|
+
var SliderRatingRoot = /* @__PURE__ */ function(_Component) {
|
|
37
|
+
_inherits(SliderRatingRoot2, _Component);
|
|
38
|
+
var _super = _createSuper(SliderRatingRoot2);
|
|
33
39
|
function SliderRatingRoot2() {
|
|
34
40
|
var _this;
|
|
35
41
|
_classCallCheck(this, SliderRatingRoot2);
|
|
36
42
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
43
|
args[_key] = arguments[_key];
|
|
38
44
|
}
|
|
39
|
-
_this =
|
|
40
|
-
_defineProperty(_this, "state", {
|
|
45
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
41
47
|
hoveredIndex: -1,
|
|
42
48
|
clickedIndex: -1
|
|
43
49
|
});
|
|
44
|
-
_defineProperty(_this, "handleClick", function(newValue) {
|
|
45
|
-
return function(
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function(newValue) {
|
|
51
|
+
return function(e) {
|
|
46
52
|
var readonly = _this.asProps.readonly;
|
|
47
53
|
if (!readonly) {
|
|
48
54
|
_this.setValue(newValue);
|
|
49
55
|
}
|
|
50
56
|
};
|
|
51
57
|
});
|
|
52
|
-
_defineProperty(_this, "handleMouseEnder", function(index) {
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseEnder", function(index) {
|
|
53
59
|
return function() {
|
|
54
60
|
_this.setState({
|
|
55
61
|
hoveredIndex: index
|
|
56
62
|
});
|
|
57
63
|
};
|
|
58
64
|
});
|
|
59
|
-
_defineProperty(_this, "handleMouseLeave", function() {
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "handleMouseLeave", function() {
|
|
60
66
|
_this.setState({
|
|
61
67
|
hoveredIndex: -1
|
|
62
68
|
});
|
|
63
69
|
});
|
|
64
|
-
_defineProperty(_this, "setValue", function(newValue) {
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "setValue", function(newValue) {
|
|
65
71
|
var _this$asProps = _this.asProps, onChange = _this$asProps.onChange, value = _this$asProps.value;
|
|
66
72
|
if (onChange) {
|
|
67
73
|
onChange(newValue);
|
|
@@ -78,17 +84,17 @@ var SliderRatingRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
78
84
|
});
|
|
79
85
|
}
|
|
80
86
|
});
|
|
81
|
-
_defineProperty(_this, "handleKeyDown", function(event) {
|
|
87
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function(event) {
|
|
82
88
|
if (!["ArrowLeft", "ArrowRight", "Enter"].includes(event.key)) return;
|
|
83
89
|
event.preventDefault();
|
|
84
90
|
if (event.key === "Enter") {
|
|
85
91
|
var hoveredIndex = _this.state.hoveredIndex;
|
|
86
92
|
_this.setValue(hoveredIndex + 1);
|
|
87
93
|
} else {
|
|
88
|
-
var
|
|
94
|
+
var _value = _this.asProps.value;
|
|
89
95
|
var _hoveredIndex = _this.state.hoveredIndex;
|
|
90
96
|
var direction = event.key === "ArrowLeft" ? -1 : 1;
|
|
91
|
-
var newValue = _hoveredIndex === -1 ?
|
|
97
|
+
var newValue = _hoveredIndex === -1 ? _value + direction : _hoveredIndex + 1 + direction;
|
|
92
98
|
if (newValue > MAX) newValue = MAX;
|
|
93
99
|
if (newValue < MIN) newValue = MIN;
|
|
94
100
|
_this.setState({
|
|
@@ -98,8 +104,7 @@ var SliderRatingRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
98
104
|
});
|
|
99
105
|
return _this;
|
|
100
106
|
}
|
|
101
|
-
|
|
102
|
-
return _createClass(SliderRatingRoot2, [{
|
|
107
|
+
_createClass(SliderRatingRoot2, [{
|
|
103
108
|
key: "getStarProps",
|
|
104
109
|
value: function getStarProps(_, index) {
|
|
105
110
|
var _this$asProps2 = this.asProps, value = _this$asProps2.value, readonly = _this$asProps2.readonly;
|
|
@@ -146,18 +151,19 @@ var SliderRatingRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
146
151
|
return /* @__PURE__ */ React.createElement(SSliderRating, assignProps({
|
|
147
152
|
"gap": 1,
|
|
148
153
|
"role": "img",
|
|
149
|
-
"aria-label": label
|
|
154
|
+
"aria-label": label,
|
|
155
|
+
"use:tabIndex": -1
|
|
150
156
|
}, _ref), new Array(MAX).fill(null).map(function(_, index) {
|
|
151
|
-
return /* @__PURE__ */ React.createElement(
|
|
152
|
-
key: index
|
|
153
|
-
|
|
157
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
158
|
+
key: index,
|
|
159
|
+
position: "relative"
|
|
160
|
+
}, /* @__PURE__ */ React.createElement(SliderRating.Star, null));
|
|
154
161
|
}));
|
|
155
162
|
}
|
|
156
163
|
var hoverValue = hoveredIndex + 1;
|
|
157
164
|
var editModeLabel = hoverValue > 0 || value ? "".concat(label, ". ").concat(getI18nText("FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber"), ".") : label;
|
|
158
|
-
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SSliderRating, _ref3.cn("SSliderRating", _objectSpread({}, assignProps({
|
|
165
|
+
return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SSliderRating, _ref3.cn("SSliderRating", _objectSpread({}, assignProps({
|
|
159
166
|
"gap": 1,
|
|
160
|
-
"tabIndex": 0,
|
|
161
167
|
"onMouseLeave": this.handleMouseLeave,
|
|
162
168
|
"onKeyDown": this.handleKeyDown,
|
|
163
169
|
"role": "slider",
|
|
@@ -167,16 +173,18 @@ var SliderRatingRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
167
173
|
"aria-valuetext": editModeLabel,
|
|
168
174
|
"aria-valuenow": hoverValue
|
|
169
175
|
}, _ref))), new Array(MAX).fill(null).map(function(_, index) {
|
|
170
|
-
return /* @__PURE__ */ React.createElement(
|
|
171
|
-
key: index
|
|
172
|
-
|
|
176
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
177
|
+
key: index,
|
|
178
|
+
position: "relative"
|
|
179
|
+
}, /* @__PURE__ */ React.createElement(SliderRating.Star, null));
|
|
173
180
|
}));
|
|
174
181
|
}
|
|
175
182
|
}]);
|
|
176
|
-
|
|
183
|
+
return SliderRatingRoot2;
|
|
184
|
+
}(Component);
|
|
177
185
|
_defineProperty(SliderRatingRoot, "displayName", "SliderRating");
|
|
178
186
|
_defineProperty(SliderRatingRoot, "style", style);
|
|
179
|
-
_defineProperty(SliderRatingRoot, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
|
|
187
|
+
_defineProperty(SliderRatingRoot, "enhance", [keyboardFocusEnhance(), uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
|
|
180
188
|
_defineProperty(SliderRatingRoot, "defaultProps", {
|
|
181
189
|
i18n: localizedMessages,
|
|
182
190
|
locale: "en"
|
|
@@ -184,7 +192,7 @@ _defineProperty(SliderRatingRoot, "defaultProps", {
|
|
|
184
192
|
function Star(props) {
|
|
185
193
|
var _ref2 = arguments[0], _ref4;
|
|
186
194
|
var SStar = Box;
|
|
187
|
-
return _ref4 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SStar, _ref4.cn("SStar", _objectSpread({}, assignProps({
|
|
195
|
+
return _ref4 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SStar, _ref4.cn("SStar", _objectSpread({}, assignProps({
|
|
188
196
|
"tag": "svg",
|
|
189
197
|
"role": "none",
|
|
190
198
|
"width": "24",
|
|
@@ -6,12 +6,4 @@ SFeedbackRating {
|
|
|
6
6
|
ul, li {
|
|
7
7
|
list-style: none;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
SHeader {
|
|
11
|
-
font-size: var(--intergalactic-fs-300, 16px);
|
|
12
|
-
line-height: var(--intergalactic-lh-300, 150%);
|
|
13
|
-
font-weight: var(--intergalactic-bold, 700);
|
|
14
|
-
margin: var(--intergalactic-spacing-4x, 16px) 0;
|
|
15
|
-
text-align: center;
|
|
16
|
-
}
|
|
17
9
|
}
|
|
@@ -2,12 +2,17 @@ SSliderRating SStar {
|
|
|
2
2
|
transition: all calc(var(--intergalactic-duration-control, 200) * 1ms) ease-out;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
SSliderRating
|
|
5
|
+
SSliderRating[keyboardFocused] SStar[hovered],
|
|
6
6
|
SSliderRating SStar:hover {
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
transform: scale(1.3);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
SSliderRating[keyboardFocused] {
|
|
12
|
+
outline: none;
|
|
13
|
+
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.376 0.247 264.2 / 0.441));
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
SSliderRating[readonly] SStar:hover {
|
|
12
17
|
cursor: default;
|
|
13
18
|
transform: none;
|
|
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
-
import pl from "./pl.json.mjs";
|
|
10
9
|
import pt from "./pt.json.mjs";
|
|
11
|
-
import sv from "./sv.json.mjs";
|
|
12
10
|
import tr from "./tr.json.mjs";
|
|
13
11
|
import vi from "./vi.json.mjs";
|
|
14
12
|
import zh from "./zh.json.mjs";
|
|
13
|
+
import pl from "./pl.json.mjs";
|
|
14
|
+
import sv from "./sv.json.mjs";
|
|
15
15
|
var localizedMessages = {
|
|
16
16
|
de,
|
|
17
17
|
en,
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const CheckboxButton: import("@semcore/core").
|
|
1
|
+
declare const CheckboxButton: import("@semcore/core").ComponentType<unknown, {}, {}, {
|
|
2
|
+
[key: string]: (arg: unknown) => void;
|
|
3
|
+
}, null>;
|
|
2
4
|
export default CheckboxButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function FeedbackItem({ Children, tag, uid, tooltipProps: tooltipPropsList, ...props }: any):
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function FeedbackItem({ Children, tag, uid, tooltipProps: tooltipPropsList, ...props }: any): JSX.Element;
|
|
3
3
|
export declare namespace FeedbackItem {
|
|
4
4
|
var enhance: ((props: any) => {
|
|
5
|
-
uid:
|
|
5
|
+
uid: string;
|
|
6
6
|
})[];
|
|
7
7
|
}
|
|
@@ -1,27 +1,196 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type Checkbox from '@semcore/checkbox';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { Component } from '@semcore/core';
|
|
4
|
-
import
|
|
3
|
+
import { FeedbackRatingProps, FeedbackRatingType, FormConfigItem } from './FeedbackRating.type';
|
|
5
4
|
import { NoticeBubbleManager } from '@semcore/notice-bubble';
|
|
6
|
-
import { Text } from '@semcore/typography';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import type { FeedbackRatingCheckboxProps, FeedbackRatingItemProps, FeedbackRatingProps, FormConfigItem, FeedbackRatingDefaultProps } from './FeedbackRating.type';
|
|
9
5
|
type State = {
|
|
10
6
|
error: boolean;
|
|
11
7
|
};
|
|
12
|
-
declare class FeedbackRatingRoot extends Component<FeedbackRatingProps,
|
|
8
|
+
declare class FeedbackRatingRoot extends Component<FeedbackRatingProps, {}, State, typeof FeedbackRatingRoot.enhance> {
|
|
13
9
|
static displayName: string;
|
|
14
10
|
static style: {
|
|
15
11
|
[key: string]: string;
|
|
16
12
|
};
|
|
17
13
|
static enhance: readonly [(props: any) => {
|
|
18
|
-
getI18nText:
|
|
14
|
+
getI18nText: (messageId: string, variables?: {
|
|
19
15
|
[key: string]: string | number | undefined;
|
|
20
|
-
}) => string
|
|
16
|
+
} | undefined) => string;
|
|
21
17
|
}, (props: any) => {
|
|
22
|
-
uid:
|
|
18
|
+
uid: string;
|
|
23
19
|
}];
|
|
24
|
-
static defaultProps:
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
onSubmit: () => void;
|
|
22
|
+
i18n: {
|
|
23
|
+
de: {
|
|
24
|
+
leaveFeedback: string;
|
|
25
|
+
learnMore: string;
|
|
26
|
+
formTitle: string;
|
|
27
|
+
submitButton: string;
|
|
28
|
+
successMessage: string;
|
|
29
|
+
errorMessage: string;
|
|
30
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
31
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
32
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
33
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
34
|
+
};
|
|
35
|
+
en: {
|
|
36
|
+
leaveFeedback: string;
|
|
37
|
+
learnMore: string;
|
|
38
|
+
formTitle: string;
|
|
39
|
+
submitButton: string;
|
|
40
|
+
successMessage: string;
|
|
41
|
+
errorMessage: string;
|
|
42
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
43
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
44
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
45
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
46
|
+
};
|
|
47
|
+
es: {
|
|
48
|
+
leaveFeedback: string;
|
|
49
|
+
learnMore: string;
|
|
50
|
+
formTitle: string;
|
|
51
|
+
submitButton: string;
|
|
52
|
+
successMessage: string;
|
|
53
|
+
errorMessage: string;
|
|
54
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
55
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
56
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
57
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
58
|
+
};
|
|
59
|
+
fr: {
|
|
60
|
+
leaveFeedback: string;
|
|
61
|
+
learnMore: string;
|
|
62
|
+
formTitle: string;
|
|
63
|
+
submitButton: string;
|
|
64
|
+
successMessage: string;
|
|
65
|
+
errorMessage: string;
|
|
66
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
67
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
68
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
69
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
70
|
+
};
|
|
71
|
+
it: {
|
|
72
|
+
leaveFeedback: string;
|
|
73
|
+
learnMore: string;
|
|
74
|
+
formTitle: string;
|
|
75
|
+
submitButton: string;
|
|
76
|
+
successMessage: string;
|
|
77
|
+
errorMessage: string;
|
|
78
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
79
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
80
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
81
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
82
|
+
};
|
|
83
|
+
ja: {
|
|
84
|
+
leaveFeedback: string;
|
|
85
|
+
learnMore: string;
|
|
86
|
+
formTitle: string;
|
|
87
|
+
submitButton: string;
|
|
88
|
+
successMessage: string;
|
|
89
|
+
errorMessage: string;
|
|
90
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
91
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
92
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
93
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
94
|
+
};
|
|
95
|
+
ko: {
|
|
96
|
+
leaveFeedback: string;
|
|
97
|
+
learnMore: string;
|
|
98
|
+
formTitle: string;
|
|
99
|
+
submitButton: string;
|
|
100
|
+
successMessage: string;
|
|
101
|
+
errorMessage: string;
|
|
102
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
103
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
104
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
105
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
106
|
+
};
|
|
107
|
+
nl: {
|
|
108
|
+
leaveFeedback: string;
|
|
109
|
+
learnMore: string;
|
|
110
|
+
formTitle: string;
|
|
111
|
+
submitButton: string;
|
|
112
|
+
successMessage: string;
|
|
113
|
+
errorMessage: string;
|
|
114
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
115
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
116
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
117
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
118
|
+
};
|
|
119
|
+
pt: {
|
|
120
|
+
leaveFeedback: string;
|
|
121
|
+
learnMore: string;
|
|
122
|
+
formTitle: string;
|
|
123
|
+
submitButton: string;
|
|
124
|
+
successMessage: string;
|
|
125
|
+
errorMessage: string;
|
|
126
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
127
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
128
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
129
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
130
|
+
};
|
|
131
|
+
tr: {
|
|
132
|
+
leaveFeedback: string;
|
|
133
|
+
learnMore: string;
|
|
134
|
+
formTitle: string;
|
|
135
|
+
submitButton: string;
|
|
136
|
+
successMessage: string;
|
|
137
|
+
errorMessage: string;
|
|
138
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
139
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
140
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
141
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
142
|
+
};
|
|
143
|
+
vi: {
|
|
144
|
+
leaveFeedback: string;
|
|
145
|
+
learnMore: string;
|
|
146
|
+
formTitle: string;
|
|
147
|
+
submitButton: string;
|
|
148
|
+
successMessage: string;
|
|
149
|
+
errorMessage: string;
|
|
150
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
151
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
152
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
153
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
154
|
+
};
|
|
155
|
+
zh: {
|
|
156
|
+
leaveFeedback: string;
|
|
157
|
+
learnMore: string;
|
|
158
|
+
formTitle: string;
|
|
159
|
+
submitButton: string;
|
|
160
|
+
successMessage: string;
|
|
161
|
+
errorMessage: string;
|
|
162
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
163
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
164
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
165
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
166
|
+
};
|
|
167
|
+
pl: {
|
|
168
|
+
leaveFeedback: string;
|
|
169
|
+
learnMore: string;
|
|
170
|
+
formTitle: string;
|
|
171
|
+
submitButton: string;
|
|
172
|
+
successMessage: string;
|
|
173
|
+
errorMessage: string;
|
|
174
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
175
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
176
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
177
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
178
|
+
};
|
|
179
|
+
sv: {
|
|
180
|
+
leaveFeedback: string;
|
|
181
|
+
learnMore: string;
|
|
182
|
+
formTitle: string;
|
|
183
|
+
submitButton: string;
|
|
184
|
+
successMessage: string;
|
|
185
|
+
errorMessage: string;
|
|
186
|
+
"FeedbackRating.SliderRating.ScreenReaderOnly.sliderDescriber": string;
|
|
187
|
+
"FeedbackRating.SliderRating.aria-valuetext.readonly": string;
|
|
188
|
+
"FeedbackRating.SliderRating.aria-valuetext.empty": string;
|
|
189
|
+
"FeedbackRating.SliderRating.aria-valuetext": string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
locale: string;
|
|
193
|
+
};
|
|
25
194
|
static validate: {
|
|
26
195
|
description: (error: Error | string) => (value?: string) => string | Error | undefined;
|
|
27
196
|
email: (error: Error | string) => (value?: string) => string | Error | undefined;
|
|
@@ -39,17 +208,13 @@ declare class FeedbackRatingRoot extends Component<FeedbackRatingProps, typeof F
|
|
|
39
208
|
getNoticeTextId(): string;
|
|
40
209
|
handleChangeRating: (rating: number) => void;
|
|
41
210
|
handelCloseModal: () => void;
|
|
42
|
-
handleChange: (fn: (e: React.SyntheticEvent) => void) => (
|
|
211
|
+
handleChange: (fn: (e: React.SyntheticEvent) => void) => (value: any, e: React.SyntheticEvent) => void;
|
|
43
212
|
componentDidUpdate(prevProps: Readonly<FeedbackRatingProps>): void;
|
|
44
|
-
renderCheckbox: (config: FormConfigItem, index: number) =>
|
|
45
|
-
renderTextField: (config: FormConfigItem) =>
|
|
213
|
+
renderCheckbox: (config: FormConfigItem, index: number) => JSX.Element;
|
|
214
|
+
renderTextField: (config: FormConfigItem) => JSX.Element;
|
|
46
215
|
render(): React.ReactNode;
|
|
47
216
|
}
|
|
48
|
-
declare const FeedbackRating:
|
|
217
|
+
declare const FeedbackRating: typeof FeedbackRatingType & {
|
|
49
218
|
validate: typeof FeedbackRatingRoot.validate;
|
|
50
|
-
Item: Intergalactic.Component<"div", FeedbackRatingItemProps>;
|
|
51
|
-
Submit: typeof Button;
|
|
52
|
-
Checkbox: Intergalactic.Component<typeof Checkbox, FeedbackRatingCheckboxProps>;
|
|
53
|
-
Header: typeof Text;
|
|
54
219
|
};
|
|
55
220
|
export default FeedbackRating;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import type { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeedbackFormProps } from '../../index';
|
|
3
|
+
import { FieldProps } from 'react-final-form';
|
|
4
|
+
import { Intergalactic } from '@semcore/core';
|
|
5
|
+
import Button from '@semcore/button';
|
|
6
|
+
import { Text } from '@semcore/typography';
|
|
7
|
+
import Checkbox, { CheckboxProps } from '@semcore/checkbox';
|
|
9
8
|
export type FormConfigItem = {
|
|
10
9
|
key: string;
|
|
11
10
|
label: React.ReactNode;
|
|
@@ -14,44 +13,36 @@ export type FormConfigItem = {
|
|
|
14
13
|
validate?: (value: any) => Error | string | undefined;
|
|
15
14
|
};
|
|
16
15
|
export type FeedbackRatingProps = Intergalactic.InternalTypings.EfficientOmit<FeedbackFormProps, 'initialValues' | 'loading'> & {
|
|
17
|
-
/**
|
|
16
|
+
/** status of form */
|
|
18
17
|
status: 'default' | 'success' | 'error' | 'loading';
|
|
19
|
-
/**
|
|
18
|
+
/** flag for show/hide notification */
|
|
20
19
|
notificationVisible: boolean;
|
|
21
|
-
/**
|
|
20
|
+
/** */
|
|
22
21
|
onNotificationClose: () => void;
|
|
23
|
-
/**
|
|
22
|
+
/** text in notification panel */
|
|
24
23
|
notificationText: string;
|
|
25
|
-
/**
|
|
24
|
+
/** title in notification panel */
|
|
26
25
|
notificationTitle?: string;
|
|
27
|
-
/**
|
|
26
|
+
/** optional link in notification panel */
|
|
28
27
|
learnMoreLink?: string;
|
|
29
|
-
/**
|
|
28
|
+
/** rating value */
|
|
30
29
|
rating: number;
|
|
31
|
-
/**
|
|
30
|
+
/** visible modal form flag */
|
|
32
31
|
visible: boolean;
|
|
33
|
-
/** Visibility changes callback */
|
|
34
32
|
onVisibleChange: (visible: boolean, rating: number) => void;
|
|
35
|
-
/**
|
|
33
|
+
/** width for modal with form */
|
|
36
34
|
modalWidth?: number | string;
|
|
37
|
-
/**
|
|
35
|
+
/** header of modal with form */
|
|
38
36
|
header: React.ReactNode;
|
|
39
|
-
/**
|
|
37
|
+
/** text for submit button of form */
|
|
40
38
|
submitText?: string;
|
|
41
|
-
/**
|
|
39
|
+
/** config for form fields */
|
|
42
40
|
formConfig: FormConfigItem[];
|
|
43
|
-
/** Initial form values including rating */
|
|
44
41
|
initialValues: Record<string, any> & {
|
|
45
42
|
rating: number;
|
|
46
43
|
};
|
|
47
|
-
/** Email address shown in error messages */
|
|
48
44
|
errorFeedbackEmail: string;
|
|
49
|
-
/** Specifies the locale for i18n support */
|
|
50
45
|
locale?: string;
|
|
51
|
-
/** Illustration element */
|
|
52
|
-
Illustration?: Intergalactic.Component<'svg', IllustrationProps>;
|
|
53
|
-
/** Notice component */
|
|
54
|
-
Notice?: typeof Notice;
|
|
55
46
|
};
|
|
56
47
|
export type FeedbackRatingItemProps = FieldProps<any, any> & {
|
|
57
48
|
/**
|
|
@@ -59,14 +50,14 @@ export type FeedbackRatingItemProps = FieldProps<any, any> & {
|
|
|
59
50
|
*/
|
|
60
51
|
tooltipProps?: string[];
|
|
61
52
|
};
|
|
62
|
-
export type FeedbackRatingCheckboxProps = Omit<
|
|
53
|
+
export type FeedbackRatingCheckboxProps = Omit<CheckboxProps, 'label'> & {
|
|
63
54
|
focused: boolean;
|
|
64
55
|
label: React.ReactNode;
|
|
65
56
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Notice: typeof Notice;
|
|
57
|
+
declare const FeedbackRatingType: Intergalactic.Component<'form', FeedbackRatingProps> & {
|
|
58
|
+
Item: Intergalactic.Component<'div', FeedbackRatingItemProps>;
|
|
59
|
+
Submit: typeof Button;
|
|
60
|
+
Checkbox: Intergalactic.Component<typeof Checkbox, FeedbackRatingCheckboxProps>;
|
|
61
|
+
Header: typeof Text;
|
|
72
62
|
};
|
|
63
|
+
export { FeedbackRatingType };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Component, Intergalactic } from '@semcore/core';
|
|
2
|
+
import { Box, BoxProps } from '@semcore/flex-box';
|
|
3
3
|
type SliderRatingProps = {
|
|
4
4
|
value: number;
|
|
5
5
|
onChange?: (value: number) => void;
|
|
@@ -8,7 +8,7 @@ type SliderRatingProps = {
|
|
|
8
8
|
type StarProps = BoxProps & {
|
|
9
9
|
filled?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const SliderRating: Intergalactic.Component<
|
|
11
|
+
declare const SliderRating: (<Tag extends Intergalactic.InternalTypings.ComponentTag = Intergalactic.Component<"div", import("@semcore/flex-box").FlexProps, {}, never[]>, Props extends SliderRatingProps = SliderRatingProps>(props: Intergalactic.InternalTypings.ComponentProps<Tag, Intergalactic.Component<"div", import("@semcore/flex-box").FlexProps, {}, never[]>, Props, {}, never[]>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<Intergalactic.Component<"div", import("@semcore/flex-box").FlexProps, {}, never[]>, Intergalactic.InternalTypings.ComponentTag, SliderRatingProps, {}, never[]> & {
|
|
12
12
|
Star: Intergalactic.Component<typeof Box, StarProps>;
|
|
13
13
|
};
|
|
14
14
|
export default SliderRating;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
FormProps,
|
|
3
|
+
FieldProps,
|
|
4
|
+
FieldInputProps,
|
|
5
|
+
FieldMetaState,
|
|
6
|
+
FieldRenderProps,
|
|
7
|
+
} from 'react-final-form';
|
|
8
|
+
|
|
9
|
+
import { Intergalactic } from '@semcore/core';
|
|
10
|
+
import Button from '@semcore/button';
|
|
11
|
+
import { NoticeSmart } from '@semcore/notice';
|
|
12
|
+
import { Box } from '@semcore/flex-box';
|
|
6
13
|
|
|
7
14
|
import { default as FeedbackRating } from './component/feedback-rating/FeedbackRating';
|
|
8
15
|
|
|
16
|
+
/** @deprecated */
|
|
17
|
+
export type IFeedbackForm = FeedbackFormProps;
|
|
9
18
|
export type FeedbackFormProps = FormProps & {
|
|
10
|
-
|
|
19
|
+
/* The event is called when the form is submitted */
|
|
11
20
|
onSubmit: (values: any, form: any, callback?: (errors?: {}) => void) => {} | Promise<{}> | void;
|
|
12
21
|
/**
|
|
13
22
|
* The property is in charge of the spinner showing
|