@coorpacademy/components 10.5.7-alpha.9 → 10.6.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.
- package/es/atom/select/index.js +3 -2
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +36 -0
- package/es/atom/select/test/fixtures.js +2 -0
- package/es/atom/select/test/fixtures.js.map +1 -1
- package/es/molecule/card/customer.js +6 -3
- package/es/molecule/card/customer.js.map +1 -1
- package/es/molecule/card/favorite.js +13 -4
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/card/index.js +41 -12
- package/es/molecule/card/index.js.map +1 -1
- package/es/molecule/card/selectable.js +11 -4
- package/es/molecule/card/selectable.js.map +1 -1
- package/es/molecule/card/test/fixtures/default.js +20 -1
- package/es/molecule/card/test/fixtures/default.js.map +1 -1
- package/es/molecule/card-content/index.js +20 -7
- package/es/molecule/card-content/index.js.map +1 -1
- package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
- package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
- package/es/molecule/questions/free-text/test/fixtures.js +4 -2
- package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/es/molecule/questions/template/index.js +2 -1
- package/es/molecule/questions/template/index.js.map +1 -1
- package/es/molecule/questions/template/style.css +6 -0
- package/es/variables/colors.css +2 -0
- package/lib/atom/select/index.js +3 -2
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +36 -0
- package/lib/atom/select/test/fixtures.js +3 -0
- package/lib/atom/select/test/fixtures.js.map +1 -1
- package/lib/molecule/card/customer.js +6 -3
- package/lib/molecule/card/customer.js.map +1 -1
- package/lib/molecule/card/favorite.js +13 -4
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/card/index.js +41 -12
- package/lib/molecule/card/index.js.map +1 -1
- package/lib/molecule/card/selectable.js +11 -4
- package/lib/molecule/card/selectable.js.map +1 -1
- package/lib/molecule/card/test/fixtures/default.js +20 -1
- package/lib/molecule/card/test/fixtures/default.js.map +1 -1
- package/lib/molecule/card-content/index.js +21 -7
- package/lib/molecule/card-content/index.js.map +1 -1
- package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
- package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
- package/lib/molecule/questions/free-text/test/fixtures.js +5 -2
- package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/lib/molecule/questions/template/index.js +2 -1
- package/lib/molecule/questions/template/index.js.map +1 -1
- package/lib/molecule/questions/template/style.css +6 -0
- package/lib/variables/colors.css +2 -0
- package/package.json +2 -2
- package/es/molecule/cockpit-popin/test/fixtures.js +0 -17
- package/es/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/es/molecule/search/test/fixtures.js +0 -15
- package/es/molecule/search/test/fixtures.js.map +0 -1
- package/lib/molecule/cockpit-popin/test/fixtures.js +0 -28
- package/lib/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/lib/molecule/search/test/fixtures.js +0 -25
- package/lib/molecule/search/test/fixtures.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/molecule/card/test/fixtures/default.js"],"names":["props","image","adaptiv","certification","type","title","author","certifiedAuthor","progress","badge","favorite","addFavoriteToolTip","removeFavoriteToolTip","isSelected","undefined","customer","coorpOriginal","name","onClick","console","log","onFavoriteClick"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EACH,4LAFG;AAGLC,IAAAA,OAAO,EAAE,KAHJ;AAILC,IAAAA,aAAa,EAAE,KAJV;AAKLC,IAAAA,IAAI,EAAE,QALD;AAMLC,IAAAA,KAAK,EAAE,sDANF;AAOLC,IAAAA,MAAM,EAAE,cAPH;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,QAAQ,EAAE,IATL;AAULC,IAAAA,KAAK,EAAE,KAVF;AAWLC,IAAAA,QAAQ,EAAE,IAXL;AAYLC,IAAAA,kBAAkB,EAAE,gBAZf;AAaLC,IAAAA,qBAAqB,EAAE,qBAblB;AAcLC,IAAAA,UAAU,EAAEC,SAdP;AAeLC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,aAAa,EAAE,IADP;AAERC,MAAAA,IAAI,EAAE;AAFE,KAfL;AAmBLC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,kBAAZ,CAnBV;AAoBLC,IAAAA,eAAe,EAAE,MAAMF,OAAO,CAACC,GAAR,CAAY,gBAAZ;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/card/test/fixtures/default.js"],"names":["props","image","adaptiv","certification","type","title","author","certifiedAuthor","progress","badge","favorite","addFavoriteToolTip","removeFavoriteToolTip","isSelected","undefined","customer","coorpOriginal","name","onClick","console","log","onFavoriteClick","addToFavorite","removeFromFavorite","select","unSelect","progression","adaptive"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,KAAK,EACH,4LAFG;AAGLC,IAAAA,OAAO,EAAE,KAHJ;AAILC,IAAAA,aAAa,EAAE,KAJV;AAKLC,IAAAA,IAAI,EAAE,QALD;AAMLC,IAAAA,KAAK,EAAE,sDANF;AAOLC,IAAAA,MAAM,EAAE,cAPH;AAQLC,IAAAA,eAAe,EAAE,IARZ;AASLC,IAAAA,QAAQ,EAAE,IATL;AAULC,IAAAA,KAAK,EAAE,KAVF;AAWLC,IAAAA,QAAQ,EAAE,IAXL;AAYLC,IAAAA,kBAAkB,EAAE,gBAZf;AAaLC,IAAAA,qBAAqB,EAAE,qBAblB;AAcLC,IAAAA,UAAU,EAAEC,SAdP;AAeLC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,aAAa,EAAE,IADP;AAERC,MAAAA,IAAI,EAAE;AAFE,KAfL;AAmBLC,IAAAA,OAAO,EAAE,MAAMC,OAAO,CAACC,GAAR,CAAY,kBAAZ,CAnBV;AAoBLC,IAAAA,eAAe,EAAE,MAAMF,OAAO,CAACC,GAAR,CAAY,gBAAZ,CApBlB;AAqBL,kBAAc,aArBT;AAsBL,6BAAyB,2BAtBpB;AAuBL,2BAAuB;AACrBV,MAAAA,QAAQ,EAAE,6BADW;AAErBY,MAAAA,aAAa,EAAE,iBAFM;AAGrBC,MAAAA,kBAAkB,EAAE;AAHC,KAvBlB;AA4BL,6BAAyB;AACvBC,MAAAA,MAAM,EAAE,eADe;AAEvBC,MAAAA,QAAQ,EAAE;AAFa,KA5BpB;AAgCL,2BAAuB,SAhClB;AAiCL,wBAAoB,YAjCf;AAkCL,2BAAuB,wBAlClB;AAmCL,+BAA2B;AACzBnB,MAAAA,MAAM,EAAE,aADiB;AAEzBoB,MAAAA,WAAW,EAAE,iCAFY;AAGzBC,MAAAA,QAAQ,EAAE;AAHe;AAnCtB;AADM,CAAf","sourcesContent":["export default {\n props: {\n image:\n 'https://api.coorpacademy.com/api-service/medias?url=https://static.coorpacademy.com/content/partner-wedemain/fr/medias/img/cover/shutterstock_248741149-1470302136299.jpg&h=500&w=500&q=90',\n adaptiv: false,\n certification: false,\n type: 'course',\n title: 'From Mass Market to One to One targeting Lorem ipsum',\n author: 'Coorpacademy',\n certifiedAuthor: true,\n progress: 0.65,\n badge: 'new',\n favorite: true,\n addFavoriteToolTip: 'Add to my list',\n removeFavoriteToolTip: 'Remove from my list',\n isSelected: undefined,\n customer: {\n coorpOriginal: true,\n name: 'Decathlon creation'\n },\n onClick: () => console.log('click everywhere'),\n onFavoriteClick: () => console.log('click Favorite'),\n 'aria-label': 'course card',\n 'background-aria-label': 'image wthout informations',\n 'favorite-aria-label': {\n favorite: 'this cours is your favorite',\n addToFavorite: 'add to favorite',\n removeFromFavorite: 'remove from favorite'\n },\n 'selectable-aria-label': {\n select: 'select course',\n unSelect: 'unselect course'\n },\n 'customer-aria-label': 'made by',\n 'badge-aria-label': 'new course',\n 'disabled-aria-label': 'the course is disabled',\n 'card-content-aria-label': {\n author: 'auther name',\n progression: 'you have done 65% of the course',\n adaptive: 'this is an adaptive course'\n }\n }\n};\n"],"file":"default.js"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _keys from "lodash/fp/keys";
|
|
2
2
|
import _isNil from "lodash/fp/isNil";
|
|
3
|
+
import _get from "lodash/fp/get";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import classnames from 'classnames';
|
|
@@ -90,7 +91,8 @@ const AuthorName = ({
|
|
|
90
91
|
author,
|
|
91
92
|
empty,
|
|
92
93
|
courseContent,
|
|
93
|
-
certifiedAuthor
|
|
94
|
+
certifiedAuthor,
|
|
95
|
+
'aria-label': ariaLabel
|
|
94
96
|
}) => {
|
|
95
97
|
const checkIcon = certifiedAuthor ? /*#__PURE__*/React.createElement(CheckIcon, {
|
|
96
98
|
className: classnames(style.authorIcon, courseContent ? style.iconShadow : null),
|
|
@@ -99,6 +101,7 @@ const AuthorName = ({
|
|
|
99
101
|
return /*#__PURE__*/React.createElement("div", {
|
|
100
102
|
"data-name": "author",
|
|
101
103
|
title: author,
|
|
104
|
+
"aria-label": ariaLabel,
|
|
102
105
|
className: classnames(style.author, courseContent ? style.lightTitle : style.darkAuthorTitle, empty ? style.empty : null)
|
|
103
106
|
}, /*#__PURE__*/React.createElement("span", null, author), checkIcon);
|
|
104
107
|
};
|
|
@@ -107,7 +110,8 @@ AuthorName.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
107
110
|
author: PropTypes.string,
|
|
108
111
|
empty: PropTypes.bool,
|
|
109
112
|
courseContent: PropTypes.bool,
|
|
110
|
-
certifiedAuthor: PropTypes.bool
|
|
113
|
+
certifiedAuthor: PropTypes.bool,
|
|
114
|
+
'aria-label': PropTypes.string
|
|
111
115
|
} : {};
|
|
112
116
|
|
|
113
117
|
const ContentInfo = ({
|
|
@@ -122,7 +126,8 @@ const ContentInfo = ({
|
|
|
122
126
|
type,
|
|
123
127
|
badgeCategory,
|
|
124
128
|
badgeLabel,
|
|
125
|
-
theme = 'default'
|
|
129
|
+
theme = 'default',
|
|
130
|
+
'aria-label': ariaLabel
|
|
126
131
|
}) => {
|
|
127
132
|
const progressBarColor = '#3EC483';
|
|
128
133
|
const inlineProgressValueStyle = {
|
|
@@ -137,10 +142,12 @@ const ContentInfo = ({
|
|
|
137
142
|
}, !disabled ? /*#__PURE__*/React.createElement("div", {
|
|
138
143
|
"data-name": "progress",
|
|
139
144
|
className: style.progress,
|
|
140
|
-
style: inlineProgressValueStyle
|
|
145
|
+
style: inlineProgressValueStyle,
|
|
146
|
+
"aria-label": _get('progression', ariaLabel)
|
|
141
147
|
}) : null) : null;
|
|
142
148
|
const adaptiveIcon = adaptiv ? /*#__PURE__*/React.createElement("div", {
|
|
143
|
-
className: classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)
|
|
149
|
+
className: classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null),
|
|
150
|
+
"aria-label": _get('adaptive', ariaLabel)
|
|
144
151
|
}, /*#__PURE__*/React.createElement(AdaptivIcon, {
|
|
145
152
|
height: 25
|
|
146
153
|
})) : null;
|
|
@@ -166,7 +173,8 @@ const ContentInfo = ({
|
|
|
166
173
|
author: author,
|
|
167
174
|
empty: empty,
|
|
168
175
|
courseContent: courseContent,
|
|
169
|
-
certifiedAuthor: certifiedAuthor
|
|
176
|
+
certifiedAuthor: certifiedAuthor,
|
|
177
|
+
"aria-label": _get('author', ariaLabel)
|
|
170
178
|
})), progressBar);
|
|
171
179
|
};
|
|
172
180
|
|
|
@@ -185,7 +193,12 @@ ContentInfo.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
185
193
|
mode: PropTypes.string,
|
|
186
194
|
badgeCategory: ContentBadge.propTypes.category,
|
|
187
195
|
badgeLabel: ContentBadge.propTypes.label,
|
|
188
|
-
theme: PropTypes.oneOf(_keys(THEMES))
|
|
196
|
+
theme: PropTypes.oneOf(_keys(THEMES)),
|
|
197
|
+
'aria-label': PropTypes.shape({
|
|
198
|
+
author: PropTypes.string,
|
|
199
|
+
progression: PropTypes.string,
|
|
200
|
+
adaptive: PropTypes.string
|
|
201
|
+
})
|
|
189
202
|
} : {};
|
|
190
203
|
export default ContentInfo;
|
|
191
204
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/molecule/card-content/index.js"],"names":["React","PropTypes","classnames","NovaCompositionCoorpacademyAdaptive","AdaptivIcon","NovaSolidStatusCheckCircle2","CheckIcon","NovaCompositionCoorpacademyTimer","TimerIcon","isExternalContent","EXTERNAL_CONTENT_ICONS","Provider","ContentBadge","innerHTML","style","MODES","HERO","CARD","THEMES","default","coorpmanager","ContentTypeInfo","mode","type","externalContent","context","translate","microLearningIcon","timerIcon","microLearninglabel","textColor","color","contentTypeInfo","contextTypes","skin","childContextTypes","propTypes","bool","string","CardTitle","title","empty","courseContent","lightTitle","darkTitle","__html","AuthorName","author","certifiedAuthor","checkIcon","authorIcon","iconShadow","darkAuthorTitle","ContentInfo","adaptiv","disabled","progress","badgeCategory","badgeLabel","theme","progressBarColor","inlineProgressValueStyle","backgroundColor","width","chapterContent","progressBar","progressWrapper","hideProgressBar","adaptiveIcon","infoWrapper","hero","card","progressBarDisabled","cardInfo","microLearningCardInfo","iconWrapper","number","category","label","oneOf"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,mCAAmC,IAAIC,WADzC,EAEEC,2BAA2B,IAAIC,SAFjC,EAGEC,gCAAgC,IAAIC,SAHtC,QAIO,0BAJP;AAKA,SAAQC,iBAAR,EAA2BC,sBAA3B,QAAwD,6BAAxD;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAAQC,SAAR,QAAwB,4BAAxB;AACA,OAAOC,KAAP,MAAkB,aA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,EAAEvC,SAAS,CAACqC,MAPK;AAQtBf,EAAAA,IAAI,EAAEtB,SAAS,CAACqC,MARM;AAStBhB,EAAAA,IAAI,EAAErB,SAAS,CAACqC,MATM;AAUtBmB,EAAAA,aAAa,EAAE7C,YAAY,CAACwB,SAAb,CAAuByC,QAVhB;AAWtBnB,EAAAA,UAAU,EAAE9C,YAAY,CAACwB,SAAb,CAAuB0C,KAXb;AAYtBnB,EAAAA,KAAK,EAAE1D,SAAS,CAAC8E,KAAV,CAAgB,MAAK7D,MAAL,CAAhB;AAZe,CAAxB;AAeA,eAAemC,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyAdaptive as AdaptivIcon,\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport ContentBadge from '../../atom/content-badge';\nimport {innerHTML} from '../../atom/label/style.css';\nimport style from './style.css';\n\nexport const MODES = {\n HERO: 'hero',\n CARD: 'card'\n};\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst ContentTypeInfo = ({mode, type, externalContent}, context) => {\n const {translate} = context;\n if (mode !== MODES.CARD) {\n return null;\n }\n\n if (type === 'chapter') {\n return (\n <div className={style.microLearningIcon}>\n <TimerIcon className={style.timerIcon} />\n <span className={style.microLearninglabel}>{\"5' learning\"}</span>\n </div>\n );\n }\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const textColor = EXTERNAL_CONTENT_ICONS[type].color;\n\n return (\n <div className={style.contentTypeInfo} style={{color: textColor}}>\n {type === 'scorm' ? translate('external_content_scorm') : ''}\n {type === 'video' ? translate('external_content_video') : ''}\n {type === 'article' ? translate('external_content_article') : ''}\n {type === 'podcast' ? translate('external_content_podcast') : ''}\n </div>\n );\n }\n\n return null;\n};\n\nContentTypeInfo.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContentTypeInfo.propTypes = {\n externalContent: PropTypes.bool,\n type: PropTypes.string,\n mode: PropTypes.string\n};\n\nconst CardTitle = ({title, empty, courseContent}) => {\n return (\n <div\n className={classnames(\n style.title,\n innerHTML,\n courseContent ? style.lightTitle : style.darkTitle,\n empty ? style.empty : null\n )}\n data-name=\"title\"\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n );\n};\n\nCardTitle.propTypes = {\n title: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool\n};\n\nconst AuthorName = ({author, empty, courseContent, certifiedAuthor}) => {\n const checkIcon = certifiedAuthor ? (\n <CheckIcon\n className={classnames(style.authorIcon, courseContent ? style.iconShadow : null)}\n color=\"inherit\"\n />\n ) : null;\n\n return (\n <div\n data-name=\"author\"\n title={author}\n className={classnames(\n style.author,\n courseContent ? style.lightTitle : style.darkAuthorTitle,\n empty ? style.empty : null\n )}\n >\n <span>{author}</span>\n {checkIcon}\n </div>\n );\n};\n\nAuthorName.propTypes = {\n author: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool,\n certifiedAuthor: PropTypes.bool\n};\n\nconst ContentInfo = ({\n adaptiv,\n author,\n certifiedAuthor = false,\n disabled = false,\n empty = false,\n mode = MODES.CARD,\n progress,\n title,\n type,\n badgeCategory,\n badgeLabel,\n theme = 'default'\n}) => {\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${progress * 100}%`\n };\n const externalContent = isExternalContent(type);\n const courseContent = type === 'course';\n const chapterContent = type === 'chapter';\n\n const progressBar =\n mode === MODES.HERO || (!empty && !disabled) ? (\n <div className={!isNil(progress) ? style.progressWrapper : style.hideProgressBar}>\n {!disabled ? (\n <div data-name=\"progress\" className={style.progress} style={inlineProgressValueStyle} />\n ) : null}\n </div>\n ) : null;\n\n const adaptiveIcon = adaptiv ? (\n <div className={classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)}>\n <AdaptivIcon height={25} />\n </div>\n ) : null;\n\n return (\n <div\n data-name=\"info\"\n className={classnames(\n THEMES[theme],\n style.infoWrapper,\n mode === MODES.HERO ? style.hero : style.card,\n disabled ? style.progressBarDisabled : null,\n externalContent ? style.externalContent : null\n )}\n >\n <ContentTypeInfo mode={mode} type={type} externalContent={externalContent} />\n <div\n className={classnames(style.cardInfo, chapterContent ? style.microLearningCardInfo : null)}\n >\n <div className={style.iconWrapper}>\n {adaptiveIcon}\n {!empty && badgeLabel && badgeCategory && courseContent ? (\n <ContentBadge category={badgeCategory} label={badgeLabel} />\n ) : null}\n </div>\n <CardTitle title={title} empty={empty} courseContent={courseContent} />\n <AuthorName\n author={author}\n empty={empty}\n courseContent={courseContent}\n certifiedAuthor={certifiedAuthor}\n />\n </div>\n {progressBar}\n </div>\n );\n};\n\nContentInfo.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nContentInfo.propTypes = {\n adaptiv: PropTypes.bool,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n disabled: PropTypes.bool,\n empty: PropTypes.bool,\n progress: PropTypes.number,\n title: PropTypes.string,\n type: PropTypes.string,\n mode: PropTypes.string,\n badgeCategory: ContentBadge.propTypes.category,\n badgeLabel: ContentBadge.propTypes.label,\n theme: PropTypes.oneOf(keys(THEMES))\n};\n\nexport default ContentInfo;\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/card-content/index.js"],"names":["React","PropTypes","classnames","NovaCompositionCoorpacademyAdaptive","AdaptivIcon","NovaSolidStatusCheckCircle2","CheckIcon","NovaCompositionCoorpacademyTimer","TimerIcon","isExternalContent","EXTERNAL_CONTENT_ICONS","Provider","ContentBadge","innerHTML","style","MODES","HERO","CARD","THEMES","default","coorpmanager","ContentTypeInfo","mode","type","externalContent","context","translate","microLearningIcon","timerIcon","microLearninglabel","textColor","color","contentTypeInfo","contextTypes","skin","childContextTypes","propTypes","bool","string","CardTitle","title","empty","courseContent","lightTitle","darkTitle","__html","AuthorName","author","certifiedAuthor","ariaLabel","checkIcon","authorIcon","iconShadow","darkAuthorTitle","ContentInfo","adaptiv","disabled","progress","badgeCategory","badgeLabel","theme","progressBarColor","inlineProgressValueStyle","backgroundColor","width","chapterContent","progressBar","progressWrapper","hideProgressBar","adaptiveIcon","infoWrapper","hero","card","progressBarDisabled","cardInfo","microLearningCardInfo","iconWrapper","number","category","label","oneOf","shape","progression","adaptive"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,mCAAmC,IAAIC,WADzC,EAEEC,2BAA2B,IAAIC,SAFjC,EAGEC,gCAAgC,IAAIC,SAHtC,QAIO,0BAJP;AAKA,SAAQC,iBAAR,EAA2BC,sBAA3B,QAAwD,6BAAxD;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAAQC,SAAR,QAAwB,4BAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,OAAO,MAAMC,KAAK,GAAG;AACnBC,EAAAA,IAAI,EAAE,MADa;AAEnBC,EAAAA,IAAI,EAAE;AAFa,CAAd;AAKP,OAAO,MAAMC,MAAM,GAAG;AACpBC,EAAAA,OAAO,EAAE,IADW;AAEpBC,EAAAA,YAAY,EAAEN,KAAK,CAACM;AAFA,CAAf;;AAKP,MAAMC,eAAe,GAAG,CAAC;AAACC,EAAAA,IAAD;AAAOC,EAAAA,IAAP;AAAaC,EAAAA;AAAb,CAAD,EAAgCC,OAAhC,KAA4C;AAClE,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AACA,MAAIH,IAAI,KAAKP,KAAK,CAACE,IAAnB,EAA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;AAWtBnB,EAAAA,UAAU,EAAE/C,YAAY,CAACwB,SAAb,CAAuB2C,KAXb;AAYtBnB,EAAAA,KAAK,EAAE3D,SAAS,CAAC+E,KAAV,CAAgB,MAAK9D,MAAL,CAAhB,CAZe;AAatB,gBAAcjB,SAAS,CAACgF,KAAV,CAAgB;AAC5BlC,IAAAA,MAAM,EAAE9C,SAAS,CAACqC,MADU;AAE5B4C,IAAAA,WAAW,EAAEjF,SAAS,CAACqC,MAFK;AAG5B6C,IAAAA,QAAQ,EAAElF,SAAS,CAACqC;AAHQ,GAAhB;AAbQ,CAAxB;AAoBA,eAAegB,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isNil, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyAdaptive as AdaptivIcon,\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport ContentBadge from '../../atom/content-badge';\nimport {innerHTML} from '../../atom/label/style.css';\nimport style from './style.css';\n\nexport const MODES = {\n HERO: 'hero',\n CARD: 'card'\n};\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst ContentTypeInfo = ({mode, type, externalContent}, context) => {\n const {translate} = context;\n if (mode !== MODES.CARD) {\n return null;\n }\n\n if (type === 'chapter') {\n return (\n <div className={style.microLearningIcon}>\n <TimerIcon className={style.timerIcon} />\n <span className={style.microLearninglabel}>{\"5' learning\"}</span>\n </div>\n );\n }\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const textColor = EXTERNAL_CONTENT_ICONS[type].color;\n\n return (\n <div className={style.contentTypeInfo} style={{color: textColor}}>\n {type === 'scorm' ? translate('external_content_scorm') : ''}\n {type === 'video' ? translate('external_content_video') : ''}\n {type === 'article' ? translate('external_content_article') : ''}\n {type === 'podcast' ? translate('external_content_podcast') : ''}\n </div>\n );\n }\n\n return null;\n};\n\nContentTypeInfo.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContentTypeInfo.propTypes = {\n externalContent: PropTypes.bool,\n type: PropTypes.string,\n mode: PropTypes.string\n};\n\nconst CardTitle = ({title, empty, courseContent}) => {\n return (\n <div\n className={classnames(\n style.title,\n innerHTML,\n courseContent ? style.lightTitle : style.darkTitle,\n empty ? style.empty : null\n )}\n data-name=\"title\"\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n );\n};\n\nCardTitle.propTypes = {\n title: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool\n};\n\nconst AuthorName = ({author, empty, courseContent, certifiedAuthor, 'aria-label': ariaLabel}) => {\n const checkIcon = certifiedAuthor ? (\n <CheckIcon\n className={classnames(style.authorIcon, courseContent ? style.iconShadow : null)}\n color=\"inherit\"\n />\n ) : null;\n\n return (\n <div\n data-name=\"author\"\n title={author}\n aria-label={ariaLabel}\n className={classnames(\n style.author,\n courseContent ? style.lightTitle : style.darkAuthorTitle,\n empty ? style.empty : null\n )}\n >\n <span>{author}</span>\n {checkIcon}\n </div>\n );\n};\n\nAuthorName.propTypes = {\n author: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool,\n certifiedAuthor: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst ContentInfo = ({\n adaptiv,\n author,\n certifiedAuthor = false,\n disabled = false,\n empty = false,\n mode = MODES.CARD,\n progress,\n title,\n type,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n 'aria-label': ariaLabel\n}) => {\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${progress * 100}%`\n };\n const externalContent = isExternalContent(type);\n const courseContent = type === 'course';\n const chapterContent = type === 'chapter';\n\n const progressBar =\n mode === MODES.HERO || (!empty && !disabled) ? (\n <div className={!isNil(progress) ? style.progressWrapper : style.hideProgressBar}>\n {!disabled ? (\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n aria-label={get('progression', ariaLabel)}\n />\n ) : null}\n </div>\n ) : null;\n\n const adaptiveIcon = adaptiv ? (\n <div\n className={classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)}\n aria-label={get('adaptive', ariaLabel)}\n >\n <AdaptivIcon height={25} />\n </div>\n ) : null;\n\n return (\n <div\n data-name=\"info\"\n className={classnames(\n THEMES[theme],\n style.infoWrapper,\n mode === MODES.HERO ? style.hero : style.card,\n disabled ? style.progressBarDisabled : null,\n externalContent ? style.externalContent : null\n )}\n >\n <ContentTypeInfo mode={mode} type={type} externalContent={externalContent} />\n <div\n className={classnames(style.cardInfo, chapterContent ? style.microLearningCardInfo : null)}\n >\n <div className={style.iconWrapper}>\n {adaptiveIcon}\n {!empty && badgeLabel && badgeCategory && courseContent ? (\n <ContentBadge category={badgeCategory} label={badgeLabel} />\n ) : null}\n </div>\n <CardTitle title={title} empty={empty} courseContent={courseContent} />\n <AuthorName\n author={author}\n empty={empty}\n courseContent={courseContent}\n certifiedAuthor={certifiedAuthor}\n aria-label={get('author', ariaLabel)}\n />\n </div>\n {progressBar}\n </div>\n );\n};\n\nContentInfo.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nContentInfo.propTypes = {\n adaptiv: PropTypes.bool,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n disabled: PropTypes.bool,\n empty: PropTypes.bool,\n progress: PropTypes.number,\n title: PropTypes.string,\n type: PropTypes.string,\n mode: PropTypes.string,\n badgeCategory: ContentBadge.propTypes.category,\n badgeLabel: ContentBadge.propTypes.label,\n theme: PropTypes.oneOf(keys(THEMES)),\n 'aria-label': PropTypes.shape({\n author: PropTypes.string,\n progression: PropTypes.string,\n adaptive: PropTypes.string\n })\n};\n\nexport default ContentInfo;\n"],"file":"index.js"}
|
|
@@ -3,7 +3,12 @@ export default {
|
|
|
3
3
|
props: {
|
|
4
4
|
mode: MODES.CARD,
|
|
5
5
|
author: 'Coorpcademy',
|
|
6
|
-
title: '<p align="right">From Mass Market to One to One targeting</p>'
|
|
6
|
+
title: '<p align="right">From Mass Market to One to One targeting</p>',
|
|
7
|
+
'aria-label': {
|
|
8
|
+
author: 'auther name',
|
|
9
|
+
progression: 'you have done 65% of the course',
|
|
10
|
+
adaptive: 'this is an adaptive course'
|
|
11
|
+
}
|
|
7
12
|
}
|
|
8
13
|
};
|
|
9
14
|
//# sourceMappingURL=card-no-progress-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/molecule/card-content/test/fixtures/card-no-progress-bar.js"],"names":["MODES","props","mode","CARD","author","title"],"mappings":"AAAA,SAAQA,KAAR,QAAoB,OAApB;AAEA,eAAe;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAEF,KAAK,CAACG,IADP;AAELC,IAAAA,MAAM,EAAE,aAFH;AAGLC,IAAAA,KAAK,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/card-content/test/fixtures/card-no-progress-bar.js"],"names":["MODES","props","mode","CARD","author","title","progression","adaptive"],"mappings":"AAAA,SAAQA,KAAR,QAAoB,OAApB;AAEA,eAAe;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAEF,KAAK,CAACG,IADP;AAELC,IAAAA,MAAM,EAAE,aAFH;AAGLC,IAAAA,KAAK,EAAE,+DAHF;AAIL,kBAAc;AACZD,MAAAA,MAAM,EAAE,aADI;AAEZE,MAAAA,WAAW,EAAE,iCAFD;AAGZC,MAAAA,QAAQ,EAAE;AAHE;AAJT;AADM,CAAf","sourcesContent":["import {MODES} from '../..';\n\nexport default {\n props: {\n mode: MODES.CARD,\n author: 'Coorpcademy',\n title: '<p align=\"right\">From Mass Market to One to One targeting</p>',\n 'aria-label': {\n author: 'auther name',\n progression: 'you have done 65% of the course',\n adaptive: 'this is an adaptive course'\n }\n }\n};\n"],"file":"card-no-progress-bar.js"}
|
|
@@ -3,7 +3,8 @@ import forEach from 'lodash/forEach';
|
|
|
3
3
|
import renderComponentMacro from '../../../../test/helpers/render-component';
|
|
4
4
|
import MoleculeQuestionsFreeText from '..';
|
|
5
5
|
import fixtureDefault from './fixtures/default';
|
|
6
|
-
import
|
|
6
|
+
import fixtureWithValueOnChange from './fixtures/with-value-on-change';
|
|
7
|
+
import fixtureWithValue from './fixtures/with-value';
|
|
7
8
|
test('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {
|
|
8
9
|
t.pass();
|
|
9
10
|
forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {
|
|
@@ -11,5 +12,6 @@ test('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTy
|
|
|
11
12
|
});
|
|
12
13
|
});
|
|
13
14
|
test('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);
|
|
14
|
-
test('MoleculeQuestions › MoleculeQuestionsFreeText ›
|
|
15
|
+
test('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValueOnChange);
|
|
16
|
+
test('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValue);
|
|
15
17
|
//# sourceMappingURL=fixtures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuestionsFreeText","fixtureDefault","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuestionsFreeText","fixtureDefault","fixtureWithValueOnChange","fixtureWithValue","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,2CAAjC;AACA,OAAOC,yBAAP,MAAsC,IAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,wBAAP,MAAqC,iCAArC;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AAEAN,IAAI,CAAC,6EAAD,EAAgFO,CAAC,IAAI;AACvFA,EAAAA,CAAC,CAACC,IAAF;AACAP,EAAAA,OAAO,CAACE,yBAAyB,CAACM,SAA3B,EAAsC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC3DJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uEAAsEF,GAAI,mEAAnG;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAX,IAAI,CAAC,8EAAD,EAAiFE,oBAAjF,EAAuGC,yBAAvG,EAAkIC,cAAlI,CAAJ;AACAJ,IAAI,CAAC,wFAAD,EAA2FE,oBAA3F,EAAiHC,yBAAjH,EAA4IE,wBAA5I,CAAJ;AACAL,IAAI,CAAC,gFAAD,EAAmFE,oBAAnF,EAAyGC,yBAAzG,EAAoIG,gBAApI,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../../test/helpers/render-component';\nimport MoleculeQuestionsFreeText from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWithValueOnChange from './fixtures/with-value-on-change';\nimport fixtureWithValue from './fixtures/with-value';\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"MoleculeQuestions.MoleculeQuestionsFreeText.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValueOnChange);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValue);\n"],"file":"fixtures.js"}
|
|
@@ -25,7 +25,8 @@ const Template = ({
|
|
|
25
25
|
|
|
26
26
|
if (type === 'string') {
|
|
27
27
|
return /*#__PURE__*/React.createElement("span", {
|
|
28
|
-
key: key
|
|
28
|
+
key: key,
|
|
29
|
+
className: style.textPart // eslint-disable-next-line react/no-danger
|
|
29
30
|
,
|
|
30
31
|
dangerouslySetInnerHTML: {
|
|
31
32
|
__html: part.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/template/index.js"],"names":["React","PropTypes","parseTemplateString","DropDown","FreeText","style","Template","template","answers","totalTemplate","templateCompose","convert","cap","part","key","type","__html","value","field","name","fieldType","fieldProps","fieldView","text","answerType","wrapper","TextPropTypes","propTypes","string","arrayOf","oneOfType","shape"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,mBAAP,MAAgC,qCAAhC;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAAC;AAACC,EAAAA,QAAD;AAAWC,EAAAA;AAAX,CAAD,KAAyB;AACxC,QAAMC,aAAa,GAAGP,mBAAmB,CAACK,QAAD,CAAzC;;AACA,QAAMG,eAAe,GAAG,KAAIC,OAAJ,CAAY;AAACC,IAAAA,GAAG,EAAE;AAAN,GAAZ,EAA0B,CAACC,IAAD,EAAOC,GAAP,KAAe;AAC/D,UAAMC,IAAI,GAAGF,IAAI,CAACE,IAAlB;;AACA,QAAIA,IAAI,KAAK,QAAb,EAAuB;AACrB,0BACE;AACE,QAAA,GAAG,EAAED,GADP,
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/template/index.js"],"names":["React","PropTypes","parseTemplateString","DropDown","FreeText","style","Template","template","answers","totalTemplate","templateCompose","convert","cap","part","key","type","textPart","__html","value","field","name","fieldType","fieldProps","fieldView","text","answerType","wrapper","TextPropTypes","propTypes","string","arrayOf","oneOfType","shape"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,mBAAP,MAAgC,qCAAhC;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAAC;AAACC,EAAAA,QAAD;AAAWC,EAAAA;AAAX,CAAD,KAAyB;AACxC,QAAMC,aAAa,GAAGP,mBAAmB,CAACK,QAAD,CAAzC;;AACA,QAAMG,eAAe,GAAG,KAAIC,OAAJ,CAAY;AAACC,IAAAA,GAAG,EAAE;AAAN,GAAZ,EAA0B,CAACC,IAAD,EAAOC,GAAP,KAAe;AAC/D,UAAMC,IAAI,GAAGF,IAAI,CAACE,IAAlB;;AACA,QAAIA,IAAI,KAAK,QAAb,EAAuB;AACrB,0BACE;AACE,QAAA,GAAG,EAAED,GADP;AAEE,QAAA,SAAS,EAAET,KAAK,CAACW,QAFnB,CAGE;AAHF;AAIE,QAAA,uBAAuB,EAAE;AAACC,UAAAA,MAAM,EAAEJ,IAAI,CAACK;AAAd;AAJ3B,QADF;AAQD;;AACD,QAAIH,IAAI,KAAK,aAAb,EAA4B;AAC1B,YAAMI,KAAK,GAAG,MAAK;AAACC,QAAAA,IAAI,EAAEP,IAAI,CAACK;AAAZ,OAAL,EAAyBV,OAAzB,CAAd;;AACA,UAAI,CAACW,KAAL,EAAY,OAAO,IAAP;;AACZ,YAAM;AAACJ,QAAAA,IAAI,EAAEM;AAAP,UAAmCF,KAAzC;AAAA,YAA2BG,UAA3B,iCAAyCH,KAAzC;;AACA,YAAMI,SAAS,GACbF,SAAS,KAAK,MAAd,gBACE,oBAAC,QAAD,eAAcC,UAAd;AAA0B,QAAA,SAAS,EAAEjB,KAAK,CAACmB;AAA3C,SADF,gBAGE,oBAAC,QAAD,eAAcF,UAAd;AAA0B,QAAA,KAAK,EAAC;AAAhC,SAJJ;AAOA,0BACE;AAAK,QAAA,SAAS,EAAEjB,KAAK,CAACoB,UAAtB;AAAkC,QAAA,GAAG,EAAEZ,IAAI,CAACK;AAA5C,SACGK,SADH,CADF;AAKD;AACF,GA7BuB,EA6BrBd,aA7BqB,CAAxB;;AA+BA,sBACE;AAAK,iBAAU,kBAAf;AAAkC,IAAA,SAAS,EAAEJ,KAAK,CAACqB;AAAnD,KACGhB,eADH,CADF;AAKD,CAtCD;;AAwCA,MAAMiB,aAAN,iEACKxB,QAAQ,CAACyB,SADd;AAEEb,EAAAA,IAAI,EAAEd,SAAS,CAAC4B;AAFlB;AAKAvB,QAAQ,CAACsB,SAAT,2CAAqB;AACnBrB,EAAAA,QAAQ,EAAEN,SAAS,CAAC4B,MADD;AAEnBrB,EAAAA,OAAO,EAAEP,SAAS,CAAC6B,OAAV,CACP7B,SAAS,CAAC8B,SAAV,CAAoB,CAAC9B,SAAS,CAAC+B,KAAV,CAAgB7B,QAAQ,CAACyB,SAAzB,CAAD,EAAsC3B,SAAS,CAAC+B,KAAV,CAAgBL,aAAhB,CAAtC,CAApB,CADO;AAFU,CAArB;AAOA,eAAerB,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {map, find} from 'lodash/fp';\nimport parseTemplateString from '../../../util/parse-template-string';\nimport DropDown from '../drop-down';\nimport FreeText from '../free-text';\nimport style from './style.css';\n\nconst Template = ({template, answers}) => {\n const totalTemplate = parseTemplateString(template);\n const templateCompose = map.convert({cap: false})((part, key) => {\n const type = part.type;\n if (type === 'string') {\n return (\n <span\n key={key}\n className={style.textPart}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: part.value}}\n />\n );\n }\n if (type === 'answerField') {\n const field = find({name: part.value}, answers);\n if (!field) return null;\n const {type: fieldType, ...fieldProps} = field;\n const fieldView =\n fieldType === 'text' ? (\n <FreeText {...fieldProps} className={style.text} />\n ) : (\n <DropDown {...fieldProps} theme=\"player\" />\n );\n\n return (\n <div className={style.answerType} key={part.value}>\n {fieldView}\n </div>\n );\n }\n }, totalTemplate);\n\n return (\n <div data-name=\"template-wrapper\" className={style.wrapper}>\n {templateCompose}\n </div>\n );\n};\n\nconst TextPropTypes = {\n ...DropDown.propTypes,\n type: PropTypes.string\n};\n\nTemplate.propTypes = {\n template: PropTypes.string,\n answers: PropTypes.arrayOf(\n PropTypes.oneOfType([PropTypes.shape(DropDown.propTypes), PropTypes.shape(TextPropTypes)])\n )\n};\n\nexport default Template;\n"],"file":"index.js"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
@value breakpoints: "../../../variables/breakpoints.css";
|
|
2
2
|
@value mobile from breakpoints;
|
|
3
3
|
@value tablet from breakpoints;
|
|
4
|
+
@value colors: "../../../variables/colors.css";
|
|
5
|
+
@value cm_blue_900 from colors;
|
|
4
6
|
|
|
5
7
|
.wrapper {
|
|
6
8
|
display: block;
|
|
@@ -15,6 +17,10 @@
|
|
|
15
17
|
text-align: center;
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
.textPart {
|
|
21
|
+
color: cm_blue_900;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
.answerType {
|
|
19
25
|
display: inline-block;
|
|
20
26
|
margin: 4px 0 8px;
|
package/es/variables/colors.css
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
@value cm_grey_200: #d7d7da;
|
|
40
40
|
@value cm_grey_300: #C5C5C9;
|
|
41
41
|
@value cm_grey_400: #9999A8;
|
|
42
|
+
@value cm_grey_450: #8393ad;
|
|
42
43
|
@value cm_grey_500: #515161;
|
|
43
44
|
@value cm_grey_700: #1D1D2B;
|
|
44
45
|
@value cm_grey_800: #3a3a4a;
|
|
@@ -62,3 +63,4 @@
|
|
|
62
63
|
@value cm_violet_podcast: #432ba7;
|
|
63
64
|
@value cm_warning_50: rgba(255, 192, 67, 0.13);
|
|
64
65
|
@value box_shadow_light_dark: rgba(0, 0, 0, 0.12);
|
|
66
|
+
@value box_shadow_medium_dark: rgba(0, 0, 0, 0.2);
|
package/lib/atom/select/index.js
CHANGED
|
@@ -106,9 +106,10 @@ const Select = (props, context) => {
|
|
|
106
106
|
const black = (0, _react.useMemo)(() => (0, _getOr2.default)('#14171A', 'common.black', skin), [skin]);
|
|
107
107
|
const color = (0, _react.useMemo)(() => (0, _getOr2.default)('#00B0FF', 'common.primary', skin), [skin]);
|
|
108
108
|
const shouldUseSkinFontColor = (0, _react.useMemo)(() => !isSelectedInValidOption && selected && (0, _includes2.default)(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
|
|
109
|
+
const arrowColor = selected ? color : undefined;
|
|
109
110
|
const arrowView = !multiple ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, {
|
|
110
|
-
color:
|
|
111
|
-
className: _style.default.arrow
|
|
111
|
+
color: (0, _includes2.default)(theme, ['question', 'template', 'player']) ? arrowColor : black,
|
|
112
|
+
className: shouldUseSkinFontColor ? _style.default.selectedArrow : _style.default.arrow
|
|
112
113
|
}) : null;
|
|
113
114
|
const behaviourClassName = (0, _react.useMemo)(() => (0, _getClassState.default)(_style.default.default, _style.default.modified, _style.default.error, modified, error), [error, modified]);
|
|
114
115
|
const composedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(theme ? themeStyle[theme] : behaviourClassName, selected ? _style.default.selected : _style.default.unselected, className), [behaviourClassName, className, selected, theme]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/select/index.js"],"names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","Select","props","context","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","optionList","map","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","arrowView","arrow","behaviourClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;AACjBC,EAAAA,MAAM,EAAEC,eAAMD,MADG;AAEjBE,EAAAA,OAAO,EAAED,eAAMC,OAFE;AAGjBC,EAAAA,MAAM,EAAEF,eAAME,MAHG;AAIjBC,EAAAA,IAAI,EAAEH,eAAMG,IAJK;AAKjBC,EAAAA,QAAQ,EAAEJ,eAAMI,QALC;AAMjBC,EAAAA,IAAI,EAAEL,eAAMK,IANK;AAOjBC,EAAAA,WAAW,EAAEN,eAAMM,WAPF;AAQjBC,EAAAA,MAAM,EAAEP,eAAMO,MARG;AASjBC,EAAAA,QAAQ,EAAER,eAAMQ,QATC,CASQ;;AATR,CAAnB;;AAYA,MAAMC,MAAM,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACjC,QAAM;AACJC,IAAAA,IADI;AAEJC,IAAAA,OAAO,GAAG,EAFN;AAGJC,IAAAA,SAHI;AAIJC,IAAAA,eAJI;AAKJC,IAAAA,QALI;AAMJC,IAAAA,QAAQ,GAAG,KANP;AAOJC,IAAAA,QAPI;AAQJC,IAAAA,QARI;AASJC,IAAAA,WATI;AAUJC,IAAAA,KAVI;AAWJC,IAAAA,QAAQ,GAAG,KAXP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zC,EAAAA,QAAQ,EAAEwC,mBAAUK,IARH;AASjBhD,EAAAA,QAAQ,EAAE2C,mBAAUU,IATH;AAUjBhD,EAAAA,KAAK,EAAEsC,mBAAUW,KAAV,CAAgB,oBAAKxE,UAAL,CAAhB,CAVU;AAWjBe,EAAAA,OAAO,EAAE8C,mBAAUY,OAAV,CAAkBZ,mBAAUa,KAAV,CAAgBd,qBAAhB,CAAlB,CAXQ;AAYjBpC,EAAAA,QAAQ,EAAEqC,mBAAUK,IAZH;AAajBzC,EAAAA,KAAK,EAAEoC,mBAAUK;AAbA,CAAnB;eAgBevD,M","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {find, keys, map, get, getOr, filter, includes, size} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template // we keep template in case it is used anywhere else?\n};\n\nconst Select = (props, context) => {\n const {\n name,\n options = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle\n } = props;\n\n const {skin} = context;\n\n const title = useMemo(() => (propTitle ? `${propTitle}${required ? '*' : ''}` : null), [\n propTitle,\n required\n ]);\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options)),\n [multiple, options]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options)),\n [multiple, options]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const shouldUseSkinFontColor = useMemo(\n () =>\n !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']),\n [isSelectedInValidOption, selected, theme]\n );\n\n const arrowView = !multiple ? (\n <ArrowDown\n color={selected && (theme === 'question' || theme === 'template') ? color : black}\n className={style.arrow}\n />\n ) : null;\n const behaviourClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme ? themeStyle[theme] : behaviourClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviourClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div className={composedClassName}>\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool\n};\n\nexport default Select;\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/select/index.js"],"names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","Select","props","context","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","optionList","map","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","arrowColor","undefined","arrowView","selectedArrow","arrow","behaviourClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;AACjBC,EAAAA,MAAM,EAAEC,eAAMD,MADG;AAEjBE,EAAAA,OAAO,EAAED,eAAMC,OAFE;AAGjBC,EAAAA,MAAM,EAAEF,eAAME,MAHG;AAIjBC,EAAAA,IAAI,EAAEH,eAAMG,IAJK;AAKjBC,EAAAA,QAAQ,EAAEJ,eAAMI,QALC;AAMjBC,EAAAA,IA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BAAUI,MAA7B,CAApB,CAF4B;AAGnChC,EAAAA,QAAQ,EAAE4B,mBAAUK,IAHe;AAInC9B,EAAAA,WAAW,EAAEyB,mBAAUK;AAJY,CAA9B;;AAOP1D,MAAM,CAAC2D,YAAP,GAAsB;AACpB1C,EAAAA,IAAI,EAAE2C,kBAASC,iBAAT,CAA2B5C;AADb,CAAtB;AAIAjB,MAAM,CAAC8D,SAAP,2CAAmB;AACjB/C,EAAAA,KAAK,EAAEsC,mBAAUC,MADA;AAEjBnD,EAAAA,IAAI,EAAEkD,mBAAUC,MAFC;AAGjBjD,EAAAA,SAAS,EAAEgD,mBAAUC,MAHJ;AAIjBhD,EAAAA,eAAe,EAAE+C,mBAAUC,MAJV;AAKjB7C,EAAAA,QAAQ,EAAE4C,mBAAUK,IALH;AAMjBlD,EAAAA,QAAQ,EAAE6C,mBAAUK,IANH;AAOjB/C,EAAAA,WAAW,EAAE0C,mBAAUC,MAPN;AAQjB5C,EAAAA,QAAQ,EAAE2C,mBAAUK,IARH;AASjBnD,EAAAA,QAAQ,EAAE8C,mBAAUU,IATH;AAUjBnD,EAAAA,KAAK,EAAEyC,mBAAUW,KAAV,CAAgB,oBAAK3E,UAAL,CAAhB,CAVU;AAWjBe,EAAAA,OAAO,EAAEiD,mBAAUY,OAAV,CAAkBZ,mBAAUa,KAAV,CAAgBd,qBAAhB,CAAlB,CAXQ;AAYjBvC,EAAAA,QAAQ,EAAEwC,mBAAUK,IAZH;AAajB5C,EAAAA,KAAK,EAAEuC,mBAAUK;AAbA,CAAnB;eAgBe1D,M","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {find, keys, map, get, getOr, filter, includes, size} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template // we keep template in case it is used anywhere else?\n};\n\nconst Select = (props, context) => {\n const {\n name,\n options = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle\n } = props;\n\n const {skin} = context;\n\n const title = useMemo(() => (propTitle ? `${propTitle}${required ? '*' : ''}` : null), [\n propTitle,\n required\n ]);\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options)),\n [multiple, options]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options)),\n [multiple, options]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const shouldUseSkinFontColor = useMemo(\n () =>\n !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']),\n [isSelectedInValidOption, selected, theme]\n );\n const arrowColor = selected ? color : undefined;\n\n const arrowView = !multiple ? (\n <ArrowDown\n color={includes(theme, ['question', 'template', 'player']) ? arrowColor : black}\n className={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n />\n ) : null;\n const behaviourClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme ? themeStyle[theme] : behaviourClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviourClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div className={composedClassName}>\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool\n};\n\nexport default Select;\n"],"file":"index.js"}
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
@value xtraLightGrey from colors;
|
|
12
12
|
@value transparent from colors;
|
|
13
13
|
@value box_shadow_light_dark from colors;
|
|
14
|
+
@value box_shadow_medium_dark from colors;
|
|
14
15
|
@value cm_blue_900 from colors;
|
|
16
|
+
@value cm_grey_450 from colors;
|
|
15
17
|
|
|
16
18
|
.default {
|
|
17
19
|
display: flex;
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
.player .selectWrapper {
|
|
86
88
|
min-width: min-content;
|
|
87
89
|
height: min-content;
|
|
90
|
+
margin-right: 0;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
.modified select {
|
|
@@ -132,6 +135,22 @@
|
|
|
132
135
|
z-index: 11;
|
|
133
136
|
}
|
|
134
137
|
|
|
138
|
+
.selectedArrow {
|
|
139
|
+
composes: arrow;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.player .selectWrapper .arrow {
|
|
143
|
+
color: cm_grey_450;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.player:hover .arrow {
|
|
147
|
+
color: cm_blue_900;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.player:hover .selectedArrow {
|
|
151
|
+
color: inherit;
|
|
152
|
+
}
|
|
153
|
+
|
|
135
154
|
@media mobile {
|
|
136
155
|
.arrow::after {
|
|
137
156
|
right: 10px;
|
|
@@ -248,6 +267,12 @@ div.player .noLabelCommon.selectSpan {
|
|
|
248
267
|
min-width: min-content;
|
|
249
268
|
width: 100%;
|
|
250
269
|
white-space: nowrap;
|
|
270
|
+
color: cm_blue_900;
|
|
271
|
+
border-width: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
div.player:hover span.selectSpan {
|
|
275
|
+
box-shadow: 0px 4px 16px box_shadow_medium_dark;
|
|
251
276
|
}
|
|
252
277
|
|
|
253
278
|
.no-label .selectBox {
|
|
@@ -467,6 +492,17 @@ div.player .noLabelCommon.selectSpan {
|
|
|
467
492
|
composes: no-label;
|
|
468
493
|
}
|
|
469
494
|
|
|
495
|
+
.player .selectBox {
|
|
496
|
+
border: 0;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/* mozilla specific styling */
|
|
500
|
+
@supports (-moz-appearance:none) {
|
|
501
|
+
.player label.selectWrapper select.selectBox {
|
|
502
|
+
width: 100%;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
470
506
|
/*
|
|
471
507
|
Header
|
|
472
508
|
*/
|
|
@@ -26,6 +26,8 @@ var _multipleSelected = _interopRequireDefault(require("./fixtures/multiple-sele
|
|
|
26
26
|
|
|
27
27
|
var _multiple = _interopRequireDefault(require("./fixtures/multiple"));
|
|
28
28
|
|
|
29
|
+
var _player = _interopRequireDefault(require("./fixtures/player"));
|
|
30
|
+
|
|
29
31
|
var _question = _interopRequireDefault(require("./fixtures/question"));
|
|
30
32
|
|
|
31
33
|
var _requiredWithTitle = _interopRequireDefault(require("./fixtures/required-with-title"));
|
|
@@ -57,6 +59,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
57
59
|
(0, _ava.default)('Atom › AtomSelect › Mooc › should be rendered', _renderComponent.default, _.default, _mooc.default);
|
|
58
60
|
(0, _ava.default)('Atom › AtomSelect › MultipleSelected › should be rendered', _renderComponent.default, _.default, _multipleSelected.default);
|
|
59
61
|
(0, _ava.default)('Atom › AtomSelect › Multiple › should be rendered', _renderComponent.default, _.default, _multiple.default);
|
|
62
|
+
(0, _ava.default)('Atom › AtomSelect › Player › should be rendered', _renderComponent.default, _.default, _player.default);
|
|
60
63
|
(0, _ava.default)('Atom › AtomSelect › Question › should be rendered', _renderComponent.default, _.default, _question.default);
|
|
61
64
|
(0, _ava.default)('Atom › AtomSelect › RequiredWithTitle › should be rendered', _renderComponent.default, _.default, _requiredWithTitle.default);
|
|
62
65
|
(0, _ava.default)('Atom › AtomSelect › Required › should be rendered', _renderComponent.default, _.default, _required.default);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/atom/select/test/fixtures.js"],"names":["t","pass","AtomSelect","propTypes","value","key","not","undefined","renderComponentMacro","fixtureDefault","fixtureDisabled","fixtureError","fixtureFilter","fixtureInvalid","fixtureModified","fixtureMooc","fixtureMultipleSelected","fixtureMultiple","fixtureQuestion","fixtureRequiredWithTitle","fixtureRequired","fixtureSort","fixtureTemplate","fixtureThematiquesLong","fixtureThematiques"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,iDAAL,EAAwDA,CAAC,IAAI;AAC3DA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAAWC,SAAnB,EAA8B,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC5CL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,2CAA0CF,GAAI,mEAAvE;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,kDAAL,EAAyDG,wBAAzD,EAA+EN,SAA/E,EAA2FO,gBAA3F;AACA,kBAAK,mDAAL,EAA0DD,wBAA1D,EAAgFN,SAAhF,EAA4FQ,iBAA5F;AACA,kBAAK,gDAAL,EAAuDF,wBAAvD,EAA6EN,SAA7E,EAAyFS,cAAzF;AACA,kBAAK,iDAAL,EAAwDH,wBAAxD,EAA8EN,SAA9E,EAA0FU,eAA1F;AACA,kBAAK,kDAAL,EAAyDJ,wBAAzD,EAA+EN,SAA/E,EAA2FW,gBAA3F;AACA,kBAAK,mDAAL,EAA0DL,wBAA1D,EAAgFN,SAAhF,EAA4FY,iBAA5F;AACA,kBAAK,+CAAL,EAAsDN,wBAAtD,EAA4EN,SAA5E,EAAwFa,aAAxF;AACA,kBAAK,2DAAL,EAAkEP,wBAAlE,EAAwFN,SAAxF,EAAoGc,yBAApG;AACA,kBAAK,mDAAL,EAA0DR,wBAA1D,EAAgFN,SAAhF,EAA4Fe,iBAA5F;AACA,kBAAK,mDAAL,
|
|
1
|
+
{"version":3,"sources":["../../../../src/atom/select/test/fixtures.js"],"names":["t","pass","AtomSelect","propTypes","value","key","not","undefined","renderComponentMacro","fixtureDefault","fixtureDisabled","fixtureError","fixtureFilter","fixtureInvalid","fixtureModified","fixtureMooc","fixtureMultipleSelected","fixtureMultiple","fixturePlayer","fixtureQuestion","fixtureRequiredWithTitle","fixtureRequired","fixtureSort","fixtureTemplate","fixtureThematiquesLong","fixtureThematiques"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,iDAAL,EAAwDA,CAAC,IAAI;AAC3DA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAAWC,SAAnB,EAA8B,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC5CL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,2CAA0CF,GAAI,mEAAvE;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,kDAAL,EAAyDG,wBAAzD,EAA+EN,SAA/E,EAA2FO,gBAA3F;AACA,kBAAK,mDAAL,EAA0DD,wBAA1D,EAAgFN,SAAhF,EAA4FQ,iBAA5F;AACA,kBAAK,gDAAL,EAAuDF,wBAAvD,EAA6EN,SAA7E,EAAyFS,cAAzF;AACA,kBAAK,iDAAL,EAAwDH,wBAAxD,EAA8EN,SAA9E,EAA0FU,eAA1F;AACA,kBAAK,kDAAL,EAAyDJ,wBAAzD,EAA+EN,SAA/E,EAA2FW,gBAA3F;AACA,kBAAK,mDAAL,EAA0DL,wBAA1D,EAAgFN,SAAhF,EAA4FY,iBAA5F;AACA,kBAAK,+CAAL,EAAsDN,wBAAtD,EAA4EN,SAA5E,EAAwFa,aAAxF;AACA,kBAAK,2DAAL,EAAkEP,wBAAlE,EAAwFN,SAAxF,EAAoGc,yBAApG;AACA,kBAAK,mDAAL,EAA0DR,wBAA1D,EAAgFN,SAAhF,EAA4Fe,iBAA5F;AACA,kBAAK,iDAAL,EAAwDT,wBAAxD,EAA8EN,SAA9E,EAA0FgB,eAA1F;AACA,kBAAK,mDAAL,EAA0DV,wBAA1D,EAAgFN,SAAhF,EAA4FiB,iBAA5F;AACA,kBAAK,4DAAL,EAAmEX,wBAAnE,EAAyFN,SAAzF,EAAqGkB,0BAArG;AACA,kBAAK,mDAAL,EAA0DZ,wBAA1D,EAAgFN,SAAhF,EAA4FmB,iBAA5F;AACA,kBAAK,+CAAL,EAAsDb,wBAAtD,EAA4EN,SAA5E,EAAwFoB,aAAxF;AACA,kBAAK,mDAAL,EAA0Dd,wBAA1D,EAAgFN,SAAhF,EAA4FqB,iBAA5F;AACA,kBAAK,0DAAL,EAAiEf,wBAAjE,EAAuFN,SAAvF,EAAmGsB,wBAAnG;AACA,kBAAK,sDAAL,EAA6DhB,wBAA7D,EAAmFN,SAAnF,EAA+FuB,oBAA/F","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomSelect from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureDisabled from './fixtures/disabled';\nimport fixtureError from './fixtures/error';\nimport fixtureFilter from './fixtures/filter';\nimport fixtureInvalid from './fixtures/invalid';\nimport fixtureModified from './fixtures/modified';\nimport fixtureMooc from './fixtures/mooc';\nimport fixtureMultipleSelected from './fixtures/multiple-selected';\nimport fixtureMultiple from './fixtures/multiple';\nimport fixturePlayer from './fixtures/player';\nimport fixtureQuestion from './fixtures/question';\nimport fixtureRequiredWithTitle from './fixtures/required-with-title';\nimport fixtureRequired from './fixtures/required';\nimport fixtureSort from './fixtures/sort';\nimport fixtureTemplate from './fixtures/template';\nimport fixtureThematiquesLong from './fixtures/thematiques-long';\nimport fixtureThematiques from './fixtures/thematiques';\n\ntest('Atom › AtomSelect > should have valid propTypes', t => {\n t.pass();\n forEach(AtomSelect.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomSelect.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomSelect › Default › should be rendered', renderComponentMacro, AtomSelect, fixtureDefault);\ntest('Atom › AtomSelect › Disabled › should be rendered', renderComponentMacro, AtomSelect, fixtureDisabled);\ntest('Atom › AtomSelect › Error › should be rendered', renderComponentMacro, AtomSelect, fixtureError);\ntest('Atom › AtomSelect › Filter › should be rendered', renderComponentMacro, AtomSelect, fixtureFilter);\ntest('Atom › AtomSelect › Invalid › should be rendered', renderComponentMacro, AtomSelect, fixtureInvalid);\ntest('Atom › AtomSelect › Modified › should be rendered', renderComponentMacro, AtomSelect, fixtureModified);\ntest('Atom › AtomSelect › Mooc › should be rendered', renderComponentMacro, AtomSelect, fixtureMooc);\ntest('Atom › AtomSelect › MultipleSelected › should be rendered', renderComponentMacro, AtomSelect, fixtureMultipleSelected);\ntest('Atom › AtomSelect › Multiple › should be rendered', renderComponentMacro, AtomSelect, fixtureMultiple);\ntest('Atom › AtomSelect › Player › should be rendered', renderComponentMacro, AtomSelect, fixturePlayer);\ntest('Atom › AtomSelect › Question › should be rendered', renderComponentMacro, AtomSelect, fixtureQuestion);\ntest('Atom › AtomSelect › RequiredWithTitle › should be rendered', renderComponentMacro, AtomSelect, fixtureRequiredWithTitle);\ntest('Atom › AtomSelect › Required › should be rendered', renderComponentMacro, AtomSelect, fixtureRequired);\ntest('Atom › AtomSelect › Sort › should be rendered', renderComponentMacro, AtomSelect, fixtureSort);\ntest('Atom › AtomSelect › Template › should be rendered', renderComponentMacro, AtomSelect, fixtureTemplate);\ntest('Atom › AtomSelect › ThematiquesLong › should be rendered', renderComponentMacro, AtomSelect, fixtureThematiquesLong);\ntest('Atom › AtomSelect › Thematiques › should be rendered', renderComponentMacro, AtomSelect, fixtureThematiques);\n"],"file":"fixtures.js"}
|
|
@@ -27,12 +27,14 @@ const Customer = props => {
|
|
|
27
27
|
type,
|
|
28
28
|
coorpOriginal,
|
|
29
29
|
theme,
|
|
30
|
-
disabled = false
|
|
30
|
+
disabled = false,
|
|
31
|
+
'aria-label': ariaLabel
|
|
31
32
|
} = props;
|
|
32
33
|
const className = (0, _classnames.default)(THEMES[theme], _customer.default.customer, type === 'chapter' ? _customer.default.chapterCustomer : null);
|
|
33
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
35
|
className: className,
|
|
35
|
-
disabled: disabled
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
"aria-label": ariaLabel
|
|
36
38
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
37
39
|
className: _customer.default.content
|
|
38
40
|
}, coorpOriginal ? /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -47,7 +49,8 @@ Customer.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
47
49
|
type: _propTypes.default.string,
|
|
48
50
|
name: _propTypes.default.string,
|
|
49
51
|
coorpOriginal: _propTypes.default.bool.isRequired,
|
|
50
|
-
disabled: _propTypes.default.bool
|
|
52
|
+
disabled: _propTypes.default.bool,
|
|
53
|
+
'aria-label': _propTypes.default.string
|
|
51
54
|
} : {};
|
|
52
55
|
var _default = Customer;
|
|
53
56
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/molecule/card/customer.js"],"names":["THEMES","default","coorpmanager","style","Customer","props","name","type","coorpOriginal","theme","disabled","className","customer","chapterCustomer","content","coorp","original","propTypes","PropTypes","oneOf","string","bool","isRequired"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAEO,MAAMA,MAAM,GAAG;AACpBC,EAAAA,OAAO,EAAE,IADW;AAEpBC,EAAAA,YAAY,EAAEC,kBAAMD;AAFA,CAAf;;;AAKP,MAAME,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,IAAD;AAAOC,IAAAA,IAAP;AAAaC,IAAAA,aAAb;AAA4BC,IAAAA,KAA5B;AAAmCC,IAAAA,QAAQ,GAAG;
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/card/customer.js"],"names":["THEMES","default","coorpmanager","style","Customer","props","name","type","coorpOriginal","theme","disabled","ariaLabel","className","customer","chapterCustomer","content","coorp","original","propTypes","PropTypes","oneOf","string","bool","isRequired"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAEO,MAAMA,MAAM,GAAG;AACpBC,EAAAA,OAAO,EAAE,IADW;AAEpBC,EAAAA,YAAY,EAAEC,kBAAMD;AAFA,CAAf;;;AAKP,MAAME,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,IAAD;AAAOC,IAAAA,IAAP;AAAaC,IAAAA,aAAb;AAA4BC,IAAAA,KAA5B;AAAmCC,IAAAA,QAAQ,GAAG,KAA9C;AAAqD,kBAAcC;AAAnE,MAAgFN,KAAtF;AACA,QAAMO,SAAS,GAAG,yBAChBZ,MAAM,CAACS,KAAD,CADU,EAEhBN,kBAAMU,QAFU,EAGhBN,IAAI,KAAK,SAAT,GAAqBJ,kBAAMW,eAA3B,GAA6C,IAH7B,CAAlB;AAMA,sBACE;AAAK,IAAA,SAAS,EAAEF,SAAhB;AAA2B,IAAA,QAAQ,EAAEF,QAArC;AAA+C,kBAAYC;AAA3D,kBACE;AAAK,IAAA,SAAS,EAAER,kBAAMY;AAAtB,KACGP,aAAa,gBAAG;AAAM,IAAA,SAAS,EAAEL,kBAAMa;AAAvB,cAAH,GAAiD,IADjE,EAEGR,aAAa,gBAAG;AAAM,IAAA,SAAS,EAAEL,kBAAMc;AAAvB,iBAAH,GAAuD,IAFvE,EAGG,CAACT,aAAD,IAAkBF,IAHrB,CADF,CADF;AASD,CAjBD;;AAmBAF,QAAQ,CAACc,SAAT,2CAAqB;AACnBT,EAAAA,KAAK,EAAEU,mBAAUC,KAAV,CAAgB,oBAAKpB,MAAL,CAAhB,CADY;AAEnBO,EAAAA,IAAI,EAAEY,mBAAUE,MAFG;AAGnBf,EAAAA,IAAI,EAAEa,mBAAUE,MAHG;AAInBb,EAAAA,aAAa,EAAEW,mBAAUG,IAAV,CAAeC,UAJX;AAKnBb,EAAAA,QAAQ,EAAES,mBAAUG,IALD;AAMnB,gBAAcH,mBAAUE;AANL,CAArB;eASejB,Q","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys} from 'lodash/fp';\nimport style from './customer.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst Customer = props => {\n const {name, type, coorpOriginal, theme, disabled = false, 'aria-label': ariaLabel} = props;\n const className = classnames(\n THEMES[theme],\n style.customer,\n type === 'chapter' ? style.chapterCustomer : null\n );\n\n return (\n <div className={className} disabled={disabled} aria-label={ariaLabel}>\n <div className={style.content}>\n {coorpOriginal ? <span className={style.coorp}>Coorp </span> : null}\n {coorpOriginal ? <span className={style.original}>Original </span> : null}\n {!coorpOriginal && name}\n </div>\n </div>\n );\n};\n\nCustomer.propTypes = {\n theme: PropTypes.oneOf(keys(THEMES)),\n type: PropTypes.string,\n name: PropTypes.string,\n coorpOriginal: PropTypes.bool.isRequired,\n disabled: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Customer;\n"],"file":"customer.js"}
|
|
@@ -49,7 +49,8 @@ class Favorite extends _react.default.Component {
|
|
|
49
49
|
favorite,
|
|
50
50
|
addFavoriteToolTip,
|
|
51
51
|
removeFavoriteToolTip,
|
|
52
|
-
className
|
|
52
|
+
className,
|
|
53
|
+
'aria-label': ariaLabel = {}
|
|
53
54
|
} = this.props;
|
|
54
55
|
const primaryColor = (0, _get2.default)('common.primary', skin);
|
|
55
56
|
const darkColor = (0, _get2.default)('common.dark', skin);
|
|
@@ -61,6 +62,7 @@ class Favorite extends _react.default.Component {
|
|
|
61
62
|
className: _favorite.default.blocFavorite
|
|
62
63
|
}, toolTipView, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
64
|
"data-name": "favorite",
|
|
65
|
+
"aria-label": ariaLabel.favorite,
|
|
64
66
|
className: (0, _classnames.default)(_favorite.default.favorite, className, favorite && _favorite.default.selected),
|
|
65
67
|
onClick: this.handleFavoviteClick,
|
|
66
68
|
style: {
|
|
@@ -70,12 +72,14 @@ class Favorite extends _react.default.Component {
|
|
|
70
72
|
className: _favorite.default.checkIcon,
|
|
71
73
|
color: brandColor,
|
|
72
74
|
width: 13,
|
|
73
|
-
height: 13
|
|
75
|
+
height: 13,
|
|
76
|
+
"aria-label": ariaLabel.removeFromFavorite
|
|
74
77
|
}) : /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationMore, {
|
|
75
78
|
className: _favorite.default.moreIcon,
|
|
76
79
|
color: darkColor,
|
|
77
80
|
width: 13,
|
|
78
|
-
height: 13
|
|
81
|
+
height: 13,
|
|
82
|
+
"aria-label": ariaLabel.addToFavorite
|
|
79
83
|
})));
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -91,7 +95,12 @@ Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
91
95
|
disabled: _propTypes.default.bool,
|
|
92
96
|
addFavoriteToolTip: _propTypes.default.string,
|
|
93
97
|
removeFavoriteToolTip: _propTypes.default.string,
|
|
94
|
-
onFavoriteClick: _propTypes.default.func
|
|
98
|
+
onFavoriteClick: _propTypes.default.func,
|
|
99
|
+
'aria-label': _propTypes.default.shape({
|
|
100
|
+
favorite: _propTypes.default.string,
|
|
101
|
+
addToFavorite: _propTypes.default.string,
|
|
102
|
+
removeFromFavorite: _propTypes.default.string
|
|
103
|
+
})
|
|
95
104
|
} : {};
|
|
96
105
|
var _default = Favorite;
|
|
97
106
|
exports.default = _default;
|