@coorpacademy/components 11.25.0 → 11.27.0

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 (48) hide show
  1. package/README.md +8 -1
  2. package/es/atom/gradient/index.native.d.ts.map +1 -1
  3. package/es/atom/gradient/index.native.js +5 -7
  4. package/es/atom/gradient/index.native.js.map +1 -1
  5. package/es/atom/icon/index.d.ts +6 -0
  6. package/es/atom/icon/index.d.ts.map +1 -0
  7. package/es/atom/icon/index.js +67 -0
  8. package/es/atom/icon/index.js.map +1 -0
  9. package/es/atom/icon/style.css +7 -0
  10. package/es/globals.d.js.map +1 -1
  11. package/es/molecule/dashboard/learning-profile-banner/style.css +3 -5
  12. package/es/molecule/learning-profile-radar-chart/index.d.ts +57 -0
  13. package/es/molecule/learning-profile-radar-chart/index.d.ts.map +1 -0
  14. package/es/molecule/learning-profile-radar-chart/index.js +387 -0
  15. package/es/molecule/learning-profile-radar-chart/index.js.map +1 -0
  16. package/es/molecule/learning-profile-radar-chart/style.css +49 -0
  17. package/es/molecule/learning-profile-radar-chart/types.d.ts +145 -0
  18. package/es/molecule/learning-profile-radar-chart/types.d.ts.map +1 -0
  19. package/es/molecule/learning-profile-radar-chart/types.js +54 -0
  20. package/es/molecule/learning-profile-radar-chart/types.js.map +1 -0
  21. package/es/util/check-is-mobile.d.ts +2 -0
  22. package/es/util/check-is-mobile.d.ts.map +1 -0
  23. package/es/util/check-is-mobile.js +3 -0
  24. package/es/util/check-is-mobile.js.map +1 -0
  25. package/lib/atom/gradient/index.native.d.ts.map +1 -1
  26. package/lib/atom/gradient/index.native.js +5 -7
  27. package/lib/atom/gradient/index.native.js.map +1 -1
  28. package/lib/atom/icon/index.d.ts +6 -0
  29. package/lib/atom/icon/index.d.ts.map +1 -0
  30. package/lib/atom/icon/index.js +92 -0
  31. package/lib/atom/icon/index.js.map +1 -0
  32. package/lib/atom/icon/style.css +7 -0
  33. package/lib/globals.d.js.map +1 -1
  34. package/lib/molecule/dashboard/learning-profile-banner/style.css +3 -5
  35. package/lib/molecule/learning-profile-radar-chart/index.d.ts +57 -0
  36. package/lib/molecule/learning-profile-radar-chart/index.d.ts.map +1 -0
  37. package/lib/molecule/learning-profile-radar-chart/index.js +416 -0
  38. package/lib/molecule/learning-profile-radar-chart/index.js.map +1 -0
  39. package/lib/molecule/learning-profile-radar-chart/style.css +49 -0
  40. package/lib/molecule/learning-profile-radar-chart/types.d.ts +145 -0
  41. package/lib/molecule/learning-profile-radar-chart/types.d.ts.map +1 -0
  42. package/lib/molecule/learning-profile-radar-chart/types.js +67 -0
  43. package/lib/molecule/learning-profile-radar-chart/types.js.map +1 -0
  44. package/lib/util/check-is-mobile.d.ts +2 -0
  45. package/lib/util/check-is-mobile.d.ts.map +1 -0
  46. package/lib/util/check-is-mobile.js +10 -0
  47. package/lib/util/check-is-mobile.js.map +1 -0
  48. package/package.json +11 -4
