@coorpacademy/components 11.4.5-alpha.41 → 11.4.5-alpha.42

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.
@@ -51,8 +51,7 @@ declare namespace Select {
51
51
  modified: PropTypes.Requireable<boolean>;
52
52
  error: PropTypes.Requireable<boolean>;
53
53
  'aria-label': PropTypes.Requireable<string>;
54
- selectId: PropTypes.Requireable<string>;
55
- titleClassName: PropTypes.Requireable<string>;
54
+ 'aria-labelledby': PropTypes.Requireable<string>;
56
55
  };
57
56
  }
58
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AA6BA,qEAsKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AAwDA,qEA8KC"}
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
2
 
3
- import React, { useMemo } from 'react';
3
+ import React, { useCallback, useMemo, useState } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classnames from 'classnames';
6
6
  import filter from 'lodash/fp/filter';
@@ -11,7 +11,7 @@ import includes from 'lodash/fp/includes';
11
11
  import keys from 'lodash/fp/keys';
12
12
  import map from 'lodash/fp/map';
13
13
  import size from 'lodash/fp/size';
14
- import { NovaCompositionNavigationArrowDown as ArrowDown } from '@coorpacademy/nova-icons';
14
+ import { NovaCompositionNavigationArrowDown as ArrowDown, NovaCompositionNavigationArrowTop as ArrowUp } from '@coorpacademy/nova-icons';
15
15
  import Provider, { GetSkinFromContext } from '../provider';
16
16
  import getClassState from '../../util/get-class-state';
17
17
  import style from './style.css';
@@ -28,6 +28,30 @@ const themeStyle = {
28
28
  coorpmanager: null
29
29
  };
30
30
 
31
+ const ArrowView = ({
32
+ shouldRender,
33
+ isArrowUp,
34
+ ariaLabel,
35
+ arrowClass,
36
+ arrowColor
37
+ }) => {
38
+ const props = useMemo(() => _extends({}, ariaLabel & {
39
+ 'aria-label': ariaLabel
40
+ }, arrowColor & {
41
+ color: arrowColor
42
+ }, {
43
+ className: arrowClass
44
+ }), [ariaLabel, arrowClass, arrowColor]);
45
+
46
+ if (shouldRender) {
47
+ return isArrowUp ? /*#__PURE__*/React.createElement(ArrowUp, _extends({}, props, {
48
+ "data-testid": "select-arrow-up-icon"
49
+ })) : /*#__PURE__*/React.createElement(ArrowDown, _extends({}, props, {
50
+ "data-testid": "select-arrow-down-icon"
51
+ }));
52
+ } else return null;
53
+ };
54
+
31
55
  const Select = (props, legacyContext) => {
32
56
  const {
33
57
  name,
@@ -44,11 +68,13 @@ const Select = (props, legacyContext) => {
44
68
  error = false,
45
69
  title: propTitle,
46
70
  'aria-label': ariaLabel,
47
- selectId,
48
- titleClassName
71
+ 'aria-labelledby': ariaLabelledBy
49
72
  } = props;
50
73
  const skin = GetSkinFromContext(legacyContext);
51
74
  const title = useMemo(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
75
+ const [isArrowUp, setIsArrowUp] = useState(false);
76
+ const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);
77
+ const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);
52
78
  const optionList = options && options.map((option, index) => {
53
79
  return /*#__PURE__*/React.createElement("option", {
54
80
  key: index,
@@ -56,18 +82,9 @@ const Select = (props, legacyContext) => {
56
82
  className: style.selectOption
57
83
  }, option.name);
58
84
  });
59
- let titleView = null;
60
-
61
- if (selectId) {
62
- titleView = /*#__PURE__*/React.createElement("div", {
63
- className: titleClassName
64
- }, title, " ");
65
- } else if (title) {
66
- titleView = /*#__PURE__*/React.createElement("span", {
67
- className: style.title
68
- }, title, " ");
69
- }
70
-
85
+ const titleView = title ? /*#__PURE__*/React.createElement("span", {
86
+ className: style.title
87
+ }, title, " ") : null;
71
88
  const selected = useMemo(() => multiple ? map(get('value'), filter({
72
89
  selected: true
73
90
  }, options)) : get('value', find({
@@ -83,53 +100,62 @@ const Select = (props, legacyContext) => {
83
100
  selected: true
84
101
  }, options)), [options, theme]);
85
102
  const handleChange = useMemo(() => multiple ? e => {
103
+ setIsArrowUp(false);
86
104
  onChange(map(get('value'), e.target.selectedOptions));
87
105
  } : e => {
106
+ setIsArrowUp(false);
88
107
  onChange(e.target.value);
89
108
  }, [onChange, multiple]);
90
109
  const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);
91
110
  const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);
92
- const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && includes(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
111
+ const isThemeOneOfQuestionTemplateOrPlayer = useMemo(() => includes(theme, ['question', 'template', 'player']), [theme]);
112
+ const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer, [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]);
93
113
  const arrowColor = selected ? color : undefined;
94
- const arrowView = !multiple ? /*#__PURE__*/React.createElement(ArrowDown, {
95
- color: includes(theme, ['question', 'template', 'player']) ? arrowColor : black,
96
- className: shouldUseSkinFontColor ? style.selectedArrow : style.arrow,
97
- "aria-label": ariaLabel,
98
- "data-testid": "select-arrow-down-icon"
99
- }) : null;
100
114
  const behaviorClassName = useMemo(() => getClassState(style.default, style.modified, style.error, modified, error), [error, modified]);
101
115
  const composedClassName = useMemo(() => classnames(theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName, selected ? style.selected : style.unselected, className), [behaviorClassName, className, selected, theme]);
102
116
  const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);
103
117
  const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);
