@coorpacademy/components 11.11.1 → 11.11.3-alpha.2

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 (67) hide show
  1. package/es/atom/battle-opponent/index.d.ts +19 -0
  2. package/es/atom/battle-opponent/index.d.ts.map +1 -0
  3. package/es/atom/battle-opponent/index.js +52 -0
  4. package/es/atom/battle-opponent/index.js.map +1 -0
  5. package/es/atom/battle-opponent/prop-types.d.ts +19 -0
  6. package/es/atom/battle-opponent/prop-types.d.ts.map +1 -0
  7. package/es/atom/battle-opponent/prop-types.js +11 -0
  8. package/es/atom/battle-opponent/prop-types.js.map +1 -0
  9. package/es/atom/battle-opponent/style.css +126 -0
  10. package/es/atom/tooltip/index.d.ts +3 -1
  11. package/es/atom/tooltip/index.d.ts.map +1 -1
  12. package/es/atom/tooltip/index.js +17 -7
  13. package/es/atom/tooltip/index.js.map +1 -1
  14. package/es/atom/tooltip/style.css +10 -2
  15. package/es/globals.d.js.map +1 -1
  16. package/es/molecule/battle-opponent-list/index.d.ts +18 -0
  17. package/es/molecule/battle-opponent-list/index.d.ts.map +1 -0
  18. package/es/molecule/battle-opponent-list/index.js +21 -0
  19. package/es/molecule/battle-opponent-list/index.js.map +1 -0
  20. package/es/molecule/battle-opponent-list/prop-types.d.ts +26 -0
  21. package/es/molecule/battle-opponent-list/prop-types.d.ts.map +1 -0
  22. package/es/molecule/battle-opponent-list/prop-types.js +14 -0
  23. package/es/molecule/battle-opponent-list/prop-types.js.map +1 -0
  24. package/es/molecule/video-player-mobile/index.native.d.ts +1 -1
  25. package/es/molecule/video-player-mobile/index.native.d.ts.map +1 -1
  26. package/es/molecule/video-player-mobile/index.native.js +26 -9
  27. package/es/molecule/video-player-mobile/index.native.js.map +1 -1
  28. package/es/organism/review-slide/index.native.d.ts.map +1 -1
  29. package/es/organism/review-slide/index.native.js +32 -15
  30. package/es/organism/review-slide/index.native.js.map +1 -1
  31. package/es/organism/user-preferences/index.d.ts.map +1 -1
  32. package/es/organism/user-preferences/index.js +6 -3
  33. package/es/organism/user-preferences/index.js.map +1 -1
  34. package/lib/atom/battle-opponent/index.d.ts +19 -0
  35. package/lib/atom/battle-opponent/index.d.ts.map +1 -0
  36. package/lib/atom/battle-opponent/index.js +70 -0
  37. package/lib/atom/battle-opponent/index.js.map +1 -0
  38. package/lib/atom/battle-opponent/prop-types.d.ts +19 -0
  39. package/lib/atom/battle-opponent/prop-types.d.ts.map +1 -0
  40. package/lib/atom/battle-opponent/prop-types.js +20 -0
  41. package/lib/atom/battle-opponent/prop-types.js.map +1 -0
  42. package/lib/atom/battle-opponent/style.css +126 -0
  43. package/lib/atom/tooltip/index.d.ts +3 -1
  44. package/lib/atom/tooltip/index.d.ts.map +1 -1
  45. package/lib/atom/tooltip/index.js +18 -7
  46. package/lib/atom/tooltip/index.js.map +1 -1
  47. package/lib/atom/tooltip/style.css +10 -2
  48. package/lib/globals.d.js.map +1 -1
  49. package/lib/molecule/battle-opponent-list/index.d.ts +18 -0
  50. package/lib/molecule/battle-opponent-list/index.d.ts.map +1 -0
  51. package/lib/molecule/battle-opponent-list/index.js +37 -0
  52. package/lib/molecule/battle-opponent-list/index.js.map +1 -0
  53. package/lib/molecule/battle-opponent-list/prop-types.d.ts +26 -0
  54. package/lib/molecule/battle-opponent-list/prop-types.d.ts.map +1 -0
  55. package/lib/molecule/battle-opponent-list/prop-types.js +23 -0
  56. package/lib/molecule/battle-opponent-list/prop-types.js.map +1 -0
  57. package/lib/molecule/video-player-mobile/index.native.d.ts +1 -1
  58. package/lib/molecule/video-player-mobile/index.native.d.ts.map +1 -1
  59. package/lib/molecule/video-player-mobile/index.native.js +29 -9
  60. package/lib/molecule/video-player-mobile/index.native.js.map +1 -1
  61. package/lib/organism/review-slide/index.native.d.ts.map +1 -1
  62. package/lib/organism/review-slide/index.native.js +31 -13
  63. package/lib/organism/review-slide/index.native.js.map +1 -1
  64. package/lib/organism/user-preferences/index.d.ts.map +1 -1
  65. package/lib/organism/user-preferences/index.js +10 -3
  66. package/lib/organism/user-preferences/index.js.map +1 -1
  67. package/package.json +4 -2
@@ -13,6 +13,8 @@ var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
13
13
 
14
14
  var _isString = _interopRequireDefault(require("lodash/fp/isString"));
