@coorpacademy/components 11.9.2 → 11.9.3-alpha.23
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/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.map +1 -1
- package/es/molecule/answer/index.js +6 -3
- 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/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.map +1 -1
- package/lib/molecule/answer/index.js +6 -3
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-presentation/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-presentation/index.js"],"names":[],"mappings":";AA+CA,6DA+BC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import React, { useState, useCallback } from 'react';
|
|
1
|
+
import React from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
3
|
import getOr from 'lodash/fp/getOr';
|
|
6
4
|
import map from 'lodash/fp/map';
|
|
7
|
-
import { NovaSolidStatusCheckCircle2 as CheckIcon, NovaSolidVoteRewardsVoteHeart as HeartIcon,
|
|
5
|
+
import { NovaSolidStatusCheckCircle2 as CheckIcon, NovaSolidVoteRewardsVoteHeart as HeartIcon, NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon, NovaLineSelectionCursorsCursorArrowTarget as TargetIcon } from '@coorpacademy/nova-icons';
|
|
6
|
+
import ToolTip from '../tooltip';
|
|
8
7
|
import style from './style.css';
|
|
9
8
|
import propTypes from './prop-types';
|
|
10
9
|
const ICONS = {
|
|
@@ -31,50 +30,6 @@ const ReviewIcon = ({
|
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
const ToolTip = ({
|
|
35
|
-
tooltipText,
|
|
36
|
-
'aria-label': moreDetailsAriaLabel,
|
|
37
|
-
'data-testid': dataTestId,
|
|
38
|
-
closeToolTipInformationTextAriaLabel
|
|
39
|
-
}) => {
|
|
40
|
-
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
41
|
-
const handleKeyPress = useCallback(event => {
|
|
42
|
-
if (event.key === 'Enter') {
|
|
43
|
-
setToolTipIsVisible(!toolTipIsVisible);
|
|
44
|
-
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
45
|
-
setToolTipIsVisible(false);
|
|
46
|
-
}
|
|
47
|
-
}, [setToolTipIsVisible, toolTipIsVisible]);
|
|
48
|
-
const handleMouseOver = useCallback(() => {
|
|
49
|
-
setToolTipIsVisible(true);
|
|
50
|
-
}, [setToolTipIsVisible]);
|
|
51
|
-
const handleMouseLeave = useCallback(() => {
|
|
52
|
-
setToolTipIsVisible(false);
|
|
53
|
-
}, [setToolTipIsVisible]);
|
|
54
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
className: style.tooltipContainer,
|
|
56
|
-
onMouseLeave: handleMouseLeave,
|
|
57
|
-
onMouseOver: handleMouseOver
|
|
58
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
59
|
-
type: "button",
|
|
60
|
-
className: style.tooltipIconContainer,
|
|
61
|
-
"data-testid": dataTestId,
|
|
62
|
-
onKeyDown: handleKeyPress,
|
|
63
|
-
tabIndex: 0
|
|
64
|
-
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
65
|
-
className: style.informationIcon,
|
|
66
|
-
width: 12,
|
|
67
|
-
height: 12,
|
|
68
|
-
"aria-label": moreDetailsAriaLabel
|
|
69
|
-
})), toolTipIsVisible ? /*#__PURE__*/React.createElement("div", {
|
|
70
|
-
className: style.toolTip,
|
|
71
|
-
"data-testid": "review-presentation-tooltip",
|
|
72
|
-
"aria-label": closeToolTipInformationTextAriaLabel
|
|
73
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
74
|
-
className: style.tooltipText
|
|
75
|
-
}, tooltipText)) : null);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
33
|
const ReviewListItemWrapper = ({
|
|
79
34
|
iconKey,
|
|
80
35
|
label
|
|
@@ -89,10 +44,10 @@ const ReviewListItemWrapper = ({
|
|
|
89
44
|
}, /*#__PURE__*/React.createElement(ReviewIcon, {
|
|
90
45
|
icon: iconKey
|
|
91
46
|
}), " ", label.text), /*#__PURE__*/React.createElement(ToolTip, {
|
|
92
|
-
|
|
93
|
-
"aria-label": label.moreDetailsAriaLabel,
|
|
47
|
+
TooltipContent: label.tooltipText,
|
|
94
48
|
closeToolTipInformationTextAriaLabel: label.closeToolTipInformationTextAriaLabel,
|
|
95
|
-
"data-testid": `review-list-item-tooltip-button-${iconKey}
|
|
49
|
+
"data-testid": `review-list-item-tooltip-button-${iconKey}`,
|
|
50
|
+
"aria-label": label.moreDetailsAriaLabel
|
|
96
51
|
}));
|
|
97
52
|
};
|
|
98
53
|
|
|
@@ -135,23 +90,18 @@ const ReviewPresentation = props => {
|
|
|
135
90
|
}, labelsList)));
|
|
136
91
|
};
|
|
137
92
|
|
|
138
|
-
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
139
|
-
tooltipText: PropTypes.string,
|
|
140
|
-
'aria-label': PropTypes.string,
|
|
141
|
-
'data-testid': PropTypes.string,
|
|
142
|
-
closeToolTipInformationTextAriaLabel: PropTypes.string
|
|
143
|
-
} : {};
|
|
144
93
|
ReviewIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
145
94
|
icon: PropTypes.string
|
|
146
95
|
} : {};
|
|
147
|
-
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ?
|
|
96
|
+
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
148
97
|
iconKey: PropTypes.string,
|
|
149
98
|
label: PropTypes.shape({
|
|
150
|
-
tooltipText:
|
|
151
|
-
moreDetailsAriaLabel:
|
|
152
|
-
closeToolTipInformationTextAriaLabel:
|
|
99
|
+
tooltipText: ToolTip.propTypes.tooltipText,
|
|
100
|
+
moreDetailsAriaLabel: ToolTip.propTypes['aria-label'],
|
|
101
|
+
closeToolTipInformationTextAriaLabel: ToolTip.propTypes.closeToolTipInformationTextAriaLabel,
|
|
102
|
+
text: PropTypes.string
|
|
153
103
|
})
|
|
154
|
-
}
|
|
104
|
+
} : {};
|
|
155
105
|
ReviewPresentation.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
156
106
|
export default ReviewPresentation;
|
|
157
107
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","getOr","map","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidVoteRewardsVoteHeart","HeartIcon","NovaSolidInterfaceFeedbackInterfaceQuestionMark","QuestionIcon","NovaLineSelectionCursorsCursorArrowTarget","TargetIcon","ToolTip","style","propTypes","ICONS","skills","questions","lifes","allright","ReviewIcon","icon","Icon","labelIcon","ReviewListItemWrapper","iconKey","label","reviewListItemWrapper","reviewListText","text","tooltipText","closeToolTipInformationTextAriaLabel","moreDetailsAriaLabel","ReviewPresentation","props","ariaLabel","reviewTitle","reviewText","labelsList","reviewWrapper","__html","reviewListWrapper","convert","cap","key","reviewList","string","shape"],"sources":["../../../src/atom/review-presentation/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport getOr from 'lodash/fp/getOr';\nimport map from 'lodash/fp/map';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidVoteRewardsVoteHeart as HeartIcon,\n NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon,\n NovaLineSelectionCursorsCursorArrowTarget as TargetIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip from '../tooltip';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst ICONS = {\n skills: TargetIcon,\n questions: QuestionIcon,\n lifes: HeartIcon,\n allright: CheckIcon\n};\n\nconst ReviewIcon = ({icon}) => {\n const Icon = getOr(null, icon, ICONS);\n\n /* istanbul ignore next */\n if (!Icon) {\n return <div className={style.labelIcon} />;\n }\n return <Icon className={style.labelIcon} />;\n};\n\nconst ReviewListItemWrapper = ({iconKey, label}) => {\n return (\n <div className={style.reviewListItemWrapper} data-tip data-for=\"reviewListItem\" tabIndex={0}>\n <div className={style.reviewListText}>\n <ReviewIcon icon={iconKey} /> {label.text}\n </div>\n <ToolTip\n TooltipContent={label.tooltipText}\n closeToolTipInformationTextAriaLabel={label.closeToolTipInformationTextAriaLabel}\n data-testid={`review-list-item-tooltip-button-${iconKey}`}\n aria-label={label.moreDetailsAriaLabel}\n />\n </div>\n );\n};\n\nconst ReviewPresentation = props => {\n const {'aria-label': ariaLabel, reviewTitle, reviewText, labelsList} = props;\n\n return (\n <div className={style.reviewWrapper} aria-label={ariaLabel}>\n <div\n className={style.reviewTitle}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewTitle}}\n />\n <div\n className={style.reviewText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewText}}\n />\n <ul className={style.reviewListWrapper}>\n {map.convert({cap: false})((label, key) => {\n return (\n <li key={`step-${key}`} className={style.reviewList}>\n <ReviewListItemWrapper\n iconKey={key}\n label={label}\n tooltipText={label.tooltipText}\n aria-label={label.moreDetailsAriaLabel}\n />\n </li>\n );\n }, labelsList)}\n </ul>\n </div>\n );\n};\n\nReviewIcon.propTypes = {\n icon: PropTypes.string\n};\n\nReviewListItemWrapper.propTypes = {\n iconKey: PropTypes.string,\n label: PropTypes.shape({\n tooltipText: ToolTip.propTypes.tooltipText,\n moreDetailsAriaLabel: ToolTip.propTypes['aria-label'],\n closeToolTipInformationTextAriaLabel: ToolTip.propTypes.closeToolTipInformationTextAriaLabel,\n text: PropTypes.string\n })\n};\n\nReviewPresentation.propTypes = propTypes;\n\nexport default ReviewPresentation;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SACEC,2BAA2B,IAAIC,SADjC,EAEEC,6BAA6B,IAAIC,SAFnC,EAGEC,+CAA+C,IAAIC,YAHrD,EAIEC,yCAAyC,IAAIC,UAJ/C,QAKO,0BALP;AAMA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,MAAMC,KAAK,GAAG;EACZC,MAAM,EAAEL,UADI;EAEZM,SAAS,EAAER,YAFC;EAGZS,KAAK,EAAEX,SAHK;EAIZY,QAAQ,EAAEd;AAJE,CAAd;;AAOA,MAAMe,UAAU,GAAG,CAAC;EAACC;AAAD,CAAD,KAAY;EAC7B,MAAMC,IAAI,GAAGpB,KAAK,CAAC,IAAD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,CAAY;IAACC,GAAG,EAAE;EAAN,CAAZ,EAA0B,CAACjB,KAAD,EAAQkB,GAAR,KAAgB;IACzC,oBACE;MAAI,GAAG,EAAG,QAAOA,GAAI,EAArB;MAAwB,SAAS,EAAE/B,KAAK,CAACgC;IAAzC,gBACE,oBAAC,qBAAD;MACE,OAAO,EAAED,GADX;MAEE,KAAK,EAAElB,KAFT;MAGE,WAAW,EAAEA,KAAK,CAACI,WAHrB;MAIE,cAAYJ,KAAK,CAACM;IAJpB,EADF,CADF;EAUD,CAXA,EAWEM,UAXF,CADH,CAXF,CADF;AA4BD,CA/BD;;AAiCAlB,UAAU,CAACN,SAAX,2CAAuB;EACrBO,IAAI,EAAEpB,SAAS,CAAC6C;AADK,CAAvB;AAIAtB,qBAAqB,CAACV,SAAtB,2CAAkC;EAChCW,OAAO,EAAExB,SAAS,CAAC6C,MADa;EAEhCpB,KAAK,EAAEzB,SAAS,CAAC8C,KAAV,CAAgB;IACrBjB,WAAW,EAAElB,OAAO,CAACE,SAAR,CAAkBgB,WADV;IAErBE,oBAAoB,EAAEpB,OAAO,CAACE,SAAR,CAAkB,YAAlB,CAFD;IAGrBiB,oCAAoC,EAAEnB,OAAO,CAACE,SAAR,CAAkBiB,oCAHnC;IAIrBF,IAAI,EAAE5B,SAAS,CAAC6C;EAJK,CAAhB;AAFyB,CAAlC;AAUAb,kBAAkB,CAACnB,SAAnB,2CAA+BA,SAA/B;AAEA,eAAemB,kBAAf"}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
@value mobile from breakpoints;
|
|
4
4
|
@value colors: "../../variables/colors.css";
|
|
5
5
|
@value xtraLightGrey from colors;
|
|
6
|
-
@value cm_blue_900 from colors;
|
|
7
6
|
@value cm_grey_75 from colors;
|
|
8
|
-
@value cm_grey_500 from colors;
|
|
9
|
-
@value cm_grey_700 from colors;
|
|
10
|
-
@value white from colors;
|
|
11
7
|
|
|
8
|
+
.reviewWrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
border-radius: 16px;
|
|
11
|
+
background-color: xtraLightGrey;
|
|
12
|
+
padding-bottom: 40px;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
.textBase {
|
|
14
16
|
font-family: "Gilroy";
|
|
@@ -17,13 +19,6 @@
|
|
|
17
19
|
user-select: none;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
.reviewWrapper {
|
|
21
|
-
width: 100%;
|
|
22
|
-
border-radius: 16px;
|
|
23
|
-
background-color: xtraLightGrey;
|
|
24
|
-
padding-bottom: 40px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
.reviewTitle {
|
|
28
23
|
composes: textBase;
|
|
29
24
|
font-weight: 700;
|
|
@@ -77,61 +72,6 @@
|
|
|
77
72
|
width: 16px;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
|
-
.informationIcon {
|
|
81
|
-
color: cm_grey_500;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.toolTip {
|
|
85
|
-
transition: opacity 0.8s;
|
|
86
|
-
position: absolute;
|
|
87
|
-
height: auto;
|
|
88
|
-
width: 200px;
|
|
89
|
-
border-radius: 7px;
|
|
90
|
-
background-color: cm_grey_700;
|
|
91
|
-
right: -81px;
|
|
92
|
-
bottom: 32px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.toolTip::before {
|
|
96
|
-
content: '';
|
|
97
|
-
display: inline-block;
|
|
98
|
-
visibility: inherit;
|
|
99
|
-
opacity: inherit;
|
|
100
|
-
width: 15px;
|
|
101
|
-
height: 15px;
|
|
102
|
-
transform: rotate(-45deg);
|
|
103
|
-
background-color: cm_grey_700;
|
|
104
|
-
position: inherit;
|
|
105
|
-
bottom: -5px;
|
|
106
|
-
right: 40%;
|
|
107
|
-
border-radius: 2px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tooltipText {
|
|
111
|
-
composes: textBase;
|
|
112
|
-
font-weight: 500;
|
|
113
|
-
font-size: 14px;
|
|
114
|
-
display: inline-block;
|
|
115
|
-
border-radius: 3px;
|
|
116
|
-
word-wrap: break-word;
|
|
117
|
-
color: white;
|
|
118
|
-
padding: 8px 14px;
|
|
119
|
-
text-align: center;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.tooltipContainer {
|
|
123
|
-
overflow: visible;
|
|
124
|
-
position: relative;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.tooltipIconContainer {
|
|
128
|
-
display: flex;
|
|
129
|
-
justify-content: flex-end;
|
|
130
|
-
border: none;
|
|
131
|
-
background: cm_grey_75;
|
|
132
|
-
height: 25px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
75
|
@media tablet {
|
|
136
76
|
.reviewWrapper{
|
|
137
77
|
width: 100%;
|
|
@@ -142,4 +82,4 @@
|
|
|
142
82
|
.reviewWrapper{
|
|
143
83
|
width: 100%;
|
|
144
84
|
}
|
|
145
|
-
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
|
+
export default ToolTip;
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible }: {
|
|
4
|
+
anchorId: any;
|
|
5
|
+
TooltipContent: any;
|
|
6
|
+
"aria-label": any;
|
|
7
|
+
"data-testid": any;
|
|
8
|
+
closeToolTipInformationTextAriaLabel: any;
|
|
9
|
+
toolTipIsVisible: any;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
declare namespace ToolTip {
|
|
12
|
+
const propTypes: {
|
|
13
|
+
TooltipContent: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
|
|
14
|
+
'data-testid': PropTypes.Requireable<string>;
|
|
15
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
16
|
+
closeToolTipInformationTextAriaLabel: PropTypes.Validator<string>;
|
|
17
|
+
anchorId: PropTypes.Requireable<string>;
|
|
18
|
+
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
import PropTypes from "prop-types";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { isValidElement, useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ReactTooltip from 'react-tooltip';
|
|
4
|
+
import isString from 'lodash/fp/isString';
|
|
5
|
+
import { NovaCompositionCoorpacademyInformationIcon as InformationIcon } from '@coorpacademy/nova-icons';
|
|
6
|
+
import style from './style.css';
|
|
7
|
+
|
|
8
|
+
const ToolTipWrapper = ({
|
|
9
|
+
toolTipIsVisible,
|
|
10
|
+
anchorId,
|
|
11
|
+
closeToolTipInformationTextAriaLabel,
|
|
12
|
+
content
|
|
13
|
+
}) => {
|
|
14
|
+
if (!toolTipIsVisible) return null;
|
|
15
|
+
|
|
16
|
+
if (anchorId) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
18
|
+
id: anchorId,
|
|
19
|
+
className: style.toolTipReact,
|
|
20
|
+
"data-event-off": "click",
|
|
21
|
+
place: "left",
|
|
22
|
+
effect: "solid",
|
|
23
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
24
|
+
}, content);
|
|
25
|
+
} else {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: style.toolTip,
|
|
28
|
+
"data-testid": "tooltip",
|
|
29
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
30
|
+
}, content);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
35
|
+
toolTipIsVisible: PropTypes.bool,
|
|
36
|
+
anchorId: PropTypes.string,
|
|
37
|
+
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
38
|
+
content: PropTypes.node
|
|
39
|
+
} : {};
|
|
40
|
+
export const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
41
|
+
if (event.key === 'Enter') {
|
|
42
|
+
if (ref) ref.current.focus();
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
setState(!state);
|
|
46
|
+
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
47
|
+
setState(false);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const ToolTip = ({
|
|
52
|
+
anchorId,
|
|
53
|
+
TooltipContent,
|
|
54
|
+
'aria-label': ariaLabel,
|
|
55
|
+
'data-testid': dataTestId,
|
|
56
|
+
closeToolTipInformationTextAriaLabel,
|
|
57
|
+
toolTipIsVisible: _toolTipIsVisible
|
|
58
|
+
}) => {
|
|
59
|
+
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
60
|
+
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
61
|
+
const handleKeyPress = useCallback(event => {
|
|
62
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
|
|
63
|
+
}, [toolTipIsVisible]);
|
|
64
|
+
const handleMouseOver = useCallback(() => {
|
|
65
|
+
setToolTipIsVisible(true);
|
|
66
|
+
}, []);
|
|
67
|
+
const handleMouseLeave = useCallback(() => {
|
|
68
|
+
setToolTipIsVisible(false);
|
|
69
|
+
}, []);
|
|
70
|
+
const content = useMemo(() => {
|
|
71
|
+
return isComponent ? /*#__PURE__*/React.createElement(TooltipContent, null) : /*#__PURE__*/React.createElement("p", {
|
|
72
|
+
className: style.tooltipContent
|
|
73
|
+
}, TooltipContent);
|
|
74
|
+
}, [TooltipContent, isComponent]);
|
|
75
|
+
return anchorId ? /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
76
|
+
toolTipIsVisible: _toolTipIsVisible,
|
|
77
|
+
anchorId: anchorId,
|
|
78
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
79
|
+
content: content,
|
|
80
|
+
onMouseLeave: handleMouseLeave,
|
|
81
|
+
onMouseOver: handleMouseOver
|
|
82
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: style.tooltipContainer,
|
|
84
|
+
onMouseLeave: handleMouseLeave,
|
|
85
|
+
onMouseOver: handleMouseOver
|
|
86
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
87
|
+
type: "button",
|
|
88
|
+
className: style.tooltipIconContainer,
|
|
89
|
+
"data-testid": dataTestId,
|
|
90
|
+
onKeyDown: handleKeyPress,
|
|
91
|
+
tabIndex: 0
|
|
92
|
+
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
93
|
+
className: style.informationIcon,
|
|
94
|
+
width: 12,
|
|
95
|
+
height: 12,
|
|
96
|
+
"aria-label": ariaLabel
|
|
97
|
+
})), /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
98
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
99
|
+
anchorId: anchorId,
|
|
100
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
101
|
+
content: content
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
106
|
+
TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),
|
|
107
|
+
'data-testid': PropTypes.string,
|
|
108
|
+
'aria-label': PropTypes.string,
|
|
109
|
+
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
110
|
+
// ---------- externalHandling --------------
|
|
111
|
+
// if passed down, React Tooltip is used instead, due to limitations on
|
|
112
|
+
// parents overflow hidden controls
|
|
113
|
+
anchorId: PropTypes.string,
|
|
114
|
+
toolTipIsVisible: PropTypes.bool
|
|
115
|
+
} : {};
|
|
116
|
+
export default ToolTip;
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","PropTypes","ReactTooltip","isString","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","toolTipReact","toolTip","propTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","setToolTipIsVisible","handleKeyPress","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,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC;AAJsB,CAAD,KAKjB;EACJ,IAAI,CAACH,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,oBAAC,YAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEH,KAAK,CAACM,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYF;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAEL,KAAK,CAACO,OADnB;MAEE,eAAY,SAFd;MAGE,cAAYH;IAHd,GAKGC,OALH,CADF;EASD;AACF,CA/BD;;AAiCAJ,cAAc,CAACO,SAAf,2CAA2B;EACzBN,gBAAgB,EAAEP,SAAS,CAACc,IADH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AAiB3C,SAAS,CAACiB,IAA3B,EAAiCjB,SAAS,CAACe,MAA3C,CAApB,CADE;EAElB,eAAef,SAAS,CAACe,MAFP;EAGlB,cAAcf,SAAS,CAACe,MAHN;EAIlBN,oCAAoC,EAAET,SAAS,CAACe,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACA;EACAR,QAAQ,EAAER,SAAS,CAACe,MARF;EASlBR,gBAAgB,EAAEP,SAAS,CAACc;AATV,CAApB;AAYA,eAAec,OAAf"}
|
|
@@ -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
|
+
}
|
|
@@ -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":";AA4EA,iDAWC"}
|
|
@@ -15,7 +15,7 @@ import QcmGraphic from '../questions/qcm-graphic';
|
|
|
15
15
|
import QuestionRange from '../questions/question-range';
|
|
16
16
|
import Template from '../questions/template';
|
|
17
17
|
import Audio from '../audio';
|
|
18
|
-
import { GetTranslateFromContext } from '../../atom/provider';
|
|
18
|
+
import Provider, { GetTranslateFromContext } from '../../atom/provider';
|
|
19
19
|
import style from './style.css';
|
|
20
20
|
import propTypes, { MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO } from './prop-types';
|
|
21
21
|
|
|
@@ -64,11 +64,11 @@ MediaView.propTypes = process.env.NODE_ENV !== "production" ? MediaViewPropTypes
|
|
|
64
64
|
const Switch = ({
|
|
65
65
|
model,
|
|
66
66
|
help
|
|
67
|
-
}) => {
|
|
67
|
+
}, legacyContext) => {
|
|
68
68
|
const {
|
|
69
69
|
type
|
|
70
70
|
} = model;
|
|
71
|
-
const translate = GetTranslateFromContext();
|
|
71
|
+
const translate = GetTranslateFromContext(legacyContext);
|
|
72
72
|
|
|
73
73
|
switch (type) {
|
|
74
74
|
case 'qcmDrag':
|
|
@@ -111,6 +111,9 @@ Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
111
111
|
model: propTypes.model,
|
|
112
112
|
help: propTypes.help
|
|
113
113
|
} : {};
|
|
114
|
+
Switch.contextTypes = {
|
|
115
|
+
translate: Provider.childContextTypes.translate
|
|
116
|
+
};
|
|
114
117
|
|
|
115
118
|
const Answer = props => {
|
|
116
119
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Audio","GetTranslateFromContext","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","translate","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 {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}) => {\n const {type} = model;\n const translate = GetTranslateFromContext();\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\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\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Audio","Provider","GetTranslateFromContext","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","legacyContext","translate","contextTypes","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 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\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,O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BAAT,CAA2BF;AADlB,CAAtB;;AAIA,MAAMG,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACP,KAAD;IAAQT,KAAR;IAAeU;EAAf,IAAuBM,KAA7B;EAEA,oBACE;IAAK,aAAU,QAAf;IAAwB,SAAS,EAAEvB,KAAK,CAACwB;EAAzC,GACGjB,KAAK,gBAAG,oBAAC,SAAD;IAAW,KAAK,EAAEA;EAAlB,EAAH,GAAiC,IADzC,eAEE,+CACE,oBAAC,MAAD;IAAQ,KAAK,EAAES,KAAf;IAAsB,IAAI,EAAEC;EAA5B,EADF,CAFF,CADF;AAQD,CAXD;;AAaAK,MAAM,CAACrB,SAAP,2CAAmBA,SAAnB;AAEA,eAAeqB,MAAf"}
|
|
@@ -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 {
|