104
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", selectId ? {
105
- htmlFor: selectId
106
- } : {}, titleView), /*#__PURE__*/React.createElement("div", {
118
+ return /*#__PURE__*/React.createElement("div", {
107
119
  className: classnames(composedClassName, theme === 'coorpmanager' ? style.coorpmanager : null)
108
- }, /*#__PURE__*/React.createElement("div", {
120
+ }, /*#__PURE__*/React.createElement("label", {
109
121
  "data-name": "select-wrapper",
110
122
  style: _extends({}, shouldUseSkinFontColor && {
111
123
  color
112
124
  }),
113
125
  className: style.selectWrapper
114
- }, /*#__PURE__*/React.createElement("span", {
126
+ }, titleView, /*#__PURE__*/React.createElement("span", {
115
127
  "data-name": "select-span",
116
128
  className: classnames(style.selectSpan, includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template']) ? style.noLabelCommon : null, borderClassName, isLongLabel ? style.longLabel : null),
117
129
  style: _extends({}, shouldUseSkinFontColor && {
118
130
  color
119
131
  })
120
- }, selectedLabel), arrowView, /*#__PURE__*/React.createElement("select", _extends({}, selectId ? {
121
- id: selectId
132
+ }, selectedLabel), /*#__PURE__*/React.createElement(ArrowView, {
133
+ shouldRender: !multiple,
134
+ isArrowUp: isArrowUp,
135
+ ariaLabel: ariaLabel,
136
+ arrowClass: shouldUseSkinFontColor ? style.selectedArrow : style.arrow,
137
+ arrowColor: isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black
138
+ }), /*#__PURE__*/React.createElement("select", _extends({}, ariaLabelledBy ? {
139
+ 'aria-labelledby': ariaLabelledBy
122
140
  } : {}, {
123
141
  "data-name": "native-select",
124
142
  className: style.selectBox,
143
+ title: selectedLabel,
125
144
  name: name,
126
145
  onChange: handleChange,
127
146
  value: selected,
128
147
  multiple: multiple,
129
- disabled: disabled
148
+ disabled: disabled,
149
+ onClick: handleSelectOnFocus,
150
+ onBlur: handleSelectOnBlur // onBlur does not handle completely an out of bounds click
151
+ // ex: select is Opened and a click is done outside, cancelling the select
152
+ // that doesn't count as a Blur, so an onMouseLeave is needed
153
+ ,
154
+ onMouseLeave: handleSelectOnBlur,
155
+ "data-testid": "native-select"
130
156
  }), optionList)), /*#__PURE__*/React.createElement("div", {
131
157
  className: style.description
132
- }, description)));
158
+ }, description));
133
159
  };
134
160
 
135
161
  export const SelectOptionPropTypes = {
@@ -156,8 +182,7 @@ Select.propTypes = process.env.NODE_ENV !== "production" ? {
156
182
  modified: PropTypes.bool,
157
183
  error: PropTypes.bool,
158
184
  'aria-label': PropTypes.string,
159
- selectId: PropTypes.string,
160
- titleClassName: PropTypes.string
185
+ 'aria-labelledby': PropTypes.string
161
186
  } : {};
162
187
  export default Select;
163
188
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useMemo","PropTypes","classnames","filter","find","get","getOr","includes","keys","map","size","NovaCompositionNavigationArrowDown","ArrowDown","Provider","GetSkinFromContext","getClassState","style","themeStyle","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","Select","props","legacyContext","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabel","selectId","titleClassName","skin","optionList","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","arrowColor","undefined","arrowView","selectedArrow","arrow","behaviorClassName","default","composedClassName","unselected","labelSize","isLongLabel","htmlFor","selectWrapper","selectSpan","noLabelCommon","longLabel","id","selectBox","SelectOptionPropTypes","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} 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,\n coorpmanager: null\n};\n\nconst Select = (props, legacyContext) => {\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 'aria-label': ariaLabel,\n selectId,\n titleClassName\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, 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 let titleView = null;\n if (selectId) {\n titleView = <div className={titleClassName}>{title} </div>;\n } else if (title) {\n titleView = <span className={style.title}>{title} </span>;\n }\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 aria-label={ariaLabel}\n data-testid=\"select-arrow-down-icon\"\n />\n ) : null;\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, 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>\n <label {...(selectId ? {htmlFor: selectId} : {})}>{titleView}</label>\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <div\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\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 style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n {...(selectId ? {id: selectId} : {})}\n data-name=\"native-select\"\n className={style.selectBox}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </div>\n <div className={style.description}>{description}</div>\n </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 'aria-label': PropTypes.string,\n selectId: PropTypes.string,\n titleClassName: PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,MAAP,MAAmB,kBAAnB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,aAA3C;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;EACjBd,MAAM,EAAEa,KAAK,CAACb,MADG;EAEjBe,OAAO,EAAEF,KAAK,CAACE,OAFE;EAGjBC,MAAM,EAAEH,KAAK,CAACG,MAHG;EAIjBC,IAAI,EAAEJ,KAAK,CAACI,IAJK;EAKjBC,QAAQ,EAAEL,KAAK,CAACK,QALC;EAMjBC,IA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C,SAAS,CAACuF,IARH;EASjBtD,QAAQ,EAAEjC,SAAS,CAAC2F,IATH;EAUjBrD,KAAK,EAAEtC,SAAS,CAAC4F,KAAV,CAAgBrF,IAAI,CAACS,UAAD,CAApB,CAVU;EAWjBc,OAAO,EAAE9B,SAAS,CAAC6F,OAAV,CAAkB7F,SAAS,CAAC8F,KAAV,CAAgBZ,qBAAhB,CAAlB,CAXQ;EAYjB3C,QAAQ,EAAEvC,SAAS,CAACuF,IAZH;EAajB/C,KAAK,EAAExC,SAAS,CAACuF,IAbA;EAcjB,cAAcvF,SAAS,CAACmF,MAdP;EAejBvC,QAAQ,EAAE5C,SAAS,CAACmF,MAfH;EAgBjBtC,cAAc,EAAE7C,SAAS,CAACmF;AAhBT,CAAnB;AAmBA,eAAezD,MAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","PropTypes","classnames","filter","find","get","getOr","includes","keys","map","size","NovaCompositionNavigationArrowDown","ArrowDown","NovaCompositionNavigationArrowTop","ArrowUp","Provider","GetSkinFromContext","getClassState","style","themeStyle","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","ArrowView","shouldRender","isArrowUp","ariaLabel","arrowClass","arrowColor","props","color","className","Select","legacyContext","name","options","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabelledBy","skin","setIsArrowUp","handleSelectOnFocus","handleSelectOnBlur","optionList","option","index","value","selectOption","titleView","selected","selectedLabel","isSelectedInValidOption","validOption","handleChange","e","target","selectedOptions","black","isThemeOneOfQuestionTemplateOrPlayer","shouldUseSkinFontColor","undefined","behaviorClassName","default","composedClassName","unselected","labelSize","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectedArrow","arrow","selectBox","SelectOptionPropTypes","string","isRequired","oneOfType","number","bool","contextTypes","childContextTypes","propTypes","func","oneOf","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaCompositionNavigationArrowTop as ArrowUp\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} 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,\n coorpmanager: null\n};\n\nconst ArrowView = ({shouldRender, isArrowUp, ariaLabel, arrowClass, arrowColor}) => {\n const props = useMemo(\n () => ({\n ...(ariaLabel &\n {\n 'aria-label': ariaLabel\n }),\n ...(arrowColor &\n {\n color: arrowColor\n }),\n className: arrowClass\n }),\n [ariaLabel, arrowClass, arrowColor]\n );\n if (shouldRender) {\n return isArrowUp ? (\n <ArrowUp {...props} data-testid=\"select-arrow-up-icon\" />\n ) : (\n <ArrowDown {...props} data-testid=\"select-arrow-down-icon\" />\n );\n } else return null;\n};\n\nconst Select = (props, legacyContext) => {\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 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const [isArrowUp, setIsArrowUp] = useState(false);\n\n const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);\n const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);\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 setIsArrowUp(false);\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n setIsArrowUp(false);\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 isThemeOneOfQuestionTemplateOrPlayer = useMemo(\n () => includes(theme, ['question', 'template', 'player']),\n [theme]\n );\n const shouldUseSkinFontColor = useMemo(\n () => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer,\n [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]\n );\n const arrowColor = selected ? color : undefined;\n\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, 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\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\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 style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n <ArrowView\n shouldRender={!multiple}\n isArrowUp={isArrowUp}\n ariaLabel={ariaLabel}\n arrowClass={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n arrowColor={isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black}\n />\n <select\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\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 onClick={handleSelectOnFocus}\n onBlur={handleSelectOnBlur}\n // onBlur does not handle completely an out of bounds click\n // ex: select is Opened and a click is done outside, cancelling the select\n // that doesn't count as a Blur, so an onMouseLeave is needed\n onMouseLeave={handleSelectOnBlur}\n data-testid=\"native-select\"\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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AAJY,CAA9B;AAOPxD,MAAM,CAACyD,YAAP,GAAsB;EACpBzC,IAAI,EAAEvC,QAAQ,CAACiF,iBAAT,CAA2B1C;AADb,CAAtB;AAIAhB,MAAM,CAAC2D,SAAP,2CAAmB;EACjB9C,KAAK,EAAElD,SAAS,CAACyF,MADA;EAEjBlD,IAAI,EAAEvC,SAAS,CAACyF,MAFC;EAGjBrD,SAAS,EAAEpC,SAAS,CAACyF,MAHJ;EAIjBhD,eAAe,EAAEzC,SAAS,CAACyF,MAJV;EAKjB7C,QAAQ,EAAE5C,SAAS,CAAC6F,IALH;EAMjBlD,QAAQ,EAAE3C,SAAS,CAAC6F,IANH;EAOjB/C,WAAW,EAAE9C,SAAS,CAACyF,MAPN;EAQjB5C,QAAQ,EAAE7C,SAAS,CAAC6F,IARH;EASjBnD,QAAQ,EAAE1C,SAAS,CAACiG,IATH;EAUjBlD,KAAK,EAAE/C,SAAS,CAACkG,KAAV,CAAgB3F,IAAI,CAACW,UAAD,CAApB,CAVU;EAWjBsB,OAAO,EAAExC,SAAS,CAACmG,OAAV,CAAkBnG,SAAS,CAACoG,KAAV,CAAgBZ,qBAAhB,CAAlB,CAXQ;EAYjBxC,QAAQ,EAAEhD,SAAS,CAAC6F,IAZH;EAajB5C,KAAK,EAAEjD,SAAS,CAAC6F,IAbA;EAcjB,cAAc7F,SAAS,CAACyF,MAdP;EAejB,mBAAmBzF,SAAS,CAACyF;AAfZ,CAAnB;AAkBA,eAAepD,MAAf"}
@@ -24,11 +24,11 @@
24
24
  composes: default;
