@coorpacademy/components 10.5.7-alpha.11 → 10.5.7-alpha.6
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 +20 -38
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +40 -129
- package/es/atom/select/test/fixtures.js +0 -2
- package/es/atom/select/test/fixtures.js.map +1 -1
- 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 +6 -1
- package/es/molecule/questions/drop-down/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.js +15 -35
- package/es/molecule/questions/free-text/index.js.map +1 -1
- package/es/molecule/questions/free-text/style.css +15 -35
- 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.js → with-default-value.js} +2 -2
- package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +1 -0
- package/es/molecule/questions/free-text/test/fixtures.js +2 -4
- package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/es/molecule/questions/qcm/style.css +4 -0
- 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 -0
- 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/template/index.js +10 -13
- 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/select/index.js +17 -40
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +40 -129
- package/lib/atom/select/test/fixtures.js +0 -3
- package/lib/atom/select/test/fixtures.js.map +1 -1
- 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 +5 -1
- package/lib/molecule/questions/drop-down/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.js +14 -32
- package/lib/molecule/questions/free-text/index.js.map +1 -1
- package/lib/molecule/questions/free-text/style.css +15 -35
- 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.js → with-default-value.js} +2 -2
- package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +1 -0
- package/lib/molecule/questions/free-text/test/fixtures.js +2 -5
- package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/lib/molecule/questions/qcm/style.css +4 -0
- 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 -0
- 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/template/index.js +10 -13
- 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/atom/select/test/fixtures/player.js +0 -11
- package/es/atom/select/test/fixtures/player.js.map +0 -1
- package/es/atom/select/test/select.js +0 -49
- package/es/atom/select/test/select.js.map +0 -1
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +0 -9
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +0 -1
- package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +0 -1
- package/es/molecule/questions/free-text/test/free-text.js +0 -106
- package/es/molecule/questions/free-text/test/free-text.js.map +0 -1
- package/lib/atom/select/test/fixtures/player.js +0 -21
- package/lib/atom/select/test/fixtures/player.js.map +0 -1
- package/lib/atom/select/test/select.js +0 -62
- package/lib/atom/select/test/select.js.map +0 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +0 -14
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +0 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +0 -1
- package/lib/molecule/questions/free-text/test/free-text.js +0 -119
- package/lib/molecule/questions/free-text/test/free-text.js.map +0 -1
package/es/atom/select/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import _size from "lodash/fp/size";
|
|
2
|
-
import _includes from "lodash/fp/includes";
|
|
3
1
|
import _filter from "lodash/fp/filter";
|
|
4
|
-
import _getOr from "lodash/fp/getOr";
|
|
5
2
|
import _get from "lodash/fp/get";
|
|
6
3
|
import _map from "lodash/fp/map";
|
|
7
4
|
import _keys from "lodash/fp/keys";
|
|
8
5
|
import _find from "lodash/fp/find";
|
|
9
|
-
|
|
10
|
-
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); }
|
|
11
|
-
|
|
12
6
|
import React, { useMemo } from 'react';
|
|
13
7
|
import PropTypes from 'prop-types';
|
|
14
8
|
import classnames from 'classnames';
|
|
@@ -24,9 +18,7 @@ const themeStyle = {
|
|
|
24
18
|
question: style.question,
|
|
25
19
|
sort: style.sort,
|
|
26
20
|
thematiques: style.thematiques,
|
|
27
|
-
|
|
28
|
-
template: style.template // we keep template in case it is used anywhere else?
|
|
29
|
-
|
|
21
|
+
template: style.template
|
|
30
22
|
};
|
|
31
23
|
|
|
32
24
|
const Select = (props, context) => {
|
|
@@ -48,61 +40,52 @@ const Select = (props, context) => {
|
|
|
48
40
|
const {
|
|
49
41
|
skin
|
|
50
42
|
} = context;
|
|
51
|
-
const title =
|
|
43
|
+
const title = propTitle ? `${propTitle}${required ? '*' : ''}` : null;
|
|
52
44
|
const optionList = options && options.map((option, index) => {
|
|
53
45
|
return /*#__PURE__*/React.createElement("option", {
|
|
54
46
|
key: index,
|
|
55
|
-
value: option.value
|
|
56
|
-
className: style.selectOption
|
|
47
|
+
value: option.value
|
|
57
48
|
}, option.name);
|
|
58
49
|
});
|
|
59
50
|
const titleView = title ? /*#__PURE__*/React.createElement("span", {
|
|
60
51
|
className: style.title
|
|
61
52
|
}, title, " ") : null;
|
|
62
|
-
const selected =
|
|
53
|
+
const selected = multiple ? _map(_get('value'), _filter({
|
|
63
54
|
selected: true
|
|
64
55
|
}, options)) : _get('value', _find({
|
|
65
56
|
selected: true
|
|
66
|
-
}, options))
|
|
67
|
-
const selectedLabel =
|
|
57
|
+
}, options));
|
|
58
|
+
const selectedLabel = multiple ? _map(_get('name'), _filter({
|
|
68
59
|
selected: true
|
|
69
60
|
}, options)) : _get('name', _find({
|
|
70
61
|
selected: true
|
|
71
|
-
}, options))
|
|
72
|
-
const isSelectedInValidOption = useMemo(() => theme === 'player' && _getOr(false, 'name', _find({
|
|
73
|
-
validOption: false,
|
|
74
|
-
selected: true
|
|
75
|
-
}, options)), [options, theme]);
|
|
62
|
+
}, options));
|
|
76
63
|
const handleChange = useMemo(() => multiple ? e => {
|
|
77
64
|
onChange(_map(_get('value'), e.target.selectedOptions));
|
|
78
65
|
} : e => {
|
|
79
66
|
onChange(e.target.value);
|
|
80
67
|
}, [onChange, multiple]);
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
68
|
+
|
|
69
|
+
const black = _get('common.black', skin);
|
|
70
|
+
|
|
71
|
+
const color = _get('common.primary', skin);
|
|
72
|
+
|
|
73
|
+
const skinColor = {
|
|
74
|
+
color: selected && (theme === 'question' || theme === 'template') ? color : null
|
|
75
|
+
};
|
|
84
76
|
const arrowView = !multiple ? /*#__PURE__*/React.createElement(ArrowDown, {
|
|
85
77
|
color: selected && (theme === 'question' || theme === 'template') ? color : black,
|
|
86
78
|
className: style.arrow
|
|
87
79
|
}) : null;
|
|
88
|
-
const behaviourClassName =
|
|
89
|
-
const composedClassName =
|
|
90
|
-
const labelSize = useMemo(() => _size(selectedLabel), [selectedLabel]);
|
|
91
|
-
const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);
|
|
80
|
+
const behaviourClassName = getClassState(style.default, style.modified, style.error, modified, error);
|
|
81
|
+
const composedClassName = classnames(theme ? themeStyle[theme] : behaviourClassName, selected ? style.selected : style.unselected, className);
|
|
92
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
83
|
className: composedClassName
|
|
94
84
|
}, /*#__PURE__*/React.createElement("label", {
|
|
95
|
-
|
|
96
|
-
style: _extends({}, shouldUseSkinFontColor && {
|
|
97
|
-
color
|
|
98
|
-
}),
|
|
99
|
-
className: style.selectWrapper
|
|
85
|
+
style: skinColor
|
|
100
86
|
}, titleView, /*#__PURE__*/React.createElement("span", {
|
|
101
|
-
|
|
102
|
-
className: classnames(style.selectSpan, _includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template']) ? style.noLabelCommon : null, borderClassName, isLongLabel ? style.longLabel : null)
|
|
87
|
+
className: classnames(style.label, borderClassName)
|
|
103
88
|
}, selectedLabel), arrowView, /*#__PURE__*/React.createElement("select", {
|
|
104
|
-
"data-name": "native-select",
|
|
105
|
-
className: style.selectBox,
|
|
106
89
|
title: selectedLabel,
|
|
107
90
|
name: name,
|
|
108
91
|
onChange: handleChange,
|
|
@@ -117,8 +100,7 @@ const Select = (props, context) => {
|
|
|
117
100
|
export const SelectOptionPropTypes = {
|
|
118
101
|
name: PropTypes.string.isRequired,
|
|
119
102
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
120
|
-
selected: PropTypes.bool
|
|
121
|
-
validOption: PropTypes.bool
|
|
103
|
+
selected: PropTypes.bool
|
|
122
104
|
};
|
|
123
105
|
Select.contextTypes = {
|
|
124
106
|
skin: Provider.childContextTypes.skin
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/select/index.js"],"names":["React","useMemo","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","Provider","getClassState","style","themeStyle","filter","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","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;AACjBC,EAAAA,MAAM,EAAEF,KAAK,CAACE,MADG;AAEjBC,EA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AlB,CAXQ;AAYjBpC,EAAAA,QAAQ,EAAE9B,SAAS,CAACuE,IAZH;AAajBxC,EAAAA,KAAK,EAAE/B,SAAS,CAACuE;AAbA,CAAnB;AAgBA,eAAetD,MAAf","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":["React","useMemo","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","Provider","getClassState","style","themeStyle","filter","invalid","header","mooc","question","sort","thematiques","template","Select","props","context","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","optionList","map","option","index","value","titleView","selected","selectedLabel","handleChange","e","target","selectedOptions","black","color","skinColor","arrowView","arrow","behaviourClassName","default","composedClassName","unselected","label","SelectOptionPropTypes","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;AACjBC,EAAAA,MAAM,EAAEF,KAAK,CAACE,MADG;AAEjBC,EAAAA,OAAO,EAAEH,KAAK,CAACG,OAFE;AAGjBC,EAAAA,MAAM,EAAEJ,KAAK,CAACI,MAHG;AAIjBC,EAAAA,IAAI,EAAEL,KAAK,CAACK,IAJK;AAKjBC,EAAAA,QAAQ,EAAEN,KAAK,CAACM,QALC;AAMjBC,EAAAA,IAAI,EAAEP,KAAK,CAACO,IANK;AAOjBC,EAAAA,WAAW,EAAER,KAAK,CAACQ,WAPF;AAQ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SAAS,CAACyD,MADA;AAEjBtC,EAAAA,IAAI,EAAEnB,SAAS,CAACyD,MAFC;AAGjBpC,EAAAA,SAAS,EAAErB,SAAS,CAACyD,MAHJ;AAIjBnC,EAAAA,eAAe,EAAEtB,SAAS,CAACyD,MAJV;AAKjBhC,EAAAA,QAAQ,EAAEzB,SAAS,CAAC6D,IALH;AAMjBrC,EAAAA,QAAQ,EAAExB,SAAS,CAAC6D,IANH;AAOjBlC,EAAAA,WAAW,EAAE3B,SAAS,CAACyD,MAPN;AAQjB/B,EAAAA,QAAQ,EAAE1B,SAAS,CAAC6D,IARH;AASjBtC,EAAAA,QAAQ,EAAEvB,SAAS,CAACiE,IATH;AAUjBrC,EAAAA,KAAK,EAAE5B,SAAS,CAACkE,KAAV,CAAgB,MAAK3D,UAAL,CAAhB,CAVU;AAWjBa,EAAAA,OAAO,EAAEpB,SAAS,CAACmE,OAAV,CAAkBnE,SAAS,CAACoE,KAAV,CAAgBZ,qBAAhB,CAAlB,CAXQ;AAYjB3B,EAAAA,QAAQ,EAAE7B,SAAS,CAAC6D,IAZH;AAajB/B,EAAAA,KAAK,EAAE9B,SAAS,CAAC6D;AAbA,CAAnB;AAgBA,eAAe7C,MAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {find, keys, map, get, filter} 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 template: style.template\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 = propTitle ? `${propTitle}${required ? '*' : ''}` : null;\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options));\n const selectedLabel = multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options));\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 = get('common.black', skin);\n const color = get('common.primary', skin);\n const skinColor = {\n color: selected && (theme === 'question' || theme === 'template') ? color : null\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 = getClassState(\n style.default,\n style.modified,\n style.error,\n modified,\n error\n );\n const composedClassName = classnames(\n theme ? themeStyle[theme] : behaviourClassName,\n selected ? style.selected : style.unselected,\n className\n );\n\n return (\n <div className={composedClassName}>\n <label style={skinColor}>\n {titleView}\n <span className={classnames(style.label, borderClassName)}>{selectedLabel}</span>\n {arrowView}\n <select\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};\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"}
|
package/es/atom/select/style.css
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
@value white from colors;
|
|
11
11
|
@value xtraLightGrey from colors;
|
|
12
12
|
@value transparent from colors;
|
|
13
|
-
@value box_shadow_light_dark from colors;
|
|
14
|
-
@value cm_blue_900 from colors;
|
|
15
13
|
|
|
16
14
|
.default {
|
|
17
15
|
display: flex;
|
|
@@ -25,11 +23,7 @@
|
|
|
25
23
|
composes: default;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
.
|
|
29
|
-
position: relative;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.default .selectWrapper {
|
|
26
|
+
.default label {
|
|
33
27
|
display: flex;
|
|
34
28
|
align-items: center;
|
|
35
29
|
height: 50px;
|
|
@@ -47,16 +41,20 @@
|
|
|
47
41
|
width: 180px;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
.
|
|
44
|
+
.label {
|
|
51
45
|
display: none;
|
|
52
|
-
position:
|
|
53
|
-
z-index: 10;
|
|
46
|
+
position: absolute;
|
|
54
47
|
white-space: nowrap;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
55
52
|
pointer-events: none;
|
|
53
|
+
text-overflow: ellipsis;
|
|
56
54
|
height: 18px;
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
.default
|
|
57
|
+
.default select {
|
|
60
58
|
font-family: "Gilroy";
|
|
61
59
|
text-transform: none;
|
|
62
60
|
padding: 0 15px;
|
|
@@ -70,18 +68,6 @@
|
|
|
70
68
|
outline: none;
|
|
71
69
|
appearance: none;
|
|
72
70
|
cursor: pointer;
|
|
73
|
-
position: absolute;
|
|
74
|
-
left: 0;
|
|
75
|
-
right: 0;
|
|
76
|
-
bottom: 0;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.selectOption,
|
|
80
|
-
|
|
81
|
-
.no-label .selectWrapper,
|
|
82
|
-
.player .selectWrapper {
|
|
83
|
-
min-width: min-content;
|
|
84
|
-
height: min-content;
|
|
85
71
|
}
|
|
86
72
|
|
|
87
73
|
.modified select {
|
|
@@ -126,7 +112,6 @@
|
|
|
126
112
|
pointer-events: none;
|
|
127
113
|
width: 12px;
|
|
128
114
|
height: 12px;
|
|
129
|
-
z-index: 11;
|
|
130
115
|
}
|
|
131
116
|
|
|
132
117
|
@media mobile {
|
|
@@ -136,7 +121,7 @@
|
|
|
136
121
|
}
|
|
137
122
|
}
|
|
138
123
|
|
|
139
|
-
.default
|
|
124
|
+
.default select[multiple] {
|
|
140
125
|
padding: 0;
|
|
141
126
|
height: 80px;
|
|
142
127
|
}
|
|
@@ -145,7 +130,7 @@
|
|
|
145
130
|
Filter
|
|
146
131
|
*/
|
|
147
132
|
|
|
148
|
-
.filter
|
|
133
|
+
.filter label {
|
|
149
134
|
display: flex;
|
|
150
135
|
align-items: center;
|
|
151
136
|
position: relative;
|
|
@@ -155,7 +140,7 @@
|
|
|
155
140
|
margin: 0;
|
|
156
141
|
}
|
|
157
142
|
|
|
158
|
-
.filter .
|
|
143
|
+
.filter .label {
|
|
159
144
|
display: block;
|
|
160
145
|
padding: 15px 30px 15px 15px;
|
|
161
146
|
font-size: 12px;
|
|
@@ -172,7 +157,7 @@
|
|
|
172
157
|
margin-bottom: 10px;
|
|
173
158
|
}
|
|
174
159
|
|
|
175
|
-
.filter
|
|
160
|
+
.filter select {
|
|
176
161
|
display: block;
|
|
177
162
|
width: 100%;
|
|
178
163
|
height: 50px;
|
|
@@ -201,110 +186,57 @@
|
|
|
201
186
|
position: relative;
|
|
202
187
|
}
|
|
203
188
|
|
|
204
|
-
.no-label
|
|
189
|
+
.no-label label {
|
|
205
190
|
display: flex;
|
|
206
191
|
align-items: center;
|
|
207
|
-
|
|
192
|
+
height: 44px;
|
|
208
193
|
position: relative;
|
|
209
194
|
flex-grow: 0;
|
|
210
195
|
}
|
|
211
196
|
|
|
212
|
-
.
|
|
197
|
+
.no-label .label {
|
|
213
198
|
display: block;
|
|
214
199
|
padding: 0 30px 0 10px;
|
|
215
200
|
font-size: 14px;
|
|
216
|
-
height: 54px;
|
|
217
|
-
line-height: 52px;
|
|
218
|
-
box-sizing: border-box;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
div.default label.selectWrapper span.longLabel {
|
|
222
|
-
min-width: 230px;
|
|
223
|
-
max-width: 280px;
|
|
224
|
-
white-space: pre-wrap;
|
|
225
|
-
line-height: 22px;
|
|
226
|
-
padding-top: 15px;
|
|
227
|
-
padding-bottom: 15px;
|
|
228
|
-
height: auto;
|
|
229
|
-
border: none;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
div:not(.player) .noLabelCommon.selectSpan {
|
|
233
201
|
border: 1px solid light;
|
|
234
202
|
background: white;
|
|
235
203
|
border-radius: 2px;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
box-shadow: 0px 4px 16px box_shadow_light_dark;
|
|
240
|
-
border-radius: 8px;
|
|
241
|
-
min-width: min-content;
|
|
242
|
-
width: 100%;
|
|
204
|
+
height: 44px;
|
|
205
|
+
line-height: 42px;
|
|
206
|
+
box-sizing: border-box;
|
|
243
207
|
white-space: nowrap;
|
|
208
|
+
text-overflow: ellipsis;
|
|
244
209
|
}
|
|
245
210
|
|
|
246
|
-
.no-label
|
|
211
|
+
.no-label select {
|
|
247
212
|
font-family: "Gilroy";
|
|
248
213
|
text-transform: none;
|
|
249
214
|
padding: 0 15px;
|
|
250
|
-
height:
|
|
215
|
+
height: 44px;
|
|
251
216
|
border-radius: 2px;
|
|
252
|
-
font-size:
|
|
217
|
+
font-size: 16px;
|
|
253
218
|
color: black;
|
|
254
219
|
font-weight: normal;
|
|
255
220
|
margin-left: 0;
|
|
256
221
|
width: 230px;
|
|
257
|
-
max-width: 280px;
|
|
258
222
|
cursor: pointer;
|
|
259
223
|
background: white;
|
|
260
224
|
border: 2px solid xtraLightGrey;
|
|
261
225
|
}
|
|
262
226
|
|
|
263
227
|
@media mobile {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
.no-label .selectBox {
|
|
228
|
+
.no-label select {
|
|
229
|
+
height: 100%;
|
|
230
|
+
width: 100%;
|
|
269
231
|
margin-left: 0;
|
|
270
232
|
border-radius: 0;
|
|
271
|
-
position: absolute;
|
|
272
|
-
left: 0;
|
|
273
|
-
right: 0;
|
|
274
|
-
bottom: 0;
|
|
275
233
|
}
|
|
276
234
|
|
|
277
|
-
.no-label
|
|
235
|
+
.no-label label {
|
|
278
236
|
display: block;
|
|
279
237
|
margin-right: 0;
|
|
280
238
|
width: 100%;
|
|
281
|
-
|
|
282
|
-
height: min-content;
|
|
283
|
-
min-width: 250px;
|
|
284
|
-
max-width: 280px;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.player .noLabelCommon {
|
|
288
|
-
height: min-content;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
div.player .noLabelCommon.selectSpan {
|
|
292
|
-
min-width: 250px;
|
|
293
|
-
max-width: 280px;
|
|
294
|
-
white-space: pre-wrap;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.noLabelCommon.longLabel {
|
|
298
|
-
line-height: 22px;
|
|
299
|
-
height: 100%;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.player.default .selectBox {
|
|
303
|
-
position: absolute;
|
|
304
|
-
top: 0px;
|
|
305
|
-
left: 0px;
|
|
306
|
-
width: 100%;
|
|
307
|
-
height: 100%;
|
|
239
|
+
height: 44px;
|
|
308
240
|
}
|
|
309
241
|
}
|
|
310
242
|
|
|
@@ -316,16 +248,12 @@ div.player .noLabelCommon.selectSpan {
|
|
|
316
248
|
composes: no-label;
|
|
317
249
|
}
|
|
318
250
|
|
|
319
|
-
.invalid
|
|
320
|
-
color: cm_blue_900;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.invalid .selectWrapper {
|
|
251
|
+
.invalid label {
|
|
324
252
|
height: 54px;
|
|
325
253
|
color: black;
|
|
326
254
|
}
|
|
327
255
|
|
|
328
|
-
.invalid .
|
|
256
|
+
.invalid .label {
|
|
329
257
|
font-size: 15px;
|
|
330
258
|
font-weight: 700;
|
|
331
259
|
border: 2px solid;
|
|
@@ -343,7 +271,7 @@ div.player .noLabelCommon.selectSpan {
|
|
|
343
271
|
width: 150px;
|
|
344
272
|
}
|
|
345
273
|
|
|
346
|
-
.mooc
|
|
274
|
+
.mooc label {
|
|
347
275
|
margin: 0;
|
|
348
276
|
height: 35px;
|
|
349
277
|
border: 0;
|
|
@@ -379,11 +307,11 @@ div.player .noLabelCommon.selectSpan {
|
|
|
379
307
|
composes: no-label;
|
|
380
308
|
}
|
|
381
309
|
|
|
382
|
-
.question
|
|
310
|
+
.question label {
|
|
383
311
|
height: 54px;
|
|
384
312
|
}
|
|
385
313
|
|
|
386
|
-
.question .
|
|
314
|
+
.question .label {
|
|
387
315
|
font-size: 15px;
|
|
388
316
|
font-weight: 700;
|
|
389
317
|
border: 2px solid;
|
|
@@ -400,7 +328,7 @@ div.player .noLabelCommon.selectSpan {
|
|
|
400
328
|
margin-bottom: 10px;
|
|
401
329
|
}
|
|
402
330
|
|
|
403
|
-
.sort
|
|
331
|
+
.sort label {
|
|
404
332
|
display: flex;
|
|
405
333
|
align-items: center;
|
|
406
334
|
position: relative;
|
|
@@ -410,7 +338,7 @@ div.player .noLabelCommon.selectSpan {
|
|
|
410
338
|
margin: 0;
|
|
411
339
|
}
|
|
412
340
|
|
|
413
|
-
.sort .
|
|
341
|
+
.sort .label {
|
|
414
342
|
display: block;
|
|
415
343
|
padding: 15px 30px 15px 15px;
|
|
416
344
|
font-size: 12px;
|
|
@@ -451,14 +379,6 @@ div.player .noLabelCommon.selectSpan {
|
|
|
451
379
|
composes: no-label;
|
|
452
380
|
}
|
|
453
381
|
|
|
454
|
-
/*
|
|
455
|
-
Player
|
|
456
|
-
*/
|
|
457
|
-
|
|
458
|
-
.player {
|
|
459
|
-
composes: no-label;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
382
|
/*
|
|
463
383
|
Header
|
|
464
384
|
*/
|
|
@@ -468,15 +388,6 @@ div.player .noLabelCommon.selectSpan {
|
|
|
468
388
|
width: auto;
|
|
469
389
|
}
|
|
470
390
|
|
|
471
|
-
.default .selectWrapper select.selectBox {
|
|
472
|
-
max-width: 280px;
|
|
473
|
-
width: inherit;
|
|
474
|
-
border-radius: 8px;
|
|
475
|
-
padding: 0;
|
|
476
|
-
height: 100%;
|
|
477
|
-
top: 0;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
391
|
.header select {
|
|
481
392
|
background-color: light;
|
|
482
393
|
border: 0;
|
|
@@ -509,7 +420,7 @@ div.player .noLabelCommon.selectSpan {
|
|
|
509
420
|
composes: no-label;
|
|
510
421
|
}
|
|
511
422
|
|
|
512
|
-
.template
|
|
423
|
+
.template select {
|
|
513
424
|
width: auto;
|
|
514
425
|
height: 54px;
|
|
515
426
|
padding: 0 50px 0 0;
|
|
@@ -517,22 +428,22 @@ div.player .noLabelCommon.selectSpan {
|
|
|
517
428
|
max-width: 100%;
|
|
518
429
|
}
|
|
519
430
|
|
|
520
|
-
.template .
|
|
431
|
+
.template .label {
|
|
521
432
|
font-size: 15px;
|
|
522
433
|
font-weight: 700;
|
|
523
434
|
height: 54px;
|
|
524
435
|
line-height: 52px;
|
|
525
436
|
}
|
|
526
437
|
|
|
527
|
-
.selected.template .
|
|
438
|
+
.selected.template .label {
|
|
528
439
|
border: 1px solid;
|
|
529
440
|
}
|
|
530
441
|
|
|
531
|
-
.unselected.template .
|
|
442
|
+
.unselected.template .label {
|
|
532
443
|
border: 1px solid color(black lightness(85%));
|
|
533
444
|
}
|
|
534
445
|
|
|
535
|
-
.template
|
|
446
|
+
.template label {
|
|
536
447
|
display: block;
|
|
537
448
|
width: auto;
|
|
538
449
|
margin-right: 0;
|
|
@@ -11,7 +11,6 @@ import fixtureModified from './fixtures/modified';
|
|
|
11
11
|
import fixtureMooc from './fixtures/mooc';
|
|
12
12
|
import fixtureMultipleSelected from './fixtures/multiple-selected';
|
|
13
13
|
import fixtureMultiple from './fixtures/multiple';
|
|
14
|
-
import fixturePlayer from './fixtures/player';
|
|
15
14
|
import fixtureQuestion from './fixtures/question';
|
|
16
15
|
import fixtureRequiredWithTitle from './fixtures/required-with-title';
|
|
17
16
|
import fixtureRequired from './fixtures/required';
|
|
@@ -34,7 +33,6 @@ test('Atom › AtomSelect › Modified › should be rendered', renderComponentM
|
|
|
34
33
|
test('Atom › AtomSelect › Mooc › should be rendered', renderComponentMacro, AtomSelect, fixtureMooc);
|
|
35
34
|
test('Atom › AtomSelect › MultipleSelected › should be rendered', renderComponentMacro, AtomSelect, fixtureMultipleSelected);
|
|
36
35
|
test('Atom › AtomSelect › Multiple › should be rendered', renderComponentMacro, AtomSelect, fixtureMultiple);
|
|
37
|
-
test('Atom › AtomSelect › Player › should be rendered', renderComponentMacro, AtomSelect, fixturePlayer);
|
|
38
36
|
test('Atom › AtomSelect › Question › should be rendered', renderComponentMacro, AtomSelect, fixtureQuestion);
|
|
39
37
|
test('Atom › AtomSelect › RequiredWithTitle › should be rendered', renderComponentMacro, AtomSelect, fixtureRequiredWithTitle);
|
|
40
38
|
test('Atom › AtomSelect › Required › should be rendered', renderComponentMacro, AtomSelect, fixtureRequired);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/atom/select/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","AtomSelect","fixtureDefault","fixtureDisabled","fixtureError","fixtureFilter","fixtureInvalid","fixtureModified","fixtureMooc","fixtureMultipleSelected","fixtureMultiple","
|
|
1
|
+
{"version":3,"sources":["../../../../src/atom/select/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","AtomSelect","fixtureDefault","fixtureDisabled","fixtureError","fixtureFilter","fixtureInvalid","fixtureModified","fixtureMooc","fixtureMultipleSelected","fixtureMultiple","fixtureQuestion","fixtureRequiredWithTitle","fixtureRequired","fixtureSort","fixtureTemplate","fixtureThematiquesLong","fixtureThematiques","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,UAAP,MAAuB,IAAvB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,sBAAP,MAAmC,6BAAnC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AAEAnB,IAAI,CAAC,iDAAD,EAAoDoB,CAAC,IAAI;AAC3DA,EAAAA,CAAC,CAACC,IAAF;AACApB,EAAAA,OAAO,CAACE,UAAU,CAACmB,SAAZ,EAAuB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC5CJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,2CAA0CF,GAAI,mEAAvE;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAxB,IAAI,CAAC,kDAAD,EAAqDE,oBAArD,EAA2EC,UAA3E,EAAuFC,cA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Content":["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 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 › 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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeCockpitPopin from '..';
|
|
5
|
+
import fixtureDefault from './fixtures/default';
|
|
6
|
+
import fixtureLoading from './fixtures/loading';
|
|
7
|
+
import fixtureVideoTranslate from './fixtures/video-translate';
|
|
8
|
+
test('Molecule › MoleculeCockpitPopin > should have valid propTypes', t => {
|
|
9
|
+
t.pass();
|
|
10
|
+
forEach(MoleculeCockpitPopin.propTypes, (value, key) => {
|
|
11
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeCockpitPopin.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
test('Molecule › MoleculeCockpitPopin › Default › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureDefault);
|
|
15
|
+
test('Molecule › MoleculeCockpitPopin › Loading › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureLoading);
|
|
16
|
+
test('Molecule › MoleculeCockpitPopin › VideoTranslate › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureVideoTranslate);
|
|
17
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/cockpit-popin/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeCockpitPopin","fixtureDefault","fixtureLoading","fixtureVideoTranslate","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,oBAAP,MAAiC,IAAjC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEAN,IAAI,CAAC,+DAAD,EAAkEO,CAAC,IAAI;AACzEA,EAAAA,CAAC,CAACC,IAAF;AACAP,EAAAA,OAAO,CAACE,oBAAoB,CAACM,SAAtB,EAAiC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACtDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,yDAAwDF,GAAI,mEAArF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAX,IAAI,CAAC,gEAAD,EAAmEE,oBAAnE,EAAyFC,oBAAzF,EAA+GC,cAA/G,CAAJ;AACAJ,IAAI,CAAC,gEAAD,EAAmEE,oBAAnE,EAAyFC,oBAAzF,EAA+GE,cAA/G,CAAJ;AACAL,IAAI,CAAC,uEAAD,EAA0EE,oBAA1E,EAAgGC,oBAAhG,EAAsHG,qBAAtH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeCockpitPopin from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLoading from './fixtures/loading';\nimport fixtureVideoTranslate from './fixtures/video-translate';\n\ntest('Molecule › MoleculeCockpitPopin > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeCockpitPopin.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeCockpitPopin.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeCockpitPopin › Default › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureDefault);\ntest('Molecule › MoleculeCockpitPopin › Loading › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureLoading);\ntest('Molecule › MoleculeCockpitPopin › VideoTranslate › should be rendered', renderComponentMacro, MoleculeCockpitPopin, fixtureVideoTranslate);\n"],"file":"fixtures.js"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _find from "lodash/fp/find";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import PropTypes from 'prop-types';
|
|
4
7
|
import Select, { SelectOptionPropTypes } from '../../../atom/select';
|
|
@@ -26,7 +29,9 @@ const DropDown = props => {
|
|
|
26
29
|
|
|
27
30
|
DropDown.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
28
31
|
onChange: Select.propTypes.onChange,
|
|
29
|
-
options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)
|
|
32
|
+
options: PropTypes.arrayOf(PropTypes.shape(_extends(_extends({}, SelectOptionPropTypes), {}, {
|
|
33
|
+
validOption: PropTypes.bool
|
|
34
|
+
}))),
|
|
30
35
|
theme: Select.propTypes.theme
|
|
31
36
|
} : {};
|
|
32
37
|
export default DropDown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["React","PropTypes","Select","SelectOptionPropTypes","style","DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","wrapper","propTypes","arrayOf","shape"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["React","PropTypes","Select","SelectOptionPropTypes","style","DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","wrapper","propTypes","arrayOf","shape","bool"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,sBAA5C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,OAAD;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAAK,EAAEC;AAA3B,MAAyCJ,KAA/C;;AAEA,QAAMK,gBAAgB,GAAG,MAAK,UAAL,EAAiBJ,OAAjB,CAAzB;;AACA,QAAMK,YAAY,GAChB,CAACD,gBAAD,IAAqBA,gBAAgB,CAACE,WAAjB,KAAiC,KAAtD,GAA8D,SAA9D,GAA0E,UAD5E;AAGA,QAAMJ,KAAK,GAAGC,UAAU,IAAIE,YAA5B;AAEA,sBACE;AAAK,IAAA,SAAS,EAAER,KAAK,CAACU;AAAtB,kBACE,oBAAC,MAAD;AAAQ,IAAA,KAAK,EAAEL,KAAf;AAAsB,IAAA,OAAO,EAAEF,OAA/B;AAAwC,IAAA,QAAQ,EAAEC;AAAlD,IADF,CADF;AAKD,CAdD;;AAgBAH,QAAQ,CAACU,SAAT,2CAAqB;AACnBP,EAAAA,QAAQ,EAAEN,MAAM,CAACa,SAAP,CAAiBP,QADR;AAEnBD,EAAAA,OAAO,EAAEN,SAAS,CAACe,OAAV,CACPf,SAAS,CAACgB,KAAV,uBAAoBd,qBAApB;AAA2CU,IAAAA,WAAW,EAAEZ,SAAS,CAACiB;AAAlE,KADO,CAFU;AAKnBT,EAAAA,KAAK,EAAEP,MAAM,CAACa,SAAP,CAAiBN;AALL,CAArB;AAQA,eAAeJ,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {find} from 'lodash/fp';\nimport Select, {SelectOptionPropTypes} from '../../../atom/select';\nimport style from './style.css';\n\nconst DropDown = props => {\n const {options, onChange, theme: propsTheme} = props;\n\n const currentSelection = find('selected', options);\n const defaultTheme =\n !currentSelection || currentSelection.validOption === false ? 'invalid' : 'question';\n\n const theme = propsTheme || defaultTheme;\n\n return (\n <div className={style.wrapper}>\n <Select theme={theme} options={options} onChange={onChange} />\n </div>\n );\n};\n\nDropDown.propTypes = {\n onChange: Select.propTypes.onChange,\n options: PropTypes.arrayOf(\n PropTypes.shape({...SelectOptionPropTypes, validOption: PropTypes.bool})\n ),\n theme: Select.propTypes.theme\n};\n\nexport default DropDown;\n"],"file":"index.js"}
|