15
15
 
16
+ var _keys = _interopRequireDefault(require("lodash/fp/keys"));
17
+
16
18
  var _novaIcons = require("@coorpacademy/nova-icons");
17
19
 
18
20
  var _style = _interopRequireDefault(require("./style.css"));
@@ -27,13 +29,18 @@ const FontSizes = {
27
29
  12: _style.default.tooltipContentFontSize12,
28
30
  14: _style.default.tooltipContentFontSize14
29
31
  };
32
+ const IconSizes = {
33
+ small: 12,
34
+ big: 20
35
+ };
30
36
 
31
37
  const ToolTipWrapper = ({
32
38
  toolTipIsVisible,
33
39
  anchorId,
34
40
  closeToolTipInformationTextAriaLabel,
35
41
  content,
36
- handleContentMouseOver
42
+ handleContentMouseOver,
43
+ iconSize
37
44
  }) => {
38
45
  if (!toolTipIsVisible) return null;
39
46
 
@@ -48,7 +55,7 @@ const ToolTipWrapper = ({
48
55
  }, content);
49
56
  } else {
50
57
  return /*#__PURE__*/_react.default.createElement("div", {
51
- className: _style.default.toolTip,
58
+ className: (0, _classnames.default)(_style.default.toolTip, iconSize === 'big' ? _style.default.bigIconToolTip : _style.default.smallIconToolTip),
52
59
  "data-testid": "tooltip",
53
60
  "aria-label": closeToolTipInformationTextAriaLabel,
54
61
  onMouseOver: handleContentMouseOver
@@ -61,7 +68,8 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
61
68
  anchorId: _propTypes.default.string,
62
69
  closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
63
70
  content: _propTypes.default.node,
64
- handleContentMouseOver: _propTypes.default.func
71
+ handleContentMouseOver: _propTypes.default.func,
72
+ iconSize: _propTypes.default.oneOf((0, _keys.default)(IconSizes))
65
73
  } : {};
66
74
 
67
75
  const toggleStateOnKeyPress = (state, setState, ref) => event => {
@@ -86,7 +94,8 @@ const ToolTip = ({
86
94
  toolTipIsVisible: _toolTipIsVisible,
87
95
  iconContainerClassName,
88
96
  delayHide = 250,
89
- fontSize = 14
97
+ fontSize = 14,
98
+ iconSize = 'small'
90
99
  }) => {
91
100
  const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
92
101
  const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
@@ -131,8 +140,8 @@ const ToolTip = ({
131
140
  tabIndex: 0
132
141
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
133
142
  className: _style.default.informationIcon,
134
- width: 12,
135
- height: 12,
143
+ width: IconSizes[iconSize],
144
+ height: IconSizes[iconSize],
136
145
  "aria-label": ariaLabel
137
146
  })), /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
138
147
  toolTipIsVisible: toolTipIsVisible,
@@ -140,7 +149,8 @@ const ToolTip = ({
140
149
  closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
141
150
  content: content,
142
151
  handleContentMouseOver: handleContentMouseOver,
143
- fontSize: fontSize
152
+ fontSize: fontSize,
153
+ iconSize: iconSize
144
154
  }));
145
155
  };
146
156
 
@@ -153,6 +163,7 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
153
163
  iconContainerClassName: _propTypes.default.string,
154
164
  delayHide: _propTypes.default.number,
155
165
  fontSize: _propTypes.default.oneOf([12, 14]),
166
+ iconSize: _propTypes.default.oneOf((0, _keys.default)(IconSizes)),
156
167
  // ---------- React Tooltip exclusive --------------
157
168
  // externalHandling: if passed down, React Tooltip is used instead, due to limitations on
158
169
  // parents overflow hidden controls
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FontSizes","style","tooltipContentFontSize12","tooltipContentFontSize14","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","func","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","useCallback","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","classnames","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number","oneOf"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={style.toolTip}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={12}\n height={12}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;EAChB,IAAIC,cAAA,CAAMC,wBADM;EAEhB,IAAID,cAAA,CAAME;AAFM,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC;AALsB,CAAD,KAMjB;EACJ,IAAI,CAACJ,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,6BAAC,qBAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEL,cAAA,CAAMS,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OAL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BC,UAJrC;EAKlB;EACAkB,sBAAsB,EAAErB,kBAAA,CAAUE,MANhB;EAOlBoB,SAAS,EAAEtB,kBAAA,CAAU6C,MAPH;EAQlBtB,QAAQ,EAAEvB,kBAAA,CAAU8C,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlB;EACA;EACA;EACArD,QAAQ,EAAEO,kBAAA,CAAUE,MAZF;EAalBV,gBAAgB,EAAEQ,kBAAA,CAAUC;AAbV,CAApB;eAgBee,O"}
1
+ {"version":3,"file":"index.js","names":["FontSizes","style","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","toolTipReact","classnames","toolTip","bigIconToolTip","smallIconToolTip","propTypes","PropTypes","bool","string","isRequired","node","func","oneOf","keys","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","useCallback","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={classnames(\n style.toolTip,\n iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n )}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes))\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small'\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;EAChB,IAAIC,cAAA,CAAMC,wBADM;EAEhB,IAAID,cAAA,CAAME;AAFM,CAAlB;AAKA,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,EADS;EAEhBC,GAAG,EAAE;AAFW,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC,sBALsB;EAMtBC;AANsB,CAAD,KAOjB;EACJ,IAAI,CAACL,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,6BAAC,qBAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAER,cAAA,CAAMa,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYJ;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAE,IAAAI,mBAAA,EACTd,cAAA,CAAMe,OADG,EAETH,QAAQ,KAAK,KAAb,GAAqBZ,cAAA,CAAMgB,cAA3B,GAA4ChB,cAAA,CAAMiB,gBAFzC,CADb;MAKE,eAAY,SALd;MAME,cAAYR,oCANd;MAOE,WAAW,EAAEE;IAPf,GASGD,OATH,CADF;EAaD;AACF,CArCD;;AAuCAJ,cAAc,CAACY,SAAf,2CAA2B;EACzBX,gBAAgB,EAAEY,kBAAA,CAAUC,IADH;EAEzBZ,QAAQ,EAAEW,kBAAA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B,QAAQ,EAAEzB,kBAAA,CAAUM,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlBb,QAAQ,EAAEO,kBAAA,CAAUM,KAAV,CAAgB,IAAAC,aAAA,EAAKvB,SAAL,CAAhB,CATQ;EAUlB;EACA;EACA;EACAK,QAAQ,EAAEW,kBAAA,CAAUE,MAbF;EAclBd,gBAAgB,EAAEY,kBAAA,CAAUC;AAdV,CAApB;eAiBeiB,O"}
@@ -34,12 +34,20 @@
34
34
  position: absolute;
35
35
  border-radius: 7px;
36
36
  background-color: cm_grey_700;
37
- right: -75px;
38
- bottom: 32px;
39
37
  height: auto;
40
38
  width: 200px;
41
39
  }
