@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/FeedbackForm.js +108 -120
  3. package/lib/cjs/FeedbackForm.js.map +1 -1
  4. package/lib/cjs/component/checkbox-button/CheckboxButton.js +48 -45
  5. package/lib/cjs/component/checkbox-button/CheckboxButton.js.map +1 -1
  6. package/lib/cjs/component/feedback-item/FeedbackItem.js +33 -35
  7. package/lib/cjs/component/feedback-item/FeedbackItem.js.map +1 -1
  8. package/lib/cjs/component/feedback-rating/FeedbackRating.js +240 -274
  9. package/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
  10. package/lib/cjs/component/feedback-rating/FeedbackRating.type.js.map +1 -1
  11. package/lib/cjs/component/slider-rating/SliderRating.js +146 -147
  12. package/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
  13. package/lib/cjs/component/submit-button/SubmitButton.js +12 -9
  14. package/lib/cjs/component/submit-button/SubmitButton.js.map +1 -1
  15. package/lib/cjs/index.d.js +3 -3
  16. package/lib/cjs/index.d.js.map +1 -1
  17. package/lib/cjs/index.js +5 -5
  18. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
  19. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  20. package/lib/es6/FeedbackForm.js +101 -113
  21. package/lib/es6/FeedbackForm.js.map +1 -1
  22. package/lib/es6/component/checkbox-button/CheckboxButton.js +44 -41
  23. package/lib/es6/component/checkbox-button/CheckboxButton.js.map +1 -1
  24. package/lib/es6/component/feedback-item/FeedbackItem.js +29 -31
  25. package/lib/es6/component/feedback-item/FeedbackItem.js.map +1 -1
  26. package/lib/es6/component/feedback-rating/FeedbackRating.js +220 -254
  27. package/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
  28. package/lib/es6/component/feedback-rating/FeedbackRating.type.js.map +1 -1
  29. package/lib/es6/component/slider-rating/SliderRating.js +138 -139
  30. package/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
  31. package/lib/es6/component/submit-button/SubmitButton.js +11 -8
  32. package/lib/es6/component/submit-button/SubmitButton.js.map +1 -1
  33. package/lib/es6/index.d.js +0 -3
  34. package/lib/es6/index.d.js.map +1 -1
  35. package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
  36. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  37. package/lib/esm/FeedbackForm.mjs +101 -101
  38. package/lib/esm/component/checkbox-button/CheckboxButton.mjs +47 -39
  39. package/lib/esm/component/feedback-item/FeedbackItem.mjs +29 -23
  40. package/lib/esm/component/feedback-rating/FeedbackRating.mjs +223 -234
  41. package/lib/esm/component/slider-rating/SliderRating.mjs +139 -129
  42. package/lib/esm/component/submit-button/SubmitButton.mjs +11 -8
  43. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
  44. package/lib/types/component/checkbox-button/CheckboxButton.d.ts +1 -3
  45. package/lib/types/component/feedback-rating/FeedbackRating.d.ts +11 -189
  46. package/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +7 -9
  47. package/lib/types/component/slider-rating/SliderRating.d.ts +1 -1
  48. package/lib/types/index.d.ts +1 -3
  49. package/package.json +17 -16
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxButton.js","names":["Checkbox","createComponent","Component","Root","sstyled","Box","React","style","_sstyled","insert","CheckboxButtonRoot","_Component","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","render","_ref","asProps","_ref2","_this$asProps","styles","id","label","_type","type","focused","other","_objectWithoutProperties","_excluded","autoFocus","SCheckboxButton","createElement","cn","_objectSpread","_assignProps","Value","Text","_defineProperty","CheckboxButton"],"sources":["../../../../src/component/checkbox-button/CheckboxButton.tsx"],"sourcesContent":["import Checkbox from '@semcore/checkbox';\nimport { createComponent, Component, Root, sstyled } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\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 render() {\n const { styles, id, label, type: _type, focused, ...other } = this.asProps;\n const autoFocus = focused ? 20 : false;\n\n const SCheckboxButton = Root;\n return sstyled(styles)(\n <SCheckboxButton render={Box} __excludeProps={['onChange', 'id', 'type']}>\n <Checkbox {...other}>\n <Checkbox.Value autoFocus={autoFocus} 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,OAAOA,QAAQ,MAAM,mBAAmB;AACxC,SAASC,eAAe,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,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;IAAAE,eAAA,OAAAF,kBAAA;IAAA,OAAAG,UAAA,OAAAH,kBAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,kBAAA,EAAAC,UAAA;EAAA,OAAAK,YAAA,CAAAN,kBAAA;IAAAO,GAAA;IAAAC,KAAA,EAGtB,SAAAC,MAAMA,CAAA,EAAG;MAAA,IAAAC,IAAA,QAAAC,OAAA;QAAAC,KAAA;MACP,IAAAC,aAAA,GAA8D,IAAI,CAACF,OAAO;QAAlEG,MAAM,GAAAD,aAAA,CAANC,MAAM;QAAEC,EAAE,GAAAF,aAAA,CAAFE,EAAE;QAAEC,KAAK,GAAAH,aAAA,CAALG,KAAK;QAAQC,KAAK,GAAAJ,aAAA,CAAXK,IAAI;QAASC,OAAO,GAAAN,aAAA,CAAPM,OAAO;QAAKC,KAAK,GAAAC,wBAAA,CAAAR,aAAA,EAAAS,SAAA;MACzD,IAAMC,SAAS,GAAGJ,OAAO,GAAG,EAAE,GAAG,KAAK;MAEtC,IAAMK,eAAe,GAEM7B,GAAG;MAD9B,OAAAiB,KAAA,GAAOlB,OAAO,CAACoB,MAAM,CAAC,eACpBlB,KAAA,CAAA6B,aAAA,CAACD,eAAe,EAAAZ,KAAA,CAAAc,EAAA,oBAAAC,aAAA,KAAAC,YAAA;QAAA,kBAA8B,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM;MAAC,GAAAlB,IAAA,kBACtEd,KAAA,CAAA6B,aAAA,CAACnC,QAAQ,EAAAsB,KAAA,CAAAc,EAAA,aAAAC,aAAA,KAAKP,KAAK,iBACjBxB,KAAA,CAAA6B,aAAA,CAACnC,QAAQ,CAACuC,KAAK;QAACN,SAAS,EAAEA,SAAU;QAAC,mBAAiBR;MAAG,CAAE,CAAC,eAC7DnB,KAAA,CAAA6B,aAAA,CAACnC,QAAQ,CAACwC,IAAI;QAACf,EAAE,EAAEA;MAAG,GAAEC,KAAqB,CACrC,CACK,CAAC;IAEtB;EAAC;AAAA,EAhB8BxB,SAAS;AAAAuC,eAAA,CAApC/B,kBAAkB,WACPH,KAAK;AAkBtB,IAAMmC,cAAc,GAAGzC,eAAe,CAACS,kBAAkB,CAAC;AAE1D,eAAegC,cAAc","ignoreList":[]}
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
- var deafultTooltipPropsList = ['title', 'theme', 'strategy', 'modifiers', 'placement', 'interaction', 'timeout', 'visible', 'defaultVisible', 'onVisibleChange', 'offset', 'preventOverflow', 'arrow', 'flip', 'computeStyles', 'eventListeners', 'onFirstUpdate'];
14
- export function FeedbackItem(_ref) {
15
- var Children = _ref.Children,
16
- tag = _ref.tag,
17
- uid = _ref.uid,
18
- _ref$tooltipProps = _ref.tooltipProps,
19
- tooltipPropsList = _ref$tooltipProps === void 0 ? deafultTooltipPropsList : _ref$tooltipProps,
20
- props = _objectWithoutProperties(_ref, _excluded);
21
- var tooltipProps = pick(props, tooltipPropsList);
22
- var lastErrorRef = React.useRef(undefined);
23
- return /*#__PURE__*/React.createElement(Field, props, function (_ref2) {
24
- var _meta$error;
25
- var input = _ref2.input,
26
- meta = _ref2.meta,
27
- other = _objectWithoutProperties(_ref2, _excluded2);
28
- var showError = other.validateOnBlur === false ? meta.submitFailed : true;
29
- var invalid = meta.invalid && meta.touched;
30
- var errorState = showError && invalid;
31
- var popperId = "".concat(uid, "-error-description");
32
- var ariaDescribedBy = props['aria-describedby'];
33
- var inputProps = assignProps(_objectSpread(_objectSpread({}, propsForElement(other)), {}, {
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
- }), input);
38
- if (meta !== null && meta !== void 0 && meta.error) lastErrorRef.current = meta.error;
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(_objectSpread({
49
+ }), typeof Children.origin === 'function' && Children.origin({
53
50
  input: inputProps,
54
- meta: meta
55
- }, other))), /*#__PURE__*/React.createElement(Tooltip.Popper, {
51
+ meta,
52
+ ...other
53
+ })), /*#__PURE__*/React.createElement(Tooltip.Popper, {
56
54
  w: "100%",
57
55
  id: popperId
58
- }, (_meta$error = meta.error) !== null && _meta$error !== void 0 ? _meta$error : lastErrorRef.current));
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","_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 </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,IAAMC,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,CAAAC,IAAA,EAMpB;EAAA,IALNC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IAAAC,iBAAA,GAAAJ,IAAA,CACHK,YAAY;IAAEC,gBAAgB,GAAAF,iBAAA,cAAGN,uBAAuB,GAAAM,iBAAA;IACrDG,KAAK,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA;EAER,IAAMJ,YAAY,GAAGb,IAAI,CAACe,KAAK,EAAED,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AM;MAChBC,IAAI,EAAE;QACJC,kBAAkB,EAAE,CAAC,OAAO,EAAE,QAAQ;MACxC;IAAE,GACElC,YAAY,gBAEhBT,KAAA,CAAAiB,aAAA,CAAClB,OAAO,CAAC6C,OAAO,EAAAN,QAAA;MACdO,MAAM,EAAE,KAAM;MACdC,IAAI,EAAE9B,SAAU;MAChBV,GAAG,EAAEA;IAAI,GACJA,GAAG,GAAG2B,UAAU,GAAG,CAAC,CAAC;MAC1Bc,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":[]}
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()];\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