@coorpacademy/components 10.17.2 → 10.19.0

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 (77) hide show
  1. package/es/atom/drag-and-drop/index.js +2 -2
  2. package/es/atom/drag-and-drop/index.js.map +1 -1
  3. package/es/atom/drag-and-drop/test/fixtures/disabled-with-image-reset.js +12 -0
  4. package/es/atom/drag-and-drop/test/fixtures/disabled-with-image-reset.js.map +1 -0
  5. package/es/atom/drag-and-drop/test/fixtures.js +2 -0
  6. package/es/atom/drag-and-drop/test/fixtures.js.map +1 -1
  7. package/es/atom/lottie-wrapper/index.js +2 -2
  8. package/es/atom/lottie-wrapper/index.js.map +1 -1
  9. package/es/molecule/brand-create-form/index.js +1 -0
  10. package/es/molecule/brand-create-form/index.js.map +1 -1
  11. package/es/molecule/review-card-congrats/index.js +99 -0
  12. package/es/molecule/review-card-congrats/index.js.map +1 -0
  13. package/es/molecule/review-card-congrats/style.css +139 -0
  14. package/es/molecule/review-card-congrats/test/card-congrats.js +47 -0
  15. package/es/molecule/review-card-congrats/test/card-congrats.js.map +1 -0
  16. package/es/molecule/review-card-congrats/test/fixtures/rank.js +22 -0
  17. package/es/molecule/review-card-congrats/test/fixtures/rank.js.map +1 -0
  18. package/es/molecule/review-card-congrats/test/fixtures/star.js +21 -0
  19. package/es/molecule/review-card-congrats/test/fixtures/star.js.map +1 -0
  20. package/es/molecule/review-card-congrats/test/fixtures.js +15 -0
  21. package/es/molecule/review-card-congrats/test/fixtures.js.map +1 -0
  22. package/es/organism/review-congrats/index.js +72 -0
  23. package/es/organism/review-congrats/index.js.map +1 -0
  24. package/es/organism/review-congrats/style.css +225 -0
  25. package/es/organism/review-congrats/test/fixtures/default.js +25 -0
  26. package/es/organism/review-congrats/test/fixtures/default.js.map +1 -0
  27. package/es/organism/review-congrats/test/fixtures.js +13 -0
  28. package/es/organism/review-congrats/test/fixtures.js.map +1 -0
  29. package/es/organism/review-congrats/test/review-congrats.js +37 -0
  30. package/es/organism/review-congrats/test/review-congrats.js.map +1 -0
  31. package/es/organism/review-header/index.js +7 -3
  32. package/es/organism/review-header/index.js.map +1 -1
  33. package/es/organism/review-header/style.css +13 -0
  34. package/es/organism/review-header/test/fixtures/steps-animation.js +11 -0
  35. package/es/organism/review-header/test/fixtures/steps-animation.js.map +1 -0
  36. package/es/organism/review-header/test/fixtures.js +2 -0
  37. package/es/organism/review-header/test/fixtures.js.map +1 -1
  38. package/es/variables/colors.css +1 -0
  39. package/lib/atom/drag-and-drop/index.js +2 -2
  40. package/lib/atom/drag-and-drop/index.js.map +1 -1
  41. package/lib/atom/drag-and-drop/test/fixtures/disabled-with-image-reset.js +21 -0
  42. package/lib/atom/drag-and-drop/test/fixtures/disabled-with-image-reset.js.map +1 -0
  43. package/lib/atom/drag-and-drop/test/fixtures.js +3 -0
  44. package/lib/atom/drag-and-drop/test/fixtures.js.map +1 -1
  45. package/lib/atom/lottie-wrapper/index.js +2 -2
  46. package/lib/atom/lottie-wrapper/index.js.map +1 -1
  47. package/lib/molecule/brand-create-form/index.js +1 -0
  48. package/lib/molecule/brand-create-form/index.js.map +1 -1
  49. package/lib/molecule/review-card-congrats/index.js +124 -0
  50. package/lib/molecule/review-card-congrats/index.js.map +1 -0
  51. package/lib/molecule/review-card-congrats/style.css +139 -0
  52. package/lib/molecule/review-card-congrats/test/card-congrats.js +63 -0
  53. package/lib/molecule/review-card-congrats/test/card-congrats.js.map +1 -0
  54. package/lib/molecule/review-card-congrats/test/fixtures/rank.js +32 -0
  55. package/lib/molecule/review-card-congrats/test/fixtures/rank.js.map +1 -0
  56. package/lib/molecule/review-card-congrats/test/fixtures/star.js +31 -0
  57. package/lib/molecule/review-card-congrats/test/fixtures/star.js.map +1 -0
  58. package/lib/molecule/review-card-congrats/test/fixtures.js +25 -0
  59. package/lib/molecule/review-card-congrats/test/fixtures.js.map +1 -0
  60. package/lib/organism/review-congrats/index.js +91 -0
  61. package/lib/organism/review-congrats/index.js.map +1 -0
  62. package/lib/organism/review-congrats/style.css +225 -0
  63. package/lib/organism/review-congrats/test/fixtures/default.js +36 -0
  64. package/lib/organism/review-congrats/test/fixtures/default.js.map +1 -0
  65. package/lib/organism/review-congrats/test/fixtures.js +22 -0
  66. package/lib/organism/review-congrats/test/fixtures.js.map +1 -0
  67. package/lib/organism/review-congrats/test/review-congrats.js +53 -0
  68. package/lib/organism/review-congrats/test/review-congrats.js.map +1 -0
  69. package/lib/organism/review-header/index.js +8 -3
  70. package/lib/organism/review-header/index.js.map +1 -1
  71. package/lib/organism/review-header/style.css +13 -0
  72. package/lib/organism/review-header/test/fixtures/steps-animation.js +21 -0
  73. package/lib/organism/review-header/test/fixtures/steps-animation.js.map +1 -0
  74. package/lib/organism/review-header/test/fixtures.js +3 -0
  75. package/lib/organism/review-header/test/fixtures.js.map +1 -1
  76. package/lib/variables/colors.css +1 -0
  77. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/drag-and-drop/index.js"],"names":["constantNull","DragAndDrop","React","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","error","buttonAriaLabel","errorButtonLabel","disabled","previewView","type","style","preview","src","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","position","button","previewContainer","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","PropTypes","string","shape","bool","func"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,YAAY,GAAG,wBAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0BC,eAAMC,SAAhC,CAA0C;AAqBxCC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;AAEA,S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Q,EAAE+B,mBAAUG,IAZH;AAajB9C,EAAAA,QAAQ,EAAE2C,mBAAUI,IAbH;AAcjBvC,EAAAA,OAAO,EAAEmC,mBAAUI,IAdF;AAejBtC,EAAAA,KAAK,EAAEkC,mBAAUC,MAfA;AAgBjBlC,EAAAA,eAAe,EAAEiC,mBAAUC,MAhBV;AAiBjBjC,EAAAA,gBAAgB,EAAEgC,mBAAUC;AAjBX,C;eA0LNzD,W","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, constant, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as Close,\n NovaSolidFilesBasicFileUpload2 as FileUploadIcon,\n NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport Loader from '../loader';\nimport Button from '../button-link';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string,\n label: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func,\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null,\n error = '',\n buttonAriaLabel = '',\n errorButtonLabel = '',\n disabled = false\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.preview}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={style.preview}>\n <video controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loaderWrapper}>\n <div className={style.loadingCancel}>\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n <div className={style.loader}>\n <Loader theme=\"coorpmanager\" />\n </div>\n <span className={style.loaderText}>Uploading</span>\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src ? (\n <div className={style.resetUploadWrapper}>\n <div className={style.resetSrcLabel}>\n {previewContent.label ? previewContent.label : previewContent.src}\n </div>\n {onReset ? (\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n ) : null}\n </div>\n ) : null;\n\n const buildButton = () => {\n const defaultButtonProps = {\n label: uploadLabel,\n 'aria-label': buttonAriaLabel,\n 'data-name': 'default-button',\n icon: {\n position: 'left',\n type: 'folders'\n }\n };\n if (dragging) {\n return null;\n } else if (error) {\n return <Button {...defaultButtonProps} label={errorButtonLabel} icon={{}} />;\n } else {\n return <Button {...defaultButtonProps} />;\n }\n };\n\n const button = buildButton(dragging, error);\n\n const previewContainer = getClassState(\n style.previewContainer,\n style.modifiedPreviewContainer,\n null,\n modified,\n error\n );\n const inputWrapper = getClassState(\n style.inputWrapper,\n style.modifiedInputWrapper,\n style.errorInputWrapper,\n modified,\n error\n );\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n {!isEmpty(previewContent) || loading ? (\n <div className={classnames(previewContainer, disabled && style.disabled)}>\n {previewView}\n </div>\n ) : (\n <div\n className={classnames(\n dragging ? style.dragging : inputWrapper,\n disabled && style.disabled\n )}\n id={idBox}\n >\n <div className={style.infosContainer}>\n {error ? (\n <FileUploadBlockedIcon className={style.iconError} />\n ) : (\n <FileUploadIcon className={style.icon} />\n )}\n {description ? <div className={style.description}>{description}</div> : null}\n {error ? null : <div className={style.dragAndDropLabel}>{'Drag & Drop here'}</div>}\n </div>\n {button}\n <div>{children(this.handleDragStart, this.handleDragStop)}</div>\n </div>\n )}\n {error ? <span className={style.errorMessage}>{error}</span> : resetContent}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/atom/drag-and-drop/index.js"],"names":["constantNull","DragAndDrop","React","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","error","buttonAriaLabel","errorButtonLabel","disabled","previewView","type","style","preview","src","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","position","button","previewContainer","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","PropTypes","string","shape","bool","func"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,YAAY,GAAG,wBAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0BC,eAAMC,SAAhC,CAA0C;AAqBxCC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;AAEA,SAAKC,KAAL,GAAa;AACXC,MAAAA,QAAQ,EAAE;AADC,KAAb;AAIA,SAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBC,IAArB,CAA0B,IAA1B,CAAvB;AACA,SAAKC,cAAL,GAAsB,KAAKA,cAAL,CAAoBD,IAApB,CAAyB,IAAz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EAAEmC,mBAAUI,IAdF;AAejBtC,EAAAA,KAAK,EAAEkC,mBAAUC,MAfA;AAgBjBlC,EAAAA,eAAe,EAAEiC,mBAAUC,MAhBV;AAiBjBjC,EAAAA,gBAAgB,EAAEgC,mBAAUC;AAjBX,C;eAgMNzD,W","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, constant, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as Close,\n NovaSolidFilesBasicFileUpload2 as FileUploadIcon,\n NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport Loader from '../loader';\nimport Button from '../button-link';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string,\n label: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func,\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null,\n error = '',\n buttonAriaLabel = '',\n errorButtonLabel = '',\n disabled = false\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.preview}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={style.preview}>\n <video controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loaderWrapper}>\n <div className={style.loadingCancel}>\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n <div className={style.loader}>\n <Loader theme=\"coorpmanager\" />\n </div>\n <span className={style.loaderText}>Uploading</span>\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src ? (\n <div className={classnames(style.resetUploadWrapper, disabled && style.disabled)}>\n <div className={style.resetSrcLabel}>\n {previewContent.label ? previewContent.label : previewContent.src}\n </div>\n {onReset ? (\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n ) : null}\n </div>\n ) : null;\n\n const buildButton = () => {\n const defaultButtonProps = {\n label: uploadLabel,\n 'aria-label': buttonAriaLabel,\n 'data-name': 'default-button',\n icon: {\n position: 'left',\n type: 'folders'\n }\n };\n if (dragging) {\n return null;\n } else if (error) {\n return <Button {...defaultButtonProps} label={errorButtonLabel} icon={{}} />;\n } else {\n return <Button {...defaultButtonProps} />;\n }\n };\n\n const button = buildButton(dragging, error);\n\n const previewContainer = getClassState(\n style.previewContainer,\n style.modifiedPreviewContainer,\n null,\n modified,\n error\n );\n const inputWrapper = getClassState(\n style.inputWrapper,\n style.modifiedInputWrapper,\n style.errorInputWrapper,\n modified,\n error\n );\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n {!isEmpty(previewContent) || loading ? (\n <div className={classnames(previewContainer, disabled && style.disabled)}>\n {previewView}\n </div>\n ) : (\n <div\n className={classnames(\n dragging ? style.dragging : inputWrapper,\n disabled && style.disabled\n )}\n id={idBox}\n >\n <div className={style.infosContainer}>\n {error ? (\n <FileUploadBlockedIcon className={style.iconError} />\n ) : (\n <FileUploadIcon className={style.icon} />\n )}\n {description ? <div className={style.description}>{description}</div> : null}\n {error ? null : <div className={style.dragAndDropLabel}>{'Drag & Drop here'}</div>}\n </div>\n {button}\n <div>{children(this.handleDragStart, this.handleDragStop)}</div>\n </div>\n )}\n {error ? (\n <span className={classnames(style.errorMessage, disabled && style.disabled)}>\n {error}\n </span>\n ) : (\n resetContent\n )}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"file":"index.js"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _withImageReset = _interopRequireDefault(require("./with-image-reset"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
