@semcore/feedback-form 6.42.0 → 6.42.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/CHANGELOG.md +6 -0
- package/lib/cjs/FeedbackForm.js +10 -8
- package/lib/cjs/FeedbackForm.js.map +1 -1
- package/lib/cjs/component/checkbox-button/CheckboxButton.js +6 -4
- package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.js +5 -3
- package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/cjs/component/slider-rating/SliderRating.js +10 -8
- package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/es6/FeedbackForm.js +10 -8
- package/lib/es6/FeedbackForm.js.map +1 -1
- package/lib/es6/component/checkbox-button/CheckboxButton.js +6 -4
- package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.js +5 -3
- package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/es6/component/slider-rating/SliderRating.js +10 -8
- package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/esm/FeedbackForm.mjs +129 -108
- package/lib/esm/component/checkbox-button/CheckboxButton.mjs +52 -42
- package/lib/esm/component/feedback-item/FeedbackItem.mjs +44 -33
- package/lib/esm/component/feedback-rating/FeedbackRating.mjs +297 -247
- package/lib/esm/component/slider-rating/SliderRating.mjs +178 -138
- package/lib/esm/component/submit-button/SubmitButton.mjs +14 -12
- package/lib/esm/index.mjs +4 -4
- package/lib/esm/style/checkbox-button.shadow.css +21 -0
- package/lib/esm/style/feedback-form.shadow.css +36 -0
- package/lib/esm/style/feedback-rating.shadow.css +9 -0
- package/lib/esm/style/slider-rating.shadow.css +33 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +20 -14
- package/lib/esm/translations/en.json.mjs +20 -14
- package/lib/esm/translations/es.json.mjs +20 -14
- package/lib/esm/translations/fr.json.mjs +20 -14
- package/lib/esm/translations/it.json.mjs +20 -14
- package/lib/esm/translations/ja.json.mjs +20 -14
- package/lib/esm/translations/ko.json.mjs +20 -14
- package/lib/esm/translations/nl.json.mjs +20 -14
- package/lib/esm/translations/pl.json.mjs +20 -14
- package/lib/esm/translations/pt.json.mjs +20 -14
- package/lib/esm/translations/sv.json.mjs +20 -14
- package/lib/esm/translations/tr.json.mjs +20 -14
- package/lib/esm/translations/vi.json.mjs +20 -14
- package/lib/esm/translations/zh.json.mjs +20 -14
- package/package.json +16 -16
|
@@ -1,50 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { Box
|
|
12
|
-
import
|
|
13
|
-
var
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Box } from "@semcore/flex-box";
|
|
12
|
+
import Checkbox from "@semcore/checkbox";
|
|
13
|
+
var _excluded = ["styles", "id", "label", "type", "focused"];
|
|
14
|
+
/*!__reshadow-styles__:"../../style/checkbox-button.shadow.css"*/
|
|
15
|
+
var style = (
|
|
14
16
|
/*__reshadow_css_start__*/
|
|
15
|
-
(
|
|
17
|
+
(sstyled.insert(
|
|
16
18
|
/*__inner_css_start__*/
|
|
17
|
-
".
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
".___SCheckboxButton_14l0f_gg_{margin-top:var(--intergalactic-spacing-2x, 8px);border:1px solid var(--intergalactic-border-primary, #c4c7cf);border-radius:var(--intergalactic-rounded-medium, 6px)}.___SCheckboxButton_14l0f_gg_ label{width:100%;padding:var(--intergalactic-spacing-3x, 12px);box-sizing:border-box}.___SCheckboxButton_14l0f_gg_.__checked_14l0f_gg_{cursor:pointer;border-color:var(--intergalactic-border-info-active, #006dca);background-color:rgba(0,143,248,.1)}@media (hover:hover){.___SCheckboxButton_14l0f_gg_:hover{cursor:pointer;border-color:var(--intergalactic-border-info-active, #006dca);background-color:rgba(0,143,248,.1)}.___SCheckboxButton_14l0f_gg_.__checked_14l0f_gg_:hover{background-color:rgba(0,143,248,.2)}}",
|
|
20
|
+
/*__inner_css_end__*/
|
|
21
|
+
"14l0f_gg_"
|
|
22
|
+
), /*__reshadow_css_end__*/
|
|
23
|
+
{
|
|
24
|
+
"__SCheckboxButton": "___SCheckboxButton_14l0f_gg_",
|
|
25
|
+
"_checked": "__checked_14l0f_gg_"
|
|
22
26
|
})
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
);
|
|
28
|
+
var CheckboxButtonRoot = /* @__PURE__ */ function(_Component) {
|
|
29
|
+
_inherits(CheckboxButtonRoot2, _Component);
|
|
30
|
+
var _super = _createSuper(CheckboxButtonRoot2);
|
|
31
|
+
function CheckboxButtonRoot2() {
|
|
32
|
+
_classCallCheck(this, CheckboxButtonRoot2);
|
|
33
|
+
return _super.apply(this, arguments);
|
|
28
34
|
}
|
|
29
|
-
|
|
35
|
+
_createClass(CheckboxButtonRoot2, [{
|
|
30
36
|
key: "render",
|
|
31
|
-
value: function() {
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
}), /* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
value: function render() {
|
|
38
|
+
var _ref = this.asProps, _ref2;
|
|
39
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, id = _this$asProps.id, label = _this$asProps.label;
|
|
40
|
+
_this$asProps.type;
|
|
41
|
+
var focused = _this$asProps.focused, other = _objectWithoutProperties(_this$asProps, _excluded);
|
|
42
|
+
var autoFocus = focused ? 20 : false;
|
|
43
|
+
var SCheckboxButton = Box;
|
|
44
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCheckboxButton, _ref2.cn("SCheckboxButton", _objectSpread({}, assignProps({
|
|
45
|
+
"__excludeProps": ["onChange", "id", "type"]
|
|
46
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Checkbox, _ref2.cn("Checkbox", _objectSpread({}, other)), /* @__PURE__ */ React.createElement(Checkbox.Value, {
|
|
47
|
+
autoFocus,
|
|
48
|
+
"aria-labelledby": id
|
|
49
|
+
}), /* @__PURE__ */ React.createElement(Checkbox.Text, {
|
|
50
|
+
id
|
|
51
|
+
}, label)));
|
|
43
52
|
}
|
|
44
|
-
}])
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
}]);
|
|
54
|
+
return CheckboxButtonRoot2;
|
|
55
|
+
}(Component);
|
|
56
|
+
_defineProperty(CheckboxButtonRoot, "style", style);
|
|
57
|
+
var CheckboxButton = createComponent(CheckboxButtonRoot);
|
|
48
58
|
export {
|
|
49
|
-
|
|
59
|
+
CheckboxButton as default
|
|
50
60
|
};
|
|
@@ -1,45 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Field
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { assignProps
|
|
10
|
-
import
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Field } from "react-final-form";
|
|
6
|
+
import Tooltip from "@semcore/tooltip";
|
|
7
|
+
import pick from "@semcore/utils/lib/pick";
|
|
8
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
9
|
+
import { assignProps } from "@semcore/utils/lib/core";
|
|
10
|
+
import propsForElement from "@semcore/utils/lib/propsForElement";
|
|
11
|
+
var _excluded = ["Children", "tag", "uid", "tooltipProps"], _excluded2 = ["input", "meta"];
|
|
12
|
+
var deafultTooltipPropsList = ["title", "theme", "strategy", "modifiers", "placement", "interaction", "timeout", "visible", "defaultVisible", "onVisibleChange", "offset", "preventOverflow", "arrow", "flip", "computeStyles", "eventListeners", "onFirstUpdate"];
|
|
13
|
+
function FeedbackItem(_ref) {
|
|
14
|
+
var Children = _ref.Children, tag = _ref.tag, uid = _ref.uid, _ref$tooltipProps = _ref.tooltipProps, tooltipPropsList = _ref$tooltipProps === void 0 ? deafultTooltipPropsList : _ref$tooltipProps, props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
var tooltipProps = pick(props, tooltipPropsList);
|
|
16
|
+
var lastErrorRef = React.useRef(void 0);
|
|
17
|
+
return /* @__PURE__ */ React.createElement(Field, props, function(_ref2) {
|
|
18
|
+
var _meta$error;
|
|
19
|
+
var input = _ref2.input, meta = _ref2.meta, other = _objectWithoutProperties(_ref2, _excluded2);
|
|
20
|
+
var showError = other.validateOnBlur === false ? meta.submitFailed : true;
|
|
21
|
+
var invalid = meta.invalid && meta.touched;
|
|
22
|
+
var errorState = showError && invalid;
|
|
23
|
+
var popperId = "".concat(uid, "-error-description");
|
|
24
|
+
var ariaDescribedBy = props["aria-describedby"];
|
|
25
|
+
var inputProps = assignProps(_objectSpread(_objectSpread({}, propsForElement(other)), {}, {
|
|
26
|
+
state: errorState ? "invalid" : "normal",
|
|
27
|
+
"aria-invalid": errorState ? true : false,
|
|
28
|
+
"aria-describedby": meta.active ? errorState ? popperId : ariaDescribedBy : void 0
|
|
29
|
+
}), input);
|
|
30
|
+
if (meta !== null && meta !== void 0 && meta.error) lastErrorRef.current = meta.error;
|
|
31
|
+
return /* @__PURE__ */ React.createElement(Tooltip, _extends({
|
|
32
|
+
visible: errorState && meta.active,
|
|
22
33
|
theme: "warning",
|
|
23
34
|
placement: "left",
|
|
24
35
|
flip: {
|
|
25
36
|
fallbackPlacements: ["right", "bottom"]
|
|
26
37
|
}
|
|
27
|
-
},
|
|
28
|
-
inline:
|
|
38
|
+
}, tooltipProps), /* @__PURE__ */ React.createElement(Tooltip.Trigger, _extends({
|
|
39
|
+
inline: false,
|
|
29
40
|
role: void 0,
|
|
30
|
-
tag
|
|
31
|
-
},
|
|
41
|
+
tag
|
|
42
|
+
}, tag ? inputProps : {}, {
|
|
32
43
|
__excludeProps: ["type", "aria-describedby"]
|
|
33
|
-
}), typeof
|
|
34
|
-
input:
|
|
35
|
-
meta
|
|
36
|
-
},
|
|
44
|
+
}), typeof Children.origin === "function" && Children.origin(_objectSpread({
|
|
45
|
+
input: inputProps,
|
|
46
|
+
meta
|
|
47
|
+
}, other))), /* @__PURE__ */ React.createElement(Tooltip.Popper, {
|
|
37
48
|
w: "100%",
|
|
38
|
-
id:
|
|
39
|
-
}, (
|
|
49
|
+
id: popperId
|
|
50
|
+
}, (_meta$error = meta.error) !== null && _meta$error !== void 0 ? _meta$error : lastErrorRef.current));
|
|
40
51
|
});
|
|
41
52
|
}
|
|
42
|
-
|
|
53
|
+
FeedbackItem.enhance = [uniqueIDEnhancement()];
|
|
43
54
|
export {
|
|
44
|
-
|
|
55
|
+
FeedbackItem
|
|
45
56
|
};
|