@@ -0,0 +1,416 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.formatData = exports.default = exports.LearningProfileRadarChart = void 0;
5
+
6
+ var _findKey2 = _interopRequireDefault(require("lodash/fp/findKey"));
7
+
8
+ var _flatten2 = _interopRequireDefault(require("lodash/fp/flatten"));
9
+
10
+ var _times2 = _interopRequireDefault(require("lodash/fp/times"));
11
+
12
+ var _fromPairs2 = _interopRequireDefault(require("lodash/fp/fromPairs"));
13
+
14
+ var _omit2 = _interopRequireDefault(require("lodash/fp/omit"));
15
+
16
+ var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
17
+
18
+ var _values2 = _interopRequireDefault(require("lodash/fp/values"));
19
+
20
+ var _toPairs2 = _interopRequireDefault(require("lodash/fp/toPairs"));
21
+
22
+ var _map2 = _interopRequireDefault(require("lodash/fp/map"));
23
+
24
+ var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
25
+
26
+ var _size2 = _interopRequireDefault(require("lodash/fp/size"));
27
+
28
+ var _mapValues2 = _interopRequireDefault(require("lodash/fp/mapValues"));
29
+
30
+ var _keyBy2 = _interopRequireDefault(require("lodash/fp/keyBy"));
31
+
32
+ var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
33
+
34
+ var _react = _interopRequireWildcard(require("react"));
35
+
36
+ var _recharts = require("recharts");
37
+
38
+ var _classnames = _interopRequireDefault(require("classnames"));
39
+
40
+ var _checkIsMobile = require("../../util/check-is-mobile");
41
+
42
+ var _style = _interopRequireDefault(require("./style.css"));
43
+
44
+ var _types = require("./types");
45
+
46
+ const _excluded = ["offset", "alignment"];
47
+
48
+ 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); }
49
+
50
+ 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; }
51
+
52
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
53
+
54
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
55
+
56
+ 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); }
57
+
58
+ /* TICK_POSITIONS */
59
+ const top = {
60
+ offset: {
61
+ x: -100,
62
+ y: -65
63
+ },
64
+ alignment: 'center',
65
+ margin: 'auto'
66
+ };
67
+ const bottom = {
68
+ offset: {
69
+ x: -100,
70
+ y: 10
71
+ },
72
+ alignment: 'center',
73
+ margin: 'auto'
74
+ };
75
+ const right = {
76
+ offset: {
77
+ x: 30,
78
+ y: -10
79
+ },
80
+ alignment: 'start',
81
+ marginRight: 'auto'
82
+ };
83
+ const left = {
84
+ offset: {
85
+ x: -230,
86
+ y: -10
87
+ },
88
+ alignment: 'end',
89
+ marginLeft: 'auto'
90
+ };
91
+ /* CONSTANTS */
92
+
93
+ const BLACK = '#000000ff';
94
+ const WHITE = '#ffffffff';
95
+ const DEFAULT_MAIN_COLOR = '#0062ffff';
96
+ const DEFAULT_COLORS = {
97
+ gradient: {
98
+ fill: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR],
99
+ stroke: [DEFAULT_MAIN_COLOR, DEFAULT_MAIN_COLOR]
100
+ },
101
+ percentage: {
102
+ color: BLACK,
103
+ background: WHITE
104
+ },
105
+ label: {
106
+ color: BLACK
107
+ }
108
+ };
109
+ const CHART_CONFIGS = {
110
+ triangle: {
111
+ name: 'triangle',
112
+ ticks: [top, right, left],
113
+ sideCount: 3
114
+ },
115
+ quadrilateral: {
116
+ name: 'quadrilateral',
117
+ ticks: [top, right, bottom, left],
118
+ sideCount: 4
119
+ },
120
+ pentagon: {
121
+ name: 'pentagon',
122
+ ticks: [top, right, right, left, left],
123
+ sideCount: 5
124
+ },
125
+ hexagon: {
126
+ name: 'hexagon',
127
+ ticks: [top, right, right, bottom, left, left],
128
+ sideCount: 6
129
+ }
130
+ };
131
+ const DOT_DEFAULT_PROPS = {
132
+ strokeWidth: 4,
133
+ strokeOpacity: 0.2,
134
+ fill: '#fff',
135
+ r: 8,
136
+ pointerEvents: 'all',
137
+ style: {
138
+ cursor: 'pointer'
139
+ }
140
+ };
141
+ const DOT_ACTIVE_PROPS = {
142
+ fill: '#fff',
143
+ r: 8,
144
+ strokeWidth: 6,
145
+ strokeOpacity: 0.5
146
+ };
147
+ const RADAR_DEFAULT_PROPS = {
148
+ strokeWidth: 6,
149
+ strokeOpacity: 0.2,
150
+ fillOpacity: 0.2
151
+ };
152
+ /* COMPONENTS */
153
+
154
+ const Gradient = ({
155
+ type,
156
+ colors: [firstColor, secondColor]
157
+ }) => /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("linearGradient", {
158
+ id: `gradient-${type}`,
159
+ x1: "0%",
160
+ y1: "0%",
161
+ x2: "0%",
162
+ y2: "100%"
163
+ }, /*#__PURE__*/_react.default.createElement("stop", {
164
+ offset: "0%",
165
+ stopColor: firstColor
166
+ }), /*#__PURE__*/_react.default.createElement("stop", {
167
+ offset: "100%",
168
+ stopColor: secondColor
169
+ })));
170
+
171
+ const CustomTooltip = ({
172
+ active,
173
+ payload,
174
+ label
175
+ }) => active && !!payload?.length ? /*#__PURE__*/_react.default.createElement("div", {
176
+ className: _style.default.tooltip
177
+ }, /*#__PURE__*/_react.default.createElement("p", null, label), /*#__PURE__*/_react.default.createElement("p", null, payload[0].value, "%")) : null;
178
+
179
+ const CustomDot = ({
180
+ cx,
181
+ cy,
182
+ payload,
183
+ onDotClick,
184
+ stroke,
185
+ activeDot,
186
+ dataName
187
+ }) => /*#__PURE__*/_react.default.createElement("circle", _extends({}, DOT_DEFAULT_PROPS, payload?.payload.subject === activeDot?.label && DOT_ACTIVE_PROPS, {
188
+ stroke,
189
+ cx,
190
+ cy,
191
+ onClick: e => {
192
+ e.stopPropagation();
193
+ if (!payload?.name) return;
194
+ onDotClick(payload.name);
195
+ },
196
+ 'data-name': dataName
197
+ }));
198
+
199
+ const buildRadars = (totalDataset, handleOnDotClick, activeDot) => (0, _times2.default)(index => {
200
+ const datakey = `value${index + 1}`;
201
+ const dataset = `dataset-${index + 1}`;
202
+ return /*#__PURE__*/_react.default.createElement(_recharts.Radar, _extends({}, RADAR_DEFAULT_PROPS, {
203
+ fill: `url(#gradient-fill-${index})`,
204
+ stroke: `url(#gradient-stroke-${index})`,
205
+ key: dataset,
206
+ name: dataset,
207
+ dataKey: datakey,
208
+ activeDot: _extends({}, DOT_ACTIVE_PROPS, {
209
+ stroke: `url(#gradient-stroke-${index})`
210
+ }) // only on mobile
211
+ // to handle dot style on hover (convert to click)
212
+ // use with the tooltip component
213
+ ,
214
+ dot: /*#__PURE__*/_react.default.createElement(CustomDot, {
215
+ onDotClick: handleOnDotClick(datakey),
216
+ activeDot: activeDot,
217
+ dataKey: datakey,
218
+ stroke: `url(#gradient-stroke-${index})`,
219
+ dataName: dataset
220
+ })
221
+ }));
222
+ }, totalDataset);
223
+
224
+ const buildCustomLabel = ({
225
+ index,
226
+ x,
227
+ y,
228
+ percentagesValues,
229
+ label,
230
+ activeDot,
231
+ chartType,
232
+ formatedColors
233
+ }) => {
234
+ const isCurrentDotActive = activeDot?.label === label;
235
+
236
+ const _CHART_CONFIGS$chartT = CHART_CONFIGS[chartType].ticks[index],
237
+ {
238
+ offset: {
239
+ x: offsetX,
240
+ y: offsetY
241
+ },
242
+ alignment
243
+ } = _CHART_CONFIGS$chartT,
244
+ rest = _objectWithoutPropertiesLoose(_CHART_CONFIGS$chartT, _excluded);
245
+
246
+ return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("foreignObject", {
247
+ x: x + offsetX,
248
+ y: y + offsetY,
249
+ width: "200",
250
+ height: "65"
251
+ }, /*#__PURE__*/_react.default.createElement("div", {
252
+ className: (0, _classnames.default)(_style.default.tickWrapper, isCurrentDotActive && _style.default.tickWrapperFocus),
253
+ style: _extends({}, rest, {
254
+ alignItems: alignment,
255
+ textAlign: alignment,
256
+ opacity: !(0, _isEmpty2.default)(activeDot) && !isCurrentDotActive ? 0.3 : 1
257
+ })
258
+ }, formatedColors.map(({
259
+ percentage: {
260
+ color,
261
+ background
262
+ },
263
+ label: {
264
+ color: colorLabel
265
+ }
266
+ }, i) => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
267
+ key: i
268
+ }, /*#__PURE__*/_react.default.createElement("span", {
269
+ className: _style.default.tickValue,
270
+ style: {
271
+ color,
272
+ background
273
+ }
274
+ }, percentagesValues[i]), /*#__PURE__*/_react.default.createElement("span", {
275
+ className: _style.default.tickLabel,
276
+ style: {
277
+ color: colorLabel
278
+ }
279
+ }, label))))));
280
+ };
281
+ /* UTILS */
282
+
283
+
284
+ const CHART_CONFIGS_BY_SIDE_COUNT = (0, _pipe2.default)((0, _keyBy2.default)('sideCount'), (0, _mapValues2.default)('name'))(CHART_CONFIGS);
285
+ const formatValues = (0, _pipe2.default)(values_ => (0, _flatten2.default)([values_]), values_ => values_.map((val, i) => [`value${i + 1}`, val]), _fromPairs2.default);
286
+ /* this convert incoming component data to rechart data structure */
287
+
288
+ const formatData = (legend, data_) => (0, _pipe2.default)(_toPairs2.default, (0, _map2.default)(([ref, values_]) => _extends({}, formatValues(values_), {
289
+ subject: legend[ref]
290
+ })))(data_);
291
+
292
+ exports.formatData = formatData;
293
+
294
+ const LearningProfileRadarChart = ({
295
+ data,
296
+ legend,
297
+ totalDataset,
298
+ colors: colorsProps,
299
+ onClick,
300
+ width,
301
+ height
302
+ }) => {
303
+ const [isMobile, setIsMobile] = (0, _react.useState)(false);
304
+ const [activeDot, setActiveDot] = (0, _react.useState)();
305
+ const formatedColors = (0, _times2.default)(i => {
306
+ if (!colorsProps?.length) return DEFAULT_COLORS;
307
+ const colors = colorsProps[i];
308
+ return colors ? Object.assign({}, DEFAULT_COLORS, colors) : DEFAULT_COLORS;
309
+ })(totalDataset);
310
+ const chartType = (0, _react.useMemo)(() => (0, _getOr2.default)('hexagon', (0, _size2.default)(data), CHART_CONFIGS_BY_SIDE_COUNT), [data]);
311
+ const gradients = (0, _react.useMemo)(() => formatedColors.map(({
312
+ gradient: {
313
+ fill,
314
+ stroke
315
+ }
316
+ }, index) => /*#__PURE__*/_react.default.createElement("svg", {
317
+ key: `gradient-${index}`
318
+ }, /*#__PURE__*/_react.default.createElement(Gradient, {
319
+ type: `fill-${index}`,
320
+ colors: fill
321
+ }), /*#__PURE__*/_react.default.createElement(Gradient, {
322
+ type: `stroke-${index}`,
323
+ colors: stroke
324
+ }))), [formatedColors]);
325
+ const userAgent = navigator?.userAgent;
326
+ const isMobile_ = (0, _react.useMemo)(() => (0, _checkIsMobile.isMobile)(userAgent), [userAgent]);
327
+ const setIsMobile_ = (0, _react.useCallback)(() => {
328
+ setIsMobile(isMobile_);
329
+ }, [isMobile_]);
330
+ (0, _react.useEffect)(() => setIsMobile_(), [setIsMobile_]);
331
+ (0, _react.useEffect)(() => {
332
+ const handleClick = () => setActiveDot(undefined);
333
+
334
+ !(0, _isEmpty2.default)(activeDot) && window.addEventListener('click', handleClick);
335
+ return () => {
336
+ window.removeEventListener('click', handleClick);
337
+ };
338
+ }, [activeDot]);
339
+
340
+ function handleOnDotClick(datakey) {
341
+ return label => {
342
+ const payload = formatedData.find(data_ => data_.subject === label);
343
+ const skillRef = (0, _findKey2.default)(val => val === payload?.subject, legend);
344
+
345
+ if (payload && skillRef) {
346
+ setActiveDot({
347
+ key: datakey,
348
+ value: payload[datakey],
349
+ label: payload.subject
350
+ });
351
+ onClick(skillRef);
352
+ }
353
+ };
354
+ }
355
+
356
+ function renderCustomLabel({
357
+ x,
358
+ y,
359
+ payload: {
360
+ value: label
361
+ },
362
+ index
363
+ }) {
364
+ const currentData = formatedData.find(({
365
+ subject
366
+ }) => subject === label);
367
+ const percentagesValues = (0, _pipe2.default)((0, _omit2.default)('subject'), (0, _mapValues2.default)(value => `${value}%`), _values2.default)(currentData);
368
+ return buildCustomLabel({
369
+ index,
370
+ x,
371
+ y,
372
+ percentagesValues,
373
+ label,
374
+ activeDot,
375
+ chartType,
376
+ formatedColors
377
+ });
378
+ }
379
+
380
+ const formatedData = (0, _react.useMemo)(() => formatData(legend, data), [legend, data]);
381
+ return /*#__PURE__*/_react.default.createElement(_recharts.RadarChart, {
382
+ width: width,
383
+ height: height,
384
+ cx: "50%",
385
+ cy: "50%",
386
+ outerRadius: "80%",
387
+ data: formatedData
388
+ }, gradients, buildRadars(totalDataset, handleOnDotClick, activeDot), /*#__PURE__*/_react.default.createElement(_recharts.PolarGrid, {
389
+ strokeDasharray: 15,
390
+ strokeWidth: 3,
391
+ radialLines: false
392
+ }), /*#__PURE__*/_react.default.createElement(_recharts.PolarAngleAxis, {
393
+ dataKey: "subject",
394
+ tick: !isMobile && renderCustomLabel
395
+ }), /*#__PURE__*/_react.default.createElement(_recharts.PolarRadiusAxis, {
396
+ tick: false,
397
+ axisLine: false,
398
+ domain: [0, 100]
399
+ }), isMobile ? /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
400
+ cursor: false,
401
+ content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
402
+ }) : null);
403
+ };
404
+
405
+ exports.LearningProfileRadarChart = LearningProfileRadarChart;
406
+
407
+ const ResponsiveLearningProfileRadarChart = props => /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
408
+ width: "100%",
409
+ height: "100%"
410
+ }, /*#__PURE__*/_react.default.createElement(LearningProfileRadarChart, props));
411
+
412
+ LearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? _types.learningProfileRadarChartPropTypes : {};
413
+ ResponsiveLearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? _types.learningProfileRadarChartPropTypes : {};
414
+ var _default = ResponsiveLearningProfileRadarChart;
415
+ exports.default = _default;
416
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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","value","CustomDot","cx","cy","onDotClick","activeDot","dataName","subject","onClick","e","stopPropagation","buildRadars","totalDataset","handleOnDotClick","index","datakey","dataset","buildCustomLabel","percentagesValues","chartType","formatedColors","isCurrentDotActive","offsetX","offsetY","rest","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","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: -65}, 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: 4,\n strokeOpacity: 0.2,\n fill: '#fff',\n r: 8,\n pointerEvents: 'all',\n style: {cursor: 'pointer'}\n} as const;\n\nconst DOT_ACTIVE_PROPS = {\n fill: '#fff',\n r: 8,\n strokeWidth: 6,\n strokeOpacity: 0.5\n} as const;\n\nconst RADAR_DEFAULT_PROPS = {\n strokeWidth: 6,\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 <p>{label}</p>\n <p>{payload[0].value}%</p>\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 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: (datakey: string) => (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(datakey)}\n activeDot={activeDot}\n dataKey={datakey}\n stroke={`url(#gradient-stroke-${index})`}\n dataName={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}: {\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}) => {\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 return (\n <g>\n <foreignObject x={x + offsetX} y={y + offsetY} width=\"200\" height=\"65\">\n <div\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}: 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 = () => setActiveDot(undefined);\n\n !isEmpty(activeDot) && window.addEventListener('click', handleClick);\n\n return () => {\n window.removeEventListener('click', handleClick);\n };\n }, [activeDot]);\n\n function handleOnDotClick(datakey: string) {\n return (label: string) => {\n const payload = formatedData.find(data_ => data_.subject === label);\n const skillRef = findKey(val => val === payload?.subject, legend);\n\n if (payload && skillRef) {\n setActiveDot({\n key: datakey,\n value: payload[datakey],\n label: payload.subject\n });\n onClick(skillRef);\n }\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 });\n }\n const formatedData = useMemo(() => formatData(legend, data), [legend, data]);\n\n return (\n <RadarChart\n width={width}\n height={height}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius=\"80%\"\n data={formatedData}\n >\n {gradients}\n {buildRadars(totalDataset, handleOnDotClick, activeDot)}\n <PolarGrid strokeDasharray={15} strokeWidth={3} 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,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;E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EAAwC,CAACJ,MAAD,EAASI,IAAT,CAAxC,CAArB;EAEA,oBACE,6BAAC,oBAAD;IACE,KAAK,EAAEE,KADT;IAEE,MAAM,EAAEC,MAFV;IAGE,EAAE,EAAC,KAHL;IAIE,EAAE,EAAC,KAJL;IAKE,WAAW,EAAC,KALd;IAME,IAAI,EAAEqB;EANR,GAQGb,SARH,EASG7C,WAAW,CAACC,YAAD,EAAeC,gBAAf,EAAiCR,SAAjC,CATd,eAUE,6BAAC,mBAAD;IAAW,eAAe,EAAE,EAA5B;IAAgC,WAAW,EAAE,CAA7C;IAAgD,WAAW,EAAE;EAA7D,EAVF,eAWE,6BAAC,wBAAD;IAAgB,OAAO,EAAC,SAAxB;IAAkC,IAAI,EAAE,CAAC4C,QAAD,IAAawB;EAArD,EAXF,eAYE,6BAAC,yBAAD;IAAiB,IAAI,EAAE,KAAvB;IAA8B,QAAQ,EAAE,KAAxC;IAA+C,MAAM,EAAE,CAAC,CAAD,EAAI,GAAJ;EAAvD,EAZF,EAaGxB,QAAQ,gBAAG,6BAAC,iBAAD;IAAS,MAAM,EAAE,KAAjB;IAAwB,OAAO,eAAE,6BAAC,aAAD;EAAjC,EAAH,GAA4D,IAbvE,CADF;AAiBD,CAtHM;;;;AAwHP,MAAM0B,mCAAmC,GAAIC,KAAD,iBAC1C,6BAAC,6BAAD;EAAqB,KAAK,EAAC,MAA3B;EAAkC,MAAM,EAAC;AAAzC,gBACE,6BAAC,yBAAD,EAA+BA,KAA/B,CADF,CADF;;AAMAhC,yBAAyB,CAACiC,SAA1B,2CAAsCC,yCAAtC;AACAH,mCAAmC,CAACE,SAApC,2CAAgDC,yCAAhD;eAEeH,mC"}
@@ -0,0 +1,49 @@
1
+ @value colors: "../../variables/colors.css";
2
+ @value cm_primary_blue from colors;
3
+ @value cm_grey_50 from colors;
4
+ @value lightDark from colors;
5
+
6
+ .tickWrapper {
7
+ display: flex;
8
+ flex-direction: column;
9
+ justify-content: center;
10
+ align-items: end;
11
+ gap: 6px;
12
+ width: 100%;
13
+ height: 100%;
14
+ font-size: 14px;
15
+ font-family: 'Gilroy';
16
+ font-weight: 600;
17
+ padding: 0px 12px;
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ .tickWrapperFocus {
22
+ background-color: cm_grey_50;
23
+ border-radius: 12px;
24
+ width: fit-content;
25
+ }
26
+
27
+ .tickValue {
28
+ padding: 4px;
29
+ border-radius: 12px;
30
+ }
31
+
32
+ .tickLabel {
33
+ text-overflow: ellipsis;
34
+ overflow: hidden;
35
+ white-space: normal;
36
+ width: 100%;
37
+ width: fit-content;
38
+ }
39
+
40
+ .tooltip {
41
+ position: relative;
42
+ font-family: 'Gilroy';
43
+ font-weight: 600;
44
+ background-color: lightDark;
45
+ color: cm_grey_50;
46
+ padding: 4px 8px;
47
+ border-radius: 8px;
48
+ width: 100%;
49
+ }
@@ -0,0 +1,145 @@
1
+ import PropTypes from 'prop-types';
2
+ export declare const learningProfileRadarChartPropTypes: {
3
+ data: PropTypes.Validator<{
4
+ [x: string]: NonNullable<number | (number | null | undefined)[] | null | undefined> | null | undefined;
5
+ }>;
6
+ totalDataset: PropTypes.Validator<number>;
7
+ onDotClick: PropTypes.Requireable<(...args: any[]) => any>;
8
+ colors: PropTypes.Requireable<(PropTypes.InferProps<{
9
+ gradient: PropTypes.Requireable<PropTypes.InferProps<{
10
+ fill: PropTypes.Requireable<(string | null | undefined)[]>;
11
+ stroke: PropTypes.Requireable<(string | null | undefined)[]>;
12
+ }>>;
13
+ percentage: PropTypes.Requireable<PropTypes.InferProps<{
14
+ color: PropTypes.Requireable<string>;
15
+ background: PropTypes.Requireable<string>;
16
+ }>>;
17
+ label: PropTypes.Requireable<PropTypes.InferProps<{
18
+ color: PropTypes.Requireable<string>;
19
+ }>>;
20
+ }> | null | undefined)[]>;
21
+ width: PropTypes.Requireable<number>;
22
+ height: PropTypes.Requireable<number>;
23
+ };
24
+ export declare const customDotPropTypes: {
25
+ cx: PropTypes.Requireable<number>;
26
+ cy: PropTypes.Requireable<number>;
27
+ payload: PropTypes.Requireable<PropTypes.InferProps<{
28
+ payload: PropTypes.Requireable<PropTypes.InferProps<{
29
+ value: PropTypes.Requireable<number>;
30
+ subject: PropTypes.Requireable<string>;
31
+ }>>;
32
+ name: PropTypes.Requireable<string>;
33
+ }>>;
34
+ onDotClick: PropTypes.Requireable<(...args: any[]) => any>;
35
+ index: PropTypes.Requireable<number>;
36
+ activeDot: PropTypes.Requireable<PropTypes.InferProps<{
37
+ label: PropTypes.Requireable<string>;
38
+ value: PropTypes.Requireable<number>;
39
+ key: PropTypes.Requireable<string>;
40
+ }>>;
41
+ dataKey: PropTypes.Requireable<string>;
42
+ stroke: PropTypes.Requireable<string>;
43
+ };
44
+ export declare const customTooltipPropTypes: {
45
+ active: PropTypes.Requireable<boolean>;
46
+ payload: PropTypes.Requireable<(PropTypes.InferProps<{
47
+ value: PropTypes.Requireable<number>;
48
+ }> | null | undefined)[]>;
49
+ label: PropTypes.Requireable<string>;
50
+ };
51
+ export declare const gradientPropTypes: {
52
+ type: PropTypes.Requireable<string>;
53
+ colors: PropTypes.Requireable<(string | null | undefined)[]>;
54
+ };
55
+ export declare type ColorType = {
56
+ gradient?: {
57
+ fill?: string[];
58
+ stroke?: string[];
59
+ };
60
+ percentage?: {
61
+ color?: string;
62
+ background?: string;
63
+ };
64
+ label?: {
65
+ color?: string;
66
+ };
67
+ };
68
+ export declare type LearningProfileRadarChartPropTypes = {
69
+ data: {
70
+ [ref: string]: number | number[];
71
+ };
72
+ legend: {
73
+ [ref: string]: string;
74
+ };
75
+ totalDataset: number;
76
+ onClick: (skillRef: string) => void;
77
+ colors?: ColorType[];
78
+ width?: number;
79
+ height?: number;
80
+ };
81
+ export declare type CustomDotPropTypes = {
82
+ cx: number;
83
+ cy: number;
84
+ payload: {
85
+ payload: {
86
+ value: number;
87
+ subject: string;
88
+ };
89
+ name: string;
90
+ };
91
+ onDotClick: (name: string) => void;
92
+ index: number;
93
+ activeDot?: {
94
+ label: string;
95
+ value: number;
96
+ key: string;
97
+ };
98
+ dataKey: string;
99
+ stroke: string;
100
+ };
101
+ export declare type CustomTooltipPropTypes = {
102
+ active: boolean;
103
+ payload: {
104
+ value: number;
105
+ }[];
106
+ label: string;
107
+ };
108
+ export declare type GradientPropTypes = {
109
+ type: string;
110
+ colors: string[];
111
+ };
112
+ export declare type TickType = {
113
+ offset: {
114
+ x: number;
115
+ y: number;
116
+ };
117
+ alignment: 'center' | 'start' | 'end';
118
+ margin?: 'auto';
119
+ marginLeft?: 'auto';
120
+ marginRight?: 'auto';
121
+ };
122
+ export declare type FormatedColorsType = {
123
+ gradient: {
124
+ fill: string[];
125
+ stroke: string[];
126
+ };
127
+ percentage: {
128
+ color: string;
129
+ background: string;
130
+ };
131
+ label: {
132
+ color: string;
133
+ };
134
+ };
135
+ export declare type FormatedDataType = {
136
+ subject: string;
137
+ } & {
138
+ [key: string]: number | string;
139
+ };
140
+ export declare type ActiveDotType = {
141
+ key: string;
142
+ value: number | string;
143
+ label: string;
144
+ };
145
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;CAuB9C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;CAmB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAG7B,CAAC;AAGF,oBAAY,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,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