42
40
 
41
+ .bigIconToolTip {
42
+ right: -71px;
43
+ bottom: 31px;
44
+ }
45
+
46
+ .smallIconToolTip {
47
+ right: -75px;
48
+ bottom: 32px;
49
+ }
50
+
43
51
  .toolTip::before {
44
52
  content: '';
45
53
  display: inline-block;
@@ -1 +1 @@
1
- {"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module 'react-native/*';\ndeclare module 'color';\ndeclare module 'classnames';\ndeclare module '*.css';\n"],"mappings":""}
1
+ {"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module 'browser-env';\ndeclare module 'react-native/*';\ndeclare module 'color';\ndeclare module 'classnames';\ndeclare module '*.css';\n"],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { BattleOpponentListProps } from './prop-types';
3
+ declare const BattleOpponentList: {
4
+ ({ opponents }: BattleOpponentListProps): JSX.Element[];
5
+ propTypes: {
6
+ opponents: import("prop-types").Requireable<(import("prop-types").InferProps<{
7
+ isAlreadyEngaged: import("prop-types").Requireable<boolean>;
8
+ isRandom: import("prop-types").Requireable<boolean>;
9
+ photo: import("prop-types").Requireable<string>;
10
+ onClick: import("prop-types").Requireable<(...args: any[]) => any>;
11
+ displayName: import("prop-types").Requireable<string>;
12
+ tooltipText: import("prop-types").Requireable<string>;
13
+ user_id: import("prop-types").Requireable<string>;
14
+ }> | null | undefined)[]>;
15
+ };
16
+ };
17
+ export default BattleOpponentList;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/battle-opponent-list/index.tsx"],"names":[],"mappings":";AAIA,OAAkB,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAEhE,QAAA,MAAM,kBAAkB;oBAAiB,uBAAuB;;;;;;;;;;;;CAiB/D,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _get = _interopRequireDefault(require("lodash/fp/get"));
9
+
10
+ var _map = _interopRequireDefault(require("lodash/fp/map"));
11
+
12
+ var _battleOpponent = _interopRequireDefault(require("../../atom/battle-opponent"));
13
+
14
+ var _propTypes = _interopRequireDefault(require("./prop-types"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
21
+
22
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
23
+
24
+ const BattleOpponentList = ({
25
+ opponents
26
+ }) => {
27
+ const opponentList = (0, _react.useMemo)(() => (0, _map.default)(opponent => /*#__PURE__*/_react.default.createElement(_battleOpponent.default, _extends({}, opponent, {
28
+ key: opponent.user_id,
29
+ userAvatarSrc: (0, _get.default)('photo', opponent)
30
+ })), opponents), [opponents]);
31
+ return opponentList;
32
+ };
33
+
34
+ BattleOpponentList.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.default : {};
35
+ var _default = BattleOpponentList;
36
+ exports.default = _default;
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["BattleOpponentList","opponents","opponentList","useMemo","map","opponent","user_id","get","propTypes"],"sources":["../../../src/molecule/battle-opponent-list/index.tsx"],"sourcesContent":["import React, {useMemo} from 'react';\nimport get from 'lodash/fp/get';\nimport map from 'lodash/fp/map';\nimport BattleOpponent from '../../atom/battle-opponent';\nimport propTypes, {BattleOpponentListProps} from './prop-types';\n\nconst BattleOpponentList = ({opponents}: BattleOpponentListProps) => {\n const opponentList = useMemo(\n () =>\n map(\n opponent => (\n <BattleOpponent\n {...opponent}\n key={opponent.user_id}\n userAvatarSrc={get('photo', opponent)}\n />\n ),\n opponents\n ),\n [opponents]\n );\n\n return opponentList;\n};\n\nBattleOpponentList.propTypes = propTypes;\n\nexport default BattleOpponentList;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,kBAAkB,GAAG,CAAC;EAACC;AAAD,CAAD,KAA0C;EACnE,MAAMC,YAAY,GAAG,IAAAC,cAAA,EACnB,MACE,IAAAC,YAAA,EACEC,QAAQ,iBACN,6BAAC,uBAAD,eACMA,QADN;IAEE,GAAG,EAAEA,QAAQ,CAACC,OAFhB;IAGE,aAAa,EAAE,IAAAC,YAAA,EAAI,OAAJ,EAAaF,QAAb;EAHjB,GAFJ,EAQEJ,SARF,CAFiB,EAYnB,CAACA,SAAD,CAZmB,CAArB;EAeA,OAAOC,YAAP;AACD,CAjBD;;AAmBAF,kBAAkB,CAACQ,SAAnB,2CAA+BA,kBAA/B;eAEeR,kB"}
@@ -0,0 +1,26 @@
1
+ import PropTypes from 'prop-types';
2
+ declare const propTypes: {
3
+ opponents: PropTypes.Requireable<(PropTypes.InferProps<{
4
+ isAlreadyEngaged: PropTypes.Requireable<boolean>;
5
+ isRandom: PropTypes.Requireable<boolean>;
6
+ photo: PropTypes.Requireable<string>;
7
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
8
+ displayName: PropTypes.Requireable<string>;
9
+ tooltipText: PropTypes.Requireable<string>;
10
+ user_id: PropTypes.Requireable<string>;
11
+ }> | null | undefined)[]>;
12
+ };
13
+ declare type MoocBattleOpponent = {
14
+ isAlreadyEngaged?: boolean;
15
+ isRandom?: boolean;
16
+ photo?: string;
17
+ onClick?: () => void;
18
+ displayName: string;
19
+ tooltipText: string;
20
+ user_id: string;
21
+ };
22
+ export declare type BattleOpponentListProps = {
23
+ opponents: MoocBattleOpponent[];
24
+ };
25
+ export default propTypes;
26
+ //# sourceMappingURL=prop-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/battle-opponent-list/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,QAAA,MAAM,SAAS;;;;;;;;;;CAYd,CAAC;AAEF,aAAK,kBAAkB,GAAG;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,uBAAuB,GAAG;IAAC,SAAS,EAAE,kBAAkB,EAAE,CAAA;CAAC,CAAC;AAExE,eAAe,SAAS,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _propTypes = _interopRequireDefault(require("prop-types"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ const propTypes = {
11
+ opponents: _propTypes.default.arrayOf(_propTypes.default.shape({
12
+ isAlreadyEngaged: _propTypes.default.bool,
13
+ isRandom: _propTypes.default.bool,
14
+ photo: _propTypes.default.string,
15
+ onClick: _propTypes.default.func,
16
+ displayName: _propTypes.default.string,
17
+ tooltipText: _propTypes.default.string,
18
+ user_id: _propTypes.default.string
19
+ }))
20
+ };
21
+ var _default = propTypes;
22
+ exports.default = _default;
23
+ //# sourceMappingURL=prop-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-types.js","names":["propTypes","opponents","PropTypes","arrayOf","shape","isAlreadyEngaged","bool","isRandom","photo","string","onClick","func","displayName","tooltipText","user_id"],"sources":["../../../src/molecule/battle-opponent-list/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst propTypes = {\n opponents: PropTypes.arrayOf(\n PropTypes.shape({\n isAlreadyEngaged: PropTypes.bool,\n isRandom: PropTypes.bool,\n photo: PropTypes.string,\n onClick: PropTypes.func,\n displayName: PropTypes.string,\n tooltipText: PropTypes.string,\n user_id: PropTypes.string\n })\n )\n};\n\ntype MoocBattleOpponent = {\n isAlreadyEngaged?: boolean;\n isRandom?: boolean;\n photo?: string;\n onClick?: () => void;\n displayName: string;\n tooltipText: string;\n user_id: string;\n};\n\nexport type BattleOpponentListProps = {opponents: MoocBattleOpponent[]};\n\nexport default propTypes;\n"],"mappings":";;;;;AAAA;;;;AAEA,MAAMA,SAAS,GAAG;EAChBC,SAAS,EAAEC,kBAAA,CAAUC,OAAV,CACTD,kBAAA,CAAUE,KAAV,CAAgB;IACdC,gBAAgB,EAAEH,kBAAA,CAAUI,IADd;IAEdC,QAAQ,EAAEL,kBAAA,CAAUI,IAFN;IAGdE,KAAK,EAAEN,kBAAA,CAAUO,MAHH;IAIdC,OAAO,EAAER,kBAAA,CAAUS,IAJL;IAKdC,WAAW,EAAEV,kBAAA,CAAUO,MALT;IAMdI,WAAW,EAAEX,kBAAA,CAAUO,MANT;IAOdK,OAAO,EAAEZ,kBAAA,CAAUO;EAPL,CAAhB,CADS;AADK,CAAlB;eA0BeT,S"}
@@ -3,6 +3,6 @@ import { Media } from '../questions/types';
3
3
  export declare type Props = {
4
4
  media: Media;
5
5
  };
6
- declare const Video: ({ media }: Props) => JSX.Element;
6
+ declare const Video: ({ media }: Props) => JSX.Element | null;
7
7
  export default Video;
8
8
  //# sourceMappingURL=index.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,oBAAY,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC;AA0BnC,QAAA,MAAM,KAAK,cAAa,KAAK,gBAE5B,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,oBAAY,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,CAAC;AAwCnC,QAAA,MAAM,KAAK,cAAa,KAAK,uBAE5B,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -9,33 +9,55 @@ var _reactNative = require("react-native");
9
9
 
10
10
  var _reactNativeJwMediaPlayer = _interopRequireDefault(require("react-native-jw-media-player"));
11
11
 
12
+ var _reactNativeYoutube = _interopRequireDefault(require("react-native-youtube"));
13
+
14
+ var _reactNativeVimeoIframe = require("react-native-vimeo-iframe");
15
+
16
+ var _templateContext = require("../../template/app-review/template-context");
17
+
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
19
 
14
20
  const styleSheet = _reactNative.StyleSheet.create({
15
21
  container: {
16
22
  flex: 1,
17
23
  width: '100%'
18
- },
19
- video: {
20
- flex: 1,
21
- width: '100%'
22
24
  }
23
25
  });
24
26
 
25
27
  const VideoSwitch = ({
26
28
  media
27
29
  }) => {
30
+ const {
31
+ brandTheme
32
+ } = (0, _templateContext.useTemplateContext)();
33
+
28
34
  switch (media.mimeType) {
35
+ case 'application/kontiki':
29
36
  case 'application/jwplayer':
37
+ case 'video/mp4':
30
38
  if (!media.jwpOptions?.config) {
31
39
  return null;
32
40
  }
33
41
 
34
42
  return /*#__PURE__*/_react.default.createElement(_reactNativeJwMediaPlayer.default, {
35
- style: styleSheet.video,
43
+ style: styleSheet.container,
36
44
  config: media.jwpOptions.config
37
45
  });
38
46
 
47
+ case 'application/vimeo':
48
+ return media.videoId ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
49
+ style: styleSheet.container
50
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeVimeoIframe.Vimeo, {
51
+ videoId: media.videoId
52
+ })) : null;
53
+
54
+ case 'application/youtube':
55
+ return /*#__PURE__*/_react.default.createElement(_reactNativeYoutube.default, {
56
+ apiKey: brandTheme.youtube?.apiKey || '',
57
+ style: styleSheet.container,
58
+ videoId: media.videoId
59
+ });
60
+
39
61
  default:
40
62
  return /*#__PURE__*/_react.default.createElement(_reactNative.Text, null, `video mimeType ${media.mimeType} is not handled`);
41
63
  }
