@coorpacademy/components 11.18.9-alpha.2 → 11.18.9
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/molecule/card/index.d.ts +52 -0
- package/es/molecule/card/index.d.ts.map +1 -1
- package/es/molecule/card/index.js +3 -2
- package/es/molecule/card/index.js.map +1 -1
- package/es/molecule/dashboard/cards-list/index.d.ts +56 -1
- package/es/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/es/molecule/dashboard/cards-list/index.js +39 -5
- package/es/molecule/dashboard/cards-list/index.js.map +1 -1
- package/es/molecule/dashboard/cards-list/prop-types.d.ts +14 -0
- package/es/molecule/dashboard/cards-list/prop-types.d.ts.map +1 -0
- package/es/molecule/dashboard/cards-list/prop-types.js +2 -0
- package/es/molecule/dashboard/cards-list/prop-types.js.map +1 -0
- package/es/template/app-player/popin-end/index.d.ts +52 -1
- package/es/template/app-player/popin-end/summary.d.ts +52 -1
- package/es/template/common/search-page/index.d.ts +52 -1
- package/es/template/teams-dashboard/index.d.ts +52 -1
- package/lib/molecule/card/index.d.ts +52 -0
- package/lib/molecule/card/index.d.ts.map +1 -1
- package/lib/molecule/card/index.js +5 -3
- package/lib/molecule/card/index.js.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.d.ts +56 -1
- package/lib/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.js +43 -5
- package/lib/molecule/dashboard/cards-list/index.js.map +1 -1
- package/lib/molecule/dashboard/cards-list/prop-types.d.ts +14 -0
- package/lib/molecule/dashboard/cards-list/prop-types.d.ts.map +1 -0
- package/lib/molecule/dashboard/cards-list/prop-types.js +2 -0
- package/lib/molecule/dashboard/cards-list/prop-types.js.map +1 -0
- package/lib/template/app-player/popin-end/index.d.ts +52 -1
- package/lib/template/app-player/popin-end/summary.d.ts +52 -1
- package/lib/template/common/search-page/index.d.ts +52 -1
- package/lib/template/teams-dashboard/index.d.ts +52 -1
- package/package.json +2 -2
|
@@ -115,13 +115,64 @@ declare namespace Summary {
|
|
|
115
115
|
dataName: PropTypes.Requireable<string>;
|
|
116
116
|
title: PropTypes.Requireable<string>;
|
|
117
117
|
showMore: PropTypes.Requireable<string>;
|
|
118
|
-
cards: PropTypes.Requireable<(PropTypes.InferProps<
|
|
118
|
+
cards: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
119
|
+
badge: PropTypes.Requireable<string>;
|
|
120
|
+
image: PropTypes.Requireable<string>;
|
|
121
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
122
|
+
adaptiv: PropTypes.Requireable<boolean>;
|
|
123
|
+
type: PropTypes.Requireable<string>;
|
|
124
|
+
title: PropTypes.Requireable<string>;
|
|
125
|
+
author: PropTypes.Requireable<string>;
|
|
126
|
+
certifiedAuthor: PropTypes.Requireable<boolean>;
|
|
127
|
+
customer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
128
|
+
theme: PropTypes.Requireable<string>;
|
|
129
|
+
type: PropTypes.Requireable<string>;
|
|
130
|
+
name: PropTypes.Requireable<string>;
|
|
131
|
+
coorpOriginal: PropTypes.Validator<boolean>;
|
|
132
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
133
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
134
|
+
}>>;
|
|
135
|
+
progress: PropTypes.Requireable<number>;
|
|
136
|
+
favorite: PropTypes.Requireable<boolean>;
|
|
137
|
+
addFavoriteToolTip: PropTypes.Requireable<string>;
|
|
138
|
+
removeFavoriteToolTip: PropTypes.Requireable<string>;
|
|
139
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
140
|
+
onFavoriteClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
141
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
142
|
+
notification: PropTypes.Requireable<PropTypes.InferProps<{
|
|
143
|
+
message: PropTypes.Validator<string>;
|
|
144
|
+
icon: PropTypes.Validator<string>;
|
|
145
|
+
}>>;
|
|
146
|
+
badgeCategory: PropTypes.Requireable<string>;
|
|
147
|
+
badgeLabel: PropTypes.Requireable<string>;
|
|
148
|
+
theme: PropTypes.Requireable<string>;
|
|
149
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
150
|
+
'background-aria-label': PropTypes.Requireable<string>;
|
|
151
|
+
'favorite-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
152
|
+
favorite: PropTypes.Requireable<string>;
|
|
153
|
+
addToFavorite: PropTypes.Requireable<string>;
|
|
154
|
+
removeFromFavorite: PropTypes.Requireable<string>;
|
|
155
|
+
}>>;
|
|
156
|
+
'selectable-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
157
|
+
select: PropTypes.Requireable<string>;
|
|
158
|
+
unSelect: PropTypes.Requireable<string>;
|
|
159
|
+
}>>;
|
|
160
|
+
'customer-aria-label': PropTypes.Requireable<string>;
|
|
161
|
+
'badge-aria-label': PropTypes.Requireable<string>;
|
|
162
|
+
'disabled-aria-label': PropTypes.Requireable<string>;
|
|
163
|
+
'card-content-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
164
|
+
author: PropTypes.Requireable<string>;
|
|
165
|
+
progression: PropTypes.Requireable<string>;
|
|
166
|
+
adaptive: PropTypes.Requireable<string>;
|
|
167
|
+
}>>;
|
|
168
|
+
}> | null | undefined)[]>;
|
|
119
169
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
120
170
|
onShowMore: PropTypes.Requireable<(...args: any[]) => any>;
|
|
121
171
|
'arrows-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
122
172
|
showMoreOnLeftAriaLabel: PropTypes.Requireable<string>;
|
|
123
173
|
showMoreOnRightAriaLabel: PropTypes.Requireable<string>;
|
|
124
174
|
}>>;
|
|
175
|
+
testingSizes: PropTypes.Requireable<any>;
|
|
125
176
|
}>>;
|
|
126
177
|
const feedback: PropTypes.Requireable<PropTypes.InferProps<{
|
|
127
178
|
title: PropTypes.Requireable<string>;
|
|
@@ -113,13 +113,64 @@ declare namespace SearchPage {
|
|
|
113
113
|
dataName: PropTypes.Requireable<string>;
|
|
114
114
|
title: PropTypes.Requireable<string>;
|
|
115
115
|
showMore: PropTypes.Requireable<string>;
|
|
116
|
-
cards: PropTypes.Requireable<(PropTypes.InferProps<
|
|
116
|
+
cards: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
117
|
+
badge: PropTypes.Requireable<string>;
|
|
118
|
+
image: PropTypes.Requireable<string>;
|
|
119
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
120
|
+
adaptiv: PropTypes.Requireable<boolean>;
|
|
121
|
+
type: PropTypes.Requireable<string>;
|
|
122
|
+
title: PropTypes.Requireable<string>;
|
|
123
|
+
author: PropTypes.Requireable<string>;
|
|
124
|
+
certifiedAuthor: PropTypes.Requireable<boolean>;
|
|
125
|
+
customer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
126
|
+
theme: PropTypes.Requireable<string>;
|
|
127
|
+
type: PropTypes.Requireable<string>;
|
|
128
|
+
name: PropTypes.Requireable<string>;
|
|
129
|
+
coorpOriginal: PropTypes.Validator<boolean>;
|
|
130
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
131
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
132
|
+
}>>;
|
|
133
|
+
progress: PropTypes.Requireable<number>;
|
|
134
|
+
favorite: PropTypes.Requireable<boolean>;
|
|
135
|
+
addFavoriteToolTip: PropTypes.Requireable<string>;
|
|
136
|
+
removeFavoriteToolTip: PropTypes.Requireable<string>;
|
|
137
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
138
|
+
onFavoriteClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
139
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
140
|
+
notification: PropTypes.Requireable<PropTypes.InferProps<{
|
|
141
|
+
message: PropTypes.Validator<string>;
|
|
142
|
+
icon: PropTypes.Validator<string>;
|
|
143
|
+
}>>;
|
|
144
|
+
badgeCategory: PropTypes.Requireable<string>;
|
|
145
|
+
badgeLabel: PropTypes.Requireable<string>;
|
|
146
|
+
theme: PropTypes.Requireable<string>;
|
|
147
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
148
|
+
'background-aria-label': PropTypes.Requireable<string>;
|
|
149
|
+
'favorite-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
150
|
+
favorite: PropTypes.Requireable<string>;
|
|
151
|
+
addToFavorite: PropTypes.Requireable<string>;
|
|
152
|
+
removeFromFavorite: PropTypes.Requireable<string>;
|
|
153
|
+
}>>;
|
|
154
|
+
'selectable-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
155
|
+
select: PropTypes.Requireable<string>;
|
|
156
|
+
unSelect: PropTypes.Requireable<string>;
|
|
157
|
+
}>>;
|
|
158
|
+
'customer-aria-label': PropTypes.Requireable<string>;
|
|
159
|
+
'badge-aria-label': PropTypes.Requireable<string>;
|
|
160
|
+
'disabled-aria-label': PropTypes.Requireable<string>;
|
|
161
|
+
'card-content-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
162
|
+
author: PropTypes.Requireable<string>;
|
|
163
|
+
progression: PropTypes.Requireable<string>;
|
|
164
|
+
adaptive: PropTypes.Requireable<string>;
|
|
165
|
+
}>>;
|
|
166
|
+
}> | null | undefined)[]>;
|
|
117
167
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
118
168
|
onShowMore: PropTypes.Requireable<(...args: any[]) => any>;
|
|
119
169
|
'arrows-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
120
170
|
showMoreOnLeftAriaLabel: PropTypes.Requireable<string>;
|
|
121
171
|
showMoreOnRightAriaLabel: PropTypes.Requireable<string>;
|
|
122
172
|
}>>;
|
|
173
|
+
testingSizes: PropTypes.Requireable<any>;
|
|
123
174
|
}>>;
|
|
124
175
|
const moreSortAriaLabel: PropTypes.Requireable<string>;
|
|
125
176
|
const moreFilterAriaLabel: PropTypes.Requireable<string>;
|
|
@@ -39,13 +39,64 @@ declare namespace TeamsDashboard {
|
|
|
39
39
|
dataName: PropTypes.Requireable<string>;
|
|
40
40
|
title: PropTypes.Requireable<string>;
|
|
41
41
|
showMore: PropTypes.Requireable<string>;
|
|
42
|
-
cards: PropTypes.Requireable<(PropTypes.InferProps<
|
|
42
|
+
cards: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
43
|
+
badge: PropTypes.Requireable<string>;
|
|
44
|
+
image: PropTypes.Requireable<string>;
|
|
45
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
46
|
+
adaptiv: PropTypes.Requireable<boolean>;
|
|
47
|
+
type: PropTypes.Requireable<string>;
|
|
48
|
+
title: PropTypes.Requireable<string>;
|
|
49
|
+
author: PropTypes.Requireable<string>;
|
|
50
|
+
certifiedAuthor: PropTypes.Requireable<boolean>;
|
|
51
|
+
customer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
52
|
+
theme: PropTypes.Requireable<string>;
|
|
53
|
+
type: PropTypes.Requireable<string>;
|
|
54
|
+
name: PropTypes.Requireable<string>;
|
|
55
|
+
coorpOriginal: PropTypes.Validator<boolean>;
|
|
56
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
57
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
58
|
+
}>>;
|
|
59
|
+
progress: PropTypes.Requireable<number>;
|
|
60
|
+
favorite: PropTypes.Requireable<boolean>;
|
|
61
|
+
addFavoriteToolTip: PropTypes.Requireable<string>;
|
|
62
|
+
removeFavoriteToolTip: PropTypes.Requireable<string>;
|
|
63
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
|
+
onFavoriteClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
66
|
+
notification: PropTypes.Requireable<PropTypes.InferProps<{
|
|
67
|
+
message: PropTypes.Validator<string>;
|
|
68
|
+
icon: PropTypes.Validator<string>;
|
|
69
|
+
}>>;
|
|
70
|
+
badgeCategory: PropTypes.Requireable<string>;
|
|
71
|
+
badgeLabel: PropTypes.Requireable<string>;
|
|
72
|
+
theme: PropTypes.Requireable<string>;
|
|
73
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
74
|
+
'background-aria-label': PropTypes.Requireable<string>;
|
|
75
|
+
'favorite-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
76
|
+
favorite: PropTypes.Requireable<string>;
|
|
77
|
+
addToFavorite: PropTypes.Requireable<string>;
|
|
78
|
+
removeFromFavorite: PropTypes.Requireable<string>;
|
|
79
|
+
}>>;
|
|
80
|
+
'selectable-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
81
|
+
select: PropTypes.Requireable<string>;
|
|
82
|
+
unSelect: PropTypes.Requireable<string>;
|
|
83
|
+
}>>;
|
|
84
|
+
'customer-aria-label': PropTypes.Requireable<string>;
|
|
85
|
+
'badge-aria-label': PropTypes.Requireable<string>;
|
|
86
|
+
'disabled-aria-label': PropTypes.Requireable<string>;
|
|
87
|
+
'card-content-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
88
|
+
author: PropTypes.Requireable<string>;
|
|
89
|
+
progression: PropTypes.Requireable<string>;
|
|
90
|
+
adaptive: PropTypes.Requireable<string>;
|
|
91
|
+
}>>;
|
|
92
|
+
}> | null | undefined)[]>;
|
|
43
93
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
94
|
onShowMore: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
95
|
'arrows-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
46
96
|
showMoreOnLeftAriaLabel: PropTypes.Requireable<string>;
|
|
47
97
|
showMoreOnRightAriaLabel: PropTypes.Requireable<string>;
|
|
48
98
|
}>>;
|
|
99
|
+
testingSizes: PropTypes.Requireable<any>;
|
|
49
100
|
}> | null | undefined)[]>;
|
|
50
101
|
const isLoading: PropTypes.Requireable<boolean>;
|
|
51
102
|
}
|
|
@@ -3,7 +3,59 @@ export namespace THEMES {
|
|
|
3
3
|
export { _default as default };
|
|
4
4
|
export const coorpmanager: any;
|
|
5
5
|
}
|
|
6
|
+
export const cardPropTypes: {
|
|
7
|
+
badge: PropTypes.Requireable<string>;
|
|
8
|
+
image: PropTypes.Requireable<string>;
|
|
9
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
10
|
+
adaptiv: PropTypes.Requireable<boolean>;
|
|
11
|
+
type: PropTypes.Requireable<string>;
|
|
12
|
+
title: PropTypes.Requireable<string>;
|
|
13
|
+
author: PropTypes.Requireable<string>;
|
|
14
|
+
certifiedAuthor: PropTypes.Requireable<boolean>;
|
|
15
|
+
customer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
theme: PropTypes.Requireable<string>;
|
|
17
|
+
type: PropTypes.Requireable<string>;
|
|
18
|
+
name: PropTypes.Requireable<string>;
|
|
19
|
+
coorpOriginal: PropTypes.Validator<boolean>;
|
|
20
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
22
|
+
}>>;
|
|
23
|
+
progress: PropTypes.Requireable<number>;
|
|
24
|
+
favorite: PropTypes.Requireable<boolean>;
|
|
25
|
+
addFavoriteToolTip: PropTypes.Requireable<string>;
|
|
26
|
+
removeFavoriteToolTip: PropTypes.Requireable<string>;
|
|
27
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
onFavoriteClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
30
|
+
notification: PropTypes.Requireable<PropTypes.InferProps<{
|
|
31
|
+
message: PropTypes.Validator<string>;
|
|
32
|
+
icon: PropTypes.Validator<string>;
|
|
33
|
+
}>>;
|
|
34
|
+
badgeCategory: PropTypes.Requireable<string>;
|
|
35
|
+
badgeLabel: PropTypes.Requireable<string>;
|
|
36
|
+
theme: PropTypes.Requireable<string>;
|
|
37
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
38
|
+
'background-aria-label': PropTypes.Requireable<string>;
|
|
39
|
+
'favorite-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
40
|
+
favorite: PropTypes.Requireable<string>;
|
|
41
|
+
addToFavorite: PropTypes.Requireable<string>;
|
|
42
|
+
removeFromFavorite: PropTypes.Requireable<string>;
|
|
43
|
+
}>>;
|
|
44
|
+
'selectable-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
45
|
+
select: PropTypes.Requireable<string>;
|
|
46
|
+
unSelect: PropTypes.Requireable<string>;
|
|
47
|
+
}>>;
|
|
48
|
+
'customer-aria-label': PropTypes.Requireable<string>;
|
|
49
|
+
'badge-aria-label': PropTypes.Requireable<string>;
|
|
50
|
+
'disabled-aria-label': PropTypes.Requireable<string>;
|
|
51
|
+
'card-content-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
52
|
+
author: PropTypes.Requireable<string>;
|
|
53
|
+
progression: PropTypes.Requireable<string>;
|
|
54
|
+
adaptive: PropTypes.Requireable<string>;
|
|
55
|
+
}>>;
|
|
56
|
+
};
|
|
6
57
|
export default Card;
|
|
58
|
+
import PropTypes from "prop-types";
|
|
7
59
|
declare const Card: React.NamedExoticComponent<object>;
|
|
8
60
|
import React from "react";
|
|
9
61
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/index.js"],"names":[],"mappings":";;;;;AAoPA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE;;;AA1JF,uDAuHG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.default = exports.THEMES = void 0;
|
|
4
|
+
exports.default = exports.cardPropTypes = exports.THEMES = void 0;
|
|
5
5
|
|
|
6
6
|
var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
|
|
7
7
|
|
|
@@ -256,7 +256,7 @@ const Card = /*#__PURE__*/(0, _react.memo)(function Card(props, context) {
|
|
|
256
256
|
Card.contextTypes = {
|
|
257
257
|
skin: _provider.default.childContextTypes.skin
|
|
258
258
|
};
|
|
259
|
-
|
|
259
|
+
const cardPropTypes = {
|
|
260
260
|
badge: _propTypes.default.string,
|
|
261
261
|
image: _propTypes.default.string,
|
|
262
262
|
disabled: _propTypes.default.bool,
|
|
@@ -285,7 +285,9 @@ Card.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
285
285
|
'badge-aria-label': _propTypes.default.string,
|
|
286
286
|
'disabled-aria-label': _propTypes.default.string,
|
|
287
287
|
'card-content-aria-label': _cardContent.default.propTypes['aria-label']
|
|
288
|
-
}
|
|
288
|
+
};
|
|
289
|
+
exports.cardPropTypes = cardPropTypes;
|
|
290
|
+
Card.propTypes = process.env.NODE_ENV !== "production" ? cardPropTypes : {};
|
|
289
291
|
var _default = Card;
|
|
290
292
|
exports.default = _default;
|
|
291
293
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["THEMES","default","coorpmanager","style","CardBackground","type","image","empty","ariaLabel","skin","externalContent","isExternalContent","primaryColor","whiteColor","EXTERNAL_CONTENT_ICONS","IconType","icon","iconColor","color","backgroundIcon","externalIconCircleWrapper","externalIcon","_backgroundIcon","classnames","externalIconCircleWithImageWrapper","backgroundColor","externalIconWithImage","imageWrapper","backgroundImage","externalContentHeader","externalBackground","emptyIcon","chapterImageWrapper","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","bool","Card","memo","props","context","badge","adaptiv","disabled","hidden","title","author","customer","certifiedAuthor","progress","favorite","addFavoriteToolTip","removeFavoriteToolTip","onClick","onFavoriteClick","isSelected","notification","badgeCategory","badgeLabel","theme","cardArialabel","backgroundAriaLabel","favoriteAriaLabel","selectableAriaLabel","customerAriaLabel","badgeAriaLabel","disabledArialabel","cardContentLabelAriaLabel","cardStyle","chapter","course","lazy","grid","handleClick","useMemo","e","lock","lockIcon","inlineBadgeStyle","getType","contentType","MODES","CARD","lockWrapper","shape","Customer","number","func","Notification","CardContentInfo","oneOf","Favorite","Selectable"],"sources":["../../../src/molecule/card/index.js"],"sourcesContent":["import React, {useMemo, memo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, isUndefined, pick, keys} from 'lodash/fp';\nimport {\n NovaSolidLoginLocked as LockIcon,\n NovaCompositionCoorpacademyPictures as PicturesIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport CardContentInfo, {MODES} from '../card-content';\nimport Customer from './customer';\nimport Favorite from './favorite';\nimport Selectable from './selectable';\nimport Notification from './notification';\nimport style from './style.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst CardBackground = ({type, image, empty, 'aria-label': ariaLabel}, {skin}) => {\n const externalContent = isExternalContent(type);\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const IconType = EXTERNAL_CONTENT_ICONS[type].icon;\n const iconColor = EXTERNAL_CONTENT_ICONS[type].color;\n const backgroundIcon = (\n <div className={style.externalIconCircleWrapper}>\n <IconType className={style.externalIcon} />\n </div>\n );\n\n if (image) {\n const _backgroundIcon = (\n <div\n className={classnames(\n style.externalIconCircleWrapper,\n style.externalIconCircleWithImageWrapper\n )}\n style={{\n backgroundColor: iconColor\n }}\n >\n <IconType className={style.externalIconWithImage} />\n </div>\n );\n\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor,\n backgroundImage: `url('${image}')`\n }}\n className={classnames(style.externalContentHeader, style.externalBackground)}\n >\n {_backgroundIcon}\n </div>\n </div>\n );\n }\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor\n }}\n className={style.externalContentHeader}\n >\n {backgroundIcon}\n </div>\n </div>\n );\n }\n\n const emptyIcon = empty ? (\n <PicturesIcon className={style.emptyIcon} style={{color: whiteColor}} />\n ) : null;\n return (\n <div\n className={classnames(\n style.imageWrapper,\n type === 'chapter' ? style.chapterImageWrapper : null\n )}\n >\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n className={style.image}\n style={{\n backgroundColor: primaryColor,\n backgroundImage: image ? `url('${image}')` : 'none'\n }}\n >\n {emptyIcon}\n </div>\n </div>\n );\n};\n\nCardBackground.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCardBackground.propTypes = {\n type: PropTypes.string,\n image: PropTypes.string,\n empty: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst Card = memo(function Card(props, context) {\n const {skin} = context;\n const {\n image,\n badge,\n adaptiv,\n disabled: hidden = false,\n type = 'course',\n title,\n author,\n customer,\n certifiedAuthor,\n progress,\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n onClick,\n onFavoriteClick,\n isSelected,\n notification,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n 'aria-label': cardArialabel,\n 'background-aria-label': backgroundAriaLabel,\n 'favorite-aria-label': favoriteAriaLabel,\n 'selectable-aria-label': selectableAriaLabel,\n 'customer-aria-label': customerAriaLabel,\n 'badge-aria-label': badgeAriaLabel,\n 'disabled-aria-label': disabledArialabel,\n 'card-content-aria-label': cardContentLabelAriaLabel\n } = props;\n const empty = isEmpty(pick(['title', 'type', 'author', 'image'], props));\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n const cardStyle = classnames(\n THEMES[theme],\n type === 'chapter' ? style.chapter : style.course,\n title ? null : style.lazy,\n style.grid,\n empty ? style.empty : null\n );\n const disabled = hidden && (!isSelected || isUndefined(isSelected));\n const handleClick = useMemo(() => e => !disabled && onClick(e), [disabled, onClick]);\n const lock = disabled ? (\n <LockIcon className={style.lockIcon} style={{color: whiteColor}} height={40} />\n ) : null;\n const inlineBadgeStyle = {color: primaryColor};\n const getType = contentType => {\n switch (contentType) {\n case 'chapter':\n return 'microlearning';\n case 'course':\n return 'learner';\n default:\n return contentType;\n }\n };\n\n return (\n <div\n className={cardStyle}\n data-name=\"card\"\n data-lock={disabled}\n data-type={getType(type)}\n disabled={disabled}\n onClick={handleClick}\n aria-label={cardArialabel}\n >\n <CardBackground type={type} image={image} empty={empty} aria-label={backgroundAriaLabel} />\n {isUndefined(isSelected) && !isUndefined(favorite) ? (\n <Favorite\n className={style.favorite}\n favorite={favorite}\n disabled={disabled}\n onFavoriteClick={onFavoriteClick}\n addFavoriteToolTip={addFavoriteToolTip}\n removeFavoriteToolTip={removeFavoriteToolTip}\n aria-label={favoriteAriaLabel}\n />\n ) : null}\n <Selectable isSelected={isSelected} hidden={hidden} aria-label={selectableAriaLabel} />\n {notification ? <Notification {...notification} /> : null}\n {customer ? (\n <Customer\n {...customer}\n theme={theme}\n type={type}\n disabled={disabled}\n aria-label={customerAriaLabel}\n />\n ) : null}\n <CardContentInfo\n mode={MODES.CARD}\n adaptiv={adaptiv}\n author={author}\n certifiedAuthor={certifiedAuthor}\n disabled={disabled}\n empty={empty}\n progress={progress}\n title={title}\n type={type}\n badgeCategory={badgeCategory}\n badgeLabel={badgeLabel}\n theme={theme}\n aria-label={cardContentLabelAriaLabel}\n />\n {badge ? (\n <div className={style.badge} style={inlineBadgeStyle} aria-label={badgeAriaLabel}>\n {badge}\n </div>\n ) : null}\n {disabled ? (\n <div className={style.lockWrapper} aria-label={disabledArialabel}>\n {lock}\n </div>\n ) : null}\n </div>\n );\n});\n\nCard.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCard.propTypes = {\n badge: PropTypes.string,\n image: PropTypes.string,\n disabled: PropTypes.bool,\n adaptiv: PropTypes.bool,\n type: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n customer: PropTypes.shape(Customer.propTypes),\n progress: PropTypes.number,\n favorite: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onClick: PropTypes.func,\n onFavoriteClick: PropTypes.func,\n isSelected: PropTypes.bool,\n notification: PropTypes.shape(Notification.propTypes),\n badgeCategory: CardContentInfo.propTypes.badgeCategory,\n badgeLabel: CardContentInfo.propTypes.badgeLabel,\n theme: PropTypes.oneOf(keys(THEMES)),\n 'aria-label': PropTypes.string,\n 'background-aria-label': PropTypes.string,\n 'favorite-aria-label': Favorite.propTypes['aria-label'],\n 'selectable-aria-label': Selectable.propTypes['aria-label'],\n 'customer-aria-label': Customer.propTypes['aria-label'],\n 'badge-aria-label': PropTypes.string,\n 'disabled-aria-label': PropTypes.string,\n 'card-content-aria-label': CardContentInfo.propTypes['aria-label']\n};\nexport default Card;\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,IADW;EAEpBC,YAAY,EAAEC,cAAA,CAAMD;AAFA,CAAf;;;AAKP,MAAME,cAAc,GAAG,CAAC;EAACC,IAAD;EAAOC,KAAP;EAAcC,KAAd;EAAqB,cAAcC;AAAnC,CAAD,EAAgD;EAACC;AAAD,CAAhD,KAA2D;EAChF,MAAMC,eAAe,GAAG,IAAAC,kCAAA,EAAkBN,IAAlB,CAAxB;EACA,MAAMO,YAAY,GAAG,mBAAI,gBAAJ,EAAsBH,IAAtB,CAArB;EACA,MAAMI,UAAU,GAAG,mBAAI,cAAJ,EAAoBJ,IAApB,CAAnB;;EAEA,IAAIC,eAAe,IAAII,uCAAA,C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BAAkB,EAAEjB,kBAAA,CAAUC,MAZf;EAafiB,qBAAqB,EAAElB,kBAAA,CAAUC,MAblB;EAcfkB,OAAO,EAAEnB,kBAAA,CAAUqD,IAdJ;EAefjC,eAAe,EAAEpB,kBAAA,CAAUqD,IAfZ;EAgBfhC,UAAU,EAAErB,kBAAA,CAAUE,IAhBP;EAiBfoB,YAAY,EAAEtB,kBAAA,CAAUkD,KAAV,CAAgBI,qBAAA,CAAavD,SAA7B,CAjBC;EAkBfwB,aAAa,EAAEgC,oBAAA,CAAgBxD,SAAhB,CAA0BwB,aAlB1B;EAmBfC,UAAU,EAAE+B,oBAAA,CAAgBxD,SAAhB,CAA0ByB,UAnBvB;EAoBfC,KAAK,EAAEzB,kBAAA,CAAUwD,KAAV,CAAgB,oBAAK7F,MAAL,CAAhB,CApBQ;EAqBf,cAAcqC,kBAAA,CAAUC,MArBT;EAsBf,yBAAyBD,kBAAA,CAAUC,MAtBpB;EAuBf,uBAAuBwD,iBAAA,CAAS1D,SAAT,CAAmB,YAAnB,CAvBR;EAwBf,yBAAyB2D,mBAAA,CAAW3D,SAAX,CAAqB,YAArB,CAxBV;EAyBf,uBAAuBoD,iBAAA,CAASpD,SAAT,CAAmB,YAAnB,CAzBR;EA0Bf,oBAAoBC,kBAAA,CAAUC,MA1Bf;EA2Bf,uBAAuBD,kBAAA,CAAUC,MA3BlB;EA4Bf,2BAA2BsD,oBAAA,CAAgBxD,SAAhB,CAA0B,YAA1B;AA5BZ,CAAjB;eA8BeI,I"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["THEMES","default","coorpmanager","style","CardBackground","type","image","empty","ariaLabel","skin","externalContent","isExternalContent","primaryColor","whiteColor","EXTERNAL_CONTENT_ICONS","IconType","icon","iconColor","color","backgroundIcon","externalIconCircleWrapper","externalIcon","_backgroundIcon","classnames","externalIconCircleWithImageWrapper","backgroundColor","externalIconWithImage","imageWrapper","backgroundImage","externalContentHeader","externalBackground","emptyIcon","chapterImageWrapper","contextTypes","Provider","childContextTypes","propTypes","PropTypes","string","bool","Card","memo","props","context","badge","adaptiv","disabled","hidden","title","author","customer","certifiedAuthor","progress","favorite","addFavoriteToolTip","removeFavoriteToolTip","onClick","onFavoriteClick","isSelected","notification","badgeCategory","badgeLabel","theme","cardArialabel","backgroundAriaLabel","favoriteAriaLabel","selectableAriaLabel","customerAriaLabel","badgeAriaLabel","disabledArialabel","cardContentLabelAriaLabel","cardStyle","chapter","course","lazy","grid","handleClick","useMemo","e","lock","lockIcon","inlineBadgeStyle","getType","contentType","MODES","CARD","lockWrapper","cardPropTypes","shape","Customer","number","func","Notification","CardContentInfo","oneOf","Favorite","Selectable"],"sources":["../../../src/molecule/card/index.js"],"sourcesContent":["import React, {useMemo, memo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, isUndefined, pick, keys} from 'lodash/fp';\nimport {\n NovaSolidLoginLocked as LockIcon,\n NovaCompositionCoorpacademyPictures as PicturesIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport CardContentInfo, {MODES} from '../card-content';\nimport Customer from './customer';\nimport Favorite from './favorite';\nimport Selectable from './selectable';\nimport Notification from './notification';\nimport style from './style.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst CardBackground = ({type, image, empty, 'aria-label': ariaLabel}, {skin}) => {\n const externalContent = isExternalContent(type);\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const IconType = EXTERNAL_CONTENT_ICONS[type].icon;\n const iconColor = EXTERNAL_CONTENT_ICONS[type].color;\n const backgroundIcon = (\n <div className={style.externalIconCircleWrapper}>\n <IconType className={style.externalIcon} />\n </div>\n );\n\n if (image) {\n const _backgroundIcon = (\n <div\n className={classnames(\n style.externalIconCircleWrapper,\n style.externalIconCircleWithImageWrapper\n )}\n style={{\n backgroundColor: iconColor\n }}\n >\n <IconType className={style.externalIconWithImage} />\n </div>\n );\n\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor,\n backgroundImage: `url('${image}')`\n }}\n className={classnames(style.externalContentHeader, style.externalBackground)}\n >\n {_backgroundIcon}\n </div>\n </div>\n );\n }\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor\n }}\n className={style.externalContentHeader}\n >\n {backgroundIcon}\n </div>\n </div>\n );\n }\n\n const emptyIcon = empty ? (\n <PicturesIcon className={style.emptyIcon} style={{color: whiteColor}} />\n ) : null;\n return (\n <div\n className={classnames(\n style.imageWrapper,\n type === 'chapter' ? style.chapterImageWrapper : null\n )}\n >\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n className={style.image}\n style={{\n backgroundColor: primaryColor,\n backgroundImage: image ? `url('${image}')` : 'none'\n }}\n >\n {emptyIcon}\n </div>\n </div>\n );\n};\n\nCardBackground.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCardBackground.propTypes = {\n type: PropTypes.string,\n image: PropTypes.string,\n empty: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst Card = memo(function Card(props, context) {\n const {skin} = context;\n const {\n image,\n badge,\n adaptiv,\n disabled: hidden = false,\n type = 'course',\n title,\n author,\n customer,\n certifiedAuthor,\n progress,\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n onClick,\n onFavoriteClick,\n isSelected,\n notification,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n 'aria-label': cardArialabel,\n 'background-aria-label': backgroundAriaLabel,\n 'favorite-aria-label': favoriteAriaLabel,\n 'selectable-aria-label': selectableAriaLabel,\n 'customer-aria-label': customerAriaLabel,\n 'badge-aria-label': badgeAriaLabel,\n 'disabled-aria-label': disabledArialabel,\n 'card-content-aria-label': cardContentLabelAriaLabel\n } = props;\n const empty = isEmpty(pick(['title', 'type', 'author', 'image'], props));\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n const cardStyle = classnames(\n THEMES[theme],\n type === 'chapter' ? style.chapter : style.course,\n title ? null : style.lazy,\n style.grid,\n empty ? style.empty : null\n );\n const disabled = hidden && (!isSelected || isUndefined(isSelected));\n const handleClick = useMemo(() => e => !disabled && onClick(e), [disabled, onClick]);\n const lock = disabled ? (\n <LockIcon className={style.lockIcon} style={{color: whiteColor}} height={40} />\n ) : null;\n const inlineBadgeStyle = {color: primaryColor};\n const getType = contentType => {\n switch (contentType) {\n case 'chapter':\n return 'microlearning';\n case 'course':\n return 'learner';\n default:\n return contentType;\n }\n };\n\n return (\n <div\n className={cardStyle}\n data-name=\"card\"\n data-lock={disabled}\n data-type={getType(type)}\n disabled={disabled}\n onClick={handleClick}\n aria-label={cardArialabel}\n >\n <CardBackground type={type} image={image} empty={empty} aria-label={backgroundAriaLabel} />\n {isUndefined(isSelected) && !isUndefined(favorite) ? (\n <Favorite\n className={style.favorite}\n favorite={favorite}\n disabled={disabled}\n onFavoriteClick={onFavoriteClick}\n addFavoriteToolTip={addFavoriteToolTip}\n removeFavoriteToolTip={removeFavoriteToolTip}\n aria-label={favoriteAriaLabel}\n />\n ) : null}\n <Selectable isSelected={isSelected} hidden={hidden} aria-label={selectableAriaLabel} />\n {notification ? <Notification {...notification} /> : null}\n {customer ? (\n <Customer\n {...customer}\n theme={theme}\n type={type}\n disabled={disabled}\n aria-label={customerAriaLabel}\n />\n ) : null}\n <CardContentInfo\n mode={MODES.CARD}\n adaptiv={adaptiv}\n author={author}\n certifiedAuthor={certifiedAuthor}\n disabled={disabled}\n empty={empty}\n progress={progress}\n title={title}\n type={type}\n badgeCategory={badgeCategory}\n badgeLabel={badgeLabel}\n theme={theme}\n aria-label={cardContentLabelAriaLabel}\n />\n {badge ? (\n <div className={style.badge} style={inlineBadgeStyle} aria-label={badgeAriaLabel}>\n {badge}\n </div>\n ) : null}\n {disabled ? (\n <div className={style.lockWrapper} aria-label={disabledArialabel}>\n {lock}\n </div>\n ) : null}\n </div>\n );\n});\n\nCard.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport const cardPropTypes = {\n badge: PropTypes.string,\n image: PropTypes.string,\n disabled: PropTypes.bool,\n adaptiv: PropTypes.bool,\n type: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n customer: PropTypes.shape(Customer.propTypes),\n progress: PropTypes.number,\n favorite: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onClick: PropTypes.func,\n onFavoriteClick: PropTypes.func,\n isSelected: PropTypes.bool,\n notification: PropTypes.shape(Notification.propTypes),\n badgeCategory: CardContentInfo.propTypes.badgeCategory,\n badgeLabel: CardContentInfo.propTypes.badgeLabel,\n theme: PropTypes.oneOf(keys(THEMES)),\n 'aria-label': PropTypes.string,\n 'background-aria-label': PropTypes.string,\n 'favorite-aria-label': Favorite.propTypes['aria-label'],\n 'selectable-aria-label': Selectable.propTypes['aria-label'],\n 'customer-aria-label': Customer.propTypes['aria-label'],\n 'badge-aria-label': PropTypes.string,\n 'disabled-aria-label': PropTypes.string,\n 'card-content-aria-label': CardContentInfo.propTypes['aria-label']\n};\n\nCard.propTypes = cardPropTypes;\n\nexport default Card;\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,IADW;EAEpBC,YAAY,EAAEC,cAAA,CAAMD;AAFA,CAAf;;;AAKP,MAAME,cAAc,GAAG,CAAC;EAACC,IAAD;EAAOC,KAAP;EAAcC,KAAd;EAAqB,cAAcC;AAAnC,CAAD,EAAgD;EAACC;AAAD,CAAhD,KAA2D;EAChF,MAAMC,eAAe,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
|
1
1
|
export default CardsList;
|
|
2
2
|
declare class CardsList extends React.PureComponent<any, any, any> {
|
|
3
|
+
/**
|
|
4
|
+
* IMPORTANT: update prop-types.ts too, 1st a migration of tests
|
|
5
|
+
* is intended, then, a TS + functional refactor is planned.
|
|
6
|
+
*/
|
|
3
7
|
static propTypes: {
|
|
4
8
|
contentType: PropTypes.Requireable<string>;
|
|
5
9
|
dataName: PropTypes.Requireable<string>;
|
|
6
10
|
title: PropTypes.Requireable<string>;
|
|
7
11
|
showMore: PropTypes.Requireable<string>;
|
|
8
|
-
cards: PropTypes.Requireable<(PropTypes.InferProps<
|
|
12
|
+
cards: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
13
|
+
badge: PropTypes.Requireable<string>;
|
|
14
|
+
image: PropTypes.Requireable<string>;
|
|
15
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
16
|
+
adaptiv: PropTypes.Requireable<boolean>;
|
|
17
|
+
type: PropTypes.Requireable<string>;
|
|
18
|
+
title: PropTypes.Requireable<string>;
|
|
19
|
+
author: PropTypes.Requireable<string>;
|
|
20
|
+
certifiedAuthor: PropTypes.Requireable<boolean>;
|
|
21
|
+
customer: PropTypes.Requireable<PropTypes.InferProps<{
|
|
22
|
+
theme: PropTypes.Requireable<string>;
|
|
23
|
+
type: PropTypes.Requireable<string>;
|
|
24
|
+
name: PropTypes.Requireable<string>;
|
|
25
|
+
coorpOriginal: PropTypes.Validator<boolean>;
|
|
26
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
27
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
28
|
+
}>>;
|
|
29
|
+
progress: PropTypes.Requireable<number>;
|
|
30
|
+
favorite: PropTypes.Requireable<boolean>;
|
|
31
|
+
addFavoriteToolTip: PropTypes.Requireable<string>;
|
|
32
|
+
removeFavoriteToolTip: PropTypes.Requireable<string>;
|
|
33
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
+
onFavoriteClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
+
isSelected: PropTypes.Requireable<boolean>;
|
|
36
|
+
notification: PropTypes.Requireable<PropTypes.InferProps<{
|
|
37
|
+
message: PropTypes.Validator<string>;
|
|
38
|
+
icon: PropTypes.Validator<string>;
|
|
39
|
+
}>>;
|
|
40
|
+
badgeCategory: PropTypes.Requireable<string>;
|
|
41
|
+
badgeLabel: PropTypes.Requireable<string>;
|
|
42
|
+
theme: PropTypes.Requireable<string>;
|
|
43
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
44
|
+
'background-aria-label': PropTypes.Requireable<string>;
|
|
45
|
+
'favorite-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
46
|
+
favorite: PropTypes.Requireable<string>;
|
|
47
|
+
addToFavorite: PropTypes.Requireable<string>;
|
|
48
|
+
removeFromFavorite: PropTypes.Requireable<string>;
|
|
49
|
+
}>>;
|
|
50
|
+
'selectable-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
51
|
+
select: PropTypes.Requireable<string>;
|
|
52
|
+
unSelect: PropTypes.Requireable<string>;
|
|
53
|
+
}>>;
|
|
54
|
+
'customer-aria-label': PropTypes.Requireable<string>;
|
|
55
|
+
'badge-aria-label': PropTypes.Requireable<string>;
|
|
56
|
+
'disabled-aria-label': PropTypes.Requireable<string>;
|
|
57
|
+
'card-content-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
58
|
+
author: PropTypes.Requireable<string>;
|
|
59
|
+
progression: PropTypes.Requireable<string>;
|
|
60
|
+
adaptive: PropTypes.Requireable<string>;
|
|
61
|
+
}>>;
|
|
62
|
+
}> | null | undefined)[]>;
|
|
9
63
|
onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
64
|
onShowMore: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
65
|
'arrows-aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
12
66
|
showMoreOnLeftAriaLabel: PropTypes.Requireable<string>;
|
|
13
67
|
showMoreOnRightAriaLabel: PropTypes.Requireable<string>;
|
|
14
68
|
}>>;
|
|
69
|
+
testingSizes: PropTypes.Requireable<any>;
|
|
15
70
|
};
|
|
16
71
|
static contextTypes: {
|
|
17
72
|
skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"names":[],"mappings":";AAuFA;IACE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"names":[],"mappings":";AAuFA;IACE;;;OAGG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,wBAkCC;IA/BC;;;;;;;;MAQC;IAED,0DAAgE;IAsHlE,qBAiBC;IAED,qBAGC;IAED,sBAGC;IAED,0BASC;IAvJC,uEAA6D;IAyJ/D,mCAIC;IA5DD,oCAMC;IAGD,sCAIC;IA5DD,qBAGC;IAnCD,0BAMC;IAED,2BAYC;IAED,6BAOC;IASD,wCAuCC;IAGC,kBAA2B;IA6D7B,sBAkGC;CACF"}
|
|
@@ -37,10 +37,14 @@ var _novaIcons = require("@coorpacademy/nova-icons");
|
|
|
37
37
|
|
|
38
38
|
var _provider = _interopRequireDefault(require("../../../atom/provider"));
|
|
39
39
|
|
|
40
|
-
var _card =
|
|
40
|
+
var _card = _interopRequireWildcard(require("../../card"));
|
|
41
41
|
|
|
42
42
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
43
43
|
|
|
44
|
+
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); }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
44
48
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
49
|
|
|
46
50
|
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); }
|
|
@@ -114,6 +118,10 @@ IconView.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
114
118
|
} : {};
|
|
115
119
|
|
|
116
120
|
class CardsList extends _react.default.PureComponent {
|
|
121
|
+
/**
|
|
122
|
+
* IMPORTANT: update prop-types.ts too, 1st a migration of tests
|
|
123
|
+
* is intended, then, a TS + functional refactor is planned.
|
|
124
|
+
*/
|
|
117
125
|
constructor(props) {
|
|
118
126
|
super(props);
|
|
119
127
|
this.state = {
|
|
@@ -134,7 +142,22 @@ class CardsList extends _react.default.PureComponent {
|
|
|
134
142
|
this.updatePages = this.updatePages.bind(this);
|
|
135
143
|
this.setCardsWrapper = this.setCardsWrapper.bind(this);
|
|
136
144
|
this.getScrollWidth = this.getScrollWidth.bind(this);
|
|
137
|
-
this.handleResize = this.handleResize.bind(this);
|
|
145
|
+
this.handleResize = this.handleResize.bind(this); // for testing purposes only - no other way to test this polluted component
|
|
146
|
+
|
|
147
|
+
if (props.testingSizes) {
|
|
148
|
+
const {
|
|
149
|
+
offsetWidth,
|
|
150
|
+
scrollLeft,
|
|
151
|
+
maxPages,
|
|
152
|
+
possiblePages,
|
|
153
|
+
possiblePositions
|
|
154
|
+
} = props.testingSizes;
|
|
155
|
+
this.state.offsetWidth = offsetWidth;
|
|
156
|
+
this.state.scrollLeft = scrollLeft;
|
|
157
|
+
this.state.maxPages = maxPages;
|
|
158
|
+
this.state.possiblePages = possiblePages;
|
|
159
|
+
this.state.possiblePositions = possiblePositions;
|
|
160
|
+
}
|
|
138
161
|
}
|
|
139
162
|
|
|
140
163
|
componentDidMount() {
|
|
@@ -173,6 +196,8 @@ class CardsList extends _react.default.PureComponent {
|
|
|
173
196
|
|
|
174
197
|
this.updateState.cancel();
|
|
175
198
|
}
|
|
199
|
+
/* istanbul ignore next */
|
|
200
|
+
|
|
176
201
|
|
|
177
202
|
handleResize() {
|
|
178
203
|
const {
|
|
@@ -180,6 +205,8 @@ class CardsList extends _react.default.PureComponent {
|
|
|
180
205
|
} = this.props;
|
|
181
206
|
this.updatePaginationState(cards);
|
|
182
207
|
}
|
|
208
|
+
/* istanbul ignore next */
|
|
209
|
+
|
|
183
210
|
|
|
184
211
|
updatePaginationState(cards) {
|
|
185
212
|
const {
|
|
@@ -214,6 +241,8 @@ class CardsList extends _react.default.PureComponent {
|
|
|
214
241
|
offsetWidth: this.cardsWrapper?.offsetWidth
|
|
215
242
|
});
|
|
216
243
|
}
|
|
244
|
+
/* istanbul ignore next */
|
|
245
|
+
|
|
217
246
|
|
|
218
247
|
getScrollWidth(index) {
|
|
219
248
|
const {
|
|
@@ -222,6 +251,8 @@ class CardsList extends _react.default.PureComponent {
|
|
|
222
251
|
const card = cards[index];
|
|
223
252
|
return computeWidth(card);
|
|
224
253
|
}
|
|
254
|
+
/* istanbul ignore next */
|
|
255
|
+
|
|
225
256
|
|
|
226
257
|
handleScroll() {
|
|
227
258
|
const scrollLeft = this.cardsWrapper?.scrollLeft;
|
|
@@ -357,7 +388,11 @@ class CardsList extends _react.default.PureComponent {
|
|
|
357
388
|
}, showMoreView, leftArrowView, rightArrowView) : null;
|
|
358
389
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
359
390
|
className: _style.default.wrapper,
|
|
360
|
-
"data-name": "cardsList"
|
|
391
|
+
"data-name": "cardsList",
|
|
392
|
+
"data-max-pages": `${maxPages}` // eslint-disable-next-line react/destructuring-assignment
|
|
393
|
+
,
|
|
394
|
+
"data-actual-page": `${this.state.actualPage}`,
|
|
395
|
+
"data-scroll-left": this.cardsWrapper?.scrollLeft
|
|
361
396
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
362
397
|
className: _style.default.list
|
|
363
398
|
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -365,6 +400,7 @@ class CardsList extends _react.default.PureComponent {
|
|
|
365
400
|
className: _style.default.header
|
|
366
401
|
}, titleView, switchPagesView), /*#__PURE__*/_react.default.createElement("div", {
|
|
367
402
|
className: _style.default.cards,
|
|
403
|
+
"data-testid": "cards-view-wrapper",
|
|
368
404
|
ref: this.setCardsWrapper
|
|
369
405
|
}, cardsView))));
|
|
370
406
|
}
|
|
@@ -380,13 +416,15 @@ CardsList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
380
416
|
dataName: _propTypes.default.string,
|
|
381
417
|
title: _propTypes.default.string,
|
|
382
418
|
showMore: _propTypes.default.string,
|
|
383
|
-
cards: _propTypes.default.arrayOf(_propTypes.default.shape(_card.
|
|
419
|
+
cards: _propTypes.default.arrayOf(_propTypes.default.shape(_card.cardPropTypes)),
|
|
384
420
|
onScroll: _propTypes.default.func,
|
|
385
421
|
onShowMore: _propTypes.default.func,
|
|
386
422
|
'arrows-aria-label': _propTypes.default.shape({
|
|
387
423
|
showMoreOnLeftAriaLabel: _propTypes.default.string,
|
|
388
424
|
showMoreOnRightAriaLabel: _propTypes.default.string
|
|
389
|
-
})
|
|
425
|
+
}),
|
|
426
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
427
|
+
testingSizes: _propTypes.default.any
|
|
390
428
|
} : {};
|
|
391
429
|
var _default = CardsList;
|
|
392
430
|
exports.default = _default;
|