@coorpacademy/components 11.9.1 → 11.9.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/es/atom/review-presentation/index.d.ts.map +1 -1
  2. package/es/atom/review-presentation/index.js +12 -62
  3. package/es/atom/review-presentation/index.js.map +1 -1
  4. package/es/atom/review-presentation/style.css +7 -67
  5. package/es/atom/tooltip/index.d.ts +22 -0
  6. package/es/atom/tooltip/index.d.ts.map +1 -0
  7. package/es/atom/tooltip/index.js +117 -0
  8. package/es/atom/tooltip/index.js.map +1 -0
  9. package/es/atom/tooltip/style.css +96 -0
  10. package/es/template/activity/engine-stars.css +16 -33
  11. package/es/template/activity/engine-stars.d.ts +15 -17
  12. package/es/template/activity/engine-stars.d.ts.map +1 -1
  13. package/es/template/activity/engine-stars.js +128 -115
  14. package/es/template/activity/engine-stars.js.map +1 -1
  15. package/es/template/activity/index.d.ts +1 -0
  16. package/es/template/activity/index.d.ts.map +1 -1
  17. package/es/template/activity/index.js +18 -9
  18. package/es/template/activity/index.js.map +1 -1
  19. package/es/template/activity/progression-item.js +1 -1
  20. package/es/template/activity/progression-item.js.map +1 -1
  21. package/es/template/activity/stars-summary.d.ts +1 -0
  22. package/es/template/activity/stars-summary.d.ts.map +1 -1
  23. package/es/template/activity/stars-summary.js +10 -5
  24. package/es/template/activity/stars-summary.js.map +1 -1
  25. package/lib/atom/review-presentation/index.d.ts.map +1 -1
  26. package/lib/atom/review-presentation/index.js +13 -66
  27. package/lib/atom/review-presentation/index.js.map +1 -1
  28. package/lib/atom/review-presentation/style.css +7 -67
  29. package/lib/atom/tooltip/index.d.ts +22 -0
  30. package/lib/atom/tooltip/index.d.ts.map +1 -0
  31. package/lib/atom/tooltip/index.js +137 -0
  32. package/lib/atom/tooltip/index.js.map +1 -0
  33. package/lib/atom/tooltip/style.css +96 -0
  34. package/lib/template/activity/engine-stars.css +16 -33
  35. package/lib/template/activity/engine-stars.d.ts +15 -17
  36. package/lib/template/activity/engine-stars.d.ts.map +1 -1
  37. package/lib/template/activity/engine-stars.js +135 -116
  38. package/lib/template/activity/engine-stars.js.map +1 -1
  39. package/lib/template/activity/index.d.ts +1 -0
  40. package/lib/template/activity/index.d.ts.map +1 -1
  41. package/lib/template/activity/index.js +21 -9
  42. package/lib/template/activity/index.js.map +1 -1
  43. package/lib/template/activity/progression-item.js +1 -1
  44. package/lib/template/activity/progression-item.js.map +1 -1
  45. package/lib/template/activity/stars-summary.d.ts +1 -0
  46. package/lib/template/activity/stars-summary.d.ts.map +1 -1
  47. package/lib/template/activity/stars-summary.js +10 -5
  48. package/lib/template/activity/stars-summary.js.map +1 -1
  49. package/locales/en/global.json +1 -0
  50. package/package.json +4 -3
  51. package/locales/.mtslconfig.json +0 -1
@@ -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
- .toolTip {
160
- opacity: 1 !important;
161
- padding: 0;
162
- pointer-events: all;
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
- padding: 10px;
172
- margin: 0;
173
- border-radius: 3px;
174
- font-family: 'Gilroy';
175
- font-size: 12px;
170
+ composes: textBase;
176
171
  width: 270px;
177
- background-color: white;
178
- border: 1px solid white;
179
- color: dark;
180
- box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 8px 3px 10px rgba(0, 0, 0, 0.23);
172
+ font-weight: 500;
173
+ font-size: 14px;
174
+ display: inline-block;
175
+ border-radius: 3px;
176
+ word-wrap: break-word;
177
+ padding: 8px 14px;
178
+ text-align: center;
181
179
  }
