@coorpacademy/components 10.5.7-alpha.5 → 10.5.7-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/es/atom/range/handle.css +18 -2
  2. package/es/atom/range/handle.js +7 -3
  3. package/es/atom/range/handle.js.map +1 -1
  4. package/es/atom/range/style.css +2 -2
  5. package/es/atom/select/index.js +38 -20
  6. package/es/atom/select/index.js.map +1 -1
  7. package/es/atom/select/style.css +154 -42
  8. package/es/atom/select/test/fixtures/player.js +11 -0
  9. package/es/atom/select/test/fixtures/player.js.map +1 -0
  10. package/es/atom/select/test/select.js +49 -0
  11. package/es/atom/select/test/select.js.map +1 -0
  12. package/es/molecule/cockpit-popin/test/fixtures.js +17 -0
  13. package/es/molecule/cockpit-popin/test/fixtures.js.map +1 -0
  14. package/es/molecule/questions/drop-down/index.js +1 -6
  15. package/es/molecule/questions/drop-down/index.js.map +1 -1
  16. package/es/molecule/questions/free-text/index.js +35 -15
  17. package/es/molecule/questions/free-text/index.js.map +1 -1
  18. package/es/molecule/questions/free-text/style.css +39 -15
  19. package/es/molecule/questions/free-text/test/fixtures/default.js +1 -1
  20. package/es/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  21. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +9 -0
  22. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
  23. package/es/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
  24. package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
  25. package/es/molecule/questions/free-text/test/free-text.js +106 -0
  26. package/es/molecule/questions/free-text/test/free-text.js.map +1 -0
  27. package/es/molecule/questions/qcm/style.css +4 -0
  28. package/es/molecule/questions/qcm-drag/index.js +53 -21
  29. package/es/molecule/questions/qcm-drag/index.js.map +1 -1
  30. package/es/molecule/questions/qcm-drag/style.css +72 -22
  31. package/es/molecule/questions/qcm-graphic/index.js +1 -0
  32. package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
  33. package/es/molecule/questions/qcm-graphic/style.css +12 -2
  34. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  35. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  36. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  37. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  38. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  39. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  40. package/es/molecule/questions/question-range/style.css +9 -8
  41. package/es/molecule/questions/template/index.js +13 -10
  42. package/es/molecule/questions/template/index.js.map +1 -1
  43. package/es/molecule/search/test/fixtures.js +15 -0
  44. package/es/molecule/search/test/fixtures.js.map +1 -0
  45. package/lib/atom/range/handle.css +18 -2
  46. package/lib/atom/range/handle.js +8 -3
  47. package/lib/atom/range/handle.js.map +1 -1
  48. package/lib/atom/range/style.css +2 -2
  49. package/lib/atom/select/index.js +40 -17
  50. package/lib/atom/select/index.js.map +1 -1
  51. package/lib/atom/select/style.css +154 -42
  52. package/lib/atom/select/test/fixtures/player.js +21 -0
  53. package/lib/atom/select/test/fixtures/player.js.map +1 -0
  54. package/lib/atom/select/test/select.js +62 -0
  55. package/lib/atom/select/test/select.js.map +1 -0
  56. package/lib/molecule/cockpit-popin/test/fixtures.js +28 -0
  57. package/lib/molecule/cockpit-popin/test/fixtures.js.map +1 -0
  58. package/lib/molecule/questions/drop-down/index.js +1 -5
  59. package/lib/molecule/questions/drop-down/index.js.map +1 -1
  60. package/lib/molecule/questions/free-text/index.js +32 -14
  61. package/lib/molecule/questions/free-text/index.js.map +1 -1
  62. package/lib/molecule/questions/free-text/style.css +39 -15
  63. package/lib/molecule/questions/free-text/test/fixtures/default.js +1 -1
  64. package/lib/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  65. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +14 -0
  66. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
  67. package/lib/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
  68. package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
  69. package/lib/molecule/questions/free-text/test/free-text.js +119 -0
  70. package/lib/molecule/questions/free-text/test/free-text.js.map +1 -0
  71. package/lib/molecule/questions/qcm/style.css +4 -0
  72. package/lib/molecule/questions/qcm-drag/index.js +53 -21
  73. package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
  74. package/lib/molecule/questions/qcm-drag/style.css +72 -22
  75. package/lib/molecule/questions/qcm-graphic/index.js +1 -0
  76. package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
  77. package/lib/molecule/questions/qcm-graphic/style.css +12 -2
  78. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  79. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  80. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  81. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  82. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  83. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  84. package/lib/molecule/questions/question-range/style.css +9 -8
  85. package/lib/molecule/questions/template/index.js +13 -10
  86. package/lib/molecule/questions/template/index.js.map +1 -1
  87. package/lib/molecule/search/test/fixtures.js +25 -0
  88. package/lib/molecule/search/test/fixtures.js.map +1 -0
  89. package/package.json +2 -2
  90. package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
  91. package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