+
12
+ const {
13
+ props
14
+ } = _withImageReset.default;
15
+ var _default = {
16
+ props: _extends(_extends({}, props), {}, {
17
+ disabled: true
18
+ })
19
+ };
20
+ exports.default = _default;
21
+ //# sourceMappingURL=disabled-with-image-reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/atom/drag-and-drop/test/fixtures/disabled-with-image-reset.js"],"names":["props","withImageReset","disabled"],"mappings":";;;;;AAAA;;;;;;AAEA,MAAM;AAACA,EAAAA;AAAD,IAAUC,uBAAhB;eAEe;AACbD,EAAAA,KAAK,wBACAA,KADA;AAEHE,IAAAA,QAAQ,EAAE;AAFP;AADQ,C","sourcesContent":["import withImageReset from './with-image-reset';\n\nconst {props} = withImageReset;\n\nexport default {\n props: {\n ...props,\n disabled: true\n }\n};\n"],"file":"disabled-with-image-reset.js"}
@@ -12,6 +12,8 @@ var _cleanAndModified = _interopRequireDefault(require("./fixtures/clean-and-mod
12
12
 
13
13
  var _default = _interopRequireDefault(require("./fixtures/default"));
14
14
 
15
+ var _disabledWithImageReset = _interopRequireDefault(require("./fixtures/disabled-with-image-reset"));
16
+
15
17
  var _disabled = _interopRequireDefault(require("./fixtures/disabled"));
16
18
 
17
19
  var _error = _interopRequireDefault(require("./fixtures/error"));
@@ -40,6 +42,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
40
42
  });
41
43
  (0, _ava.default)('Atom › AtomDragAndDrop › CleanAndModified › should be rendered', _renderComponent.default, _.default, _cleanAndModified.default);
42
44
  (0, _ava.default)('Atom › AtomDragAndDrop › Default › should be rendered', _renderComponent.default, _.default, _default.default);
45
+ (0, _ava.default)('Atom › AtomDragAndDrop › DisabledWithImageReset › should be rendered', _renderComponent.default, _.default, _disabledWithImageReset.default);
43
46
  (0, _ava.default)('Atom › AtomDragAndDrop › Disabled › should be rendered', _renderComponent.default, _.default, _disabled.default);
44
47
  (0, _ava.default)('Atom › AtomDragAndDrop › Error › should be rendered', _renderComponent.default, _.default, _error.default);