182
180
 
183
181
  .toolTipContent > a {
@@ -191,21 +189,6 @@
191
189
  text-decoration: underline;
192
190
  }
193
191
 
194
- .toolTipContent::after {
195
- content: '';
196
- width: 0;
197
- height: 0;
198
- position: absolute;
199
- border-left-color: inherit;
200
- border-left-style: solid;
201
- border-left-width: 6px;
202
- border-top: 5px solid transparent;
203
- border-bottom: 5px solid transparent;
204
- right: -6px;
205
- top: 50%;
206
- margin-top: -4px;
207
- }
208
-
209
192
  /* ------------------------------------------------------ */
210
193
 
211
194
  @media tablet, mobile {
@@ -1,21 +1,23 @@
1
1
  export default EngineStars;
2
- declare class EngineStars extends React.Component<any, any, any> {
3
- static propTypes: {
4
- type: PropTypes.Validator<string>;
5
- stars: PropTypes.Validator<number>;
6
- title: PropTypes.Validator<string>;
7
- active: PropTypes.Requireable<boolean>;
8
- disabled: PropTypes.Requireable<boolean>;
9
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
10
- toolTip: PropTypes.Requireable<PropTypes.InferProps<{
2
+ declare function EngineStars(props: any, legacyContext: any): JSX.Element;
3
+ declare namespace EngineStars {
4
+ namespace propTypes {
5
+ const type: PropTypes.Validator<string>;
6
+ const stars: PropTypes.Validator<number>;
7
+ const title: PropTypes.Validator<string>;
8
+ const active: PropTypes.Requireable<boolean>;
9
+ const disabled: PropTypes.Requireable<boolean>;
10
+ const onClick: PropTypes.Requireable<(...args: any[]) => any>;
11
+ const className: PropTypes.Requireable<string>;
12
+ const toolTip: PropTypes.Requireable<PropTypes.InferProps<{
11
13
  preMessage: PropTypes.Requireable<string>;
12
14
  linkMessage: PropTypes.Requireable<string>;
13
15
  endMessage: PropTypes.Requireable<string>;
14
16
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
15
17
  }>>;
16
- };
17
- static contextTypes: {
18
- skin: PropTypes.Requireable<PropTypes.InferProps<{
18
+ }
19
+ namespace contextTypes {
20
+ const skin: PropTypes.Requireable<PropTypes.InferProps<{
19
21
  common: PropTypes.Requireable<{
20
22
  [x: string]: any;
21
23
  }>;
@@ -36,11 +38,7 @@ declare class EngineStars extends React.Component<any, any, any> {
36
38
  [x: string]: any;
37
39
  }>;
38
40
  }>>;
39
- };
40
- constructor(props: any, context: any);
41
- handleClick: (e: any) => void;
42
- render(): JSX.Element;
41
+ }
43
42
  }
44
- import React from "react";
45
43
  import PropTypes from "prop-types";
46
44
  //# sourceMappingURL=engine-stars.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-stars.d.ts","sourceRoot":"","sources":["../../../src/template/activity/engine-stars.js"],"names":[],"mappings":";AAqFA;IACE;;;;;;;;;;;;;MAaE;IAEF;;;;;;;;;;;;;;;;;;;;;;MAEE;IAEF,sCAGC;IAED,8BAKE;IAEF,sBAqDC;CACF"}
1
+ {"version":3,"file":"engine-stars.d.ts","sourceRoot":"","sources":["../../../src/template/activity/engine-stars.js"],"names":[],"mappings":";AAuEA,0EAwIC"}
@@ -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 = _interopRequireDefault(require("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 = _interopRequireDefault(require("../../atom/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 ToolTip = ({
42
- toolTip,
43
- id
44
- }, context) => {
45
- if (!toolTip) {
46
- return null;
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
- skin
51
- } = context;
52
- const {
53
- preMessage,
54
- endMessage,
55
- linkMessage,
56
- onClick
57
- } = toolTip;
58
- const primary = (0, _get2.default)('common.primary', skin);
59
- const handleClick = onClick;
60
- return /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
61
- id: id,
62
- className: _engineStars.default.toolTip,
63
- "data-event-off": "click",
64
- place: "left",
65
- effect: "solid",
66
- delayHide: 500
67
- }, /*#__PURE__*/_react.default.createElement("p", {
68
- className: _engineStars.default.toolTipContent
69
- }, /*#__PURE__*/_react.default.createElement("span", null, `${preMessage}`), /*#__PURE__*/_react.default.createElement(_link.default, {
70
- onClick: handleClick,
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
- color: primary
155
+ backgroundColor: onClick === _noop2.default ? light : primary
73
156
  }
74
- }, `${linkMessage}`), /*#__PURE__*/_react.default.createElement("span", null, `${endMessage}`)));
75
- };
76
-
77
- ToolTip.contextTypes = {
78
- skin: _provider.default.childContextTypes.skin
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
- }))), /*#__PURE__*/_react.default.createElement("div", {
151
- className: _engineStars.default.scoreTitle
152
- }, title));
153
- }
154
-
155
- }
156
-
157
- EngineStars.contextTypes = {
158
- skin: _provider.default.childContextTypes.skin
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,E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P;EAIjBe,MAAM,EAAEnB,kBAAA,CAAUiC,IAJD;EAKjBlB,QAAQ,EAAEf,kBAAA,CAAUiC,IALH;EAMjB3C,OAAO,EAAEU,kBAAA,CAAUG,IANF;EAOjBpB,OAAO,EAAEiB,kBAAA,CAAUC,KAAV,CAAgB;IACvBd,UAAU,EAAEa,kBAAA,CAAUE,MADC;IAEvBb,WAAW,EAAEW,kBAAA,CAAUE,MAFA;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,MAA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V,kBAAA,CAAU8D,KAAV,CAAgB;IACvBvE,UAAU,EAAES,kBAAA,CAAUC,MADC;IAEvBT,WAAW,EAAEQ,kBAAA,CAAUC,MAFA;IAGvBR,UAAU,EAAEO,kBAAA,CAAUC,MAHC;IAIvBP,OAAO,EAAEM,kBAAA,CAAUE;EAJI,CAAhB;AARa,CAAxB;AAgBAC,WAAW,CAAC4D,YAAZ,GAA2B;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":";AAeA,0EAuGC"}
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 && onClick(e);
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 = progressions.map(progression => /*#__PURE__*/_react.default.createElement(_progressionItem.default, _extends({}, (0, _omit.default)(['ref'], progression), {
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","map","progression","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 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 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} = recommendation;\n onClick && 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 = progressions.map(progression => (\n <ProgressionItem\n {...omit(['ref'], progression)}\n key={progression.ref}\n adaptiveAriaLabel={adaptiveAriaLabel}\n />\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\">\n <div className={style.mainTitle}>\n <span>{mainTitle}</span> {mainSubtitle}\n </div>\n <div className={style.headerProgression}>\n <div className={style.wrapperCta}>\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;;;;;;;;;;AAEA,MAAMA,WAAW,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EAC5C,MAAM;IACJC,SADI;IAEJC,YAFI;IAGJC,cAAc,GAAG,EAHb;IAIJC,YAAY,GAAG,EAJX;IAKJC,iBALI;IAMJC,KANI;IAOJC,OAAO,GAAG,EAPN;IAQJC,WAAW,GAAG,EARV;IASJC;EATI,IAUFV,KAVJ;EAWA,MAAMW,IAAI,GAAG,IAAAC,4BAAA,EAAmBX,aAAnB,CAAb;EACA,MAAM;IAACY,QAAQ,EAAEC;EAAX,IAAkCL,WAAxC;EAEA,MAAMM,WAAW,GAAG,IAAAC,kBAAA,EAClBC,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,MAAM;MAACC;IAAD,IAAYhB,cAAlB;IACAgB,OAAO,IAAIA,OAAO,CAACH,CAAD,CAAlB;EACD,CANiB,EAOlB,CAACb,cAAD,CAPkB,CAApB;EAUA,MAAMiB,iBAAiB,GAAG,IAAAL,kBAAA,EACxB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K,EAAEkD,kBAAA,CAAUG,KAAV,CAAgB;IACrBC,KAAK,EAAEJ,kBAAA,CAAUC,MAAV,CAAiBC,UADH;IAErBG,KAAK,EAAEL,kBAAA,CAAUM,MAAV,CAAiBJ;EAFH,CAAhB,EAGJA,UAPmB;EAQtBnD,OAAO,EAAEiD,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUG,KAAV,CAAgBK,oBAAA,CAAYT,SAA5B,CAAlB,CARa;EAStB9C,OAAO,EAAE+C,kBAAA,CAAUS,IAAV,CAAeP,UATF;EAUtBtD,YAAY,EAAEoD,kBAAA,CAAUO,OAAV,CACZP,kBAAA,CAAUG,KAAV,cAAoBO,wBAAA,CAAgBX,SAApC;IAA+C1B,GAAG,EAAE2B,kBAAA,CAAUC,MAAV,CAAiBC;EAArE,GADY,CAVQ;EAatBlD,WAAW,EAAEgD,kBAAA,CAAUG,KAAV,CAAgB;IAC3BzB,OAAO,EAAEiC,eAAA,CAAOZ,SAAP,CAAiBrB,OAAjB,CAAyBwB,UADP;IAE3B9C,QAAQ,EAAEuD,eAAA,CAAOZ,SAAP,CAAiB3C;EAFA,CAAhB,CAbS;EAiBtBT,cAAc,EAAEqD,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;IAK9BvC,OAAO,EAAEqC,kBAAA,CAAUY;EALW,CAAhB;AAjBM,CAAxB;eA0BetE,W"}
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,GAAG,EAAE;AAAN,CAAZ,CAArB;;AAEA,MAAMC,WAAW,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EAC5C,MAAM;IACJC,SADI;IAEJC,YAFI;IAGJC,cAAc,GAAG,EAHb;IAIJC,YAAY,GAAG,EAJX;IAKJC,iBALI;IAMJC,KANI;IAOJC,OAAO,GAAG,EAPN;IAQJC,WAAW,GAAG,EARV;IASJC;EATI,IAUFV,KAVJ;EAWA,MAAMW,IAAI,GAAG,IAAAC,4BAAA,EAAmBX,aAAnB,CAAb;EACA,MAAM;IAACY,QAAQ,EAAEC;EAAX,IAAkCL,WAAxC;EAEA,MAAMM,WAAW,GAAG,IAAAC,kBAAA,EAClBC,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,MAAM;MAACC,OAAO,GAAGC;IAAX,IAAmBjB,cAAzB;IACAgB,OAAO,CAACH,CAAD,CAAP;EACD,CANiB,EAOlB,CAACb,cAAD,CAPkB,CAApB;EAUA,MAAMkB,iBAAiB,GAAG,IAAAN,kBAAA,EACxBC,CAAC,IAAI;IACHH,mBAAmB,IAAIA,mBAAmB,CAACG,CAAD,CAA1C;EACD,CAHuB,EAIxB,CAACH,mBAAD,CAJwB,CAA1B;EAOA,MAAMS,OAAO,GAAG,IAAAC,YAAA,EAAI,gBAAJ,EAAsBb,IAAtB,C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UG,KAAV,CAAgB;IACrBC,KAAK,EAAEJ,kBAAA,CAAUC,MAAV,CAAiBC,UADH;IAErBG,KAAK,EAAEL,kBAAA,CAAUM,MAAV,CAAiBJ;EAFH,CAAhB,EAGJA,UAPmB;EAQtBpD,OAAO,EAAEkD,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUG,KAAV,CAAgBK,oBAAA,CAAYT,SAA5B,CAAlB,CARa;EAStB/C,OAAO,EAAEgD,kBAAA,CAAUS,IAAV,CAAeP,UATF;EAUtBvD,YAAY,EAAEqD,kBAAA,CAAUO,OAAV,CACZP,kBAAA,CAAUG,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 && onClick(e);
79
+ onClick(e);
80
80
  }, [onClick]);
81
81
  const link = disabled ? null : /*#__PURE__*/_react.default.createElement(_link.default, {
82
82
  style: {