@coorpacademy/components 11.7.3 → 11.7.4-alpha.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/es/atom/select/index.d.ts +18 -0
- package/es/atom/select/index.d.ts.map +1 -1
- package/es/atom/select/index.js +21 -4
- package/es/atom/select/index.js.map +1 -1
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +36 -9
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +18 -0
- package/es/molecule/filters/filters-wrapper.d.ts +1 -0
- package/es/molecule/filters/filters-wrapper.d.ts.map +1 -1
- package/es/molecule/filters/filters-wrapper.js +9 -5
- package/es/molecule/filters/filters-wrapper.js.map +1 -1
- package/es/molecule/filters/index.d.ts +10 -0
- package/es/molecule/filters/index.d.ts.map +1 -1
- package/es/molecule/filters/index.js +6 -3
- package/es/molecule/filters/index.js.map +1 -1
- package/es/molecule/questions/drop-down/index.d.ts +1 -0
- package/es/molecule/questions/drop-down/index.js +7 -3
- package/es/molecule/questions/drop-down/index.js.map +1 -1
- package/es/molecule/questions/qcm/index.d.ts +1 -0
- package/es/molecule/questions/qcm/index.js +7 -3
- package/es/molecule/questions/qcm/index.js.map +1 -1
- package/es/molecule/questions/qcm-drag/index.d.ts +3 -1
- package/es/molecule/questions/qcm-drag/index.d.ts.map +1 -1
- package/es/molecule/questions/qcm-drag/index.js +7 -3
- package/es/molecule/questions/qcm-drag/index.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/index.d.ts +1 -0
- package/es/molecule/questions/qcm-graphic/index.d.ts.map +1 -1
- package/es/molecule/questions/qcm-graphic/index.js +7 -3
- package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/es/molecule/questions/question-range/index.d.ts +1 -0
- package/es/molecule/questions/question-range/index.js +8 -4
- package/es/molecule/questions/question-range/index.js.map +1 -1
- package/es/molecule/questions/template/index.d.ts +6 -2
- package/es/molecule/questions/template/index.d.ts.map +1 -1
- package/es/molecule/questions/template/index.js +7 -3
- package/es/molecule/questions/template/index.js.map +1 -1
- package/es/molecule/setup-slide/index.d.ts +9 -0
- package/es/molecule/setup-slider/index.d.ts +9 -0
- package/es/organism/brand-form/index.d.ts +18 -0
- package/es/organism/user-preferences/index.d.ts +1 -0
- package/es/organism/user-preferences/index.d.ts.map +1 -1
- package/es/organism/user-preferences/index.js +9 -5
- package/es/organism/user-preferences/index.js.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +18 -0
- package/es/template/back-office/brand-update/index.d.ts +36 -0
- package/es/template/common/search-page/index.d.ts +11 -0
- package/es/template/common/search-page/index.d.ts.map +1 -1
- package/es/template/common/search-page/index.js +6 -3
- package/es/template/common/search-page/index.js.map +1 -1
- package/lib/atom/select/index.d.ts +18 -0
- package/lib/atom/select/index.d.ts.map +1 -1
- package/lib/atom/select/index.js +26 -5
- package/lib/atom/select/index.js.map +1 -1
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +37 -9
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +18 -0
- package/lib/molecule/filters/filters-wrapper.d.ts +1 -0
- package/lib/molecule/filters/filters-wrapper.d.ts.map +1 -1
- package/lib/molecule/filters/filters-wrapper.js +9 -5
- package/lib/molecule/filters/filters-wrapper.js.map +1 -1
- package/lib/molecule/filters/index.d.ts +10 -0
- package/lib/molecule/filters/index.d.ts.map +1 -1
- package/lib/molecule/filters/index.js +6 -3
- package/lib/molecule/filters/index.js.map +1 -1
- package/lib/molecule/questions/drop-down/index.d.ts +1 -0
- package/lib/molecule/questions/drop-down/index.js +7 -3
- package/lib/molecule/questions/drop-down/index.js.map +1 -1
- package/lib/molecule/questions/qcm/index.d.ts +1 -0
- package/lib/molecule/questions/qcm/index.js +7 -3
- package/lib/molecule/questions/qcm/index.js.map +1 -1
- package/lib/molecule/questions/qcm-drag/index.d.ts +3 -1
- package/lib/molecule/questions/qcm-drag/index.d.ts.map +1 -1
- package/lib/molecule/questions/qcm-drag/index.js +7 -3
- package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/index.d.ts +1 -0
- package/lib/molecule/questions/qcm-graphic/index.d.ts.map +1 -1
- package/lib/molecule/questions/qcm-graphic/index.js +7 -3
- package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/lib/molecule/questions/question-range/index.d.ts +1 -0
- package/lib/molecule/questions/question-range/index.js +8 -4
- package/lib/molecule/questions/question-range/index.js.map +1 -1
- package/lib/molecule/questions/template/index.d.ts +6 -2
- package/lib/molecule/questions/template/index.d.ts.map +1 -1
- package/lib/molecule/questions/template/index.js +7 -3
- package/lib/molecule/questions/template/index.js.map +1 -1
- package/lib/molecule/setup-slide/index.d.ts +9 -0
- package/lib/molecule/setup-slider/index.d.ts +9 -0
- package/lib/organism/brand-form/index.d.ts +18 -0
- package/lib/organism/user-preferences/index.d.ts +1 -0
- package/lib/organism/user-preferences/index.d.ts.map +1 -1
- package/lib/organism/user-preferences/index.js +9 -5
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +18 -0
- package/lib/template/back-office/brand-update/index.d.ts +36 -0
- package/lib/template/common/search-page/index.d.ts +11 -0
- package/lib/template/common/search-page/index.d.ts.map +1 -1
- package/lib/template/common/search-page/index.js +6 -3
- package/lib/template/common/search-page/index.js.map +1 -1
- package/locales/cs/global.json +1 -0
- package/locales/de/global.json +1 -0
- package/locales/en/global.json +1 -0
- package/locales/es/global.json +1 -0
- package/locales/et/global.json +1 -0
- package/locales/fr/global.json +1 -0
- package/locales/hr/global.json +1 -0
- package/locales/hu/global.json +1 -0
- package/locales/it/global.json +1 -0
- package/locales/ja/global.json +1 -0
- package/locales/ko/global.json +1 -0
- package/locales/nl/global.json +1 -0
- package/locales/pl/global.json +1 -0
- package/locales/pt/global.json +1 -0
- package/locales/ro/global.json +1 -0
- package/locales/ru/global.json +1 -0
- package/locales/sk/global.json +1 -0
- package/locales/tl/global.json +1 -0
- package/locales/tr/global.json +1 -0
- package/locales/uk/global.json +1 -0
- package/locales/vi/global.json +1 -0
- package/locales/zh/global.json +1 -0
- package/locales/zh_TW/global.json +1 -0
- package/package.json +2 -2
- package/locales/.mtslconfig.json +0 -1
|
@@ -143,6 +143,15 @@ declare namespace WizardContents {
|
|
|
143
143
|
selected: PropTypes.Requireable<boolean>;
|
|
144
144
|
validOption: PropTypes.Requireable<boolean>;
|
|
145
145
|
}> | null | undefined)[]>;
|
|
146
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
147
|
+
label: PropTypes.Validator<string>;
|
|
148
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
149
|
+
name: PropTypes.Validator<string>;
|
|
150
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
151
|
+
selected: PropTypes.Requireable<boolean>;
|
|
152
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
153
|
+
}> | null | undefined)[]>;
|
|
154
|
+
}> | null | undefined)[]>;
|
|
146
155
|
modified: PropTypes.Requireable<boolean>;
|
|
147
156
|
error: PropTypes.Requireable<boolean>;
|
|
148
157
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -247,6 +256,15 @@ declare namespace WizardContents {
|
|
|
247
256
|
selected: PropTypes.Requireable<boolean>;
|
|
248
257
|
validOption: PropTypes.Requireable<boolean>;
|
|
249
258
|
}> | null | undefined)[]>;
|
|
259
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
260
|
+
label: PropTypes.Validator<string>;
|
|
261
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
262
|
+
name: PropTypes.Validator<string>;
|
|
263
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
264
|
+
selected: PropTypes.Requireable<boolean>;
|
|
265
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
266
|
+
}> | null | undefined)[]>;
|
|
267
|
+
}> | null | undefined)[]>;
|
|
250
268
|
modified: PropTypes.Requireable<boolean>;
|
|
251
269
|
error: PropTypes.Requireable<boolean>;
|
|
252
270
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -228,6 +228,15 @@ declare namespace BrandUpdate {
|
|
|
228
228
|
selected: PropTypes.Requireable<boolean>;
|
|
229
229
|
validOption: PropTypes.Requireable<boolean>;
|
|
230
230
|
}> | null | undefined)[]>;
|
|
231
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
232
|
+
label: PropTypes.Validator<string>;
|
|
233
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
234
|
+
name: PropTypes.Validator<string>;
|
|
235
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
236
|
+
selected: PropTypes.Requireable<boolean>;
|
|
237
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
238
|
+
}> | null | undefined)[]>;
|
|
239
|
+
}> | null | undefined)[]>;
|
|
231
240
|
modified: PropTypes.Requireable<boolean>;
|
|
232
241
|
error: PropTypes.Requireable<boolean>;
|
|
233
242
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -332,6 +341,15 @@ declare namespace BrandUpdate {
|
|
|
332
341
|
selected: PropTypes.Requireable<boolean>;
|
|
333
342
|
validOption: PropTypes.Requireable<boolean>;
|
|
334
343
|
}> | null | undefined)[]>;
|
|
344
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
345
|
+
label: PropTypes.Validator<string>;
|
|
346
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
347
|
+
name: PropTypes.Validator<string>;
|
|
348
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
349
|
+
selected: PropTypes.Requireable<boolean>;
|
|
350
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
351
|
+
}> | null | undefined)[]>;
|
|
352
|
+
}> | null | undefined)[]>;
|
|
335
353
|
modified: PropTypes.Requireable<boolean>;
|
|
336
354
|
error: PropTypes.Requireable<boolean>;
|
|
337
355
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -851,6 +869,15 @@ declare namespace BrandUpdate {
|
|
|
851
869
|
selected: PropTypes.Requireable<boolean>;
|
|
852
870
|
validOption: PropTypes.Requireable<boolean>;
|
|
853
871
|
}> | null | undefined)[]>;
|
|
872
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
873
|
+
label: PropTypes.Validator<string>;
|
|
874
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
875
|
+
name: PropTypes.Validator<string>;
|
|
876
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
877
|
+
selected: PropTypes.Requireable<boolean>;
|
|
878
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
879
|
+
}> | null | undefined)[]>;
|
|
880
|
+
}> | null | undefined)[]>;
|
|
854
881
|
modified: PropTypes.Requireable<boolean>;
|
|
855
882
|
error: PropTypes.Requireable<boolean>;
|
|
856
883
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -955,6 +982,15 @@ declare namespace BrandUpdate {
|
|
|
955
982
|
selected: PropTypes.Requireable<boolean>;
|
|
956
983
|
validOption: PropTypes.Requireable<boolean>;
|
|
957
984
|
}> | null | undefined)[]>;
|
|
985
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
986
|
+
label: PropTypes.Validator<string>;
|
|
987
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
988
|
+
name: PropTypes.Validator<string>;
|
|
989
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
990
|
+
selected: PropTypes.Requireable<boolean>;
|
|
991
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
992
|
+
}> | null | undefined)[]>;
|
|
993
|
+
}> | null | undefined)[]>;
|
|
958
994
|
modified: PropTypes.Requireable<boolean>;
|
|
959
995
|
error: PropTypes.Requireable<boolean>;
|
|
960
996
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -55,6 +55,15 @@ declare namespace SearchPage {
|
|
|
55
55
|
selected: PropTypes.Requireable<boolean>;
|
|
56
56
|
validOption: PropTypes.Requireable<boolean>;
|
|
57
57
|
}> | null | undefined)[]>;
|
|
58
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
59
|
+
label: PropTypes.Validator<string>;
|
|
60
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
61
|
+
name: PropTypes.Validator<string>;
|
|
62
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
63
|
+
selected: PropTypes.Requireable<boolean>;
|
|
64
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
65
|
+
}> | null | undefined)[]>;
|
|
66
|
+
}> | null | undefined)[]>;
|
|
58
67
|
modified: PropTypes.Requireable<boolean>;
|
|
59
68
|
error: PropTypes.Requireable<boolean>;
|
|
60
69
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -64,6 +73,7 @@ declare namespace SearchPage {
|
|
|
64
73
|
onToggleSorts: PropTypes.Requireable<(...args: any[]) => any>;
|
|
65
74
|
moreSortAriaLabel: PropTypes.Requireable<string>;
|
|
66
75
|
moreFilterAriaLabel: PropTypes.Requireable<string>;
|
|
76
|
+
filterGroupAriaLabel: PropTypes.Requireable<string>;
|
|
67
77
|
}>>;
|
|
68
78
|
const cards: PropTypes.Requireable<PropTypes.InferProps<{
|
|
69
79
|
list: PropTypes.Requireable<(PropTypes.InferProps<any> | null | undefined)[]>;
|
|
@@ -100,6 +110,7 @@ declare namespace SearchPage {
|
|
|
100
110
|
}>>;
|
|
101
111
|
const moreSortAriaLabel: PropTypes.Requireable<string>;
|
|
102
112
|
const moreFilterAriaLabel: PropTypes.Requireable<string>;
|
|
113
|
+
const filterGroupAriaLabel: PropTypes.Requireable<string>;
|
|
103
114
|
}
|
|
104
115
|
}
|
|
105
116
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/search-page/index.js"],"names":[],"mappings":";AAUA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/search-page/index.js"],"names":[],"mappings":";AAUA,mEAoDC"}
|
|
@@ -21,7 +21,8 @@ const SearchPage = (props, context) => {
|
|
|
21
21
|
clearFilters,
|
|
22
22
|
recommendations,
|
|
23
23
|
moreSortAriaLabel,
|
|
24
|
-
moreFilterAriaLabel
|
|
24
|
+
moreFilterAriaLabel,
|
|
25
|
+
filterGroupAriaLabel
|
|
25
26
|
} = props;
|
|
26
27
|
const {
|
|
27
28
|
skin
|
|
@@ -44,7 +45,8 @@ const SearchPage = (props, context) => {
|
|
|
44
45
|
}))), recommendationsView) : /*#__PURE__*/React.createElement(CardsGrid, cards);
|
|
45
46
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Filters, _extends({}, searchFilters, {
|
|
46
47
|
moreSortAriaLabel: moreSortAriaLabel,
|
|
47
|
-
moreFilterAriaLabel: moreFilterAriaLabel
|
|
48
|
+
moreFilterAriaLabel: moreFilterAriaLabel,
|
|
49
|
+
filterGroupAriaLabel: filterGroupAriaLabel
|
|
48
50
|
})), /*#__PURE__*/React.createElement("div", {
|
|
49
51
|
"data-name": "searchResult",
|
|
50
52
|
className: style.cardsWrapper
|
|
@@ -65,7 +67,8 @@ SearchPage.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
65
67
|
clearFilters: PropTypes.shape(Button.propTypes),
|
|
66
68
|
recommendations: PropTypes.shape(CardsList.propTypes),
|
|
67
69
|
moreSortAriaLabel: PropTypes.string,
|
|
68
|
-
moreFilterAriaLabel: PropTypes.string
|
|
70
|
+
moreFilterAriaLabel: PropTypes.string,
|
|
71
|
+
filterGroupAriaLabel: PropTypes.string
|
|
69
72
|
} : {};
|
|
70
73
|
export default SearchPage;
|
|
71
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","Provider","Button","Filters","CardsGrid","CardsList","style","SearchPage","props","context","title","searchFilters","cards","noresultsfound","clearFilters","recommendations","moreSortAriaLabel","moreFilterAriaLabel","skin","defaultColor","recommendationsView","cardsView","list","noresults","noresultstxt","clear","background","cardsWrapper","contextTypes","childContextTypes","propTypes","string","shape"],"sources":["../../../../src/template/common/search-page/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, isEmpty} from 'lodash/fp';\nimport Provider from '../../../atom/provider';\nimport Button from '../../../atom/button';\nimport Filters from '../../../molecule/filters';\nimport CardsGrid from '../../../organism/cards-grid';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport style from './style.css';\n\nconst SearchPage = (props, context) => {\n const {\n title,\n searchFilters,\n cards,\n noresultsfound,\n clearFilters,\n recommendations,\n moreSortAriaLabel,\n moreFilterAriaLabel\n } = props;\n\n const {skin} = context;\n const defaultColor = getOr('#00B0FF', 'common.primary', skin);\n\n const recommendationsView = isEmpty(recommendations) ? null : <CardsList {...recommendations} />;\n\n const cardsView = isEmpty(cards.list) ? (\n <div>\n <div className={style.noresults}>\n <div className={style.noresultstxt}>{noresultsfound}</div>\n <Button\n {...clearFilters}\n data-name=\"searchPageClear\"\n className={style.clear}\n style={{background: defaultColor}}\n type=\"link\"\n />\n </div>\n {recommendationsView}\n </div>\n ) : (\n <CardsGrid {...cards} />\n );\n\n return (\n <div>\n <Filters\n {...searchFilters}\n moreSortAriaLabel={moreSortAriaLabel}\n moreFilterAriaLabel={moreFilterAriaLabel}\n />\n <div data-name=\"searchResult\" className={style.cardsWrapper}>\n <div className={style.title} role=\"status\">\n {title}\n </div>\n {cardsView}\n </div>\n </div>\n );\n};\n\nSearchPage.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSearchPage.propTypes = {\n noresultsfound: PropTypes.string,\n title: PropTypes.string,\n searchFilters: PropTypes.shape(Filters.propTypes),\n cards: PropTypes.shape(CardsGrid.propTypes),\n clearFilters: PropTypes.shape(Button.propTypes),\n recommendations: PropTypes.shape(CardsList.propTypes),\n moreSortAriaLabel: PropTypes.string,\n moreFilterAriaLabel: PropTypes.string\n};\n\nexport default SearchPage;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,MAAP,MAAmB,sBAAnB;AACA,OAAOC,OAAP,MAAoB,2BAApB;AACA,OAAOC,SAAP,MAAsB,8BAAtB;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,UAAU,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACrC,MAAM;IACJC,KADI;IAEJC,aAFI;IAGJC,KAHI;IAIJC,cAJI;IAKJC,YALI;IAMJC,eANI;IAOJC,iBAPI;IAQJC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","Provider","Button","Filters","CardsGrid","CardsList","style","SearchPage","props","context","title","searchFilters","cards","noresultsfound","clearFilters","recommendations","moreSortAriaLabel","moreFilterAriaLabel","filterGroupAriaLabel","skin","defaultColor","recommendationsView","cardsView","list","noresults","noresultstxt","clear","background","cardsWrapper","contextTypes","childContextTypes","propTypes","string","shape"],"sources":["../../../../src/template/common/search-page/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, isEmpty} from 'lodash/fp';\nimport Provider from '../../../atom/provider';\nimport Button from '../../../atom/button';\nimport Filters from '../../../molecule/filters';\nimport CardsGrid from '../../../organism/cards-grid';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport style from './style.css';\n\nconst SearchPage = (props, context) => {\n const {\n title,\n searchFilters,\n cards,\n noresultsfound,\n clearFilters,\n recommendations,\n moreSortAriaLabel,\n moreFilterAriaLabel,\n filterGroupAriaLabel\n } = props;\n\n const {skin} = context;\n const defaultColor = getOr('#00B0FF', 'common.primary', skin);\n\n const recommendationsView = isEmpty(recommendations) ? null : <CardsList {...recommendations} />;\n\n const cardsView = isEmpty(cards.list) ? (\n <div>\n <div className={style.noresults}>\n <div className={style.noresultstxt}>{noresultsfound}</div>\n <Button\n {...clearFilters}\n data-name=\"searchPageClear\"\n className={style.clear}\n style={{background: defaultColor}}\n type=\"link\"\n />\n </div>\n {recommendationsView}\n </div>\n ) : (\n <CardsGrid {...cards} />\n );\n\n return (\n <div>\n <Filters\n {...searchFilters}\n moreSortAriaLabel={moreSortAriaLabel}\n moreFilterAriaLabel={moreFilterAriaLabel}\n filterGroupAriaLabel={filterGroupAriaLabel}\n />\n <div data-name=\"searchResult\" className={style.cardsWrapper}>\n <div className={style.title} role=\"status\">\n {title}\n </div>\n {cardsView}\n </div>\n </div>\n );\n};\n\nSearchPage.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSearchPage.propTypes = {\n noresultsfound: PropTypes.string,\n title: PropTypes.string,\n searchFilters: PropTypes.shape(Filters.propTypes),\n cards: PropTypes.shape(CardsGrid.propTypes),\n clearFilters: PropTypes.shape(Button.propTypes),\n recommendations: PropTypes.shape(CardsList.propTypes),\n moreSortAriaLabel: PropTypes.string,\n moreFilterAriaLabel: PropTypes.string,\n filterGroupAriaLabel: PropTypes.string\n};\n\nexport default SearchPage;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,MAAP,MAAmB,sBAAnB;AACA,OAAOC,OAAP,MAAoB,2BAApB;AACA,OAAOC,SAAP,MAAsB,8BAAtB;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,UAAU,GAAG,CAACC,KAAD,EAA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EACrBlB,cAAc,EAAEb,SAAS,CAACgC,MADL;EAErBtB,KAAK,EAAEV,SAAS,CAACgC,MAFI;EAGrBrB,aAAa,EAAEX,SAAS,CAACiC,KAAV,CAAgB9B,OAAO,CAAC4B,SAAxB,CAHM;EAIrBnB,KAAK,EAAEZ,SAAS,CAACiC,KAAV,CAAgB7B,SAAS,CAAC2B,SAA1B,CAJc;EAKrBjB,YAAY,EAAEd,SAAS,CAACiC,KAAV,CAAgB/B,MAAM,CAAC6B,SAAvB,CALO;EAMrBhB,eAAe,EAAEf,SAAS,CAACiC,KAAV,CAAgB5B,SAAS,CAAC0B,SAA1B,CANI;EAOrBf,iBAAiB,EAAEhB,SAAS,CAACgC,MAPR;EAQrBf,mBAAmB,EAAEjB,SAAS,CAACgC,MARV;EASrBd,oBAAoB,EAAElB,SAAS,CAACgC;AATX,CAAvB;AAYA,eAAezB,UAAf"}
|
|
@@ -4,6 +4,15 @@ export namespace SelectOptionPropTypes {
|
|
|
4
4
|
const selected: PropTypes.Requireable<boolean>;
|
|
5
5
|
const validOption: PropTypes.Requireable<boolean>;
|
|
6
6
|
}
|
|
7
|
+
export namespace SelectOptionGroupPropTypes {
|
|
8
|
+
const label: PropTypes.Validator<string>;
|
|
9
|
+
const options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
10
|
+
name: PropTypes.Validator<string>;
|
|
11
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
12
|
+
selected: PropTypes.Requireable<boolean>;
|
|
13
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
14
|
+
}> | null | undefined)[]>;
|
|
15
|
+
}
|
|
7
16
|
export default Select;
|
|
8
17
|
import PropTypes from "prop-types";
|
|
9
18
|
declare function Select(props: any, legacyContext: any): JSX.Element;
|
|
@@ -48,6 +57,15 @@ declare namespace Select {
|
|
|
48
57
|
selected: PropTypes.Requireable<boolean>;
|
|
49
58
|
validOption: PropTypes.Requireable<boolean>;
|
|
50
59
|
}> | null | undefined)[]>;
|
|
60
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
61
|
+
label: PropTypes.Validator<string>;
|
|
62
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
63
|
+
name: PropTypes.Validator<string>;
|
|
64
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
65
|
+
selected: PropTypes.Requireable<boolean>;
|
|
66
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
67
|
+
}> | null | undefined)[]>;
|
|
68
|
+
}> | null | undefined)[]>;
|
|
51
69
|
modified: PropTypes.Requireable<boolean>;
|
|
52
70
|
error: PropTypes.Requireable<boolean>;
|
|
53
71
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2DA,qEAqLC"}
|
package/lib/atom/select/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.default = exports.SelectOptionPropTypes = void 0;
|
|
4
|
+
exports.default = exports.SelectOptionPropTypes = exports.SelectOptionGroupPropTypes = void 0;
|
|
5
5
|
|
|
6
6
|
var _react = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
@@ -9,16 +9,22 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
|
+
var _concat = _interopRequireDefault(require("lodash/fp/concat"));
|
|
13
|
+
|
|
12
14
|
var _filter = _interopRequireDefault(require("lodash/fp/filter"));
|
|
13
15
|
|
|
14
16
|
var _find = _interopRequireDefault(require("lodash/fp/find"));
|
|
15
17
|
|
|
18
|
+
var _flatMapDeep = _interopRequireDefault(require("lodash/fp/flatMapDeep"));
|
|
19
|
+
|
|
16
20
|
var _get = _interopRequireDefault(require("lodash/fp/get"));
|
|
17
21
|
|
|
18
22
|
var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
|
|
19
23
|
|
|
20
24
|
var _includes = _interopRequireDefault(require("lodash/fp/includes"));
|
|
21
25
|
|
|
26
|
+
var _isEmpty = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
27
|
+
|
|
22
28
|
var _keys = _interopRequireDefault(require("lodash/fp/keys"));
|
|
23
29
|
|
|
24
30
|
var _map = _interopRequireDefault(require("lodash/fp/map"));
|
|
@@ -82,6 +88,7 @@ const Select = (props, legacyContext) => {
|
|
|
82
88
|
const {
|
|
83
89
|
name,
|
|
84
90
|
options = [],
|
|
91
|
+
optgroups = [],
|
|
85
92
|
className,
|
|
86
93
|
borderClassName,
|
|
87
94
|
onChange,
|
|
@@ -100,12 +107,20 @@ const Select = (props, legacyContext) => {
|
|
|
100
107
|
const [isArrowUp, setIsArrowUp] = (0, _react.useState)(false);
|
|
101
108
|
const handleSelectOnFocus = (0, _react.useCallback)(() => setIsArrowUp(true), []);
|
|
102
109
|
const handleSelectOnBlur = (0, _react.useCallback)(() => setIsArrowUp(false), []);
|
|
103
|
-
|
|
110
|
+
|
|
111
|
+
const selectOption = (option, index) => {
|
|
104
112
|
return /*#__PURE__*/_react.default.createElement("option", {
|
|
105
113
|
key: index,
|
|
106
114
|
value: option.value,
|
|
107
115
|
className: _style.default.selectOption
|
|
108
116
|
}, option.name);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const optionList = !(0, _isEmpty.default)(options) ? options.map((option, index) => selectOption(option, index)) : optgroups.map((optgroup, index) => {
|
|
120
|
+
return /*#__PURE__*/_react.default.createElement("optgroup", {
|
|
121
|
+
key: index,
|
|
122
|
+
label: optgroup.label
|
|
123
|
+
}, optgroup.options && optgroup.options.map((option, i) => selectOption(option, i)));
|
|
109
124
|
});
|
|
110
125
|
const titleView = title ? /*#__PURE__*/_react.default.createElement("span", {
|
|
111
126
|
className: _style.default.title
|
|
@@ -114,12 +129,12 @@ const Select = (props, legacyContext) => {
|
|
|
114
129
|
selected: true
|
|
115
130
|
}, options)) : (0, _get.default)('value', (0, _find.default)({
|
|
116
131
|
selected: true
|
|
117
|
-
}, options)), [multiple, options]);
|
|
132
|
+
}, (0, _concat.default)(options, (0, _flatMapDeep.default)('options', optgroups)))), [multiple, options, optgroups]);
|
|
118
133
|
const selectedLabel = (0, _react.useMemo)(() => multiple ? (0, _map.default)((0, _get.default)('name'), (0, _filter.default)({
|
|
119
134
|
selected: true
|
|
120
|
-
}, options)) : (0, _get.default)('
|
|
135
|
+
}, options)) : (0, _get.default)('value', (0, _find.default)({
|
|
121
136
|
selected: true
|
|
122
|
-
}, options)), [multiple, options]);
|
|
137
|
+
}, (0, _concat.default)(options, (0, _flatMapDeep.default)('options', optgroups)))), [multiple, options, optgroups]);
|
|
123
138
|
const isSelectedInValidOption = (0, _react.useMemo)(() => theme === 'player' && (0, _getOr.default)(false, 'name', (0, _find.default)({
|
|
124
139
|
validOption: false,
|
|
125
140
|
selected: true
|
|
@@ -188,6 +203,11 @@ const SelectOptionPropTypes = {
|
|
|
188
203
|
validOption: _propTypes.default.bool
|
|
189
204
|
};
|
|
190
205
|
exports.SelectOptionPropTypes = SelectOptionPropTypes;
|
|
206
|
+
const SelectOptionGroupPropTypes = {
|
|
207
|
+
label: _propTypes.default.string.isRequired,
|
|
208
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape(SelectOptionPropTypes))
|
|
209
|
+
};
|
|
210
|
+
exports.SelectOptionGroupPropTypes = SelectOptionGroupPropTypes;
|
|
191
211
|
Select.contextTypes = {
|
|
192
212
|
skin: _provider.default.childContextTypes.skin
|
|
193
213
|
};
|
|
@@ -203,6 +223,7 @@ Select.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
203
223
|
onChange: _propTypes.default.func,
|
|
204
224
|
theme: _propTypes.default.oneOf((0, _keys.default)(themeStyle)),
|
|
205
225
|
options: _propTypes.default.arrayOf(_propTypes.default.shape(SelectOptionPropTypes)),
|
|
226
|
+
optgroups: _propTypes.default.arrayOf(_propTypes.default.shape(SelectOptionGroupPropTypes)),
|
|
206
227
|
modified: _propTypes.default.bool,
|
|
207
228
|
error: _propTypes.default.bool,
|
|
208
229
|
'aria-label': _propTypes.default.string
|
|
@@ -1 +1 @@
|
|
|
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","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 } = 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 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};\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;EAEjBE,OAAO,EAAED,cAAA,CAAMC,OAFE;EAGjBC,MAAM,EAAEF,cAAA,CAAME,MAHG;EAIjBC,IAAI,EAAEH,cAAA,CAAMG,I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kBAAA,CAAUc,KAAV,CAAgBf,qBAAhB,CAAlB,CAXQ;EAYjBlD,QAAQ,EAAEmD,kBAAA,CAAUK,IAZH;EAajBvD,KAAK,EAAEkD,kBAAA,CAAUK,IAbA;EAcjB,cAAcL,kBAAA,CAAUC;AAdP,CAAnB;eAiBe/D,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","optgroups","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","GetSkinFromContext","setIsArrowUp","useState","handleSelectOnFocus","useCallback","handleSelectOnBlur","selectOption","option","index","value","optionList","isEmpty","map","optgroup","label","i","titleView","selected","get","find","concat","flatMapDeep","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","SelectOptionGroupPropTypes","arrayOf","shape","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","keys"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport concat from 'lodash/fp/concat';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport flatMapDeep from 'lodash/fp/flatMapDeep';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport isEmpty from 'lodash/fp/isEmpty';\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 optgroups = [],\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 } = 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 selectOption = (option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n };\n\n const optionList = !isEmpty(options)\n ? options.map((option, index) => selectOption(option, index))\n : optgroups.map((optgroup, index) => {\n return (\n <optgroup key={index} label={optgroup.label}>\n {optgroup.options && optgroup.options.map((option, i) => selectOption(option, i))}\n </optgroup>\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}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('value', find({selected: true}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\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 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\nexport const SelectOptionGroupPropTypes = {\n label: PropTypes.string.isRequired,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\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 optgroups: PropTypes.arrayOf(PropTypes.shape(SelectOptionGroupPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;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,SAAS,GAAG,CAAC;EAACC,YAAD;EAAeC,SAAf;EAA0BC,SAA1B;EAAqCC,UAArC;EAAiDC;AAAjD,CAAD,KAAkE;EAClF,MAAMC,KAAK,GAAG,IAAAC,cAAA,EACZ,mBACMJ,SAAS,GACX;IACE,cAAcA;EADhB,CAFJ,EAKME,UAAU,GACZ;IACEG,KAAK,EAAEH;EADT,CANJ;IASEI,SAAS,EAAEL;EATb,EADY,EAYZ,CAACD,SAAD,EAAYC,UAAZ,EAAwBC,UAAxB,CAZY,CAAd;;EAcA,IAAIJ,YAAJ,EAAkB;IAChB,OAAOC,SAAS,gBACd,6BAAC,4CAAD,eAAaI,KAAb;MAAoB,eAAY;IAAhC,GADc,gBAGd,6BAAC,6CAAD,eAAeA,KAAf;MAAsB,eAAY;IAAlC,GAHF;EAKD,CAND,MAMO,OAAO,IAAP;AACR,CAtBD;;AAwBA,MAAMI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AL,CAAhB,CAVU;EAWjByB,OAAO,EAAEkE,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUQ,KAAV,CAAgBT,qBAAhB,CAAlB,CAXQ;EAYjBhE,SAAS,EAAEiE,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUQ,KAAV,CAAgBF,0BAAhB,CAAlB,CAZM;EAajB/D,QAAQ,EAAEyD,kBAAA,CAAUK,IAbH;EAcjB7D,KAAK,EAAEwD,kBAAA,CAAUK,IAdA;EAejB,cAAcL,kBAAA,CAAUC;AAfP,CAAnB;eAkBetE,M"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AAoGA,iDASC"}
|
|
@@ -25,6 +25,8 @@ var _template = _interopRequireDefault(require("../questions/template"));
|
|
|
25
25
|
|
|
26
26
|
var _audio = _interopRequireDefault(require("../audio"));
|
|
27
27
|
|
|
28
|
+
var _provider = require("../../atom/provider");
|
|
29
|
+
|
|
28
30
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
29
31
|
|
|
30
32
|
var _propTypes = _interopRequireWildcard(require("./prop-types"));
|
|
@@ -90,30 +92,56 @@ const Switch = ({
|
|
|
90
92
|
const {
|
|
91
93
|
type
|
|
92
94
|
} = model;
|
|
95
|
+
const translate = (0, _provider.GetTranslateFromContext)();
|
|
93
96
|
|
|
94
97
|
switch (type) {
|
|
95
98
|
case 'qcmDrag':
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
role: "form"
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_qcmDrag.default, _extends({}, model, {
|
|
102
|
+
help: help,
|
|
103
|
+
groupAriaLabel: translate('answer_the_question')
|
|
104
|
+
})), ' ');
|
|
99
105
|
|
|
100
106
|
case 'qcm':
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
role: "form"
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_qcm.default, _extends({}, model, {
|
|
110
|
+
groupAriaLabel: translate('answer_the_question')
|
|
111
|
+
})));
|
|
102
112
|
|
|
103
113
|
case 'qcmGraphic':
|
|
104
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
+
role: "form"
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement(_qcmGraphic.default, _extends({}, model, {
|
|
117
|
+
groupAriaLabel: translate('answer_the_question')
|
|
118
|
+
})));
|
|
105
119
|
|
|
106
120
|
case 'freeText':
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
121
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
122
|
+
role: "form"
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement(_freeText.default, model));
|
|
108
124
|
|
|
109
125
|
case 'dropDown':
|
|
110
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
127
|
+
role: "form"
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(_dropDown.default, _extends({}, model, {
|
|
129
|
+
groupAriaLabel: translate('answer_the_question')
|
|
130
|
+
})));
|
|
111
131
|
|
|
112
132
|
case 'slider':
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
role: "form"
|
|
135
|
+
}, /*#__PURE__*/_react.default.createElement(_questionRange.default, _extends({}, model, {
|
|
136
|
+
groupAriaLabel: translate('answer_the_question')
|
|
137
|
+
})));
|
|
114
138
|
|
|
115
139
|
case 'template':
|
|
116
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
+
role: "form"
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement(_template.default, _extends({}, model, {
|
|
143
|
+
groupAriaLabel: translate('answer_the_question')
|
|
144
|
+
})));
|
|
117
145
|
}
|
|
118
146
|
};
|
|
119
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["MediaView","media","videoId","type","childProps","TYPE_IMAGE","style","backgroundImage","url","TYPE_VIDEO","video","TYPE_AUDIO","audio","propTypes","MediaViewPropTypes","Switch","model","help","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}) => {\n const {type} = model;\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["MediaView","media","videoId","type","childProps","TYPE_IMAGE","style","backgroundImage","url","TYPE_VIDEO","video","TYPE_AUDIO","audio","propTypes","MediaViewPropTypes","Switch","model","help","translate","GetTranslateFromContext","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport {GetTranslateFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}) => {\n const {type} = model;\n const translate = GetTranslateFromContext();\n switch (type) {\n case 'qcmDrag':\n return (\n <div role=\"form\">\n <QcmDrag {...model} help={help} groupAriaLabel={translate('answer_the_question')} />{' '}\n </div>\n );\n case 'qcm':\n return (\n <div role=\"form\">\n <Qcm {...model} groupAriaLabel={translate('answer_the_question')} />\n </div>\n );\n case 'qcmGraphic':\n return (\n <div role=\"form\">\n <QcmGraphic {...model} groupAriaLabel={translate('answer_the_question')} />\n </div>\n );\n case 'freeText':\n return (\n <div role=\"form\">\n <FreeText {...model} />\n </div>\n );\n case 'dropDown':\n return (\n <div role=\"form\">\n <DropDown {...model} groupAriaLabel={translate('answer_the_question')} />\n </div>\n );\n case 'slider':\n return (\n <div role=\"form\">\n <QuestionRange {...model} groupAriaLabel={translate('answer_the_question')} />\n </div>\n );\n case 'template':\n return (\n <div role=\"form\">\n <Template {...model} groupAriaLabel={translate('answer_the_question')} />\n </div>\n );\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <Switch model={model} help={help} />\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,MAAMA,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAAa;EAC7B,MAAM;IAACC,OAAD;IAAUC;EAAV,IAAiCF,KAAvC;EAAA,MAAyBG,UAAzB,iCAAuCH,KAAvC;;EACA,QAAQE,IAAR;IACE,KAAKE,qBAAL;MACE,oBACE;QACE,SAAS,EAAEC,cAAA,CAAML,KADnB;QAEE,KAAK,EAAE;UACLM,eAAe,EAAG,OAAMN,KAAK,CAACO,GAAI;QAD7B;MAFT,EADF;;IAQF,KAAKC,qBAAL;MACE,oBACE;QAAK,SAAS,EAAEH,cAAA,CAAMI;MAAtB,gBACE,6BAAC,oBAAD,eAAiB,oBAAK,IAAL,EAAWN,UAAX,CAAjB;QAAyC,EAAE,EAAEF,OAA7C;QAAsD,MAAM,EAAC,MAA7D;QAAoE,KAAK,EAAC;MAA1E,GADF,CADF;;IAKF,KAAKS,qBAAL;MACE,oBACE;QAAK,SAAS,EAAEL,cAAA,CAAMM;MAAtB,gBACE,6BAAC,cAAD,eAAW,oBAAK,IAAL,EAAWR,UAAX,CAAX;Q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C;MAAV,gBACE,6BAAC,iBAAD,eAAcF,KAAd;QAAqB,cAAc,EAAEE,SAAS,CAAC,qBAAD;MAA9C,GADF,CADF;EAtCJ;AA4CD,CA/CD;;AAiDAH,MAAM,CAACF,SAAP,2CAAmB;EACjBG,KAAK,EAAEH,kBAAA,CAAUG,KADA;EAEjBC,IAAI,EAAEJ,kBAAA,CAAUI;AAFC,CAAnB;;AAKA,MAAMG,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IAACL,KAAD;IAAQf,KAAR;IAAegB;EAAf,IAAuBI,KAA7B;EAEA,oBACE;IAAK,aAAU,QAAf;IAAwB,SAAS,EAAEf,cAAA,CAAMgB;EAAzC,GACGrB,KAAK,gBAAG,6BAAC,SAAD;IAAW,KAAK,EAAEA;EAAlB,EAAH,GAAiC,IADzC,eAEE,6BAAC,MAAD;IAAQ,KAAK,EAAEe,KAAf;IAAsB,IAAI,EAAEC;EAA5B,EAFF,CADF;AAMD,CATD;;AAWAG,MAAM,CAACP,SAAP,2CAAmBA,kBAAnB;eAEeO,M"}
|
|
@@ -96,6 +96,15 @@ declare namespace BrandFormGroup {
|
|
|
96
96
|
selected: PropTypes.Requireable<boolean>;
|
|
97
97
|
validOption: PropTypes.Requireable<boolean>;
|
|
98
98
|
}> | null | undefined)[]>;
|
|
99
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
100
|
+
label: PropTypes.Validator<string>;
|
|
101
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
102
|
+
name: PropTypes.Validator<string>;
|
|
103
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
104
|
+
selected: PropTypes.Requireable<boolean>;
|
|
105
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
106
|
+
}> | null | undefined)[]>;
|
|
107
|
+
}> | null | undefined)[]>;
|
|
99
108
|
modified: PropTypes.Requireable<boolean>;
|
|
100
109
|
error: PropTypes.Requireable<boolean>;
|
|
101
110
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -200,6 +209,15 @@ declare namespace BrandFormGroup {
|
|
|
200
209
|
selected: PropTypes.Requireable<boolean>;
|
|
201
210
|
validOption: PropTypes.Requireable<boolean>;
|
|
202
211
|
}> | null | undefined)[]>;
|
|
212
|
+
optgroups: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
213
|
+
label: PropTypes.Validator<string>;
|
|
214
|
+
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
215
|
+
name: PropTypes.Validator<string>;
|
|
216
|
+
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
217
|
+
selected: PropTypes.Requireable<boolean>;
|
|
218
|
+
validOption: PropTypes.Requireable<boolean>;
|
|
219
|
+
}> | null | undefined)[]>;
|
|
220
|
+
}> | null | undefined)[]>;
|
|
203
221
|
modified: PropTypes.Requireable<boolean>;
|
|
204
222
|
error: PropTypes.Requireable<boolean>;
|
|
205
223
|
'aria-label': PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters-wrapper.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/filters-wrapper.js"],"names":[],"mappings":";AAUA,
|
|
1
|
+
{"version":3,"file":"filters-wrapper.d.ts","sourceRoot":"","sources":["../../../src/molecule/filters/filters-wrapper.js"],"names":[],"mappings":";AAUA,sEA6DC"}
|
|
@@ -30,7 +30,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
30
30
|
const FiltersWapper = (props, context) => {
|
|
31
31
|
const {
|
|
32
32
|
filters,
|
|
33
|
-
className
|
|
33
|
+
className,
|
|
34
|
+
filterGroupAriaLabel
|
|
34
35
|
} = props;
|
|
35
36
|
|
|
36
37
|
const buildFilter = (filter, idx) => {
|
|
@@ -94,9 +95,11 @@ const FiltersWapper = (props, context) => {
|
|
|
94
95
|
})(buildFilter, filters);
|
|
95
96
|
|
|
96
97
|
const emptyFilters = (0, _isEmpty2.default)(filters);
|
|
97
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
-
className: (0, _classnames.default)(className, emptyFilters ? _filtersWapper.default.wrapperNone : _filtersWapper.default.wrapper)
|
|
99
|
-
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement("form", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: (0, _classnames.default)(className, emptyFilters ? _filtersWapper.default.wrapperNone : _filtersWapper.default.wrapper),
|
|
100
|
+
role: "group",
|
|
101
|
+
"aria-label": filterGroupAriaLabel
|
|
102
|
+
}, filtersList));
|
|
100
103
|
};
|
|
101
104
|
|
|
102
105
|
FiltersWapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -104,7 +107,8 @@ FiltersWapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
104
107
|
filters: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
105
108
|
type: _propTypes.default.oneOf(['select', 'range', 'radio', 'switch']).isRequired,
|
|
106
109
|
fieldName: _propTypes.default.string.isRequired
|
|
107
|
-
}))
|
|
110
|
+
})),
|
|
111
|
+
filterGroupAriaLabel: _propTypes.default.string
|
|
108
112
|
} : {};
|
|
109
113
|
var _default = FiltersWapper;
|
|
110
114
|
exports.default = _default;
|