45
48
  (0, _ava.default)('Atom › AtomDragAndDrop › Loading › should be rendered', _renderComponent.default, _.default, _loading.default);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/atom/drag-and-drop/test/fixtures.js"],"names":["t","pass","AtomDragAndDrop","propTypes","value","key","not","undefined","renderComponentMacro","fixtureCleanAndModified","fixtureDefault","fixtureDisabled","fixtureError","fixtureLoading","fixtureModified","fixtureWithChildren","fixtureWithImageReset","fixtureWithImage","fixtureWithLongDescription","fixtureWithVideo"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,sDAAL,EAA6DA,CAAC,IAAI;AAChEA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAAgBC,SAAxB,EAAmC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACjDL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,gDAA+CF,GAAI,mEAA5E;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,gEAAL,EAAuEG,wBAAvE,EAA6FN,SAA7F,EAA8GO,yBAA9G;AACA,kBAAK,uDAAL,EAA8DD,wBAA9D,EAAoFN,SAApF,EAAqGQ,gBAArG;AACA,kBAAK,wDAAL,EAA+DF,wBAA/D,EAAqFN,SAArF,EAAsGS,iBAAtG;AACA,kBAAK,qDAAL,EAA4DH,wBAA5D,EAAkFN,SAAlF,EAAmGU,cAAnG;AACA,kBAAK,uDAAL,EAA8DJ,wBAA9D,EAAoFN,SAApF,EAAqGW,gBAArG;AACA,kBAAK,wDAAL,EAA+DL,wBAA/D,EAAqFN,SAArF,EAAsGY,iBAAtG;AACA,kBAAK,4DAAL,EAAmEN,wBAAnE,EAAyFN,SAAzF,EAA0Ga,qBAA1G;AACA,kBAAK,8DAAL,EAAqEP,wBAArE,EAA2FN,SAA3F,EAA4Gc,uBAA5G;AACA,kBAAK,yDAAL,EAAgER,wBAAhE,EAAsFN,SAAtF,EAAuGe,kBAAvG;AACA,kBAAK,mEAAL,EAA0ET,wBAA1E,EAAgGN,SAAhG,EAAiHgB,4BAAjH;AACA,kBAAK,yDAAL,EAAgEV,wBAAhE,EAAsFN,SAAtF,EAAuGiB,kBAAvG","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomDragAndDrop from '..';\nimport fixtureCleanAndModified from './fixtures/clean-and-modified';\nimport fixtureDefault from './fixtures/default';\nimport fixtureDisabled from './fixtures/disabled';\nimport fixtureError from './fixtures/error';\nimport fixtureLoading from './fixtures/loading';\nimport fixtureModified from './fixtures/modified';\nimport fixtureWithChildren from './fixtures/with-children';\nimport fixtureWithImageReset from './fixtures/with-image-reset';\nimport fixtureWithImage from './fixtures/with-image';\nimport fixtureWithLongDescription from './fixtures/with-long-description';\nimport fixtureWithVideo from './fixtures/with-video';\n\ntest('Atom › AtomDragAndDrop > should have valid propTypes', t => {\n t.pass();\n forEach(AtomDragAndDrop.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomDragAndDrop.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomDragAndDrop › CleanAndModified › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureCleanAndModified);\ntest('Atom › AtomDragAndDrop › Default › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureDefault);\ntest('Atom › AtomDragAndDrop › Disabled › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureDisabled);\ntest('Atom › AtomDragAndDrop › Error › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureError);\ntest('Atom › AtomDragAndDrop › Loading › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureLoading);\ntest('Atom › AtomDragAndDrop › Modified › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureModified);\ntest('Atom › AtomDragAndDrop › WithChildren › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithChildren);\ntest('Atom › AtomDragAndDrop › WithImageReset › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithImageReset);\ntest('Atom › AtomDragAndDrop › WithImage › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithImage);\ntest('Atom › AtomDragAndDrop › WithLongDescription › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithLongDescription);\ntest('Atom › AtomDragAndDrop › WithVideo › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithVideo);\n"],"file":"fixtures.js"}
