@coorpacademy/components 11.9.2 → 11.9.3-alpha.24
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/provider/index.d.ts.map +1 -1
- package/es/atom/provider/index.js +2 -0
- package/es/atom/provider/index.js.map +1 -1
- package/es/atom/review-presentation/index.d.ts.map +1 -1
- package/es/atom/review-presentation/index.js +12 -62
- package/es/atom/review-presentation/index.js.map +1 -1
- package/es/atom/review-presentation/style.css +7 -67
- package/es/atom/tooltip/index.d.ts +22 -0
- package/es/atom/tooltip/index.d.ts.map +1 -0
- package/es/atom/tooltip/index.js +117 -0
- package/es/atom/tooltip/index.js.map +1 -0
- package/es/atom/tooltip/style.css +96 -0
- package/es/molecule/answer/index.d.ts +3 -0
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +11 -4
- package/es/molecule/answer/index.js.map +1 -1
- package/es/template/activity/engine-stars.css +16 -33
- package/es/template/activity/engine-stars.d.ts +15 -17
- package/es/template/activity/engine-stars.d.ts.map +1 -1
- package/es/template/activity/engine-stars.js +128 -115
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/activity/index.d.ts +1 -0
- package/es/template/activity/index.d.ts.map +1 -1
- package/es/template/activity/index.js +18 -9
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/progression-item.js +1 -1
- package/es/template/activity/progression-item.js.map +1 -1
- package/es/template/activity/stars-summary.d.ts +1 -0
- package/es/template/activity/stars-summary.d.ts.map +1 -1
- package/es/template/activity/stars-summary.js +10 -5
- package/es/template/activity/stars-summary.js.map +1 -1
- package/lib/atom/provider/index.d.ts.map +1 -1
- package/lib/atom/provider/index.js +2 -0
- package/lib/atom/provider/index.js.map +1 -1
- package/lib/atom/review-presentation/index.d.ts.map +1 -1
- package/lib/atom/review-presentation/index.js +13 -66
- package/lib/atom/review-presentation/index.js.map +1 -1
- package/lib/atom/review-presentation/style.css +7 -67
- package/lib/atom/tooltip/index.d.ts +22 -0
- package/lib/atom/tooltip/index.d.ts.map +1 -0
- package/lib/atom/tooltip/index.js +137 -0
- package/lib/atom/tooltip/index.js.map +1 -0
- package/lib/atom/tooltip/style.css +96 -0
- package/lib/molecule/answer/index.d.ts +3 -0
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +11 -4
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/template/activity/engine-stars.css +16 -33
- package/lib/template/activity/engine-stars.d.ts +15 -17
- package/lib/template/activity/engine-stars.d.ts.map +1 -1
- package/lib/template/activity/engine-stars.js +135 -116
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/activity/index.d.ts +1 -0
- package/lib/template/activity/index.d.ts.map +1 -1
- package/lib/template/activity/index.js +21 -9
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/progression-item.js +1 -1
- package/lib/template/activity/progression-item.js.map +1 -1
- package/lib/template/activity/stars-summary.d.ts +1 -0
- package/lib/template/activity/stars-summary.d.ts.map +1 -1
- package/lib/template/activity/stars-summary.js +10 -5
- package/lib/template/activity/stars-summary.js.map +1 -1
- package/locales/cs/global.json +1 -0
- package/locales/de/global.json +1 -0
- package/locales/en/global.json +1 -0
- package/locales/es/global.json +1 -0
- package/locales/et/global.json +1 -0
- package/locales/fr/global.json +1 -0
- package/locales/hr/global.json +1 -0
- package/locales/hu/global.json +1 -0
- package/locales/it/global.json +1 -0
- package/locales/ja/global.json +1 -0
- package/locales/ko/global.json +1 -0
- package/locales/nl/global.json +1 -0
- package/locales/pl/global.json +1 -0
- package/locales/pt/global.json +1 -0
- package/locales/ro/global.json +1 -0
- package/locales/ru/global.json +1 -0
- package/locales/sk/global.json +1 -0
- package/locales/th/global.json +90 -0
- package/locales/tl/global.json +1 -0
- package/locales/zh/global.json +1 -0
- package/locales/zh_TW/global.json +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.toggleStateOnKeyPress = exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
|
|
11
|
+
|
|
12
|
+
var _isString = _interopRequireDefault(require("lodash/fp/isString"));
|
|
13
|
+
|
|
14
|
+
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
15
|
+
|
|
16
|
+
var _style = _interopRequireDefault(require("./style.css"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
const ToolTipWrapper = ({
|
|
25
|
+
toolTipIsVisible,
|
|
26
|
+
anchorId,
|
|
27
|
+
closeToolTipInformationTextAriaLabel,
|
|
28
|
+
content
|
|
29
|
+
}) => {
|
|
30
|
+
if (!toolTipIsVisible) return null;
|
|
31
|
+
|
|
32
|
+
if (anchorId) {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
|
|
34
|
+
id: anchorId,
|
|
35
|
+
className: _style.default.toolTipReact,
|
|
36
|
+
"data-event-off": "click",
|
|
37
|
+
place: "left",
|
|
38
|
+
effect: "solid",
|
|
39
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
40
|
+
}, content);
|
|
41
|
+
} else {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: _style.default.toolTip,
|
|
44
|
+
"data-testid": "tooltip",
|
|
45
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
46
|
+
}, content);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
51
|
+
toolTipIsVisible: _propTypes.default.bool,
|
|
52
|
+
anchorId: _propTypes.default.string,
|
|
53
|
+
closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
|
|
54
|
+
content: _propTypes.default.node
|
|
55
|
+
} : {};
|
|
56
|
+
|
|
57
|
+
const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
58
|
+
if (event.key === 'Enter') {
|
|
59
|
+
if (ref) ref.current.focus();
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
setState(!state);
|
|
63
|
+
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
64
|
+
setState(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.toggleStateOnKeyPress = toggleStateOnKeyPress;
|
|
69
|
+
|
|
70
|
+
const ToolTip = ({
|
|
71
|
+
anchorId,
|
|
72
|
+
TooltipContent,
|
|
73
|
+
'aria-label': ariaLabel,
|
|
74
|
+
'data-testid': dataTestId,
|
|
75
|
+
closeToolTipInformationTextAriaLabel,
|
|
76
|
+
toolTipIsVisible: _toolTipIsVisible
|
|
77
|
+
}) => {
|
|
78
|
+
const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
|
|
79
|
+
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
80
|
+
const handleKeyPress = (0, _react.useCallback)(event => {
|
|
81
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
|
|
82
|
+
}, [toolTipIsVisible]);
|
|
83
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
84
|
+
setToolTipIsVisible(true);
|
|
85
|
+
}, []);
|
|
86
|
+
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
87
|
+
setToolTipIsVisible(false);
|
|
88
|
+
}, []);
|
|
89
|
+
const content = (0, _react.useMemo)(() => {
|
|
90
|
+
return isComponent ? /*#__PURE__*/_react.default.createElement(TooltipContent, null) : /*#__PURE__*/_react.default.createElement("p", {
|
|
91
|
+
className: _style.default.tooltipContent
|
|
92
|
+
}, TooltipContent);
|
|
93
|
+
}, [TooltipContent, isComponent]);
|
|
94
|
+
return anchorId ? /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
|
|
95
|
+
toolTipIsVisible: _toolTipIsVisible,
|
|
96
|
+
anchorId: anchorId,
|
|
97
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
98
|
+
content: content,
|
|
99
|
+
onMouseLeave: handleMouseLeave,
|
|
100
|
+
onMouseOver: handleMouseOver
|
|
101
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: _style.default.tooltipContainer,
|
|
103
|
+
onMouseLeave: handleMouseLeave,
|
|
104
|
+
onMouseOver: handleMouseOver
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
className: _style.default.tooltipIconContainer,
|
|
108
|
+
"data-testid": dataTestId,
|
|
109
|
+
onKeyDown: handleKeyPress,
|
|
110
|
+
tabIndex: 0
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
|
|
112
|
+
className: _style.default.informationIcon,
|
|
113
|
+
width: 12,
|
|
114
|
+
height: 12,
|
|
115
|
+
"aria-label": ariaLabel
|
|
116
|
+
})), /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
|
|
117
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
118
|
+
anchorId: anchorId,
|
|
119
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
120
|
+
content: content
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
125
|
+
TooltipContent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node, _propTypes.default.string]),
|
|
126
|
+
'data-testid': _propTypes.default.string,
|
|
127
|
+
'aria-label': _propTypes.default.string,
|
|
128
|
+
closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
|
|
129
|
+
// ---------- externalHandling --------------
|
|
130
|
+
// if passed down, React Tooltip is used instead, due to limitations on
|
|
131
|
+
// parents overflow hidden controls
|
|
132
|
+
anchorId: _propTypes.default.string,
|
|
133
|
+
toolTipIsVisible: _propTypes.default.bool
|
|
134
|
+
} : {};
|
|
135
|
+
var _default = ToolTip;
|
|
136
|
+
exports.default = _default;
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","style","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","handleKeyPress","useCallback","handleMouseOver","handleMouseLeave","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","func"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\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 ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content\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 >\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};\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}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n setToolTipIsVisible(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setToolTipIsVisible(false);\n }, []);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={style.tooltipContent}>{TooltipContent}</p>\n );\n }, [TooltipContent, 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 />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={style.tooltipIconContainer}\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 />\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 // ---------- externalHandling --------------\n // 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;;;;;;;;AAEA,MAAMA,cAAc,GAAG,CAAC;EACtBC,gBADsB;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FhB;IAGE,WAAW,EAAED;EAHf,gBAKE;IACE,IAAI,EAAC,QADP;IAEE,SAAS,EAAEhC,cAAA,CAAMoC,oBAFnB;IAGE,eAAad,UAHf;IAIE,SAAS,EAAEQ,cAJb;IAKE,QAAQ,EAAE;EALZ,gBAOE,6BAAC,qDAAD;IACE,SAAS,EAAE9B,cAAA,CAAMqC,eADnB;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYhB;EAJd,EAPF,CALF,eAmBE,6BAAC,cAAD;IACE,gBAAgB,EAAEzB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC;EAJX,EAnBF,CAVF;AAqCD,CA3ED;;AA6EAoB,OAAO,CAAChB,SAAR,2CAAoB;EAClBiB,cAAc,EAAEhB,kBAAA,CAAUkC,SAAV,CAAoB,CAAClC,kBAAA,CAAUmC,IAAX,EAAiBnC,kBAAA,CAAUI,IAA3B,EAAiCJ,kBAAA,CAAUE,MAA3C,CAApB,CADE;EAElB,eAAeF,kBAAA,CAAUE,MAFP;EAGlB,cAAcF,kBAAA,CAAUE,MAHN;EAIlBR,oCAAoC,EAAEM,kBAAA,CAAUE,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACA;EACAV,QAAQ,EAAEO,kBAAA,CAAUE,MARF;EASlBV,gBAAgB,EAAEQ,kBAAA,CAAUC;AATV,CAApB;eAYec,O"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value cm_blue_900 from colors;
|
|
3
|
+
@value cm_grey_75 from colors;
|
|
4
|
+
@value cm_grey_500 from colors;
|
|
5
|
+
@value cm_grey_700 from colors;
|
|
6
|
+
|
|
7
|
+
.textBase {
|
|
8
|
+
font-family: "Gilroy";
|
|
9
|
+
font-style: normal;
|
|
10
|
+
color: cm_blue_900;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltipContainer {
|
|
15
|
+
overflow: visible;
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 10;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
justify-self: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tooltipIconContainer {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
border: none;
|
|
27
|
+
background: cm_grey_75;
|
|
28
|
+
height: 25px;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.toolTip {
|
|
33
|
+
transition: opacity 0.8s;
|
|
34
|
+
position: absolute;
|
|
35
|
+
border-radius: 7px;
|
|
36
|
+
background-color: cm_grey_700;
|
|
37
|
+
right: -75px;
|
|
38
|
+
bottom: 32px;
|
|
39
|
+
height: auto;
|
|
40
|
+
width: 200px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.toolTip::before {
|
|
44
|
+
content: '';
|
|
45
|
+
display: inline-block;
|
|
46
|
+
visibility: inherit;
|
|
47
|
+
opacity: inherit;
|
|
48
|
+
width: 15px;
|
|
49
|
+
height: 15px;
|
|
50
|
+
transform: rotate(-45deg);
|
|
51
|
+
background-color: cm_grey_700;
|
|
52
|
+
position: inherit;
|
|
53
|
+
border-radius: 2px;
|
|
54
|
+
bottom: -5px;
|
|
55
|
+
right: 40%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tooltipContent {
|
|
59
|
+
composes: textBase;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
display: inline-block;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
word-wrap: break-word;
|
|
65
|
+
color: white;
|
|
66
|
+
padding: 8px 14px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.informationIcon {
|
|
71
|
+
color: cm_grey_500;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ----------------------- ReactToolTip exclusive classes ------------------------- */
|
|
75
|
+
.toolTipReact {
|
|
76
|
+
pointer-events: all !important;
|
|
77
|
+
background-color: cm_grey_700;
|
|
78
|
+
border-radius: 7px !important;
|
|
79
|
+
visibility: visible !important;
|
|
80
|
+
opacity: 1 !important;
|
|
81
|
+
left: 5px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* for keyboard navigation, the position can't be obtained from the mouse */
|
|
85
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact) {
|
|
86
|
+
border-radius: 7px !important;
|
|
87
|
+
top: 97px!important;
|
|
88
|
+
left: 628px!important;
|
|
89
|
+
visibility: visible !important;
|
|
90
|
+
opacity: 1!important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* same reason, arrow can't be placed effectively */
|
|
94
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact)::after {
|
|
95
|
+
content: none !important;
|
|
96
|
+
}
|
|
@@ -2,6 +2,9 @@ export default Answer;
|
|
|
2
2
|
declare function Answer(props: any): JSX.Element;
|
|
3
3
|
declare namespace Answer {
|
|
4
4
|
export { propTypes };
|
|
5
|
+
export namespace contextTypes {
|
|
6
|
+
const translate: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
import propTypes from "./prop-types";
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AA6EA,iDAWC"}
|
|
@@ -25,7 +25,7 @@ var _template = _interopRequireDefault(require("../questions/template"));
|
|
|
25
25
|
|
|
26
26
|
var _audio = _interopRequireDefault(require("../audio"));
|
|
27
27
|
|
|
28
|
-
var _provider = require("../../atom/provider");
|
|
28
|
+
var _provider = _interopRequireDefault(require("../../atom/provider"));
|
|
29
29
|
|
|
30
30
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
31
31
|
|
|
@@ -88,11 +88,12 @@ MediaView.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.MediaVi
|
|
|
88
88
|
const Switch = ({
|
|
89
89
|
model,
|
|
90
90
|
help
|
|
91
|
-
}) => {
|
|
91
|
+
}, legacyContext) => {
|
|
92
92
|
const {
|
|
93
93
|
type
|
|
94
|
-
} = model;
|
|
95
|
-
|
|
94
|
+
} = model; // const translate = GetTranslateFromContext(legacyContext);
|
|
95
|
+
|
|
96
|
+
const translate = legacyContext.translate;
|
|
96
97
|
|
|
97
98
|
switch (type) {
|
|
98
99
|
case 'qcmDrag':
|
|
@@ -135,6 +136,9 @@ Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
135
136
|
model: _propTypes.default.model,
|
|
136
137
|
help: _propTypes.default.help
|
|
137
138
|
} : {};
|
|
139
|
+
Switch.contextTypes = {
|
|
140
|
+
translate: _provider.default.childContextTypes.translate
|
|
141
|
+
};
|
|
138
142
|
|
|
139
143
|
const Answer = props => {
|
|
140
144
|
const {
|
|
@@ -154,6 +158,9 @@ const Answer = props => {
|
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
Answer.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.default : {};
|
|
161
|
+
Answer.contextTypes = {
|
|
162
|
+
translate: _provider.default.childContextTypes.translate
|
|
163
|
+
};
|
|
157
164
|
var _default = Answer;
|
|
158
165
|
exports.default = _default;
|
|
159
166
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MediaView","media","videoId","type","childProps","TYPE_IMAGE","style","backgroundImage","url","TYPE_VIDEO","video","TYPE_AUDIO","audio","propTypes","MediaViewPropTypes","Switch","model","help","translate","
|
|
1
|
+
{"version":3,"file":"index.js","names":["MediaView","media","videoId","type","childProps","TYPE_IMAGE","style","backgroundImage","url","TYPE_VIDEO","video","TYPE_AUDIO","audio","propTypes","MediaViewPropTypes","Switch","model","help","legacyContext","translate","contextTypes","Provider","childContextTypes","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}, legacyContext) => {\n const {type} = model;\n // const translate = GetTranslateFromContext(legacyContext);\n const translate = legacyContext.translate;\n switch (type) {\n case 'qcmDrag':\n return <QcmDrag {...model} help={help} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcm':\n return <Qcm {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcmGraphic':\n return <QcmGraphic {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'freeText':\n return <FreeText {...model} />;\n case 'dropDown':\n return <DropDown {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'slider':\n return <QuestionRange {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'template':\n return <Template {...model} groupAriaLabel={translate('answer_the_question')} />;\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nSwitch.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <form>\n <Switch model={model} help={help} />\n </form>\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nAnswer.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,MAAMA,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAAa;EAC7B,MAAM;IAACC,OAAD;IAAUC;EAAV,IAAiCF,KAAvC;EAAA,MAAyBG,UAAzB,iCAAuCH,KAAvC;;EACA,QAAQE,IAAR;IACE,KAAKE,qBAAL;MACE,oBACE;QACE,SAAS,EAAEC,cAAA,CAAML,KADnB;QAEE,KAAK,EAAE;UACLM,eAAe,EAAG,OAAMN,KAAK,CAACO,GAAI;QAD7B;MAFT,EADF;;IAQF,KAAKC,qBAAL;MACE,oBACE;QAAK,SAAS,EAAEH,cAAA,CAAMI;MAAtB,gBACE,6BAAC,oBAAD,eAAiB,oBAAK,IAAL,EAAWN,UAAX,CAAjB;QAAyC,EAAE,EAAEF,OAA7C;QAAsD,MAAM,EAAC,MAA7D;QAAoE,KAAK,EAAC;MAA1E,GADF,CADF;;IAKF,KAAKS,qBAAL;MACE,oBACE;QAAK,SAAS,EAAEL,cAAA,CAAMM;MAAtB,gBACE,6BAAC,cAAD,eAAW,oBAAK,IAAL,EAAWR,UAAX,CAAX;QAAmC,MAAM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,CAAUI;AAFC,CAAnB;AAKAF,MAAM,CAACK,YAAP,GAAsB;EACpBD,SAAS,EAAEE,iBAAA,CAASC,iBAAT,CAA2BH;AADlB,CAAtB;;AAIA,MAAMI,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACR,KAAD;IAAQf,KAAR;IAAegB;EAAf,IAAuBO,KAA7B;EAEA,oBACE;IAAK,aAAU,QAAf;IAAwB,SAAS,EAAElB,cAAA,CAAMmB;EAAzC,GACGxB,KAAK,gBAAG,6BAAC,SAAD;IAAW,KAAK,EAAEA;EAAlB,EAAH,GAAiC,IADzC,eAEE,wDACE,6BAAC,MAAD;IAAQ,KAAK,EAAEe,KAAf;IAAsB,IAAI,EAAEC;EAA5B,EADF,CAFF,CADF;AAQD,CAXD;;AAaAM,MAAM,CAACV,SAAP,2CAAmBA,kBAAnB;AAEAU,MAAM,CAACH,YAAP,GAAsB;EACpBD,SAAS,EAAEE,iBAAA,CAASC,iBAAT,CAA2BH;AADlB,CAAtB;eAIeI,M"}
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
user-select: none;
|
|
23
23
|
position: relative;
|
|
24
|
+
border-bottom: none;
|
|
25
|
+
border-right: 0px;
|
|
26
|
+
border-width: 1px 0 0 1px;
|
|
27
|
+
background: inherit;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
.engineIcon {
|
|
@@ -156,28 +160,22 @@
|
|
|
156
160
|
opacity: 0.4;
|
|
157
161
|
}
|
|
158
162
|
|
|
159
|
-
.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
background-color: transparent !important;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.toolTip::after {
|
|
167
|
-
border-left-color: transparent !important;
|
|
163
|
+
.textBase {
|
|
164
|
+
font-family: "Gilroy";
|
|
165
|
+
font-style: normal;
|
|
166
|
+
color: white;
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
.toolTipContent {
|
|
171
|
-
|
|
172
|
-
margin: 0;
|
|
173
|
-
border-radius: 3px;
|
|
174
|
-
font-family: 'Gilroy';
|
|
175
|
-
font-size: 12px;
|
|
170
|
+
composes: textBase;
|
|
176
171
|
width: 270px;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
font-size: 14px;
|
|
174
|
+
display: inline-block;
|
|
175
|
+
border-radius: 3px;
|
|
176
|
+
word-wrap: break-word;
|
|
177
|
+
padding: 8px 14px;
|
|
178
|
+
text-align: center;
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
.toolTipContent > a {
|
|
@@ -191,21 +189,6 @@
|
|
|
191
189
|
text-decoration: underline;
|
|
192
190
|
}
|
|
193
191
|
|
|
194
|
-
.toolTipContent::after {
|
|
195
|
-
content: '';
|
|
196
|
-
width: 0;
|
|
197
|
-
height: 0;
|
|
198
|
-
position: absolute;
|
|
199
|
-
border-left-color: inherit;
|
|
200
|
-
border-left-style: solid;
|
|
201
|
-
border-left-width: 6px;
|
|
202
|
-
border-top: 5px solid transparent;
|
|
203
|
-
border-bottom: 5px solid transparent;
|
|
204
|
-
right: -6px;
|
|
205
|
-
top: 50%;
|
|
206
|
-
margin-top: -4px;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
192
|
/* ------------------------------------------------------ */
|
|
210
193
|
|
|
211
194
|
@media tablet, mobile {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
export default EngineStars;
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
declare function EngineStars(props: any, legacyContext: any): JSX.Element;
|
|
3
|
+
declare namespace EngineStars {
|
|
4
|
+
namespace propTypes {
|
|
5
|
+
const type: PropTypes.Validator<string>;
|
|
6
|
+
const stars: PropTypes.Validator<number>;
|
|
7
|
+
const title: PropTypes.Validator<string>;
|
|
8
|
+
const active: PropTypes.Requireable<boolean>;
|
|
9
|
+
const disabled: PropTypes.Requireable<boolean>;
|
|
10
|
+
const onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
const className: PropTypes.Requireable<string>;
|
|
12
|
+
const toolTip: PropTypes.Requireable<PropTypes.InferProps<{
|
|
11
13
|
preMessage: PropTypes.Requireable<string>;
|
|
12
14
|
linkMessage: PropTypes.Requireable<string>;
|
|
13
15
|
endMessage: PropTypes.Requireable<string>;
|
|
14
16
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
17
|
}>>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
+
}
|
|
19
|
+
namespace contextTypes {
|
|
20
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
21
|
common: PropTypes.Requireable<{
|
|
20
22
|
[x: string]: any;
|
|
21
23
|
}>;
|
|
@@ -36,11 +38,7 @@ declare class EngineStars extends React.Component<any, any, any> {
|
|
|
36
38
|
[x: string]: any;
|
|
37
39
|
}>;
|
|
38
40
|
}>>;
|
|
39
|
-
}
|
|
40
|
-
constructor(props: any, context: any);
|
|
41
|
-
handleClick: (e: any) => void;
|
|
42
|
-
render(): JSX.Element;
|
|
41
|
+
}
|
|
43
42
|
}
|
|
44
|
-
import React from "react";
|
|
45
43
|
import PropTypes from "prop-types";
|
|
46
44
|
//# sourceMappingURL=engine-stars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stars.d.ts","sourceRoot":"","sources":["../../../src/template/activity/engine-stars.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"engine-stars.d.ts","sourceRoot":"","sources":["../../../src/template/activity/engine-stars.js"],"names":[],"mappings":";AAuEA,0EAwIC"}
|