@semcore/feedback-form 16.2.0 → 17.0.0-prerelease.18
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 +17 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxButton.js","names":["Checkbox","createComponent","Component","Root","sstyled","
|
|
1
|
+
{"version":3,"file":"CheckboxButton.js","names":["Box","Checkbox","createComponent","Component","Root","sstyled","React","style","_sstyled","insert","CheckboxButtonRoot","constructor","args","_defineProperty","createRef","componentDidMount","focused","asProps","setTimeout","checkboxRef","current","focus","render","_ref","_ref2","styles","id","label","type","_type","other","SCheckboxButton","createElement","cn","_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,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;AAAA;AAK1B,MAAMC,kBAAkB,SAASP,SAAS,CAA8B;EAAAQ,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,mCAGxDP,KAAK,CAACQ,SAAS,CAAmB,CAAC;EAAA;EAEjDC,iBAAiBA,CAAA,EAAG;IAClB,MAAM;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACC,OAAO;IAEhC,IAAID,OAAO,EAAE;MACXE,UAAU,CAAC,MAAM;QACf,IAAI,CAACC,WAAW,CAACC,OAAO,EAAEC,KAAK,CAAC,CAAC;MACnC,CAAC,EAAE,EAAE,CAAC;IACR;EACF;EAEAC,MAAMA,CAAA,EAAG;IAAA,IAAAC,IAAA,QAAAN,OAAA;MAAAO,KAAA;IACP,MAAM;MAAEC,MAAM;MAAEC,EAAE;MAAEC,KAAK;MAAEC,IAAI,EAAEC,KAAK;MAAEb,OAAO;MAAE,GAAGc;IAAM,CAAC,GAAG,IAAI,CAACb,OAAO;IAE1E,MAAMc,eAAe,GAEM/B,GAAG;IAD9B,OAAAwB,KAAA,GAAOnB,OAAO,CAACoB,MAAM,CAAC,eACpBnB,KAAA,CAAA0B,aAAA,CAACD,eAAe,EAAAP,KAAA,CAAAS,EAAA;MAAA,GAAAC,YAAA;QAAA,kBAA8B,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM;MAAC,GAAAX,IAAA;IAAA,iBACtEjB,KAAA,CAAA0B,aAAA,CAAC/B,QAAQ,EAAAuB,KAAA,CAAAS,EAAA;MAAA,GAAKH;IAAK,iBACjBxB,KAAA,CAAA0B,aAAA,CAAC/B,QAAQ,CAACkC,KAAK;MAACC,GAAG,EAAE,IAAI,CAACjB,WAAY;MAAC,mBAAiBO;IAAG,CAAE,CAAC,eAC9DpB,KAAA,CAAA0B,aAAA,CAAC/B,QAAQ,CAACoC,IAAI;MAACX,EAAE,EAAEA;IAAG,GAAEC,KAAqB,CACrC,CACK,CAAC;EAEtB;AACF;AAACd,eAAA,CA5BKH,kBAAkB,WACPH,KAAK;AA6BtB,MAAM+B,cAAc,GAAGpC,eAAe,CAACQ,kBAAkB,CAAC;AAE1D,eAAe4B,cAAc","ignoreList":[]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["Children", "tag", "uid", "tooltipProps"],
|
|
5
|
-
_excluded2 = ["input", "meta"];
|
|
6
2
|
import { assignProps } from '@semcore/core';
|
|
7
3
|
import pick from '@semcore/core/lib/utils/pick';
|
|
8
4
|
import propsForElement from '@semcore/core/lib/utils/propsForElement';
|
|
@@ -10,32 +6,33 @@ import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
|
10
6
|
import Tooltip from '@semcore/tooltip';
|
|
11
7
|
import React from 'react';
|
|
12
8
|
import { Field } from 'react-final-form';
|
|
13
|
-
|
|
14
|
-
export function FeedbackItem(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return /*#__PURE__*/React.createElement(Field, props,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
const deafultTooltipPropsList = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate'];
|
|
10
|
+
export function FeedbackItem({
|
|
11
|
+
Children,
|
|
12
|
+
tag,
|
|
13
|
+
uid,
|
|
14
|
+
tooltipProps: tooltipPropsList = deafultTooltipPropsList,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const tooltipProps = pick(props, tooltipPropsList);
|
|
18
|
+
const lastErrorRef = React.useRef(undefined);
|
|
19
|
+
return /*#__PURE__*/React.createElement(Field, props, ({
|
|
20
|
+
input,
|
|
21
|
+
meta,
|
|
22
|
+
...other
|
|
23
|
+
}) => {
|
|
24
|
+
const showError = other.validateOnBlur === false ? meta.submitFailed : true;
|
|
25
|
+
const invalid = meta.invalid && meta.touched;
|
|
26
|
+
const errorState = showError && invalid;
|
|
27
|
+
const popperId = `${uid}-error-description`;
|
|
28
|
+
const ariaDescribedBy = props['aria-describedby'];
|
|
29
|
+
const inputProps = assignProps({
|
|
30
|
+
...propsForElement(other),
|
|
34
31
|
'state': errorState ? 'invalid' : 'normal',
|
|
35
32
|
'aria-invalid': errorState ? true : false,
|
|
36
33
|
'aria-describedby': meta.active ? errorState ? popperId : ariaDescribedBy : undefined
|
|
37
|
-
}
|
|
38
|
-
if (meta
|
|
34
|
+
}, input);
|
|
35
|
+
if (meta?.error) lastErrorRef.current = meta.error;
|
|
39
36
|
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
40
37
|
visible: errorState && meta.active,
|
|
41
38
|
theme: "warning",
|
|
@@ -49,13 +46,14 @@ export function FeedbackItem(_ref) {
|
|
|
49
46
|
tag: tag
|
|
50
47
|
}, tag ? inputProps : {}, {
|
|
51
48
|
__excludeProps: ['type', 'aria-describedby']
|
|
52
|
-
}), typeof Children.origin === 'function' && Children.origin(
|
|
49
|
+
}), typeof Children.origin === 'function' && Children.origin({
|
|
53
50
|
input: inputProps,
|
|
54
|
-
meta
|
|
55
|
-
|
|
51
|
+
meta,
|
|
52
|
+
...other
|
|
53
|
+
})), /*#__PURE__*/React.createElement(Tooltip.Popper, {
|
|
56
54
|
w: "100%",
|
|
57
55
|
id: popperId
|
|
58
|
-
},
|
|
56
|
+
}, meta.error ?? lastErrorRef.current));
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
59
|
FeedbackItem.enhance = [uniqueIDEnhancement()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackItem.js","names":["assignProps","pick","propsForElement","uniqueIDEnhancement","Tooltip","React","Field","deafultTooltipPropsList","FeedbackItem","
|
|
1
|
+
{"version":3,"file":"FeedbackItem.js","names":["assignProps","pick","propsForElement","uniqueIDEnhancement","Tooltip","React","Field","deafultTooltipPropsList","FeedbackItem","Children","tag","uid","tooltipProps","tooltipPropsList","props","lastErrorRef","useRef","undefined","createElement","input","meta","other","showError","validateOnBlur","submitFailed","invalid","touched","errorState","popperId","ariaDescribedBy","inputProps","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 </Tooltip.Popper>\n </Tooltip>\n );\n }}\n </Field>\n );\n}\nFeedbackItem.enhance = [uniqueIDEnhancement()];\n"],"mappings":";AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,OAAOC,IAAI,MAAM,8BAA8B;AAC/C,OAAOC,eAAe,MAAM,yCAAyC;AACrE,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,OAAOC,OAAO,MAAM,kBAAkB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,kBAAkB;AAExC,MAAMC,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,eAAe,CAChB;AAED,OAAO,SAASC,YAAYA,CAAC;EAC3BC,QAAQ;EACRC,GAAG;EACHC,GAAG;EACHC,YAAY,EAAEC,gBAAgB,GAAGN,uBAAuB;EACxD,GAAGO;AACA,CAAC,EAAE;EACN,MAAMF,YAAY,GAAGX,IAAI,CAACa,KAAK,EAAED,gBAAgB,CAAC;EAClD,MAAME,YAAY,GAAGV,KAAK,CAACW,MAAM,CAACC,SAAS,CAAC;EAE5C,oBACEZ,KAAA,CAAAa,aAAA,CAACZ,KAAK,EAAKQ,KAAK,EACb,CAAC;IAAEK,KAAK;IAAEC,IAAI;IAAE,GAAGC;EAAM,CAAC,KAAK;IAC9B,MAAMC,SAAS,GAAGD,KAAK,CAACE,cAAc,KAAK,KAAK,GAAGH,IAAI,CAACI,YAAY,GAAG,IAAI;IAC3E,MAAMC,OAAO,GAAGL,IAAI,CAACK,OAAO,IAAIL,IAAI,CAACM,OAAO;IAC5C,MAAMC,UAAU,GAAGL,SAAS,IAAIG,OAAO;IACvC,MAAMG,QAAQ,GAAG,GAAGjB,G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