@coorpacademy/components 11.11.3-alpha.6 → 11.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/tooltip/index.d.ts +1 -3
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +7 -17
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/atom/tooltip/style.css +2 -10
- package/es/globals.d.js.map +1 -1
- package/es/molecule/video-player-mobile/index.native.d.ts +2 -1
- package/es/molecule/video-player-mobile/index.native.d.ts.map +1 -1
- package/es/molecule/video-player-mobile/index.native.js +23 -11
- package/es/molecule/video-player-mobile/index.native.js.map +1 -1
- package/es/organism/review-slide/index.native.d.ts.map +1 -1
- package/es/organism/review-slide/index.native.js +29 -15
- package/es/organism/review-slide/index.native.js.map +1 -1
- package/es/organism/user-preferences/index.d.ts.map +1 -1
- package/es/organism/user-preferences/index.js +3 -6
- package/es/organism/user-preferences/index.js.map +1 -1
- package/lib/atom/tooltip/index.d.ts +1 -3
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +7 -18
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/atom/tooltip/style.css +2 -10
- package/lib/globals.d.js.map +1 -1
- package/lib/molecule/video-player-mobile/index.native.d.ts +2 -1
- package/lib/molecule/video-player-mobile/index.native.d.ts.map +1 -1
- package/lib/molecule/video-player-mobile/index.native.js +23 -11
- package/lib/molecule/video-player-mobile/index.native.js.map +1 -1
- package/lib/organism/review-slide/index.native.d.ts.map +1 -1
- package/lib/organism/review-slide/index.native.js +37 -23
- package/lib/organism/review-slide/index.native.js.map +1 -1
- package/lib/organism/user-preferences/index.d.ts.map +1 -1
- package/lib/organism/user-preferences/index.js +3 -10
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/locales/.mtslconfig.json +1 -0
- package/package.json +2 -3
- package/es/atom/battle-opponent/index.d.ts +0 -19
- package/es/atom/battle-opponent/index.d.ts.map +0 -1
- package/es/atom/battle-opponent/index.js +0 -52
- package/es/atom/battle-opponent/index.js.map +0 -1
- package/es/atom/battle-opponent/prop-types.d.ts +0 -19
- package/es/atom/battle-opponent/prop-types.d.ts.map +0 -1
- package/es/atom/battle-opponent/prop-types.js +0 -11
- package/es/atom/battle-opponent/prop-types.js.map +0 -1
- package/es/atom/battle-opponent/style.css +0 -124
- package/es/molecule/battle-opponent-list/index.d.ts +0 -18
- package/es/molecule/battle-opponent-list/index.d.ts.map +0 -1
- package/es/molecule/battle-opponent-list/index.js +0 -25
- package/es/molecule/battle-opponent-list/index.js.map +0 -1
- package/es/molecule/battle-opponent-list/prop-types.d.ts +0 -26
- package/es/molecule/battle-opponent-list/prop-types.d.ts.map +0 -1
- package/es/molecule/battle-opponent-list/prop-types.js +0 -14
- package/es/molecule/battle-opponent-list/prop-types.js.map +0 -1
- package/es/molecule/battle-opponent-list/style.css +0 -5
- package/lib/atom/battle-opponent/index.d.ts +0 -19
- package/lib/atom/battle-opponent/index.d.ts.map +0 -1
- package/lib/atom/battle-opponent/index.js +0 -70
- package/lib/atom/battle-opponent/index.js.map +0 -1
- package/lib/atom/battle-opponent/prop-types.d.ts +0 -19
- package/lib/atom/battle-opponent/prop-types.d.ts.map +0 -1
- package/lib/atom/battle-opponent/prop-types.js +0 -20
- package/lib/atom/battle-opponent/prop-types.js.map +0 -1
- package/lib/atom/battle-opponent/style.css +0 -124
- package/lib/molecule/battle-opponent-list/index.d.ts +0 -18
- package/lib/molecule/battle-opponent-list/index.d.ts.map +0 -1
- package/lib/molecule/battle-opponent-list/index.js +0 -43
- package/lib/molecule/battle-opponent-list/index.js.map +0 -1
- package/lib/molecule/battle-opponent-list/prop-types.d.ts +0 -26
- package/lib/molecule/battle-opponent-list/prop-types.d.ts.map +0 -1
- package/lib/molecule/battle-opponent-list/prop-types.js +0 -23
- package/lib/molecule/battle-opponent-list/prop-types.js.map +0 -1
- package/lib/molecule/battle-opponent-list/style.css +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
2
|
export default ToolTip;
|
|
3
|
-
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize }: {
|
|
4
4
|
anchorId: any;
|
|
5
5
|
TooltipContent: any;
|
|
6
6
|
"aria-label": any;
|
|
@@ -10,7 +10,6 @@ declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "d
|
|
|
10
10
|
iconContainerClassName: any;
|
|
11
11
|
delayHide?: number | undefined;
|
|
12
12
|
fontSize?: number | undefined;
|
|
13
|
-
iconSize?: string | undefined;
|
|
14
13
|
}): JSX.Element;
|
|
15
14
|
declare namespace ToolTip {
|
|
16
15
|
const propTypes: {
|
|
@@ -21,7 +20,6 @@ declare namespace ToolTip {
|
|
|
21
20
|
iconContainerClassName: PropTypes.Requireable<string>;
|
|
22
21
|
delayHide: PropTypes.Requireable<number>;
|
|
23
22
|
fontSize: PropTypes.Requireable<number>;
|
|
24
|
-
iconSize: PropTypes.Requireable<string>;
|
|
25
23
|
anchorId: PropTypes.Requireable<string>;
|
|
26
24
|
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
27
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AAwDO,iGASN;;AAED;;;;;;;;;;gBAwFC"}
|
package/es/atom/tooltip/index.js
CHANGED
|
@@ -3,25 +3,19 @@ import classnames from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import ReactTooltip from 'react-tooltip';
|
|
5
5
|
import isString from 'lodash/fp/isString';
|
|
6
|
-
import keys from 'lodash/fp/keys';
|
|
7
6
|
import { NovaCompositionCoorpacademyInformationIcon as InformationIcon } from '@coorpacademy/nova-icons';
|
|
8
7
|
import style from './style.css';
|
|
9
8
|
const FontSizes = {
|
|
10
9
|
12: style.tooltipContentFontSize12,
|
|
11
10
|
14: style.tooltipContentFontSize14
|
|
12
11
|
};
|
|
13
|
-
const IconSizes = {
|
|
14
|
-
small: 12,
|
|
15
|
-
big: 20
|
|
16
|
-
};
|
|
17
12
|
|
|
18
13
|
const ToolTipWrapper = ({
|
|
19
14
|
toolTipIsVisible,
|
|
20
15
|
anchorId,
|
|
21
16
|
closeToolTipInformationTextAriaLabel,
|
|
22
17
|
content,
|
|
23
|
-
handleContentMouseOver
|
|
24
|
-
iconSize
|
|
18
|
+
handleContentMouseOver
|
|
25
19
|
}) => {
|
|
26
20
|
if (!toolTipIsVisible) return null;
|
|
27
21
|
|
|
@@ -36,7 +30,7 @@ const ToolTipWrapper = ({
|
|
|
36
30
|
}, content);
|
|
37
31
|
} else {
|
|
38
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
-
className:
|
|
33
|
+
className: style.toolTip,
|
|
40
34
|
"data-testid": "tooltip",
|
|
41
35
|
"aria-label": closeToolTipInformationTextAriaLabel,
|
|
42
36
|
onMouseOver: handleContentMouseOver
|
|
@@ -49,8 +43,7 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
49
43
|
anchorId: PropTypes.string,
|
|
50
44
|
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
51
45
|
content: PropTypes.node,
|
|
52
|
-
handleContentMouseOver: PropTypes.func
|
|
53
|
-
iconSize: PropTypes.oneOf(keys(IconSizes))
|
|
46
|
+
handleContentMouseOver: PropTypes.func
|
|
54
47
|
} : {};
|
|
55
48
|
export const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
56
49
|
if (event.key === 'Enter') {
|
|
@@ -72,8 +65,7 @@ const ToolTip = ({
|
|
|
72
65
|
toolTipIsVisible: _toolTipIsVisible,
|
|
73
66
|
iconContainerClassName,
|
|
74
67
|
delayHide = 250,
|
|
75
|
-
fontSize = 14
|
|
76
|
-
iconSize = 'small'
|
|
68
|
+
fontSize = 14
|
|
77
69
|
}) => {
|
|
78
70
|
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
79
71
|
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
@@ -118,8 +110,8 @@ const ToolTip = ({
|
|
|
118
110
|
tabIndex: 0
|
|
119
111
|
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
120
112
|
className: style.informationIcon,
|
|
121
|
-
width:
|
|
122
|
-
height:
|
|
113
|
+
width: 12,
|
|
114
|
+
height: 12,
|
|
123
115
|
"aria-label": ariaLabel
|
|
124
116
|
})), /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
125
117
|
toolTipIsVisible: toolTipIsVisible,
|
|
@@ -127,8 +119,7 @@ const ToolTip = ({
|
|
|
127
119
|
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
128
120
|
content: content,
|
|
129
121
|
handleContentMouseOver: handleContentMouseOver,
|
|
130
|
-
fontSize: fontSize
|
|
131
|
-
iconSize: iconSize
|
|
122
|
+
fontSize: fontSize
|
|
132
123
|
}));
|
|
133
124
|
};
|
|
134
125
|
|
|
@@ -141,7 +132,6 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
141
132
|
iconContainerClassName: PropTypes.string,
|
|
142
133
|
delayHide: PropTypes.number,
|
|
143
134
|
fontSize: PropTypes.oneOf([12, 14]),
|
|
144
|
-
iconSize: PropTypes.oneOf(keys(IconSizes)),
|
|
145
135
|
// ---------- React Tooltip exclusive --------------
|
|
146
136
|
// externalHandling: if passed down, React Tooltip is used instead, due to limitations on
|
|
147
137
|
// parents overflow hidden controls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","toolTipReact","toolTip","bigIconToolTip","smallIconToolTip","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","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,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,SAAS,GAAG;EAChB,IAAID,KAAK,CAACE,wBADM;EAEhB,IAAIF,KAAK,CAACG;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,oBAAC,YAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAET,KAAK,CAACc,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,EAAElB,UAAU,CACnBO,KAAK,CAACe,OADa,EAEnBF,QAAQ,KAAK,KAAb,GAAqBb,KAAK,CAACgB,cAA3B,GAA4ChB,KAAK,CAACiB,gBAF/B,CADvB;MAKE,eAAY,SALd;MAME,cAAYP,oCANd;MAOE,WAAW,EAAEE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,SAAS,CAAC0B,MANhB;EAOlBqB,SAAS,EAAE/C,SAAS,CAACgE,MAPH;EAQlBhB,QAAQ,EAAEhD,SAAS,CAAC8B,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlBX,QAAQ,EAAEnB,SAAS,CAAC8B,KAAV,CAAgB3B,IAAI,CAACO,SAAD,CAApB,CATQ;EAUlB;EACA;EACA;EACAK,QAAQ,EAAEf,SAAS,CAAC0B,MAbF;EAclBZ,gBAAgB,EAAEd,SAAS,CAACyB;AAdV,CAApB;AAiBA,eAAegB,OAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","toolTipReact","toolTip","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","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","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.b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AS,EAAEU,cAJb;IAKE,QAAQ,EAAE;EALZ,gBAOE,oBAAC,eAAD;IACE,SAAS,EAAEzC,KAAK,CAACiD,eADnB;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYnB;EAJd,EAPF,CALF,eAmBE,oBAAC,cAAD;IACE,gBAAgB,EAAEzB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC,OAJX;IAKE,sBAAsB,EAAEC,sBAL1B;IAME,QAAQ,EAAE0B;EANZ,EAnBF,CAXF;AAwCD,CAxFD;;AA0FAP,OAAO,CAAChB,SAAR,2CAAoB;EAClBiB,cAAc,EAAElC,SAAS,CAACuD,SAAV,CAAoB,CAACvD,SAAS,CAACsB,IAAX,EAAiBtB,SAAS,CAACqB,IAA3B,EAAiCrB,SAAS,CAACmB,MAA3C,CAApB,CADE;EAElB,eAAenB,SAAS,CAACmB,MAFP;EAGlB,cAAcnB,SAAS,CAACmB,MAHN;EAIlBP,oCAAoC,EAAEZ,SAAS,CAACmB,MAAV,CAAiBC,UAJrC;EAKlB;EACAkB,sBAAsB,EAAEtC,SAAS,CAACmB,MANhB;EAOlBoB,SAAS,EAAEvC,SAAS,CAACwD,MAPH;EAQlBhB,QAAQ,EAAExC,SAAS,CAACyD,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlB;EACA;EACA;EACA9C,QAAQ,EAAEX,SAAS,CAACmB,MAZF;EAalBT,gBAAgB,EAAEV,SAAS,CAACkB;AAbV,CAApB;AAgBA,eAAee,OAAf"}
|
|
@@ -34,18 +34,10 @@
|
|
|
34
34
|
position: absolute;
|
|
35
35
|
border-radius: 7px;
|
|
36
36
|
background-color: cm_grey_700;
|
|
37
|
-
height: auto;
|
|
38
|
-
width: 200px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.bigIconToolTip {
|
|
42
|
-
right: -71px;
|
|
43
|
-
bottom: 31px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.smallIconToolTip {
|
|
47
37
|
right: -75px;
|
|
48
38
|
bottom: 32px;
|
|
39
|
+
height: auto;
|
|
40
|
+
width: 200px;
|
|
49
41
|
}
|
|
50
42
|
|
|
51
43
|
.toolTip::before {
|
package/es/globals.d.js.map
CHANGED
|
@@ -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 '
|
|
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":""}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { Media } from '../questions/types';
|
|
3
3
|
export declare type Props = {
|
|
4
4
|
media: Media;
|
|
5
|
+
autoplay: boolean;
|
|
5
6
|
};
|
|
6
|
-
declare const Video: ({ media }: Props) => JSX.Element | null;
|
|
7
|
+
declare const Video: ({ media, autoplay }: Props) => JSX.Element | null;
|
|
7
8
|
export default Video;
|
|
8
9
|
//# 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":";AAOA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAEzC,oBAAY,KAAK,GAAG;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,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,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,CAAC;AA+CtD,QAAA,MAAM,KAAK,wBAAuB,KAAK,uBAEtC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
5
|
import JWPlayer from 'react-native-jw-media-player';
|
|
@@ -12,7 +14,8 @@ const styleSheet = StyleSheet.create({
|
|
|
12
14
|
});
|
|
13
15
|
|
|
14
16
|
const VideoSwitch = ({
|
|
15
|
-
media
|
|
17
|
+
media,
|
|
18
|
+
autoplay
|
|
16
19
|
}) => {
|
|
17
20
|
const {
|
|
18
21
|
brandTheme
|
|
@@ -22,14 +25,20 @@ const VideoSwitch = ({
|
|
|
22
25
|
case 'application/kontiki':
|
|
23
26
|
case 'application/jwplayer':
|
|
24
27
|
case 'video/mp4':
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
{
|
|
29
|
+
if (!media.jwpOptions?.config) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const config = _extends({}, media.jwpOptions.config, {
|
|
34
|
+
autostart: autoplay
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(JWPlayer, {
|
|
38
|
+
style: styleSheet.container,
|
|
39
|
+
config: config
|
|
40
|
+
});
|
|
41
|
+
}
|
|
33
42
|
|
|
34
43
|
case 'application/vimeo':
|
|
35
44
|
return media.videoId ? /*#__PURE__*/React.createElement(View, {
|
|
@@ -42,7 +51,8 @@ const VideoSwitch = ({
|
|
|
42
51
|
return /*#__PURE__*/React.createElement(Youtube, {
|
|
43
52
|
apiKey: brandTheme.youtube?.apiKey || '',
|
|
44
53
|
style: styleSheet.container,
|
|
45
|
-
videoId: media.videoId
|
|
54
|
+
videoId: media.videoId,
|
|
55
|
+
play: autoplay
|
|
46
56
|
});
|
|
47
57
|
|
|
48
58
|
default:
|
|
@@ -51,10 +61,12 @@ const VideoSwitch = ({
|
|
|
51
61
|
};
|
|
52
62
|
|
|
53
63
|
const Video = ({
|
|
54
|
-
media
|
|
64
|
+
media,
|
|
65
|
+
autoplay
|
|
55
66
|
}) => {
|
|
56
67
|
return media ? /*#__PURE__*/React.createElement(VideoSwitch, {
|
|
57
|
-
media: media
|
|
68
|
+
media: media,
|
|
69
|
+
autoplay: autoplay
|
|
58
70
|
}) : null;
|
|
59
71
|
};
|
|
60
72
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","StyleSheet","Text","View","JWPlayer","Youtube","Vimeo","useTemplateContext","styleSheet","create","container","flex","width","VideoSwitch","media","brandTheme","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'
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["React","StyleSheet","Text","View","JWPlayer","Youtube","Vimeo","useTemplateContext","styleSheet","create","container","flex","width","VideoSwitch","media","autoplay","brandTheme","mimeType","jwpOptions","config","autostart","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; autoplay: boolean};\n\nconst styleSheet = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%'\n }\n});\n\nconst VideoSwitch = ({media, autoplay}: 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 const config = {\n ...media.jwpOptions.config,\n autostart: autoplay\n };\n\n return <JWPlayer style={styleSheet.container} config={config} />;\n }\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 play={autoplay}\n />\n );\n default:\n return <Text>{`video mimeType ${media.mimeType} is not handled`}</Text>;\n }\n};\n\nconst Video = ({media, autoplay}: Props) => {\n return media ? <VideoSwitch media={media} autoplay={autoplay} /> : null;\n};\n\nexport default Video;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,UAAR,EAAoBC,IAApB,EAA0BC,IAA1B,QAAqC,cAArC;AACA,OAAOC,QAAP,MAAqB,8BAArB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CD;;AAsCA,MAAMO,KAAK,GAAG,CAAC;EAACV,KAAD;EAAQC;AAAR,CAAD,KAA8B;EAC1C,OAAOD,KAAK,gBAAG,oBAAC,WAAD;IAAa,KAAK,EAAEA,KAApB;IAA2B,QAAQ,EAAEC;EAArC,EAAH,GAAuD,IAAnE;AACD,CAFD;;AAIA,eAAeS,KAAf"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AA6NtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBA6DrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -3,21 +3,19 @@ import { Animated, Easing, Image, Keyboard, ScrollView, StyleSheet, useWindowDim
|
|
|
3
3
|
import get from 'lodash/fp/get';
|
|
4
4
|
import getOr from 'lodash/fp/getOr';
|
|
5
5
|
import { useTranslateY } from '@coorpacademy/react-native-animation';
|
|
6
|
-
import Text from '../../atom/text/index.native';
|
|
7
6
|
import Answer from '../../molecule/answer/index.native';
|
|
8
7
|
import ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';
|
|
9
8
|
import { useTemplateContext } from '../../template/app-review/template-context';
|
|
10
9
|
import Button from '../../atom/button/index.native';
|
|
11
10
|
import { TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO } from '../../molecule/answer/prop-types';
|
|
12
11
|
import Video from '../../molecule/video-player-mobile/index.native';
|
|
12
|
+
import Html from '../../atom/html/index.native';
|
|
13
13
|
const styles = StyleSheet.create({
|
|
14
14
|
mediaContainer: {
|
|
15
|
-
flex: 1,
|
|
16
15
|
alignItems: 'center',
|
|
17
16
|
justifyContent: 'center',
|
|
18
|
-
marginTop: 20,
|
|
19
17
|
width: '100%',
|
|
20
|
-
|
|
18
|
+
height: 200,
|
|
21
19
|
borderRadius: 10,
|
|
22
20
|
overflow: 'hidden'
|
|
23
21
|
},
|
|
@@ -33,14 +31,20 @@ const styles = StyleSheet.create({
|
|
|
33
31
|
});
|
|
34
32
|
|
|
35
33
|
const MediaView = ({
|
|
36
|
-
media
|
|
34
|
+
media,
|
|
35
|
+
autoplay
|
|
37
36
|
}) => {
|
|
37
|
+
if (!media) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
38
41
|
switch (media.type) {
|
|
39
42
|
case TYPE_VIDEO:
|
|
40
43
|
return /*#__PURE__*/React.createElement(View, {
|
|
41
44
|
style: styles.mediaContainer
|
|
42
45
|
}, /*#__PURE__*/React.createElement(Video, {
|
|
43
|
-
media: media
|
|
46
|
+
media: media,
|
|
47
|
+
autoplay: autoplay
|
|
44
48
|
}));
|
|
45
49
|
|
|
46
50
|
case TYPE_IMAGE:
|
|
@@ -129,10 +133,11 @@ const createQuestionStyle = theme => StyleSheet.create({
|
|
|
129
133
|
textAlign: 'center'
|
|
130
134
|
},
|
|
131
135
|
choicesScrollView: {
|
|
132
|
-
|
|
136
|
+
marginTop: 20,
|
|
133
137
|
width: '100%'
|
|
134
138
|
},
|
|
135
139
|
choicesScrollContent: {
|
|
140
|
+
justifyContent: 'space-between',
|
|
136
141
|
padding: 10
|
|
137
142
|
}
|
|
138
143
|
});
|
|
@@ -141,7 +146,8 @@ const Question = props => {
|
|
|
141
146
|
const {
|
|
142
147
|
answerUI,
|
|
143
148
|
questionText,
|
|
144
|
-
questionOrigin
|
|
149
|
+
questionOrigin = '',
|
|
150
|
+
autoplayMedia = false
|
|
145
151
|
} = props;
|
|
146
152
|
const {
|
|
147
153
|
theme
|
|
@@ -152,23 +158,29 @@ const Question = props => {
|
|
|
152
158
|
setStyle(questionStyle);
|
|
153
159
|
}, [theme]);
|
|
154
160
|
if (!answerUI || !questionText || !style) return null;
|
|
161
|
+
const hasVideoOrImage = answerUI.media?.type && [TYPE_VIDEO, TYPE_IMAGE].includes(answerUI.media.type);
|
|
155
162
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
156
163
|
style: style.questionHeading
|
|
157
|
-
}, /*#__PURE__*/React.createElement(
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Html, {
|
|
158
165
|
style: style.questionOrigin
|
|
159
|
-
}, questionOrigin), /*#__PURE__*/React.createElement(
|
|
166
|
+
}, questionOrigin), /*#__PURE__*/React.createElement(Html, {
|
|
160
167
|
style: style.questionText
|
|
161
|
-
}, questionText), /*#__PURE__*/React.createElement(
|
|
168
|
+
}, questionText), /*#__PURE__*/React.createElement(Html, {
|
|
162
169
|
style: style.questionHelp
|
|
163
|
-
}, get('help', answerUI))),
|
|
164
|
-
media: answerUI.media
|
|
165
|
-
}) : null, /*#__PURE__*/React.createElement(ScrollView, {
|
|
170
|
+
}, get('help', answerUI))), /*#__PURE__*/React.createElement(ScrollView, {
|
|
166
171
|
style: style.choicesScrollView,
|
|
167
172
|
contentContainerStyle: style.choicesScrollContent,
|
|
168
173
|
centerContent: true,
|
|
169
174
|
showsHorizontalScrollIndicator: false,
|
|
170
175
|
showsVerticalScrollIndicator: false
|
|
171
|
-
}, /*#__PURE__*/React.createElement(
|
|
176
|
+
}, hasVideoOrImage ? /*#__PURE__*/React.createElement(MediaView, {
|
|
177
|
+
media: answerUI.media,
|
|
178
|
+
autoplay: autoplayMedia
|
|
179
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
180
|
+
style: {
|
|
181
|
+
marginTop: hasVideoOrImage ? 30 : 0
|
|
182
|
+
}
|
|
183
|
+
}, /*#__PURE__*/React.createElement(Answer, answerUI))));
|
|
172
184
|
};
|
|
173
185
|
|
|
174
186
|
const createSlideStyle = (num, screenWidth) => {
|
|
@@ -229,6 +241,7 @@ const Slide = props => {
|
|
|
229
241
|
width
|
|
230
242
|
} = useWindowDimensions();
|
|
231
243
|
const slideStyle = createSlideStyle(num, width);
|
|
244
|
+
const isFirstSlide = num === 1;
|
|
232
245
|
const {
|
|
233
246
|
loading,
|
|
234
247
|
parentContentTitle,
|
|
@@ -250,6 +263,7 @@ const Slide = props => {
|
|
|
250
263
|
questionOrigin: parentContentTitle,
|
|
251
264
|
questionText: questionText,
|
|
252
265
|
answerUI: answerUI,
|
|
266
|
+
autoplayMedia: isFirstSlide,
|
|
253
267
|
key: "question-container"
|
|
254
268
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
255
269
|
disabled: isValidated || validateButton.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","useCallback","useEffect","useState","Animated","Easing","Image","Keyboard","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Text","Answer","ReviewCorrectionPopin","useTemplateContext","Button","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","Video","styles","create","mediaContainer","flex","alignItems","justifyContent","marginTop","width","minHeight","borderRadius","overflow","image","correctionPopinWrapper","position","bottom","MediaView","media","type","uri","url","split","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","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","setStyle","questionStyle","createSlideStyle","num","screenWidth","slideWidth","hiddenBackgroundToLockActions","left","right","top","backgroundColor","slide","height","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","isValidated","setValidated","handleValidatePress","dismiss","setTimeout","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,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,QAAvC,QAAsD,OAAtD;AAEA,SACEC,QADF,EAEEC,MAFF,EAGEC,KAHF,EAIEC,QAJF,EAKEC,UALF,EAMEC,UANF,EAQEC,mBARF,EASEC,IATF,QAWO,cAXP;AAYA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,IAAP,MAAiB,8BAAjB;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,UAAR,EAAoBC,UAApB,EAAgCC,UAAhC,QAAiD,kCAAjD;AACA,OAAOC,KAAP,MAAkB,iDAAlB;AAIA,MAAMC,MAA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UAAU,GAAGvB,gBAAgB,CAACC,GAAD,EAAMnE,KAAN,CAAnC;EAEA,MAAM;IACJ0F,OADI;IAEJC,kBAFI;IAGJvC,YAHI;IAIJW,QAJI;IAKJ9C,mBALI;IAMJC;EANI,IAOFyD,KAPJ;;EASA,IAAIe,OAAJ,EAAa;IACX,oBAAO,oBAAC,IAAD;MAAM,KAAK,EAAED,UAAU,CAACd;IAAxB,EAAP;EACD;;EAED,oBACE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACc,UAAU,CAACd,KAAZ,EAAmBvC,aAAnB;EAAtB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAEuD,kBADlB;IAEE,YAAY,EAAEvC,YAFhB;IAGE,QAAQ,EAAEW,QAHZ;IAIE,GAAG,EAAC;EAJN,EADF,eAOE,oBAAC,MAAD;IACE,QAAQ,EAAEqB,WAAW,IAAID,cAAc,CAACS,QAD1C;IAEE,WAAW,EAAET,cAAc,CAACtD,KAF9B;IAGE,OAAO,EAAEyD,mBAHX;IAIE,MAAM,EAAG,yBAAwBtE,UAAW;EAJ9C,EAPF,EAaGoE,WAAW,gBAAG,oBAAC,IAAD;IAAM,KAAK,EAAEK,UAAU,CAACnB;EAAxB,EAAH,GAA+D,IAb7E,EAcGvD,oBAAoB,gBACnB,oBAAC,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;;AA6DA,eAAegE,KAAf"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["React","useCallback","useEffect","useState","Animated","Easing","Image","Keyboard","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Answer","ReviewCorrectionPopin","useTemplateContext","Button","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","Video","Html","styles","create","mediaContainer","alignItems","justifyContent","width","height","borderRadius","overflow","image","flex","correctionPopinWrapper","position","bottom","MediaView","media","autoplay","type","uri","url","split","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","choicesScrollContent","padding","Question","props","answerUI","autoplayMedia","setStyle","questionStyle","hasVideoOrImage","includes","createSlideStyle","num","screenWidth","slideWidth","hiddenBackgroundToLockActions","left","right","top","backgroundColor","slide","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","isValidated","setValidated","handleValidatePress","dismiss","setTimeout","slideStyle","isFirstSlide","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 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 Html from '../../atom/html/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: 200,\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, autoplay}: {media?: Media; autoplay: boolean}) => {\n if (!media) {\n return null;\n }\n\n switch (media.type) {\n case TYPE_VIDEO:\n return (\n <View style={styles.mediaContainer}>\n <Video media={media} autoplay={autoplay} />\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 marginTop: 20,\n width: '100%'\n },\n choicesScrollContent: {\n justifyContent: 'space-between',\n padding: 10\n }\n });\n\ntype QuestionProps = {\n autoplayMedia: boolean;\n answerUI: SlideProps['answerUI'];\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {answerUI, questionText, questionOrigin = '', autoplayMedia = false} = 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 const hasVideoOrImage =\n answerUI.media?.type && [TYPE_VIDEO, TYPE_IMAGE].includes(answerUI.media.type);\n\n return (\n <>\n <View style={style.questionHeading}>\n <Html style={style.questionOrigin}>{questionOrigin}</Html>\n <Html style={style.questionText}>{questionText}</Html>\n <Html style={style.questionHelp}>{get('help', answerUI)}</Html>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n {hasVideoOrImage ? <MediaView media={answerUI.media} autoplay={autoplayMedia} /> : null}\n <View style={{marginTop: hasVideoOrImage ? 30 : 0}}>\n <Answer {...answerUI} />\n </View>\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 const isFirstSlide = num === 1;\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 autoplayMedia={isFirstSlide}\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,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,QAAvC,QAAsD,OAAtD;AAEA,SACEC,QADF,EAEEC,MAFF,EAGEC,KAHF,EAIEC,QAJF,EAKEC,UALF,EAMEC,UANF,EAQEC,mBARF,EASEC,IATF,QAWO,cAXP;AAYA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,UAAR,EAAoBC,UAApB,EAAgCC,UAAhC,QAAiD,kCAAjD;AACA,OAAOC,KAAP,MAAkB,iDAAlB;AAEA,OAAOC,IAAP,MAAiB,8BAAjB;AAGA,MAAMC,MAAM,GAAGf,UAAU,CAACgB,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,UAAU,EAAE,QADE;IAEdC,cAAc,EAAE,QAFF;IAGdC,KAAK,EAAE,MAHO;IAIdC,MAAM,EAAE,GAJM;IAKdC,YAAY,EAAE,EALA;IAMdC,QAAQ,EAAE;EANI,CADe;EAS/BC,KAAK,EAAE;IACLC,IAAI,EAAE,CADD;IAELL,KAAK,EAAE;EAFF,CATwB;EAa/BM,sBAAsB,EAAE;IACtBC,QAAQ,EAAE,UADY;IAEtBC,MAAM,EAAE,EAFc;IAGtBR,KAA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,MAAMgH,UAAU,GAAGtB,gBAAgB,CAACC,GAAD,EAAMxE,KAAN,CAAnC;EACA,MAAM8F,YAAY,GAAGtB,GAAG,KAAK,CAA7B;EAEA,MAAM;IACJuB,OADI;IAEJC,kBAFI;IAGJzC,YAHI;IAIJU,QAJI;IAKJ9C,mBALI;IAMJC;EANI,IAOF4D,KAPJ;;EASA,IAAIe,OAAJ,EAAa;IACX,oBAAO,oBAAC,IAAD;MAAM,KAAK,EAAEF,UAAU,CAACb;IAAxB,EAAP;EACD;;EAED,oBACE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACa,UAAU,CAACb,KAAZ,EAAmB1C,aAAnB;EAAtB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAE0D,kBADlB;IAEE,YAAY,EAAEzC,YAFhB;IAGE,QAAQ,EAAEU,QAHZ;IAIE,aAAa,EAAE6B,YAJjB;IAKE,GAAG,EAAC;EALN,EADF,eAQE,oBAAC,MAAD;IACE,QAAQ,EAAEN,WAAW,IAAID,cAAc,CAACU,QAD1C;IAEE,WAAW,EAAEV,cAAc,CAACxD,KAF9B;IAGE,OAAO,EAAE2D,mBAHX;IAIE,MAAM,EAAG,yBAAwBxE,UAAW;EAJ9C,EARF,EAcGsE,WAAW,gBAAG,oBAAC,IAAD;IAAM,KAAK,EAAEK,UAAU,CAAClB;EAAxB,EAAH,GAA+D,IAd7E,EAeG1D,oBAAoB,gBACnB,oBAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IAvBN,CADF;AA2BD,CA7DD;;AA+DA,eAAekE,KAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/user-preferences/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/user-preferences/index.js"],"names":[],"mappings":";AAwCA,0DAeC"}
|
|
@@ -8,13 +8,13 @@ import React from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import isEmpty from 'lodash/fp/isEmpty';
|
|
10
10
|
import map from 'lodash/fp/map';
|
|
11
|
-
import
|
|
11
|
+
import { GetTranslateFromContext } from '../../atom/provider';
|
|
12
12
|
import ToolTip from '../../atom/tooltip';
|
|
13
13
|
import InputSwitch from '../../atom/input-switch';
|
|
14
14
|
import style from './style.css';
|
|
15
15
|
|
|
16
|
-
const Settings =
|
|
17
|
-
const translate = GetTranslateFromContext(
|
|
16
|
+
const Settings = props => {
|
|
17
|
+
const translate = GetTranslateFromContext();
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
label,
|
|
@@ -42,9 +42,6 @@ Settings.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, InputS
|
|
|
42
42
|
label: PropTypes.string.isRequired,
|
|
43
43
|
description: PropTypes.string
|
|
44
44
|
}) : {};
|
|
45
|
-
Settings.contextTypes = {
|
|
46
|
-
translate: Provider.childContextTypes.translate
|
|
47
|
-
};
|
|
48
45
|
|
|
49
46
|
const UserPreferences = props => {
|
|
50
47
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","isEmpty","map","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","isEmpty","map","GetTranslateFromContext","ToolTip","InputSwitch","style","Settings","props","translate","label","description","moreInfoAriaLabel","settings","infoIconTooltip","propTypes","string","isRequired","UserPreferences","preferences","groupAriaLabel","arrayOf","shape"],"sources":["../../../src/organism/user-preferences/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport {GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip from '../../atom/tooltip';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst Settings = props => {\n const translate = GetTranslateFromContext();\n const {label, description, moreInfoAriaLabel, ...settings} = props;\n return (\n <div className={style.settings}>\n <InputSwitch {...settings} />\n <span className={style.label} tabIndex={0}>\n {label}\n </span>\n {isEmpty(description) ? null : (\n <ToolTip\n TooltipContent={description}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n data-testid=\"user-preferences-tooltip\"\n aria-label={moreInfoAriaLabel}\n iconContainerClassName={style.infoIconTooltip}\n fontSize={12}\n />\n )}\n </div>\n );\n};\n\nSettings.propTypes = {\n ...InputSwitch.propTypes,\n label: PropTypes.string.isRequired,\n description: PropTypes.string\n};\n\nconst UserPreferences = props => {\n const {preferences, moreInfoAriaLabel, groupAriaLabel} = props;\n\n return (\n <form>\n <div className={style.preferences} role=\"group\" aria-label={groupAriaLabel} tabIndex={0}>\n {map(\n settings => (\n <Settings {...settings} key={settings.label} moreInfoAriaLabel={moreInfoAriaLabel} />\n ),\n preferences\n )}\n </div>\n </form>\n );\n};\n\nUserPreferences.propTypes = {\n preferences: PropTypes.arrayOf(PropTypes.shape(Settings.propTypes)),\n moreInfoAriaLabel: PropTypes.string,\n groupAriaLabel: PropTypes.string\n};\n\nexport default UserPreferences;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SAAQC,uBAAR,QAAsC,qBAAtC;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAGC,KAAK,IAAI;EACxB,MAAMC,SAAS,GAAGN,uBAAuB,EAAzC;;EACA,MAAM;IAACO,KAAD;IAAQC,WAAR;IAAqBC;EAArB,IAAuDJ,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EAAEZ,SAAS,CAACgB,MAFH;EAG1BI,cAAc,EAAEpB,SAAS,CAACgB;AAHA,CAA5B;AAMA,eAAeE,eAAf"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
2
|
export default ToolTip;
|
|
3
|
-
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize }: {
|
|
4
4
|
anchorId: any;
|
|
5
5
|
TooltipContent: any;
|
|
6
6
|
"aria-label": any;
|
|
@@ -10,7 +10,6 @@ declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "d
|
|
|
10
10
|
iconContainerClassName: any;
|
|
11
11
|
delayHide?: number | undefined;
|
|
12
12
|
fontSize?: number | undefined;
|
|
13
|
-
iconSize?: string | undefined;
|
|
14
13
|
}): JSX.Element;
|
|
15
14
|
declare namespace ToolTip {
|
|
16
15
|
const propTypes: {
|
|
@@ -21,7 +20,6 @@ declare namespace ToolTip {
|
|
|
21
20
|
iconContainerClassName: PropTypes.Requireable<string>;
|
|
22
21
|
delayHide: PropTypes.Requireable<number>;
|
|
23
22
|
fontSize: PropTypes.Requireable<number>;
|
|
24
|
-
iconSize: PropTypes.Requireable<string>;
|
|
25
23
|
anchorId: PropTypes.Requireable<string>;
|
|
26
24
|
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
27
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AAwDO,iGASN;;AAED;;;;;;;;;;gBAwFC"}
|