@coorpacademy/components 11.6.1 → 11.7.3-alpha.29
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/loader/index.native.d.ts +10 -0
- package/es/atom/loader/index.native.d.ts.map +1 -0
- package/es/atom/loader/index.native.js +192 -0
- package/es/atom/loader/index.native.js.map +1 -0
- 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 +69 -15
- 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 +17 -12
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +18 -0
- package/es/molecule/empty-state-dashboard/index.d.ts +23 -0
- package/es/molecule/empty-state-dashboard/index.d.ts.map +1 -0
- package/es/molecule/empty-state-dashboard/index.js +31 -0
- package/es/molecule/empty-state-dashboard/index.js.map +1 -0
- package/es/molecule/empty-state-dashboard/style.css +55 -0
- package/es/molecule/empty-state-dashboard/types.d.ts +19 -0
- package/es/molecule/empty-state-dashboard/types.d.ts.map +1 -0
- package/es/molecule/empty-state-dashboard/types.js +19 -0
- package/es/molecule/empty-state-dashboard/types.js.map +1 -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.d.ts.map +1 -1
- package/es/molecule/questions/drop-down/index.js +9 -5
- 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.d.ts.map +1 -1
- package/es/molecule/questions/qcm/index.js +9 -5
- 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 +9 -5
- 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 +9 -5
- 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.d.ts.map +1 -1
- package/es/molecule/questions/question-range/index.js +10 -6
- 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 +9 -5
- 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/list-item/index.d.ts +8 -6
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +16 -2
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-item/style.css +18 -0
- package/es/organism/list-items/index.d.ts +2 -0
- package/es/organism/list-items/index.js +5 -1
- package/es/organism/list-items/index.js.map +1 -1
- 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/activity/index.d.ts +36 -40
- package/es/template/activity/index.d.ts.map +1 -1
- package/es/template/activity/index.js +89 -111
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/stars-summary.d.ts +9 -18
- package/es/template/activity/stars-summary.d.ts.map +1 -1
- package/es/template/activity/stars-summary.js +94 -122
- package/es/template/activity/stars-summary.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +56 -0
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +12 -3
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/back-office/brand-update/style.css +5 -1
- 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/es/util/button-icons.d.ts +1 -0
- package/es/util/button-icons.d.ts.map +1 -1
- package/es/util/button-icons.js +3 -2
- package/es/util/button-icons.js.map +1 -1
- package/lib/atom/loader/index.native.d.ts +10 -0
- package/lib/atom/loader/index.native.d.ts.map +1 -0
- package/lib/atom/loader/index.native.js +205 -0
- package/lib/atom/loader/index.native.js.map +1 -0
- 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 +72 -14
- 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 +18 -13
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +18 -0
- package/lib/molecule/empty-state-dashboard/index.d.ts +23 -0
- package/lib/molecule/empty-state-dashboard/index.d.ts.map +1 -0
- package/lib/molecule/empty-state-dashboard/index.js +42 -0
- package/lib/molecule/empty-state-dashboard/index.js.map +1 -0
- package/lib/molecule/empty-state-dashboard/style.css +55 -0
- package/lib/molecule/empty-state-dashboard/types.d.ts +19 -0
- package/lib/molecule/empty-state-dashboard/types.d.ts.map +1 -0
- package/lib/molecule/empty-state-dashboard/types.js +29 -0
- package/lib/molecule/empty-state-dashboard/types.js.map +1 -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.d.ts.map +1 -1
- package/lib/molecule/questions/drop-down/index.js +9 -5
- 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.d.ts.map +1 -1
- package/lib/molecule/questions/qcm/index.js +9 -5
- 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 +9 -5
- 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 +9 -5
- 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.d.ts.map +1 -1
- package/lib/molecule/questions/question-range/index.js +10 -6
- 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 +9 -5
- 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/list-item/index.d.ts +8 -6
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +16 -2
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-item/style.css +18 -0
- package/lib/organism/list-items/index.d.ts +2 -0
- package/lib/organism/list-items/index.js +5 -1
- package/lib/organism/list-items/index.js.map +1 -1
- 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/activity/index.d.ts +36 -40
- package/lib/template/activity/index.d.ts.map +1 -1
- package/lib/template/activity/index.js +95 -110
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/stars-summary.d.ts +9 -18
- package/lib/template/activity/stars-summary.d.ts.map +1 -1
- package/lib/template/activity/stars-summary.js +90 -119
- package/lib/template/activity/stars-summary.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +56 -0
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +13 -3
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/back-office/brand-update/style.css +5 -1
- 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/lib/util/button-icons.d.ts +1 -0
- package/lib/util/button-icons.d.ts.map +1 -1
- package/lib/util/button-icons.js +2 -1
- package/lib/util/button-icons.js.map +1 -1
- package/locales/bs/global.json +8 -1
- package/locales/cs/global.json +9 -1
- package/locales/de/global.json +9 -1
- package/locales/en/global.json +1 -1
- package/locales/es/global.json +9 -1
- package/locales/et/global.json +9 -1
- package/locales/fr/global.json +1 -1
- package/locales/hr/global.json +9 -1
- package/locales/hu/global.json +9 -1
- package/locales/hy/global.json +0 -1
- package/locales/it/global.json +9 -1
- package/locales/ja/global.json +9 -1
- package/locales/ko/global.json +9 -1
- package/locales/nl/global.json +9 -1
- package/locales/pl/global.json +9 -1
- package/locales/pt/global.json +9 -1
- package/locales/ro/global.json +9 -1
- package/locales/ru/global.json +1 -1
- package/locales/sk/global.json +9 -1
- package/locales/tl/global.json +9 -1
- package/locales/tr/global.json +9 -1
- package/locales/uk/global.json +9 -1
- package/locales/vi/global.json +9 -1
- package/locales/zh/global.json +9 -1
- package/locales/zh_TW/global.json +9 -1
- package/package.json +3 -3
|
@@ -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,QAA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I,KAAtB;IAA6B,IAAI,EAAC;EAAlC,GACGA,KADH,CADF,EAIGY,SAJH,CAPF,CADF;AAgBD,CApDD;;AAsDAf,UAAU,CAACsB,YAAX,GAA0B;EACxBV,IAAI,EAAElB,QAAQ,CAAC6B,iBAAT,CAA2BX;AADT,CAA1B;AAIAZ,UAAU,CAACwB,SAAX,2CAAuB;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-icons.d.ts","sourceRoot":"","sources":["../../src/util/button-icons.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button-icons.d.ts","sourceRoot":"","sources":["../../src/util/button-icons.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;EAiBE"}
|
package/es/util/button-icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NovaSolidRemoveAddAddCircle1 as AddIcon, NovaCompositionCoorpacademyAnalytics as AnalyticsIcon, NovaSolidContentEditionBin as BinIcon, NovaCompositionCoorpacademyBulletPoint as BulletPointIcon, NovaCompositionNavigationArrowLeft as ChevronLeftIcon, NovaCompositionNavigationArrowRight as ChevronRightIcon, NovaSolidStatusClose as CloseIcon, NovaSolidContentEditionPencilWrite as EditIcon, NovaCompositionCoorpacademyEye as EyeIcon, NovaSolidContentContentViewModule1 as ListIcon, NovaSolidLoginLogout1 as LogoutIcon, NovaSolidApplicationsWindowUpload3 as PublishIcon, NovaSolidComputersSdCard as SaveIcon, NovaLineLoginKey1 as KlfIcon, NovaSolidFilesFoldersFolders as FoldersIcon } from '@coorpacademy/nova-icons';
|
|
1
|
+
import { NovaSolidRemoveAddAddCircle1 as AddIcon, NovaCompositionCoorpacademyAnalytics as AnalyticsIcon, NovaSolidContentEditionBin as BinIcon, NovaCompositionCoorpacademyBulletPoint as BulletPointIcon, NovaCompositionNavigationArrowLeft as ChevronLeftIcon, NovaCompositionNavigationArrowRight as ChevronRightIcon, NovaSolidStatusClose as CloseIcon, NovaSolidContentEditionPencilWrite as EditIcon, NovaCompositionCoorpacademyEye as EyeIcon, NovaSolidContentContentViewModule1 as ListIcon, NovaSolidLoginLogout1 as LogoutIcon, NovaSolidApplicationsWindowUpload3 as PublishIcon, NovaSolidComputersSdCard as SaveIcon, NovaLineLoginKey1 as KlfIcon, NovaSolidFilesFoldersFolders as FoldersIcon, NovaSolidFilesBasicFileUpload2 as UploadIcon } from '@coorpacademy/nova-icons';
|
|
2
2
|
export const ICONS = {
|
|
3
3
|
add: AddIcon,
|
|
4
4
|
analytics: AnalyticsIcon,
|
|
@@ -14,6 +14,7 @@ export const ICONS = {
|
|
|
14
14
|
publish: PublishIcon,
|
|
15
15
|
save: SaveIcon,
|
|
16
16
|
see: EyeIcon,
|
|
17
|
-
folders: FoldersIcon
|
|
17
|
+
folders: FoldersIcon,
|
|
18
|
+
upload: UploadIcon
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=button-icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-icons.js","names":["NovaSolidRemoveAddAddCircle1","AddIcon","NovaCompositionCoorpacademyAnalytics","AnalyticsIcon","NovaSolidContentEditionBin","BinIcon","NovaCompositionCoorpacademyBulletPoint","BulletPointIcon","NovaCompositionNavigationArrowLeft","ChevronLeftIcon","NovaCompositionNavigationArrowRight","ChevronRightIcon","NovaSolidStatusClose","CloseIcon","NovaSolidContentEditionPencilWrite","EditIcon","NovaCompositionCoorpacademyEye","EyeIcon","NovaSolidContentContentViewModule1","ListIcon","NovaSolidLoginLogout1","LogoutIcon","NovaSolidApplicationsWindowUpload3","PublishIcon","NovaSolidComputersSdCard","SaveIcon","NovaLineLoginKey1","KlfIcon","NovaSolidFilesFoldersFolders","FoldersIcon","ICONS","add","analytics","bin","close","edit","key","list","logout","publish","save","see","folders"],"sources":["../../src/util/button-icons.js"],"sourcesContent":["import {\n NovaSolidRemoveAddAddCircle1 as AddIcon,\n NovaCompositionCoorpacademyAnalytics as AnalyticsIcon,\n NovaSolidContentEditionBin as BinIcon,\n NovaCompositionCoorpacademyBulletPoint as BulletPointIcon,\n NovaCompositionNavigationArrowLeft as ChevronLeftIcon,\n NovaCompositionNavigationArrowRight as ChevronRightIcon,\n NovaSolidStatusClose as CloseIcon,\n NovaSolidContentEditionPencilWrite as EditIcon,\n NovaCompositionCoorpacademyEye as EyeIcon,\n NovaSolidContentContentViewModule1 as ListIcon,\n NovaSolidLoginLogout1 as LogoutIcon,\n NovaSolidApplicationsWindowUpload3 as PublishIcon,\n NovaSolidComputersSdCard as SaveIcon,\n NovaLineLoginKey1 as KlfIcon,\n NovaSolidFilesFoldersFolders as FoldersIcon\n} from '@coorpacademy/nova-icons';\n\nexport const ICONS = {\n add: AddIcon,\n analytics: AnalyticsIcon,\n bin: BinIcon,\n 'bullet-point': BulletPointIcon,\n 'chevron-left': ChevronLeftIcon,\n 'chevron-right': ChevronRightIcon,\n close: CloseIcon,\n edit: EditIcon,\n key: KlfIcon,\n list: ListIcon,\n logout: LogoutIcon,\n publish: PublishIcon,\n save: SaveIcon,\n see: EyeIcon,\n folders: FoldersIcon\n};\n"],"mappings":"AAAA,SACEA,4BAA4B,IAAIC,OADlC,EAEEC,oCAAoC,IAAIC,aAF1C,EAGEC,0BAA0B,IAAIC,OAHhC,EAIEC,sCAAsC,IAAIC,eAJ5C,EAKEC,kCAAkC,IAAIC,eALxC,EAMEC,mCAAmC,IAAIC,gBANzC,EAOEC,oBAAoB,IAAIC,SAP1B,EAQEC,kCAAkC,IAAIC,QARxC,EASEC,8BAA8B,IAAIC,OATpC,EAUEC,kCAAkC,IAAIC,QAVxC,EAWEC,qBAAqB,IAAIC,UAX3B,EAYEC,kCAAkC,IAAIC,WAZxC,EAaEC,wBAAwB,IAAIC,QAb9B,EAcEC,iBAAiB,IAAIC,OAdvB,EAeEC,4BAA4B,IAAIC,WAflC,
|
|
1
|
+
{"version":3,"file":"button-icons.js","names":["NovaSolidRemoveAddAddCircle1","AddIcon","NovaCompositionCoorpacademyAnalytics","AnalyticsIcon","NovaSolidContentEditionBin","BinIcon","NovaCompositionCoorpacademyBulletPoint","BulletPointIcon","NovaCompositionNavigationArrowLeft","ChevronLeftIcon","NovaCompositionNavigationArrowRight","ChevronRightIcon","NovaSolidStatusClose","CloseIcon","NovaSolidContentEditionPencilWrite","EditIcon","NovaCompositionCoorpacademyEye","EyeIcon","NovaSolidContentContentViewModule1","ListIcon","NovaSolidLoginLogout1","LogoutIcon","NovaSolidApplicationsWindowUpload3","PublishIcon","NovaSolidComputersSdCard","SaveIcon","NovaLineLoginKey1","KlfIcon","NovaSolidFilesFoldersFolders","FoldersIcon","NovaSolidFilesBasicFileUpload2","UploadIcon","ICONS","add","analytics","bin","close","edit","key","list","logout","publish","save","see","folders","upload"],"sources":["../../src/util/button-icons.js"],"sourcesContent":["import {\n NovaSolidRemoveAddAddCircle1 as AddIcon,\n NovaCompositionCoorpacademyAnalytics as AnalyticsIcon,\n NovaSolidContentEditionBin as BinIcon,\n NovaCompositionCoorpacademyBulletPoint as BulletPointIcon,\n NovaCompositionNavigationArrowLeft as ChevronLeftIcon,\n NovaCompositionNavigationArrowRight as ChevronRightIcon,\n NovaSolidStatusClose as CloseIcon,\n NovaSolidContentEditionPencilWrite as EditIcon,\n NovaCompositionCoorpacademyEye as EyeIcon,\n NovaSolidContentContentViewModule1 as ListIcon,\n NovaSolidLoginLogout1 as LogoutIcon,\n NovaSolidApplicationsWindowUpload3 as PublishIcon,\n NovaSolidComputersSdCard as SaveIcon,\n NovaLineLoginKey1 as KlfIcon,\n NovaSolidFilesFoldersFolders as FoldersIcon,\n NovaSolidFilesBasicFileUpload2 as UploadIcon\n} from '@coorpacademy/nova-icons';\n\nexport const ICONS = {\n add: AddIcon,\n analytics: AnalyticsIcon,\n bin: BinIcon,\n 'bullet-point': BulletPointIcon,\n 'chevron-left': ChevronLeftIcon,\n 'chevron-right': ChevronRightIcon,\n close: CloseIcon,\n edit: EditIcon,\n key: KlfIcon,\n list: ListIcon,\n logout: LogoutIcon,\n publish: PublishIcon,\n save: SaveIcon,\n see: EyeIcon,\n folders: FoldersIcon,\n upload: UploadIcon\n};\n"],"mappings":"AAAA,SACEA,4BAA4B,IAAIC,OADlC,EAEEC,oCAAoC,IAAIC,aAF1C,EAGEC,0BAA0B,IAAIC,OAHhC,EAIEC,sCAAsC,IAAIC,eAJ5C,EAKEC,kCAAkC,IAAIC,eALxC,EAMEC,mCAAmC,IAAIC,gBANzC,EAOEC,oBAAoB,IAAIC,SAP1B,EAQEC,kCAAkC,IAAIC,QARxC,EASEC,8BAA8B,IAAIC,OATpC,EAUEC,kCAAkC,IAAIC,QAVxC,EAWEC,qBAAqB,IAAIC,UAX3B,EAYEC,kCAAkC,IAAIC,WAZxC,EAaEC,wBAAwB,IAAIC,QAb9B,EAcEC,iBAAiB,IAAIC,OAdvB,EAeEC,4BAA4B,IAAIC,WAflC,EAgBEC,8BAA8B,IAAIC,UAhBpC,QAiBO,0BAjBP;AAmBA,OAAO,MAAMC,KAAK,GAAG;EACnBC,GAAG,EAAEhC,OADc;EAEnBiC,SAAS,EAAE/B,aAFQ;EAGnBgC,GAAG,EAAE9B,OAHc;EAInB,gBAAgBE,eAJG;EAKnB,gBAAgBE,eALG;EAMnB,iBAAiBE,gBANE;EAOnByB,KAAK,EAAEvB,SAPY;EAQnBwB,IAAI,EAAEtB,QARa;EASnBuB,GAAG,EAAEX,OATc;EAUnBY,IAAI,EAAEpB,QAVa;EAWnBqB,MAAM,EAAEnB,UAXW;EAYnBoB,OAAO,EAAElB,WAZU;EAanBmB,IAAI,EAAEjB,QAba;EAcnBkB,GAAG,EAAE1B,OAdc;EAenB2B,OAAO,EAAEf,WAfU;EAgBnBgB,MAAM,EAAEd;AAhBW,CAAd"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ColorValue } from 'react-native';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
color?: ColorValue;
|
|
5
|
+
height?: number;
|
|
6
|
+
readyToHide: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const Loader: (props: Props) => JSX.Element | null;
|
|
9
|
+
export default Loader;
|
|
10
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/loader/index.native.tsx"],"names":[],"mappings":";AAEA,OAAO,EAA0C,UAAU,EAAC,MAAM,cAAc,CAAC;AAoCjF,oBAAY,KAAK,GAAG;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAKF,QAAA,MAAM,MAAM,UAAW,KAAK,uBAqK3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
var _templateContext = require("../../template/app-review/template-context");
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
const createStyleSheet = theme => _reactNative.StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center'
|
|
22
|
+
},
|
|
23
|
+
dot: {
|
|
24
|
+
position: 'absolute'
|
|
25
|
+
},
|
|
26
|
+
blue: {
|
|
27
|
+
backgroundColor: theme.colors.cta
|
|
28
|
+
},
|
|
29
|
+
red: {
|
|
30
|
+
backgroundColor: theme.colors.negative
|
|
31
|
+
},
|
|
32
|
+
green: {
|
|
33
|
+
backgroundColor: theme.colors.positive
|
|
34
|
+
},
|
|
35
|
+
yellow: {
|
|
36
|
+
backgroundColor: theme.colors.battle
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const CYCLE_DURATION = 3000;
|
|
41
|
+
const MIN_TIME = 1000;
|
|
42
|
+
|
|
43
|
+
const Loader = props => {
|
|
44
|
+
const templateContext = (0, _templateContext.useTemplateContext)();
|
|
45
|
+
const {
|
|
46
|
+
theme
|
|
47
|
+
} = templateContext;
|
|
48
|
+
const [styleSheet, setStylesheet] = (0, _react.useState)(null);
|
|
49
|
+
const [visible, setVisible] = (0, _react.useState)(true);
|
|
50
|
+
const [minTimeIsSpent, setMinTimeSpent] = (0, _react.useState)(false);
|
|
51
|
+
const rotation = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
52
|
+
const scale = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
53
|
+
const hideAnimation = (0, _reactNativeAnimation.useAnimateProp)({
|
|
54
|
+
property: 'opacity',
|
|
55
|
+
fromValue: 1,
|
|
56
|
+
toValue: 0
|
|
57
|
+
});
|
|
58
|
+
const {
|
|
59
|
+
height = 60,
|
|
60
|
+
color,
|
|
61
|
+
readyToHide
|
|
62
|
+
} = props;
|
|
63
|
+
(0, _react.useEffect)(() => {
|
|
64
|
+
const _stylesheet = createStyleSheet(theme);
|
|
65
|
+
|
|
66
|
+
setStylesheet(_stylesheet);
|
|
67
|
+
}, [theme]);
|
|
68
|
+
(0, _react.useEffect)(() => {
|
|
69
|
+
if (readyToHide && minTimeIsSpent) {
|
|
70
|
+
setVisible(false);
|
|
71
|
+
}
|
|
72
|
+
}, [readyToHide, minTimeIsSpent]);
|
|
73
|
+
(0, _react.useEffect)(() => {
|
|
74
|
+
if (!visible) {
|
|
75
|
+
hideAnimation.start();
|
|
76
|
+
}
|
|
77
|
+
}, [visible, hideAnimation]);
|
|
78
|
+
(0, _react.useEffect)(() => {
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
setMinTimeSpent(true);
|
|
81
|
+
}, MIN_TIME);
|
|
82
|
+
|
|
83
|
+
const _animation = _reactNative.Animated.parallel([_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(scale, {
|
|
84
|
+
toValue: 0,
|
|
85
|
+
duration: 0,
|
|
86
|
+
useNativeDriver: false
|
|
87
|
+
}), _reactNative.Animated.timing(scale, {
|
|
88
|
+
toValue: 1,
|
|
89
|
+
duration: CYCLE_DURATION,
|
|
90
|
+
useNativeDriver: false,
|
|
91
|
+
easing: _reactNative.Easing.inOut(_reactNative.Easing.sin)
|
|
92
|
+
}), _reactNative.Animated.timing(scale, {
|
|
93
|
+
toValue: 2,
|
|
94
|
+
duration: CYCLE_DURATION,
|
|
95
|
+
useNativeDriver: false,
|
|
96
|
+
easing: _reactNative.Easing.inOut(_reactNative.Easing.sin)
|
|
97
|
+
}), _reactNative.Animated.timing(scale, {
|
|
98
|
+
toValue: 3,
|
|
99
|
+
duration: CYCLE_DURATION,
|
|
100
|
+
useNativeDriver: false,
|
|
101
|
+
easing: _reactNative.Easing.inOut(_reactNative.Easing.sin)
|
|
102
|
+
})])), _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(rotation, {
|
|
103
|
+
toValue: 0,
|
|
104
|
+
duration: 0,
|
|
105
|
+
useNativeDriver: false
|
|
106
|
+
}), _reactNative.Animated.timing(rotation, {
|
|
107
|
+
toValue: 1,
|
|
108
|
+
duration: CYCLE_DURATION,
|
|
109
|
+
useNativeDriver: false,
|
|
110
|
+
easing: _reactNative.Easing.inOut(_reactNative.Easing.sin)
|
|
111
|
+
})]))]);
|
|
112
|
+
|
|
113
|
+
_animation.start();
|
|
114
|
+
|
|
115
|
+
return () => {
|
|
116
|
+
_animation.stop();
|
|
117
|
+
}; // eslint bad warning --> effect only onmount
|
|
118
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
if (!styleSheet) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const interpolatedScale = scale.interpolate({
|
|
126
|
+
inputRange: [0, 0.45, 1, 1.32, 1.5, 2, 2.3, 2.64, 3],
|
|
127
|
+
outputRange: [0.5, 0.2, 0.5, 0.5, 0.8, 0.5, 0.5, 0.3, 0.5]
|
|
128
|
+
});
|
|
129
|
+
const interpolatedRotation = rotation.interpolate({
|
|
130
|
+
inputRange: [0, 1],
|
|
131
|
+
outputRange: ['0deg', '360deg']
|
|
132
|
+
});
|
|
133
|
+
const dotWidth = rotation.interpolate({
|
|
134
|
+
inputRange: [0, 0.5, 1],
|
|
135
|
+
outputRange: [height / 2, height / 6, height / 2]
|
|
136
|
+
});
|
|
137
|
+
const dotTranslate = rotation.interpolate({
|
|
138
|
+
inputRange: [0, 0.5, 1],
|
|
139
|
+
outputRange: [-25 * (height / 60), -35 * (height / 60), -25 * (height / 60)]
|
|
140
|
+
});
|
|
141
|
+
const dotStyle = {
|
|
142
|
+
width: dotWidth,
|
|
143
|
+
height: height / 6,
|
|
144
|
+
borderRadius: height / 12
|
|
145
|
+
};
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
147
|
+
style: hideAnimation.animatedStyle
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
149
|
+
style: [styleSheet.container, {
|
|
150
|
+
height,
|
|
151
|
+
width: height,
|
|
152
|
+
transform: [{
|
|
153
|
+
scaleX: interpolatedScale
|
|
154
|
+
}, {
|
|
155
|
+
scaleY: interpolatedScale
|
|
156
|
+
}, {
|
|
157
|
+
rotateZ: interpolatedRotation
|
|
158
|
+
}]
|
|
159
|
+
}]
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
161
|
+
style: [styleSheet.dot, color ? {
|
|
162
|
+
backgroundColor: color
|
|
163
|
+
} : styleSheet.red, dotStyle, {
|
|
164
|
+
transform: [{
|
|
165
|
+
rotateZ: '45deg'
|
|
166
|
+
}, {
|
|
167
|
+
translateX: dotTranslate
|
|
168
|
+
}]
|
|
169
|
+
}]
|
|
170
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
171
|
+
style: [styleSheet.dot, color ? {
|
|
172
|
+
backgroundColor: color
|
|
173
|
+
} : styleSheet.green, dotStyle, {
|
|
174
|
+
transform: [{
|
|
175
|
+
rotateZ: '135deg'
|
|
176
|
+
}, {
|
|
177
|
+
translateX: dotTranslate
|
|
178
|
+
}]
|
|
179
|
+
}]
|
|
180
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
181
|
+
style: [styleSheet.dot, color ? {
|
|
182
|
+
backgroundColor: color
|
|
183
|
+
} : styleSheet.yellow, dotStyle, {
|
|
184
|
+
transform: [{
|
|
185
|
+
rotateZ: '225deg'
|
|
186
|
+
}, {
|
|
187
|
+
translateX: dotTranslate
|
|
188
|
+
}]
|
|
189
|
+
}]
|
|
190
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
191
|
+
style: [styleSheet.dot, color ? {
|
|
192
|
+
backgroundColor: color
|
|
193
|
+
} : styleSheet.blue, dotStyle, {
|
|
194
|
+
transform: [{
|
|
195
|
+
rotateZ: '315deg'
|
|
196
|
+
}, {
|
|
197
|
+
translateX: dotTranslate
|
|
198
|
+
}]
|
|
199
|
+
}]
|
|
200
|
+
})));
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
var _default = Loader;
|
|
204
|
+
exports.default = _default;
|
|
205
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["createStyleSheet","theme","StyleSheet","create","container","alignItems","justifyContent","dot","position","blue","backgroundColor","colors","cta","red","negative","green","positive","yellow","battle","CYCLE_DURATION","MIN_TIME","Loader","props","templateContext","useTemplateContext","styleSheet","setStylesheet","useState","visible","setVisible","minTimeIsSpent","setMinTimeSpent","rotation","useRef","Animated","Value","current","scale","hideAnimation","useAnimateProp","property","fromValue","toValue","height","color","readyToHide","useEffect","_stylesheet","start","setTimeout","_animation","parallel","loop","sequence","timing","duration","useNativeDriver","easing","Easing","inOut","sin","stop","interpolatedScale","interpolate","inputRange","outputRange","interpolatedRotation","dotWidth","dotTranslate","dotStyle","width","borderRadius","animatedStyle","transform","scaleX","scaleY","rotateZ","translateX"],"sources":["../../../src/atom/loader/index.native.tsx"],"sourcesContent":["import {useAnimateProp} from '@coorpacademy/react-native-animation';\nimport React, {useEffect, useRef, useState} from 'react';\nimport {Animated, StyleSheet, Easing, ViewStyle, ColorValue} from 'react-native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\n\ntype StyleSheetType = {\n container: ViewStyle;\n dot: ViewStyle;\n blue: ViewStyle;\n red: ViewStyle;\n green: ViewStyle;\n yellow: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n container: {\n alignItems: 'center',\n justifyContent: 'center'\n },\n dot: {\n position: 'absolute'\n },\n blue: {\n backgroundColor: theme.colors.cta\n },\n red: {\n backgroundColor: theme.colors.negative\n },\n green: {\n backgroundColor: theme.colors.positive\n },\n yellow: {\n backgroundColor: theme.colors.battle\n }\n });\n\nexport type Props = {\n color?: ColorValue;\n height?: number;\n readyToHide: boolean;\n};\n\nconst CYCLE_DURATION = 3000;\nconst MIN_TIME = 1000;\n\nconst Loader = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const [visible, setVisible] = useState<boolean>(true);\n const [minTimeIsSpent, setMinTimeSpent] = useState<boolean>(false);\n\n const rotation = useRef<Animated.Value>(new Animated.Value(0)).current;\n const scale = useRef<Animated.Value>(new Animated.Value(0)).current;\n\n const hideAnimation = useAnimateProp({\n property: 'opacity',\n fromValue: 1,\n toValue: 0\n });\n\n const {height = 60, color, readyToHide} = props;\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n useEffect(() => {\n if (readyToHide && minTimeIsSpent) {\n setVisible(false);\n }\n }, [readyToHide, minTimeIsSpent]);\n\n useEffect(() => {\n if (!visible) {\n hideAnimation.start();\n }\n }, [visible, hideAnimation]);\n\n useEffect(() => {\n setTimeout(() => {\n setMinTimeSpent(true);\n }, MIN_TIME);\n\n const _animation = Animated.parallel([\n Animated.loop(\n Animated.sequence([\n Animated.timing(scale, {toValue: 0, duration: 0, useNativeDriver: false}),\n Animated.timing(scale, {\n toValue: 1,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n }),\n Animated.timing(scale, {\n toValue: 2,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n }),\n Animated.timing(scale, {\n toValue: 3,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n })\n ])\n ),\n Animated.loop(\n Animated.sequence([\n Animated.timing(rotation, {toValue: 0, duration: 0, useNativeDriver: false}),\n Animated.timing(rotation, {\n toValue: 1,\n duration: CYCLE_DURATION,\n useNativeDriver: false,\n easing: Easing.inOut(Easing.sin)\n })\n ])\n )\n ]);\n\n _animation.start();\n\n return () => {\n _animation.stop();\n };\n // eslint bad warning --> effect only onmount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n if (!styleSheet) {\n return null;\n }\n\n const interpolatedScale = scale.interpolate({\n inputRange: [0, 0.45, 1, 1.32, 1.5, 2, 2.3, 2.64, 3],\n outputRange: [0.5, 0.2, 0.5, 0.5, 0.8, 0.5, 0.5, 0.3, 0.5]\n });\n\n const interpolatedRotation = rotation.interpolate({\n inputRange: [0, 1],\n outputRange: ['0deg', '360deg']\n });\n const dotWidth = rotation.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [height / 2, height / 6, height / 2]\n });\n const dotTranslate = rotation.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [-25 * (height / 60), -35 * (height / 60), -25 * (height / 60)]\n });\n const dotStyle = {\n width: dotWidth,\n height: height / 6,\n borderRadius: height / 12\n };\n\n return (\n <Animated.View style={hideAnimation.animatedStyle}>\n <Animated.View\n style={[\n styleSheet.container,\n {\n height,\n width: height,\n transform: [\n {scaleX: interpolatedScale},\n {scaleY: interpolatedScale},\n {rotateZ: interpolatedRotation}\n ]\n }\n ]}\n >\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.red,\n dotStyle,\n {transform: [{rotateZ: '45deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.green,\n dotStyle,\n {transform: [{rotateZ: '135deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.yellow,\n dotStyle,\n {transform: [{rotateZ: '225deg'}, {translateX: dotTranslate}]}\n ]}\n />\n <Animated.View\n style={[\n styleSheet.dot,\n color ? {backgroundColor: color} : styleSheet.blue,\n dotStyle,\n {transform: [{rotateZ: '315deg'}, {translateX: dotTranslate}]}\n ]}\n />\n </Animated.View>\n </Animated.View>\n );\n};\n\nexport default Loader;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAYA,MAAMA,gBAAgB,GAAIC,KAAD,IACvBC,uBAAA,CAAWC,MAAX,CAAkB;EAChBC,SAAS,EAAE;IACTC,UAAU,EAAE,QADH;IAETC,cAAc,EAAE;EAFP,CADK;EAKhBC,GAAG,EAAE;IACHC,QAAQ,EAAE;EADP,CALW;EAQhBC,IAAI,EAAE;IACJC,eAAe,EAAET,KAAK,CAACU,MAAN,CAAaC;EAD1B,CARU;EAWhBC,GAAG,EAAE;IACHH,eAAe,EAAET,KAAK,CAACU,MAAN,CAAaG;EAD3B,CAXW;EAchBC,KAAK,EAAE;IACLL,eAAe,EAAET,KAAK,CAACU,MAAN,CAAaK;EADzB,CAdS;EA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SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAqB;QAACC,UAAU,EAAET;MAAb,CAArB;IAAZ,CAJK;EADT,EAdF,eAsBE,6BAAC,qBAAD,CAAU,IAAV;IACE,KAAK,EAAE,CACL3C,UAAU,CAAClB,GADN,EAELqC,KAAK,GAAG;MAAClC,eAAe,EAAEkC;IAAlB,CAAH,GAA8BnB,UAAU,CAACV,KAFzC,EAGLsD,QAHK,EAIL;MAACI,SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAsB;QAACC,UAAU,EAAET;MAAb,CAAtB;IAAZ,CAJK;EADT,EAtBF,eA8BE,6BAAC,qBAAD,CAAU,IAAV;IACE,KAAK,EAAE,CACL3C,UAAU,CAAClB,GADN,EAELqC,KAAK,GAAG;MAAClC,eAAe,EAAEkC;IAAlB,CAAH,GAA8BnB,UAAU,CAACR,MAFzC,EAGLoD,QAHK,EAIL;MAACI,SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAsB;QAACC,UAAU,EAAET;MAAb,CAAtB;IAAZ,CAJK;EADT,EA9BF,eAsCE,6BAAC,qBAAD,CAAU,IAAV;IACE,KAAK,EAAE,CACL3C,UAAU,CAAClB,GADN,EAELqC,KAAK,GAAG;MAAClC,eAAe,EAAEkC;IAAlB,CAAH,GAA8BnB,UAAU,CAAChB,IAFzC,EAGL4D,QAHK,EAIL;MAACI,SAAS,EAAE,CAAC;QAACG,OAAO,EAAE;MAAV,CAAD,EAAsB;QAACC,UAAU,EAAET;MAAb,CAAtB;IAAZ,CAJK;EADT,EAtCF,CADF,CADF;AAmDD,CArKD;;eAuKe/C,M"}
|
|
@@ -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"));
|
|
@@ -54,10 +60,35 @@ const themeStyle = {
|
|
|
54
60
|
coorpmanager: null
|
|
55
61
|
};
|
|
56
62
|
|
|
63
|
+
const ArrowView = ({
|
|
64
|
+
shouldRender,
|
|
65
|
+
isArrowUp,
|
|
66
|
+
ariaLabel,
|
|
67
|
+
arrowClass,
|
|
68
|
+
arrowColor
|
|
69
|
+
}) => {
|
|
70
|
+
const props = (0, _react.useMemo)(() => _extends({}, ariaLabel & {
|
|
71
|
+
'aria-label': ariaLabel
|
|
72
|
+
}, arrowColor & {
|
|
73
|
+
color: arrowColor
|
|
74
|
+
}, {
|
|
75
|
+
className: arrowClass
|
|
76
|
+
}), [ariaLabel, arrowClass, arrowColor]);
|
|
77
|
+
|
|
78
|
+
if (shouldRender) {
|
|
79
|
+
return isArrowUp ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowTop, _extends({}, props, {
|
|
80
|
+
"data-testid": "select-arrow-up-icon"
|
|
81
|
+
})) : /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, _extends({}, props, {
|
|
82
|
+
"data-testid": "select-arrow-down-icon"
|
|
83
|
+
}));
|
|
84
|
+
} else return null;
|
|
85
|
+
};
|
|
86
|
+
|
|
57
87
|
const Select = (props, legacyContext) => {
|
|
58
88
|
const {
|
|
59
89
|
name,
|
|
60
90
|
options = [],
|
|
91
|
+
optgroups = [],
|
|
61
92
|
className,
|
|
62
93
|
borderClassName,
|
|
63
94
|
onChange,
|
|
@@ -73,12 +104,23 @@ const Select = (props, legacyContext) => {
|
|
|
73
104
|
} = props;
|
|
74
105
|
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
75
106
|
const title = (0, _react.useMemo)(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
|
|
76
|
-
const
|
|
107
|
+
const [isArrowUp, setIsArrowUp] = (0, _react.useState)(false);
|
|
108
|
+
const handleSelectOnFocus = (0, _react.useCallback)(() => setIsArrowUp(true), []);
|
|
109
|
+
const handleSelectOnBlur = (0, _react.useCallback)(() => setIsArrowUp(false), []);
|
|
110
|
+
|
|
111
|
+
const selectOption = (option, index) => {
|
|
77
112
|
return /*#__PURE__*/_react.default.createElement("option", {
|
|
78
113
|
key: index,
|
|
79
114
|
value: option.value,
|
|
80
115
|
className: _style.default.selectOption
|
|
81
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)));
|
|
82
124
|
});
|
|
83
125
|
const titleView = title ? /*#__PURE__*/_react.default.createElement("span", {
|
|
84
126
|
className: _style.default.title
|
|
@@ -87,31 +129,28 @@ const Select = (props, legacyContext) => {
|
|
|
87
129
|
selected: true
|
|
88
130
|
}, options)) : (0, _get.default)('value', (0, _find.default)({
|
|
89
131
|
selected: true
|
|
90
|
-
}, options)), [multiple, options]);
|
|
132
|
+
}, (0, _concat.default)(options, (0, _flatMapDeep.default)('options', optgroups)))), [multiple, options, optgroups]);
|
|
91
133
|
const selectedLabel = (0, _react.useMemo)(() => multiple ? (0, _map.default)((0, _get.default)('name'), (0, _filter.default)({
|
|
92
134
|
selected: true
|
|
93
|
-
}, options)) : (0, _get.default)('
|
|
135
|
+
}, options)) : (0, _get.default)('value', (0, _find.default)({
|
|
94
136
|
selected: true
|
|
95
|
-
}, options)), [multiple, options]);
|
|
137
|
+
}, (0, _concat.default)(options, (0, _flatMapDeep.default)('options', optgroups)))), [multiple, options, optgroups]);
|
|
96
138
|
const isSelectedInValidOption = (0, _react.useMemo)(() => theme === 'player' && (0, _getOr.default)(false, 'name', (0, _find.default)({
|
|
97
139
|
validOption: false,
|
|
98
140
|
selected: true
|
|
99
141
|
}, options)), [options, theme]);
|
|
100
142
|
const handleChange = (0, _react.useMemo)(() => multiple ? e => {
|
|
143
|
+
setIsArrowUp(false);
|
|
101
144
|
onChange((0, _map.default)((0, _get.default)('value'), e.target.selectedOptions));
|
|
102
145
|
} : e => {
|
|
146
|
+
setIsArrowUp(false);
|
|
103
147
|
onChange(e.target.value);
|
|
104
148
|
}, [onChange, multiple]);
|
|
105
149
|
const black = (0, _react.useMemo)(() => (0, _getOr.default)('#14171A', 'common.black', skin), [skin]);
|
|
106
150
|
const color = (0, _react.useMemo)(() => (0, _getOr.default)('#00B0FF', 'common.primary', skin), [skin]);
|
|
107
|
-
const
|
|
151
|
+
const isThemeOneOfQuestionTemplateOrPlayer = (0, _react.useMemo)(() => (0, _includes.default)(theme, ['question', 'template', 'player']), [theme]);
|
|
152
|
+
const shouldUseSkinFontColor = (0, _react.useMemo)(() => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer, [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]);
|
|
108
153
|
const arrowColor = selected ? color : undefined;
|
|
109
|
-
const arrowView = !multiple ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationArrowDown, {
|
|
110
|
-
color: (0, _includes.default)(theme, ['question', 'template', 'player']) ? arrowColor : black,
|
|
111
|
-
className: shouldUseSkinFontColor ? _style.default.selectedArrow : _style.default.arrow,
|
|
112
|
-
"aria-label": ariaLabel,
|
|
113
|
-
"data-testid": "select-arrow-down-icon"
|
|
114
|
-
}) : null;
|
|
115
154
|
const behaviorClassName = (0, _react.useMemo)(() => (0, _getClassState.default)(_style.default.default, _style.default.modified, _style.default.error, modified, error), [error, modified]);
|
|
116
155
|
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]);
|
|
117
156
|
const labelSize = (0, _react.useMemo)(() => (0, _size.default)(selectedLabel), [selectedLabel]);
|
|
@@ -130,7 +169,13 @@ const Select = (props, legacyContext) => {
|
|
|
130
169
|
style: _extends({}, shouldUseSkinFontColor && {
|
|
131
170
|
color
|
|
132
171
|
})
|
|
133
|
-
}, selectedLabel),
|
|
172
|
+
}, selectedLabel), /*#__PURE__*/_react.default.createElement(ArrowView, {
|
|
173
|
+
shouldRender: !multiple,
|
|
174
|
+
isArrowUp: isArrowUp,
|
|
175
|
+
ariaLabel: ariaLabel,
|
|
176
|
+
arrowClass: shouldUseSkinFontColor ? _style.default.selectedArrow : _style.default.arrow,
|
|
177
|
+
arrowColor: isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black
|
|
178
|
+
}), /*#__PURE__*/_react.default.createElement("select", {
|
|
134
179
|
"data-name": "native-select",
|
|
135
180
|
className: _style.default.selectBox,
|
|
136
181
|
title: selectedLabel,
|
|
@@ -138,7 +183,14 @@ const Select = (props, legacyContext) => {
|
|
|
138
183
|
onChange: handleChange,
|
|
139
184
|
value: selected,
|
|
140
185
|
multiple: multiple,
|
|
141
|
-
disabled: disabled
|
|
186
|
+
disabled: disabled,
|
|
187
|
+
onClick: handleSelectOnFocus,
|
|
188
|
+
onBlur: handleSelectOnBlur // onBlur does not handle completely an out of bounds click
|
|
189
|
+
// ex: select is Opened and a click is done outside, cancelling the select
|
|
190
|
+
// that doesn't count as a Blur, so an onMouseLeave is needed
|
|
191
|
+
,
|
|
192
|
+
onMouseLeave: handleSelectOnBlur,
|
|
193
|
+
"data-testid": "native-select"
|
|
142
194
|
}, optionList)), /*#__PURE__*/_react.default.createElement("div", {
|
|
143
195
|
className: _style.default.description
|
|
144
196
|
}, description));
|
|
@@ -151,6 +203,11 @@ const SelectOptionPropTypes = {
|
|
|
151
203
|
validOption: _propTypes.default.bool
|
|
152
204
|
};
|
|
153
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;
|
|
154
211
|
Select.contextTypes = {
|
|
155
212
|
skin: _provider.default.childContextTypes.skin
|
|
156
213
|
};
|
|
@@ -166,6 +223,7 @@ Select.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
166
223
|
onChange: _propTypes.default.func,
|
|
167
224
|
theme: _propTypes.default.oneOf((0, _keys.default)(themeStyle)),
|
|
168
225
|
options: _propTypes.default.arrayOf(_propTypes.default.shape(SelectOptionPropTypes)),
|
|
226
|
+
optgroups: _propTypes.default.arrayOf(_propTypes.default.shape(SelectOptionGroupPropTypes)),
|
|
169
227
|
modified: _propTypes.default.bool,
|
|
170
228
|
error: _propTypes.default.bool,
|
|
171
229
|
'aria-label': _propTypes.default.string
|