@coorpacademy/components 10.5.7-alpha.6.5 → 10.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/select/index.js +41 -22
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +190 -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/fixtures.js +2 -0
- package/es/atom/select/test/fixtures.js.map +1 -1
- package/es/atom/select/test/select.js +49 -0
- package/es/atom/select/test/select.js.map +1 -0
- package/es/molecule/card/customer.js +6 -3
- package/es/molecule/card/customer.js.map +1 -1
- package/es/molecule/card/favorite.js +13 -4
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/card/index.js +41 -12
- package/es/molecule/card/index.js.map +1 -1
- package/es/molecule/card/selectable.js +11 -4
- package/es/molecule/card/selectable.js.map +1 -1
- package/es/molecule/card/test/fixtures/default.js +20 -1
- package/es/molecule/card/test/fixtures/default.js.map +1 -1
- package/es/molecule/card-content/index.js +20 -7
- package/es/molecule/card-content/index.js.map +1 -1
- package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
- package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
- package/es/molecule/course-sections/test/fixtures.js +15 -0
- package/es/molecule/course-sections/test/fixtures.js.map +1 -0
- package/es/molecule/draggable-list/test/fixtures.js +15 -0
- package/es/molecule/draggable-list/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/fixtures.js +4 -2
- package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
- 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/template/index.js +15 -11
- package/es/molecule/questions/template/index.js.map +1 -1
- package/es/molecule/questions/template/style.css +6 -0
- package/es/molecule/wizard-summary/test/fixtures.js +2 -0
- package/es/molecule/wizard-summary/test/fixtures.js.map +1 -1
- package/es/organism/wizard-contents/test/fixtures.js +2 -0
- package/es/organism/wizard-contents/test/fixtures.js.map +1 -1
- package/es/template/back-office/brand-update/test/fixtures.js +2 -0
- package/es/template/back-office/brand-update/test/fixtures.js.map +1 -1
- package/es/variables/colors.css +2 -0
- package/lib/atom/select/index.js +43 -19
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +190 -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/fixtures.js +3 -0
- package/lib/atom/select/test/fixtures.js.map +1 -1
- package/lib/atom/select/test/select.js +62 -0
- package/lib/atom/select/test/select.js.map +1 -0
- package/lib/molecule/card/customer.js +6 -3
- package/lib/molecule/card/customer.js.map +1 -1
- package/lib/molecule/card/favorite.js +13 -4
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/card/index.js +41 -12
- package/lib/molecule/card/index.js.map +1 -1
- package/lib/molecule/card/selectable.js +11 -4
- package/lib/molecule/card/selectable.js.map +1 -1
- package/lib/molecule/card/test/fixtures/default.js +20 -1
- package/lib/molecule/card/test/fixtures/default.js.map +1 -1
- package/lib/molecule/card-content/index.js +21 -7
- package/lib/molecule/card-content/index.js.map +1 -1
- package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
- package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
- package/lib/molecule/course-sections/test/fixtures.js +25 -0
- package/lib/molecule/course-sections/test/fixtures.js.map +1 -0
- package/lib/molecule/draggable-list/test/fixtures.js +25 -0
- package/lib/molecule/draggable-list/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/fixtures.js +5 -2
- package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
- 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/template/index.js +15 -11
- package/lib/molecule/questions/template/index.js.map +1 -1
- package/lib/molecule/questions/template/style.css +6 -0
- package/lib/molecule/wizard-summary/test/fixtures.js +3 -0
- package/lib/molecule/wizard-summary/test/fixtures.js.map +1 -1
- package/lib/organism/wizard-contents/test/fixtures.js +3 -0
- package/lib/organism/wizard-contents/test/fixtures.js.map +1 -1
- package/lib/template/back-office/brand-update/test/fixtures.js +3 -0
- package/lib/template/back-office/brand-update/test/fixtures.js.map +1 -1
- package/lib/variables/colors.css +2 -0
- package/package.json +2 -2
- package/es/molecule/cockpit-popin/test/fixtures.js +0 -17
- package/es/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
- package/es/molecule/search/test/fixtures.js +0 -15
- package/es/molecule/search/test/fixtures.js.map +0 -1
- package/lib/molecule/cockpit-popin/test/fixtures.js +0 -28
- package/lib/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
- package/lib/molecule/search/test/fixtures.js +0 -25
- package/lib/molecule/search/test/fixtures.js.map +0 -1
package/es/atom/select/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import _size from "lodash/fp/size";
|
|
2
|
+
import _includes from "lodash/fp/includes";
|
|
1
3
|
import _filter from "lodash/fp/filter";
|
|
4
|
+
import _getOr from "lodash/fp/getOr";
|
|
2
5
|
import _get from "lodash/fp/get";
|
|
3
6
|
import _map from "lodash/fp/map";
|
|
4
7
|
import _keys from "lodash/fp/keys";
|
|
5
8
|
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
|
+
|
|
6
12
|
import React, { useMemo } from 'react';
|
|
7
13
|
import PropTypes from 'prop-types';
|
|
8
14
|
import classnames from 'classnames';
|
|
@@ -18,7 +24,9 @@ const themeStyle = {
|
|
|
18
24
|
question: style.question,
|
|
19
25
|
sort: style.sort,
|
|
20
26
|
thematiques: style.thematiques,
|
|
21
|
-
|
|
27
|
+
player: style.player,
|
|
28
|
+
template: style.template // we keep template in case it is used anywhere else?
|
|
29
|
+
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
const Select = (props, context) => {
|
|
@@ -40,52 +48,62 @@ const Select = (props, context) => {
|
|
|
40
48
|
const {
|
|
41
49
|
skin
|
|
42
50
|
} = context;
|
|
43
|
-
const title = propTitle ? `${propTitle}${required ? '*' : ''}` : null;
|
|
51
|
+
const title = useMemo(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
|
|
44
52
|
const optionList = options && options.map((option, index) => {
|
|
45
53
|
return /*#__PURE__*/React.createElement("option", {
|
|
46
54
|
key: index,
|
|
47
|
-
value: option.value
|
|
55
|
+
value: option.value,
|
|
56
|
+
className: style.selectOption
|
|
48
57
|
}, option.name);
|
|
49
58
|
});
|
|
50
59
|
const titleView = title ? /*#__PURE__*/React.createElement("span", {
|
|
51
60
|
className: style.title
|
|
52
61
|
}, title, " ") : null;
|
|
53
|
-
const selected = multiple ? _map(_get('value'), _filter({
|
|
62
|
+
const selected = useMemo(() => multiple ? _map(_get('value'), _filter({
|
|
54
63
|
selected: true
|
|
55
64
|
}, options)) : _get('value', _find({
|
|
56
65
|
selected: true
|
|
57
|
-
}, options));
|
|
58
|
-
const selectedLabel = multiple ? _map(_get('name'), _filter({
|
|
66
|
+
}, options)), [multiple, options]);
|
|
67
|
+
const selectedLabel = useMemo(() => multiple ? _map(_get('name'), _filter({
|
|
59
68
|
selected: true
|
|
60
69
|
}, options)) : _get('name', _find({
|
|
61
70
|
selected: true
|
|
62
|
-
}, options));
|
|
71
|
+
}, options)), [multiple, options]);
|
|
72
|
+
const isSelectedInValidOption = useMemo(() => theme === 'player' && _getOr(false, 'name', _find({
|
|
73
|
+
validOption: false,
|
|
74
|
+
selected: true
|
|
75
|
+
}, options)), [options, theme]);
|
|
63
76
|
const handleChange = useMemo(() => multiple ? e => {
|
|
64
77
|
onChange(_map(_get('value'), e.target.selectedOptions));
|
|
65
78
|
} : e => {
|
|
66
79
|
onChange(e.target.value);
|
|
67
80
|
}, [onChange, multiple]);
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const skinColor = {
|
|
74
|
-
color: selected && (theme === 'question' || theme === 'template') ? color : null
|
|
75
|
-
};
|
|
81
|
+
const black = useMemo(() => _getOr('#14171A', 'common.black', skin), [skin]);
|
|
82
|
+
const color = useMemo(() => _getOr('#00B0FF', 'common.primary', skin), [skin]);
|
|
83
|
+
const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && _includes(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
|
|
84
|
+
const arrowColor = selected ? color : undefined;
|
|
76
85
|
const arrowView = !multiple ? /*#__PURE__*/React.createElement(ArrowDown, {
|
|
77
|
-
color:
|
|
78
|
-
className: style.arrow
|
|
86
|
+
color: _includes(theme, ['question', 'template', 'player']) ? arrowColor : black,
|
|
87
|
+
className: shouldUseSkinFontColor ? style.selectedArrow : style.arrow
|
|
79
88
|
}) : null;
|
|
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);
|
|
89
|
+
const behaviourClassName = useMemo(() => getClassState(style.default, style.modified, style.error, modified, error), [error, modified]);
|
|
90
|
+
const composedClassName = useMemo(() => classnames(theme ? themeStyle[theme] : behaviourClassName, selected ? style.selected : style.unselected, className), [behaviourClassName, className, selected, theme]);
|
|
91
|
+
const labelSize = useMemo(() => _size(selectedLabel), [selectedLabel]);
|
|
92
|
+
const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);
|
|
82
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
83
94
|
className: composedClassName
|
|
84
95
|
}, /*#__PURE__*/React.createElement("label", {
|
|
85
|
-
|
|
96
|
+
"data-name": "select-wrapper",
|
|
97
|
+
style: _extends({}, shouldUseSkinFontColor && {
|
|
98
|
+
color
|
|
99
|
+
}),
|
|
100
|
+
className: style.selectWrapper
|
|
86
101
|
}, titleView, /*#__PURE__*/React.createElement("span", {
|
|
87
|
-
|
|
102
|
+
"data-name": "select-span",
|
|
103
|
+
className: classnames(style.selectSpan, _includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template']) ? style.noLabelCommon : null, borderClassName, isLongLabel ? style.longLabel : null)
|
|
88
104
|
}, selectedLabel), arrowView, /*#__PURE__*/React.createElement("select", {
|
|
105
|
+
"data-name": "native-select",
|
|
106
|
+
className: style.selectBox,
|
|
89
107
|
title: selectedLabel,
|
|
90
108
|
name: name,
|
|
91
109
|
onChange: handleChange,
|
|
@@ -100,7 +118,8 @@ const Select = (props, context) => {
|
|
|
100
118
|
export const SelectOptionPropTypes = {
|
|
101
119
|
name: PropTypes.string.isRequired,
|
|
102
120
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
103
|
-
selected: PropTypes.bool
|
|
121
|
+
selected: PropTypes.bool,
|
|
122
|
+
validOption: PropTypes.bool
|
|
104
123
|
};
|
|
105
124
|
Select.contextTypes = {
|
|
106
125
|
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","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,C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YAAP,GAAsB;AACpB7B,EAAAA,IAAI,EAAE7B,QAAQ,CAAC2D,iBAAT,CAA2B9B;AADb,CAAtB;AAIAjB,MAAM,CAACgD,SAAP,2CAAmB;AACjBjC,EAAAA,KAAK,EAAE/B,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"}
|
|
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","arrowColor","undefined","arrowView","selectedArrow","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,EAAAA,OAAO,EAAEH,KAAK,CAACG,OAFE;AAGjBC,EAAAA,MAAM,EAAEJ,KAAK,CAACI,MAHG;AAIjBC,EAAAA,IAAI,EAAE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CAAlB,CAXQ;AAYjBvC,EAAAA,QAAQ,EAAE9B,SAAS,CAAC0E,IAZH;AAajB3C,EAAAA,KAAK,EAAE/B,SAAS,CAAC0E;AAbA,CAAnB;AAgBA,eAAezD,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 const arrowColor = selected ? color : undefined;\n\n const arrowView = !multiple ? (\n <ArrowDown\n color={includes(theme, ['question', 'template', 'player']) ? arrowColor : black}\n className={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n />\n ) : null;\n const behaviourClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme ? themeStyle[theme] : behaviourClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviourClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div className={composedClassName}>\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool\n};\n\nexport default Select;\n"],"file":"index.js"}
|
package/es/atom/select/style.css
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
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 box_shadow_medium_dark from colors;
|
|
15
|
+
@value cm_blue_900 from colors;
|
|
16
|
+
@value cm_grey_450 from colors;
|
|
13
17
|
|
|
14
18
|
.default {
|
|
15
19
|
display: flex;
|
|
@@ -23,7 +27,11 @@
|
|
|
23
27
|
composes: default;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
.
|
|
30
|
+
.selectWrapper {
|
|
31
|
+
position: relative;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.default .selectWrapper {
|
|
27
35
|
display: flex;
|
|
28
36
|
align-items: center;
|
|
29
37
|
height: 50px;
|
|
@@ -41,20 +49,16 @@
|
|
|
41
49
|
width: 180px;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
.
|
|
52
|
+
.selectSpan {
|
|
45
53
|
display: none;
|
|
46
|
-
position:
|
|
54
|
+
position: relative;
|
|
55
|
+
z-index: 10;
|
|
47
56
|
white-space: nowrap;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
left: 0;
|
|
50
|
-
right: 0;
|
|
51
|
-
bottom: 0;
|
|
52
57
|
pointer-events: none;
|
|
53
|
-
text-overflow: ellipsis;
|
|
54
58
|
height: 18px;
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
.default
|
|
61
|
+
.default .selectBox {
|
|
58
62
|
font-family: "Gilroy";
|
|
59
63
|
text-transform: none;
|
|
60
64
|
padding: 0 15px;
|
|
@@ -68,6 +72,22 @@
|
|
|
68
72
|
outline: none;
|
|
69
73
|
appearance: none;
|
|
70
74
|
cursor: pointer;
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
bottom: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.selectOption,
|
|
82
|
+
.no-label .selectWrapper{
|
|
83
|
+
min-width: min-content;
|
|
84
|
+
height: min-content;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.player .selectWrapper {
|
|
88
|
+
min-width: min-content;
|
|
89
|
+
height: min-content;
|
|
90
|
+
margin-right: 0;
|
|
71
91
|
}
|
|
72
92
|
|
|
73
93
|
.modified select {
|
|
@@ -112,6 +132,23 @@
|
|
|
112
132
|
pointer-events: none;
|
|
113
133
|
width: 12px;
|
|
114
134
|
height: 12px;
|
|
135
|
+
z-index: 11;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.selectedArrow {
|
|
139
|
+
composes: arrow;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.player .selectWrapper .arrow {
|
|
143
|
+
color: cm_grey_450;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.player:hover .arrow {
|
|
147
|
+
color: cm_blue_900;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.player:hover .selectedArrow {
|
|
151
|
+
color: inherit;
|
|
115
152
|
}
|
|
116
153
|
|
|
117
154
|
@media mobile {
|
|
@@ -121,7 +158,7 @@
|
|
|
121
158
|
}
|
|
122
159
|
}
|
|
123
160
|
|
|
124
|
-
.default
|
|
161
|
+
.default .selectBox[multiple] {
|
|
125
162
|
padding: 0;
|
|
126
163
|
height: 80px;
|
|
127
164
|
}
|
|
@@ -130,7 +167,7 @@
|
|
|
130
167
|
Filter
|
|
131
168
|
*/
|
|
132
169
|
|
|
133
|
-
.filter
|
|
170
|
+
.filter .selectWrapper {
|
|
134
171
|
display: flex;
|
|
135
172
|
align-items: center;
|
|
136
173
|
position: relative;
|
|
@@ -140,7 +177,7 @@
|
|
|
140
177
|
margin: 0;
|
|
141
178
|
}
|
|
142
179
|
|
|
143
|
-
.filter .
|
|
180
|
+
.filter .selectSpan {
|
|
144
181
|
display: block;
|
|
145
182
|
padding: 15px 30px 15px 15px;
|
|
146
183
|
font-size: 12px;
|
|
@@ -157,7 +194,9 @@
|
|
|
157
194
|
margin-bottom: 10px;
|
|
158
195
|
}
|
|
159
196
|
|
|
160
|
-
.filter
|
|
197
|
+
.filter .selectBox {
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 27px;
|
|
161
200
|
display: block;
|
|
162
201
|
width: 100%;
|
|
163
202
|
height: 50px;
|
|
@@ -186,57 +225,118 @@
|
|
|
186
225
|
position: relative;
|
|
187
226
|
}
|
|
188
227
|
|
|
189
|
-
.no-label
|
|
228
|
+
.no-label .selectWrapper {
|
|
190
229
|
display: flex;
|
|
191
230
|
align-items: center;
|
|
192
|
-
height:
|
|
231
|
+
min-height: 54px;
|
|
193
232
|
position: relative;
|
|
194
233
|
flex-grow: 0;
|
|
195
234
|
}
|
|
196
235
|
|
|
197
|
-
.
|
|
236
|
+
.noLabelCommon {
|
|
198
237
|
display: block;
|
|
199
238
|
padding: 0 30px 0 10px;
|
|
200
239
|
font-size: 14px;
|
|
240
|
+
height: 54px;
|
|
241
|
+
line-height: 52px;
|
|
242
|
+
box-sizing: border-box;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
div.default label.selectWrapper span.longLabel {
|
|
246
|
+
min-width: 230px;
|
|
247
|
+
max-width: 280px;
|
|
248
|
+
white-space: pre-wrap;
|
|
249
|
+
line-height: 22px;
|
|
250
|
+
padding-top: 15px;
|
|
251
|
+
padding-bottom: 15px;
|
|
252
|
+
height: auto;
|
|
253
|
+
border: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
div:not(.player) .noLabelCommon.selectSpan {
|
|
201
257
|
border: 1px solid light;
|
|
202
258
|
background: white;
|
|
203
259
|
border-radius: 2px;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
260
|
+
min-width: min-content;
|
|
261
|
+
width: 100%;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
div.player .noLabelCommon.selectSpan {
|
|
265
|
+
box-shadow: 0px 4px 16px box_shadow_light_dark;
|
|
266
|
+
border-radius: 8px;
|
|
267
|
+
min-width: min-content;
|
|
268
|
+
width: 100%;
|
|
207
269
|
white-space: nowrap;
|
|
208
|
-
|
|
270
|
+
color: cm_blue_900;
|
|
271
|
+
border-width: 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
div.player:hover span.selectSpan {
|
|
275
|
+
box-shadow: 0px 4px 16px box_shadow_medium_dark;
|
|
209
276
|
}
|
|
210
277
|
|
|
211
|
-
.no-label
|
|
278
|
+
.no-label .selectBox {
|
|
212
279
|
font-family: "Gilroy";
|
|
213
280
|
text-transform: none;
|
|
214
281
|
padding: 0 15px;
|
|
215
|
-
height:
|
|
282
|
+
height: 54px;
|
|
216
283
|
border-radius: 2px;
|
|
217
|
-
font-size:
|
|
284
|
+
font-size: 14px;
|
|
218
285
|
color: black;
|
|
219
286
|
font-weight: normal;
|
|
220
287
|
margin-left: 0;
|
|
221
288
|
width: 230px;
|
|
289
|
+
max-width: 280px;
|
|
222
290
|
cursor: pointer;
|
|
223
291
|
background: white;
|
|
224
292
|
border: 2px solid xtraLightGrey;
|
|
225
293
|
}
|
|
226
294
|
|
|
227
295
|
@media mobile {
|
|
228
|
-
.
|
|
229
|
-
|
|
230
|
-
|
|
296
|
+
div.player .selectBox {
|
|
297
|
+
min-width: 0;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.no-label .selectBox {
|
|
231
301
|
margin-left: 0;
|
|
232
302
|
border-radius: 0;
|
|
303
|
+
position: absolute;
|
|
304
|
+
left: 0;
|
|
305
|
+
right: 0;
|
|
306
|
+
bottom: 0;
|
|
233
307
|
}
|
|
234
308
|
|
|
235
|
-
.no-label
|
|
309
|
+
.no-label .selectWrapper {
|
|
236
310
|
display: block;
|
|
237
311
|
margin-right: 0;
|
|
238
312
|
width: 100%;
|
|
239
|
-
height: 44px;
|
|
313
|
+
min-height: 44px;
|
|
314
|
+
height: min-content;
|
|
315
|
+
min-width: 250px;
|
|
316
|
+
max-width: 280px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.player .noLabelCommon {
|
|
320
|
+
height: min-content;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
div.player .noLabelCommon.selectSpan {
|
|
324
|
+
min-width: 250px;
|
|
325
|
+
max-width: 280px;
|
|
326
|
+
white-space: pre-wrap;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.noLabelCommon.longLabel {
|
|
330
|
+
line-height: 22px;
|
|
331
|
+
height: 100%;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.player.default .selectBox {
|
|
335
|
+
position: absolute;
|
|
336
|
+
top: 0px;
|
|
337
|
+
left: 0px;
|
|
338
|
+
width: 100%;
|
|
339
|
+
height: 100%;
|
|
240
340
|
}
|
|
241
341
|
}
|
|
242
342
|
|
|
@@ -248,12 +348,16 @@
|
|
|
248
348
|
composes: no-label;
|
|
249
349
|
}
|
|
250
350
|
|
|
251
|
-
.invalid
|
|
351
|
+
.invalid .player {
|
|
352
|
+
color: cm_blue_900;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.invalid .selectWrapper {
|
|
252
356
|
height: 54px;
|
|
253
357
|
color: black;
|
|
254
358
|
}
|
|
255
359
|
|
|
256
|
-
.invalid .
|
|
360
|
+
.invalid .selectSpan {
|
|
257
361
|
font-size: 15px;
|
|
258
362
|
font-weight: 700;
|
|
259
363
|
border: 2px solid;
|
|
@@ -271,10 +375,11 @@
|
|
|
271
375
|
width: 150px;
|
|
272
376
|
}
|
|
273
377
|
|
|
274
|
-
.mooc
|
|
378
|
+
.mooc .selectWrapper {
|
|
275
379
|
margin: 0;
|
|
276
380
|
height: 35px;
|
|
277
381
|
border: 0;
|
|
382
|
+
width: inherit;
|
|
278
383
|
}
|
|
279
384
|
|
|
280
385
|
.mooc select {
|
|
@@ -307,11 +412,11 @@
|
|
|
307
412
|
composes: no-label;
|
|
308
413
|
}
|
|
309
414
|
|
|
310
|
-
.question
|
|
415
|
+
.question .selectWrapper {
|
|
311
416
|
height: 54px;
|
|
312
417
|
}
|
|
313
418
|
|
|
314
|
-
.question .
|
|
419
|
+
.question .selectSpan {
|
|
315
420
|
font-size: 15px;
|
|
316
421
|
font-weight: 700;
|
|
317
422
|
border: 2px solid;
|
|
@@ -328,7 +433,7 @@
|
|
|
328
433
|
margin-bottom: 10px;
|
|
329
434
|
}
|
|
330
435
|
|
|
331
|
-
.sort
|
|
436
|
+
.sort .selectWrapper {
|
|
332
437
|
display: flex;
|
|
333
438
|
align-items: center;
|
|
334
439
|
position: relative;
|
|
@@ -338,7 +443,7 @@
|
|
|
338
443
|
margin: 0;
|
|
339
444
|
}
|
|
340
445
|
|
|
341
|
-
.sort .
|
|
446
|
+
.sort .selectSpan {
|
|
342
447
|
display: block;
|
|
343
448
|
padding: 15px 30px 15px 15px;
|
|
344
449
|
font-size: 12px;
|
|
@@ -379,16 +484,59 @@
|
|
|
379
484
|
composes: no-label;
|
|
380
485
|
}
|
|
381
486
|
|
|
487
|
+
/*
|
|
488
|
+
Player
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
.player {
|
|
492
|
+
composes: no-label;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.player .selectBox {
|
|
496
|
+
border: 0;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/* mozilla specific styling */
|
|
500
|
+
@supports (-moz-appearance:none) {
|
|
501
|
+
.player label.selectWrapper select.selectBox {
|
|
502
|
+
width: 100%;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
382
506
|
/*
|
|
383
507
|
Header
|
|
384
508
|
*/
|
|
385
509
|
|
|
386
510
|
.header {
|
|
387
511
|
composes: mooc;
|
|
388
|
-
width: auto;
|
|
389
512
|
}
|
|
390
513
|
|
|
391
|
-
.header
|
|
514
|
+
.header .selectBox {
|
|
515
|
+
margin-left: 0;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.default .selectWrapper select.selectBox {
|
|
519
|
+
max-width: 280px;
|
|
520
|
+
width: inherit;
|
|
521
|
+
border-radius: 8px;
|
|
522
|
+
padding: 0;
|
|
523
|
+
height: 100%;
|
|
524
|
+
top: 0;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.header .title,
|
|
528
|
+
.header .selectWrapper span.selectSpan {
|
|
529
|
+
min-width: 150px;
|
|
530
|
+
color: transparent;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.header .selectWrapper select.selectBox {
|
|
534
|
+
padding-left: 10px;
|
|
535
|
+
border-radius: 2px;
|
|
536
|
+
padding-right: 30px;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.header .selectBox {
|
|
392
540
|
background-color: light;
|
|
393
541
|
border: 0;
|
|
394
542
|
font-weight: 700;
|
|
@@ -420,7 +568,7 @@
|
|
|
420
568
|
composes: no-label;
|
|
421
569
|
}
|
|
422
570
|
|
|
423
|
-
.template
|
|
571
|
+
.template .selectBox {
|
|
424
572
|
width: auto;
|
|
425
573
|
height: 54px;
|
|
426
574
|
padding: 0 50px 0 0;
|
|
@@ -428,22 +576,22 @@
|
|
|
428
576
|
max-width: 100%;
|
|
429
577
|
}
|
|
430
578
|
|
|
431
|
-
.template .
|
|
579
|
+
.template .selectSpan {
|
|
432
580
|
font-size: 15px;
|
|
433
581
|
font-weight: 700;
|
|
434
582
|
height: 54px;
|
|
435
583
|
line-height: 52px;
|
|
436
584
|
}
|
|
437
585
|
|
|
438
|
-
.selected.template .
|
|
586
|
+
.selected.template .selectSpan {
|
|
439
587
|
border: 1px solid;
|
|
440
588
|
}
|
|
441
589
|
|
|
442
|
-
.unselected.template .
|
|
590
|
+
.unselected.template .selectSpan {
|
|
443
591
|
border: 1px solid color(black lightness(85%));
|
|
444
592
|
}
|
|
445
593
|
|
|
446
|
-
.template
|
|
594
|
+
.template .selectWrapper {
|
|
447
595
|
display: block;
|
|
448
596
|
width: auto;
|
|
449
597
|
margin-right: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/atom/select/test/fixtures/player.js"],"names":["Default","props","theme"],"mappings":";AACA,OAAOA,OAAP,MAAoB,WAApB;AAEA,MAAM;AAACC,EAAAA;AAAD,IAAUD,OAAhB;AAEA,eAAe;AACbC,EAAAA,KAAK,EAAE,cAAaA,KAAb,EAAoB;AACzBC,IAAAA,KAAK,EAAE;AADkB,GAApB;AADM,CAAf","sourcesContent":["import {defaultsDeep} from 'lodash/fp';\nimport Default from './default';\n\nconst {props} = Default;\n\nexport default {\n props: defaultsDeep(props, {\n theme: 'player'\n })\n};\n"],"file":"player.js"}
|
|
@@ -11,6 +11,7 @@ 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';
|
|
14
15
|
import fixtureQuestion from './fixtures/question';
|
|
15
16
|
import fixtureRequiredWithTitle from './fixtures/required-with-title';
|
|
16
17
|
import fixtureRequired from './fixtures/required';
|
|
@@ -33,6 +34,7 @@ test('Atom › AtomSelect › Modified › should be rendered', renderComponentM
|
|
|
33
34
|
test('Atom › AtomSelect › Mooc › should be rendered', renderComponentMacro, AtomSelect, fixtureMooc);
|
|
34
35
|
test('Atom › AtomSelect › MultipleSelected › should be rendered', renderComponentMacro, AtomSelect, fixtureMultipleSelected);
|
|
35
36
|
test('Atom › AtomSelect › Multiple › should be rendered', renderComponentMacro, AtomSelect, fixtureMultiple);
|
|
37
|
+
test('Atom › AtomSelect › Player › should be rendered', renderComponentMacro, AtomSelect, fixturePlayer);
|
|
36
38
|
test('Atom › AtomSelect › Question › should be rendered', renderComponentMacro, AtomSelect, fixtureQuestion);
|
|
37
39
|
test('Atom › AtomSelect › RequiredWithTitle › should be rendered', renderComponentMacro, AtomSelect, fixtureRequiredWithTitle);
|
|
38
40
|
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","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;
|
|
1
|
+
{"version":3,"sources":["../../../../src/atom/select/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","AtomSelect","fixtureDefault","fixtureDisabled","fixtureError","fixtureFilter","fixtureInvalid","fixtureModified","fixtureMooc","fixtureMultipleSelected","fixtureMultiple","fixturePlayer","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,aAAP,MAA0B,mBAA1B;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;AAEApB,IAAI,CAAC,iDAAD,EAAoDqB,CAAC,IAAI;AAC3DA,EAAAA,CAAC,CAACC,IAAF;AACArB,EAAAA,OAAO,CAACE,UAAU,CAACoB,SAAZ,EAAuB,CAACC,KAAD,EA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lD,EAAwEC,UAAxE,EAAoFc,WAApF,CAAJ;AACAjB,IAAI,CAAC,mDAAD,EAAsDE,oBAAtD,EAA4EC,UAA5E,EAAwFe,eAAxF,CAAJ;AACAlB,IAAI,CAAC,0DAAD,EAA6DE,oBAA7D,EAAmFC,UAAnF,EAA+FgB,sBAA/F,CAAJ;AACAnB,IAAI,CAAC,sDAAD,EAAyDE,oBAAzD,EAA+EC,UAA/E,EAA2FiB,kBAA3F,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport AtomSelect from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureDisabled from './fixtures/disabled';\nimport fixtureError from './fixtures/error';\nimport fixtureFilter from './fixtures/filter';\nimport fixtureInvalid from './fixtures/invalid';\nimport fixtureModified from './fixtures/modified';\nimport fixtureMooc from './fixtures/mooc';\nimport fixtureMultipleSelected from './fixtures/multiple-selected';\nimport fixtureMultiple from './fixtures/multiple';\nimport fixturePlayer from './fixtures/player';\nimport fixtureQuestion from './fixtures/question';\nimport fixtureRequiredWithTitle from './fixtures/required-with-title';\nimport fixtureRequired from './fixtures/required';\nimport fixtureSort from './fixtures/sort';\nimport fixtureTemplate from './fixtures/template';\nimport fixtureThematiquesLong from './fixtures/thematiques-long';\nimport fixtureThematiques from './fixtures/thematiques';\n\ntest('Atom › AtomSelect > should have valid propTypes', t => {\n t.pass();\n forEach(AtomSelect.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Atom.AtomSelect.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Atom › AtomSelect › Default › should be rendered', renderComponentMacro, AtomSelect, fixtureDefault);\ntest('Atom › AtomSelect › Disabled › should be rendered', renderComponentMacro, AtomSelect, fixtureDisabled);\ntest('Atom › AtomSelect › Error › should be rendered', renderComponentMacro, AtomSelect, fixtureError);\ntest('Atom › AtomSelect › Filter › should be rendered', renderComponentMacro, AtomSelect, fixtureFilter);\ntest('Atom › AtomSelect › Invalid › should be rendered', renderComponentMacro, AtomSelect, fixtureInvalid);\ntest('Atom › AtomSelect › Modified › should be rendered', renderComponentMacro, AtomSelect, fixtureModified);\ntest('Atom › AtomSelect › Mooc › should be rendered', renderComponentMacro, AtomSelect, fixtureMooc);\ntest('Atom › AtomSelect › MultipleSelected › should be rendered', renderComponentMacro, AtomSelect, fixtureMultipleSelected);\ntest('Atom › AtomSelect › Multiple › should be rendered', renderComponentMacro, AtomSelect, fixtureMultiple);\ntest('Atom › AtomSelect › Player › should be rendered', renderComponentMacro, AtomSelect, fixturePlayer);\ntest('Atom › AtomSelect › Question › should be rendered', renderComponentMacro, AtomSelect, fixtureQuestion);\ntest('Atom › AtomSelect › RequiredWithTitle › should be rendered', renderComponentMacro, AtomSelect, fixtureRequiredWithTitle);\ntest('Atom › AtomSelect › Required › should be rendered', renderComponentMacro, AtomSelect, fixtureRequired);\ntest('Atom › AtomSelect › Sort › should be rendered', renderComponentMacro, AtomSelect, fixtureSort);\ntest('Atom › AtomSelect › Template › should be rendered', renderComponentMacro, AtomSelect, fixtureTemplate);\ntest('Atom › AtomSelect › ThematiquesLong › should be rendered', renderComponentMacro, AtomSelect, fixtureThematiquesLong);\ntest('Atom › AtomSelect › Thematiques › should be rendered', renderComponentMacro, AtomSelect, fixtureThematiques);\n"],"file":"fixtures.js"}
|