@semcore/feedback-form 16.2.0 → 17.0.0-prerelease.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/FeedbackForm.js +108 -120
- package/lib/cjs/FeedbackForm.js.map +1 -1
- package/lib/cjs/component/checkbox-button/CheckboxButton.js +48 -45
- package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/cjs/component/feedback-item/FeedbackItem.js +33 -35
- package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.js +240 -274
- package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/cjs/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/lib/cjs/component/slider-rating/SliderRating.js +146 -147
- package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/cjs/component/submit-button/SubmitButton.js +12 -9
- package/lib/cjs/component/submit-button/SubmitButton.js.map +1 -1
- package/lib/cjs/index.d.js +3 -3
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +5 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/FeedbackForm.js +101 -113
- package/lib/es6/FeedbackForm.js.map +1 -1
- package/lib/es6/component/checkbox-button/CheckboxButton.js +44 -41
- package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
- package/lib/es6/component/feedback-item/FeedbackItem.js +29 -31
- package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.js +220 -254
- package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/lib/es6/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/lib/es6/component/slider-rating/SliderRating.js +138 -139
- package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
- package/lib/es6/component/submit-button/SubmitButton.js +11 -8
- package/lib/es6/component/submit-button/SubmitButton.js.map +1 -1
- package/lib/es6/index.d.js +0 -3
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/FeedbackForm.mjs +101 -101
- package/lib/esm/component/checkbox-button/CheckboxButton.mjs +47 -39
- package/lib/esm/component/feedback-item/FeedbackItem.mjs +29 -23
- package/lib/esm/component/feedback-rating/FeedbackRating.mjs +223 -234
- package/lib/esm/component/slider-rating/SliderRating.mjs +139 -129
- package/lib/esm/component/submit-button/SubmitButton.mjs +11 -8
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -3
- package/lib/types/component/feedback-rating/FeedbackRating.d.ts +11 -189
- package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +7 -9
- package/lib/types/component/slider-rating/SliderRating.d.ts +1 -1
- package/lib/types/index.d.ts +1 -3
- package/package.json +18 -17
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.FeedbackItem = FeedbackItem;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
9
|
var _core = require("@semcore/core");
|
|
12
10
|
var _pick = _interopRequireDefault(require("@semcore/core/lib/utils/pick"));
|
|
13
11
|
var _propsForElement = _interopRequireDefault(require("@semcore/core/lib/utils/propsForElement"));
|
|
@@ -15,55 +13,55 @@ var _uniqueID = _interopRequireDefault(require("@semcore/core/lib/utils/uniqueID
|
|
|
15
13
|
var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
16
14
|
var _react = _interopRequireDefault(require("react"));
|
|
17
15
|
var _reactFinalForm = require("react-final-form");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var inputProps = (0, _core.assignProps)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, (0, _propsForElement["default"])(other)), {}, {
|
|
16
|
+
const deafultTooltipPropsList = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate'];
|
|
17
|
+
function FeedbackItem({
|
|
18
|
+
Children,
|
|
19
|
+
tag,
|
|
20
|
+
uid,
|
|
21
|
+
tooltipProps: tooltipPropsList = deafultTooltipPropsList,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const tooltipProps = (0, _pick.default)(props, tooltipPropsList);
|
|
25
|
+
const lastErrorRef = _react.default.useRef(undefined);
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, props, ({
|
|
27
|
+
input,
|
|
28
|
+
meta,
|
|
29
|
+
...other
|
|
30
|
+
}) => {
|
|
31
|
+
const showError = other.validateOnBlur === false ? meta.submitFailed : true;
|
|
32
|
+
const invalid = meta.invalid && meta.touched;
|
|
33
|
+
const errorState = showError && invalid;
|
|
34
|
+
const popperId = `${uid}-error-description`;
|
|
35
|
+
const ariaDescribedBy = props['aria-describedby'];
|
|
36
|
+
const inputProps = (0, _core.assignProps)({
|
|
37
|
+
...(0, _propsForElement.default)(other),
|
|
41
38
|
'state': errorState ? 'invalid' : 'normal',
|
|
42
39
|
'aria-invalid': errorState ? true : false,
|
|
43
40
|
'aria-describedby': meta.active ? errorState ? popperId : ariaDescribedBy : undefined
|
|
44
|
-
}
|
|
45
|
-
if (meta
|
|
46
|
-
return /*#__PURE__*/_react
|
|
41
|
+
}, input);
|
|
42
|
+
if (meta?.error) lastErrorRef.current = meta.error;
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_tooltip.default, (0, _extends2.default)({
|
|
47
44
|
visible: errorState && meta.active,
|
|
48
45
|
theme: "warning",
|
|
49
46
|
placement: "left",
|
|
50
47
|
flip: {
|
|
51
48
|
fallbackPlacements: ['right', 'bottom']
|
|
52
49
|
}
|
|
53
|
-
}, tooltipProps), /*#__PURE__*/_react
|
|
50
|
+
}, tooltipProps), /*#__PURE__*/_react.default.createElement(_tooltip.default.Trigger, (0, _extends2.default)({
|
|
54
51
|
inline: false,
|
|
55
52
|
role: undefined,
|
|
56
53
|
tag: tag
|
|
57
54
|
}, tag ? inputProps : {}, {
|
|
58
55
|
__excludeProps: ['type', 'aria-describedby']
|
|
59
|
-
}), typeof Children.origin === 'function' && Children.origin(
|
|
56
|
+
}), typeof Children.origin === 'function' && Children.origin({
|
|
60
57
|
input: inputProps,
|
|
61
|
-
meta
|
|
62
|
-
|
|
58
|
+
meta,
|
|
59
|
+
...other
|
|
60
|
+
})), /*#__PURE__*/_react.default.createElement(_tooltip.default.Popper, {
|
|
63
61
|
w: "100%",
|
|
64
62
|
id: popperId
|
|
65
|
-
},
|
|
63
|
+
}, meta.error ?? lastErrorRef.current));
|
|
66
64
|
});
|
|
67
65
|
}
|
|
68
|
-
FeedbackItem.enhance = [(0, _uniqueID
|
|
66
|
+
FeedbackItem.enhance = [(0, _uniqueID.default)()];
|
|
69
67
|
//# sourceMappingURL=FeedbackItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackItem.js","names":["_core","require","_pick","_interopRequireDefault","_propsForElement","_uniqueID","_tooltip","_react","_reactFinalForm","
|
|
1
|
+
{"version":3,"file":"FeedbackItem.js","names":["_core","require","_pick","_interopRequireDefault","_propsForElement","_uniqueID","_tooltip","_react","_reactFinalForm","deafultTooltipPropsList","FeedbackItem","Children","tag","uid","tooltipProps","tooltipPropsList","props","pick","lastErrorRef","React","useRef","undefined","default","createElement","Field","input","meta","other","showError","validateOnBlur","submitFailed","invalid","touched","errorState","popperId","ariaDescribedBy","inputProps","assignProps","propsForElement","active","error","current","_extends2","visible","theme","placement","flip","fallbackPlacements","Trigger","inline","role","__excludeProps","origin","Popper","w","id","enhance","uniqueIDEnhancement"],"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 </Tooltip.Popper>\n </Tooltip>\n );\n }}\n </Field>\n );\n}\nFeedbackItem.enhance = [uniqueIDEnhancement()];\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,MAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAEA,MAAMQ,uBAAuB,GAAG,CAC9B,OAAO,EACP,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,OAAO,EACP,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,e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