25
25
  }
26
26
 
27
- div.coorpmanager div.selectWrapper {
27
+ div.coorpmanager label.selectWrapper {
28
28
  max-width: fit-content;
29
29
  }
30
30
 
31
- .coorpmanager div.selectWrapper select.selectBox {
31
+ .coorpmanager label.selectWrapper select.selectBox {
32
32
  padding-left: 10px;
33
33
  position: relative;
34
34
  border-radius: 2px;
@@ -38,13 +38,13 @@ div.coorpmanager div.selectWrapper {
38
38
  }
39
39
 
40
40
  @media tablet {
41
- .coorpmanager div.selectWrapper .description {
41
+ .coorpmanager label.selectWrapper .description {
42
42
  max-width: 120px;
43
43
  }
44
44
  }
45
45
 
46
46
  @media mobile {
47
- .coorpmanager div.selectWrapper select.selectBox {
47
+ .coorpmanager label.selectWrapper select.selectBox {
48
48
  width: 100%;
49
49
  min-width: 180px;
50
50
  }
@@ -272,7 +272,7 @@ div.coorpmanager div.selectWrapper {
272
272
  box-sizing: border-box;
273
273
  }
274
274
 
275
- div.default div.selectWrapper span.longLabel {
275
+ div.default label.selectWrapper span.longLabel {
276
276
  min-width: 230px;
277
277
  max-width: 280px;
278
278
  white-space: pre-wrap;
@@ -529,7 +529,7 @@ div.player:hover span.selectSpan {
529
529
 
530
530
  /* mozilla specific styling */
531
531
  @supports (-moz-appearance:none) {
532
- .player div.selectWrapper select.selectBox {
532
+ .player label.selectWrapper select.selectBox {
533
533
  width: 100%;
534
534
  }
535
535
  }
@@ -99,8 +99,7 @@ declare namespace BrandFormGroup {
99
99
  modified: PropTypes.Requireable<boolean>;
100
100
  error: PropTypes.Requireable<boolean>;
101
101
  'aria-label': PropTypes.Requireable<string>;
102
- selectId: PropTypes.Requireable<string>;
103
- titleClassName: PropTypes.Requireable<string>;
102
+ 'aria-labelledby': PropTypes.Requireable<string>;
104
103
  }> | PropTypes.InferProps<{
105
104
  type: PropTypes.Requireable<string>;
106
105
  title: PropTypes.Validator<string>;
@@ -205,8 +204,7 @@ declare namespace BrandFormGroup {
205
204
  modified: PropTypes.Requireable<boolean>;
206
205
  error: PropTypes.Requireable<boolean>;
207
206
  'aria-label': PropTypes.Requireable<string>;
208
- selectId: PropTypes.Requireable<string>;
209
- titleClassName: PropTypes.Requireable<string>;
207
+ 'aria-labelledby': PropTypes.Requireable<string>;
210
208
  }> | PropTypes.InferProps<{
211
209
  type: PropTypes.Requireable<string>;
212
210
  title: PropTypes.Validator<string>;
@@ -31,8 +31,7 @@ declare class Filters extends React.Component<any, any, any> {
31
31
  modified: PropTypes.Requireable<boolean>;
32
32
  error: PropTypes.Requireable<boolean>;
33
33
  'aria-label': PropTypes.Requireable<string>;
34
- selectId: PropTypes.Requireable<string>;
35
- titleClassName: PropTypes.Requireable<string>;
34
+ 'aria-labelledby': PropTypes.Requireable<string>;
36
35
  }>>;
37
36
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
38
37
  onToggleFilters: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/index.js"],"names":[],"mappings":";AASA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;MAEE;IAEF,wBASC;IAPC;;;MAGC;IAMH,yBAcC;IAED,uBAYC;IAED,qBAOC;IAED,sBAsFC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/index.js"],"names":[],"mappings":";AASA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;MAEE;IAEF,wBASC;IAPC;;;MAGC;IAMH,yBAcC;IAED,uBAYC;IAED,qBAOC;IAED,sBAsFC;CACF"}
@@ -57,8 +57,7 @@ declare namespace SetupSlide {
57
57
  modified: PropTypes.Requireable<boolean>;
58
58
  error: PropTypes.Requireable<boolean>;
59
59
  'aria-label': PropTypes.Requireable<string>;
60
- selectId: PropTypes.Requireable<string>;
61
- titleClassName: PropTypes.Requireable<string>;
60
+ 'aria-labelledby': PropTypes.Requireable<string>;
62
61
  }> | PropTypes.InferProps<{
63
62
  type: PropTypes.Requireable<string>;
64
63
  title: PropTypes.Validator<string>;
@@ -70,8 +70,7 @@ declare namespace SetupSlider {
70
70
  modified: PropTypes.Requireable<boolean>;
71
71
  error: PropTypes.Requireable<boolean>;
72
72
  'aria-label': PropTypes.Requireable<string>;
73
- selectId: PropTypes.Requireable<string>;
74
- titleClassName: PropTypes.Requireable<string>;
73
+ 'aria-labelledby': PropTypes.Requireable<string>;
75
74
  }> | PropTypes.InferProps<{
76
75
  type: PropTypes.Requireable<string>;
77
76
  title: PropTypes.Validator<string>;
@@ -129,8 +129,7 @@ declare namespace BrandForm {
129
129
  modified: PropTypes.Requireable<boolean>;
130
130
  error: PropTypes.Requireable<boolean>;
131
131
  'aria-label': PropTypes.Requireable<string>;
132
- selectId: PropTypes.Requireable<string>;
133
- titleClassName: PropTypes.Requireable<string>;
132
+ 'aria-labelledby': PropTypes.Requireable<string>;
134
133
  }> | PropTypes.InferProps<{
135
134
  type: PropTypes.Requireable<string>;
136
135
  title: PropTypes.Validator<string>;
@@ -235,8 +234,7 @@ declare namespace BrandForm {
235
234
  modified: PropTypes.Requireable<boolean>;
236
235
  error: PropTypes.Requireable<boolean>;
237
236
  'aria-label': PropTypes.Requireable<string>;
238
- selectId: PropTypes.Requireable<string>;
239
- titleClassName: PropTypes.Requireable<string>;
237
+ 'aria-labelledby': PropTypes.Requireable<string>;
240
238
  }> | PropTypes.InferProps<{
241
239
  type: PropTypes.Requireable<string>;
242
240
  title: PropTypes.Validator<string>;
@@ -146,8 +146,7 @@ declare namespace WizardContents {
146
146
  modified: PropTypes.Requireable<boolean>;
147
147
  error: PropTypes.Requireable<boolean>;
148
148
  'aria-label': PropTypes.Requireable<string>;
149
- selectId: PropTypes.Requireable<string>;
150
- titleClassName: PropTypes.Requireable<string>;
149
+ 'aria-labelledby': PropTypes.Requireable<string>;
151
150
  }> | PropTypes.InferProps<{
152
151
  type: PropTypes.Requireable<string>;
153
152
  title: PropTypes.Validator<string>;
@@ -252,8 +251,7 @@ declare namespace WizardContents {
252
251
  modified: PropTypes.Requireable<boolean>;
253
252
  error: PropTypes.Requireable<boolean>;
254
253
  'aria-label': PropTypes.Requireable<string>;
255
- selectId: PropTypes.Requireable<string>;
256
- titleClassName: PropTypes.Requireable<string>;
254
+ 'aria-labelledby': PropTypes.Requireable<string>;
257
255
  }> | PropTypes.InferProps<{
258
256
  type: PropTypes.Requireable<string>;
259
257
  title: PropTypes.Validator<string>;
@@ -231,8 +231,7 @@ declare namespace BrandUpdate {
231
231
  modified: PropTypes.Requireable<boolean>;
232
232
  error: PropTypes.Requireable<boolean>;
233
233
  'aria-label': PropTypes.Requireable<string>;
234
- selectId: PropTypes.Requireable<string>;
235
- titleClassName: PropTypes.Requireable<string>;
234
+ 'aria-labelledby': PropTypes.Requireable<string>;
236
235
  }> | PropTypes.InferProps<{
237
236
  type: PropTypes.Requireable<string>;
238
237
  title: PropTypes.Validator<string>;
@@ -337,8 +336,7 @@ declare namespace BrandUpdate {
337
336
  modified: PropTypes.Requireable<boolean>;
338
337
  error: PropTypes.Requireable<boolean>;
339
338
  'aria-label': PropTypes.Requireable<string>;
340
- selectId: PropTypes.Requireable<string>;
341
- titleClassName: PropTypes.Requireable<string>;
339
+ 'aria-labelledby': PropTypes.Requireable<string>;
342
340
  }> | PropTypes.InferProps<{
343
341
  type: PropTypes.Requireable<string>;
344
342
  title: PropTypes.Validator<string>;
@@ -858,8 +856,7 @@ declare namespace BrandUpdate {
858
856
  modified: PropTypes.Requireable<boolean>;
859
857
  error: PropTypes.Requireable<boolean>;
860
858
  'aria-label': PropTypes.Requireable<string>;
861
- selectId: PropTypes.Requireable<string>;
862
- titleClassName: PropTypes.Requireable<string>;
859
+ 'aria-labelledby': PropTypes.Requireable<string>;
863
860
  }> | PropTypes.InferProps<{
864
861
  type: PropTypes.Requireable<string>;
865
862
  title: PropTypes.Validator<string>;
@@ -964,8 +961,7 @@ declare namespace BrandUpdate {
964
961
  modified: PropTypes.Requireable<boolean>;
965
962
  error: PropTypes.Requireable<boolean>;
966
963
  'aria-label': PropTypes.Requireable<string>;
967
- selectId: PropTypes.Requireable<string>;
968
- titleClassName: PropTypes.Requireable<string>;
964
+ 'aria-labelledby': PropTypes.Requireable<string>;
969
965
  }> | PropTypes.InferProps<{
970
966
  type: PropTypes.Requireable<string>;
971
967
  title: PropTypes.Validator<string>;
@@ -58,8 +58,7 @@ declare namespace SearchPage {
58
58
  modified: PropTypes.Requireable<boolean>;
59
59
  error: PropTypes.Requireable<boolean>;
60
60
  'aria-label': PropTypes.Requireable<string>;
61
- selectId: PropTypes.Requireable<string>;
62
- titleClassName: PropTypes.Requireable<string>;
61
+ 'aria-labelledby': PropTypes.Requireable<string>;
63
62
  }>>;
64
63
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
65
64
  onToggleFilters: PropTypes.Requireable<(...args: any[]) => any>;
@@ -51,8 +51,7 @@ declare namespace Select {
51
51
  modified: PropTypes.Requireable<boolean>;
52
52
  error: PropTypes.Requireable<boolean>;
53
53
  'aria-label': PropTypes.Requireable<string>;
54
- selectId: PropTypes.Requireable<string>;
55
- titleClassName: PropTypes.Requireable<string>;
54
+ 'aria-labelledby': PropTypes.Requireable<string>;
56
55
  };
57
56
  }
58
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AA6BA,qEAsKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;AAwDA,qEA8KC"}
@@ -54,6 +54,30 @@ const themeStyle = {
54
54
  coorpmanager: null
55
55
  };
56
56
 
57
+ const ArrowView = ({
58
+ shouldRender,
59
+ isArrowUp,
60
+ ariaLabel,
61
+ arrowClass,
62
+ arrowColor
63
+ }) => {
64
+ const props = (0, _react.useMemo)(() => _extends({}, ariaLabel & {
65
+ 'aria-label': ariaLabel
66
+ }, arrowColor & {
67
+ color: arrowColor
68
+ }, {
69
+ className: arrowClass
70
+ }), [ariaLabel, arrowClass, arrowColor]);
71
+
72
+ if (shouldRender) {
73
+ return isArrowUp ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowTop, _extends({}, props, {
74
+ "data-testid": "select-arrow-up-icon"
75
+ })) : /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, _extends({}, props, {
76
+ "data-testid": "select-arrow-down-icon"
77
+ }));
78
+ } else return null;
79
+ };
80
+
57
81
  const Select = (props, legacyContext) => {
58
82
  const {
59
83
  name,
@@ -70,11 +94,13 @@ const Select = (props, legacyContext) => {
70
94
  error = false,
71
95
  title: propTitle,
72
96
  'aria-label': ariaLabel,
73
- selectId,
74
- titleClassName
97
+ 'aria-labelledby': ariaLabelledBy
75
98
  } = props;
76
99
  const skin = (0, _provider.GetSkinFromContext)(legacyContext);
77
100
  const title = (0, _react.useMemo)(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
101
+ const [isArrowUp, setIsArrowUp] = (0, _react.useState)(false);
102
+ const handleSelectOnFocus = (0, _react.useCallback)(() => setIsArrowUp(true), []);
103
+ const handleSelectOnBlur = (0, _react.useCallback)(() => setIsArrowUp(false), []);
78
104
  const optionList = options && options.map((option, index) => {
79
105
  return /*#__PURE__*/_react.default.createElement("option", {
80
106
  key: index,
@@ -82,18 +108,9 @@ const Select = (props, legacyContext) => {
82
108
  className: _style.default.selectOption
83
109
  }, option.name);
84
110
  });
85
- let titleView = null;
86
-
87
- if (selectId) {
88
- titleView = /*#__PURE__*/_react.default.createElement("div", {
89
- className: titleClassName
90
- }, title, " ");
91
- } else if (title) {
92
- titleView = /*#__PURE__*/_react.default.createElement("span", {
93
- className: _style.default.title
94
- }, title, " ");
95
- }
96
-
111
+ const titleView = title ? /*#__PURE__*/_react.default.createElement("span", {
112
+ className: _style.default.title
113
+ }, title, " ") : null;
97
114
  const selected = (0, _react.useMemo)(() => multiple ? (0, _map.default)((0, _get.default)('value'), (0, _filter.default)({
98
115
  selected: true
99
116
  }, options)) : (0, _get.default)('value', (0, _find.default)({
@@ -109,53 +126,62 @@ const Select = (props, legacyContext) => {
109
126
  selected: true
110
127
  }, options)), [options, theme]);
111
128
  const handleChange = (0, _react.useMemo)(() => multiple ? e => {
129
+ setIsArrowUp(false);
112
130
  onChange((0, _map.default)((0, _get.default)('value'), e.target.selectedOptions));
113
131
  } : e => {
132
+ setIsArrowUp(false);
114
133
  onChange(e.target.value);
115
134
  }, [onChange, multiple]);
116
135
  const black = (0, _react.useMemo)(() => (0, _getOr.default)('#14171A', 'common.black', skin), [skin]);
117
136
  const color = (0, _react.useMemo)(() => (0, _getOr.default)('#00B0FF', 'common.primary', skin), [skin]);
118
- const shouldUseSkinFontColor = (0, _react.useMemo)(() => !isSelectedInValidOption && selected && (0, _includes.default)(theme, ['question', 'template', 'player']), [isSelectedInValidOption, selected, theme]);
137
+ const isThemeOneOfQuestionTemplateOrPlayer = (0, _react.useMemo)(() => (0, _includes.default)(theme, ['question', 'template', 'player']), [theme]);
138
+ const shouldUseSkinFontColor = (0, _react.useMemo)(() => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer, [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]);
119
139
  const arrowColor = selected ? color : undefined;
120
- const arrowView = !multiple ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, {
121
- color: (0, _includes.default)(theme, ['question', 'template', 'player']) ? arrowColor : black,
122
- className: shouldUseSkinFontColor ? _style.default.selectedArrow : _style.default.arrow,
123
- "aria-label": ariaLabel,
124
- "data-testid": "select-arrow-down-icon"
125
- }) : null;
126
140
  const behaviorClassName = (0, _react.useMemo)(() => (0, _getClassState.default)(_style.default.default, _style.default.modified, _style.default.error, modified, error), [error, modified]);
127
141
  const composedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName, selected ? _style.default.selected : _style.default.unselected, className), [behaviorClassName, className, selected, theme]);
128
142
  const labelSize = (0, _react.useMemo)(() => (0, _size.default)(selectedLabel), [selectedLabel]);
129
143
  const isLongLabel = (0, _react.useMemo)(() => labelSize >= 65, [labelSize]);
130
- return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("label", selectId ? {
131
- htmlFor: selectId
132
- } : {}, titleView), /*#__PURE__*/_react.default.createElement("div", {
144
+ return /*#__PURE__*/_react.default.createElement("div", {
133
145
  className: (0, _classnames.default)(composedClassName, theme === 'coorpmanager' ? _style.default.coorpmanager : null)
134
- }, /*#__PURE__*/_react.default.createElement("div", {
146
+ }, /*#__PURE__*/_react.default.createElement("label", {
135
147
  "data-name": "select-wrapper",
136
148
  style: _extends({}, shouldUseSkinFontColor && {
137
149
  color
138
150
  }),
139
151
  className: _style.default.selectWrapper
140
- }, /*#__PURE__*/_react.default.createElement("span", {
152
+ }, titleView, /*#__PURE__*/_react.default.createElement("span", {
141
153
  "data-name": "select-span",
142
154
  className: (0, _classnames.default)(_style.default.selectSpan, (0, _includes.default)(theme, ['player', 'invalid', 'question', 'thematiques', 'template']) ? _style.default.noLabelCommon : null, borderClassName, isLongLabel ? _style.default.longLabel : null),
143
155
  style: _extends({}, shouldUseSkinFontColor && {
144
156
  color
145
157
  })
146
- }, selectedLabel), arrowView, /*#__PURE__*/_react.default.createElement("select", _extends({}, selectId ? {
147
- id: selectId
158
+ }, selectedLabel), /*#__PURE__*/_react.default.createElement(ArrowView, {
159
+ shouldRender: !multiple,
160
+ isArrowUp: isArrowUp,
161
+ ariaLabel: ariaLabel,
162
+ arrowClass: shouldUseSkinFontColor ? _style.default.selectedArrow : _style.default.arrow,
163
+ arrowColor: isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black
164
+ }), /*#__PURE__*/_react.default.createElement("select", _extends({}, ariaLabelledBy ? {
165
+ 'aria-labelledby': ariaLabelledBy
148
166
  } : {}, {
149
167
  "data-name": "native-select",
150
168
  className: _style.default.selectBox,
169
+ title: selectedLabel,
151
170
  name: name,
152
171
  onChange: handleChange,
153
172
  value: selected,
154
173
  multiple: multiple,
155
- disabled: disabled
174
+ disabled: disabled,
175
+ onClick: handleSelectOnFocus,
176
+ onBlur: handleSelectOnBlur // onBlur does not handle completely an out of bounds click
177
+ // ex: select is Opened and a click is done outside, cancelling the select
178
+ // that doesn't count as a Blur, so an onMouseLeave is needed
179
+ ,
180
+ onMouseLeave: handleSelectOnBlur,
181
+ "data-testid": "native-select"
156
182
  }), optionList)), /*#__PURE__*/_react.default.createElement("div", {
157
183
  className: _style.default.description
158
- }, description)));
184
+ }, description));
159
185
  };
160
186
 
161
187
  const SelectOptionPropTypes = {
@@ -183,8 +209,7 @@ Select.propTypes = process.env.NODE_ENV !== "production" ? {
183
209
  modified: _propTypes.default.bool,
184
210
  error: _propTypes.default.bool,
185
211
  'aria-label': _propTypes.default.string,
186
- selectId: _propTypes.default.string,
187
- titleClassName: _propTypes.default.string
212
+ 'aria-labelledby': _propTypes.default.string
188
213
  } : {};
189
214
  var _default = Select;
190
215
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","Select","props","legacyContext","name","options","className","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabel","selectId","titleClassName","skin","GetSkinFromContext","useMemo","optionList","map","option","index","value","selectOption","titleView","selected","get","find","selectedLabel","isSelectedInValidOption","getOr","validOption","handleChange","e","target","selectedOptions","black","color","shouldUseSkinFontColor","includes","arrowColor","undefined","arrowView","selectedArrow","arrow","behaviorClassName","getClassState","default","composedClassName","classnames","unselected","labelSize","size","isLongLabel","htmlFor","selectWrapper","selectSpan","noLabelCommon","longLabel","id","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","keys","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} 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,\n coorpmanager: null\n};\n\nconst Select = (props, legacyContext) => {\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 'aria-label': ariaLabel,\n selectId,\n titleClassName\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, 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 let titleView = null;\n if (selectId) {\n titleView = <div className={titleClassName}>{title} </div>;\n } else if (title) {\n titleView = <span className={style.title}>{title} </span>;\n }\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 aria-label={ariaLabel}\n data-testid=\"select-arrow-down-icon\"\n />\n ) : null;\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, 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>\n <label {...(selectId ? {htmlFor: selectId} : {})}>{titleView}</label>\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <div\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\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 style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n {arrowView}\n <select\n {...(selectId ? {id: selectId} : {})}\n data-name=\"native-select\"\n className={style.selectBox}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n >\n {optionList}\n </select>\n </div>\n <div className={style.description}>{description}</div>\n </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 'aria-label': PropTypes.string,\n selectId: PropTypes.string,\n titleClassName: PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EACjBC,MAAM,EAAEC,cAAA,CAAMD,MADG;EAEjBE,OAAO,EAAED,cAAA,CAAMC,OAFE;EAGjBC,MAAM,EAAEF,cAAA,CAAME,MAHG;EAIjBC,IAAI,EAAEH,cAAA,CAAMG,IAJK;EAKjBC,QAAQ,EAAEJ,cAAA,CAAMI,QALC;EAMjBC,IAAI,EAAEL,cAAA,CAAMK,IANK;EAOjBC,WAAW,EAAEN,cAAA,CAAMM,WAPF;EAQjBC,MAAM,EAAEP,cAAA,CAAMO,MARG;EASjBC,QAAQ,EAAER,cAAA,CAAMQ,QATC;EAUjBC,YAAY,EAAE;AAVG,CAAnB;;AAaA,MAAMC,MAAM,GAAG,CAACC,KAAD,EAAQC,aAAR,KAA0B;EACvC,MAAM;IACJC,IADI;IAEJC,OAAO,GAAG,EAFN;IAGJC,SAHI;IAIJC,eAJI;IAKJC,QALI;IAMJC,QAAQ,GAAG,KANP;IAOJC,QAPI;IAQJC,QARI;IASJC,WATI;IAUJC,KAVI;IAWJC,QAAQ,GAAG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AAUa,OAAV,CAAkBb,kBAAA,CAAUc,KAAV,CAAgBf,qBAAhB,CAAlB,CAXQ;EAYjBrD,QAAQ,EAAEsD,kBAAA,CAAUK,IAZH;EAajB1D,KAAK,EAAEqD,kBAAA,CAAUK,IAbA;EAcjB,cAAcL,kBAAA,CAAUC,MAdP;EAejBlD,QAAQ,EAAEiD,kBAAA,CAAUC,MAfH;EAgBjBjD,cAAc,EAAEgD,kBAAA,CAAUC;AAhBT,CAAnB;eAmBepE,M"}
1
+ {"version":3,"file":"index.js","names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","ArrowView","shouldRender","isArrowUp","ariaLabel","arrowClass","arrowColor","props","useMemo","color","className","Select","legacyContext","name","options","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabelledBy","skin","GetSkinFromContext","setIsArrowUp","useState","handleSelectOnFocus","useCallback","handleSelectOnBlur","optionList","map","option","index","value","selectOption","titleView","selected","get","find","selectedLabel","isSelectedInValidOption","getOr","validOption","handleChange","e","target","selectedOptions","black","isThemeOneOfQuestionTemplateOrPlayer","includes","shouldUseSkinFontColor","undefined","behaviorClassName","getClassState","default","composedClassName","classnames","unselected","labelSize","size","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectedArrow","arrow","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","keys","arrayOf","shape"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaCompositionNavigationArrowTop as ArrowUp\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} 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,\n coorpmanager: null\n};\n\nconst ArrowView = ({shouldRender, isArrowUp, ariaLabel, arrowClass, arrowColor}) => {\n const props = useMemo(\n () => ({\n ...(ariaLabel &\n {\n 'aria-label': ariaLabel\n }),\n ...(arrowColor &\n {\n color: arrowColor\n }),\n className: arrowClass\n }),\n [ariaLabel, arrowClass, arrowColor]\n );\n if (shouldRender) {\n return isArrowUp ? (\n <ArrowUp {...props} data-testid=\"select-arrow-up-icon\" />\n ) : (\n <ArrowDown {...props} data-testid=\"select-arrow-down-icon\" />\n );\n } else return null;\n};\n\nconst Select = (props, legacyContext) => {\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 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const [isArrowUp, setIsArrowUp] = useState(false);\n\n const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);\n const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);\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 setIsArrowUp(false);\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n setIsArrowUp(false);\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 isThemeOneOfQuestionTemplateOrPlayer = useMemo(\n () => includes(theme, ['question', 'template', 'player']),\n [theme]\n );\n const shouldUseSkinFontColor = useMemo(\n () => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer,\n [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]\n );\n const arrowColor = selected ? color : undefined;\n\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, 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\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\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 style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n <ArrowView\n shouldRender={!multiple}\n isArrowUp={isArrowUp}\n ariaLabel={ariaLabel}\n arrowClass={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n arrowColor={isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black}\n />\n <select\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\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 onClick={handleSelectOnFocus}\n onBlur={handleSelectOnBlur}\n // onBlur does not handle completely an out of bounds click\n // ex: select is Opened and a click is done outside, cancelling the select\n // that doesn't count as a Blur, so an onMouseLeave is needed\n onMouseLeave={handleSelectOnBlur}\n data-testid=\"native-select\"\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 'aria-label': PropTypes.string,\n 'aria-labelledby': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EACjBC,MAAM,EAAEC,cAAA,CAAMD,MADG;EAEjB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AUK,IARH;EASjB/D,QAAQ,EAAE0D,kBAAA,CAAUU,IATH;EAUjB/D,KAAK,EAAEqD,kBAAA,CAAUW,KAAV,CAAgB,IAAAC,aAAA,EAAKjG,UAAL,CAAhB,CAVU;EAWjByB,OAAO,EAAE4D,kBAAA,CAAUa,OAAV,CAAkBb,kBAAA,CAAUc,KAAV,CAAgBf,qBAAhB,CAAlB,CAXQ;EAYjBnD,QAAQ,EAAEoD,kBAAA,CAAUK,IAZH;EAajBxD,KAAK,EAAEmD,kBAAA,CAAUK,IAbA;EAcjB,cAAcL,kBAAA,CAAUC,MAdP;EAejB,mBAAmBD,kBAAA,CAAUC;AAfZ,CAAnB;eAkBehE,M"}
@@ -24,11 +24,11 @@
24
24
  composes: default;
25
25
  }
26
26
 
27
- div.coorpmanager div.selectWrapper {
27
+ div.coorpmanager label.selectWrapper {
28
28
  max-width: fit-content;
29
29
  }
30
30
 
31
- .coorpmanager div.selectWrapper select.selectBox {
31
+ .coorpmanager label.selectWrapper select.selectBox {
32
32
  padding-left: 10px;
33
33
  position: relative;
34
34
  border-radius: 2px;
@@ -38,13 +38,13 @@ div.coorpmanager div.selectWrapper {
38
38
  }
39
39
 
40
40
  @media tablet {
41
- .coorpmanager div.selectWrapper .description {
41
+ .coorpmanager label.selectWrapper .description {
42
42
  max-width: 120px;
43
43
  }
44
44
  }
45
45
 
46
46
  @media mobile {
47
- .coorpmanager div.selectWrapper select.selectBox {
47
+ .coorpmanager label.selectWrapper select.selectBox {
48
48
  width: 100%;
49
49
  min-width: 180px;
50
50
  }
@@ -272,7 +272,7 @@ div.coorpmanager div.selectWrapper {
272
272
  box-sizing: border-box;
273
273
  }
274
274
 
275
- div.default div.selectWrapper span.longLabel {
275
+ div.default label.selectWrapper span.longLabel {
276
276
  min-width: 230px;
277
277
  max-width: 280px;
278
278
  white-space: pre-wrap;
@@ -529,7 +529,7 @@ div.player:hover span.selectSpan {
529
529
 
530
530
  /* mozilla specific styling */
531
531
  @supports (-moz-appearance:none) {
532
- .player div.selectWrapper select.selectBox {
532
+ .player label.selectWrapper select.selectBox {
533
533
  width: 100%;
534
534
  }
535
535
  }
@@ -99,8 +99,7 @@ declare namespace BrandFormGroup {
99
99
  modified: PropTypes.Requireable<boolean>;
100
100
  error: PropTypes.Requireable<boolean>;
101
101
  'aria-label': PropTypes.Requireable<string>;
102
- selectId: PropTypes.Requireable<string>;
103
- titleClassName: PropTypes.Requireable<string>;
102
+ 'aria-labelledby': PropTypes.Requireable<string>;
104
103
  }> | PropTypes.InferProps<{
105
104
  type: PropTypes.Requireable<string>;
106
105
  title: PropTypes.Validator<string>;
@@ -205,8 +204,7 @@ declare namespace BrandFormGroup {
205
204
  modified: PropTypes.Requireable<boolean>;
206
205
  error: PropTypes.Requireable<boolean>;
207
206
  'aria-label': PropTypes.Requireable<string>;
208
- selectId: PropTypes.Requireable<string>;
209
- titleClassName: PropTypes.Requireable<string>;
207
+ 'aria-labelledby': PropTypes.Requireable<string>;
210
208
  }> | PropTypes.InferProps<{
211
209
  type: PropTypes.Requireable<string>;
212
210
  title: PropTypes.Validator<string>;
@@ -31,8 +31,7 @@ declare class Filters extends React.Component<any, any, any> {
31
31
  modified: PropTypes.Requireable<boolean>;
32
32
  error: PropTypes.Requireable<boolean>;
33
33
  'aria-label': PropTypes.Requireable<string>;
34
- selectId: PropTypes.Requireable<string>;
35
- titleClassName: PropTypes.Requireable<string>;
34
+ 'aria-labelledby': PropTypes.Requireable<string>;
36
35
  }>>;
37
36
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
38
37
  onToggleFilters: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/index.js"],"names":[],"mappings":";AASA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;MAEE;IAEF,wBASC;IAPC;;;MAGC;IAMH,yBAcC;IAED,uBAYC;IAED,qBAOC;IAED,sBAsFC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/index.js"],"names":[],"mappings":";AASA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAcE;IAEF;;;;;;;;;;;;;;;;;;;;;;MAEE;IAEF,wBASC;IAPC;;;MAGC;IAMH,yBAcC;IAED,uBAYC;IAED,qBAOC;IAED,sBAsFC;CACF"}
@@ -57,8 +57,7 @@ declare namespace SetupSlide {
57
57
  modified: PropTypes.Requireable<boolean>;
58
58
  error: PropTypes.Requireable<boolean>;
59
59
  'aria-label': PropTypes.Requireable<string>;
60
- selectId: PropTypes.Requireable<string>;
61
- titleClassName: PropTypes.Requireable<string>;
60
+ 'aria-labelledby': PropTypes.Requireable<string>;
62
61
  }> | PropTypes.InferProps<{
63
62
  type: PropTypes.Requireable<string>;
64
63
  title: PropTypes.Validator<string>;
@@ -70,8 +70,7 @@ declare namespace SetupSlider {
70
70
  modified: PropTypes.Requireable<boolean>;
71
71
  error: PropTypes.Requireable<boolean>;
72
72
  'aria-label': PropTypes.Requireable<string>;
73
- selectId: PropTypes.Requireable<string>;
74
- titleClassName: PropTypes.Requireable<string>;
73
+ 'aria-labelledby': PropTypes.Requireable<string>;
75
74
  }> | PropTypes.InferProps<{
76
75
  type: PropTypes.Requireable<string>;
77
76
  title: PropTypes.Validator<string>;
@@ -129,8 +129,7 @@ declare namespace BrandForm {
129
129
  modified: PropTypes.Requireable<boolean>;
130
130
  error: PropTypes.Requireable<boolean>;
131
131
  'aria-label': PropTypes.Requireable<string>;
132
- selectId: PropTypes.Requireable<string>;
133
- titleClassName: PropTypes.Requireable<string>;
132
+ 'aria-labelledby': PropTypes.Requireable<string>;
134
133
  }> | PropTypes.InferProps<{
135
134
  type: PropTypes.Requireable<string>;
136
135
  title: PropTypes.Validator<string>;
@@ -235,8 +234,7 @@ declare namespace BrandForm {
235
234
  modified: PropTypes.Requireable<boolean>;
236
235
  error: PropTypes.Requireable<boolean>;
237
236
  'aria-label': PropTypes.Requireable<string>;
238
- selectId: PropTypes.Requireable<string>;
239
- titleClassName: PropTypes.Requireable<string>;
237
+ 'aria-labelledby': PropTypes.Requireable<string>;
240
238
  }> | PropTypes.InferProps<{
241
239
  type: PropTypes.Requireable<string>;
242
240
  title: PropTypes.Validator<string>;
@@ -146,8 +146,7 @@ declare namespace WizardContents {
146
146
  modified: PropTypes.Requireable<boolean>;
147
147
  error: PropTypes.Requireable<boolean>;
148
148
  'aria-label': PropTypes.Requireable<string>;
149
- selectId: PropTypes.Requireable<string>;
150
- titleClassName: PropTypes.Requireable<string>;
149
+ 'aria-labelledby': PropTypes.Requireable<string>;
151
150
  }> | PropTypes.InferProps<{
152
151
  type: PropTypes.Requireable<string>;
153
152
  title: PropTypes.Validator<string>;
@@ -252,8 +251,7 @@ declare namespace WizardContents {
252
251
  modified: PropTypes.Requireable<boolean>;
253
252
  error: PropTypes.Requireable<boolean>;
254
253
  'aria-label': PropTypes.Requireable<string>;
255
- selectId: PropTypes.Requireable<string>;
256
- titleClassName: PropTypes.Requireable<string>;
254
+ 'aria-labelledby': PropTypes.Requireable<string>;
257
255
  }> | PropTypes.InferProps<{
258
256
  type: PropTypes.Requireable<string>;
259
257
  title: PropTypes.Validator<string>;
@@ -231,8 +231,7 @@ declare namespace BrandUpdate {
231
231
  modified: PropTypes.Requireable<boolean>;
232
232
  error: PropTypes.Requireable<boolean>;
233
233
  'aria-label': PropTypes.Requireable<string>;
234
- selectId: PropTypes.Requireable<string>;
235
- titleClassName: PropTypes.Requireable<string>;
234
+ 'aria-labelledby': PropTypes.Requireable<string>;
236
235
  }> | PropTypes.InferProps<{
237
236
  type: PropTypes.Requireable<string>;
238
237
  title: PropTypes.Validator<string>;
@@ -337,8 +336,7 @@ declare namespace BrandUpdate {
337
336
  modified: PropTypes.Requireable<boolean>;
338
337
  error: PropTypes.Requireable<boolean>;
339
338
  'aria-label': PropTypes.Requireable<string>;
340
- selectId: PropTypes.Requireable<string>;
341
- titleClassName: PropTypes.Requireable<string>;
339
+ 'aria-labelledby': PropTypes.Requireable<string>;
342
340
  }> | PropTypes.InferProps<{
343
341
  type: PropTypes.Requireable<string>;
344
342
  title: PropTypes.Validator<string>;
@@ -858,8 +856,7 @@ declare namespace BrandUpdate {
858
856
  modified: PropTypes.Requireable<boolean>;
859
857
  error: PropTypes.Requireable<boolean>;
860
858
  'aria-label': PropTypes.Requireable<string>;
861
- selectId: PropTypes.Requireable<string>;
862
- titleClassName: PropTypes.Requireable<string>;
859
+ 'aria-labelledby': PropTypes.Requireable<string>;
863
860
  }> | PropTypes.InferProps<{
864
861
  type: PropTypes.Requireable<string>;
865
862
  title: PropTypes.Validator<string>;
@@ -964,8 +961,7 @@ declare namespace BrandUpdate {
964
961
  modified: PropTypes.Requireable<boolean>;
965
962
  error: PropTypes.Requireable<boolean>;
966
963
  'aria-label': PropTypes.Requireable<string>;
967
- selectId: PropTypes.Requireable<string>;
968
- titleClassName: PropTypes.Requireable<string>;
964
+ 'aria-labelledby': PropTypes.Requireable<string>;
969
965
  }> | PropTypes.InferProps<{
970
966
  type: PropTypes.Requireable<string>;
971
967
  title: PropTypes.Validator<string>;
@@ -58,8 +58,7 @@ declare namespace SearchPage {
58
58
  modified: PropTypes.Requireable<boolean>;
59
59
  error: PropTypes.Requireable<boolean>;
60
60
  'aria-label': PropTypes.Requireable<string>;
61
- selectId: PropTypes.Requireable<string>;
62
- titleClassName: PropTypes.Requireable<string>;
61
+ 'aria-labelledby': PropTypes.Requireable<string>;
63
62
  }>>;
64
63
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
65
64
  onToggleFilters: PropTypes.Requireable<(...args: any[]) => any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/components",
3
- "version": "11.4.5-alpha.41+8a79dc32c",
3
+ "version": "11.4.5-alpha.42+4584d9183",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -160,5 +160,5 @@
160
160
  "last 2 versions",
161
161
  "IE 11"
162
162
  ],
163
- "gitHead": "8a79dc32cbdd9f9c77afc5e873e32b44e888069a"
163
+ "gitHead": "4584d91832ae87a793774213383a7d2bbdc1650d"
164
164
  }