@@ -3,8 +3,14 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = exports.SelectOptionPropTypes = void 0;
5
5
 
6
+ var _size2 = _interopRequireDefault(require("lodash/fp/size"));
7
+
8
+ var _includes2 = _interopRequireDefault(require("lodash/fp/includes"));
9
+
6
10
  var _filter2 = _interopRequireDefault(require("lodash/fp/filter"));
7
11
 
12
+ var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
13
+
8
14
  var _get2 = _interopRequireDefault(require("lodash/fp/get"));
9
15
 
10
16
  var _map2 = _interopRequireDefault(require("lodash/fp/map"));
@@ -33,6 +39,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
33
39
 
34
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
41
 
42
+ 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); }
43
+
36
44
  const themeStyle = {
37
45
  filter: _style.default.filter,
38
46
  invalid: _style.default.invalid,
@@ -41,7 +49,9 @@ const themeStyle = {
41
49
  question: _style.default.question,
42
50
  sort: _style.default.sort,
43
51
  thematiques: _style.default.thematiques,
44
- template: _style.default.template
52
+ player: _style.default.player,
53
+ template: _style.default.template // we keep template in case it is used anywhere else?
54
+
45
55
  };
46
56
 
47
57
  const Select = (props, context) => {
@@ -63,49 +73,61 @@ const Select = (props, context) => {
63
73
  const {
64
74
  skin
65
75
  } = context;
66
- const title = propTitle ? `${propTitle}${required ? '*' : ''}` : null;
76
+ const title = (0, _react.useMemo)(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
67
77
  const optionList = options && options.map((option, index) => {
68
78
  return /*#__PURE__*/_react.default.createElement("option", {
69
79
  key: index,
70
- value: option.value
80
+ value: option.value,
81
+ className: _style.default.selectOption
71
82
  }, option.name);
72
83
  });
73
84
  const titleView = title ? /*#__PURE__*/_react.default.createElement("span", {
74
85
  className: _style.default.title
75
86
  }, title, " ") : null;
76
- const selected = multiple ? (0, _map2.default)((0, _get2.default)('value'), (0, _filter2.default)({
87
+ const selected = (0, _react.useMemo)(() => multiple ? (0, _map2.default)((0, _get2.default)('value'), (0, _filter2.default)({
77
88
  selected: true
78
89
  }, options)) : (0, _get2.default)('value', (0, _find2.default)({
79
90
  selected: true
80
- }, options));
81
- const selectedLabel = multiple ? (0, _map2.default)((0, _get2.default)('name'), (0, _filter2.default)({
91
+ }, options)), [multiple, options]);
92
+ const selectedLabel = (0, _react.useMemo)(() => multiple ? (0, _map2.default)((0, _get2.default)('name'), (0, _filter2.default)({
82
93
  selected: true
83
94
  }, options)) : (0, _get2.default)('name', (0, _find2.default)({
84
95
  selected: true
85
- }, options));
96
+ }, options)), [multiple, options]);
97
+ const isSelectedInValidOption = (0, _react.useMemo)(() => theme === 'player' && (0, _getOr2.default)(false, 'name', (0, _find2.default)({
98
+ validOption: false,
99
+ selected: true
100
+ }, options)), [options, theme]);
86
101
  const handleChange = (0, _react.useMemo)(() => multiple ? e => {
87
102
  onChange((0, _map2.default)((0, _get2.default)('value'), e.target.selectedOptions));
88
103
  } : e => {
89
104
  onChange(e.target.value);
90
105
  }, [onChange, multiple]);
91
- const black = (0, _get2.default)('common.black', skin);
92
- const color = (0, _get2.default)('common.primary', skin);
93
- const skinColor = {
94
- color: selected && (theme === 'question' || theme === 'template') ? color : null
95
- };
106
+ const black = (0, _react.useMemo)(() => (0, _getOr2.default)('#14171A', 'common.black', skin), [skin]);
107
+ const color = (0, _react.useMemo)(() => (0, _getOr2.default)('#00B0FF', 'common.primary', skin), [skin]);
108
+ const shouldUseSkinFontColor = (0, _react.useMemo)(() => !isSelectedInValidOption && selected && (0, _includes2.default)(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
96
109
  const arrowView = !multiple ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, {
97
110
  color: selected && (theme === 'question' || theme === 'template') ? color : black,
98
111
  className: _style.default.arrow
99
112
  }) : null;
100
- const behaviourClassName = (0, _getClassState.default)(_style.default.default, _style.default.modified, _style.default.error, modified, error);
101
- const composedClassName = (0, _classnames.default)(theme ? themeStyle[theme] : behaviourClassName, selected ? _style.default.selected : _style.default.unselected, className);
113
+ const behaviourClassName = (0, _react.useMemo)(() => (0, _getClassState.default)(_style.default.default, _style.default.modified, _style.default.error, modified, error), [error, modified]);
114
+ const composedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(theme ? themeStyle[theme] : behaviourClassName, selected ? _style.default.selected : _style.default.unselected, className), [behaviourClassName, className, selected, theme]);
115
+ const labelSize = (0, _react.useMemo)(() => (0, _size2.default)(selectedLabel), [selectedLabel]);
116
+ const isLongLabel = (0, _react.useMemo)(() => labelSize >= 65, [labelSize]);
102
117
  return /*#__PURE__*/_react.default.createElement("div", {
103
118
  className: composedClassName
104
119
  }, /*#__PURE__*/_react.default.createElement("label", {
105
- style: skinColor
120
+ "data-name": "select-wrapper",
121
+ style: _extends({}, shouldUseSkinFontColor && {
122
+ color
123
+ }),
124
+ className: _style.default.selectWrapper
106
125
  }, titleView, /*#__PURE__*/_react.default.createElement("span", {
107
- className: (0, _classnames.default)(_style.default.label, borderClassName)
126
+ "data-name": "select-span",
127
+ className: (0, _classnames.default)(_style.default.selectSpan, (0, _includes2.default)(theme, ['player', 'invalid', 'question', 'thematiques', 'template']) ? _style.default.noLabelCommon : null, borderClassName, isLongLabel ? _style.default.longLabel : null)
108
128
  }, selectedLabel), arrowView, /*#__PURE__*/_react.default.createElement("select", {
129
+ "data-name": "native-select",
130
+ className: _style.default.selectBox,
109
131
  title: selectedLabel,
110
132
  name: name,
111
133
  onChange: handleChange,
@@ -120,7 +142,8 @@ const Select = (props, context) => {
120
142
  const SelectOptionPropTypes = {
121
143
  name: _propTypes.default.string.isRequired,
122
144
  value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
123
- selected: _propTypes.default.bool
145
+ selected: _propTypes.default.bool,
146
+ validOption: _propTypes.default.bool
124
147
  };
125
148
  exports.SelectOptionPropTypes = SelectOptionPropTypes;
126
149
  Select.contextTypes = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/atom/select/index.js"],"names":["themeStyle","filter","style","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","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,UAAU,GAAG;AACjBC,EAAAA,MAAM,EAAEC,eAAMD,MADG;AAEjBE,EAAAA,OAAO,EAAED,eAAMC,OAFE;AAGjBC,EAAAA,MAAM,EAAEF,eAAME,MAHG;AAIjBC,EAAAA,IAAI,EAAEH,eAAMG,IAJK;AAKjBC,EAAAA,QAAQ,EAAEJ,eAAMI,QALC;AAMjBC,EAAAA,IAAI,EAAEL,eAAMK,IANK;AAOjBC,EAAAA,WAAW,EAAEN,eAAMM,WAPF;AAQjBC,EAAAA,QAAQ,EAAEP,eAAMO;AARC,CAAnB;;AAWA,MAAMC,MAAM,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACjC,QAAM;AACJC,IAAAA,IADI;AAEJC,IAAAA,OAAO,GAAG,EAFN;AAGJC,IAAAA,SAHI;AAIJC,IAAAA,eAJI;AAKJC,IAAAA,QALI;AAMJC,IAAAA,QAAQ,GAAG,KANP;AAOJC,IAAAA,QAPI;AAQJC,IAAAA,QARI;AASJC,IAAAA,WATI;AAUJC,IAAAA,KAVI;AAWJC,IAAAA,QAAQ,GAAG,KAXP;AAYJC,IAAAA,KAAK,GAAG,KAZJ;AAaJC,IAAAA,KAAK,EAAEC;AAbH,MAcFf,KAdJ;AAgBA,QAAM;AAAC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AAA,QAAQ,EAAE4B,mBAAUK,IAZH;AAajBhC,EAAAA,KAAK,EAAE2B,mBAAUK;AAbA,CAAnB;eAgBe9C,M","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":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","Select","props","context","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","optionList","map","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","arrowView","arrow","behaviourClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;AACjBC,EAAA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C,mBAAUC,MAAV,CAAiBC,UADY;AAEnC9B,EAAAA,KAAK,EAAE4B,mBAAUG,SAAV,CAAoB,CAACH,mBAAUC,MAAX,EAAmBD,mBAAUI,MAA7B,CAApB,CAF4B;AAGnC7B,EAAAA,QAAQ,EAAEyB,mBAAUK,IAHe;AAInC3B,EAAAA,WAAW,EAAEsB,mBAAUK;AAJY,CAA9B;;AAOPvD,MAAM,CAACwD,YAAP,GAAsB;AACpBvC,EAAAA,IAAI,EAAEwC,kBAASC,iBAAT,CAA2BzC;AADb,CAAtB;AAIAjB,MAAM,CAAC2D,SAAP,2CAAmB;AACjB5C,EAAAA,KAAK,EAAEmC,mBAAUC,MADA;AAEjBhD,EAAAA,IAAI,EAAE+C,mBAAUC,MAFC;AAGjB9C,EAAAA,SAAS,EAAE6C,mBAAUC,MAHJ;AAIjB7C,EAAAA,eAAe,EAAE4C,mBAAUC,MAJV;AAKjB1C,EAAAA,QAAQ,EAAEyC,mBAAUK,IALH;AAMjB/C,EAAAA,QAAQ,EAAE0C,mBAAUK,IANH;AAOjB5C,EAAAA,WAAW,EAAEuC,mBAAUC,MAPN;AAQjBzC,EAAAA,QAAQ,EAAEwC,mBAAUK,IARH;AASjBhD,EAAAA,QAAQ,EAAE2C,mBAAUU,IATH;AAUjBhD,EAAAA,KAAK,EAAEsC,mBAAUW,KAAV,CAAgB,oBAAKxE,UAAL,CAAhB,CAVU;AAWjBe,EAAAA,OAAO,EAAE8C,mBAAUY,OAAV,CAAkBZ,mBAAUa,KAAV,CAAgBd,qBAAhB,CAAlB,CAXQ;AAYjBpC,EAAAA,QAAQ,EAAEqC,mBAAUK,IAZH;AAajBzC,EAAAA,KAAK,EAAEoC,mBAAUK;AAbA,CAAnB;eAgBevD,M","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {find, keys, map, get, getOr, filter, includes, size} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template // we keep template in case it is used anywhere else?\n};\n\nconst Select = (props, context) => {\n const {\n name,\n options = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle\n } = props;\n\n const {skin} = context;\n\n const title = useMemo(() => (propTitle ? `${propTitle}${required ? '*' : ''}` : null), [\n propTitle,\n required\n ]);\n\n const optionList =\n options &&\n options.map((option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, options)),\n [multiple, options]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, options)),\n [multiple, options]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const shouldUseSkinFontColor = useMemo(\n () =>\n !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']),\n [isSelectedInValidOption, selected, theme]\n );\n\n const arrowView = !multiple ? (\n <ArrowDown\n color={selected && (theme === 'question' || theme === 'template') ? color : black}\n className={style.arrow}\n />\n ) : null;\n const behaviourClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme ? themeStyle[theme] : behaviourClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviourClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div className={composedClassName}>\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool\n};\n\nexport default Select;\n"],"file":"index.js"}
@@ -10,6 +10,8 @@
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;
13
15
 
14
16
  .default {
15
17
  display: flex;
@@ -23,7 +25,11 @@
23
25
  composes: default;
24
26
  }
25
27
 
26
- .default label {
28
+ .selectWrapper {
29
+ position: relative;
30
+ }
31
+
32
+ .default .selectWrapper {
27
33
  display: flex;
28
34
  align-items: center;
29
35
  height: 50px;
@@ -41,20 +47,16 @@
41
47
  width: 180px;
42
48
  }
43
49
 
44
- .label {
50
+ .selectSpan {
45
51
  display: none;
46
- position: absolute;
52
+ position: relative;
53
+ z-index: 10;
47
54
  white-space: nowrap;
48
- overflow: hidden;
49
- left: 0;
50
- right: 0;
51
- bottom: 0;
52
55
  pointer-events: none;
53
- text-overflow: ellipsis;
54
56
  height: 18px;
55
57
  }
56
58
 
57
- .default select {
59
+ .default .selectBox {
58
60
  font-family: "Gilroy";
59
61
  text-transform: none;
60
62
  padding: 0 15px;
@@ -68,6 +70,21 @@
68
70
  outline: none;
69
71
  appearance: none;
70
72
  cursor: pointer;
73
+ position: absolute;
74
+ left: 0;
75
+ right: 0;
76
+ bottom: 0;
77
+ }
78
+
79
+ .selectOption,
80
+ .no-label .selectWrapper{
81
+ min-width: min-content;
82
+ height: min-content;
83
+ }
84
+
85
+ .player .selectWrapper {
86
+ min-width: min-content;
87
+ height: min-content;
71
88
  }
72
89
 
73
90
  .modified select {
@@ -112,6 +129,7 @@
112
129
  pointer-events: none;
113
130
  width: 12px;
114
131
  height: 12px;
132
+ z-index: 11;
115
133
  }
116
134
 
117
135
  @media mobile {
@@ -121,7 +139,7 @@
121
139
  }
122
140
  }
123
141
 
124
- .default select[multiple] {
142
+ .default .selectBox[multiple] {
125
143
  padding: 0;
126
144
  height: 80px;
127
145
  }
@@ -130,7 +148,7 @@
130
148
  Filter
131
149
  */
132
150
 
133
- .filter label {
151
+ .filter .selectWrapper {
134
152
  display: flex;
135
153
  align-items: center;
136
154
  position: relative;
@@ -140,7 +158,7 @@
140
158
  margin: 0;
141
159
  }
142
160
 
143
- .filter .label {
161
+ .filter .selectSpan {
144
162
  display: block;
145
163
  padding: 15px 30px 15px 15px;
146
164
  font-size: 12px;
@@ -157,7 +175,9 @@
157
175
  margin-bottom: 10px;
158
176
  }
159
177
 
160
- .filter select {
178
+ .filter .selectBox {
179
+ position: absolute;
180
+ top: 27px;
161
181
  display: block;
162
182
  width: 100%;
163
183
  height: 50px;
@@ -186,57 +206,112 @@
186
206
  position: relative;
187
207
  }
188
208
 
189
- .no-label label {
209
+ .no-label .selectWrapper {
190
210
  display: flex;
191
211
  align-items: center;
192
- height: 44px;
212
+ min-height: 54px;
193
213
  position: relative;
194
214
  flex-grow: 0;
195
215
  }
196
216
 
197
- .no-label .label {
217
+ .noLabelCommon {
198
218
  display: block;
199
219
  padding: 0 30px 0 10px;
200
220
  font-size: 14px;
221
+ height: 54px;
222
+ line-height: 52px;
223
+ box-sizing: border-box;
224
+ }
225
+
226
+ div.default label.selectWrapper span.longLabel {
227
+ min-width: 230px;
228
+ max-width: 280px;
229
+ white-space: pre-wrap;
230
+ line-height: 22px;
231
+ padding-top: 15px;
232
+ padding-bottom: 15px;
233
+ height: auto;
234
+ border: none;
235
+ }
236
+
237
+ div:not(.player) .noLabelCommon.selectSpan {
201
238
  border: 1px solid light;
202
239
  background: white;
203
240
  border-radius: 2px;
204
- height: 44px;
205
- line-height: 42px;
206
- box-sizing: border-box;
241
+ min-width: min-content;
242
+ width: 100%;
243
+ }
244
+
245
+ div.player .noLabelCommon.selectSpan {
246
+ box-shadow: 0px 4px 16px box_shadow_light_dark;
247
+ border-radius: 8px;
248
+ min-width: min-content;
249
+ width: 100%;
207
250
  white-space: nowrap;
208
- text-overflow: ellipsis;
209
251
  }
210
252
 
211
- .no-label select {
253
+ .no-label .selectBox {
212
254
  font-family: "Gilroy";
213
255
  text-transform: none;
214
256
  padding: 0 15px;
215
- height: 44px;
257
+ height: 54px;
216
258
  border-radius: 2px;
217
- font-size: 16px;
259
+ font-size: 14px;
218
260
  color: black;
219
261
  font-weight: normal;
220
262
  margin-left: 0;
221
263
  width: 230px;
264
+ max-width: 280px;
222
265
  cursor: pointer;
223
266
  background: white;
224
267
  border: 2px solid xtraLightGrey;
225
268
  }
226
269
 
227
270
  @media mobile {
228
- .no-label select {
229
- height: 100%;
230
- width: 100%;
271
+ div.player .selectBox {
272
+ min-width: 0;
273
+ }
274
+
275
+ .no-label .selectBox {
231
276
  margin-left: 0;
232
277
  border-radius: 0;
278
+ position: absolute;
279
+ left: 0;
280
+ right: 0;
281
+ bottom: 0;
233
282
  }
234
283
 
235
- .no-label label {
284
+ .no-label .selectWrapper {
236
285
  display: block;
237
286
  margin-right: 0;
238
287
  width: 100%;
239
- height: 44px;
288
+ min-height: 44px;
289
+ height: min-content;
290
+ min-width: 250px;
291
+ max-width: 280px;
292
+ }
293
+
294
+ .player .noLabelCommon {
295
+ height: min-content;
296
+ }
297
+
298
+ div.player .noLabelCommon.selectSpan {
299
+ min-width: 250px;
300
+ max-width: 280px;
301
+ white-space: pre-wrap;
302
+ }
303
+
304
+ .noLabelCommon.longLabel {
305
+ line-height: 22px;
306
+ height: 100%;
307
+ }
308
+
309
+ .player.default .selectBox {
310
+ position: absolute;
311
+ top: 0px;
312
+ left: 0px;
313
+ width: 100%;
314
+ height: 100%;
240
315
  }
241
316
  }
242
317
 
@@ -248,12 +323,16 @@
248
323
  composes: no-label;
249
324
  }
250
325
 
251
- .invalid label {
326
+ .invalid .player {
327
+ color: cm_blue_900;
328
+ }
329
+
330
+ .invalid .selectWrapper {
252
331
  height: 54px;
253
332
  color: black;
254
333
  }
255
334
 
256
- .invalid .label {
335
+ .invalid .selectSpan {
257
336
  font-size: 15px;
258
337
  font-weight: 700;
259
338
  border: 2px solid;
@@ -271,10 +350,11 @@
271
350
  width: 150px;
272
351
  }
273
352
 
274
- .mooc label {
353
+ .mooc .selectWrapper {
275
354
  margin: 0;
276
355
  height: 35px;
277
356
  border: 0;
357
+ width: inherit;
278
358
  }
279
359
 
280
360
  .mooc select {
@@ -307,11 +387,11 @@
307
387
  composes: no-label;
308
388
  }
309
389
 
310
- .question label {
390
+ .question .selectWrapper {
311
391
  height: 54px;
312
392
  }
313
393
 
314
- .question .label {
394
+ .question .selectSpan {
315
395
  font-size: 15px;
316
396
  font-weight: 700;
317
397
  border: 2px solid;
@@ -328,7 +408,7 @@
328
408
  margin-bottom: 10px;
329
409
  }
330
410
 
331
- .sort label {
411
+ .sort .selectWrapper {
332
412
  display: flex;
333
413
  align-items: center;
334
414
  position: relative;
@@ -338,7 +418,7 @@
338
418
  margin: 0;
339
419
  }
340
420
 
341
- .sort .label {
421
+ .sort .selectSpan {
342
422
  display: block;
343
423
  padding: 15px 30px 15px 15px;
344
424
  font-size: 12px;
@@ -379,16 +459,48 @@
379
459
  composes: no-label;
380
460
  }
381
461
 
462
+ /*
463
+ Player
464
+ */
465
+
466
+ .player {
467
+ composes: no-label;
468
+ }
469
+
382
470
  /*
383
471
  Header
384
472
  */
385
473
 
386
474
  .header {
387
475
  composes: mooc;
388
- width: auto;
389
476
  }
390
477
 
391
- .header select {
478
+ .header .selectBox {
479
+ margin-left: 0;
480
+ }
481
+
482
+ .default .selectWrapper select.selectBox {
483
+ max-width: 280px;
484
+ width: inherit;
485
+ border-radius: 8px;
486
+ padding: 0;
487
+ height: 100%;
488
+ top: 0;
489
+ }
490
+
491
+ .header .title,
492
+ .header .selectWrapper span.selectSpan {
493
+ min-width: 150px;
494
+ color: transparent;
495
+ }
496
+
497
+ .header .selectWrapper select.selectBox {
498
+ padding-left: 10px;
499
+ border-radius: 2px;
500
+ padding-right: 30px;
501
+ }
502
+
503
+ .header .selectBox {
392
504
  background-color: light;
393
505
  border: 0;
394
506
  font-weight: 700;
@@ -420,7 +532,7 @@
420
532
  composes: no-label;
421
533
  }
422
534
 
423
- .template select {
535
+ .template .selectBox {
424
536
  width: auto;
425
537
  height: 54px;
426
538
  padding: 0 50px 0 0;
@@ -428,22 +540,22 @@
428
540
  max-width: 100%;
429
541
  }
430
542
 
431
- .template .label {
543
+ .template .selectSpan {
432
544
  font-size: 15px;
433
545
  font-weight: 700;
434
546
  height: 54px;
435
547
  line-height: 52px;
436
548
  }
437
549
 
438
- .selected.template .label {
550
+ .selected.template .selectSpan {
439
551
  border: 1px solid;
440
552
  }
441
553
 
442
- .unselected.template .label {
554
+ .unselected.template .selectSpan {
443
555
  border: 1px solid color(black lightness(85%));
444
556
  }
445
557
 
446
- .template label {
558
+ .template .selectWrapper {
447
559
  display: block;
448
560
  width: auto;
449
561
  margin-right: 0;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _defaultsDeep2 = _interopRequireDefault(require("lodash/fp/defaultsDeep"));
7
+
8
+ var _default2 = _interopRequireDefault(require("./default"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const {
13
+ props
14
+ } = _default2.default;
15
+ var _default = {
16
+ props: (0, _defaultsDeep2.default)(props, {
17
+ theme: 'player'
18
+ })
19
+ };
20
+ exports.default = _default;
21
+ //# sourceMappingURL=player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/atom/select/test/fixtures/player.js"],"names":["props","Default","theme"],"mappings":";;;;;;;AACA;;;;AAEA,MAAM;AAACA,EAAAA;AAAD,IAAUC,iBAAhB;eAEe;AACbD,EAAAA,KAAK,EAAE,4BAAaA,KAAb,EAAoB;AACzBE,IAAAA,KAAK,EAAE;AADkB,GAApB;AADM,C","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"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _browserEnv = _interopRequireDefault(require("browser-env"));
4
+
5
+ var _ava = _interopRequireDefault(require("ava"));
6
+
7
+ var _react = _interopRequireDefault(require("react"));
8
+
9
+ var _enzyme = require("enzyme");
10
+
11
+ var _cloneDeep = _interopRequireDefault(require("lodash/fp/cloneDeep"));
12
+
13
+ var _noop = _interopRequireDefault(require("lodash/fp/noop"));
14
+
15
+ var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
16
+
17
+ var _ = _interopRequireDefault(require(".."));
18
+
19
+ var _player = _interopRequireDefault(require("./fixtures/player"));
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
23
+ 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); }
24
+
25
+ (0, _browserEnv.default)();
26
+ (0, _enzyme.configure)({
27
+ adapter: new _enzymeAdapterReact.default()
28
+ });
29
+ (0, _ava.default)('classnames: should pass the styles pertinent to a player theme, text color: use skin color (selected, valid option, player)', t => {
30
+ const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _extends({}, _player.default.props, {
31
+ onChange: _noop.default
32
+ })));
33
+ const selectWrapper = wrapper.find('[data-name="select-wrapper"]');
34
+ t.true(selectWrapper.at(0).exists()); // should use skin color
35
+
36
+ t.deepEqual(selectWrapper.at(0).props().style, {
37
+ color: '#00B0FF'
38
+ });
39
+ const selectSpan = selectWrapper.at(0).find('[data-name="select-span"]');
40
+ t.true(selectSpan.at(0).exists());
41
+ t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon');
42
+ });
43
+ (0, _ava.default)('text color: should not use skin color (selected, invalid option, player), long label', t => {
44
+ const withInvalid = (0, _cloneDeep.default)(_player.default.props);
45
+ withInvalid.options[1] = {
46
+ name: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',
47
+ value: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',
48
+ selected: true,
49
+ validOption: false
50
+ };
51
+ const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _extends({}, withInvalid, {
52
+ onChange: _noop.default
53
+ })));
54
+ const selectWrapper = wrapper.find('[data-name="select-wrapper"]');
55
+ t.true(selectWrapper.at(0).exists()); // should not use skin color
56
+
57
+ t.deepEqual(selectWrapper.at(0).props().style, {});
58
+ const selectSpan = selectWrapper.at(0).find('[data-name="select-span"]');
59
+ t.true(selectSpan.at(0).exists());
60
+ t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon select__longLabel');
61
+ });
62
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/atom/select/test/select.js"],"names":["adapter","Adapter","t","wrapper","playerFixture","props","noop","selectWrapper","find","true","at","exists","deepEqual","style","color","selectSpan","is","className","withInvalid","options","name","value","selected","validOption"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA,uBAAU;AAACA,EAAAA,OAAO,EAAE,IAAIC,2BAAJ;AAAV,CAAV;AAEA,kBAAK,6HAAL,EAAoIC,CAAC,IAAI;AACvI,QAAMC,OAAO,GAAG,iCAAM,6BAAC,SAAD,eAAYC,gBAAcC,KAA1B;AAAiC,IAAA,QAAQ,EAAEC;AAA3C,KAAN,CAAhB;AACA,QAAMC,aAAa,GAAGJ,OAAO,CAACK,IAAR,CAAa,8BAAb,CAAtB;AACAN,EAAAA,CAAC,CAACO,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP,EAHuI,CAIvI;;AACAT,EAAAA,CAAC,CAACU,SAAF,CAAYL,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBL,KAApB,GAA4BQ,KAAxC,EAA+C;AAC7CC,IAAAA,KAAK,EAAE;AADsC,GAA/C;AAGA,QAAMC,UAAU,GAAGR,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBF,IAApB,CAAyB,2BA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sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {mount, configure} from 'enzyme';\nimport cloneDeep from 'lodash/fp/cloneDeep';\nimport noop from 'lodash/fp/noop';\nimport Adapter from 'enzyme-adapter-react-16';\nimport Select from '..';\nimport playerFixture from './fixtures/player';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\n\ntest('classnames: should pass the styles pertinent to a player theme, text color: use skin color (selected, valid option, player)', t => {\n const wrapper = mount(<Select {...playerFixture.props} onChange={noop} />);\n const selectWrapper = wrapper.find('[data-name=\"select-wrapper\"]');\n t.true(selectWrapper.at(0).exists());\n // should use skin color\n t.deepEqual(selectWrapper.at(0).props().style, {\n color: '#00B0FF'\n });\n const selectSpan = selectWrapper.at(0).find('[data-name=\"select-span\"]');\n t.true(selectSpan.at(0).exists());\n t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon');\n});\n\ntest('text color: should not use skin color (selected, invalid option, player), long label', t => {\n const withInvalid = cloneDeep(playerFixture.props);\n withInvalid.options[1] = {\n name: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',\n value: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',\n selected: true,\n validOption: false\n };\n const wrapper = mount(<Select {...withInvalid} onChange={noop} />);\n const selectWrapper = wrapper.find('[data-name=\"select-wrapper\"]');\n t.true(selectWrapper.at(0).exists());\n // should not use skin color\n t.deepEqual(selectWrapper.at(0).props().style, {});\n const selectSpan = selectWrapper.at(0).find('[data-name=\"select-span\"]');\n t.true(selectSpan.at(0).exists());\n t.is(\n selectSpan.at(0).props().className,\n 'select__selectSpan select__noLabelCommon select__longLabel'\n );\n});\n"],"file":"select.js"}