1
+ {"version":3,"sources":["../../../../src/atom/drag-and-drop/test/fixtures.js"],"names":["t","pass","AtomDragAndDrop","propTypes","value","key","not","undefined","renderComponentMacro","fixtureCleanAndModified","fixtureDefault","fixtureDisabledWithImageReset","fixtureDisabled","fixtureError","fixtureLoading","fixtureModified","fixtureWithCh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AvG","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomDragAndDrop from '..';\nimport fixtureCleanAndModified from './fixtures/clean-and-modified';\nimport fixtureDefault from './fixtures/default';\nimport fixtureDisabledWithImageReset from './fixtures/disabled-with-image-reset';\nimport fixtureDisabled from './fixtures/disabled';\nimport fixtureError from './fixtures/error';\nimport fixtureLoading from './fixtures/loading';\nimport fixtureModified from './fixtures/modified';\nimport fixtureWithChildren from './fixtures/with-children';\nimport fixtureWithImageReset from './fixtures/with-image-reset';\nimport fixtureWithImage from './fixtures/with-image';\nimport fixtureWithLongDescription from './fixtures/with-long-description';\nimport fixtureWithVideo from './fixtures/with-video';\n\ntest('Atom › AtomDragAndDrop > should have valid propTypes', t => {\n t.pass();\n forEach(AtomDragAndDrop.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomDragAndDrop.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomDragAndDrop › CleanAndModified › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureCleanAndModified);\ntest('Atom › AtomDragAndDrop › Default › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureDefault);\ntest('Atom › AtomDragAndDrop › DisabledWithImageReset › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureDisabledWithImageReset);\ntest('Atom › AtomDragAndDrop › Disabled › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureDisabled);\ntest('Atom › AtomDragAndDrop › Error › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureError);\ntest('Atom › AtomDragAndDrop › Loading › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureLoading);\ntest('Atom › AtomDragAndDrop › Modified › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureModified);\ntest('Atom › AtomDragAndDrop › WithChildren › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithChildren);\ntest('Atom › AtomDragAndDrop › WithImageReset › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithImageReset);\ntest('Atom › AtomDragAndDrop › WithImage › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithImage);\ntest('Atom › AtomDragAndDrop › WithLongDescription › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithLongDescription);\ntest('Atom › AtomDragAndDrop › WithVideo › should be rendered', renderComponentMacro, AtomDragAndDrop, fixtureWithVideo);\n"],"file":"fixtures.js"}
@@ -114,9 +114,9 @@ const LottieWrapper = props => {
114
114
  // to remove when the migration towards @testing-library/react is done
115
115
 
116
116
  /* istanbul ignore next */
117
- if (animationItem && (0, _includes.default)(animationControl, (0, _keys.default)((0, _omit.default)('loading', ANIMATION_CONTROL))) && !autoplay) {
117
+ if ((0, _includes.default)(animationControl, (0, _keys.default)((0, _omit.default)('loading', ANIMATION_CONTROL))) && !autoplay) {
118
118
  setIsAnimationVisible(true);
119
- animationItem[animationControl]();
119
+ if (animationItem) animationItem[animationControl]();
120
120
  if (animationControl === ANIMATION_CONTROL.stop) setIsAnimationVisible(false);
121
121
  }
122
122
  }, [animationControl, animationItem, autoplay]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/lottie-wrapper/index.js"],"names":["ANIMATION_CONTROL","play","pause","stop","loading","isIE11","window","userAgent","hasMsCrypto","hasRevision","hasTrident","fetchAndLoadAnimation","_lottie","_fetch","animationSrc","containerRef","loop","animationClassnames","hideOnTransparent","autoplay","animationUrl","URL","toString","fetchResult","headers","animationData","json","animation","loadAnimation","container","current","renderer","rendererSettings","className","preserveAspectRatio","LottieWrapper","props","dataName","ariaLabel","width","height","ie11ImageBackup","backupImageClassName","animationControl","animationClassName","animationItem","setAnimationItem","isAnimationVisible","setIsAnimationVisible","_isIE11","wrapperClassName","style","lottieContainer","lottieAnimationClassName","ie11BackupImageClassName","backupImage","lottie","unfetch","destroy","name","maxWidth","maxHeight","opacity","transition","propTypes","PropTypes","string","isRequired","bool","sh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bR;AAcxB/C,EAAAA,QAAQ,EAAE8C,mBAAUG,IAdI;AAexBzB,EAAAA,gBAAgB,EAAEsB,mBAAUM,KAAV,CAAgB,mBAAKvE,iBAAL,CAAhB;AAfM,CAA1B;eAkBemC,a","sourcesContent":["import React, {useMemo, useRef, useEffect, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport lottie from 'lottie-web';\nimport get from 'lodash/fp/get';\nimport has from 'lodash/fp/has';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport omit from 'lodash/fp/omit';\nimport unfetch from 'isomorphic-unfetch';\nimport style from './style.css';\n\nexport const ANIMATION_CONTROL = {\n play: 'play',\n pause: 'pause',\n stop: 'stop',\n loading: 'loading'\n};\n\nconst isIE11 = () => {\n if (typeof window === 'undefined') return;\n const userAgent = get('navigator.userAgent', window);\n const hasMsCrypto = has('msCrypto', window);\n const hasRevision = includes('rv:', userAgent);\n const hasTrident = includes('Trident/', userAgent);\n\n return hasMsCrypto || (hasRevision && hasTrident);\n};\n\nexport const fetchAndLoadAnimation = async (\n _lottie,\n _fetch,\n animationSrc,\n containerRef,\n loop,\n animationClassnames,\n hideOnTransparent,\n autoplay\n) => {\n const animationUrl = new URL(animationSrc).toString();\n const fetchResult = await _fetch(animationUrl, {\n headers: {\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/json'\n }\n });\n\n const animationData = await fetchResult.json();\n\n const animation = _lottie.loadAnimation({\n container: containerRef.current, // the dom element that will contain the animation\n renderer: 'svg',\n autoplay,\n loop,\n animationData,\n rendererSettings: {\n className: animationClassnames,\n hideOnTransparent,\n preserveAspectRatio: 'xMidYMid meet' // same options as a preserveAspectRatio prop\n }\n });\n return animation;\n};\n\nconst LottieWrapper = props => {\n const {\n className,\n 'data-name': dataName,\n 'aria-label': ariaLabel,\n animationSrc,\n loop = false,\n rendererSettings = {},\n width,\n height,\n ie11ImageBackup,\n backupImageClassName,\n autoplay = true,\n animationControl\n } = props;\n\n const {className: animationClassName, hideOnTransparent = true} = rendererSettings;\n\n const containerRef = useRef(null);\n\n // lottie's animation instance\n const [animationItem, setAnimationItem] = useState(null);\n\n const [isAnimationVisible, setIsAnimationVisible] = useState(autoplay);\n\n const _isIE11 = useMemo(() => isIE11(), []);\n\n const wrapperClassName = useMemo(() => classnames(className, style.lottieContainer), [className]);\n\n const lottieAnimationClassName = useMemo(() => classnames(animationClassName, style.animation), [\n animationClassName\n ]);\n\n const ie11BackupImageClassName = useMemo(\n () => classnames(backupImageClassName, style.backupImage),\n [backupImageClassName]\n );\n\n useEffect(() => {\n // enzyme does not handle well the state update after an async useEffect in tests\n // to remove when the migration towards @testing-library/react is done\n /* istanbul ignore next */\n if (\n animationItem &&\n includes(animationControl, keys(omit('loading', ANIMATION_CONTROL))) &&\n !autoplay\n ) {\n setIsAnimationVisible(true);\n animationItem[animationControl]();\n if (animationControl === ANIMATION_CONTROL.stop) setIsAnimationVisible(false);\n }\n }, [animationControl, animationItem, autoplay]);\n\n useEffect(() => {\n const loadAnimation = async () => {\n if (!_isIE11 && !animationItem) {\n /* istanbul ignore else */\n if (typeof window !== 'undefined') {\n window.lottie = lottie;\n }\n const animation = await fetchAndLoadAnimation(\n lottie,\n unfetch,\n animationSrc,\n containerRef,\n loop,\n lottieAnimationClassName,\n hideOnTransparent,\n autoplay\n );\n\n /* istanbul ignore next */\n setAnimationItem(animation);\n }\n };\n\n loadAnimation();\n return () => animationItem && /* istanbul ignore next */ lottie.destroy(animationItem.name);\n }, [\n lottieAnimationClassName,\n containerRef,\n hideOnTransparent,\n loop,\n animationSrc,\n _isIE11,\n animationItem,\n autoplay\n ]);\n\n return (\n <div\n ref={containerRef}\n aria-label={ariaLabel}\n data-name={dataName}\n className={wrapperClassName}\n style={{\n ...(width && {\n width: `${width}px`,\n maxWidth: `${width}px`\n }),\n ...(height && {\n height: `${height}px`,\n maxHeight: `${height}px`\n }),\n opacity: isAnimationVisible ? 1 : 0,\n transition: 'opacity 0.25s ease-in'\n }}\n >\n {_isIE11 ? (\n <img\n src={ie11ImageBackup}\n className={ie11BackupImageClassName}\n data-name=\"ie11-backup-image\"\n />\n ) : null}\n </div>\n );\n};\n\nLottieWrapper.propTypes = {\n 'aria-label': PropTypes.string.isRequired,\n 'data-name': PropTypes.string,\n animationSrc: PropTypes.string.isRequired,\n loop: PropTypes.bool,\n rendererSettings: PropTypes.shape({\n hideOnTransparent: PropTypes.bool,\n className: PropTypes.string\n }),\n height: PropTypes.number,\n width: PropTypes.number,\n className: PropTypes.string,\n ie11ImageBackup: PropTypes.string.isRequired,\n backupImageClassName: PropTypes.string,\n autoplay: PropTypes.bool,\n animationControl: PropTypes.oneOf(keys(ANIMATION_CONTROL))\n};\n\nexport default LottieWrapper;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/atom/lottie-wrapper/index.js"],"names":["ANIMATION_CONTROL","play","pause","stop","loading","isIE11","window","userAgent","hasMsCrypto","hasRevision","hasTrident","fetchAndLoadAnimation","_lottie","_fetch","animationSrc","containerRef","loop","animationClassnames","hideOnTransparent","autoplay","animationUrl","URL","toString","fetchResult","headers","animationData","json","animation","loadAnimation","container","current","renderer","rendererSettings","className","preserveAspectRatio","LottieWrapper","props","dataName","ariaLabel","width","height","ie11ImageBackup","backupImageClassName","animationControl","animationClassName","animationItem","setAnimationItem","isAnimationVisible","setIsAnimationVisible","_isIE11","wrapperClassName","style","lottieContainer","lottieAnimationClassName","ie11BackupImageClassName","backupImage","lottie","unfetch","destroy","name","maxWidth","maxHeight","opacity","transition","propTypes","PropTypes","string","isRequired","bool","shape","number","oneOf"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,iBAAiB,GAAG;AAC/BC,EAAAA,IAAI,EAAE,MADyB;AAE/BC,EAAAA,KAAK,EAAE,OAFwB;AAG/BC,EAAAA,IAAI,EAAE,MAHyB;AAI/BC,EAA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AErB,KAAM;AAFR,KADV,GAKCC,MAAM,IAAI;AACZA,MAAAA,MAAM,EAAG,GAAEA,MAAO,IADN;AAEZqB,MAAAA,SAAS,EAAG,GAAErB,MAAO;AAFT,KALX;AASHsB,MAAAA,OAAO,EAAEf,kBAAkB,GAAG,CAAH,GAAO,CAT/B;AAUHgB,MAAAA,UAAU,EAAE;AAVT;AALP,KAkBGd,OAAO,gBACN;AACE,IAAA,GAAG,EAAER,eADP;AAEE,IAAA,SAAS,EAAEa,wBAFb;AAGE,iBAAU;AAHZ,IADM,GAMJ,IAxBN,CADF;AA4BD,CAjHD;;AAmHAnB,aAAa,CAAC6B,SAAd,2CAA0B;AACxB,gBAAcC,mBAAUC,MAAV,CAAiBC,UADP;AAExB,eAAaF,mBAAUC,MAFC;AAGxBpD,EAAAA,YAAY,EAAEmD,mBAAUC,MAAV,CAAiBC,UAHP;AAIxBnD,EAAAA,IAAI,EAAEiD,mBAAUG,IAJQ;AAKxBpC,EAAAA,gBAAgB,EAAEiC,mBAAUI,KAAV,CAAgB;AAChCnD,IAAAA,iBAAiB,EAAE+C,mBAAUG,IADG;AAEhCnC,IAAAA,SAAS,EAAEgC,mBAAUC;AAFW,GAAhB,CALM;AASxB1B,EAAAA,MAAM,EAAEyB,mBAAUK,MATM;AAUxB/B,EAAAA,KAAK,EAAE0B,mBAAUK,MAVO;AAWxBrC,EAAAA,SAAS,EAAEgC,mBAAUC,MAXG;AAYxBzB,EAAAA,eAAe,EAAEwB,mBAAUC,MAAV,CAAiBC,UAZV;AAaxBzB,EAAAA,oBAAoB,EAAEuB,mBAAUC,MAbR;AAcxB/C,EAAAA,QAAQ,EAAE8C,mBAAUG,IAdI;AAexBzB,EAAAA,gBAAgB,EAAEsB,mBAAUM,KAAV,CAAgB,mBAAKvE,iBAAL,CAAhB;AAfM,CAA1B;eAkBemC,a","sourcesContent":["import React, {useMemo, useRef, useEffect, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport lottie from 'lottie-web';\nimport get from 'lodash/fp/get';\nimport has from 'lodash/fp/has';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport omit from 'lodash/fp/omit';\nimport unfetch from 'isomorphic-unfetch';\nimport style from './style.css';\n\nexport const ANIMATION_CONTROL = {\n play: 'play',\n pause: 'pause',\n stop: 'stop',\n loading: 'loading'\n};\n\nconst isIE11 = () => {\n if (typeof window === 'undefined') return;\n const userAgent = get('navigator.userAgent', window);\n const hasMsCrypto = has('msCrypto', window);\n const hasRevision = includes('rv:', userAgent);\n const hasTrident = includes('Trident/', userAgent);\n\n return hasMsCrypto || (hasRevision && hasTrident);\n};\n\nexport const fetchAndLoadAnimation = async (\n _lottie,\n _fetch,\n animationSrc,\n containerRef,\n loop,\n animationClassnames,\n hideOnTransparent,\n autoplay\n) => {\n const animationUrl = new URL(animationSrc).toString();\n const fetchResult = await _fetch(animationUrl, {\n headers: {\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/json'\n }\n });\n\n const animationData = await fetchResult.json();\n\n const animation = _lottie.loadAnimation({\n container: containerRef.current, // the dom element that will contain the animation\n renderer: 'svg',\n autoplay,\n loop,\n animationData,\n rendererSettings: {\n className: animationClassnames,\n hideOnTransparent,\n preserveAspectRatio: 'xMidYMid meet' // same options as a preserveAspectRatio prop\n }\n });\n return animation;\n};\n\nconst LottieWrapper = props => {\n const {\n className,\n 'data-name': dataName,\n 'aria-label': ariaLabel,\n animationSrc,\n loop = false,\n rendererSettings = {},\n width,\n height,\n ie11ImageBackup,\n backupImageClassName,\n autoplay = true,\n animationControl\n } = props;\n\n const {className: animationClassName, hideOnTransparent = true} = rendererSettings;\n\n const containerRef = useRef(null);\n\n // lottie's animation instance\n const [animationItem, setAnimationItem] = useState(null);\n\n const [isAnimationVisible, setIsAnimationVisible] = useState(autoplay);\n\n const _isIE11 = useMemo(() => isIE11(), []);\n\n const wrapperClassName = useMemo(() => classnames(className, style.lottieContainer), [className]);\n\n const lottieAnimationClassName = useMemo(() => classnames(animationClassName, style.animation), [\n animationClassName\n ]);\n\n const ie11BackupImageClassName = useMemo(\n () => classnames(backupImageClassName, style.backupImage),\n [backupImageClassName]\n );\n\n useEffect(() => {\n // enzyme does not handle well the state update after an async useEffect in tests\n // to remove when the migration towards @testing-library/react is done\n /* istanbul ignore next */\n if (includes(animationControl, keys(omit('loading', ANIMATION_CONTROL))) && !autoplay) {\n setIsAnimationVisible(true);\n if (animationItem) animationItem[animationControl]();\n if (animationControl === ANIMATION_CONTROL.stop) setIsAnimationVisible(false);\n }\n }, [animationControl, animationItem, autoplay]);\n\n useEffect(() => {\n const loadAnimation = async () => {\n if (!_isIE11 && !animationItem) {\n /* istanbul ignore else */\n if (typeof window !== 'undefined') {\n window.lottie = lottie;\n }\n const animation = await fetchAndLoadAnimation(\n lottie,\n unfetch,\n animationSrc,\n containerRef,\n loop,\n lottieAnimationClassName,\n hideOnTransparent,\n autoplay\n );\n\n /* istanbul ignore next */\n setAnimationItem(animation);\n }\n };\n\n loadAnimation();\n return () => animationItem && /* istanbul ignore next */ lottie.destroy(animationItem.name);\n }, [\n lottieAnimationClassName,\n containerRef,\n hideOnTransparent,\n loop,\n animationSrc,\n _isIE11,\n animationItem,\n autoplay\n ]);\n\n return (\n <div\n ref={containerRef}\n aria-label={ariaLabel}\n data-name={dataName}\n className={wrapperClassName}\n style={{\n ...(width && {\n width: `${width}px`,\n maxWidth: `${width}px`\n }),\n ...(height && {\n height: `${height}px`,\n maxHeight: `${height}px`\n }),\n opacity: isAnimationVisible ? 1 : 0,\n transition: 'opacity 0.25s ease-in'\n }}\n >\n {_isIE11 ? (\n <img\n src={ie11ImageBackup}\n className={ie11BackupImageClassName}\n data-name=\"ie11-backup-image\"\n />\n ) : null}\n </div>\n );\n};\n\nLottieWrapper.propTypes = {\n 'aria-label': PropTypes.string.isRequired,\n 'data-name': PropTypes.string,\n animationSrc: PropTypes.string.isRequired,\n loop: PropTypes.bool,\n rendererSettings: PropTypes.shape({\n hideOnTransparent: PropTypes.bool,\n className: PropTypes.string\n }),\n height: PropTypes.number,\n width: PropTypes.number,\n className: PropTypes.string,\n ie11ImageBackup: PropTypes.string.isRequired,\n backupImageClassName: PropTypes.string,\n autoplay: PropTypes.bool,\n animationControl: PropTypes.oneOf(keys(ANIMATION_CONTROL))\n};\n\nexport default LottieWrapper;\n"],"file":"index.js"}
@@ -66,6 +66,7 @@ const BrandCreateForm = (props, context) => {
66
66
  className: fieldClass
67
67
  }, /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
68
68
  type: "text",
69
+ maxLength: "40",
69
70
  "data-name": "brand_create_text_input",
70
71
  placeholder: field.placeholder,
71
72
  defaultValue: field.value,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/molecule/brand-create-form/index.js"],"names":["BrandCreateForm","props","context","title","subtitle","description","field","onSubmit","submitValue","isPending","isModified","translate","waitMessage","wrapperClass","error","style","modifiedWrapper","wrapper","fieldClass","default","disabled","onChange","handleChange","e","target","value","actionView","wait","loading","header","content","placeholder","label","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","isRequired","shape","func","bool"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AAC1C,QAAM;AAACC,IAAAA,KAAD;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA,KAA/B;AAAsCC,IAAAA,QAAtC;AAAgDC,IAAAA,WAAhD;AAA6DC,IAAAA,SAA7D;AAAwEC,IAAAA;AAAxE,MAAsFT,KAA5F;AACA,QAAM;AAACU,IAAAA;AAAD,MAAcT,OAApB;AACA,QAAMU,WAAW,GAAGD,SAAS,CAAC,eAAD,CAA7B;AAEA,QAAME,YAAY,GAChBH,UAAU,IAAID,SAAd,IAA2BH,KAAK,CAACQ,KAAjC,GAAyCC,eAAMC,eAA/C,GAAiED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,CADF,CAHF,EAeGN,UAfH,CAJF,CADF;AAwBD,CAtDD;;AAwDA1B,eAAe,CAACiC,YAAhB,GAA+B;AAC7BtB,EAAAA,SAAS,EAAEuB,kBAASC,iBAAT,CAA2BxB;AADT,CAA/B;AAIAX,eAAe,CAACoC,SAAhB,2CAA4B;AAC1BjC,EAAAA,KAAK,EAAEkC,mBAAUC,MAAV,CAAiBC,UADE;AAE1BnC,EAAAA,QAAQ,EAAEiC,mBAAUC,MAAV,CAAiBC,UAFD;AAG1BlC,EAAAA,WAAW,EAAEgC,mBAAUC,MAAV,CAAiBC,UAHJ;AAI1BjC,EAAAA,KAAK,EAAE+B,mBAAUG,KAAV,CAAgB;AACrBT,IAAAA,WAAW,EAAEM,mBAAUC,MAAV,CAAiBC,UADT;AAErBP,IAAAA,KAAK,EAAEK,mBAAUC,MAAV,CAAiBC,UAFH;AAGrBlB,IAAAA,QAAQ,EAAEgB,mBAAUI,IAAV,CAAeF,UAHJ;AAIrBzB,IAAAA,KAAK,EAAEuB,mBAAUC,MAJI;AAKrBb,IAAAA,KAAK,EAAEY,mBAAUC;AALI,GAAhB,EAMJC,UAVuB;AAW1BhC,EAAAA,QAAQ,EAAE8B,mBAAUI,IAAV,CAAeF,UAXC;AAY1B/B,EAAAA,WAAW,EAAE6B,mBAAUC,MAAV,CAAiBC,UAZJ;AAa1B9B,EAAAA,SAAS,EAAE4B,mBAAUK,IAbK;AAc1BhC,EAAAA,UAAU,EAAE2B,mBAAUK;AAdI,CAA5B;eAiBe1C,e","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '../../atom/button';\nimport Loader from '../../atom/loader';\nimport Provider from '../../atom/provider';\nimport style from './style.css';\n\nconst BrandCreateForm = (props, context) => {\n const {title, subtitle, description, field, onSubmit, submitValue, isPending, isModified} = props;\n const {translate} = context;\n const waitMessage = translate('Wait_creation');\n\n const wrapperClass =\n isModified || isPending || field.error ? style.modifiedWrapper : style.wrapper;\n const fieldClass = field.error ? style.error : style.default;\n const disabled = isPending || !isModified;\n const {onChange} = field;\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n\n const actionView = isPending ? (\n <div>\n <div className={style.wait}>{waitMessage}</div>\n <div className={style.loading}>\n <Loader />\n </div>\n </div>\n ) : (\n <div>\n <Button\n data-name=\"brand_create_submit_button\"\n type=\"submit\"\n disabled={disabled}\n submitValue={submitValue}\n />\n </div>\n );\n\n return (\n <div className={wrapperClass}>\n <div className={style.header}>\n <h1>{title}</h1>\n </div>\n <form className={style.content} onSubmit={onSubmit}>\n <h2>{subtitle}</h2>\n <div className={style.description}>{description}</div>\n <div className={fieldClass}>\n <label>\n <input\n type=\"text\"\n data-name=\"brand_create_text_input\"\n placeholder={field.placeholder}\n defaultValue={field.value}\n onInput={handleChange}\n />\n {field.label}\n </label>\n </div>\n {actionView}\n </form>\n </div>\n );\n};\n\nBrandCreateForm.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nBrandCreateForm.propTypes = {\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n description: PropTypes.string.isRequired,\n field: PropTypes.shape({\n placeholder: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n error: PropTypes.string,\n value: PropTypes.string\n }).isRequired,\n onSubmit: PropTypes.func.isRequired,\n submitValue: PropTypes.string.isRequired,\n isPending: PropTypes.bool,\n isModified: PropTypes.bool\n};\n\nexport default BrandCreateForm;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/molecule/brand-create-form/index.js"],"names":["BrandCreateForm","props","context","title","subtitle","description","field","onSubmit","submitValue","isPending","isModified","translate","waitMessage","wrapperClass","error","style","modifiedWrapper","wrapper","fieldClass","default","disabled","onChange","handleChange","e","target","value","actionView","wait","loading","header","content","placeholder","label","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","isRequired","shape","func","bool"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;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AAE8B,mBAAUI,IAAV,CAAeF,UAXC;AAY1B/B,EAAAA,WAAW,EAAE6B,mBAAUC,MAAV,CAAiBC,UAZJ;AAa1B9B,EAAAA,SAAS,EAAE4B,mBAAUK,IAbK;AAc1BhC,EAAAA,UAAU,EAAE2B,mBAAUK;AAdI,CAA5B;eAiBe1C,e","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '../../atom/button';\nimport Loader from '../../atom/loader';\nimport Provider from '../../atom/provider';\nimport style from './style.css';\n\nconst BrandCreateForm = (props, context) => {\n const {title, subtitle, description, field, onSubmit, submitValue, isPending, isModified} = props;\n const {translate} = context;\n const waitMessage = translate('Wait_creation');\n\n const wrapperClass =\n isModified || isPending || field.error ? style.modifiedWrapper : style.wrapper;\n const fieldClass = field.error ? style.error : style.default;\n const disabled = isPending || !isModified;\n const {onChange} = field;\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n\n const actionView = isPending ? (\n <div>\n <div className={style.wait}>{waitMessage}</div>\n <div className={style.loading}>\n <Loader />\n </div>\n </div>\n ) : (\n <div>\n <Button\n data-name=\"brand_create_submit_button\"\n type=\"submit\"\n disabled={disabled}\n submitValue={submitValue}\n />\n </div>\n );\n\n return (\n <div className={wrapperClass}>\n <div className={style.header}>\n <h1>{title}</h1>\n </div>\n <form className={style.content} onSubmit={onSubmit}>\n <h2>{subtitle}</h2>\n <div className={style.description}>{description}</div>\n <div className={fieldClass}>\n <label>\n <input\n type=\"text\"\n maxLength=\"40\"\n data-name=\"brand_create_text_input\"\n placeholder={field.placeholder}\n defaultValue={field.value}\n onInput={handleChange}\n />\n {field.label}\n </label>\n </div>\n {actionView}\n </form>\n </div>\n );\n};\n\nBrandCreateForm.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nBrandCreateForm.propTypes = {\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n description: PropTypes.string.isRequired,\n field: PropTypes.shape({\n placeholder: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n error: PropTypes.string,\n value: PropTypes.string\n }).isRequired,\n onSubmit: PropTypes.func.isRequired,\n submitValue: PropTypes.string.isRequired,\n isPending: PropTypes.bool,\n isModified: PropTypes.bool\n};\n\nexport default BrandCreateForm;\n"],"file":"index.js"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.setAnimations = void 0;
5
+
6
+ var _multiply2 = _interopRequireDefault(require("lodash/fp/multiply"));
7
+
8
+ var _parseInt3 = _interopRequireDefault(require("lodash/fp/parseInt"));
9
+
10
+ var _round2 = _interopRequireDefault(require("lodash/fp/round"));
11
+
12
+ var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _propTypes = _interopRequireDefault(require("prop-types"));
17
+
18
+ var _classnames = _interopRequireDefault(require("classnames"));
19
+
20
+ var _novaIcons = require("@coorpacademy/nova-icons");
21
+
22
+ var _lottieWrapper = _interopRequireDefault(require("../../atom/lottie-wrapper"));
23
+
24
+ var _animation = _interopRequireWildcard(require("../../hoc/animation"));
25
+
26
+ var _animationScheduler = _interopRequireDefault(require("../../hoc/animation-scheduler"));
27
+
28
+ var _style = _interopRequireDefault(require("./style.css"));
29
+
30
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
31
+
32
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
+
36
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
+
38
+ const setAnimations = (setIsAnimationVisible, setIsAnimated) => () => {
39
+ setIsAnimationVisible('play');
40
+ setIsAnimated(true);
41
+ };
42
+
43
+ exports.setAnimations = setAnimations;
44
+
45
+ const ReviewCardCongrats = props => {
46
+ const {
47
+ 'aria-label': ariaLabel,
48
+ 'data-name': dataName,
49
+ animationLottie,
50
+ cardType,
51
+ iconAriaLabel,
52
+ className,
53
+ reviewCardTitle,
54
+ reviewCardValue,
55
+ rankSuffix,
56
+ timerAnimation
57
+ } = props;
58
+ const [isAnimationVisible, setIsAnimationVisible] = (0, _react.useState)('loading');
59
+ const [isAnimated, setIsAnimated] = (0, _react.useState)(false);
60
+ (0, _react.useEffect)(() => {
61
+ let timer; // istanbul ignore else
62
+
63
+ if (!isAnimationVisible || !isAnimated) {
64
+ timer = setTimeout(setAnimations(setIsAnimationVisible, setIsAnimated), timerAnimation);
65
+ }
66
+
67
+ return () => timer && clearTimeout(timer);
68
+ }, [timerAnimation]);
69
+ const wrapperClassName = (0, _classnames.default)(className, _style.default.cardContainer, cardType === 'card-star' ? _style.default.cardStar : _style.default.cardRank);
70
+ return /*#__PURE__*/_react.default.createElement("div", {
71
+ className: wrapperClassName,
72
+ "aria-label": ariaLabel,
73
+ "data-name": dataName
74
+ }, /*#__PURE__*/_react.default.createElement("div", {
75
+ className: _style.default.mainIcon
76
+ }, /*#__PURE__*/_react.default.createElement(_lottieWrapper.default, _extends({}, animationLottie, {
77
+ loop: false,
78
+ animationControl: isAnimationVisible,
79
+ autoplay: false,
80
+ "data-name": "lottie-wrapper",
81
+ className: _style.default.wrapperLottie,
82
+ backupImageClassName: _style.default.ie11Backup
83
+ }))), /*#__PURE__*/_react.default.createElement("div", {
84
+ className: _style.default.title
85
+ }, reviewCardTitle), /*#__PURE__*/_react.default.createElement("div", {
86
+ className: cardType === 'card-star' ? _style.default.textContainerStar : _style.default.textContainerRank
87
+ }, cardType === 'card-rank' ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidVoteRewardsRewardsBadge5, {
88
+ className: _style.default.iconRank,
89
+ width: 40,
90
+ height: 40,
91
+ "aria-label": iconAriaLabel
92
+ }) : null, /*#__PURE__*/_react.default.createElement(_animationScheduler.default, {
93
+ animated: isAnimated
94
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", {
95
+ className: cardType === 'card-star' ? _style.default.textStar : _style.default.textRank
96
+ }, /*#__PURE__*/_react.default.createElement(_animation.default, {
97
+ name: "counter",
98
+ bezier: _animation.EASE_OUT_CUBIC,
99
+ duration: 2000
100
+ }, progress => (0, _pipe2.default)((0, _parseInt3.default)(10), (0, _multiply2.default)(progress), _round2.default)(reviewCardValue))))), cardType === 'card-star' ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyStar, {
101
+ className: _style.default.iconStar,
102
+ width: 53,
103
+ height: 53,
104
+ "aria-label": iconAriaLabel
105
+ }) : /*#__PURE__*/_react.default.createElement("div", {
106
+ className: _style.default.rankSuffix
107
+ }, rankSuffix)));
108
+ };
109
+
110
+ ReviewCardCongrats.propTypes = process.env.NODE_ENV !== "production" ? {
111
+ 'aria-label': _propTypes.default.string,
112
+ 'data-name': _propTypes.default.string,
113
+ animationLottie: _propTypes.default.shape(_lottieWrapper.default.propTypes),
114
+ cardType: _propTypes.default.string,
115
+ iconAriaLabel: _propTypes.default.string,
116
+ className: _propTypes.default.string,
117
+ reviewCardTitle: _propTypes.default.string,
118
+ reviewCardValue: _propTypes.default.string,
119
+ rankSuffix: _propTypes.default.string,
120
+ timerAnimation: _propTypes.default.number
121
+ } : {};
122
+ var _default = ReviewCardCongrats;
123
+ exports.default = _default;
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/molecule/review-card-congrats/index.js"],"names":["setAnimations","setIsAnimationVisible","setIsAnimated","ReviewCardCongrats","props","ariaLabel","dataName","animationLottie","cardType","iconAriaLabel","className","reviewCardTitle","reviewCardValue","rankSuffix","timerAnimation","isAnimationVisible","isAnimated","timer","setTimeout","clearTimeout","wrapperClassName","style","cardContainer","cardStar","cardRank","mainIcon","wrapperLottie","ie11Backup","title","textContainerStar","textContainerRank","iconRank","textStar","textRank","EASE_OUT_CUBIC","progress","iconStar","propTypes","PropTypes","string","shape","AtomLottieWrapper","number"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,aAAa,GAAG,CAACC,qBAAD,EAAwBC,aAAxB,KAA0C,MAAM;AAC3ED,EAAAA,qBAAqB,CAAC,MAAD,CAArB;AACAC,EAAAA,aAAa,CAAC,IAAD,CAAb;AACD,CAHM;;;;AAKP,MAAMC,kBAAkB,GAAGC,KAAK,IAAI;AAClC,QAAM;AACJ,kBAAcC,SADV;AAEJ,iBAAaC,QAFT;AAGJC,IAAAA,eAHI;AAIJC,IAAAA,QAJI;AAKJC,IAAAA,aALI;AAMJC,IAAAA,SANI;AAOJC,IAAAA,eAPI;AAQJC,IAAAA,eARI;AASJC,IAAAA,UATI;AAUJC,IAAAA;AAVI,MAWFV,KAXJ;AAaA,QAAM,CAACW,kBAAD,EAAqBd,qBAArB,IAA8C,qBAAS,SAAT,CAApD;AACA,QAAM,CAACe,UAAD,EAAad,aAAb,IAA8B,qBAAS,KAAT,CAApC;AAEA,wBAAU,MAAM;AACd,QAAIe,KAAJ,CADc,CAEd;;AACA,QAAI,CAACF,kBAA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Ba,eAAMW,QAAjC,GAA4CX,eAAMY;AAAnE,kBACE,6BAAC,kBAAD;AAAW,IAAA,IAAI,EAAC,SAAhB;AAA0B,IAAA,MAAM,EAAEC,yBAAlC;AAAkD,IAAA,QAAQ,EAAE;AAA5D,KACGC,QAAQ,IAAI,oBAAK,wBAAU,EAAV,CAAL,EAAoB,wBAASA,QAAT,CAApB,mBAA+CvB,eAA/C,CADf,CADF,CADF,CADF,CAJF,EAaGJ,QAAQ,KAAK,WAAb,gBACC,6BAAC,0CAAD;AAAU,IAAA,SAAS,EAAEa,eAAMe,QAA3B;AAAqC,IAAA,KAAK,EAAE,EAA5C;AAAgD,IAAA,MAAM,EAAE,EAAxD;AAA4D,kBAAY3B;AAAxE,IADD,gBAGC;AAAK,IAAA,SAAS,EAAEY,eAAMR;AAAtB,KAAmCA,UAAnC,CAhBJ,CAbF,CADF;AAmCD,CAnED;;AAqEAV,kBAAkB,CAACkC,SAAnB,2CAA+B;AAC7B,gBAAcC,mBAAUC,MADK;AAE7B,eAAaD,mBAAUC,MAFM;AAG7BhC,EAAAA,eAAe,EAAE+B,mBAAUE,KAAV,CAAgBC,uBAAkBJ,SAAlC,CAHY;AAI7B7B,EAAAA,QAAQ,EAAE8B,mBAAUC,MAJS;AAK7B9B,EAAAA,aAAa,EAAE6B,mBAAUC,MALI;AAM7B7B,EAAAA,SAAS,EAAE4B,mBAAUC,MANQ;AAO7B5B,EAAAA,eAAe,EAAE2B,mBAAUC,MAPE;AAQ7B3B,EAAAA,eAAe,EAAE0B,mBAAUC,MARE;AAS7B1B,EAAAA,UAAU,EAAEyB,mBAAUC,MATO;AAU7BzB,EAAAA,cAAc,EAAEwB,mBAAUI;AAVG,CAA/B;eAaevC,kB","sourcesContent":["import React, {useEffect, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {pipe, round, parseInt as _parseInt, multiply} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaSolidVoteRewardsRewardsBadge5 as RankIcon\n} from '@coorpacademy/nova-icons';\nimport AtomLottieWrapper from '../../atom/lottie-wrapper';\nimport Animation, {EASE_OUT_CUBIC} from '../../hoc/animation';\nimport AnimationScheduler from '../../hoc/animation-scheduler';\nimport style from './style.css';\n\nexport const setAnimations = (setIsAnimationVisible, setIsAnimated) => () => {\n setIsAnimationVisible('play');\n setIsAnimated(true);\n};\n\nconst ReviewCardCongrats = props => {\n const {\n 'aria-label': ariaLabel,\n 'data-name': dataName,\n animationLottie,\n cardType,\n iconAriaLabel,\n className,\n reviewCardTitle,\n reviewCardValue,\n rankSuffix,\n timerAnimation\n } = props;\n\n const [isAnimationVisible, setIsAnimationVisible] = useState('loading');\n const [isAnimated, setIsAnimated] = useState(false);\n\n useEffect(() => {\n let timer;\n // istanbul ignore else\n if (!isAnimationVisible || !isAnimated) {\n timer = setTimeout(setAnimations(setIsAnimationVisible, setIsAnimated), timerAnimation);\n }\n return () => timer && clearTimeout(timer);\n }, [timerAnimation]);\n\n const wrapperClassName = classnames(\n className,\n style.cardContainer,\n cardType === 'card-star' ? style.cardStar : style.cardRank\n );\n\n return (\n <div className={wrapperClassName} aria-label={ariaLabel} data-name={dataName}>\n <div className={style.mainIcon}>\n <AtomLottieWrapper\n {...animationLottie}\n loop={false}\n animationControl={isAnimationVisible}\n autoplay={false}\n data-name=\"lottie-wrapper\"\n className={style.wrapperLottie}\n backupImageClassName={style.ie11Backup}\n />\n </div>\n <div className={style.title}>{reviewCardTitle}</div>\n <div className={cardType === 'card-star' ? style.textContainerStar : style.textContainerRank}>\n {cardType === 'card-rank' ? (\n <RankIcon className={style.iconRank} width={40} height={40} aria-label={iconAriaLabel} />\n ) : null}\n <AnimationScheduler animated={isAnimated}>\n <div>\n <span className={cardType === 'card-star' ? style.textStar : style.textRank}>\n <Animation name=\"counter\" bezier={EASE_OUT_CUBIC} duration={2000}>\n {progress => pipe(_parseInt(10), multiply(progress), round)(reviewCardValue)}\n </Animation>\n </span>\n </div>\n </AnimationScheduler>\n {cardType === 'card-star' ? (\n <StarIcon className={style.iconStar} width={53} height={53} aria-label={iconAriaLabel} />\n ) : (\n <div className={style.rankSuffix}>{rankSuffix}</div>\n )}\n </div>\n </div>\n );\n};\n\nReviewCardCongrats.propTypes = {\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n animationLottie: PropTypes.shape(AtomLottieWrapper.propTypes),\n cardType: PropTypes.string,\n iconAriaLabel: PropTypes.string,\n className: PropTypes.string,\n reviewCardTitle: PropTypes.string,\n reviewCardValue: PropTypes.string,\n rankSuffix: PropTypes.string,\n timerAnimation: PropTypes.number\n};\n\nexport default ReviewCardCongrats;\n"],"file":"index.js"}
@@ -0,0 +1,139 @@
1
+ @value breakpoints: "../../variables/breakpoints.css";
2
+ @value mobile from breakpoints;
3
+ @value colors: "../../variables/colors.css";
4
+ @value cm_blue_900 from colors;
5
+ @value cm_positive_100 from colors;
6
+ @value cm_yellow_secondary_200 from colors;
7
+
8
+ @keyframes fadeIn {
9
+ 0% {
10
+ opacity: 0;
11
+ }
12
+ 100% {
13
+ opacity: 1;
14
+ }
15
+ }
16
+
17
+ .textBase {
18
+ font-family: 'Gilroy';
19
+ font-style: normal;
20
+ user-select: none;
21
+ }
22
+
23
+ .textContainerBase {
24
+ display: flex;
25
+ align-items: center;
26
+ margin-bottom: 40px;
27
+ }
28
+
29
+ .textIconBase {
30
+ composes: textBase;
31
+ font-weight: 700;
32
+ font-size: 64px;
33
+ line-height: 77px;
34
+ }
35
+
36
+ .cardContainer {
37
+ animation: fadeIn 2s ease-in-out forwards;
38
+ backdrop-filter: blur(36px);
39
+ border-radius: 24px;
40
+ display: flex;
41
+ flex-direction: column;
42
+ justify-content: center;
43
+ width: 280px;
44
+ }
45
+
46
+ .cardStar {
47
+ box-shadow: 0px 0px 45px 6px rgba(255, 206, 10, 0.1);
48
+ }
49
+
50
+ .cardRank {
51
+ box-shadow: 0px 0px 45px 6px rgba(24, 187, 152, 0.1);
52
+ }
53
+
54
+ .mainIcon {
55
+ display: flex;
56
+ justify-content: center;
57
+ margin: 20px 0px 12px;
58
+ }
59
+
60
+ .wrapperLottie {
61
+ width: 165px;
62
+ height: 165px;
63
+ }
64
+
65
+ .ie11Backup {
66
+ composes: wrapperLottie;
67
+ }
68
+
69
+ .title {
70
+ composes: textBase;
71
+ color: cm_blue_900;
72
+ font-weight: 400;
73
+ font-size: 28px;
74
+ line-height: 36px;
75
+ text-align: center;
76
+ }
77
+
78
+ .textContainerStar {
79
+ composes: textContainerBase;
80
+ justify-content: flex-end;
81
+ }
82
+
83
+ .textContainerRank {
84
+ composes: textContainerBase;
85
+ justify-content: space-between;
86
+ padding: 0 45px;
87
+ }
88
+
89
+ .textStar {
90
+ composes: textIconBase;
91
+ color: cm_yellow_secondary_200;
92
+ }
93
+
94
+ .textRank {
95
+ composes: textIconBase;
96
+ color: cm_blue_900;
97
+ }
98
+
99
+ .iconStar {
100
+ color: cm_yellow_secondary_200;
101
+ padding: 0 55px 0 10px;
102
+ }
103
+
104
+ .iconRank {
105
+ color: cm_positive_100;
106
+ }
107
+
108
+ .rankSuffix {
109
+ composes: textIconBase;
110
+ color: cm_blue_900;
111
+ }
112
+
113
+ @media mobile {
114
+ .cardContainer {
115
+ width: 240px;
116
+ }
117
+
118
+ .mainIcon {
119
+ margin: 14px 0px 6px;
120
+ }
121
+
122
+ .textContainerBase {
123
+ margin-bottom: 20px;
124
+ }
125
+
126
+ .iconStar {
127
+ color: cm_yellow_secondary_200;
128
+ padding: 0 35px 0 10px;
129
+ }
130
+
131
+ .wrapperLottie {
132
+ width: 140px;
133
+ height: 140px;
134
+ }
135
+
136
+ .textStar, .textRank, .rankSuffix {
137
+ font-size: 54px;
138
+ }
139
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ var _browserEnv = _interopRequireDefault(require("browser-env"));
4
+
5
+ var _ava = _interopRequireDefault(require("ava"));
6
+
7
+ var _react = _interopRequireDefault(require("react"));
8
+
9
+ var _react2 = require("@testing-library/react");
10
+
11
+ var _ = _interopRequireWildcard(require(".."));
12
+
13
+ var _star = _interopRequireDefault(require("./fixtures/star"));
14
+
15
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
16
+
17
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
22
+
23
+ (0, _browserEnv.default)({
24
+ pretendToBeVisual: true
25
+ });
26
+
27
+ _ava.default.afterEach(_react2.cleanup);
28
+
29
+ (0, _ava.default)('should trigger lottie animation', async t => {
30
+ const props = _extends(_extends({}, _star.default.props), {}, {
31
+ timerAnimation: 0
32
+ });
33
+
34
+ const {
35
+ container,
36
+ rerender
37
+ } = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_.default, props));
38
+ await (0, _react2.waitFor)(async () => {
39
+ const result = await t.try(tt => {
40
+ rerender( /*#__PURE__*/_react.default.createElement(_.default, props));
41
+ const lottieWrapper = container.querySelectorAll('[data-name="lottie-wrapper"]');
42
+ tt.truthy(lottieWrapper);
43
+ });
44
+ if (result.passed) return result.commit();
45
+ result.discard();
46
+ throw result.errors;
47
+ });
48
+ t.pass();
49
+ });
50
+ (0, _ava.default)('setAnimations', t => {
51
+ t.plan(2);
52
+
53
+ const _setIsAnimationVisible = () => {
54
+ t.pass();
55
+ };
56
+
57
+ const _setIsAnimated = () => {
58
+ t.pass();
59
+ };
60
+
61
+ (0, _.setAnimations)(_setIsAnimationVisible, _setIsAnimated)();
62
+ });
63
+ //# sourceMappingURL=card-congrats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/molecule/review-card-congrats/test/card-congrats.js"],"names":["pretendToBeVisual","test","afterEach","cleanup","t","props","starFixture","timerAnimation","container","rerender","result","try","tt","lottieWrapper","querySelectorAll","truthy","passed","commit","discard","errors","pass","plan","_setIsAnimationVisible","_setIsAnimated"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,yBAAW;AAACA,EAAAA,iBAAiB,EAAE;AAApB,CAAX;;AAEAC,aAAKC,SAAL,CAAeC,eAAf;;AAEA,kBAAK,iCAAL,EAAwC,MAAMC,CAAN,IAAW;AACjD,QAAMC,KAAK,yBAAOC,cAAYD,KAAnB;AAA0BE,IAAAA,cAAc,EAAE;AAA1C,IAAX;;AACA,QAAM;AAACC,IAAAA,SAAD;AAAYC,IAAAA;AAAZ,MAAwB,kCAAO,6BAAC,SAAD,EAAwBJ,KAAxB,CAAP,CAA9B;AAEA,QAAM,qBAAQ,YAAY;AACxB,UAAMK,MAAM,GAAG,MAAMN,CAAC,CAACO,GAAF,CAAMC,EAAE,IAAI;AAC/BH,MAAAA,QAAQ,eAAC,6BAAC,SAAD,EAAwBJ,KAAxB,CAAD,CAAR;AACA,YAAMQ,aAAa,GAAGL,SAAS,CAACM,gBAAV,CAA2B,8BAA3B,CAAtB;AACAF,MAAAA,EAAE,CAACG,MAAH,CAAUF,aAAV;AACD,KAJoB,CAArB;AAKA,QAAIH,MAAM,CAACM,MAAX,EAAmB,OAAON,MAAM,CAACO,MAAP,EAAP;AACnBP,IAAAA,MAAM,CAACQ,OAAP;AACA,UAAMR,MAAM,CAACS,MAAb;AACD,GATK,CAAN;AAUAf,EAAAA,CAAC,CAACgB,IAAF;AACD,CAfD;AAiBA,kBAAK,eAAL,EAAsBhB,CAAC,IAAI;AACzBA,EAAAA,CAAC,CAACiB,IAAF,CAAO,CAAP;;AACA,QAAMC,sBAAsB,GAAG,MAAM;AACnClB,IAAAA,CAAC,CAACgB,IAAF;AACD,GAFD;;AAGA,QAAMG,cAAc,GAAG,MAAM;AAC3BnB,IAAAA,CAAC,CAACgB,IAAF;AACD,GAFD;;AAIA,uBAAcE,sBAAd,EAAsCC,cAAtC;AACD,CAVD","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {render, cleanup, waitFor} from '@testing-library/react';\nimport ReviewCardCongrats, {setAnimations} from '..';\nimport starFixture from './fixtures/star';\n\nbrowserEnv({pretendToBeVisual: true});\n\ntest.afterEach(cleanup);\n\ntest('should trigger lottie animation', async t => {\n const props = {...starFixture.props, timerAnimation: 0};\n const {container, rerender} = render(<ReviewCardCongrats {...props} />);\n\n await waitFor(async () => {\n const result = await t.try(tt => {\n rerender(<ReviewCardCongrats {...props} />);\n const lottieWrapper = container.querySelectorAll('[data-name=\"lottie-wrapper\"]');\n tt.truthy(lottieWrapper);\n });\n if (result.passed) return result.commit();\n result.discard();\n throw result.errors;\n });\n t.pass();\n});\n\ntest('setAnimations', t => {\n t.plan(2);\n const _setIsAnimationVisible = () => {\n t.pass();\n };\n const _setIsAnimated = () => {\n t.pass();\n };\n\n setAnimations(_setIsAnimationVisible, _setIsAnimated)();\n});\n"],"file":"card-congrats.js"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.defaultProps = void 0;
5
+
6
+ var _rank = _interopRequireDefault(require("../../../../atom/lottie-wrapper/test/fixtures/rank"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
+
12
+ const defaultProps = {
13
+ 'aria-label': 'Review Card Congrats Container',
14
+ 'data-name': 'card-rank',
15
+ animationLottie: _extends(_extends({}, _rank.default.props), {}, {
16
+ height: undefined,
17
+ width: undefined
18
+ }),
19
+ cardType: 'card-rank',
20
+ iconAriaLabel: 'Image without information',
21
+ className: undefined,
22
+ reviewCardTitle: 'You are now',
23
+ reviewCardValue: '14',
24
+ rankSuffix: 'th',
25
+ timerAnimation: 200
26
+ };
27
+ exports.defaultProps = defaultProps;
28
+ var _default = {
29
+ props: defaultProps
30
+ };
31
+ exports.default = _default;
32
+ //# sourceMappingURL=rank.js.map