@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
|
@@ -9,22 +9,30 @@ var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
|
-
var _react =
|
|
13
|
-
|
|
14
|
-
var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
13
|
|
|
16
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
15
|
|
|
16
|
+
var _uuid = require("uuid");
|
|
17
|
+
|
|
18
18
|
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
19
19
|
|
|
20
|
-
var _provider =
|
|
20
|
+
var _provider = _interopRequireWildcard(require("../../atom/provider"));
|
|
21
|
+
|
|
22
|
+
var _tooltip = _interopRequireWildcard(require("../../atom/tooltip"));
|
|
21
23
|
|
|
22
24
|
var _link = _interopRequireDefault(require("../../atom/link"));
|
|
23
25
|
|
|
24
26
|
var _engineStars = _interopRequireDefault(require("./engine-stars.css"));
|
|
25
27
|
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
26
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
33
|
|
|
34
|
+
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); }
|
|
35
|
+
|
|
28
36
|
const ICONS = {
|
|
29
37
|
microlearning: _novaIcons.NovaCompositionCoorpacademyTimer,
|
|
30
38
|
learner: _novaIcons.NovaSolidContentContentBook1,
|
|
@@ -38,125 +46,132 @@ const ICONS = {
|
|
|
38
46
|
review: _novaIcons.NovaCompositionCoorpacademyRevision
|
|
39
47
|
};
|
|
40
48
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
const ToolTipContent = ({
|
|
50
|
+
preMessage,
|
|
51
|
+
linkMessage,
|
|
52
|
+
endMessage,
|
|
53
|
+
onClick,
|
|
54
|
+
color,
|
|
55
|
+
handleContentMouseOver
|
|
56
|
+
}) => /*#__PURE__*/_react.default.createElement("p", {
|
|
57
|
+
className: _engineStars.default.toolTipContent,
|
|
58
|
+
onMouseOver: handleContentMouseOver,
|
|
59
|
+
"data-testid": "react-tooltip-content"
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, preMessage), /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
61
|
+
onClick: onClick,
|
|
62
|
+
style: {
|
|
63
|
+
color
|
|
47
64
|
}
|
|
65
|
+
}, linkMessage), /*#__PURE__*/_react.default.createElement("span", null, endMessage));
|
|
48
66
|
|
|
67
|
+
ToolTipContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
68
|
+
preMessage: _propTypes.default.string,
|
|
69
|
+
linkMessage: _propTypes.default.string,
|
|
70
|
+
endMessage: _propTypes.default.string,
|
|
71
|
+
color: _propTypes.default.string,
|
|
72
|
+
onClick: _propTypes.default.func,
|
|
73
|
+
handleContentMouseOver: _propTypes.default.func
|
|
74
|
+
} : {};
|
|
75
|
+
|
|
76
|
+
const EngineStars = (props, legacyContext) => {
|
|
77
|
+
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
78
|
+
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
49
79
|
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
onClick
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
toolTip = null,
|
|
81
|
+
disabled,
|
|
82
|
+
type,
|
|
83
|
+
stars,
|
|
84
|
+
title,
|
|
85
|
+
active = false,
|
|
86
|
+
onClick = _noop2.default,
|
|
87
|
+
className
|
|
88
|
+
} = props;
|
|
89
|
+
|
|
90
|
+
const handleClick = e => {
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
onClick(e);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const dark = (0, _get2.default)('common.dark', skin);
|
|
97
|
+
const light = (0, _get2.default)('common.light', skin);
|
|
98
|
+
const IconType = ICONS[type];
|
|
99
|
+
const primary = (0, _get2.default)('common.primary', skin); // to replace by useId when React17 is bumped to React18
|
|
100
|
+
|
|
101
|
+
const [engineStarsContentId] = (0, _react.useState)(disabled ? (0, _uuid.v5)('engine-stars', _uuid.v5.URL) : undefined);
|
|
102
|
+
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
103
|
+
const [mouseLeaveTimer, setMouseLeaveTimer] = (0, _react.useState)(undefined);
|
|
104
|
+
const buttonRef = (0, _react.useRef)(null);
|
|
105
|
+
const handleKeyPress = (0, _react.useCallback)(event => {
|
|
106
|
+
(0, _tooltip.toggleStateOnKeyPress)(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);
|
|
107
|
+
}, [toolTipIsVisible]);
|
|
108
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
109
|
+
mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
|
|
110
|
+
setToolTipIsVisible(true);
|
|
111
|
+
}, [mouseLeaveTimer]);
|
|
112
|
+
const handleContentMouseOver = (0, _react.useCallback)(() => {
|
|
113
|
+
mouseLeaveTimer &&
|
|
114
|
+
/* istanbul ignore next */
|
|
115
|
+
clearTimeout(mouseLeaveTimer);
|
|
116
|
+
}, [mouseLeaveTimer]);
|
|
117
|
+
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
118
|
+
setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));
|
|
119
|
+
}, []);
|
|
120
|
+
const toolTipContentProps = (0, _react.useMemo)(() => toolTip ? {
|
|
121
|
+
preMessage: toolTip.preMessage,
|
|
122
|
+
linkMessage: toolTip.linkMessage,
|
|
123
|
+
endMessage: toolTip.endMessage,
|
|
124
|
+
color: primary,
|
|
125
|
+
onClick: toolTip.onClick
|
|
126
|
+
} : null, [primary, toolTip]);
|
|
127
|
+
const toolTipProps = {
|
|
128
|
+
closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text')
|
|
129
|
+
};
|
|
130
|
+
const TooltipContent = (0, _react.useCallback)(_props => /*#__PURE__*/_react.default.createElement(ToolTipContent, _extends({}, _extends({}, toolTipContentProps, _props), {
|
|
131
|
+
handleContentMouseOver: handleContentMouseOver
|
|
132
|
+
})), [handleContentMouseOver, toolTipContentProps]);
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
134
|
+
ref: buttonRef,
|
|
135
|
+
"data-tip": disabled,
|
|
136
|
+
"data-engine": type,
|
|
137
|
+
"data-testid": `engine-stars-${type}` // eslint-disable-next-line no-nested-ternary
|
|
138
|
+
,
|
|
139
|
+
onClick: disabled ? handleKeyPress : active ? _noop2.default : handleClick,
|
|
140
|
+
"data-for": engineStarsContentId,
|
|
141
|
+
className: (0, _classnames.default)([_engineStars.default.engineStars, disabled ? _engineStars.default.disabled : '', active ? _engineStars.default.active : '', onClick !== _noop2.default ? _engineStars.default.clickable : null, className]),
|
|
142
|
+
type: "button",
|
|
143
|
+
"data-tooltip-place": "left",
|
|
144
|
+
onKeyDown: handleKeyPress,
|
|
145
|
+
onMouseLeave: handleMouseLeave,
|
|
146
|
+
onMouseOver: handleMouseOver
|
|
147
|
+
}, disabled ? /*#__PURE__*/_react.default.createElement(_tooltip.default, _extends({}, toolTipProps, {
|
|
148
|
+
anchorId: engineStarsContentId,
|
|
149
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
150
|
+
TooltipContent: TooltipContent,
|
|
151
|
+
mouseLeaveTimer: mouseLeaveTimer
|
|
152
|
+
})) : null, /*#__PURE__*/_react.default.createElement("span", {
|
|
153
|
+
className: _engineStars.default.engineIcon,
|
|
71
154
|
style: {
|
|
72
|
-
|
|
155
|
+
backgroundColor: onClick === _noop2.default ? light : primary
|
|
73
156
|
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
81
|
-
toolTip: _propTypes.default.shape({
|
|
82
|
-
preMessage: _propTypes.default.string,
|
|
83
|
-
linkMessage: _propTypes.default.string,
|
|
84
|
-
endMessage: _propTypes.default.string,
|
|
85
|
-
onClick: _propTypes.default.func
|
|
86
|
-
}),
|
|
87
|
-
id: _propTypes.default.string.isRequired
|
|
88
|
-
} : {};
|
|
89
|
-
|
|
90
|
-
class EngineStars extends _react.default.Component {
|
|
91
|
-
constructor(props, context) {
|
|
92
|
-
super(props, context);
|
|
93
|
-
|
|
94
|
-
this.handleClick = e => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
const {
|
|
98
|
-
onClick
|
|
99
|
-
} = this.props;
|
|
100
|
-
onClick && onClick(e);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
this.handleClick = this.handleClick.bind(this);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
render() {
|
|
107
|
-
const {
|
|
108
|
-
skin
|
|
109
|
-
} = this.context;
|
|
110
|
-
const {
|
|
111
|
-
disabled,
|
|
112
|
-
type,
|
|
113
|
-
stars,
|
|
114
|
-
title,
|
|
115
|
-
active = false,
|
|
116
|
-
onClick = _noop2.default,
|
|
117
|
-
toolTip = null
|
|
118
|
-
} = this.props;
|
|
119
|
-
const dark = (0, _get2.default)('common.dark', skin);
|
|
120
|
-
const light = (0, _get2.default)('common.light', skin);
|
|
121
|
-
const primary = (0, _get2.default)('common.primary', skin);
|
|
122
|
-
const IconType = ICONS[type];
|
|
123
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
-
"data-tip": disabled,
|
|
125
|
-
"data-engine": type,
|
|
126
|
-
onClick: disabled || active ? _noop2.default : this.handleClick,
|
|
127
|
-
"data-for": disabled && type,
|
|
128
|
-
className: (0, _classnames.default)([_engineStars.default.engineStars, disabled ? _engineStars.default.disabled : '', active ? _engineStars.default.active : '', onClick !== _noop2.default ? _engineStars.default.clickable : null])
|
|
129
|
-
}, /*#__PURE__*/_react.default.createElement(ToolTip, {
|
|
130
|
-
toolTip: toolTip,
|
|
131
|
-
id: type
|
|
132
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
133
|
-
className: _engineStars.default.engineIcon,
|
|
134
|
-
style: {
|
|
135
|
-
backgroundColor: onClick === _noop2.default ? light : primary
|
|
136
|
-
}
|
|
137
|
-
}, /*#__PURE__*/_react.default.createElement(IconType, {
|
|
138
|
-
className: _engineStars.default.iconHeader,
|
|
139
|
-
width: "30"
|
|
140
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
-
className: _engineStars.default.score,
|
|
142
|
-
style: {
|
|
143
|
-
color: active ? primary : dark
|
|
144
|
-
}
|
|
145
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
146
|
-
"data-name": "star-counter"
|
|
147
|
-
}, stars), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyStar, {
|
|
148
|
-
className: _engineStars.default.iconStar,
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement(IconType, {
|
|
158
|
+
className: _engineStars.default.iconHeader,
|
|
159
|
+
width: "30"
|
|
160
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
161
|
+
className: _engineStars.default.score,
|
|
162
|
+
style: {
|
|
149
163
|
color: active ? primary : dark
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
}
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
166
|
+
"data-name": "star-counter"
|
|
167
|
+
}, stars), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyStar, {
|
|
168
|
+
className: _engineStars.default.iconStar,
|
|
169
|
+
color: active ? primary : dark
|
|
170
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
171
|
+
className: _engineStars.default.scoreTitle
|
|
172
|
+
}, title));
|
|
159
173
|
};
|
|
174
|
+
|
|
160
175
|
EngineStars.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
161
176
|
type: _propTypes.default.string.isRequired,
|
|
162
177
|
stars: _propTypes.default.number.isRequired,
|
|
@@ -164,6 +179,7 @@ EngineStars.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
164
179
|
active: _propTypes.default.bool,
|
|
165
180
|
disabled: _propTypes.default.bool,
|
|
166
181
|
onClick: _propTypes.default.func,
|
|
182
|
+
className: _propTypes.default.string,
|
|
167
183
|
toolTip: _propTypes.default.shape({
|
|
168
184
|
preMessage: _propTypes.default.string,
|
|
169
185
|
linkMessage: _propTypes.default.string,
|
|
@@ -171,6 +187,9 @@ EngineStars.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
171
187
|
onClick: _propTypes.default.func
|
|
172
188
|
})
|
|
173
189
|
} : {};
|
|
190
|
+
EngineStars.contextTypes = {
|
|
191
|
+
skin: _provider.default.childContextTypes.skin
|
|
192
|
+
};
|
|
174
193
|
var _default = EngineStars;
|
|
175
194
|
exports.default = _default;
|
|
176
195
|
//# sourceMappingURL=engine-stars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stars.js","names":["ICONS","microlearning","TimerIcon","learner","LearnerIcon","battle","BoltIcon","certifications","CertificationIcon","bonus","BonusIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ToolTip","toolTip","id","context","skin","preMessage","endMessage","linkMessage","onClick","primary","handleClick","style","toolTipContent","color","contextTypes","Provider","childContextTypes","propTypes","PropTypes","shape","string","func","isRequired","EngineStars","React","Component","constructor","props","e","stopPropagation","preventDefault","bind","render","disabled","type","stars","title","active","dark","light","IconType","classnames","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","number","bool"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React from 'react';\nimport ReactTooltip from 'react-tooltip';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider from '../../atom/provider';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTip = ({toolTip, id}, context) => {\n if (!toolTip) {\n return null;\n }\n\n const {skin} = context;\n const {preMessage, endMessage, linkMessage, onClick} = toolTip;\n const primary = get('common.primary', skin);\n\n const handleClick = onClick;\n\n return (\n <ReactTooltip\n id={id}\n className={style.toolTip}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n delayHide={500}\n >\n <p className={style.toolTipContent}>\n <span>{`${preMessage}`}</span>\n <Link\n onClick={handleClick}\n style={{\n color: primary\n }}\n >\n {`${linkMessage}`}\n </Link>\n <span>{`${endMessage}`}</span>\n </p>\n </ReactTooltip>\n );\n};\n\nToolTip.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nToolTip.propTypes = {\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n }),\n id: PropTypes.string.isRequired\n};\n\nclass EngineStars extends React.Component {\n static propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin\n };\n\n constructor(props, context) {\n super(props, context);\n this.handleClick = this.handleClick.bind(this);\n }\n\n handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n const {onClick} = this.props;\n onClick && onClick(e);\n };\n\n render() {\n const {skin} = this.context;\n const {\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n toolTip = null\n } = this.props;\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const primary = get('common.primary', skin);\n const IconType = ICONS[type];\n\n return (\n <div\n data-tip={disabled}\n data-engine={type}\n onClick={disabled || active ? noop : this.handleClick}\n data-for={disabled && type}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null\n ])}\n >\n <ToolTip toolTip={toolTip} id={type} />\n\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon className={style.iconStar} color={active ? primary : dark} />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </div>\n );\n }\n}\n\nexport default EngineStars;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAaA;;AACA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,aAAa,EAAEC,2CADH;EAEZC,OAAO,EAAEC,uCAFG;EAGZC,MAAM,EAAEC,0CAHI;EAIZC,cAAc,EAAEC,8CAJJ;EAKZC,KAAK,EAAEC,4CALK;EAMZC,OAAO,EAAEC,6CANG;EAOZC,KAAK,EAAEC,2CAPK;EAQZC,KAAK,EAAEC,2CARK;EASZC,OAAO,EAAEC,gDATG;EAUZC,MAAM,EAAEC;AAVI,CAAd;;AAaA,MAAMC,OAAO,GAAG,CAAC;EAACC,OAAD;EAAUC;AAAV,CAAD,EAAgBC,OAAhB,KAA4B;EAC1C,IAAI,CAACF,OAAL,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AFA;IAGvBd,UAAU,EAAEY,kBAAA,CAAUE,MAHC;IAIvBZ,OAAO,EAAEU,kBAAA,CAAUG;EAJI,CAAhB;AAPQ,C;eAuFNE,W"}
|
|
1
|
+
{"version":3,"file":"engine-stars.js","names":["ICONS","microlearning","TimerIcon","learner","LearnerIcon","battle","BoltIcon","certifications","CertificationIcon","bonus","BonusIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ToolTipContent","preMessage","linkMessage","endMessage","onClick","color","handleContentMouseOver","style","toolTipContent","propTypes","PropTypes","string","func","EngineStars","props","legacyContext","skin","GetSkinFromContext","translate","GetTranslateFromContext","toolTip","disabled","type","stars","title","active","className","handleClick","e","stopPropagation","preventDefault","dark","light","IconType","primary","engineStarsContentId","useState","uuidV5","URL","undefined","toolTipIsVisible","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","buttonRef","useRef","handleKeyPress","useCallback","event","toggleStateOnKeyPress","handleMouseOver","clearTimeout","handleMouseLeave","setTimeout","toolTipContentProps","useMemo","toolTipProps","closeToolTipInformationTextAriaLabel","TooltipContent","_props","classnames","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","isRequired","number","bool","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React, {useCallback, useMemo, useState, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {v5 as uuidV5} from 'uuid';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTipContent = ({\n preMessage,\n linkMessage,\n endMessage,\n onClick,\n color,\n handleContentMouseOver\n}) => (\n <p\n className={style.toolTipContent}\n onMouseOver={handleContentMouseOver}\n data-testid=\"react-tooltip-content\"\n >\n <span>{preMessage}</span>\n <Link\n onClick={onClick}\n style={{\n color\n }}\n >\n {linkMessage}\n </Link>\n <span>{endMessage}</span>\n </p>\n);\n\nToolTipContent.propTypes = {\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n color: PropTypes.string,\n onClick: PropTypes.func,\n handleContentMouseOver: PropTypes.func\n};\n\nconst EngineStars = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const {\n toolTip = null,\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n className\n } = props;\n\n const handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n };\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const IconType = ICONS[type];\n\n const primary = get('common.primary', skin);\n\n // to replace by useId when React17 is bumped to React18\n const [engineStarsContentId] = useState(\n disabled ? uuidV5('engine-stars', uuidV5.URL) : undefined\n );\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n const buttonRef = useRef(null);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));\n }, []);\n\n const toolTipContentProps = useMemo(\n () =>\n toolTip\n ? {\n preMessage: toolTip.preMessage,\n linkMessage: toolTip.linkMessage,\n endMessage: toolTip.endMessage,\n color: primary,\n onClick: toolTip.onClick\n }\n : null,\n [primary, toolTip]\n );\n\n const toolTipProps = {\n closeToolTipInformationTextAriaLabel: translate(\n 'Press the escape key to close the information text'\n )\n };\n\n const TooltipContent = useCallback(\n _props => (\n <ToolTipContent\n {...{...toolTipContentProps, ..._props}}\n handleContentMouseOver={handleContentMouseOver}\n />\n ),\n [handleContentMouseOver, toolTipContentProps]\n );\n\n return (\n <button\n ref={buttonRef}\n data-tip={disabled}\n data-engine={type}\n data-testid={`engine-stars-${type}`}\n // eslint-disable-next-line no-nested-ternary\n onClick={disabled ? handleKeyPress : active ? noop : handleClick}\n data-for={engineStarsContentId}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null,\n className\n ])}\n type=\"button\"\n data-tooltip-place=\"left\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {disabled ? (\n <ToolTip\n {...toolTipProps}\n anchorId={engineStarsContentId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n mouseLeaveTimer={mouseLeaveTimer}\n />\n ) : null}\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon className={style.iconStar} color={active ? primary : dark} />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </button>\n );\n};\n\nEngineStars.propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nEngineStars.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default EngineStars;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,aAAa,EAAEC,2CADH;EAEZC,OAAO,EAAEC,uCAFG;EAGZC,MAAM,EAAEC,0CAHI;EAIZC,cAAc,EAAEC,8CAJJ;EAKZC,KAAK,EAAEC,4CALK;EAMZC,OAAO,EAAEC,6CANG;EAOZC,KAAK,EAAEC,2CAPK;EAQZC,KAAK,EAAEC,2CARK;EASZC,OAAO,EAAEC,gDATG;EAUZC,MAAM,EAAEC;AAVI,CAAd;;AAaA,MAAMC,cAAc,GAAG,CAAC;EACtBC,UADsB;EAEtBC,WAFsB;EAGtBC,UAHsB;EAItBC,OAJsB;EAKtBC,KALsB;EAMtBC;AANsB,CAAD,kBAQrB;EACE,SAAS,EAAEC,oBAAA,CAAMC,cADnB;EAEE,WAAW,EAAEF,sBAFf;EAGE,eAAY;AAHd,gBAKE,2CAAOL,UAAP,CALF,eAME,6BAAC,aAAD;EACE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EACzBzD,IAAI,EAAE0D,iBAAA,CAASC,iBAAT,CAA2B3D;AADR,CAA3B;eAIeH,W"}
|
|
@@ -39,6 +39,7 @@ declare namespace Progression {
|
|
|
39
39
|
active: PropTypes.Requireable<boolean>;
|
|
40
40
|
disabled: PropTypes.Requireable<boolean>;
|
|
41
41
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
|
+
className: PropTypes.Requireable<string>;
|
|
42
43
|
toolTip: PropTypes.Requireable<PropTypes.InferProps<{
|
|
43
44
|
preMessage: PropTypes.Requireable<string>;
|
|
44
45
|
linkMessage: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/activity/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/activity/index.js"],"names":[],"mappings":";AAmBA,0EA0GC"}
|
|
@@ -9,6 +9,10 @@ var _get = _interopRequireDefault(require("lodash/fp/get"));
|
|
|
9
9
|
|
|
10
10
|
var _isEmpty = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
11
11
|
|
|
12
|
+
var _map = _interopRequireDefault(require("lodash/fp/map"));
|
|
13
|
+
|
|
14
|
+
var _noop = _interopRequireDefault(require("lodash/fp/noop"));
|
|
15
|
+
|
|
12
16
|
var _omit = _interopRequireDefault(require("lodash/fp/omit"));
|
|
13
17
|
|
|
14
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -39,6 +43,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
39
43
|
|
|
40
44
|
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); }
|
|
41
45
|
|
|
46
|
+
const mapWithIndex = _map.default.convert({
|
|
47
|
+
cap: false
|
|
48
|
+
});
|
|
49
|
+
|
|
42
50
|
const Progression = (props, legacyContext) => {
|
|
43
51
|
const {
|
|
44
52
|
mainTitle,
|
|
@@ -59,9 +67,9 @@ const Progression = (props, legacyContext) => {
|
|
|
59
67
|
e.stopPropagation();
|
|
60
68
|
e.preventDefault();
|
|
61
69
|
const {
|
|
62
|
-
onClick
|
|
70
|
+
onClick = _noop.default
|
|
63
71
|
} = recommendation;
|
|
64
|
-
onClick
|
|
72
|
+
onClick(e);
|
|
65
73
|
}, [recommendation]);
|
|
66
74
|
const handleSelectTheme = (0, _react.useCallback)(e => {
|
|
67
75
|
themeFilterOnChange && themeFilterOnChange(e);
|
|
@@ -70,10 +78,10 @@ const Progression = (props, legacyContext) => {
|
|
|
70
78
|
const loader = loading ? /*#__PURE__*/_react.default.createElement("div", {
|
|
71
79
|
className: _style.default.loader
|
|
72
80
|
}, /*#__PURE__*/_react.default.createElement(_loader.default, null)) : null;
|
|
73
|
-
const allProgressions =
|
|
74
|
-
key: progression.ref
|
|
81
|
+
const allProgressions = mapWithIndex((progression, index) => /*#__PURE__*/_react.default.createElement(_progressionItem.default, _extends({}, (0, _omit.default)(['ref'], progression), {
|
|
82
|
+
key: `${index}-${progression.ref}`,
|
|
75
83
|
adaptiveAriaLabel: adaptiveAriaLabel
|
|
76
|
-
})));
|
|
84
|
+
})), progressions);
|
|
77
85
|
|
|
78
86
|
const coreProgression = /*#__PURE__*/_react.default.createElement("div", {
|
|
79
87
|
"data-name": "activityCore",
|
|
@@ -111,13 +119,17 @@ const Progression = (props, legacyContext) => {
|
|
|
111
119
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
112
120
|
className: _style.default.default
|
|
113
121
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
114
|
-
"data-name": "activity-header"
|
|
122
|
+
"data-name": "activity-header",
|
|
123
|
+
tabIndex: 0
|
|
115
124
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
116
|
-
className: _style.default.mainTitle
|
|
125
|
+
className: _style.default.mainTitle,
|
|
126
|
+
tabIndex: 0
|
|
117
127
|
}, /*#__PURE__*/_react.default.createElement("span", null, mainTitle), " ", mainSubtitle), /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
-
className: _style.default.headerProgression
|
|
128
|
+
className: _style.default.headerProgression,
|
|
129
|
+
tabIndex: 0
|
|
119
130
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
-
className: _style.default.wrapperCta
|
|
131
|
+
className: _style.default.wrapperCta,
|
|
132
|
+
tabIndex: 0
|
|
121
133
|
}, themeSelect, recommendationSection), /*#__PURE__*/_react.default.createElement(_starsSummary.default, {
|
|
122
134
|
engines: engines,
|
|
123
135
|
total: total
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Progression","props","legacyContext","mainTitle","mainSubtitle","recommendation","progressions","adaptiveAriaLabel","total","engines","themeFilter","loading","skin","GetSkinFromContext","onChange","themeFilterOnChange","handleClick","useCallback","e","stopPropagation","preventDefault","onClick","handleSelectTheme","primary","get","loader","style","allProgressions","
|
|
1
|
+
{"version":3,"file":"index.js","names":["mapWithIndex","map","convert","cap","Progression","props","legacyContext","mainTitle","mainSubtitle","recommendation","progressions","adaptiveAriaLabel","total","engines","themeFilter","loading","skin","GetSkinFromContext","onChange","themeFilterOnChange","handleClick","useCallback","e","stopPropagation","preventDefault","onClick","noop","handleSelectTheme","primary","get","loader","style","allProgressions","progression","index","omit","ref","coreProgression","core","themeSelect","isEmpty","options","selectBorder","select","recommendationSection","recommendationWrapper","title","subtitle","classnames","course","innerHTML","__html","courseTitle","cta","backgroundColor","default","headerProgression","wrapperCta","wrapperProgression","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","isRequired","shape","label","stars","number","arrayOf","EngineStars","bool","ProgressionItem","Select","func"],"sources":["../../../src/template/activity/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport get from 'lodash/fp/get';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport map from 'lodash/fp/map';\nimport noop from 'lodash/fp/noop';\nimport omit from 'lodash/fp/omit';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport Button from '../../atom/button';\nimport Select from '../../atom/select';\nimport Loader from '../../atom/loader';\nimport ProgressionItem from './progression-item';\nimport EngineStars from './engine-stars';\nimport StarsSummary from './stars-summary';\nimport style from './style.css';\n\nconst mapWithIndex = map.convert({cap: false});\n\nconst Progression = (props, legacyContext) => {\n const {\n mainTitle,\n mainSubtitle,\n recommendation = {},\n progressions = [],\n adaptiveAriaLabel,\n total,\n engines = [],\n themeFilter = {},\n loading\n } = props;\n const skin = GetSkinFromContext(legacyContext);\n const {onChange: themeFilterOnChange} = themeFilter;\n\n const handleClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n const {onClick = noop} = recommendation;\n onClick(e);\n },\n [recommendation]\n );\n\n const handleSelectTheme = useCallback(\n e => {\n themeFilterOnChange && themeFilterOnChange(e);\n },\n [themeFilterOnChange]\n );\n\n const primary = get('common.primary', skin);\n const loader = loading ? (\n <div className={style.loader}>\n <Loader />\n </div>\n ) : null;\n const allProgressions = mapWithIndex(\n (progression, index) => (\n <ProgressionItem\n {...omit(['ref'], progression)}\n key={`${index}-${progression.ref}`}\n adaptiveAriaLabel={adaptiveAriaLabel}\n />\n ),\n progressions\n );\n\n const coreProgression = (\n <div data-name=\"activityCore\" className={style.core}>\n {allProgressions}\n </div>\n );\n const themeSelect = !isEmpty(themeFilter.options) ? (\n <Select\n borderClassName={style.selectBorder}\n className={style.select}\n theme=\"thematiques\"\n options={themeFilter.options}\n onChange={handleSelectTheme}\n />\n ) : null;\n const recommendationSection = !isEmpty(recommendation) ? (\n <div className={style.recommendationWrapper}>\n <p className={style.recommendationSection}>{recommendation.title} </p>\n <p className={style.recommendationSection}>\n <span>{recommendation.subtitle} </span>\n <span\n className={classnames(style.course, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: recommendation.courseTitle}}\n />\n </p>\n <Button\n type=\"link\"\n onClick={handleClick}\n submitValue={recommendation.cta}\n style={{\n backgroundColor: primary\n }}\n className={style.cta}\n />\n </div>\n ) : null;\n\n return (\n <div className={style.default}>\n <div data-name=\"activity-header\" tabIndex={0}>\n <div className={style.mainTitle} tabIndex={0}>\n <span>{mainTitle}</span> {mainSubtitle}\n </div>\n <div className={style.headerProgression} tabIndex={0}>\n <div className={style.wrapperCta} tabIndex={0}>\n {themeSelect}\n {recommendationSection}\n </div>\n <StarsSummary engines={engines} total={total} />\n </div>\n </div>\n <div className={style.wrapperProgression} data-name=\"activityList\">\n {coreProgression}\n {loader}\n </div>\n </div>\n );\n};\n\nProgression.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nProgression.propTypes = {\n mainTitle: PropTypes.string.isRequired,\n mainSubtitle: PropTypes.string.isRequired,\n adaptiveAriaLabel: PropTypes.string,\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n loading: PropTypes.bool.isRequired,\n progressions: PropTypes.arrayOf(\n PropTypes.shape({...ProgressionItem.propTypes, ref: PropTypes.string.isRequired})\n ),\n themeFilter: PropTypes.shape({\n options: Select.propTypes.options.isRequired,\n onChange: Select.propTypes.onChange\n }),\n recommendation: PropTypes.shape({\n cta: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string.isRequired,\n courseTitle: PropTypes.string.isRequired,\n onClick: PropTypes.func\n })\n};\n\nexport default Progression;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,YAAA,CAAIC,OAAJ,CAAY;EAACC,GAA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AAUG,KAAV,cAAoBO,wBAAA,CAAgBX,SAApC;IAA+C1B,GAAG,EAAE2B,kBAAA,CAAUC,MAAV,CAAiBC;EAArE,GADY,CAVQ;EAatBnD,WAAW,EAAEiD,kBAAA,CAAUG,KAAV,CAAgB;IAC3BzB,OAAO,EAAEiC,eAAA,CAAOZ,SAAP,CAAiBrB,OAAjB,CAAyBwB,UADP;IAE3B/C,QAAQ,EAAEwD,eAAA,CAAOZ,SAAP,CAAiB5C;EAFA,CAAhB,CAbS;EAiBtBT,cAAc,EAAEsD,kBAAA,CAAUG,KAAV,CAAgB;IAC9Bb,GAAG,EAAEU,kBAAA,CAAUC,MAAV,CAAiBC,UADQ;IAE9BnB,KAAK,EAAEiB,kBAAA,CAAUC,MAAV,CAAiBC,UAFM;IAG9BlB,QAAQ,EAAEgB,kBAAA,CAAUC,MAAV,CAAiBC,UAHG;IAI9Bb,WAAW,EAAEW,kBAAA,CAAUC,MAAV,CAAiBC,UAJA;IAK9BxC,OAAO,EAAEsC,kBAAA,CAAUY;EALW,CAAhB;AAjBM,CAAxB;eA0BevE,W"}
|
|
@@ -76,7 +76,7 @@ const ProgressionItem = (props, context) => {
|
|
|
76
76
|
const handleCTAClick = (0, _react.useMemo)(() => e => {
|
|
77
77
|
e.stopPropagation();
|
|
78
78
|
e.preventDefault();
|
|
79
|
-
onClick
|
|
79
|
+
onClick(e);
|
|
80
80
|
}, [onClick]);
|
|
81
81
|
const link = disabled ? null : /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
82
82
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progression-item.js","names":["ICONS","chapter","TimerIcon","course","LearnerIcon","battle","BoltIcon","certification","CertificationIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ProgressionItem","props","context","skin","disabled","adaptive","completion","label","level","onClick","stars","maxStars","state","type","steps","adaptiveAriaLabel","dark","primary","white","IconType","adaptiveIcon","style","backgroundColor","handleCTAClick","useMemo","e","stopPropagation","preventDefault","link","color","cta","classnames","progressionItem","wrapperTitle","iconType","innerHTML","__html","smallStars","iconStar","borderRadius","propTypes","PropTypes","number","isRequired","bool","string","func","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/progression-item.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRightIcon,\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaCompositionCoorpacademyAdaptive as AdaptiveIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider from '../../atom/provider';\nimport ProgressBar from '../../molecule/progress-bar';\nimport Link from '../../atom/link';\nimport style from './progression-item.css';\n\nconst ICONS = {\n chapter: TimerIcon,\n course: LearnerIcon,\n battle: BoltIcon,\n certification: CertificationIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ProgressionItem = (props, context) => {\n const {skin} = context;\n const {\n disabled = false,\n adaptive,\n completion,\n label,\n level,\n onClick = noop,\n stars,\n maxStars,\n state,\n type,\n steps = 0,\n adaptiveAriaLabel\n } = props;\n\n const dark = get('common.dark', skin);\n const primary = get('common.primary', skin);\n const white = get('common.white', skin);\n const IconType = ICONS[type];\n\n const adaptiveIcon = adaptive ? (\n <div\n className={style.adaptiveIcon}\n style={{\n backgroundColor: primary\n }}\n >\n <AdaptiveIcon color={white} height={14} aria-label={adaptiveAriaLabel} />\n </div>\n ) : null;\n\n const handleCTAClick = useMemo(\n () => e => {\n e.stopPropagation();\n e.preventDefault();\n onClick
|
|
1
|
+
{"version":3,"file":"progression-item.js","names":["ICONS","chapter","TimerIcon","course","LearnerIcon","battle","BoltIcon","certification","CertificationIcon","article","ArticleIcon","scorm","ScormIcon","video","VideoIcon","podcast","PodcastIcon","review","RevisionIcon","ProgressionItem","props","context","skin","disabled","adaptive","completion","label","level","onClick","stars","maxStars","state","type","steps","adaptiveAriaLabel","dark","primary","white","IconType","adaptiveIcon","style","backgroundColor","handleCTAClick","useMemo","e","stopPropagation","preventDefault","link","color","cta","classnames","progressionItem","wrapperTitle","iconType","innerHTML","__html","smallStars","iconStar","borderRadius","propTypes","PropTypes","number","isRequired","bool","string","func","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/progression-item.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRightIcon,\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaCompositionCoorpacademyAdaptive as AdaptiveIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider from '../../atom/provider';\nimport ProgressBar from '../../molecule/progress-bar';\nimport Link from '../../atom/link';\nimport style from './progression-item.css';\n\nconst ICONS = {\n chapter: TimerIcon,\n course: LearnerIcon,\n battle: BoltIcon,\n certification: CertificationIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ProgressionItem = (props, context) => {\n const {skin} = context;\n const {\n disabled = false,\n adaptive,\n completion,\n label,\n level,\n onClick = noop,\n stars,\n maxStars,\n state,\n type,\n steps = 0,\n adaptiveAriaLabel\n } = props;\n\n const dark = get('common.dark', skin);\n const primary = get('common.primary', skin);\n const white = get('common.white', skin);\n const IconType = ICONS[type];\n\n const adaptiveIcon = adaptive ? (\n <div\n className={style.adaptiveIcon}\n style={{\n backgroundColor: primary\n }}\n >\n <AdaptiveIcon color={white} height={14} aria-label={adaptiveAriaLabel} />\n </div>\n ) : null;\n\n const handleCTAClick = useMemo(\n () => e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n },\n [onClick]\n );\n\n const link = disabled ? null : (\n <Link style={{color: primary}} onClick={handleCTAClick} data-progression-state={state}>\n <span className={style.cta}>\n {state} <ArrowRightIcon color={primary} height={12} width={20} />\n </span>\n </Link>\n );\n\n return (\n <div className={classnames(style.progressionItem, disabled ? style.disabled : '')}>\n <div className={style.wrapperTitle}>\n <IconType className={style.iconType} color={dark} />\n <div data-name=\"activityLabel\" className={style.label} title={label}>\n <div\n className={style.innerHTML}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: label}}\n />\n {adaptiveIcon}\n </div>\n\n <div\n data-name=\"activityStars\"\n className={style.stars}\n style={{\n color: primary\n }}\n >\n {stars}\n {maxStars ? ' /' : null}\n {maxStars ? <span className={style.smallStars}>{maxStars}</span> : null}{' '}\n <StarIcon className={style.iconStar} color={primary} />\n </div>\n </div>\n <ProgressBar\n className={style.completion}\n value={completion * 100}\n max={100}\n steps={steps}\n style={{backgroundColor: primary, borderRadius: 0}}\n />\n <div className={style.state}>\n {link}\n <span className={style.level}>{level}</span>\n </div>\n </div>\n );\n};\n\nProgressionItem.propTypes = {\n completion: PropTypes.number.isRequired,\n stars: PropTypes.number.isRequired,\n maxStars: PropTypes.number,\n steps: PropTypes.number,\n disabled: PropTypes.bool,\n label: PropTypes.string.isRequired,\n level: PropTypes.string.isRequired,\n state: PropTypes.string.isRequired,\n adaptiveAriaLabel: PropTypes.string,\n type: PropTypes.string.isRequired,\n adaptive: PropTypes.bool.isRequired,\n onClick: PropTypes.func\n};\n\nProgressionItem.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default ProgressionItem;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAcA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,OAAO,EAAEC,2CADG;EAEZC,MAAM,EAAEC,uCAFI;EAGZC,MAAM,EAAEC,0CAHI;EAIZC,aAAa,EAAEC,8CAJH;EAKZC,OAAO,EAAEC,6CALG;EAMZC,KAAK,EAAEC,2CANK;EAOZC,KAAK,EAAEC,2CAPK;EAQZC,OAAO,EAAEC,gDARG;EASZC,MAAM,EAAEC;AATI,CAAd;;AAYA,MAAMC,eAAe,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC1C,MAAM;IAACC;EAAD,IAASD,OAAf;EACA,MAAM;IACJE,QAAQ,GAAG,KADP;IAEJC,QAFI;IAGJC,UAHI;IAIJC,KAJI;IAKJC,KALI;IAMJC,OAAO,iBANH;IAOJC,KAPI;IAQJC,QARI;IASJC,KATI;IAUJC,IAVI;IAWJC,KAAK,GAAG,CAXJ;IAYJC;EAZI,IAaFd,KAbJ;EAeA,MAAMe,IAAI,GAAG,mBAAI,aAAJ,EAAmBb,IAAnB,CAAb;EACA,MAAMc,OAAO,GAAG,mBAAI,gBAAJ,EAAsBd,IAAtB,CAAhB;EACA,MAAMe,KAAK,GAAG,mBAAI,cAAJ,EAAoBf,IAApB,CAAd;EACA,MAAMgB,QAAQ,GAAGtC,KAAK,CAACgC,IAAD,CAAtB;EAEA,MAAMO,YAAY,GAAGf,QAAQ,gBAC3B;IACE,SAAS,E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V,CAAiBF,UARE;EAS1B5B,iBAAiB,EAAE0B,kBAAA,CAAUI,MATH;EAU1BhC,IAAI,EAAE4B,kBAAA,CAAUI,MAAV,CAAiBF,UAVG;EAW1BtC,QAAQ,EAAEoC,kBAAA,CAAUG,IAAV,CAAeD,UAXC;EAY1BlC,OAAO,EAAEgC,kBAAA,CAAUK;AAZO,CAA5B;AAeA9C,eAAe,CAAC+C,YAAhB,GAA+B;EAC7B5C,IAAI,EAAE6C,iBAAA,CAASC,iBAAT,CAA2B9C;AADJ,CAA/B;eAIeH,e"}
|
|
@@ -13,6 +13,7 @@ declare namespace StarsSummary {
|
|
|
13
13
|
active: PropTypes.Requireable<boolean>;
|
|
14
14
|
disabled: PropTypes.Requireable<boolean>;
|
|
15
15
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
className: PropTypes.Requireable<string>;
|
|
16
17
|
toolTip: PropTypes.Requireable<PropTypes.InferProps<{
|
|
17
18
|
preMessage: PropTypes.Requireable<string>;
|
|
18
19
|
linkMessage: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stars-summary.d.ts","sourceRoot":"","sources":["../../../src/template/activity/stars-summary.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"stars-summary.d.ts","sourceRoot":"","sources":["../../../src/template/activity/stars-summary.js"],"names":[],"mappings":";AA2DA,kFAoFC"}
|
|
@@ -46,6 +46,7 @@ const EngineTab = ({
|
|
|
46
46
|
key: type,
|
|
47
47
|
"data-name": dataName
|
|
48
48
|
}, /*#__PURE__*/_react.default.createElement(_engineStars.default, _extends({}, engine, {
|
|
49
|
+
key: type,
|
|
49
50
|
className: engineIndex < firstItemIndex ? _starsSummary.default.hidden : _starsSummary.default.active
|
|
50
51
|
})));
|
|
51
52
|
};
|
|
@@ -97,11 +98,12 @@ const StarsSummary = (props, legacyContext) => {
|
|
|
97
98
|
return null;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
const leftArrowView = totalItems > 6 && firstItemIndex > 0 ? /*#__PURE__*/_react.default.createElement("
|
|
101
|
+
const leftArrowView = totalItems > 6 && firstItemIndex > 0 ? /*#__PURE__*/_react.default.createElement("button", {
|
|
101
102
|
className: _starsSummary.default.circle,
|
|
102
103
|
onClick: handleOnLeft,
|
|
103
104
|
"data-name": "left-arrow",
|
|
104
|
-
"data-testid": "stars-summary-left-arrow"
|
|
105
|
+
"data-testid": "stars-summary-left-arrow",
|
|
106
|
+
type: "button"
|
|
105
107
|
}, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowLeft, {
|
|
106
108
|
color: dark,
|
|
107
109
|
className: _starsSummary.default.left,
|
|
@@ -121,15 +123,18 @@ const StarsSummary = (props, legacyContext) => {
|
|
|
121
123
|
})) : null;
|
|
122
124
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
123
125
|
"data-name": "myStars",
|
|
124
|
-
className: _starsSummary.default.myStars
|
|
126
|
+
className: _starsSummary.default.myStars,
|
|
127
|
+
tabIndex: 0
|
|
125
128
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
129
|
"data-name": "myStars-wrapper",
|
|
127
130
|
className: _starsSummary.default.myStarsWrapper,
|
|
128
|
-
"data-testid": `stars-summary-engine-index-${firstItemIndex}
|
|
131
|
+
"data-testid": `stars-summary-engine-index-${firstItemIndex}`,
|
|
132
|
+
tabIndex: 0
|
|
129
133
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
130
134
|
className: _starsSummary.default.allStars,
|
|
131
135
|
"data-name": "engineList",
|
|
132
|
-
"data-testid": "stars-summary-engine-tabs"
|
|
136
|
+
"data-testid": "stars-summary-engine-tabs",
|
|
137
|
+
tabIndex: 0
|
|
133
138
|
}, /*#__PURE__*/_react.default.createElement(EngineTabs, {
|
|
134
139
|
engines: engines,
|
|
135
140
|
firstItemIndex: firstItemIndex
|