@coorpacademy/components 11.32.3 → 11.32.5
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/battle-opponent/index.d.ts.map +1 -1
- package/es/atom/battle-opponent/index.js +1 -1
- package/es/atom/battle-opponent/index.js.map +1 -1
- package/es/molecule/base-modal/index.d.ts +24 -1
- package/es/molecule/base-modal/index.d.ts.map +1 -1
- package/es/molecule/base-modal/index.js +26 -5
- package/es/molecule/base-modal/index.js.map +1 -1
- package/es/molecule/card/favorite.d.ts.map +1 -1
- package/es/molecule/card/favorite.js +1 -1
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/discipline-associated-skills/index.d.ts +17 -0
- package/es/molecule/discipline-associated-skills/index.d.ts.map +1 -0
- package/es/molecule/discipline-associated-skills/index.js +73 -0
- package/es/molecule/discipline-associated-skills/index.js.map +1 -0
- package/es/molecule/discipline-associated-skills/style.css +71 -0
- package/es/molecule/learner-skill-card/index.d.ts +22 -0
- package/es/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.js +7 -6
- package/es/molecule/learner-skill-card/index.js.map +1 -1
- package/es/molecule/learning-profile-radar-chart/index.d.ts +28 -1
- package/es/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
- package/es/molecule/learning-profile-radar-chart/index.js +115 -28
- package/es/molecule/learning-profile-radar-chart/index.js.map +1 -1
- package/es/molecule/learning-profile-radar-chart/style.css +14 -0
- package/es/molecule/learning-profile-radar-chart/types.d.ts +2 -0
- package/es/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
- package/es/molecule/learning-profile-radar-chart/types.js +2 -1
- package/es/molecule/learning-profile-radar-chart/types.js.map +1 -1
- package/es/molecule/review-correction-popin/index.d.ts.map +1 -1
- package/es/molecule/review-correction-popin/index.js +1 -1
- package/es/molecule/review-correction-popin/index.js.map +1 -1
- package/es/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/es/molecule/skill-picker-modal/index.js +2 -1
- package/es/molecule/skill-picker-modal/index.js.map +1 -1
- package/es/organism/user-preferences/index.d.ts.map +1 -1
- package/es/organism/user-preferences/index.js +1 -1
- package/es/organism/user-preferences/index.js.map +1 -1
- package/es/template/activity/engine-stars.d.ts.map +1 -1
- package/es/template/activity/engine-stars.js +1 -1
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/common/discipline/index.d.ts +6 -0
- package/es/template/common/discipline/index.d.ts.map +1 -1
- package/es/template/common/discipline/index.js +17 -2
- package/es/template/common/discipline/index.js.map +1 -1
- package/es/template/common/discipline/style.css +4 -1
- package/es/template/my-learning/index.d.ts +21 -0
- package/es/template/my-learning/index.d.ts.map +1 -1
- package/es/template/my-learning/index.js +41 -15
- package/es/template/my-learning/index.js.map +1 -1
- package/es/template/my-learning/style.css +6 -1
- package/lib/atom/battle-opponent/index.d.ts.map +1 -1
- package/lib/atom/battle-opponent/index.js +1 -1
- package/lib/atom/battle-opponent/index.js.map +1 -1
- package/lib/molecule/base-modal/index.d.ts +24 -1
- package/lib/molecule/base-modal/index.d.ts.map +1 -1
- package/lib/molecule/base-modal/index.js +26 -4
- package/lib/molecule/base-modal/index.js.map +1 -1
- package/lib/molecule/card/favorite.d.ts.map +1 -1
- package/lib/molecule/card/favorite.js +1 -1
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/discipline-associated-skills/index.d.ts +17 -0
- package/lib/molecule/discipline-associated-skills/index.d.ts.map +1 -0
- package/lib/molecule/discipline-associated-skills/index.js +94 -0
- package/lib/molecule/discipline-associated-skills/index.js.map +1 -0
- package/lib/molecule/discipline-associated-skills/style.css +71 -0
- package/lib/molecule/learner-skill-card/index.d.ts +22 -0
- package/lib/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.js +7 -7
- package/lib/molecule/learner-skill-card/index.js.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/index.d.ts +28 -1
- package/lib/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/index.js +117 -28
- package/lib/molecule/learning-profile-radar-chart/index.js.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/style.css +14 -0
- package/lib/molecule/learning-profile-radar-chart/types.d.ts +2 -0
- package/lib/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/types.js +2 -1
- package/lib/molecule/learning-profile-radar-chart/types.js.map +1 -1
- package/lib/molecule/review-correction-popin/index.d.ts.map +1 -1
- package/lib/molecule/review-correction-popin/index.js +1 -1
- package/lib/molecule/review-correction-popin/index.js.map +1 -1
- package/lib/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/lib/molecule/skill-picker-modal/index.js +2 -1
- package/lib/molecule/skill-picker-modal/index.js.map +1 -1
- package/lib/organism/user-preferences/index.d.ts.map +1 -1
- package/lib/organism/user-preferences/index.js +1 -1
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/lib/template/activity/engine-stars.d.ts.map +1 -1
- package/lib/template/activity/engine-stars.js +1 -1
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/common/discipline/index.d.ts +6 -0
- package/lib/template/common/discipline/index.d.ts.map +1 -1
- package/lib/template/common/discipline/index.js +18 -2
- package/lib/template/common/discipline/index.js.map +1 -1
- package/lib/template/common/discipline/style.css +4 -1
- package/lib/template/my-learning/index.d.ts +21 -0
- package/lib/template/my-learning/index.d.ts.map +1 -1
- package/lib/template/my-learning/index.js +39 -15
- package/lib/template/my-learning/index.js.map +1 -1
- package/lib/template/my-learning/style.css +6 -1
- package/locales/bs/global.json +3 -1
- package/locales/cs/global.json +4 -2
- package/locales/de/global.json +3 -1
- package/locales/en/global.json +3 -1
- package/locales/es/global.json +3 -1
- package/locales/et/global.json +3 -1
- package/locales/fi/global.json +3 -1
- package/locales/fr/global.json +3 -1
- package/locales/hr/global.json +3 -1
- package/locales/hu/global.json +3 -1
- package/locales/hy/global.json +3 -1
- package/locales/it/global.json +3 -1
- package/locales/ja/global.json +3 -1
- package/locales/ko/global.json +3 -1
- package/locales/nl/global.json +3 -1
- package/locales/pl/global.json +3 -1
- package/locales/pt/global.json +3 -1
- package/locales/ro/global.json +3 -1
- package/locales/ru/global.json +3 -1
- package/locales/sk/global.json +3 -1
- package/locales/sl/global.json +3 -1
- package/locales/sv/global.json +3 -1
- package/locales/th/global.json +1 -1
- package/locales/tl/global.json +4 -2
- package/locales/tr/global.json +3 -1
- package/locales/uk/global.json +3 -1
- package/locales/vi/global.json +4 -2
- package/locales/zh/global.json +3 -1
- package/locales/zh_TW/global.json +3 -1
- package/package.json +2 -2
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.formatData = exports.default = exports.LearningProfileRadarChart = void 0;
|
|
5
5
|
|
|
6
|
+
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
7
|
+
|
|
6
8
|
var _findKey2 = _interopRequireDefault(require("lodash/fp/findKey"));
|
|
7
9
|
|
|
8
10
|
var _flatten2 = _interopRequireDefault(require("lodash/fp/flatten"));
|
|
@@ -35,14 +37,20 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
35
37
|
|
|
36
38
|
var _recharts = require("recharts");
|
|
37
39
|
|
|
40
|
+
var _cssColorFunction = require("css-color-function");
|
|
41
|
+
|
|
38
42
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
39
43
|
|
|
40
44
|
var _checkIsMobile = require("../../util/check-is-mobile");
|
|
41
45
|
|
|
42
|
-
var
|
|
46
|
+
var _buttonLink = _interopRequireDefault(require("../../atom/button-link"));
|
|
47
|
+
|
|
48
|
+
var _provider = _interopRequireWildcard(require("../../atom/provider"));
|
|
43
49
|
|
|
44
50
|
var _types = require("./types");
|
|
45
51
|
|
|
52
|
+
var _style = _interopRequireDefault(require("./style.css"));
|
|
53
|
+
|
|
46
54
|
const _excluded = ["offset", "alignment"];
|
|
47
55
|
|
|
48
56
|
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); }
|
|
@@ -184,6 +192,7 @@ const CustomDot = ({
|
|
|
184
192
|
cx,
|
|
185
193
|
cy,
|
|
186
194
|
payload,
|
|
195
|
+
onDotHover,
|
|
187
196
|
onDotClick,
|
|
188
197
|
stroke,
|
|
189
198
|
activeDot,
|
|
@@ -201,10 +210,15 @@ const CustomDot = ({
|
|
|
201
210
|
if (!payload?.name) return;
|
|
202
211
|
onDotClick(payload.name);
|
|
203
212
|
},
|
|
213
|
+
onMouseOver: () => {
|
|
214
|
+
if (!payload?.name) return;
|
|
215
|
+
onDotHover(payload.name);
|
|
216
|
+
},
|
|
217
|
+
onMouseLeave: () => onDotHover(''),
|
|
204
218
|
'data-name': dataName
|
|
205
219
|
}));
|
|
206
220
|
|
|
207
|
-
const buildRadars = (totalDataset, handleOnDotClick, activeDot) => (0, _times2.default)(index => {
|
|
221
|
+
const buildRadars = (totalDataset, handleDotHover, handleOnDotClick, activeDot) => (0, _times2.default)(index => {
|
|
208
222
|
const datakey = `value${index + 1}`;
|
|
209
223
|
const dataset = `dataset-${index + 1}`;
|
|
210
224
|
return /*#__PURE__*/_react.default.createElement(_recharts.Radar, _extends({}, RADAR_DEFAULT_PROPS, {
|
|
@@ -220,6 +234,7 @@ const buildRadars = (totalDataset, handleOnDotClick, activeDot) => (0, _times2.d
|
|
|
220
234
|
// use with the tooltip component
|
|
221
235
|
,
|
|
222
236
|
dot: /*#__PURE__*/_react.default.createElement(CustomDot, {
|
|
237
|
+
onDotHover: handleDotHover,
|
|
223
238
|
onDotClick: handleOnDotClick,
|
|
224
239
|
activeDot: activeDot,
|
|
225
240
|
dataKey: datakey,
|
|
@@ -229,7 +244,7 @@ const buildRadars = (totalDataset, handleOnDotClick, activeDot) => (0, _times2.d
|
|
|
229
244
|
}));
|
|
230
245
|
}, totalDataset);
|
|
231
246
|
|
|
232
|
-
const
|
|
247
|
+
const CustomLabel = ({
|
|
233
248
|
index,
|
|
234
249
|
x,
|
|
235
250
|
y,
|
|
@@ -238,8 +253,13 @@ const buildCustomLabel = ({
|
|
|
238
253
|
activeDot,
|
|
239
254
|
chartType,
|
|
240
255
|
formatedColors,
|
|
241
|
-
|
|
256
|
+
primarySkinColor,
|
|
257
|
+
exploreLocale,
|
|
258
|
+
hoveredDot,
|
|
259
|
+
onClick,
|
|
260
|
+
onExploreClick
|
|
242
261
|
}) => {
|
|
262
|
+
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
243
263
|
const isCurrentDotActive = activeDot?.label === label;
|
|
244
264
|
|
|
245
265
|
const _CHART_CONFIGS$chartT = CHART_CONFIGS[chartType].ticks[index],
|
|
@@ -257,16 +277,44 @@ const buildCustomLabel = ({
|
|
|
257
277
|
onClick(label);
|
|
258
278
|
}
|
|
259
279
|
|
|
280
|
+
function handleExploreClick() {
|
|
281
|
+
onExploreClick(label);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const buttonExploreProps = {
|
|
285
|
+
customStyle: {
|
|
286
|
+
height: '36px',
|
|
287
|
+
backgroundColor: hovered ? primarySkinColor : (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(0.07))`),
|
|
288
|
+
color: hovered ? '#FFFFFF' : primarySkinColor,
|
|
289
|
+
transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
|
|
290
|
+
},
|
|
291
|
+
onClick: handleExploreClick,
|
|
292
|
+
'aria-label': `${label}, ${exploreLocale}`,
|
|
293
|
+
label: exploreLocale,
|
|
294
|
+
'data-name': 'learner-skill-card-explore-button',
|
|
295
|
+
icon: {
|
|
296
|
+
position: 'left',
|
|
297
|
+
faIcon: {
|
|
298
|
+
name: 'compass',
|
|
299
|
+
backgroundColor: hovered ? primarySkinColor : (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(0.07))`),
|
|
300
|
+
color: hovered ? '#FFFFFF' : primarySkinColor,
|
|
301
|
+
size: 16
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const handleMouseOver = (0, _react.useCallback)(() => setHovered(true), [setHovered]);
|
|
306
|
+
const handleMouseLeave = (0, _react.useCallback)(() => setHovered(false), [setHovered]);
|
|
307
|
+
const extraOffsetY = isCurrentDotActive && index === 0 ? -25 : 0;
|
|
260
308
|
return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("foreignObject", {
|
|
261
309
|
className: _style.default.tickeForeignObject,
|
|
262
310
|
x: x + offsetX,
|
|
263
|
-
y: y + offsetY,
|
|
311
|
+
y: y + offsetY + extraOffsetY,
|
|
264
312
|
width: "200",
|
|
265
313
|
height: "65"
|
|
266
314
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
267
315
|
"data-name": label,
|
|
268
316
|
onClick: onLabelClick,
|
|
269
|
-
className: (0, _classnames.default)(_style.default.tickWrapper, isCurrentDotActive && _style.default.tickWrapperFocus),
|
|
317
|
+
className: (0, _classnames.default)(_style.default.tickWrapper, isCurrentDotActive && _style.default.tickWrapperFocus, hoveredDot === label && _style.default.tickWrapperHover),
|
|
270
318
|
style: _extends({}, rest, {
|
|
271
319
|
alignItems: alignment,
|
|
272
320
|
textAlign: alignment,
|
|
@@ -293,7 +341,12 @@ const buildCustomLabel = ({
|
|
|
293
341
|
style: {
|
|
294
342
|
color: colorLabel
|
|
295
343
|
}
|
|
296
|
-
}, label)))
|
|
344
|
+
}, label))), isCurrentDotActive ? /*#__PURE__*/_react.default.createElement("div", {
|
|
345
|
+
className: _style.default.buttonWrapper,
|
|
346
|
+
onMouseOver: handleMouseOver,
|
|
347
|
+
onMouseLeave: handleMouseLeave,
|
|
348
|
+
"data-name": "button-explore-wrapper"
|
|
349
|
+
}, /*#__PURE__*/_react.default.createElement(_buttonLink.default, buttonExploreProps)) : null)));
|
|
297
350
|
};
|
|
298
351
|
/* UTILS */
|
|
299
352
|
|
|
@@ -314,12 +367,17 @@ const LearningProfileRadarChart = ({
|
|
|
314
367
|
totalDataset,
|
|
315
368
|
colors: colorsProps,
|
|
316
369
|
onClick,
|
|
370
|
+
onExploreClick,
|
|
317
371
|
width,
|
|
318
372
|
height,
|
|
319
373
|
margin
|
|
320
|
-
}) => {
|
|
374
|
+
}, legacyContext) => {
|
|
321
375
|
const [isMobile, setIsMobile] = (0, _react.useState)(false);
|
|
322
376
|
const [activeDot, setActiveDot] = (0, _react.useState)();
|
|
377
|
+
const [hoveredDot, setHoveredDot] = (0, _react.useState)('');
|
|
378
|
+
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
379
|
+
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
380
|
+
const primarySkinColor = (0, _get2.default)('common.primary', skin);
|
|
323
381
|
const formatedColors = (0, _times2.default)(i => {
|
|
324
382
|
if (!colorsProps?.length) return DEFAULT_COLORS;
|
|
325
383
|
const colors = colorsProps[i];
|
|
@@ -358,7 +416,17 @@ const LearningProfileRadarChart = ({
|
|
|
358
416
|
};
|
|
359
417
|
}, [activeDot, onClick, setActiveDot]);
|
|
360
418
|
|
|
419
|
+
function handleOnActiveDotClick() {
|
|
420
|
+
setActiveDot(undefined);
|
|
421
|
+
onClick(undefined);
|
|
422
|
+
}
|
|
423
|
+
|
|
361
424
|
function handleOnDotClick(label) {
|
|
425
|
+
if (!(0, _isEmpty2.default)(activeDot) && activeDot?.label === label) {
|
|
426
|
+
handleOnActiveDotClick();
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
|
|
362
430
|
const payload = formatedData.find(({
|
|
363
431
|
subject
|
|
364
432
|
}) => subject === label);
|
|
@@ -377,28 +445,45 @@ const LearningProfileRadarChart = ({
|
|
|
377
445
|
}
|
|
378
446
|
}
|
|
379
447
|
|
|
380
|
-
function
|
|
381
|
-
|
|
382
|
-
y,
|
|
383
|
-
payload: {
|
|
384
|
-
value: label
|
|
385
|
-
},
|
|
386
|
-
index
|
|
387
|
-
}) {
|
|
388
|
-
const currentData = formatedData.find(({
|
|
448
|
+
function handleExploreClick(label) {
|
|
449
|
+
const payload = formatedData.find(({
|
|
389
450
|
subject
|
|
390
451
|
}) => subject === label);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
452
|
+
if (!payload) return;
|
|
453
|
+
const skillRef = (0, _findKey2.default)(val => val === payload?.subject, legend);
|
|
454
|
+
|
|
455
|
+
if (skillRef) {
|
|
456
|
+
onExploreClick(skillRef);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function renderCustomLabel(props) {
|
|
461
|
+
const {
|
|
394
462
|
x,
|
|
395
463
|
y,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
464
|
+
payload: {
|
|
465
|
+
value: label
|
|
466
|
+
},
|
|
467
|
+
index
|
|
468
|
+
} = props;
|
|
469
|
+
const currentData = formatedData.find(({
|
|
470
|
+
subject
|
|
471
|
+
}) => subject === label);
|
|
472
|
+
const percentagesValues = (0, _pipe2.default)((0, _omit2.default)('subject'), (0, _mapValues2.default)(value => `${value}%`), _values2.default)(currentData);
|
|
473
|
+
return /*#__PURE__*/_react.default.createElement(CustomLabel, {
|
|
474
|
+
index: index,
|
|
475
|
+
x: x,
|
|
476
|
+
y: y,
|
|
477
|
+
percentagesValues: percentagesValues,
|
|
478
|
+
label: label,
|
|
479
|
+
activeDot: activeDot,
|
|
480
|
+
chartType: chartType,
|
|
481
|
+
formatedColors: formatedColors,
|
|
482
|
+
primarySkinColor: primarySkinColor,
|
|
483
|
+
exploreLocale: translate('Explore'),
|
|
484
|
+
hoveredDot: hoveredDot,
|
|
485
|
+
onClick: handleOnDotClick,
|
|
486
|
+
onExploreClick: handleExploreClick
|
|
402
487
|
});
|
|
403
488
|
}
|
|
404
489
|
|
|
@@ -415,7 +500,7 @@ const LearningProfileRadarChart = ({
|
|
|
415
500
|
cy: "50%",
|
|
416
501
|
outerRadius: "80%",
|
|
417
502
|
data: formatedData
|
|
418
|
-
}, gradients,
|
|
503
|
+
}, gradients, /*#__PURE__*/_react.default.createElement(_recharts.PolarGrid, {
|
|
419
504
|
strokeDasharray: 10,
|
|
420
505
|
strokeWidth: 2,
|
|
421
506
|
radialLines: false
|
|
@@ -426,7 +511,7 @@ const LearningProfileRadarChart = ({
|
|
|
426
511
|
tick: false,
|
|
427
512
|
axisLine: false,
|
|
428
513
|
domain: [0, 100]
|
|
429
|
-
}), isMobile ? /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
514
|
+
}), buildRadars(totalDataset, setHoveredDot, handleOnDotClick, activeDot), isMobile ? /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
430
515
|
cursor: false,
|
|
431
516
|
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
432
517
|
}) : null);
|
|
@@ -439,6 +524,10 @@ const ResponsiveLearningProfileRadarChart = props => /*#__PURE__*/_react.default
|
|
|
439
524
|
height: "100%"
|
|
440
525
|
}, /*#__PURE__*/_react.default.createElement(LearningProfileRadarChart, props));
|
|
441
526
|
|
|
527
|
+
LearningProfileRadarChart.contextTypes = {
|
|
528
|
+
skin: _provider.default.childContextTypes.skin,
|
|
529
|
+
translate: _provider.default.childContextTypes.translate
|
|
530
|
+
};
|
|
442
531
|
LearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? _types.learningProfileRadarChartPropTypes : {};
|
|
443
532
|
ResponsiveLearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? _types.learningProfileRadarChartPropTypes : {};
|
|
444
533
|
var _default = ResponsiveLearningProfileRadarChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["top","offset","x","y","alignment","margin","bottom","right","marginRight","left","marginLeft","BLACK","WHITE","DEFAULT_MAIN_COLOR","DEFAULT_COLORS","gradient","fill","stroke","percentage","color","background","label","CHART_CONFIGS","triangle","name","ticks","sideCount","quadrilateral","pentagon","hexagon","DOT_DEFAULT_PROPS","strokeWidth","strokeOpacity","r","pointerEvents","style","cursor","DOT_ACTIVE_PROPS","RADAR_DEFAULT_PROPS","fillOpacity","Gradient","type","colors","firstColor","secondColor","CustomTooltip","active","payload","length","tooltip","tooltipLabel","tooltipValue","value","CustomDot","cx","cy","onDotClick","activeDot","dataName","subject","onTouchStart","onClick","e","stopPropagation","buildRadars","totalDataset","handleOnDotClick","index","datakey","dataset","buildCustomLabel","percentagesValues","chartType","formatedColors","isCurrentDotActive","offsetX","offsetY","rest","onLabelClick","tickeForeignObject","classnames","tickWrapper","tickWrapperFocus","alignItems","textAlign","opacity","map","colorLabel","i","tickValue","tickLabel","CHART_CONFIGS_BY_SIDE_COUNT","formatValues","values_","val","formatData","legend","data_","ref","LearningProfileRadarChart","data","colorsProps","width","height","isMobile","setIsMobile","useState","setActiveDot","Object","assign","useMemo","gradients","userAgent","navigator","isMobile_","getIsMobile","setIsMobile_","useCallback","useEffect","handleClick","undefined","window","addEventListener","removeEventListener","formatedData","find","indexOf","skillRef","key","renderCustomLabel","currentData","ResponsiveLearningProfileRadarChart","props","propTypes","learningProfileRadarChartPropTypes"],"sources":["../../../src/molecule/learning-profile-radar-chart/index.tsx"],"sourcesContent":["import React, {Fragment, useCallback, useEffect, useMemo, useState} from 'react';\nimport {\n Radar,\n RadarChart,\n PolarGrid,\n PolarAngleAxis,\n ResponsiveContainer,\n Tooltip,\n PolarRadiusAxis\n} from 'recharts';\nimport {\n pipe,\n keyBy,\n mapValues,\n size,\n getOr,\n map,\n toPairs,\n values,\n isEmpty,\n omit,\n fromPairs,\n times,\n flatten,\n findKey\n} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {isMobile as getIsMobile} from '../../util/check-is-mobile';\nimport style from './style.css';\nimport {\n ActiveDotType,\n FormatedColorsType,\n FormatedDataType,\n LearningProfileRadarChartPropTypes,\n TickType,\n learningProfileRadarChartPropTypes\n} from './types';\n\ntype CHART_TYPE_TYPE = keyof typeof CHART_CONFIGS;\n\n/* TICK_POSITIONS */\nconst top: TickType = {offset: {x: -100, y: -75}, alignment: 'center', margin: 'auto'};\nconst bottom: TickType = {offset: {x: -100, y: 10}, alignment: 'center', margin: 'auto'};\nconst right: TickType = {offset: {x: 30, y: -10}, alignment: 'start', marginRight: 'auto'};\nconst left: TickType = {offset: {x: -230, y: -10}, alignment: 'end', marginLeft: 'auto'};\n\n/* CONSTANTS */\nconst BLACK = '#000000ff';\nconst WHITE = '#ffffffff';\nconst DEFAULT_MAIN_COLOR = '#0062ffff';\n\nconst DEFAULT_COLORS: FormatedColorsType = {\n gradient: {\n fill: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR],\n stroke: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR]\n },\n percentage: {\n color: BLACK,\n background: WHITE\n },\n label: {\n color: BLACK\n }\n};\n\nconst CHART_CONFIGS = {\n triangle: {\n name: 'triangle',\n ticks: [top, right, left],\n sideCount: 3\n },\n quadrilateral: {\n name: 'quadrilateral',\n ticks: [top, right, bottom, left],\n sideCount: 4\n },\n pentagon: {\n name: 'pentagon',\n ticks: [top, right, right, left, left],\n sideCount: 5\n },\n hexagon: {\n name: 'hexagon',\n ticks: [top, right, right, bottom, left, left],\n sideCount: 6\n }\n} as const;\n\nconst DOT_DEFAULT_PROPS = {\n strokeWidth: 2,\n strokeOpacity: 0.4,\n fill: '#fff',\n r: 4,\n pointerEvents: 'all',\n style: {cursor: 'pointer'}\n} as const;\n\nconst DOT_ACTIVE_PROPS = {\n fill: '#fff',\n r: 6,\n strokeWidth: 4,\n strokeOpacity: 0.6\n} as const;\n\nconst RADAR_DEFAULT_PROPS = {\n strokeWidth: 3,\n strokeOpacity: 0.2,\n fillOpacity: 0.2\n} as const;\n\n/* COMPONENTS */\nconst Gradient = ({type, colors: [firstColor, secondColor]}: {type: string; colors: string[]}) => (\n <defs>\n <linearGradient id={`gradient-${type}`} x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={firstColor} />\n <stop offset=\"100%\" stopColor={secondColor} />\n </linearGradient>\n </defs>\n);\n\nconst CustomTooltip = ({\n active,\n payload,\n label\n}: {\n active?: boolean;\n payload?: {value: number}[];\n label?: string;\n}) =>\n active && !!payload?.length ? (\n <div className={style.tooltip}>\n <span className={style.tooltipLabel}>{label}</span>\n <span className={style.tooltipValue}>{payload[0].value}%</span>\n </div>\n ) : null;\n\nconst CustomDot = ({\n cx,\n cy,\n payload,\n onDotClick,\n stroke,\n activeDot,\n dataName\n}: {\n cx?: number;\n cy?: number;\n payload?: {payload: {subject: string} & {[datakey: string]: number}; name: string};\n onDotClick: (name: string) => void;\n dataKey: string;\n stroke: string;\n activeDot?: ActiveDotType;\n dataName: string;\n}) => (\n <circle\n {...{\n ...DOT_DEFAULT_PROPS,\n ...(payload?.payload.subject === activeDot?.label && DOT_ACTIVE_PROPS),\n stroke,\n cx,\n cy,\n onTouchStart: () => {\n if (!payload?.name) return;\n onDotClick(payload.name);\n },\n onClick: e => {\n e.stopPropagation();\n\n if (!payload?.name) return;\n onDotClick(payload.name);\n },\n 'data-name': dataName\n }}\n />\n);\n\nconst buildRadars = (\n totalDataset: number,\n handleOnDotClick: (name: string) => void,\n activeDot?: ActiveDotType\n) =>\n times(index => {\n const datakey = `value${index + 1}`;\n const dataset = `dataset-${index + 1}`;\n\n return (\n <Radar\n {...RADAR_DEFAULT_PROPS}\n fill={`url(#gradient-fill-${index})`}\n stroke={`url(#gradient-stroke-${index})`}\n key={dataset}\n name={dataset}\n dataKey={datakey}\n activeDot={{\n ...DOT_ACTIVE_PROPS,\n stroke: `url(#gradient-stroke-${index})`\n }}\n // only on mobile\n // to handle dot style on hover (convert to click)\n // use with the tooltip component\n dot={\n <CustomDot\n onDotClick={handleOnDotClick}\n activeDot={activeDot}\n dataKey={datakey}\n stroke={`url(#gradient-stroke-${index})`}\n dataName={`dot-${dataset}`}\n />\n }\n />\n );\n }, totalDataset);\n\nconst buildCustomLabel = ({\n index,\n x,\n y,\n percentagesValues,\n label,\n activeDot,\n chartType,\n formatedColors,\n onClick\n}: {\n index: number;\n x: number;\n y: number;\n percentagesValues: number[];\n label: string;\n chartType: CHART_TYPE_TYPE;\n formatedColors: FormatedColorsType[];\n activeDot?: ActiveDotType;\n onClick: (name: string) => void;\n}) => {\n const isCurrentDotActive = activeDot?.label === label;\n const {\n offset: {x: offsetX, y: offsetY},\n alignment,\n ...rest\n } = CHART_CONFIGS[chartType].ticks[index];\n\n function onLabelClick(e: React.MouseEvent) {\n e.stopPropagation();\n onClick(label);\n }\n\n return (\n <g>\n <foreignObject\n className={style.tickeForeignObject}\n x={x + offsetX}\n y={y + offsetY}\n width=\"200\"\n height=\"65\"\n >\n <div\n data-name={label}\n onClick={onLabelClick}\n className={classnames(style.tickWrapper, isCurrentDotActive && style.tickWrapperFocus)}\n style={{\n ...rest,\n alignItems: alignment,\n textAlign: alignment,\n opacity: !isEmpty(activeDot) && !isCurrentDotActive ? 0.3 : 1\n }}\n >\n {formatedColors.map(\n ({percentage: {color, background}, label: {color: colorLabel}}, i) => (\n <Fragment key={i}>\n <span className={style.tickValue} style={{color, background}}>\n {percentagesValues[i]}\n </span>\n <span className={style.tickLabel} style={{color: colorLabel}}>\n {label}\n </span>\n </Fragment>\n )\n )}\n </div>\n </foreignObject>\n </g>\n );\n};\n\n/* UTILS */\nconst CHART_CONFIGS_BY_SIDE_COUNT = pipe(keyBy('sideCount'), mapValues('name'))(CHART_CONFIGS);\n\nconst formatValues: (values_: number | number[]) => Record<string, number> = pipe(\n values_ => flatten([values_]),\n values_ => values_.map((val: number, i: number): [string, number] => [`value${i + 1}`, val]),\n fromPairs\n);\n\n/* this convert incoming component data to rechart data structure */\nexport const formatData: (\n legend: {[ref: string]: string},\n data_: LearningProfileRadarChartPropTypes['data']\n) => FormatedDataType[] = (legend, data_) =>\n pipe(\n toPairs,\n map(([ref, values_]: [string, number | number[]]) => ({\n ...formatValues(values_),\n subject: legend[ref]\n }))\n )(data_);\n\nexport const LearningProfileRadarChart = ({\n data,\n legend,\n totalDataset,\n colors: colorsProps,\n onClick,\n width,\n height,\n margin\n}: LearningProfileRadarChartPropTypes) => {\n const [isMobile, setIsMobile] = useState(false);\n const [activeDot, setActiveDot] = useState<ActiveDotType>();\n\n const formatedColors = times(i => {\n if (!colorsProps?.length) return DEFAULT_COLORS;\n\n const colors = colorsProps[i];\n return colors ? Object.assign({}, DEFAULT_COLORS, colors) : DEFAULT_COLORS;\n })(totalDataset);\n\n const chartType: CHART_TYPE_TYPE = useMemo(\n () => getOr('hexagon', size(data), CHART_CONFIGS_BY_SIDE_COUNT),\n [data]\n );\n\n const gradients = useMemo(\n () =>\n formatedColors.map(({gradient: {fill, stroke}}, index) => (\n <svg key={`gradient-${index}`}>\n <Gradient type={`fill-${index}`} colors={fill} />\n <Gradient type={`stroke-${index}`} colors={stroke} />\n </svg>\n )),\n [formatedColors]\n );\n\n const userAgent = navigator?.userAgent;\n const isMobile_ = useMemo(() => getIsMobile(userAgent), [userAgent]);\n\n const setIsMobile_ = useCallback(() => {\n setIsMobile(isMobile_);\n }, [isMobile_]);\n\n useEffect(() => setIsMobile_(), [setIsMobile_]);\n\n useEffect(() => {\n const handleClick = () => {\n setActiveDot(undefined);\n onClick(undefined);\n };\n\n !isEmpty(activeDot) && window.addEventListener('click', handleClick);\n\n return () => {\n window.removeEventListener('click', handleClick);\n };\n }, [activeDot, onClick, setActiveDot]);\n\n function handleOnDotClick(label: string) {\n const payload = formatedData.find(({subject}) => subject === label);\n if (!payload) return;\n\n const index = formatedData.indexOf(payload);\n const datakey = `value${index + 1}`;\n const skillRef = findKey(val => val === payload?.subject, legend);\n\n if (skillRef) {\n setActiveDot({\n key: datakey,\n value: payload[datakey],\n label: payload.subject\n });\n onClick(skillRef);\n }\n }\n\n function renderCustomLabel({\n x,\n y,\n payload: {value: label},\n index\n }: {\n x: number;\n y: number;\n payload: {value: string};\n index: number;\n }) {\n const currentData = formatedData.find(({subject}) => subject === label);\n const percentagesValues: number[] = pipe(\n omit('subject'),\n mapValues(value => `${value}%`),\n values\n )(currentData);\n\n return buildCustomLabel({\n index,\n x,\n y,\n percentagesValues,\n label,\n activeDot,\n chartType,\n formatedColors,\n onClick: handleOnDotClick\n });\n }\n const formatedData = useMemo(() => formatData(legend, data), [legend, data]);\n\n return (\n <RadarChart\n width={width}\n height={height}\n margin={margin ?? (isMobile ? {top: 80} : {top: 180})}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius=\"80%\"\n data={formatedData}\n >\n {gradients}\n {buildRadars(totalDataset, handleOnDotClick, activeDot)}\n <PolarGrid strokeDasharray={10} strokeWidth={2} radialLines={false} />\n <PolarAngleAxis dataKey=\"subject\" tick={!isMobile && renderCustomLabel} />\n <PolarRadiusAxis tick={false} axisLine={false} domain={[0, 100]} />\n {isMobile ? <Tooltip cursor={false} content={<CustomTooltip />} /> : null}\n </RadarChart>\n );\n};\n\nconst ResponsiveLearningProfileRadarChart = (props: LearningProfileRadarChartPropTypes) => (\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <LearningProfileRadarChart {...props} />\n </ResponsiveContainer>\n);\n\nLearningProfileRadarChart.propTypes = learningProfileRadarChartPropTypes;\nResponsiveLearningProfileRadarChart.propTypes = learningProfileRadarChartPropTypes;\n\nexport default ResponsiveLearningProfileRadarChart;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAyBA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAWA;AACA,MAAMA,GAAa,GAAG;EAACC,MAAM,EAAE;IAACC,CAAC,EAAE,CAAC,GAAL;IAAUC,CAAC,EAAE,CAAC;EAAd,CAAT;EAA4BC,SAAS,EAAE,QAAvC;EAAiDC,MAAM,EAAE;AAAzD,CAAtB;AACA,MAAMC,MAAgB,GAAG;EAACL,MAAM,EAAE;IAACC,CAAC,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N,CAA5B,CAHhB;IAIE,EAAE,EAAC,KAJL;IAKE,EAAE,EAAC,KALL;IAME,WAAW,EAAC,KANd;IAOE,IAAI,EAAE4H;EAPR,GASGb,SATH,EAUG/C,WAAW,CAACC,YAAD,EAAeC,gBAAf,EAAiCT,SAAjC,CAVd,eAWE,6BAAC,mBAAD;IAAW,eAAe,EAAE,EAA5B;IAAgC,WAAW,EAAE,CAA7C;IAAgD,WAAW,EAAE;EAA7D,EAXF,eAYE,6BAAC,wBAAD;IAAgB,OAAO,EAAC,SAAxB;IAAkC,IAAI,EAAE,CAAC+C,QAAD,IAAayB;EAArD,EAZF,eAaE,6BAAC,yBAAD;IAAiB,IAAI,EAAE,KAAvB;IAA8B,QAAQ,EAAE,KAAxC;IAA+C,MAAM,EAAE,CAAC,CAAD,EAAI,GAAJ;EAAvD,EAbF,EAcGzB,QAAQ,gBAAG,6BAAC,iBAAD;IAAS,MAAM,EAAE,KAAjB;IAAwB,OAAO,eAAE,6BAAC,aAAD;EAAjC,EAAH,GAA4D,IAdvE,CADF;AAkBD,CA9HM;;;;AAgIP,MAAM2B,mCAAmC,GAAIC,KAAD,iBAC1C,6BAAC,6BAAD;EAAqB,KAAK,EAAC,MAA3B;EAAkC,MAAM,EAAC;AAAzC,gBACE,6BAAC,yBAAD,EAA+BA,KAA/B,CADF,CADF;;AAMAjC,yBAAyB,CAACkC,SAA1B,2CAAsCC,yCAAtC;AACAH,mCAAmC,CAACE,SAApC,2CAAgDC,yCAAhD;eAEeH,mC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["top","offset","x","y","alignment","margin","bottom","right","marginRight","left","marginLeft","BLACK","WHITE","DEFAULT_MAIN_COLOR","DEFAULT_COLORS","gradient","fill","stroke","percentage","color","background","label","CHART_CONFIGS","triangle","name","ticks","sideCount","quadrilateral","pentagon","hexagon","DOT_DEFAULT_PROPS","strokeWidth","strokeOpacity","r","pointerEvents","style","cursor","DOT_ACTIVE_PROPS","RADAR_DEFAULT_PROPS","fillOpacity","Gradient","type","colors","firstColor","secondColor","CustomTooltip","active","payload","length","tooltip","tooltipLabel","tooltipValue","value","CustomDot","cx","cy","onDotHover","onDotClick","activeDot","dataName","subject","onTouchStart","onClick","e","stopPropagation","onMouseOver","onMouseLeave","buildRadars","totalDataset","handleDotHover","handleOnDotClick","index","datakey","dataset","CustomLabel","percentagesValues","chartType","formatedColors","primarySkinColor","exploreLocale","hoveredDot","onExploreClick","hovered","setHovered","useState","isCurrentDotActive","offsetX","offsetY","rest","onLabelClick","handleExploreClick","buttonExploreProps","customStyle","height","backgroundColor","convert","transition","icon","position","faIcon","size","handleMouseOver","useCallback","handleMouseLeave","extraOffsetY","tickeForeignObject","classnames","tickWrapper","tickWrapperFocus","tickWrapperHover","alignItems","textAlign","opacity","map","colorLabel","i","tickValue","tickLabel","buttonWrapper","CHART_CONFIGS_BY_SIDE_COUNT","formatValues","values_","val","formatData","legend","data_","ref","LearningProfileRadarChart","data","colorsProps","width","legacyContext","isMobile","setIsMobile","setActiveDot","setHoveredDot","skin","GetSkinFromContext","translate","GetTranslateFromContext","Object","assign","useMemo","gradients","userAgent","navigator","isMobile_","getIsMobile","setIsMobile_","useEffect","handleClick","undefined","window","addEventListener","removeEventListener","handleOnActiveDotClick","formatedData","find","indexOf","skillRef","key","renderCustomLabel","props","currentData","ResponsiveLearningProfileRadarChart","contextTypes","Provider","childContextTypes","propTypes","learningProfileRadarChartPropTypes"],"sources":["../../../src/molecule/learning-profile-radar-chart/index.tsx"],"sourcesContent":["import React, {Fragment, useCallback, useEffect, useMemo, useState} from 'react';\nimport {\n Radar,\n RadarChart,\n PolarGrid,\n PolarAngleAxis,\n ResponsiveContainer,\n Tooltip,\n PolarRadiusAxis\n} from 'recharts';\nimport {\n pipe,\n keyBy,\n mapValues,\n size,\n getOr,\n map,\n toPairs,\n values,\n isEmpty,\n omit,\n fromPairs,\n times,\n flatten,\n findKey,\n get\n} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {isMobile as getIsMobile} from '../../util/check-is-mobile';\nimport ButtonLink from '../../atom/button-link';\nimport {ButtonLinkProps} from '../../atom/button-link/types';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport {\n ActiveDotType,\n FormatedColorsType,\n FormatedDataType,\n LearningProfileRadarChartPropTypes,\n TickType,\n learningProfileRadarChartPropTypes\n} from './types';\nimport style from './style.css';\n\ntype CHART_TYPE_TYPE = keyof typeof CHART_CONFIGS;\n\n/* TICK_POSITIONS */\nconst top: TickType = {offset: {x: -100, y: -75}, alignment: 'center', margin: 'auto'};\nconst bottom: TickType = {offset: {x: -100, y: 10}, alignment: 'center', margin: 'auto'};\nconst right: TickType = {offset: {x: 30, y: -10}, alignment: 'start', marginRight: 'auto'};\nconst left: TickType = {offset: {x: -230, y: -10}, alignment: 'end', marginLeft: 'auto'};\n\n/* CONSTANTS */\nconst BLACK = '#000000ff';\nconst WHITE = '#ffffffff';\nconst DEFAULT_MAIN_COLOR = '#0062ffff';\n\nconst DEFAULT_COLORS: FormatedColorsType = {\n gradient: {\n fill: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR],\n stroke: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR]\n },\n percentage: {\n color: BLACK,\n background: WHITE\n },\n label: {\n color: BLACK\n }\n};\n\nconst CHART_CONFIGS = {\n triangle: {\n name: 'triangle',\n ticks: [top, right, left],\n sideCount: 3\n },\n quadrilateral: {\n name: 'quadrilateral',\n ticks: [top, right, bottom, left],\n sideCount: 4\n },\n pentagon: {\n name: 'pentagon',\n ticks: [top, right, right, left, left],\n sideCount: 5\n },\n hexagon: {\n name: 'hexagon',\n ticks: [top, right, right, bottom, left, left],\n sideCount: 6\n }\n} as const;\n\nconst DOT_DEFAULT_PROPS = {\n strokeWidth: 2,\n strokeOpacity: 0.4,\n fill: '#fff',\n r: 4,\n pointerEvents: 'all',\n style: {cursor: 'pointer'}\n} as const;\n\nconst DOT_ACTIVE_PROPS = {\n fill: '#fff',\n r: 6,\n strokeWidth: 4,\n strokeOpacity: 0.6\n} as const;\n\nconst RADAR_DEFAULT_PROPS = {\n strokeWidth: 3,\n strokeOpacity: 0.2,\n fillOpacity: 0.2\n} as const;\n\n/* COMPONENTS */\nconst Gradient = ({type, colors: [firstColor, secondColor]}: {type: string; colors: string[]}) => (\n <defs>\n <linearGradient id={`gradient-${type}`} x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\">\n <stop offset=\"0%\" stopColor={firstColor} />\n <stop offset=\"100%\" stopColor={secondColor} />\n </linearGradient>\n </defs>\n);\n\nconst CustomTooltip = ({\n active,\n payload,\n label\n}: {\n active?: boolean;\n payload?: {value: number}[];\n label?: string;\n}) =>\n active && !!payload?.length ? (\n <div className={style.tooltip}>\n <span className={style.tooltipLabel}>{label}</span>\n <span className={style.tooltipValue}>{payload[0].value}%</span>\n </div>\n ) : null;\n\nconst CustomDot = ({\n cx,\n cy,\n payload,\n onDotHover,\n onDotClick,\n stroke,\n activeDot,\n dataName\n}: {\n cx?: number;\n cy?: number;\n payload?: {payload: {subject: string} & {[datakey: string]: number}; name: string};\n onDotHover: (name: string) => void;\n onDotClick: (name: string) => void;\n dataKey: string;\n stroke: string;\n activeDot?: ActiveDotType;\n dataName: string;\n}) => (\n <circle\n {...{\n ...DOT_DEFAULT_PROPS,\n ...(payload?.payload.subject === activeDot?.label && DOT_ACTIVE_PROPS),\n stroke,\n cx,\n cy,\n onTouchStart: () => {\n if (!payload?.name) return;\n onDotClick(payload.name);\n },\n onClick: e => {\n e.stopPropagation();\n\n if (!payload?.name) return;\n onDotClick(payload.name);\n },\n onMouseOver: () => {\n if (!payload?.name) return;\n onDotHover(payload.name);\n },\n onMouseLeave: () => onDotHover(''),\n 'data-name': dataName\n }}\n />\n);\n\nconst buildRadars = (\n totalDataset: number,\n handleDotHover: (name: string) => void,\n handleOnDotClick: (name: string) => void,\n activeDot?: ActiveDotType\n) =>\n times(index => {\n const datakey = `value${index + 1}`;\n const dataset = `dataset-${index + 1}`;\n\n return (\n <Radar\n {...RADAR_DEFAULT_PROPS}\n fill={`url(#gradient-fill-${index})`}\n stroke={`url(#gradient-stroke-${index})`}\n key={dataset}\n name={dataset}\n dataKey={datakey}\n activeDot={{\n ...DOT_ACTIVE_PROPS,\n stroke: `url(#gradient-stroke-${index})`\n }}\n // only on mobile\n // to handle dot style on hover (convert to click)\n // use with the tooltip component\n dot={\n <CustomDot\n onDotHover={handleDotHover}\n onDotClick={handleOnDotClick}\n activeDot={activeDot}\n dataKey={datakey}\n stroke={`url(#gradient-stroke-${index})`}\n dataName={`dot-${dataset}`}\n />\n }\n />\n );\n }, totalDataset);\n\nconst CustomLabel = ({\n index,\n x,\n y,\n percentagesValues,\n label,\n activeDot,\n chartType,\n formatedColors,\n primarySkinColor,\n exploreLocale,\n hoveredDot,\n onClick,\n onExploreClick\n}: {\n index: number;\n x: number;\n y: number;\n percentagesValues: number[];\n label: string;\n chartType: CHART_TYPE_TYPE;\n formatedColors: FormatedColorsType[];\n activeDot?: ActiveDotType;\n primarySkinColor: string;\n exploreLocale: string;\n hoveredDot: string;\n onClick: (name: string) => void;\n onExploreClick: (name: string) => void;\n}) => {\n const [hovered, setHovered] = useState(false);\n const isCurrentDotActive = activeDot?.label === label;\n const {\n offset: {x: offsetX, y: offsetY},\n alignment,\n ...rest\n } = CHART_CONFIGS[chartType].ticks[index];\n\n function onLabelClick(e: React.MouseEvent) {\n e.stopPropagation();\n onClick(label);\n }\n\n function handleExploreClick() {\n onExploreClick(label);\n }\n\n const buttonExploreProps: ButtonLinkProps = {\n customStyle: {\n height: '36px',\n backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),\n color: hovered ? '#FFFFFF' : primarySkinColor,\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'\n },\n onClick: handleExploreClick,\n 'aria-label': `${label}, ${exploreLocale}`,\n label: exploreLocale,\n 'data-name': 'learner-skill-card-explore-button',\n icon: {\n position: 'left',\n faIcon: {\n name: 'compass',\n backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),\n color: hovered ? '#FFFFFF' : primarySkinColor,\n size: 16\n }\n }\n };\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const extraOffsetY = isCurrentDotActive && index === 0 ? -25 : 0;\n\n return (\n <g>\n <foreignObject\n className={style.tickeForeignObject}\n x={x + offsetX}\n y={y + offsetY + extraOffsetY}\n width=\"200\"\n height=\"65\"\n >\n <div\n data-name={label}\n onClick={onLabelClick}\n className={classnames(\n style.tickWrapper,\n isCurrentDotActive && style.tickWrapperFocus,\n hoveredDot === label && style.tickWrapperHover\n )}\n style={{\n ...rest,\n alignItems: alignment,\n textAlign: alignment,\n opacity: !isEmpty(activeDot) && !isCurrentDotActive ? 0.3 : 1\n }}\n >\n {formatedColors.map(\n ({percentage: {color, background}, label: {color: colorLabel}}, i) => (\n <Fragment key={i}>\n <span className={style.tickValue} style={{color, background}}>\n {percentagesValues[i]}\n </span>\n <span className={style.tickLabel} style={{color: colorLabel}}>\n {label}\n </span>\n </Fragment>\n )\n )}\n {isCurrentDotActive ? (\n <div\n className={style.buttonWrapper}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-name=\"button-explore-wrapper\"\n >\n <ButtonLink {...buttonExploreProps} />\n </div>\n ) : null}\n </div>\n </foreignObject>\n </g>\n );\n};\n\n/* UTILS */\nconst CHART_CONFIGS_BY_SIDE_COUNT = pipe(keyBy('sideCount'), mapValues('name'))(CHART_CONFIGS);\n\nconst formatValues: (values_: number | number[]) => Record<string, number> = pipe(\n values_ => flatten([values_]),\n values_ => values_.map((val: number, i: number): [string, number] => [`value${i + 1}`, val]),\n fromPairs\n);\n\n/* this convert incoming component data to rechart data structure */\nexport const formatData: (\n legend: {[ref: string]: string},\n data_: LearningProfileRadarChartPropTypes['data']\n) => FormatedDataType[] = (legend, data_) =>\n pipe(\n toPairs,\n map(([ref, values_]: [string, number | number[]]) => ({\n ...formatValues(values_),\n subject: legend[ref]\n }))\n )(data_);\n\nexport const LearningProfileRadarChart = (\n {\n data,\n legend,\n totalDataset,\n colors: colorsProps,\n onClick,\n onExploreClick,\n width,\n height,\n margin\n }: LearningProfileRadarChartPropTypes,\n legacyContext: WebContextValues\n) => {\n const [isMobile, setIsMobile] = useState(false);\n const [activeDot, setActiveDot] = useState<ActiveDotType>();\n const [hoveredDot, setHoveredDot] = useState('');\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const primarySkinColor = get('common.primary', skin);\n\n const formatedColors = times(i => {\n if (!colorsProps?.length) return DEFAULT_COLORS;\n\n const colors = colorsProps[i];\n return colors ? Object.assign({}, DEFAULT_COLORS, colors) : DEFAULT_COLORS;\n })(totalDataset);\n\n const chartType: CHART_TYPE_TYPE = useMemo(\n () => getOr('hexagon', size(data), CHART_CONFIGS_BY_SIDE_COUNT),\n [data]\n );\n\n const gradients = useMemo(\n () =>\n formatedColors.map(({gradient: {fill, stroke}}, index) => (\n <svg key={`gradient-${index}`}>\n <Gradient type={`fill-${index}`} colors={fill} />\n <Gradient type={`stroke-${index}`} colors={stroke} />\n </svg>\n )),\n [formatedColors]\n );\n\n const userAgent = navigator?.userAgent;\n const isMobile_ = useMemo(() => getIsMobile(userAgent), [userAgent]);\n\n const setIsMobile_ = useCallback(() => {\n setIsMobile(isMobile_);\n }, [isMobile_]);\n\n useEffect(() => setIsMobile_(), [setIsMobile_]);\n\n useEffect(() => {\n const handleClick = () => {\n setActiveDot(undefined);\n onClick(undefined);\n };\n\n !isEmpty(activeDot) && window.addEventListener('click', handleClick);\n\n return () => {\n window.removeEventListener('click', handleClick);\n };\n }, [activeDot, onClick, setActiveDot]);\n\n function handleOnActiveDotClick() {\n setActiveDot(undefined);\n onClick(undefined);\n }\n\n function handleOnDotClick(label: string) {\n if (!isEmpty(activeDot) && activeDot?.label === label) {\n handleOnActiveDotClick();\n return;\n }\n const payload = formatedData.find(({subject}) => subject === label);\n if (!payload) return;\n\n const index = formatedData.indexOf(payload);\n const datakey = `value${index + 1}`;\n const skillRef = findKey(val => val === payload?.subject, legend);\n\n if (skillRef) {\n setActiveDot({\n key: datakey,\n value: payload[datakey],\n label: payload.subject\n });\n onClick(skillRef);\n }\n }\n\n function handleExploreClick(label: string) {\n const payload = formatedData.find(({subject}) => subject === label);\n if (!payload) return;\n\n const skillRef = findKey(val => val === payload?.subject, legend);\n\n if (skillRef) {\n onExploreClick(skillRef);\n }\n }\n\n function renderCustomLabel(props: {\n x: number;\n y: number;\n payload: {value: string};\n index: number;\n }) {\n const {\n x,\n y,\n payload: {value: label},\n index\n } = props;\n const currentData = formatedData.find(({subject}) => subject === label);\n const percentagesValues: number[] = pipe(\n omit('subject'),\n mapValues(value => `${value}%`),\n values\n )(currentData);\n\n return (\n <CustomLabel\n index={index}\n x={x}\n y={y}\n percentagesValues={percentagesValues}\n label={label}\n activeDot={activeDot}\n chartType={chartType}\n formatedColors={formatedColors}\n primarySkinColor={primarySkinColor}\n exploreLocale={translate('Explore')}\n hoveredDot={hoveredDot}\n onClick={handleOnDotClick}\n onExploreClick={handleExploreClick}\n />\n );\n }\n const formatedData = useMemo(() => formatData(legend, data), [legend, data]);\n\n return (\n <RadarChart\n width={width}\n height={height}\n margin={margin ?? (isMobile ? {top: 80} : {top: 180})}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius=\"80%\"\n data={formatedData}\n >\n {gradients}\n <PolarGrid strokeDasharray={10} strokeWidth={2} radialLines={false} />\n <PolarAngleAxis dataKey=\"subject\" tick={!isMobile && renderCustomLabel} />\n <PolarRadiusAxis tick={false} axisLine={false} domain={[0, 100]} />\n {buildRadars(totalDataset, setHoveredDot, handleOnDotClick, activeDot)}\n {isMobile ? <Tooltip cursor={false} content={<CustomTooltip />} /> : null}\n </RadarChart>\n );\n};\n\nconst ResponsiveLearningProfileRadarChart = (props: LearningProfileRadarChartPropTypes) => (\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <LearningProfileRadarChart {...props} />\n </ResponsiveContainer>\n);\n\nLearningProfileRadarChart.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nLearningProfileRadarChart.propTypes = learningProfileRadarChartPropTypes;\nResponsiveLearningProfileRadarChart.propTypes = learningProfileRadarChartPropTypes;\n\nexport default ResponsiveLearningProfileRadarChart;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AA0BA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAQA;;;;;;;;;;;;;;AAIA;AACA,MAAMA,GAAa,GAAG;EAACC,MAAM,EAAE;IAACC,CAAC,EAAE,CAAC,GAAL;IAAUC,CAAC,EAAE,CAAC;EAAd,CAAT;EAA4BC,SAAS,EAAE,QAAvC;EAAiDC,MAAM,EAAE;AAAzD,CAAtB;AACA,MAAMC,MAAgB,GAAG;EAACL,MAAM,EAAE;IAACC,CAAC,EAAE,CAAC,GAAL;IAAUC,CAAC,EAAE;EAAb,CAAT;EAA2BC,SAAS,EAAE,QAAtC;EAAgDC,MAAM,EAAE;AAAxD,CAAzB;AACA,MAAME,KAAe,GAAG;EAACN,MAAM,EAAE;IAACC,CAAC,EAAE,EAAJ;IAAQC,CAAC,EAAE,CAAC;EAAZ,CAAT;EAA0BC,SAAS,EAAE,OAArC;EAA8CI,WAAW,EAAE;AAA3D,CAAxB;AACA,MAAMC,IAAc,GAAG;EAACR,MAAM,EAAE;IAACC,CAAC,EAAE,CAAC,GAAL;IAAUC,CAAC,EAAE,CAAC;EAAd,CAAT;EAA4BC,SAAS,EAAE,KAAvC;EAA8CM,UAAU,EAAE;AAA1D,CAAvB;AAEA;;AACA,MAAMC,KAAK,GAAG,WAAd;AACA,MAAMC,KAAK,GAAG,WAAd;AACA,MAAMC,kBAAkB,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;IAAgC,WAAW,EAAE,CAA7C;IAAgD,WAAW,EAAE;EAA7D,EAVF,eAWE,6BAAC,wBAAD;IAAgB,OAAO,EAAC,SAAxB;IAAkC,IAAI,EAAE,CAACX,QAAD,IAAa6B;EAArD,EAXF,eAYE,6BAAC,yBAAD;IAAiB,IAAI,EAAE,KAAvB;IAA8B,QAAQ,EAAE,KAAxC;IAA+C,MAAM,EAAE,CAAC,CAAD,EAAI,GAAJ;EAAvD,EAZF,EAaG9F,WAAW,CAACC,YAAD,EAAemE,aAAf,EAA8BjE,gBAA9B,EAAgDZ,SAAhD,CAbd,EAcG0E,QAAQ,gBAAG,6BAAC,iBAAD;IAAS,MAAM,EAAE,KAAjB;IAAwB,OAAO,eAAE,6BAAC,aAAD;EAAjC,EAAH,GAA4D,IAdvE,CADF;AAkBD,CAjKM;;;;AAmKP,MAAMgC,mCAAmC,GAAIF,KAAD,iBAC1C,6BAAC,6BAAD;EAAqB,KAAK,EAAC,MAA3B;EAAkC,MAAM,EAAC;AAAzC,gBACE,6BAAC,yBAAD,EAA+BA,KAA/B,CADF,CADF;;AAMAnC,yBAAyB,CAACsC,YAA1B,GAAyC;EACvC7B,IAAI,EAAE8B,iBAAA,CAASC,iBAAT,CAA2B/B,IADM;EAEvCE,SAAS,EAAE4B,iBAAA,CAASC,iBAAT,CAA2B7B;AAFC,CAAzC;AAKAX,yBAAyB,CAACyC,SAA1B,2CAAsCC,yCAAtC;AACAL,mCAAmC,CAACI,SAApC,2CAAgDC,yCAAhD;eAEeL,mC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@value colors: "../../variables/colors.css";
|
|
2
2
|
@value cm_primary_blue from colors;
|
|
3
3
|
@value cm_grey_50 from colors;
|
|
4
|
+
@value cm_grey_75 from colors;
|
|
4
5
|
@value lightDark from colors;
|
|
5
6
|
|
|
6
7
|
.tickeForeignObject {
|
|
@@ -27,6 +28,14 @@
|
|
|
27
28
|
width: fit-content;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
.tickWrapper:hover,
|
|
32
|
+
.tickWrapperHover {
|
|
33
|
+
background-color: cm_grey_75;
|
|
34
|
+
border-radius: 12px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
30
39
|
.tickValue {
|
|
31
40
|
padding: 4px;
|
|
32
41
|
border-radius: 12px;
|
|
@@ -64,4 +73,9 @@
|
|
|
64
73
|
.tooltipValue {
|
|
65
74
|
font-size: 14px;
|
|
66
75
|
font-weight: 700;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.buttonWrapper {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 36px;
|
|
67
81
|
}
|
|
@@ -20,6 +20,7 @@ export declare const learningProfileRadarChartPropTypes: {
|
|
|
20
20
|
}> | null | undefined)[]>;
|
|
21
21
|
width: PropTypes.Requireable<number>;
|
|
22
22
|
height: PropTypes.Requireable<number>;
|
|
23
|
+
onExploreClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
24
|
};
|
|
24
25
|
export declare const customDotPropTypes: {
|
|
25
26
|
cx: PropTypes.Requireable<number>;
|
|
@@ -74,6 +75,7 @@ export declare type LearningProfileRadarChartPropTypes = {
|
|
|
74
75
|
};
|
|
75
76
|
totalDataset: number;
|
|
76
77
|
onClick: (skillRef?: string) => void;
|
|
78
|
+
onExploreClick: (label?: string) => void;
|
|
77
79
|
colors?: ColorType[];
|
|
78
80
|
width?: number;
|
|
79
81
|
height?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/learning-profile-radar-chart/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,kCAAkC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/learning-profile-radar-chart/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,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EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -26,7 +26,8 @@ const learningProfileRadarChartPropTypes = {
|
|
|
26
26
|
})
|
|
27
27
|
})),
|
|
28
28
|
width: _propTypes.default.number,
|
|
29
|
-
height: _propTypes.default.number
|
|
29
|
+
height: _propTypes.default.number,
|
|
30
|
+
onExploreClick: _propTypes.default.func
|
|
30
31
|
};
|
|
31
32
|
exports.learningProfileRadarChartPropTypes = learningProfileRadarChartPropTypes;
|
|
32
33
|
const customDotPropTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["learningProfileRadarChartPropTypes","data","PropTypes","objectOf","oneOfType","arrayOf","number","isRequired","totalDataset","onDotClick","func","colors","shape","gradient","fill","string","stroke","percentage","color","background","label","width","height","customDotPropTypes","cx","cy","payload","value","subject","name","index","activeDot","key","dataKey","customTooltipPropTypes","active","bool","gradientPropTypes","type"],"sources":["../../../src/molecule/learning-profile-radar-chart/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\n// PROPTYPES\nexport const learningProfileRadarChartPropTypes = {\n data: PropTypes.objectOf(\n PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number])\n ).isRequired,\n totalDataset: PropTypes.number.isRequired,\n onDotClick: PropTypes.func,\n colors: PropTypes.arrayOf(\n PropTypes.shape({\n gradient: PropTypes.shape({\n fill: PropTypes.arrayOf(PropTypes.string),\n stroke: PropTypes.arrayOf(PropTypes.string)\n }),\n percentage: PropTypes.shape({\n color: PropTypes.string,\n background: PropTypes.string\n }),\n label: PropTypes.shape({\n color: PropTypes.string\n })\n })\n ),\n width: PropTypes.number,\n height: PropTypes.number\n};\n\nexport const customDotPropTypes = {\n cx: PropTypes.number,\n cy: PropTypes.number,\n payload: PropTypes.shape({\n payload: PropTypes.shape({\n value: PropTypes.number,\n subject: PropTypes.string\n }),\n name: PropTypes.string\n }),\n onDotClick: PropTypes.func,\n index: PropTypes.number,\n activeDot: PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.number,\n key: PropTypes.string\n }),\n dataKey: PropTypes.string,\n stroke: PropTypes.string\n};\n\nexport const customTooltipPropTypes = {\n active: PropTypes.bool,\n payload: PropTypes.arrayOf(\n PropTypes.shape({\n value: PropTypes.number\n })\n ),\n label: PropTypes.string\n};\n\nexport const gradientPropTypes = {\n type: PropTypes.string,\n colors: PropTypes.arrayOf(PropTypes.string)\n};\n\n// TYPES\nexport type ColorType = {\n gradient?: {\n fill?: string[];\n stroke?: string[];\n };\n percentage?: {\n color?: string;\n background?: string;\n };\n label?: {\n color?: string;\n };\n};\n\nexport type LearningProfileRadarChartPropTypes = {\n data: {\n [ref: string]: number | number[];\n };\n legend: {\n [ref: string]: string;\n };\n totalDataset: number;\n onClick: (skillRef?: string) => void;\n colors?: ColorType[];\n width?: number;\n height?: number;\n margin?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n};\n\nexport type CustomDotPropTypes = {\n cx: number;\n cy: number;\n payload: {\n payload: {\n value: number;\n subject: string;\n };\n name: string;\n };\n onDotClick: (name: string) => void;\n index: number;\n activeDot?: {\n label: string;\n value: number;\n key: string;\n };\n dataKey: string;\n stroke: string;\n};\n\nexport type CustomTooltipPropTypes = {\n active: boolean;\n payload: {\n value: number;\n }[];\n label: string;\n};\n\nexport type GradientPropTypes = {\n type: string;\n colors: string[];\n};\n\nexport type TickType = {\n offset: {x: number; y: number};\n alignment: 'center' | 'start' | 'end';\n margin?: 'auto';\n marginLeft?: 'auto';\n marginRight?: 'auto';\n};\n\nexport type FormatedColorsType = {\n gradient: {\n fill: string[];\n stroke: string[];\n };\n percentage: {\n color: string;\n background: string;\n };\n label: {\n color: string;\n };\n};\n\nexport type FormatedDataType = {\n subject: string;\n} & {\n [key: string]: number | string;\n};\n\nexport type ActiveDotType = {\n key: string;\n value: number | string;\n label: string;\n};\n"],"mappings":";;;;;AAAA;;;;AAEA;AACO,MAAMA,kCAAkC,GAAG;EAChDC,IAAI,EAAEC,kBAAA,CAAUC,QAAV,CACJD,kBAAA,CAAUE,SAAV,CAAoB,CAACF,kBAAA,CAAUG,OAAV,CAAkBH,kBAAA,CAAUI,MAA5B,CAAD,EAAsCJ,kBAAA,CAAUI,MAAhD,CAApB,CADI,EAEJC,UAH8C;EAIhDC,YAAY,EAAEN,kBAAA,CAAUI,MAAV,CAAiBC,UAJiB;EAKhDE,UAAU,EAAEP,kBAAA,CAAUQ,IAL0B;EAMhDC,MAAM,EAAET,kBAAA,CAAUG,OAAV,CACNH,kBAAA,CAAUU,KAAV,CAAgB;IACdC,QAAQ,EAAEX,kBAAA,CAAUU,KAAV,CAAgB;MACxBE,IAAI,EAAEZ,kBAAA,CAAUG,OAAV,CAAkBH,kBAAA,CAAUa,MAA5B,CADkB;MAExBC,MAAM,EAAEd,kBAAA,CAAUG,OAAV,CAAkBH,kBAAA,CAAUa,MAA5B;IAFgB,CAAhB,CADI;IAKdE,UAAU,EAAEf,kBAAA,CAAUU,KAAV,CAAgB;MAC1BM,KAAK,EAAEhB,kBAAA,CAAUa,MADS;MAE1BI,UAAU,EAAEjB,kBAAA,CAAUa;IAFI,CAAhB,CALE;IASdK,KAAK,EAAElB,kBAAA,CAAUU,KAAV,CAAgB;MACrBM,KAAK,EAAEhB,kBAAA,CAAUa;IADI,CAAhB;EATO,CAAhB,CADM,CANwC;EAqBhDM,KAAK,EAAEnB,kBAAA,CAAUI,MArB+B;EAsBhDgB,MAAM,EAAEpB,kBAAA,CAAUI;
|
|
1
|
+
{"version":3,"file":"types.js","names":["learningProfileRadarChartPropTypes","data","PropTypes","objectOf","oneOfType","arrayOf","number","isRequired","totalDataset","onDotClick","func","colors","shape","gradient","fill","string","stroke","percentage","color","background","label","width","height","onExploreClick","customDotPropTypes","cx","cy","payload","value","subject","name","index","activeDot","key","dataKey","customTooltipPropTypes","active","bool","gradientPropTypes","type"],"sources":["../../../src/molecule/learning-profile-radar-chart/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\n// PROPTYPES\nexport const learningProfileRadarChartPropTypes = {\n data: PropTypes.objectOf(\n PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number])\n ).isRequired,\n totalDataset: PropTypes.number.isRequired,\n onDotClick: PropTypes.func,\n colors: PropTypes.arrayOf(\n PropTypes.shape({\n gradient: PropTypes.shape({\n fill: PropTypes.arrayOf(PropTypes.string),\n stroke: PropTypes.arrayOf(PropTypes.string)\n }),\n percentage: PropTypes.shape({\n color: PropTypes.string,\n background: PropTypes.string\n }),\n label: PropTypes.shape({\n color: PropTypes.string\n })\n })\n ),\n width: PropTypes.number,\n height: PropTypes.number,\n onExploreClick: PropTypes.func\n};\n\nexport const customDotPropTypes = {\n cx: PropTypes.number,\n cy: PropTypes.number,\n payload: PropTypes.shape({\n payload: PropTypes.shape({\n value: PropTypes.number,\n subject: PropTypes.string\n }),\n name: PropTypes.string\n }),\n onDotClick: PropTypes.func,\n index: PropTypes.number,\n activeDot: PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.number,\n key: PropTypes.string\n }),\n dataKey: PropTypes.string,\n stroke: PropTypes.string\n};\n\nexport const customTooltipPropTypes = {\n active: PropTypes.bool,\n payload: PropTypes.arrayOf(\n PropTypes.shape({\n value: PropTypes.number\n })\n ),\n label: PropTypes.string\n};\n\nexport const gradientPropTypes = {\n type: PropTypes.string,\n colors: PropTypes.arrayOf(PropTypes.string)\n};\n\n// TYPES\nexport type ColorType = {\n gradient?: {\n fill?: string[];\n stroke?: string[];\n };\n percentage?: {\n color?: string;\n background?: string;\n };\n label?: {\n color?: string;\n };\n};\n\nexport type LearningProfileRadarChartPropTypes = {\n data: {\n [ref: string]: number | number[];\n };\n legend: {\n [ref: string]: string;\n };\n totalDataset: number;\n onClick: (skillRef?: string) => void;\n onExploreClick: (label?: string) => void;\n colors?: ColorType[];\n width?: number;\n height?: number;\n margin?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n};\n\nexport type CustomDotPropTypes = {\n cx: number;\n cy: number;\n payload: {\n payload: {\n value: number;\n subject: string;\n };\n name: string;\n };\n onDotClick: (name: string) => void;\n index: number;\n activeDot?: {\n label: string;\n value: number;\n key: string;\n };\n dataKey: string;\n stroke: string;\n};\n\nexport type CustomTooltipPropTypes = {\n active: boolean;\n payload: {\n value: number;\n }[];\n label: string;\n};\n\nexport type GradientPropTypes = {\n type: string;\n colors: string[];\n};\n\nexport type TickType = {\n offset: {x: number; y: number};\n alignment: 'center' | 'start' | 'end';\n margin?: 'auto';\n marginLeft?: 'auto';\n marginRight?: 'auto';\n};\n\nexport type FormatedColorsType = {\n gradient: {\n fill: string[];\n stroke: string[];\n };\n percentage: {\n color: string;\n background: string;\n };\n label: {\n color: string;\n };\n};\n\nexport type FormatedDataType = {\n subject: string;\n} & {\n [key: string]: number | string;\n};\n\nexport type ActiveDotType = {\n key: string;\n value: number | string;\n label: string;\n};\n"],"mappings":";;;;;AAAA;;;;AAEA;AACO,MAAMA,kCAAkC,GAAG;EAChDC,IAAI,EAAEC,kBAAA,CAAUC,QAAV,CACJD,kBAAA,CAAUE,SAAV,CAAoB,CAACF,kBAAA,CAAUG,OAAV,CAAkBH,kBAAA,CAAUI,MAA5B,CAAD,EAAsCJ,kBAAA,CAAUI,MAAhD,CAApB,CADI,EAEJC,UAH8C;EAIhDC,YAAY,EAAEN,kBAAA,CAAUI,MAAV,CAAiBC,UAJiB;EAKhDE,UAAU,EAAEP,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CAAgB;IACzBQ,KAAK,EAAElB,kBAAA,CAAUa,MADQ;IAEzBa,KAAK,EAAE1B,kBAAA,CAAUI,MAFQ;IAGzB2B,GAAG,EAAE/B,kBAAA,CAAUa;EAHU,CAAhB,CAZqB;EAiBhCmB,OAAO,EAAEhC,kBAAA,CAAUa,MAjBa;EAkBhCC,MAAM,EAAEd,kBAAA,CAAUa;AAlBc,CAA3B;;AAqBA,MAAMoB,sBAAsB,GAAG;EACpCC,MAAM,EAAElC,kBAAA,CAAUmC,IADkB;EAEpCV,OAAO,EAAEzB,kBAAA,CAAUG,OAAV,CACPH,kBAAA,CAAUU,KAAV,CAAgB;IACdgB,KAAK,EAAE1B,kBAAA,CAAUI;EADH,CAAhB,CADO,CAF2B;EAOpCc,KAAK,EAAElB,kBAAA,CAAUa;AAPmB,CAA/B;;AAUA,MAAMuB,iBAAiB,GAAG;EAC/BC,IAAI,EAAErC,kBAAA,CAAUa,MADe;EAE/BJ,MAAM,EAAET,kBAAA,CAAUG,OAAV,CAAkBH,kBAAA,CAAUa,MAA5B;AAFuB,CAA1B,C,CAKP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/review-correction-popin/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/review-correction-popin/index.js"],"names":[],"mappings":";AA6EA,gEAqDC"}
|
|
@@ -55,7 +55,7 @@ const KlfButton = ({
|
|
|
55
55
|
}
|
|
56
56
|
}), [klf.tooltip]);
|
|
57
57
|
const toolTipProps = (0, _react.useMemo)(() => ({
|
|
58
|
-
closeToolTipInformationTextAriaLabel: translate('
|
|
58
|
+
closeToolTipInformationTextAriaLabel: translate('close_tooltip_information'),
|
|
59
59
|
AnchorElement: AnchorButton,
|
|
60
60
|
TooltipContent,
|
|
61
61
|
'aria-label': translate('More details'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["KlfButton","klf","legacyContext","translate","GetTranslateFromContext","klfButtonProps","useMemo","icon","position","type","AnchorButton","useCallback","onKeyDown","style","klfButtonContainer","klfButton","TooltipContent","tooltipText","__html","tooltip","toolTipProps","closeToolTipInformationTextAriaLabel","AnchorElement","tooltipClassName","toolTipCustomization","klfContainer","propTypes","contextTypes","Provider","childContextTypes","ReviewCorrectionPopin","props","information","resultLabel","next","nextQuestionButtonProps","cta","ICONS","right","RightIcon","wrong","WrongIcon","Icon","wrapper","classnames","popin","correctionSection","iconCircle","iconRight","iconWrong","feedbackSection","labelContainer","label","message","actions","actionsWrong","nextQuestionContainer","nextQuestionButton"],"sources":["../../../src/molecule/review-correction-popin/index.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport ButtonLink from '../../atom/button-link';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport Tooltip from '../../atom/tooltip';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst KlfButton = ({klf}, legacyContext) => {\n const translate = GetTranslateFromContext(legacyContext);\n const klfButtonProps = useMemo(\n () => ({\n ...klf,\n icon: {\n position: 'left',\n type: 'key'\n },\n type: 'primary'\n }),\n [klf]\n );\n\n const AnchorButton = useCallback(\n ({onKeyDown}) => (\n <div className={style.klfButtonContainer}>\n <ButtonLink\n {...klfButtonProps}\n className={style.klfButton}\n onKeyDown={onKeyDown}\n useTitle={false}\n />\n </div>\n ),\n [klfButtonProps]\n );\n\n const TooltipContent = useCallback(\n () => (\n <span\n className={style.tooltipText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: klf.tooltip}}\n />\n ),\n [klf.tooltip]\n );\n\n const toolTipProps = useMemo(\n () => ({\n closeToolTipInformationTextAriaLabel: translate(
|
|
1
|
+
{"version":3,"file":"index.js","names":["KlfButton","klf","legacyContext","translate","GetTranslateFromContext","klfButtonProps","useMemo","icon","position","type","AnchorButton","useCallback","onKeyDown","style","klfButtonContainer","klfButton","TooltipContent","tooltipText","__html","tooltip","toolTipProps","closeToolTipInformationTextAriaLabel","AnchorElement","tooltipClassName","toolTipCustomization","klfContainer","propTypes","contextTypes","Provider","childContextTypes","ReviewCorrectionPopin","props","information","resultLabel","next","nextQuestionButtonProps","cta","ICONS","right","RightIcon","wrong","WrongIcon","Icon","wrapper","classnames","popin","correctionSection","iconCircle","iconRight","iconWrong","feedbackSection","labelContainer","label","message","actions","actionsWrong","nextQuestionContainer","nextQuestionButton"],"sources":["../../../src/molecule/review-correction-popin/index.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport ButtonLink from '../../atom/button-link';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport Tooltip from '../../atom/tooltip';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst KlfButton = ({klf}, legacyContext) => {\n const translate = GetTranslateFromContext(legacyContext);\n const klfButtonProps = useMemo(\n () => ({\n ...klf,\n icon: {\n position: 'left',\n type: 'key'\n },\n type: 'primary'\n }),\n [klf]\n );\n\n const AnchorButton = useCallback(\n ({onKeyDown}) => (\n <div className={style.klfButtonContainer}>\n <ButtonLink\n {...klfButtonProps}\n className={style.klfButton}\n onKeyDown={onKeyDown}\n useTitle={false}\n />\n </div>\n ),\n [klfButtonProps]\n );\n\n const TooltipContent = useCallback(\n () => (\n <span\n className={style.tooltipText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: klf.tooltip}}\n />\n ),\n [klf.tooltip]\n );\n\n const toolTipProps = useMemo(\n () => ({\n closeToolTipInformationTextAriaLabel: translate('close_tooltip_information'),\n AnchorElement: AnchorButton,\n TooltipContent,\n 'aria-label': translate('More details'),\n tooltipClassName: style.toolTipCustomization\n }),\n [AnchorButton, TooltipContent, translate]\n );\n\n return (\n <div className={style.klfContainer}>\n <Tooltip {...toolTipProps} />\n </div>\n );\n};\n\nKlfButton.propTypes = {\n klf: propTypes.klf\n};\n\nKlfButton.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst ReviewCorrectionPopin = props => {\n const {information, resultLabel, type, klf, next} = props;\n\n const nextQuestionButtonProps = {\n ...next,\n type: 'primary'\n };\n\n const cta = type === 'wrong' ? <KlfButton klf={klf} /> : null;\n\n const ICONS = {\n right: RightIcon,\n wrong: WrongIcon\n };\n const Icon = ICONS[type];\n\n return (\n <div className={style.wrapper} data-testid=\"review-correction-popin\">\n <div className={classnames(style.popin, type === 'right' ? style.right : style.wrong)}>\n <div className={style.correctionSection}>\n <div className={style.iconCircle}>\n <Icon className={type === 'right' ? style.iconRight : style.iconWrong} />\n </div>\n <div className={style.resultLabel}>\n <span aria-label={resultLabel} role=\"status\">\n {resultLabel}\n </span>\n </div>\n </div>\n <div className={style.feedbackSection}>\n <div className={style.information} aria-label=\"answer-information\">\n <div className={style.labelContainer}>\n <span className={style.label} aria-label={information.label}>\n {information.label}\n </span>\n </div>\n <span\n className={style.message}\n aria-label={information.message}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: information.message}}\n />\n </div>\n </div>\n <div className={type === 'right' ? style.actions : style.actionsWrong}>\n {cta}\n <div className={style.nextQuestionContainer} data-testid=\"next-question-button-container\">\n <ButtonLink {...nextQuestionButtonProps} className={style.nextQuestionButton} />\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nReviewCorrectionPopin.propTypes = propTypes;\n\nexport default ReviewCorrectionPopin;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,EAAQC,aAAR,KAA0B;EAC1C,MAAMC,SAAS,GAAG,IAA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CAAMmB,WAAtB;IAAmC,cAAW;EAA9C,gBACE;IAAK,SAAS,EAAEnB,cAAA,CAAMsC;EAAtB,gBACE;IAAM,SAAS,EAAEtC,cAAA,CAAMuC,KAAvB;IAA8B,cAAYpB,WAAW,CAACoB;EAAtD,GACGpB,WAAW,CAACoB,KADf,CADF,CADF,eAME;IACE,SAAS,EAAEvC,cAAA,CAAMwC,OADnB;IAEE,cAAYrB,WAAW,CAACqB,OAF1B,CAGE;IAHF;IAIE,uBAAuB,EAAE;MAACnC,MAAM,EAAEc,WAAW,CAACqB;IAArB;EAJ3B,EANF,CADF,CAXF,eA0BE;IAAK,SAAS,EAAE5C,IAAI,KAAK,OAAT,GAAmBI,cAAA,CAAMyC,OAAzB,GAAmCzC,cAAA,CAAM0C;EAAzD,GACGnB,GADH,eAEE;IAAK,SAAS,EAAEvB,cAAA,CAAM2C,qBAAtB;IAA6C,eAAY;EAAzD,gBACE,6BAAC,mBAAD,eAAgBrB,uBAAhB;IAAyC,SAAS,EAAEtB,cAAA,CAAM4C;EAA1D,GADF,CAFF,CA1BF,CADF,CADF;AAqCD,CArDD;;AAuDA3B,qBAAqB,CAACJ,SAAtB,2CAAkCA,kBAAlC;eAEeI,qB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/skill-picker-modal/index.js"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/skill-picker-modal/index.js"],"names":[],"mappings":";AASA,gFAgIC"}
|