@coorpacademy/components 10.5.7-alpha.5 → 10.5.7-alpha.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/atom/range/handle.css +18 -2
- package/es/atom/range/handle.js +7 -3
- package/es/atom/range/handle.js.map +1 -1
- package/es/atom/range/style.css +2 -2
- package/es/atom/select/index.js +38 -20
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +154 -42
- package/es/atom/select/test/fixtures/player.js +11 -0
- package/es/atom/select/test/fixtures/player.js.map +1 -0
- package/es/atom/select/test/select.js +49 -0
- package/es/atom/select/test/select.js.map +1 -0
- package/es/molecule/cockpit-popin/test/fixtures.js +17 -0
- package/es/molecule/cockpit-popin/test/fixtures.js.map +1 -0
- package/es/molecule/questions/drop-down/index.js +1 -6
- package/es/molecule/questions/drop-down/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.js +35 -15
- package/es/molecule/questions/free-text/index.js.map +1 -1
- package/es/molecule/questions/free-text/style.css +39 -15
- package/es/molecule/questions/free-text/test/fixtures/default.js +1 -1
- package/es/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +9 -0
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
- package/es/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
- package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
- package/es/molecule/questions/free-text/test/free-text.js +106 -0
- package/es/molecule/questions/free-text/test/free-text.js.map +1 -0
- package/es/molecule/questions/qcm/style.css +4 -0
- package/es/molecule/questions/qcm-drag/index.js +53 -21
- package/es/molecule/questions/qcm-drag/index.js.map +1 -1
- package/es/molecule/questions/qcm-drag/style.css +72 -22
- package/es/molecule/questions/qcm-graphic/index.js +1 -0
- package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/style.css +12 -2
- package/es/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
- package/es/molecule/questions/question-range/style.css +9 -8
- package/es/molecule/questions/template/index.js +13 -10
- package/es/molecule/questions/template/index.js.map +1 -1
- package/es/molecule/search/test/fixtures.js +15 -0
- package/es/molecule/search/test/fixtures.js.map +1 -0
- package/lib/atom/range/handle.css +18 -2
- package/lib/atom/range/handle.js +8 -3
- package/lib/atom/range/handle.js.map +1 -1
- package/lib/atom/range/style.css +2 -2
- package/lib/atom/select/index.js +40 -17
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +154 -42
- package/lib/atom/select/test/fixtures/player.js +21 -0
- package/lib/atom/select/test/fixtures/player.js.map +1 -0
- package/lib/atom/select/test/select.js +62 -0
- package/lib/atom/select/test/select.js.map +1 -0
- package/lib/molecule/cockpit-popin/test/fixtures.js +28 -0
- package/lib/molecule/cockpit-popin/test/fixtures.js.map +1 -0
- package/lib/molecule/questions/drop-down/index.js +1 -5
- package/lib/molecule/questions/drop-down/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.js +32 -14
- package/lib/molecule/questions/free-text/index.js.map +1 -1
- package/lib/molecule/questions/free-text/style.css +39 -15
- package/lib/molecule/questions/free-text/test/fixtures/default.js +1 -1
- package/lib/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +14 -0
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
- package/lib/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
- package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
- package/lib/molecule/questions/free-text/test/free-text.js +119 -0
- package/lib/molecule/questions/free-text/test/free-text.js.map +1 -0
- package/lib/molecule/questions/qcm/style.css +4 -0
- package/lib/molecule/questions/qcm-drag/index.js +53 -21
- package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
- package/lib/molecule/questions/qcm-drag/style.css +72 -22
- package/lib/molecule/questions/qcm-graphic/index.js +1 -0
- package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/style.css +12 -2
- package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
- package/lib/molecule/questions/question-range/style.css +9 -8
- package/lib/molecule/questions/template/index.js +13 -10
- package/lib/molecule/questions/template/index.js.map +1 -1
- package/lib/molecule/search/test/fixtures.js +25 -0
- package/lib/molecule/search/test/fixtures.js.map +1 -0
- package/package.json +2 -2
- package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/qcm-drag/index.js"],"names":["React","PropTypes","classnames","Provider","innerHTML","style","AnswersPropTypes","arrayOf","shape","onClick","func","order","number","selected","bool","title","string","help","EmptyView","emptySpan","contextTypes","translate","childContextTypes","propTypes","Choices","answers","answersViews","map","answer","key","invisibleAnswer","__html","
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/qcm-drag/index.js"],"names":["React","PropTypes","classnames","Provider","innerHTML","getShadowBoxColorFromPrimary","style","AnswersPropTypes","arrayOf","shape","onClick","func","order","number","selected","bool","title","string","help","EmptyView","emptySpan","contextTypes","translate","childContextTypes","propTypes","Choices","answers","answersViews","map","answer","key","invisibleAnswer","unselected","__html","choices","SelectedAnswerSections","backgroundColor","selectedAnswers","selectedAnswersViews","boxShadow","background","content","selectedAnswerText","length","emptyAnswers","QcmDrag","context","skin","primarySkinColor","wrapper"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,SAAQC,SAAR,QAAwB,+BAAxB;AACA,SAAQC,4BAAR,QAA2C,iDAA3C;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,gBAAN,2CAAyBN,SAAS,CAACO,OAAV,CACvBP,SAAS,CAACQ,KAAV,CAAgB;AACdC,EAAAA,OAAO,EAAET,SAAS,CAACU,IADL;AAEdC,EAAAA,KAAK,EAAEX,SAAS,CAACY,MAFH;AAGdC,EAAAA,QAAQ,EAAEb,SAAS,CAACc,IAHN;AAIdC,EAAAA,KAAK,EAAEf,SAAS,CAACgB,MAJH;AAKdC,EAAAA,IAAI,EAAEjB,SAAS,CAACgB;AALF,CAAhB,CADuB,CAAzB;;AAUA,MAAME,SAAS,GAAG,CAAC;AAACD,EAAAA;AAAD,CAAD,kBAAY;AAAM,EAAA,SAAS,EAAEZ,KAAK,CAACc;AAAvB,GAAmCF,IAAnC,CAA9B;;AAEAC,SAAS,CAACE,YAAV,GAAyB;AACvBC,EAAAA,SAAS,EAAEnB,QAAQ,CAACoB,iBAAT,CAA2BD;AADf,CAAzB;AAIAH,SAAS,CAACK,SAAV,2CAAsB;AACpBN,EAAAA,IAAI,EAAEjB,SAAS,CAACgB;AADI,CAAtB;;AAIA,MAAMQ,OAAO,GAAG,CAAC;AAACC,EAAAA;AAAD,CAAD,KAAe;AAC7B,QAAMC,YAAY,GAAGD,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AS,EAAEzC,KAAK,CAAC2C;AAAtB,kBACE,oBAAC,sBAAD;AAAwB,IAAA,OAAO,EAAEvB,OAAjC;AAA0C,IAAA,IAAI,EAAER,IAAhD;AAAsD,IAAA,eAAe,EAAE8B;AAAvE,IADF,eAEE;AAAK,iBAAU,kBAAf;AAAkC,IAAA,SAAS,EAAE1C,KAAK,CAACoB;AAAnD,kBACE,oBAAC,OAAD;AAAS,IAAA,OAAO,EAAEA;AAAlB,IADF,CAFF,CADF;AAQD,CAZD;;AAcAmB,OAAO,CAACrB,SAAR,2CAAoB;AAClBE,EAAAA,OAAO,EAAEnB,gBADS;AAElBW,EAAAA,IAAI,EAAEiB,sBAAsB,CAACX,SAAvB,CAAiCN;AAFrB,CAApB;AAKA2B,OAAO,CAACxB,YAAR,GAAuB;AACrB0B,EAAAA,IAAI,EAAE5C,QAAQ,CAACoB,iBAAT,CAA2BwB;AADZ,CAAvB;AAIA,eAAeF,OAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {pipe, filter, orderBy, getOr} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Provider from '../../../atom/provider';\nimport {innerHTML} from '../../../atom/label/style.css';\nimport {getShadowBoxColorFromPrimary} from '../../../util/get-shadow-box-color-from-primary';\nimport style from './style.css';\n\nconst AnswersPropTypes = PropTypes.arrayOf(\n PropTypes.shape({\n onClick: PropTypes.func,\n order: PropTypes.number,\n selected: PropTypes.bool,\n title: PropTypes.string,\n help: PropTypes.string\n })\n);\n\nconst EmptyView = ({help}) => <span className={style.emptySpan}>{help}</span>;\n\nEmptyView.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nEmptyView.propTypes = {\n help: PropTypes.string\n};\n\nconst Choices = ({answers}) => {\n const answersViews = answers.map((answer, key) => {\n const {onClick, title, selected} = answer;\n return (\n <div\n className={classnames(selected ? style.invisibleAnswer : style.unselected, innerHTML)}\n data-name=\"answer\"\n onClick={onClick}\n key={key}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n );\n });\n\n return <div className={style.choices}>{answersViews}</div>;\n};\n\nChoices.propTypes = {\n answers: AnswersPropTypes\n};\n\nconst SelectedAnswerSections = ({answers, help, backgroundColor}) => {\n const selectedAnswers = pipe(filter('selected'), orderBy('order', 'asc'))(answers);\n const selectedAnswersViews = selectedAnswers.map((answer, key) => {\n const {onClick, title} = answer;\n return (\n <div\n data-selected=\"true\"\n onClick={onClick}\n key={key}\n data-name=\"selectedAnswer\"\n className={style.selected}\n style={{\n boxShadow: `0px 4px 16px ${getShadowBoxColorFromPrimary(backgroundColor)}`\n }}\n >\n <div\n data-name=\"answerBackground\"\n style={{\n backgroundColor\n }}\n className={style.background}\n />\n <div className={style.content}>\n <span\n data-name=\"answerContent\"\n className={classnames(style.selectedAnswerText, innerHTML)}\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </div>\n </div>\n );\n });\n\n if (selectedAnswersViews.length > 0) {\n return <div className={style.selectedAnswers}>{selectedAnswersViews}</div>;\n } else {\n return (\n <div className={style.emptyAnswers}>\n <EmptyView help={help} />\n </div>\n );\n }\n};\n\nSelectedAnswerSections.propTypes = {\n answers: AnswersPropTypes,\n help: EmptyView.propTypes.help,\n backgroundColor: PropTypes.string\n};\n\nconst QcmDrag = ({answers, help}, context) => {\n const {skin} = context;\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n return (\n <div className={style.wrapper}>\n <SelectedAnswerSections answers={answers} help={help} backgroundColor={primarySkinColor} />\n <div data-name=\"qcm-drag-answers\" className={style.answers}>\n <Choices answers={answers} />\n </div>\n </div>\n );\n};\n\nQcmDrag.propTypes = {\n answers: AnswersPropTypes,\n help: SelectedAnswerSections.propTypes.help\n};\n\nQcmDrag.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default QcmDrag;\n"],"file":"index.js"}
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
@value black from colors;
|
|
8
8
|
@value medium from colors;
|
|
9
9
|
@value dark from colors;
|
|
10
|
+
@value cm_grey_75 from colors;
|
|
11
|
+
@value cm_grey_150 from colors;
|
|
12
|
+
@value cm_blue_900 from colors;
|
|
13
|
+
|
|
14
|
+
.wrapper {
|
|
15
|
+
width: 100%;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
flex-basis: auto;
|
|
19
|
+
}
|
|
10
20
|
|
|
11
21
|
.answers {
|
|
12
22
|
width: 100%;
|
|
@@ -19,17 +29,17 @@
|
|
|
19
29
|
padding: 0 24px 0 0;
|
|
20
30
|
}
|
|
21
31
|
|
|
22
|
-
.
|
|
32
|
+
.choices {
|
|
23
33
|
width: 100%;
|
|
24
34
|
display: flex;
|
|
35
|
+
justify-content: center;
|
|
25
36
|
flex-wrap: wrap;
|
|
26
37
|
flex-basis: auto;
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
.selectedAnswers {
|
|
30
41
|
composes: answers;
|
|
31
|
-
border: 2px
|
|
32
|
-
background-color: xtraLightGrey;
|
|
42
|
+
border-bottom: 2px solid cm_grey_150;
|
|
33
43
|
padding: 16px 8px 8px 16px;
|
|
34
44
|
margin: 0 0 24px;
|
|
35
45
|
}
|
|
@@ -49,32 +59,76 @@
|
|
|
49
59
|
color: medium;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
|
-
.
|
|
62
|
+
.choice {
|
|
53
63
|
font-family: 'Gilroy';
|
|
54
|
-
font-size:
|
|
55
|
-
font-weight:
|
|
56
|
-
|
|
57
|
-
line-height: 22px;
|
|
58
|
-
background-color: white;
|
|
59
|
-
border: 1px solid color(dark lightness(85%));
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
font-weight: 700;
|
|
66
|
+
line-height: 20px;
|
|
60
67
|
box-sizing: border-box;
|
|
61
|
-
|
|
62
|
-
margin-bottom: 8px;
|
|
63
|
-
border-radius: 3px;
|
|
68
|
+
border-radius: 8px;
|
|
64
69
|
padding: 13px 16px;
|
|
65
70
|
cursor: pointer;
|
|
71
|
+
margin-bottom: 8px;
|
|
72
|
+
margin-right: 8px;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
hyphens: auto;
|
|
75
|
+
-ms-word-break: break-all;
|
|
76
|
+
word-break: break-all;
|
|
77
|
+
word-break: break-word;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.unselected {
|
|
81
|
+
composes: choice;
|
|
82
|
+
color: cm_blue_900;
|
|
83
|
+
line-height: 20px;
|
|
84
|
+
background-color: white;
|
|
85
|
+
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.12);
|
|
66
86
|
}
|
|
67
87
|
|
|
68
|
-
.
|
|
69
|
-
|
|
88
|
+
.selected {
|
|
89
|
+
composes: choice;
|
|
90
|
+
position: relative;
|
|
91
|
+
border-radius: 8px;
|
|
70
92
|
}
|
|
71
93
|
|
|
72
|
-
.
|
|
73
|
-
|
|
94
|
+
.background {
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
position: absolute;
|
|
98
|
+
border-radius: 8px;
|
|
99
|
+
height: 100%;
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.selected .background{
|
|
104
|
+
opacity: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.selected:hover {
|
|
108
|
+
background: black;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.selected:hover .background{
|
|
112
|
+
opacity: 0.8;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.content {
|
|
116
|
+
height: 100%;
|
|
117
|
+
width: 100%;
|
|
118
|
+
border-radius: 8px;
|
|
119
|
+
position: relative;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.unselected:hover {
|
|
123
|
+
background-color: cm_grey_75;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.selectedAnswerText {
|
|
127
|
+
color: white;
|
|
74
128
|
}
|
|
75
129
|
|
|
76
130
|
.invisibleAnswer {
|
|
77
|
-
composes:
|
|
131
|
+
composes: choice;
|
|
78
132
|
display: none;
|
|
79
133
|
}
|
|
80
134
|
|
|
@@ -82,8 +136,4 @@
|
|
|
82
136
|
.selectedAnswers {
|
|
83
137
|
min-height: auto;
|
|
84
138
|
}
|
|
85
|
-
|
|
86
|
-
.answer:hover {
|
|
87
|
-
background-color: white;
|
|
88
|
-
}
|
|
89
139
|
}
|
|
@@ -57,6 +57,7 @@ const QCMImage = (props, context) => {
|
|
|
57
57
|
"data-name": "answerText",
|
|
58
58
|
className: style.titleWrapper
|
|
59
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
title: title,
|
|
60
61
|
className: classnames(style.title, innerHTML) // eslint-disable-next-line react/no-danger
|
|
61
62
|
,
|
|
62
63
|
dangerouslySetInnerHTML: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/qcm-graphic/index.js"],"names":["React","PropTypes","classnames","Provider","innerHTML","getShadowBoxColorFromPrimary","style","QCMImage","props","context","answers","skin","primarySkinColor","answersViews","map","answer","key","onClick","title","selected","image","ariaLabel","boxShadow","backgroundColor","background","content","imageWrapper","backgroundImage","titleWrapper","__html","wrapper","contextTypes","childContextTypes","propTypes","arrayOf","shape","string","bool","func"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,SAAQC,SAAR,QAAwB,+BAAxB;AACA,SAAQC,4BAAR,QAA2C,iDAA3C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACnC,QAAM;AAACC,IAAAA;AAAD,MAAYF,KAAlB;AACA,QAAM;AAACG,IAAAA;AAAD,MAASF,OAAf;;AACA,QAAMG,gBAAgB,GAAG,OAAM,SAAN,EAAiB,gBAAjB,EAAmCD,IAAnC,CAAzB;;AAEA,QAAME,YAAY,GAAGH,OAAO,CAACI,GAAR,CAAY,CAACC,MAAD,EAASC,GAAT,KAAiB;AAChD,UAAM;AAACC,MAAAA,OAAD;AAAUC,MAAAA,KAAV;AAAiBC,MAAAA,QAAjB;AAA2BC,MAAAA,KAA3B;AAAkCC,MAAAA;AAAlC,QAA+CN,MAArD;AAEA,wBACE;AACE,MAAA,OAAO,EAAEE,OADX;AAEE,uBAAeE,QAFjB;AAGE,mBAAU,eAHZ;AAIE,MAAA,KAAK,eACCA,QAAQ,IAAI;AACdG,QAAAA,SAAS,EAAG,cAAajB,4BAA4B,CAACO,gBAAD,CAAmB;AAD1D,OADb,CAJP;AASE,MAAA,SAAS,EAAEO,QAAQ,GAAGb,KAAK,CAACa,QAAT,GAAoBb,KAAK,CAACS,MAT/C;AAUE,MAAA,GAAG,EAAEC;AAVP,oBAYE;AACE,mBAAU,kBADZ;AAEE,MAAA,KAAK,EAAE;AACLO,QAAAA,eAAe,EAAEJ,QAAQ,GAAGP,gBAAH,GAAsB;AAD1C,OAFT;AAKE,MAAA,SAAS,EAAEN,KAAK,CAACkB;AALnB,MAZF,eAmBE;AAAK,mBAAU,eAAf;AAA+B,MAAA,SAAS,EAAElB,KAAK,CAACmB;AAAhD,oBACE;AACE,MAAA,SAAS,EAAEnB,KAAK,CAACoB,YADnB;AAEE,mBAAU,aAFZ;AAGE,oBAAYL,SAAS,IAAIH,KAH3B;AAIE,MAAA,KAAK,EAAE;AACLS,QAAAA,eAAe,EAAG,OAAMP,KAAM;AADzB;AAJT,MADF,eASE;AAAK,mBAAU,YAAf;AAA4B,MAAA,SAAS,EAAEd,KAAK,CAACsB;AAA7C,oBACE;AACE,MAAA,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/qcm-graphic/index.js"],"names":["React","PropTypes","classnames","Provider","innerHTML","getShadowBoxColorFromPrimary","style","QCMImage","props","context","answers","skin","primarySkinColor","answersViews","map","answer","key","onClick","title","selected","image","ariaLabel","boxShadow","backgroundColor","background","content","imageWrapper","backgroundImage","titleWrapper","__html","wrapper","contextTypes","childContextTypes","propTypes","arrayOf","shape","string","bool","func"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,SAAQC,SAAR,QAAwB,+BAAxB;AACA,SAAQC,4BAAR,QAA2C,iDAA3C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACnC,QAAM;AAACC,IAAAA;AAAD,MAAYF,KAAlB;AACA,QAAM;AAACG,IAAAA;AAAD,MAASF,OAAf;;AACA,QAAMG,gBAAgB,GAAG,OAAM,SAAN,EAAiB,gBAAjB,EAAmCD,IAAnC,CAAzB;;AAEA,QAAME,YAAY,GAAGH,OAAO,CAACI,GAAR,CAAY,CAACC,MAAD,EAASC,GAAT,KAAiB;AAChD,UAAM;AAACC,MAAAA,OAAD;AAAUC,MAAAA,KAAV;AAAiBC,MAAAA,QAAjB;AAA2BC,MAAAA,KAA3B;AAAkCC,MAAAA;AAAlC,QAA+CN,MAArD;AAEA,wBACE;AACE,MAAA,OAAO,EAAEE,OADX;AAEE,uBAAeE,QAFjB;AAGE,mBAAU,eAHZ;AAIE,MAAA,KAAK,eACCA,QAAQ,IAAI;AACdG,QAAAA,SAAS,EAAG,cAAajB,4BAA4B,CAACO,gBAAD,CAAmB;AAD1D,OADb,CAJP;AASE,MAAA,SAAS,EAAEO,QAAQ,GAAGb,KAAK,CAACa,QAAT,GAAoBb,KAAK,CAACS,MAT/C;AAUE,MAAA,GAAG,EAAEC;AAVP,oBAYE;AACE,mBAAU,kBADZ;AAEE,MAAA,KAAK,EAAE;AACLO,QAAAA,eAAe,EAAEJ,QA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;AALP,GAAhB,CADO;AADU,CAArB;AAYA,eAAe7B,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Provider from '../../../atom/provider';\nimport {innerHTML} from '../../../atom/label/style.css';\nimport {getShadowBoxColorFromPrimary} from '../../../util/get-shadow-box-color-from-primary';\nimport style from './style.css';\n\nconst QCMImage = (props, context) => {\n const {answers} = props;\n const {skin} = context;\n const primarySkinColor = getOr('#00B0FF', 'common.primary', skin);\n\n const answersViews = answers.map((answer, key) => {\n const {onClick, title, selected, image, ariaLabel} = answer;\n\n return (\n <div\n onClick={onClick}\n data-selected={selected}\n data-name=\"answerGraphic\"\n style={{\n ...(selected && {\n boxShadow: `0 4px 16px ${getShadowBoxColorFromPrimary(primarySkinColor)}`\n })\n }}\n className={selected ? style.selected : style.answer}\n key={key}\n >\n <div\n data-name=\"answerBackground\"\n style={{\n backgroundColor: selected ? primarySkinColor : '#F4F4F5'\n }}\n className={style.background}\n />\n <div data-name=\"answerContent\" className={style.content}>\n <div\n className={style.imageWrapper}\n data-name=\"answerImage\"\n aria-label={ariaLabel || title}\n style={{\n backgroundImage: `url(${image})`\n }}\n />\n <div data-name=\"answerText\" className={style.titleWrapper}>\n <div\n title={title}\n className={classnames(style.title, innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </div>\n </div>\n </div>\n );\n });\n\n return (\n <div data-name=\"qcm-graphic-wrapper\" className={style.wrapper}>\n {answersViews}\n </div>\n );\n};\n\nQCMImage.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nQCMImage.propTypes = {\n answers: PropTypes.arrayOf(\n PropTypes.shape({\n title: PropTypes.string,\n selected: PropTypes.bool,\n onClick: PropTypes.func,\n image: PropTypes.string,\n ariaLabel: PropTypes.string\n })\n )\n};\n\nexport default QCMImage;\n"],"file":"index.js"}
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
margin: 0 4px 8px;
|
|
28
28
|
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.12);
|
|
29
29
|
border-radius: 16px;
|
|
30
|
-
transition: background-color 0.25s linear;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
.background {
|
|
@@ -37,7 +36,6 @@
|
|
|
37
36
|
border-radius: 16px;
|
|
38
37
|
height: 100%;
|
|
39
38
|
width: 100%;
|
|
40
|
-
transition: opacity 0.25s linear, background-color 0.25s linear;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
.content {
|
|
@@ -64,6 +62,11 @@
|
|
|
64
62
|
width: 100%;
|
|
65
63
|
align-items: center;
|
|
66
64
|
justify-content: center;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
hyphens: auto;
|
|
67
|
+
-ms-word-break: break-all;
|
|
68
|
+
word-break: break-all;
|
|
69
|
+
word-break: break-word;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
.title {
|
|
@@ -144,10 +147,17 @@
|
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
.titleWrapper {
|
|
150
|
+
height: 100%;
|
|
151
|
+
width: 100%;
|
|
152
|
+
display: flex;
|
|
147
153
|
white-space: wrap;
|
|
148
154
|
overflow: hidden;
|
|
149
155
|
padding: 0;
|
|
150
156
|
justify-content: left;
|
|
151
157
|
font-size: 15px;
|
|
152
158
|
}
|
|
159
|
+
|
|
160
|
+
.title {
|
|
161
|
+
text-align: left;
|
|
162
|
+
}
|
|
153
163
|
}
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
selected: false,
|
|
7
7
|
image: 'https://images.unsplash.com/photo-1467890947394-8171244e5410?dpr=2&auto=format&fit=crop&w=1080&h=720&q=80&cs=tinysrgb&crop=&bg='
|
|
8
8
|
}, {
|
|
9
|
-
title: 'Lorem ipsum',
|
|
9
|
+
title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sut labore et dolore magna aliqua.',
|
|
10
10
|
onClick: () => {},
|
|
11
11
|
selected: false,
|
|
12
12
|
image: 'https://images.unsplash.com/photo-1494477920939-88c59ba76428?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/molecule/questions/qcm-graphic/test/fixtures/default.js"],"names":["props","answers","title","onClick","selected","image"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,iCADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KADO,EAQP;AACEH,MAAAA,KAAK,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/molecule/questions/qcm-graphic/test/fixtures/default.js"],"names":["props","answers","title","onClick","selected","image"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,iCADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KADO,EAQP;AACEH,MAAAA,KAAK,EACH,6FAFJ;AAGEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAHnB;AAIEC,MAAAA,QAAQ,EAAE,KAJZ;AAKEC,MAAAA,KAAK,EACH;AANJ,KARO,EAgBP;AACEH,MAAAA,KAAK,EAAE,OADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,IAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KAhBO,EAuBP;AACEH,MAAAA,KAAK,EAAE,6BADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KAvBO,EA8BP;AACEH,MAAAA,KAAK,EAAE,iCADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KA9BO,EAqCP;AACEH,MAAAA,KAAK,EAAE,aADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KArCO,EA4CP;AACEH,MAAAA,KAAK,EAAE,OADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,IAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KA5CO,EAmDP;AACEH,MAAAA,KAAK,EAAE,6BADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KAnDO;AADJ;AADM,CAAf","sourcesContent":["export default {\n props: {\n answers: [\n {\n title: 'There is no need for a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1467890947394-8171244e5410?dpr=2&auto=format&fit=crop&w=1080&h=720&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title:\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sut labore et dolore magna aliqua.',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1494477920939-88c59ba76428?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'Lorem',\n onClick: () => {},\n selected: true,\n image:\n 'https://images.unsplash.com/photo-1494416952682-200c9e760aac?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'You need to have a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1493442043090-087540b34c1a?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'There is no need for a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1467890947394-8171244e5410?dpr=2&auto=format&fit=crop&w=1080&h=720&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'Lorem ipsum',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1494477920939-88c59ba76428?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'Lorem',\n onClick: () => {},\n selected: true,\n image:\n 'https://images.unsplash.com/photo-1494416952682-200c9e760aac?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'You need to have a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1493442043090-087540b34c1a?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n }\n ]\n }\n};\n"],"file":"default.js"}
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
selected: false,
|
|
7
7
|
image: 'https://images.unsplash.com/photo-1467890947394-8171244e5410?dpr=2&auto=format&fit=crop&w=1080&h=720&q=80&cs=tinysrgb&crop=&bg='
|
|
8
8
|
}, {
|
|
9
|
-
title: 'Lorem ipsum',
|
|
9
|
+
title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore.',
|
|
10
10
|
onClick: () => {},
|
|
11
11
|
selected: false,
|
|
12
12
|
image: 'https://images.unsplash.com/photo-1494477920939-88c59ba76428?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/molecule/questions/qcm-graphic/test/fixtures/no-selected.js"],"names":["props","answers","title","onClick","selected","image"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,iCADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KADO,EAQP;AACEH,MAAAA,KAAK,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/molecule/questions/qcm-graphic/test/fixtures/no-selected.js"],"names":["props","answers","title","onClick","selected","image"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAE,CACP;AACEC,MAAAA,KAAK,EAAE,iCADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KADO,EAQP;AACEH,MAAAA,KAAK,EACH,6PAFJ;AAGEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAHnB;AAIEC,MAAAA,QAAQ,EAAE,KAJZ;AAKEC,MAAAA,KAAK,EACH;AANJ,KARO,EAgBP;AACEH,MAAAA,KAAK,EAAE,OADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KAhBO,EAuBP;AACEH,MAAAA,KAAK,EAAE,6BADT;AAEEC,MAAAA,OAAO,EAAE,MAAM,CAAE,CAFnB;AAGEC,MAAAA,QAAQ,EAAE,KAHZ;AAIEC,MAAAA,KAAK,EACH;AALJ,KAvBO;AADJ;AADM,CAAf","sourcesContent":["export default {\n props: {\n answers: [\n {\n title: 'There is no need for a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1467890947394-8171244e5410?dpr=2&auto=format&fit=crop&w=1080&h=720&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title:\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore.',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1494477920939-88c59ba76428?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'Lorem',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1494416952682-200c9e760aac?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n },\n {\n title: 'You need to have a password',\n onClick: () => {},\n selected: false,\n image:\n 'https://images.unsplash.com/photo-1493442043090-087540b34c1a?dpr=2&auto=format&fit=crop&w=1080&h=607&q=80&cs=tinysrgb&crop=&bg='\n }\n ]\n }\n};\n"],"file":"no-selected.js"}
|
|
@@ -28,7 +28,7 @@ test('onClick should be reachable, should match given aria-label', t => {
|
|
|
28
28
|
});
|
|
29
29
|
const answersImages = wrapper.find('[data-name="answerImage"]');
|
|
30
30
|
t.true(answersImages.at(1).exists());
|
|
31
|
-
t.is(answersImages.at(1).props()['aria-label'], 'Lorem ipsum');
|
|
31
|
+
t.is(answersImages.at(1).props()['aria-label'], 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sut labore et dolore magna aliqua.');
|
|
32
32
|
const answers = wrapper.find('[data-name="answerGraphic"]');
|
|
33
33
|
answers.at(1).simulate('click');
|
|
34
34
|
t.true(answerWasClicked);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/molecule/questions/qcm-graphic/test/qcm-graphic.js"],"names":["browserEnv","test","React","shallow","configure","Adapter","QCMImage","defaultFixture","adapter","translate","t","answerWasClicked","props","answers","onClick","wrapper","context","answersImages","find","true","at","exists","is","simulate","pass","firstAnswer","deepEqual","style","unselectedBackgroundAnswer","children","backgroundColor","firstAnswerText","thirdAnswer","boxShadow","selectedBackgroundAnswer"],"mappings":";;;;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,SAAjB,QAAiC,QAAjC;AAEA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,QAAP,MAAqB,IAArB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEAP,UAAU;AACVI,SAAS,CAAC;AAACI,EAAAA,OAAO,EAAE,IAAIH,OAAJ;AAAV,CAAD,CAAT;AACA,MAAMI,SAAS,YAAf;AAEAR,IAAI,CAAC,4DAAD,EAA+DS,CAAC,IAAI;AACtE,MAAIC,gBAAgB,GAAG,KAAvB;AACAJ,EAAAA,cAAc,CAACK,KAAf,CAAqBC,OAArB,CAA6B,CAA7B,0BACKN,cAAc,CAACK,KAAf,CAAqBC,OAArB,CAA6B,CAA7B,CADL;AAEEC,IAAAA,OAAO,EAAE,MAAM;AACbH,MAAAA,gBAAgB,GAAG,IAAnB;AACD;AAJH;AAOA,QAAMI,OAAO,GAAGZ,OAAO,eAAC,oBAAC,QAAD,EAAcI,cAAc,CAACK,KAA7B,CAAD,EAAyC;AAC9DI,IAAAA,OAAO,EAAE;AAACP,MAAAA;AAAD;AADqD,GAAzC,CAAvB;AAIA,QAAMQ,aAAa,GAAGF,OAAO,CAACG,IAAR,CAAa,2BAAb,CAAtB;AACAR,EAAAA,CAAC,CAACS,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP;AACAX,EAAAA,CAAC,CAACY,EAAF,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/questions/qcm-graphic/test/qcm-graphic.js"],"names":["browserEnv","test","React","shallow","configure","Adapter","QCMImage","defaultFixture","adapter","translate","t","answerWasClicked","props","answers","onClick","wrapper","context","answersImages","find","true","at","exists","is","simulate","pass","firstAnswer","deepEqual","style","unselectedBackgroundAnswer","children","backgroundColor","firstAnswerText","thirdAnswer","boxShadow","selectedBackgroundAnswer"],"mappings":";;;;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,SAAjB,QAAiC,QAAjC;AAEA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,QAAP,MAAqB,IAArB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEAP,UAAU;AACVI,SAAS,CAAC;AAACI,EAAAA,OAAO,EAAE,IAAIH,OAAJ;AAAV,CAAD,CAAT;AACA,MAAMI,SAAS,YAAf;AAEAR,IAAI,CAAC,4DAAD,EAA+DS,CAAC,IAAI;AACtE,MAAIC,gBAAgB,GAAG,KAAvB;AACAJ,EAAAA,cAAc,CAACK,KAAf,CAAqBC,OAArB,CAA6B,CAA7B,0BACKN,cAAc,CAACK,KAAf,CAAqBC,OAArB,CAA6B,CAA7B,CADL;AAEEC,IAAAA,OAAO,EAAE,MAAM;AACbH,MAAAA,gBAAgB,GAAG,IAAnB;AACD;AAJH;AAOA,QAAMI,OAAO,GAAGZ,OAAO,eAAC,oBAAC,QAAD,EAAcI,cAAc,CAACK,KAA7B,CAAD,EAAyC;AAC9DI,IAAAA,OAAO,EAAE;AAACP,MAAAA;AAAD;AADqD,GAAzC,CAAvB;AAIA,QAAMQ,aAAa,GAAGF,OAAO,CAACG,IAAR,CAAa,2BAAb,CAAtB;AACAR,EAAAA,CAAC,CAACS,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP;AACAX,EAAAA,CAAC,CAACY,EAAF,CACEL,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBR,KAApB,GAA4B,YAA5B,CADF,E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ACV,MAAhB,EAAP;AAEA,QAAMW,WAAW,GAAGnB,OAAO,CAACO,EAAR,CAAW,CAAX,CAApB;AACAV,EAAAA,CAAC,CAACS,IAAF,CAAOa,WAAW,CAACX,MAAZ,EAAP;AACAX,EAAAA,CAAC,CAACgB,SAAF,CAAYM,WAAW,CAACpB,KAAZ,GAAoBe,KAAhC,EAAuC;AAACM,IAAAA,SAAS,EAAE;AAAZ,GAAvC;AACA,QAAMC,wBAAwB,GAAGF,WAAW,CAACH,QAAZ,GAAuBT,EAAvB,CAA0B,CAA1B,CAAjC;AACAV,EAAAA,CAAC,CAACS,IAAF,CAAOe,wBAAwB,CAACb,MAAzB,EAAP;AACAX,EAAAA,CAAC,CAACgB,SAAF,CAAYQ,wBAAwB,CAACtB,KAAzB,GAAiCe,KAA7C,EAAoD;AAACG,IAAAA,eAAe,EAAE;AAAlB,GAApD;AACD,CArBG,CAAJ","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {shallow, configure} from 'enzyme';\nimport {identity} from 'lodash/fp';\nimport Adapter from 'enzyme-adapter-react-16';\nimport QCMImage from '..';\nimport defaultFixture from './fixtures/default';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\nconst translate = identity;\n\ntest('onClick should be reachable, should match given aria-label', t => {\n let answerWasClicked = false;\n defaultFixture.props.answers[1] = {\n ...defaultFixture.props.answers[1],\n onClick: () => {\n answerWasClicked = true;\n }\n };\n\n const wrapper = shallow(<QCMImage {...defaultFixture.props} />, {\n context: {translate}\n });\n\n const answersImages = wrapper.find('[data-name=\"answerImage\"]');\n t.true(answersImages.at(1).exists());\n t.is(\n answersImages.at(1).props()['aria-label'],\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sut labore et dolore magna aliqua.'\n );\n\n const answers = wrapper.find('[data-name=\"answerGraphic\"]');\n answers.at(1).simulate('click');\n t.true(answerWasClicked);\n t.pass();\n});\n\ntest(\"should set: selected's background to Primary, unselected's no background\", t => {\n const wrapper = shallow(<QCMImage {...defaultFixture.props} />, {\n context: {translate}\n });\n const answers = wrapper.find('[data-name=\"answerGraphic\"]');\n\n const firstAnswer = answers.at(0);\n t.true(firstAnswer.exists());\n t.deepEqual(firstAnswer.props().style, {});\n const unselectedBackgroundAnswer = firstAnswer.children().at(0);\n t.true(unselectedBackgroundAnswer.exists());\n t.deepEqual(unselectedBackgroundAnswer.props().style, {backgroundColor: '#F4F4F5'});\n const firstAnswerText = firstAnswer.children().at(1).children().at(1).children().at(0);\n t.true(firstAnswerText.exists());\n\n const thirdAnswer = answers.at(2);\n t.true(thirdAnswer.exists());\n t.deepEqual(thirdAnswer.props().style, {boxShadow: '0 4px 16px rgba(0, 122, 179, 0.25)'});\n const selectedBackgroundAnswer = thirdAnswer.children().at(0);\n t.true(selectedBackgroundAnswer.exists());\n t.deepEqual(selectedBackgroundAnswer.props().style, {backgroundColor: '#00B0FF'});\n});\n"],"file":"qcm-graphic.js"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
@value breakpoints: "../../../variables/breakpoints.css";
|
|
2
2
|
@value mobile from breakpoints;
|
|
3
3
|
@value colors: "../../../variables/colors.css";
|
|
4
|
-
@value
|
|
5
|
-
@value black from colors;
|
|
4
|
+
@value cm_blue_900 from colors;
|
|
6
5
|
|
|
7
6
|
.wrapper {
|
|
8
7
|
width: 500px;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.title {
|
|
12
|
-
color: brand;
|
|
13
11
|
display: table;
|
|
14
12
|
font-family: "Gilroy";
|
|
15
|
-
font-size:
|
|
16
|
-
font-weight:
|
|
13
|
+
font-size: 28px;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
line-height: 36px;
|
|
17
16
|
margin: 0 auto 15px;
|
|
18
17
|
text-align: center;
|
|
19
18
|
user-select: none;
|
|
@@ -27,11 +26,13 @@
|
|
|
27
26
|
|
|
28
27
|
.label {
|
|
29
28
|
font-family: "Gilroy";
|
|
30
|
-
color:
|
|
31
|
-
font-size:
|
|
32
|
-
font-weight:
|
|
29
|
+
color: cm_blue_900;
|
|
30
|
+
font-size: 18px;
|
|
31
|
+
font-weight: 600;
|
|
33
32
|
display: inline-block;
|
|
33
|
+
line-height: 24px;
|
|
34
34
|
user-select: none;
|
|
35
|
+
font-style: normal;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
@media mobile {
|
|
@@ -3,6 +3,8 @@ import _map from "lodash/fp/map";
|
|
|
3
3
|
|
|
4
4
|
function _extends() { _extends = Object.assign || 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); }
|
|
5
5
|
|
|
6
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
+
|
|
6
8
|
import React from 'react';
|
|
7
9
|
import PropTypes from 'prop-types';
|
|
8
10
|
import parseTemplateString from '../../../util/parse-template-string';
|
|
@@ -37,10 +39,16 @@ const Template = ({
|
|
|
37
39
|
}, answers);
|
|
38
40
|
|
|
39
41
|
if (!field) return null;
|
|
40
|
-
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
type: fieldType
|
|
45
|
+
} = field,
|
|
46
|
+
fieldProps = _objectWithoutPropertiesLoose(field, ["type"]);
|
|
47
|
+
|
|
48
|
+
const fieldView = fieldType === 'text' ? /*#__PURE__*/React.createElement(FreeText, _extends({}, fieldProps, {
|
|
41
49
|
className: style.text
|
|
42
|
-
})) : /*#__PURE__*/React.createElement(DropDown, _extends({},
|
|
43
|
-
theme: "
|
|
50
|
+
})) : /*#__PURE__*/React.createElement(DropDown, _extends({}, fieldProps, {
|
|
51
|
+
theme: "player"
|
|
44
52
|
}));
|
|
45
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
54
|
className: style.answerType,
|
|
@@ -56,16 +64,11 @@ const Template = ({
|
|
|
56
64
|
};
|
|
57
65
|
|
|
58
66
|
const TextPropTypes = process.env.NODE_ENV !== "production" ? _extends(_extends({}, DropDown.propTypes), {}, {
|
|
59
|
-
type: PropTypes.string
|
|
60
|
-
name: PropTypes.string
|
|
61
|
-
}) : {};
|
|
62
|
-
const DropDownPropTypes = process.env.NODE_ENV !== "production" ? _extends(_extends({}, DropDown.propTypes), {}, {
|
|
63
|
-
type: PropTypes.string,
|
|
64
|
-
name: PropTypes.string
|
|
67
|
+
type: PropTypes.string
|
|
65
68
|
}) : {};
|
|
66
69
|
Template.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
67
70
|
template: PropTypes.string,
|
|
68
|
-
answers: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(
|
|
71
|
+
answers: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(DropDown.propTypes), PropTypes.shape(TextPropTypes)]))
|
|
69
72
|
} : {};
|
|
70
73
|
export default Template;
|
|
71
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -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","fieldView","text","answerType","wrapper","TextPropTypes","propTypes","string","
|
|
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,OAA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A8BA,sBACE;AAAK,iBAAU,kBAAf;AAAkC,IAAA,SAAS,EAAEJ,KAAK,CAACoB;AAAnD,KACGf,eADH,CADF;AAKD,CArCD;;AAuCA,MAAMgB,aAAN,iEACKvB,QAAQ,CAACwB,SADd;AAEEZ,EAAAA,IAAI,EAAEd,SAAS,CAAC2B;AAFlB;AAKAtB,QAAQ,CAACqB,SAAT,2CAAqB;AACnBpB,EAAAA,QAAQ,EAAEN,SAAS,CAAC2B,MADD;AAEnBpB,EAAAA,OAAO,EAAEP,SAAS,CAAC4B,OAAV,CACP5B,SAAS,CAAC6B,SAAV,CAAoB,CAAC7B,SAAS,CAAC8B,KAAV,CAAgB5B,QAAQ,CAACwB,SAAzB,CAAD,EAAsC1B,SAAS,CAAC8B,KAAV,CAAgBL,aAAhB,CAAtC,CAApB,CADO;AAFU,CAArB;AAOA,eAAepB,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 // 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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeSearch from '..';
|
|
5
|
+
import fixtureDefault from './fixtures/default';
|
|
6
|
+
import fixtureWithValue from './fixtures/with-value';
|
|
7
|
+
test('Molecule › MoleculeSearch > should have valid propTypes', t => {
|
|
8
|
+
t.pass();
|
|
9
|
+
forEach(MoleculeSearch.propTypes, (value, key) => {
|
|
10
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeSearch.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
test('Molecule › MoleculeSearch › Default › should be rendered', renderComponentMacro, MoleculeSearch, fixtureDefault);
|
|
14
|
+
test('Molecule › MoleculeSearch › WithValue › should be rendered', renderComponentMacro, MoleculeSearch, fixtureWithValue);
|
|
15
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/search/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeSearch","fixtureDefault","fixtureWithValue","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,cAAP,MAA2B,IAA3B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AAEAL,IAAI,CAAC,yDAAD,EAA4DM,CAAC,IAAI;AACnEA,EAAAA,CAAC,CAACC,IAAF;AACAN,EAAAA,OAAO,CAACE,cAAc,CAACK,SAAhB,EAA2B,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAChDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,mDAAkDF,GAAI,mEAA/E;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAV,IAAI,CAAC,0DAAD,EAA6DE,oBAA7D,EAAmFC,cAAnF,EAAmGC,cAAnG,CAAJ;AACAJ,IAAI,CAAC,4DAAD,EAA+DE,oBAA/D,EAAqFC,cAArF,EAAqGE,gBAArG,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeSearch from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWithValue from './fixtures/with-value';\n\ntest('Molecule › MoleculeSearch > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeSearch.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeSearch.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeSearch › Default › should be rendered', renderComponentMacro, MoleculeSearch, fixtureDefault);\ntest('Molecule › MoleculeSearch › WithValue › should be rendered', renderComponentMacro, MoleculeSearch, fixtureWithValue);\n"],"file":"fixtures.js"}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
@value colors: "../../variables/colors.css";
|
|
2
|
-
@value
|
|
2
|
+
@value white from colors;
|
|
3
|
+
@value cm_grey_200 from colors;
|
|
4
|
+
@value cm_grey_500 from colors;
|
|
5
|
+
|
|
6
|
+
.wrapper {
|
|
7
|
+
height: 100%;
|
|
8
|
+
width: 100%;
|
|
9
|
+
border-radius: 100%;
|
|
10
|
+
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.25);
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.wrapper:hover {
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
overflow: visible;
|
|
17
|
+
}
|
|
3
18
|
|
|
4
19
|
.default {
|
|
5
20
|
border-radius: 100%;
|
|
6
|
-
border:
|
|
21
|
+
border: 4px solid white;
|
|
7
22
|
box-sizing: border-box;
|
|
8
23
|
height: 100%;
|
|
9
24
|
width: 100%;
|
|
25
|
+
border-radius: 100%;
|
|
10
26
|
}
|
package/lib/atom/range/handle.js
CHANGED
|
@@ -13,6 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _provider = _interopRequireDefault(require("../provider"));
|
|
15
15
|
|
|
16
|
+
var _getShadowBoxColorFromPrimary = require("../../util/get-shadow-box-color-from-primary");
|
|
17
|
+
|
|
16
18
|
var _handle = _interopRequireDefault(require("./handle.css"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -63,15 +65,18 @@ class Handle extends _react.default.Component {
|
|
|
63
65
|
skin
|
|
64
66
|
} = this.context;
|
|
65
67
|
const primaryColor = (0, _getOr2.default)('#00B0FF', 'common.primary', skin);
|
|
66
|
-
const
|
|
68
|
+
const backgroundColor = primaryColor;
|
|
67
69
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
70
|
+
className: _handle.default.wrapper
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
68
72
|
style: {
|
|
69
|
-
|
|
73
|
+
backgroundColor,
|
|
74
|
+
boxShadow: `0px 0px 20px ${(0, _getShadowBoxColorFromPrimary.getShadowBoxColorFromPrimary)(primaryColor)}`
|
|
70
75
|
},
|
|
71
76
|
className: _handle.default.default,
|
|
72
77
|
ref: this.setHandle,
|
|
73
78
|
"data-name": 'handle'
|
|
74
|
-
});
|
|
79
|
+
}));
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/range/handle.js"],"names":["Hammer","window","require","undefined","Handle","React","Component","constructor","props","context","setHandle","bind","componentDidMount","onPanStart","onPanEnd","onPan","hammer","handle","on","componentWillUnmount","stop","destroy","el","render","skin","primaryColor","
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/range/handle.js"],"names":["Hammer","window","require","undefined","Handle","React","Component","constructor","props","context","setHandle","bind","componentDidMount","onPanStart","onPanEnd","onPan","hammer","handle","on","componentWillUnmount","stop","destroy","el","render","skin","primaryColor","backgroundColor","style","wrapper","boxShadow","default","Provider","childContextTypes","propTypes","PropTypes","func"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,MAAM,GACV;AACA,OAAOC,MAAP,KAAkB,WAAlB,GAAgCC,OAAO,CAAC,UAAD,CAAvC;AAAsD;AAA2BC,SAFnF;;AAIA,MAAMC,MAAN,SAAqBC,eAAMC,SAA3B,CAAqC;AAWnCC,EAAAA,WAAW,CAACC,KAAD,EAAQC,OAAR,EAAiB;AAC1B,UAAMD,KAAN,EAAaC,OAAb;AAEA,SAAKC,SAAL,GAAiB,KAAKA,SAAL,CAAeC,IAAf,CAAoB,IAApB,CAAjB;AACD;;AAEDC,EAAAA,iBAAiB,GAAG;AAClB;AACA,QAAIZ,MAAJ,EAAY;AACV,YAAM;AAACa,QAAAA,UAAU,iBAAX;AAAoBC,QAAAA,QAAQ,iBAA5B;AAAqCC,QAAAA,KAAK;AAA1C,UAAqD,KAAKP,KAAhE;AAEA,WAAKQ,MAAL,GAAc,IAAIhB,MAAJ,CAAW,KAAKiB,MAAhB,CAAd;AACA,WAAKD,MAAL,CAAYE,EAAZ,CAAe,UAAf,EAA2BL,UAA3B;AACA,WAAKG,MAAL,CAAYE,EAAZ,CAAe,QAAf,EAAyBJ,QAAzB;AAEA,WAAKE,MAAL,CAAYE,EAAZ,CAAe,kBAAf,EAAmCH,KAAnC;AACD;AACF;;AAEDI,EAAAA,oBAAoB,GAAG;AACrB,QAAI,KAAKH,MAAT,EAAiB;AACf,WAAKA,MAAL,CAAYI,IAAZ;AACA,WAAKJ,MAAL,CAAYK,OAAZ;AACD;;AACD,SAAKL,MAAL,GAAc,IAAd;AACD;;AAEDN,EAAAA,SAAS,CAACY,EAAD,EAAK;AACZ,SAAKL,MAAL,GAAcK,EAAd;AACD;;AAEDC,EAAAA,MAAM,GAAG;AACP,UAAM;AAACC,MAAAA;AAAD,QAAS,KAAKf,OAApB;AACA,UAAMgB,YAAY,GAAG,qBAAM,SAAN,EAAiB,gBAAjB,EAAmCD,IAAnC,CAArB;AACA,UAAME,eAAe,GAAGD,YAAxB;AAEA,wBACE;AAAK,MAAA,SAAS,EAAEE,gBAAMC;AAAtB,oBACE;AACE,MAAA,KAAK,EAAE;AACLF,QAAAA,eADK;AAELG,QAAAA,SAAS,EAAG,gBAAe,gEAA6BJ,YAA7B,CAA2C;AAFjE,OADT;AAKE,MAAA,SAAS,EAAEE,gBAAMG,OALnB;AAME,MAAA,GAAG,EAAE,KAAKpB,SANZ;AAOE,mBAAW;AAPb,MADF,CADF;AAaD;;AA5DkC;;gBAA/BN,M,kBAOkB;AACpBoB,EAAAA,IAAI,EAAEO,kBAASC,iBAAT,CAA2BR;AADb,C;;AAPlBpB,M,CACG6B,S,2CAAY;AACjBlB,EAAAA,KAAK,EAAEmB,mBAAUC,IADA;AAEjBtB,EAAAA,UAAU,EAAEqB,mBAAUC,IAFL;AAGjBrB,EAAAA,QAAQ,EAAEoB,mBAAUC;AAHH,C;eA8DN/B,M","sourcesContent":["import {noop, getOr} from 'lodash/fp';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Provider from '../provider';\nimport {getShadowBoxColorFromPrimary} from '../../util/get-shadow-box-color-from-primary';\nimport style from './handle.css';\n\nconst Hammer =\n // eslint-disable-next-line no-undef\n typeof window !== 'undefined' ? require('hammerjs') : /* istanbul ignore next */ undefined;\n\nclass Handle extends React.Component {\n static propTypes = {\n onPan: PropTypes.func,\n onPanStart: PropTypes.func,\n onPanEnd: PropTypes.func\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin\n };\n\n constructor(props, context) {\n super(props, context);\n\n this.setHandle = this.setHandle.bind(this);\n }\n\n componentDidMount() {\n /* istanbul ignore else */\n if (Hammer) {\n const {onPanStart = noop, onPanEnd = noop, onPan = noop} = this.props;\n\n this.hammer = new Hammer(this.handle);\n this.hammer.on('panstart', onPanStart);\n this.hammer.on('panend', onPanEnd);\n\n this.hammer.on('panleft panright', onPan);\n }\n }\n\n componentWillUnmount() {\n if (this.hammer) {\n this.hammer.stop();\n this.hammer.destroy();\n }\n this.hammer = null;\n }\n\n setHandle(el) {\n this.handle = el;\n }\n\n render() {\n const {skin} = this.context;\n const primaryColor = getOr('#00B0FF', 'common.primary', skin);\n const backgroundColor = primaryColor;\n\n return (\n <div className={style.wrapper}>\n <div\n style={{\n backgroundColor,\n boxShadow: `0px 0px 20px ${getShadowBoxColorFromPrimary(primaryColor)}`\n }}\n className={style.default}\n ref={this.setHandle}\n data-name={'handle'}\n />\n </div>\n );\n }\n}\n\nexport default Handle;\n"],"file":"handle.js"}
|