@@ -44,11 +66,9 @@ const VideoSwitch = ({
44
66
  const Video = ({
45
67
  media
46
68
  }) => {
47
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
48
- style: styleSheet.container
49
- }, media ? /*#__PURE__*/_react.default.createElement(VideoSwitch, {
69
+ return media ? /*#__PURE__*/_react.default.createElement(VideoSwitch, {
50
70
  media: media
51
- }) : null);
71
+ }) : null;
52
72
  };
53
73
 
54
74
  var _default = Video;
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["styleSheet","StyleSheet","create","container","flex","width","video","VideoSwitch","media","mimeType","jwpOptions","config","Video"],"sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {StyleSheet, Text, View} from 'react-native';\nimport JWPlayer from 'react-native-jw-media-player';\n\nimport {Media} from '../questions/types';\n\nexport type Props = {media: Media};\n\nconst styleSheet = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%'\n },\n video: {\n flex: 1,\n width: '100%'\n }\n});\n\nconst VideoSwitch = ({media}: Props) => {\n switch (media.mimeType) {\n case 'application/jwplayer':\n if (!media.jwpOptions?.config) {\n return null;\n }\n\n return <JWPlayer style={styleSheet.video} config={media.jwpOptions.config} />;\n default:\n return <Text>{`video mimeType ${media.mimeType} is not handled`}</Text>;\n }\n};\n\nconst Video = ({media}: Props) => {\n return <View style={styleSheet.container}>{media ? <VideoSwitch media={media} /> : null}</View>;\n};\n\nexport default Video;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;;;AAMA,MAAMA,UAAU,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EACnCC,SAAS,EAAE;IACTC,IAAI,EAAE,CADG;IAETC,KAAK,EAAE;EAFE,CADwB;EAKnCC,KAAK,EAAE;IACLF,IAAI,EAAE,CADD;IAELC,KAAK,EAAE;EAFF;AAL4B,CAAlB,CAAnB;;AAWA,MAAME,WAAW,GAAG,CAAC;EAACC;AAAD,CAAD,KAAoB;EACtC,QAAQA,KAAK,CAACC,QAAd;IACE,KAAK,sBAAL;MACE,IAAI,CAACD,KAAK,CAACE,UAAN,EAAkBC,MAAvB,EAA+B;QAC7B,OAAO,IAAP;MACD;;MAED,oBAAO,6BAAC,iCAAD;QAAU,KAAK,EAAEX,UAAU,CAACM,KAA5B;QAAmC,MAAM,EAAEE,KAAK,CAACE,UAAN,CAAiBC;MAA5D,EAAP;;IACF;MACE,oBAAO,6BAAC,iBAAD,QAAQ,kBAAiBH,KAAK,CAACC,QAAS,iBAAxC,CAAP;EARJ;AAUD,CAXD;;AAaA,MAAMG,KAAK,GAAG,CAAC;EAACJ;AAAD,CAAD,KAAoB;EAChC,oBAAO,6BAAC,iBAAD;IAAM,KAAK,EAAER,UAAU,CAACG;EAAxB,GAAoCK,KAAK,gBAAG,6BAAC,WAAD;IAAa,KAAK,EAAEA;EAApB,EAAH,GAAmC,IAA5E,CAAP;AACD,CAFD;;eAIeI,K"}
1
+ {"version":3,"file":"index.native.js","names":["styleSheet","StyleSheet","create","container","flex","width","VideoSwitch","media","brandTheme","useTemplateContext","mimeType","jwpOptions","config","videoId","youtube","apiKey","Video"],"sources":["../../../src/molecule/video-player-mobile/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {StyleSheet, Text, View} from 'react-native';\nimport JWPlayer from 'react-native-jw-media-player';\nimport Youtube from 'react-native-youtube';\nimport {Vimeo} from 'react-native-vimeo-iframe';\nimport {useTemplateContext} from '../../template/app-review/template-context';\n\nimport {Media} from '../questions/types';\n\nexport type Props = {media: Media};\n\nconst styleSheet = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%'\n }\n});\n\nconst VideoSwitch = ({media}: Props) => {\n const {brandTheme} = useTemplateContext();\n\n switch (media.mimeType) {\n case 'application/kontiki':\n case 'application/jwplayer':\n case 'video/mp4':\n if (!media.jwpOptions?.config) {\n return null;\n }\n\n return <JWPlayer style={styleSheet.container} config={media.jwpOptions.config} />;\n case 'application/vimeo':\n return media.videoId ? (\n <View style={styleSheet.container}>\n <Vimeo videoId={media.videoId} />\n </View>\n ) : null;\n case 'application/youtube':\n return (\n <Youtube\n apiKey={brandTheme.youtube?.apiKey || ''}\n style={styleSheet.container}\n videoId={media.videoId}\n />\n );\n default:\n return <Text>{`video mimeType ${media.mimeType} is not handled`}</Text>;\n }\n};\n\nconst Video = ({media}: Props) => {\n return media ? <VideoSwitch media={media} /> : null;\n};\n\nexport default Video;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAMA,MAAMA,UAAU,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EACnCC,SAAS,EAAE;IACTC,IAAI,EAAE,CADG;IAETC,KAAK,EAAE;EAFE;AADwB,CAAlB,CAAnB;;AAOA,MAAMC,WAAW,GAAG,CAAC;EAACC;AAAD,CAAD,KAAoB;EACtC,MAAM;IAACC;EAAD,IAAe,IAAAC,mCAAA,GAArB;;EAEA,QAAQF,KAAK,CAACG,QAAd;IACE,KAAK,qBAAL;IACA,KAAK,sBAAL;IACA,KAAK,WAAL;MACE,IAAI,CAACH,KAAK,CAACI,UAAN,EAAkBC,MAAvB,EAA+B;QAC7B,OAAO,IAAP;MACD;;MAED,oBAAO,6BAAC,iCAAD;QAAU,KAAK,EAAEZ,UAAU,CAACG,SAA5B;QAAuC,MAAM,EAAEI,KAAK,CAACI,UAAN,CAAiBC;MAAhE,EAAP;;IACF,KAAK,mBAAL;MACE,OAAOL,KAAK,CAACM,OAAN,gBACL,6BAAC,iBAAD;QAAM,KAAK,EAAEb,UAAU,CAACG;MAAxB,gBACE,6BAAC,6BAAD;QAAO,OAAO,EAAEI,KAAK,CAACM;MAAtB,EADF,CADK,GAIH,IAJJ;;IAKF,KAAK,qBAAL;MACE,oBACE,6BAAC,2BAAD;QACE,MAAM,EAAEL,UAAU,CAACM,OAAX,EAAoBC,MAApB,IAA8B,EADxC;QAEE,KAAK,EAAEf,UAAU,CAACG,SAFpB;QAGE,OAAO,EAAEI,KAAK,CAACM;MAHjB,EADF;;IAOF;MACE,oBAAO,6BAAC,iBAAD,QAAQ,kBAAiBN,KAAK,CAACG,QAAS,iBAAxC,CAAP;EAxBJ;AA0BD,CA7BD;;AA+BA,MAAMM,KAAK,GAAG,CAAC;EAACT;AAAD,CAAD,KAAoB;EAChC,OAAOA,KAAK,gBAAG,6BAAC,WAAD;IAAa,KAAK,EAAEA;EAApB,EAAH,GAAmC,IAA/C;AACD,CAFD;;eAIeS,K"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AAyBA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AA2MtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA8CrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AA0BA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AAoNtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA2DrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -60,15 +60,17 @@ const MediaView = ({
60
60
  }) => {
61
61
  switch (media.type) {
62
62
  case _propTypes.TYPE_VIDEO:
63
- return /*#__PURE__*/_react.default.createElement(_index5.default, {
63
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
64
+ style: styles.mediaContainer
65
+ }, /*#__PURE__*/_react.default.createElement(_index5.default, {
64
66
  media: media
65
- });
67
+ }));
66
68
 
67
69
  case _propTypes.TYPE_IMAGE:
68
70
  {
69
71
  const uri = `https://${media.url?.split('//')[1]}`;
70
72
  return /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
71
- style: styles.image,
73
+ style: [styles.mediaContainer, styles.image],
72
74
  source: {
73
75
  uri
74
76
  }
@@ -77,7 +79,7 @@ const MediaView = ({
77
79
 
78
80
  case _propTypes.TYPE_AUDIO:
79
81
  default:
80
- return /*#__PURE__*/_react.default.createElement(_index.default, null, `media type ${media.type} is not handled`);
82
+ return null;
81
83
  }
82
84
  };
83
85
 
@@ -181,11 +183,9 @@ const Question = props => {
181
183
  style: style.questionText
182
184
  }, questionText), /*#__PURE__*/_react.default.createElement(_index.default, {
183
185
  style: style.questionHelp
184
- }, (0, _get.default)('help', answerUI))), answerUI.media ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
185
- style: styles.mediaContainer
186
- }, /*#__PURE__*/_react.default.createElement(MediaView, {
186
+ }, (0, _get.default)('help', answerUI))), answerUI.media ? /*#__PURE__*/_react.default.createElement(MediaView, {
187
187
  media: answerUI.media
188
- })) : null, /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
188
+ }) : null, /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, {
189
189
  style: style.choicesScrollView,
190
190
  contentContainerStyle: style.choicesScrollContent,
191
191
  centerContent: true,
@@ -197,6 +197,14 @@ const Question = props => {
197
197
  const createSlideStyle = (num, screenWidth) => {
198
198
  const slideWidth = screenWidth - 40 - num * 8;
199
199
  return _reactNative.StyleSheet.create({
200
+ hiddenBackgroundToLockActions: {
201
+ position: 'absolute',
202
+ left: 0,
203
+ right: 0,
204
+ top: 0,
205
+ bottom: 0,
206
+ backgroundColor: '#00000000'
207
+ },
200
208
  slide: {
201
209
  position: 'absolute',
202
210
  left: 20 + num * 4,
@@ -230,6 +238,17 @@ const Slide = props => {
230
238
  num,
231
239
  slideIndex = '0'
232
240
  } = props;
241
+ const [isValidated, setValidated] = (0, _react.useState)(false);
242
+ const handleValidatePress = (0, _react.useCallback)(() => {
243
+ _reactNative.Keyboard.dismiss();
244
+
245
+ setValidated(true); // calling the onclick later, after react has rerendered, to display the locking BG as soon as possible
246
+
247
+ setTimeout(() => {
248
+ validateButton.onClick();
249
+ }, 20); // only to create on mount
250
+ // eslint-disable-next-line react-hooks/exhaustive-deps
251
+ }, []);
233
252
  const {
234
253
  width
235
254
  } = (0, _reactNative.useWindowDimensions)();
@@ -249,9 +268,6 @@ const Slide = props => {
249
268
  });
250
269
  }
251
270
 
252
- const {
253
- onClick: handleValidatePress
254
- } = validateButton;
255
271
  return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
256
272
  style: [slideStyle.slide, animatedStyle]
257
273
  }, /*#__PURE__*/_react.default.createElement(Question, {
@@ -260,11 +276,13 @@ const Slide = props => {
260
276
  answerUI: answerUI,
261
277
  key: "question-container"
262
278
  }), /*#__PURE__*/_react.default.createElement(_index4.default, {
263
- disabled: validateButton.disabled,
279
+ disabled: isValidated || validateButton.disabled,
264
280
  submitValue: validateButton.label,
265
281
  onPress: handleValidatePress,
266
282
  testID: `slide-validate-button-${slideIndex}`
267
- }), correctionPopinProps ? /*#__PURE__*/_react.default.createElement(CorrectionPopin, {
283
+ }), isValidated ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
284
+ style: slideStyle.hiddenBackgroundToLockActions
285
+ }) : null, correctionPopinProps ? /*#__PURE__*/_react.default.createElement(CorrectionPopin, {
268
286
  correctionPopinProps: correctionPopinProps,
269
287
  slideIndex: slideIndex,
270
288
  showCorrectionPopin: showCorrectionPopin,
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","TYPE_VIDEO","TYPE_IMAGE","uri","url","split","TYPE_AUDIO","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","slide","left","backgroundColor","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","useWindowDimensions","slideStyle","loading","parentContentTitle","handleValidatePress","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n marginTop: 20,\n width: '100%',\n minHeight: 150,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media}: {media: Media}) => {\n switch (media.type) {\n case TYPE_VIDEO:\n return <Video media={media} />;\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={styles.image} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return <Text>{`media type ${media.type} is not handled`}</Text>;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n {answerUI.media ? (\n <View style={styles.mediaContainer}>\n <MediaView media={answerUI.media} />\n </View>\n ) : null}\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n const {onClick: handleValidatePress} = validateButton;\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AAEA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CADQ;IAEdC,UAAU,EAAE,QAFE;IAGdC,cAAc,EAAE,QAHF;IAIdC,SAAS,EAAE,EAJG;IAKdC,KAAK,EAAE,MALO;IAMdC,SAAS,EAAE,GANG;IAOdC,YAAY,EAAE,EAPA;IAQdC,QAAQ,EAAE;EARI,CADe;EAW/BC,KAAK,EAAE;IACLR,IAAI,EAAE,CADD;IAELI,KAAK,EAAE;EAFF,CAXwB;E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A,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IArBN,CADF;AAyBD,CA9CD;;eAgDeoE,K"}
1
+ {"version":3,"file":"index.native.js","names":["styles","StyleSheet","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","TYPE_VIDEO","TYPE_IMAGE","uri","url","split","TYPE_AUDIO","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","useTranslateY","fromValue","toValue","duration","easing","Easing","bezier","useEffect","start","klf","getOr","undefined","information","label","message","next","get","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","marginVertical","choicesScrollContent","padding","Question","props","answerUI","useTemplateContext","setStyle","useState","questionStyle","createSlideStyle","num","screenWidth","slideWidth","hiddenBackgroundToLockActions","left","right","top","backgroundColor","slide","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","isValidated","setValidated","handleValidatePress","useCallback","Keyboard","dismiss","setTimeout","useWindowDimensions","slideStyle","loading","parentContentTitle","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useCallback, useEffect, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n Keyboard,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Text from '../../atom/text/index.native';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n marginTop: 20,\n width: '100%',\n minHeight: 150,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media}: {media: Media}) => {\n switch (media.type) {\n case TYPE_VIDEO:\n return (\n <View style={styles.mediaContainer}>\n <Video media={media} />\n </View>\n );\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={[styles.mediaContainer, styles.image]} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return null;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginVertical: 20,\n width: '100%'\n },\n choicesScrollContent: {\n padding: 10\n }\n });\n\ntype QuestionProps = {\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin} = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n return (\n <>\n <View style={style.questionHeading}>\n <Text style={style.questionOrigin}>{questionOrigin}</Text>\n <Text style={style.questionText}>{questionText}</Text>\n <Text style={style.questionHelp}>{get('help', answerUI)}</Text>\n </View>\n {answerUI.media ? <MediaView media={answerUI.media} /> : null}\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n <Answer {...answerUI} />\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n hiddenBackgroundToLockActions: ViewStyle;\n};\n\nconst createSlideStyle = (num: number, screenWidth: number): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n hiddenBackgroundToLockActions: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n backgroundColor: '#00000000'\n },\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: 34 + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n const [isValidated, setValidated] = useState<boolean>(false);\n\n const handleValidatePress = useCallback(() => {\n Keyboard.dismiss();\n setValidated(true);\n\n // calling the onclick later, after react has rerendered, to display the locking BG as soon as possible\n setTimeout(() => {\n validateButton.onClick();\n }, 20);\n\n // only to create on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const {width} = useWindowDimensions();\n const slideStyle = createSlideStyle(num, width);\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n key=\"question-container\"\n />\n <Button\n disabled={isValidated || validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n {isValidated ? <View style={slideStyle.hiddenBackgroundToLockActions} /> : null}\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":";;;;;AAAA;;AAEA;;AAYA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAIA,MAAMA,MAAM,GAAGC,uBAAA,CAAWC,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,IAAI,EAAE,CADQ;IAEdC,UAAU,EAAE,QAFE;IAGdC,cAAc,EAAE,QAHF;IAIdC,SAAS,EAAE,EAJG;IAKdC,KAAK,EAAE,MALO;IAMdC,SAAS,EAAE,GANG;IAOdC,YAAY,EAAE,EAPA;IAQdC,QAAQ,EAAE;EARI,CADe;EAW/BC,KAAK,EAAE;IACLR,IAAI,EAAE,CADD;IAELI,KAAK,EAAE;EAFF,CAXwB;EAe/BK,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBP,KAAK,EAAE;EAHe;AAfO,CAAlB,CAAf;;AAsBA,MAAMQ,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAA6B;EAC7C,QAAQA,KAAK,CAACC,IAAd;IACE,KAAKC,qBAAL;MACE,oBACE,6BAAC,iBAAD;QAAM,KAAK,EAAEnB,MAAM,CAACG;MAApB,gBACE,6BAAC,eAAD;QAAO,KAAK,EAAEc;MAAd,EADF,CADF;;IAKF,KAAKG,qBAAL;MAAiB;QACf,MAAMC,GAAG,GAAI,WAAUJ,KAAK,CAACK,GAAN,EAAWC,KAAX,CAAiB,IAAjB,EAAuB,CA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iBAAD;IAAM,KAAK,EAAEQ,UAAU,CAACtB;EAAxB,EAAH,GAA+D,IAb7E,EAcG9D,oBAAoB,gBACnB,6BAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IAtBN,CADF;AA0BD,CA3DD;;eA6DeuE,K"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/user-preferences/index.js"],"names":[],"mappings":";AAwCA,0DAeC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/user-preferences/index.js"],"names":[],"mappings":";AA4CA,0DAeC"}