@coorpacademy/components 11.9.2 → 11.9.3-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/review-presentation/index.d.ts.map +1 -1
- package/es/atom/review-presentation/index.js +12 -62
- package/es/atom/review-presentation/index.js.map +1 -1
- package/es/atom/review-presentation/style.css +7 -67
- package/es/atom/tooltip/index.d.ts +22 -0
- package/es/atom/tooltip/index.d.ts.map +1 -0
- package/es/atom/tooltip/index.js +117 -0
- package/es/atom/tooltip/index.js.map +1 -0
- package/es/atom/tooltip/style.css +96 -0
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +6 -3
- package/es/molecule/answer/index.js.map +1 -1
- package/es/template/activity/engine-stars.css +16 -33
- package/es/template/activity/engine-stars.d.ts +15 -17
- package/es/template/activity/engine-stars.d.ts.map +1 -1
- package/es/template/activity/engine-stars.js +128 -115
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/activity/index.d.ts +1 -0
- package/es/template/activity/index.d.ts.map +1 -1
- package/es/template/activity/index.js +18 -9
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/progression-item.js +1 -1
- package/es/template/activity/progression-item.js.map +1 -1
- package/es/template/activity/stars-summary.d.ts +1 -0
- package/es/template/activity/stars-summary.d.ts.map +1 -1
- package/es/template/activity/stars-summary.js +10 -5
- package/es/template/activity/stars-summary.js.map +1 -1
- package/lib/atom/review-presentation/index.d.ts.map +1 -1
- package/lib/atom/review-presentation/index.js +13 -66
- package/lib/atom/review-presentation/index.js.map +1 -1
- package/lib/atom/review-presentation/style.css +7 -67
- package/lib/atom/tooltip/index.d.ts +22 -0
- package/lib/atom/tooltip/index.d.ts.map +1 -0
- package/lib/atom/tooltip/index.js +137 -0
- package/lib/atom/tooltip/index.js.map +1 -0
- package/lib/atom/tooltip/style.css +96 -0
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +6 -3
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/template/activity/engine-stars.css +16 -33
- package/lib/template/activity/engine-stars.d.ts +15 -17
- package/lib/template/activity/engine-stars.d.ts.map +1 -1
- package/lib/template/activity/engine-stars.js +135 -116
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/activity/index.d.ts +1 -0
- package/lib/template/activity/index.d.ts.map +1 -1
- package/lib/template/activity/index.js +21 -9
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/progression-item.js +1 -1
- package/lib/template/activity/progression-item.js.map +1 -1
- package/lib/template/activity/stars-summary.d.ts +1 -0
- package/lib/template/activity/stars-summary.d.ts.map +1 -1
- package/lib/template/activity/stars-summary.js +10 -5
- package/lib/template/activity/stars-summary.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/th/global.json +90 -0
- package/locales/tl/global.json +1 -0
- package/locales/zh/global.json +1 -0
- package/locales/zh_TW/global.json +1 -0
- package/package.json +4 -3
|
@@ -27,6 +27,7 @@ const EngineTab = ({
|
|
|
27
27
|
key: type,
|
|
28
28
|
"data-name": dataName
|
|
29
29
|
}, /*#__PURE__*/React.createElement(EngineStars, _extends({}, engine, {
|
|
30
|
+
key: type,
|
|
30
31
|
className: engineIndex < firstItemIndex ? style.hidden : style.active
|
|
31
32
|
})));
|
|
32
33
|
};
|
|
@@ -81,11 +82,12 @@ const StarsSummary = (props, legacyContext) => {
|
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
const leftArrowView = totalItems > 6 && firstItemIndex > 0 ? /*#__PURE__*/React.createElement("
|
|
85
|
+
const leftArrowView = totalItems > 6 && firstItemIndex > 0 ? /*#__PURE__*/React.createElement("button", {
|
|
85
86
|
className: style.circle,
|
|
86
87
|
onClick: handleOnLeft,
|
|
87
88
|
"data-name": "left-arrow",
|
|
88
|
-
"data-testid": "stars-summary-left-arrow"
|
|
89
|
+
"data-testid": "stars-summary-left-arrow",
|
|
90
|
+
type: "button"
|
|
89
91
|
}, /*#__PURE__*/React.createElement(ArrowLeft, {
|
|
90
92
|
color: dark,
|
|
91
93
|
className: style.left,
|
|
@@ -105,15 +107,18 @@ const StarsSummary = (props, legacyContext) => {
|
|
|
105
107
|
})) : null;
|
|
106
108
|
return /*#__PURE__*/React.createElement("div", {
|
|
107
109
|
"data-name": "myStars",
|
|
108
|
-
className: style.myStars
|
|
110
|
+
className: style.myStars,
|
|
111
|
+
tabIndex: 0
|
|
109
112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
110
113
|
"data-name": "myStars-wrapper",
|
|
111
114
|
className: style.myStarsWrapper,
|
|
112
|
-
"data-testid": `stars-summary-engine-index-${firstItemIndex}
|
|
115
|
+
"data-testid": `stars-summary-engine-index-${firstItemIndex}`,
|
|
116
|
+
tabIndex: 0
|
|
113
117
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
114
118
|
className: style.allStars,
|
|
115
119
|
"data-name": "engineList",
|
|
116
|
-
"data-testid": "stars-summary-engine-tabs"
|
|
120
|
+
"data-testid": "stars-summary-engine-tabs",
|
|
121
|
+
tabIndex: 0
|
|
117
122
|
}, /*#__PURE__*/React.createElement(EngineTabs, {
|
|
118
123
|
engines: engines,
|
|
119
124
|
firstItemIndex: firstItemIndex
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stars-summary.js","names":["React","useCallback","useMemo","useState","PropTypes","NovaCompositionNavigationArrowLeft","ArrowLeft","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyStar","StarIcon","Provider","GetSkinFromContext","EngineStars","style","EngineTab","engine","engineIndex","firstItemIndex","type","state","dataName","hidden","active","propTypes","shape","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","setFirstItemIndex","totalItems","length","dark","primary","scrollTo","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","childContextTypes"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <div\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </div>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default StarsSummary;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,kCAAkC,IAAIC,SADxC,EAEEC,mCAAmC,IAAIC,UAFzC,EAGEC,+BAA+B,IAAIC,QAHrC,QAIO,0BAJP;AAKA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,qBAA3C;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;;AAEA,MAAMC,SAAS,GAAG,CAAC;EAACC,MAAD;EAASC,WAAT;EAAsBC;AAAtB,CAAD,KAA2C;EAC3D,MAAM;IAACC;EAAD,IAASH,MAAf;EACA,MAAMI,KAAK,GAAGlB,OAAO,CACnB,MAAOe,WAAW,GAAGC,cAAd,GAA+B,QAA/B,GAA0C,QAD9B,EAEnB,CAACD,WAAD,EAAcC,cAAd,CAFmB,CAArB;EAIA,MAAMG,QAAQ,GAAGnB,OAAO,CAAC,MAAO,GAAEiB,IAAK,UAASC,KAAM,EAA9B,EAAiC,CAACA,KAAD,EAAQD,IAAR,CAAjC,CAAxB;EAEA,oBACE;IAAI,SAAS,EAAEL,KAAK,CAACM,KAAD,CAApB;IAA6B,GAAG,EAAED,IAAlC;IAAwC,aAAWE;EAAnD,gBACE,oBAAC,WAAD,eACML,MADN;IAEE,SAAS,EAAEC,WAAW,GA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AAS,CAACqB,KAAV,CAAgBZ,WAAW,CAACW,SAA5B,CAAlB,EAA0DyC;AAL5C,CAAzB;AAQAhC,YAAY,CAACiC,YAAb,GAA4B;EAC1B7B,IAAI,EAAE1B,QAAQ,CAACwD,iBAAT,CAA2B9B;AADP,CAA5B;AAIA,eAAeJ,YAAf"}
|
|
1
|
+
{"version":3,"file":"stars-summary.js","names":["React","useCallback","useMemo","useState","PropTypes","NovaCompositionNavigationArrowLeft","ArrowLeft","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyStar","StarIcon","Provider","GetSkinFromContext","EngineStars","style","EngineTab","engine","engineIndex","firstItemIndex","type","state","dataName","hidden","active","propTypes","shape","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","setFirstItemIndex","totalItems","length","dark","primary","scrollTo","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","childContextTypes"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n key={type}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <button\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n type=\"button\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </button>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars} tabIndex={0}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n tabIndex={0}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n tabIndex={0}\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default StarsSummary;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,kCAAkC,IAAIC,SADxC,EAEEC,mCAAmC,IAAIC,UAFzC,EAGEC,+BAA+B,IAAIC,QAHrC,QAIO,0BAJP;AAKA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,qBAA3C;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;;AAEA,MAAMC,SAAS,GAAG,CAAC;EAACC,MAAD;EAASC,WAAT;EAAsBC;AAAtB,CAAD,KAA2C;EAC3D,MAAM;IAACC;EAAD,IAASH,MAAf;EACA,MAAMI,KAAK,GAAGlB,OAAO,CACnB,MAAOe,WAAW,GAAGC,cAAd,GAA+B,QAA/B,GAA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K,EAAEnB;EAA9C,EADF,CAHF,CANF,eAaE;IAAK,SAAS,EAAE5B,KAAK,CAACgD;EAAtB,GAAuCf,aAAvC,CAbF,eAcE;IAAK,SAAS,EAAEjC,KAAK,CAACiD;EAAtB,GAAwCb,cAAxC,CAdF,CAdF,CADF,CADF;AAmCD,CApFD;;AAsFAjB,YAAY,CAACT,SAAb,2CAAyB;EACvBY,KAAK,EAAEhC,SAAS,CAACqB,KAAV,CAAgB;IACrBiC,KAAK,EAAEtD,SAAS,CAAC4D,MAAV,CAAiBC,UADH;IAErBN,KAAK,EAAEvD,SAAS,CAACsB,MAAV,CAAiBuC;EAFH,CAAhB,EAGJA,UAJoB;EAKvBrC,OAAO,EAAExB,SAAS,CAAC4B,OAAV,CAAkB5B,SAAS,CAACqB,KAAV,CAAgBZ,WAAW,CAACW,SAA5B,CAAlB,EAA0DyC;AAL5C,CAAzB;AAQAhC,YAAY,CAACiC,YAAb,GAA4B;EAC1B7B,IAAI,EAAE1B,QAAQ,CAACwD,iBAAT,CAA2B9B;AADP,CAA5B;AAIA,eAAeJ,YAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-presentation/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-presentation/index.js"],"names":[],"mappings":";AA+CA,6DA+BC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
5
|
|
|
6
|
-
var _react =
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
@@ -13,18 +13,14 @@ var _map = _interopRequireDefault(require("lodash/fp/map"));
|
|
|
13
13
|
|
|
14
14
|
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
15
15
|
|
|
16
|
+
var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
17
|
+
|
|
16
18
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
17
19
|
|
|
18
20
|
var _propTypes2 = _interopRequireDefault(require("./prop-types"));
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
-
|
|
28
24
|
const ICONS = {
|
|
29
25
|
skills: _novaIcons.NovaLineSelectionCursorsCursorArrowTarget,
|
|
30
26
|
questions: _novaIcons.NovaSolidInterfaceFeedbackInterfaceQuestionMark,
|
|
@@ -49,50 +45,6 @@ const ReviewIcon = ({
|
|
|
49
45
|
});
|
|
50
46
|
};
|
|
51
47
|
|
|
52
|
-
const ToolTip = ({
|
|
53
|
-
tooltipText,
|
|
54
|
-
'aria-label': moreDetailsAriaLabel,
|
|
55
|
-
'data-testid': dataTestId,
|
|
56
|
-
closeToolTipInformationTextAriaLabel
|
|
57
|
-
}) => {
|
|
58
|
-
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
59
|
-
const handleKeyPress = (0, _react.useCallback)(event => {
|
|
60
|
-
if (event.key === 'Enter') {
|
|
61
|
-
setToolTipIsVisible(!toolTipIsVisible);
|
|
62
|
-
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
63
|
-
setToolTipIsVisible(false);
|
|
64
|
-
}
|
|
65
|
-
}, [setToolTipIsVisible, toolTipIsVisible]);
|
|
66
|
-
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
67
|
-
setToolTipIsVisible(true);
|
|
68
|
-
}, [setToolTipIsVisible]);
|
|
69
|
-
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
70
|
-
setToolTipIsVisible(false);
|
|
71
|
-
}, [setToolTipIsVisible]);
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
73
|
-
className: _style.default.tooltipContainer,
|
|
74
|
-
onMouseLeave: handleMouseLeave,
|
|
75
|
-
onMouseOver: handleMouseOver
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
77
|
-
type: "button",
|
|
78
|
-
className: _style.default.tooltipIconContainer,
|
|
79
|
-
"data-testid": dataTestId,
|
|
80
|
-
onKeyDown: handleKeyPress,
|
|
81
|
-
tabIndex: 0
|
|
82
|
-
}, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
|
|
83
|
-
className: _style.default.informationIcon,
|
|
84
|
-
width: 12,
|
|
85
|
-
height: 12,
|
|
86
|
-
"aria-label": moreDetailsAriaLabel
|
|
87
|
-
})), toolTipIsVisible ? /*#__PURE__*/_react.default.createElement("div", {
|
|
88
|
-
className: _style.default.toolTip,
|
|
89
|
-
"data-testid": "review-presentation-tooltip",
|
|
90
|
-
"aria-label": closeToolTipInformationTextAriaLabel
|
|
91
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
92
|
-
className: _style.default.tooltipText
|
|
93
|
-
}, tooltipText)) : null);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
48
|
const ReviewListItemWrapper = ({
|
|
97
49
|
iconKey,
|
|
98
50
|
label
|
|
@@ -106,11 +58,11 @@ const ReviewListItemWrapper = ({
|
|
|
106
58
|
className: _style.default.reviewListText
|
|
107
59
|
}, /*#__PURE__*/_react.default.createElement(ReviewIcon, {
|
|
108
60
|
icon: iconKey
|
|
109
|
-
}), " ", label.text), /*#__PURE__*/_react.default.createElement(
|
|
110
|
-
|
|
111
|
-
"aria-label": label.moreDetailsAriaLabel,
|
|
61
|
+
}), " ", label.text), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
62
|
+
TooltipContent: label.tooltipText,
|
|
112
63
|
closeToolTipInformationTextAriaLabel: label.closeToolTipInformationTextAriaLabel,
|
|
113
|
-
"data-testid": `review-list-item-tooltip-button-${iconKey}
|
|
64
|
+
"data-testid": `review-list-item-tooltip-button-${iconKey}`,
|
|
65
|
+
"aria-label": label.moreDetailsAriaLabel
|
|
114
66
|
}));
|
|
115
67
|
};
|
|
116
68
|
|
|
@@ -153,23 +105,18 @@ const ReviewPresentation = props => {
|
|
|
153
105
|
}, labelsList)));
|
|
154
106
|
};
|
|
155
107
|
|
|
156
|
-
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
157
|
-
tooltipText: _propTypes.default.string,
|
|
158
|
-
'aria-label': _propTypes.default.string,
|
|
159
|
-
'data-testid': _propTypes.default.string,
|
|
160
|
-
closeToolTipInformationTextAriaLabel: _propTypes.default.string
|
|
161
|
-
} : {};
|
|
162
108
|
ReviewIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
163
109
|
icon: _propTypes.default.string
|
|
164
110
|
} : {};
|
|
165
|
-
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ?
|
|
111
|
+
ReviewListItemWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
166
112
|
iconKey: _propTypes.default.string,
|
|
167
113
|
label: _propTypes.default.shape({
|
|
168
|
-
tooltipText:
|
|
169
|
-
moreDetailsAriaLabel:
|
|
170
|
-
closeToolTipInformationTextAriaLabel:
|
|
114
|
+
tooltipText: _tooltip.default.propTypes.tooltipText,
|
|
115
|
+
moreDetailsAriaLabel: _tooltip.default.propTypes['aria-label'],
|
|
116
|
+
closeToolTipInformationTextAriaLabel: _tooltip.default.propTypes.closeToolTipInformationTextAriaLabel,
|
|
117
|
+
text: _propTypes.default.string
|
|
171
118
|
})
|
|
172
|
-
}
|
|
119
|
+
} : {};
|
|
173
120
|
ReviewPresentation.propTypes = process.env.NODE_ENV !== "production" ? _propTypes2.default : {};
|
|
174
121
|
var _default = ReviewPresentation;
|
|
175
122
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ICONS","skills","TargetIcon","questions","QuestionIcon","lifes","HeartIcon","allright","CheckIcon","ReviewIcon","icon","Icon","getOr","style","labelIcon","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ICONS","skills","TargetIcon","questions","QuestionIcon","lifes","HeartIcon","allright","CheckIcon","ReviewIcon","icon","Icon","getOr","style","labelIcon","ReviewListItemWrapper","iconKey","label","reviewListItemWrapper","reviewListText","text","tooltipText","closeToolTipInformationTextAriaLabel","moreDetailsAriaLabel","ReviewPresentation","props","ariaLabel","reviewTitle","reviewText","labelsList","reviewWrapper","__html","reviewListWrapper","map","convert","cap","key","reviewList","propTypes","PropTypes","string","shape","ToolTip"],"sources":["../../../src/atom/review-presentation/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport getOr from 'lodash/fp/getOr';\nimport map from 'lodash/fp/map';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidVoteRewardsVoteHeart as HeartIcon,\n NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon,\n NovaLineSelectionCursorsCursorArrowTarget as TargetIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip from '../tooltip';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst ICONS = {\n skills: TargetIcon,\n questions: QuestionIcon,\n lifes: HeartIcon,\n allright: CheckIcon\n};\n\nconst ReviewIcon = ({icon}) => {\n const Icon = getOr(null, icon, ICONS);\n\n /* istanbul ignore next */\n if (!Icon) {\n return <div className={style.labelIcon} />;\n }\n return <Icon className={style.labelIcon} />;\n};\n\nconst ReviewListItemWrapper = ({iconKey, label}) => {\n return (\n <div className={style.reviewListItemWrapper} data-tip data-for=\"reviewListItem\" tabIndex={0}>\n <div className={style.reviewListText}>\n <ReviewIcon icon={iconKey} /> {label.text}\n </div>\n <ToolTip\n TooltipContent={label.tooltipText}\n closeToolTipInformationTextAriaLabel={label.closeToolTipInformationTextAriaLabel}\n data-testid={`review-list-item-tooltip-button-${iconKey}`}\n aria-label={label.moreDetailsAriaLabel}\n />\n </div>\n );\n};\n\nconst ReviewPresentation = props => {\n const {'aria-label': ariaLabel, reviewTitle, reviewText, labelsList} = props;\n\n return (\n <div className={style.reviewWrapper} aria-label={ariaLabel}>\n <div\n className={style.reviewTitle}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewTitle}}\n />\n <div\n className={style.reviewText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewText}}\n />\n <ul className={style.reviewListWrapper}>\n {map.convert({cap: false})((label, key) => {\n return (\n <li key={`step-${key}`} className={style.reviewList}>\n <ReviewListItemWrapper\n iconKey={key}\n label={label}\n tooltipText={label.tooltipText}\n aria-label={label.moreDetailsAriaLabel}\n />\n </li>\n );\n }, labelsList)}\n </ul>\n </div>\n );\n};\n\nReviewIcon.propTypes = {\n icon: PropTypes.string\n};\n\nReviewListItemWrapper.propTypes = {\n iconKey: PropTypes.string,\n label: PropTypes.shape({\n tooltipText: ToolTip.propTypes.tooltipText,\n moreDetailsAriaLabel: ToolTip.propTypes['aria-label'],\n closeToolTipInformationTextAriaLabel: ToolTip.propTypes.closeToolTipInformationTextAriaLabel,\n text: PropTypes.string\n })\n};\n\nReviewPresentation.propTypes = propTypes;\n\nexport default ReviewPresentation;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,MAAM,EAAEC,oDADI;EAEZC,SAAS,EAAEC,0DAFC;EAGZC,KAAK,EAAEC,wCAHK;EAIZC,QAAQ,EAAEC;AAJE,CAAd;;AAOA,MAAMC,UAAU,GAAG,CAAC;EAACC;AAAD,CAAD,KAAY;EAC7B,MAAMC,IAAI,GAAG,IAAAC,cAAA,EAAM,IAAN,EAAYF,IAAZ,EAAkBV,KAAlB,CAAb;EAEA;;EACA,IAAI,CAACW,IAAL,EAAW;IACT,oBAAO;MAAK,SAAS,EAAEE,cAAA,CAAMC;IAAtB,EAAP;EACD;;EACD,oBAAO,6BAAC,IAAD;IAAM,SAAS,EAAED,cAAA,CAAMC;EAAvB,EAAP;AACD,CARD;;AAUA,MAAMC,qBAAqB,GAAG,CAAC;EAACC,OAAD;EAAUC;AAAV,CAAD,KAAsB;EAClD,oBACE;IAAK,SAAS,EAAEJ,cAAA,CAAMK,qBAAtB;IAA6C,gBAA7C;IAAsD,YAAS,gBAA/D;IAAgF,QAAQ,EAAE;EAA1F,gBACE;IAAK,SAAS,EAAEL,cAAA,CAAMM;EAAtB,gBACE,6BAAC,UAAD;IAAY,IAAI,EAAEH;EAAlB,EADF,OACiCC,KAAK,CAACG,IADvC,CADF,eAIE,6BAAC,gBAAD;IACE,cAAc,EAAEH,KAAK,CAACI,WADxB;IAEE,oCAAoC,EAAEJ,KAAK,CAACK,oCAF9C;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A,CAAQJ,SAAR,CAAkBjB,WADV;IAErBE,oBAAoB,EAAEmB,gBAAA,CAAQJ,SAAR,CAAkB,YAAlB,CAFD;IAGrBhB,oCAAoC,EAAEoB,gBAAA,CAAQJ,SAAR,CAAkBhB,oCAHnC;IAIrBF,IAAI,EAAEmB,kBAAA,CAAUC;EAJK,CAAhB;AAFyB,CAAlC;AAUAhB,kBAAkB,CAACc,SAAnB,2CAA+BA,mBAA/B;eAEed,kB"}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
@value mobile from breakpoints;
|
|
4
4
|
@value colors: "../../variables/colors.css";
|
|
5
5
|
@value xtraLightGrey from colors;
|
|
6
|
-
@value cm_blue_900 from colors;
|
|
7
6
|
@value cm_grey_75 from colors;
|
|
8
|
-
@value cm_grey_500 from colors;
|
|
9
|
-
@value cm_grey_700 from colors;
|
|
10
|
-
@value white from colors;
|
|
11
7
|
|
|
8
|
+
.reviewWrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
border-radius: 16px;
|
|
11
|
+
background-color: xtraLightGrey;
|
|
12
|
+
padding-bottom: 40px;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
.textBase {
|
|
14
16
|
font-family: "Gilroy";
|
|
@@ -17,13 +19,6 @@
|
|
|
17
19
|
user-select: none;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
.reviewWrapper {
|
|
21
|
-
width: 100%;
|
|
22
|
-
border-radius: 16px;
|
|
23
|
-
background-color: xtraLightGrey;
|
|
24
|
-
padding-bottom: 40px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
.reviewTitle {
|
|
28
23
|
composes: textBase;
|
|
29
24
|
font-weight: 700;
|
|
@@ -77,61 +72,6 @@
|
|
|
77
72
|
width: 16px;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
|
-
.informationIcon {
|
|
81
|
-
color: cm_grey_500;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.toolTip {
|
|
85
|
-
transition: opacity 0.8s;
|
|
86
|
-
position: absolute;
|
|
87
|
-
height: auto;
|
|
88
|
-
width: 200px;
|
|
89
|
-
border-radius: 7px;
|
|
90
|
-
background-color: cm_grey_700;
|
|
91
|
-
right: -81px;
|
|
92
|
-
bottom: 32px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.toolTip::before {
|
|
96
|
-
content: '';
|
|
97
|
-
display: inline-block;
|
|
98
|
-
visibility: inherit;
|
|
99
|
-
opacity: inherit;
|
|
100
|
-
width: 15px;
|
|
101
|
-
height: 15px;
|
|
102
|
-
transform: rotate(-45deg);
|
|
103
|
-
background-color: cm_grey_700;
|
|
104
|
-
position: inherit;
|
|
105
|
-
bottom: -5px;
|
|
106
|
-
right: 40%;
|
|
107
|
-
border-radius: 2px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tooltipText {
|
|
111
|
-
composes: textBase;
|
|
112
|
-
font-weight: 500;
|
|
113
|
-
font-size: 14px;
|
|
114
|
-
display: inline-block;
|
|
115
|
-
border-radius: 3px;
|
|
116
|
-
word-wrap: break-word;
|
|
117
|
-
color: white;
|
|
118
|
-
padding: 8px 14px;
|
|
119
|
-
text-align: center;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.tooltipContainer {
|
|
123
|
-
overflow: visible;
|
|
124
|
-
position: relative;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.tooltipIconContainer {
|
|
128
|
-
display: flex;
|
|
129
|
-
justify-content: flex-end;
|
|
130
|
-
border: none;
|
|
131
|
-
background: cm_grey_75;
|
|
132
|
-
height: 25px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
75
|
@media tablet {
|
|
136
76
|
.reviewWrapper{
|
|
137
77
|
width: 100%;
|
|
@@ -142,4 +82,4 @@
|
|
|
142
82
|
.reviewWrapper{
|
|
143
83
|
width: 100%;
|
|
144
84
|
}
|
|
145
|
-
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
|
+
export default ToolTip;
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible }: {
|
|
4
|
+
anchorId: any;
|
|
5
|
+
TooltipContent: any;
|
|
6
|
+
"aria-label": any;
|
|
7
|
+
"data-testid": any;
|
|
8
|
+
closeToolTipInformationTextAriaLabel: any;
|
|
9
|
+
toolTipIsVisible: any;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
declare namespace ToolTip {
|
|
12
|
+
const propTypes: {
|
|
13
|
+
TooltipContent: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
|
|
14
|
+
'data-testid': PropTypes.Requireable<string>;
|
|
15
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
16
|
+
closeToolTipInformationTextAriaLabel: PropTypes.Validator<string>;
|
|
17
|
+
anchorId: PropTypes.Requireable<string>;
|
|
18
|
+
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
import PropTypes from "prop-types";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.toggleStateOnKeyPress = exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
|
|
11
|
+
|
|
12
|
+
var _isString = _interopRequireDefault(require("lodash/fp/isString"));
|
|
13
|
+
|
|
14
|
+
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
15
|
+
|
|
16
|
+
var _style = _interopRequireDefault(require("./style.css"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
const ToolTipWrapper = ({
|
|
25
|
+
toolTipIsVisible,
|
|
26
|
+
anchorId,
|
|
27
|
+
closeToolTipInformationTextAriaLabel,
|
|
28
|
+
content
|
|
29
|
+
}) => {
|
|
30
|
+
if (!toolTipIsVisible) return null;
|
|
31
|
+
|
|
32
|
+
if (anchorId) {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
|
|
34
|
+
id: anchorId,
|
|
35
|
+
className: _style.default.toolTipReact,
|
|
36
|
+
"data-event-off": "click",
|
|
37
|
+
place: "left",
|
|
38
|
+
effect: "solid",
|
|
39
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
40
|
+
}, content);
|
|
41
|
+
} else {
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
+
className: _style.default.toolTip,
|
|
44
|
+
"data-testid": "tooltip",
|
|
45
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
46
|
+
}, content);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
51
|
+
toolTipIsVisible: _propTypes.default.bool,
|
|
52
|
+
anchorId: _propTypes.default.string,
|
|
53
|
+
closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
|
|
54
|
+
content: _propTypes.default.node
|
|
55
|
+
} : {};
|
|
56
|
+
|
|
57
|
+
const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
58
|
+
if (event.key === 'Enter') {
|
|
59
|
+
if (ref) ref.current.focus();
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
setState(!state);
|
|
63
|
+
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
64
|
+
setState(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.toggleStateOnKeyPress = toggleStateOnKeyPress;
|
|
69
|
+
|
|
70
|
+
const ToolTip = ({
|
|
71
|
+
anchorId,
|
|
72
|
+
TooltipContent,
|
|
73
|
+
'aria-label': ariaLabel,
|
|
74
|
+
'data-testid': dataTestId,
|
|
75
|
+
closeToolTipInformationTextAriaLabel,
|
|
76
|
+
toolTipIsVisible: _toolTipIsVisible
|
|
77
|
+
}) => {
|
|
78
|
+
const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
|
|
79
|
+
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
80
|
+
const handleKeyPress = (0, _react.useCallback)(event => {
|
|
81
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
|
|
82
|
+
}, [toolTipIsVisible]);
|
|
83
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
84
|
+
setToolTipIsVisible(true);
|
|
85
|
+
}, []);
|
|
86
|
+
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
87
|
+
setToolTipIsVisible(false);
|
|
88
|
+
}, []);
|
|
89
|
+
const content = (0, _react.useMemo)(() => {
|
|
90
|
+
return isComponent ? /*#__PURE__*/_react.default.createElement(TooltipContent, null) : /*#__PURE__*/_react.default.createElement("p", {
|
|
91
|
+
className: _style.default.tooltipContent
|
|
92
|
+
}, TooltipContent);
|
|
93
|
+
}, [TooltipContent, isComponent]);
|
|
94
|
+
return anchorId ? /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
|
|
95
|
+
toolTipIsVisible: _toolTipIsVisible,
|
|
96
|
+
anchorId: anchorId,
|
|
97
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
98
|
+
content: content,
|
|
99
|
+
onMouseLeave: handleMouseLeave,
|
|
100
|
+
onMouseOver: handleMouseOver
|
|
101
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: _style.default.tooltipContainer,
|
|
103
|
+
onMouseLeave: handleMouseLeave,
|
|
104
|
+
onMouseOver: handleMouseOver
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
className: _style.default.tooltipIconContainer,
|
|
108
|
+
"data-testid": dataTestId,
|
|
109
|
+
onKeyDown: handleKeyPress,
|
|
110
|
+
tabIndex: 0
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
|
|
112
|
+
className: _style.default.informationIcon,
|
|
113
|
+
width: 12,
|
|
114
|
+
height: 12,
|
|
115
|
+
"aria-label": ariaLabel
|
|
116
|
+
})), /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
|
|
117
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
118
|
+
anchorId: anchorId,
|
|
119
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
120
|
+
content: content
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
125
|
+
TooltipContent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node, _propTypes.default.string]),
|
|
126
|
+
'data-testid': _propTypes.default.string,
|
|
127
|
+
'aria-label': _propTypes.default.string,
|
|
128
|
+
closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
|
|
129
|
+
// ---------- externalHandling --------------
|
|
130
|
+
// if passed down, React Tooltip is used instead, due to limitations on
|
|
131
|
+
// parents overflow hidden controls
|
|
132
|
+
anchorId: _propTypes.default.string,
|
|
133
|
+
toolTipIsVisible: _propTypes.default.bool
|
|
134
|
+
} : {};
|
|
135
|
+
var _default = ToolTip;
|
|
136
|
+
exports.default = _default;
|
|
137
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","style","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","handleKeyPress","useCallback","handleMouseOver","handleMouseLeave","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","func"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={style.toolTip}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n setToolTipIsVisible(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setToolTipIsVisible(false);\n }, []);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={style.tooltipContent}>{TooltipContent}</p>\n );\n }, [TooltipContent, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={12}\n height={12}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- externalHandling --------------\n // if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC;AAJsB,CAAD,KAKjB;EACJ,IAAI,CAACH,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,6BAAC,qBAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEG,cAAA,CAAMC,YAFnB;MAGE,kB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B;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYhB;EAJd,EAPF,CALF,eAmBE,6BAAC,cAAD;IACE,gBAAgB,EAAEzB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC;EAJX,EAnBF,CAVF;AAqCD,CA3ED;;AA6EAoB,OAAO,CAAChB,SAAR,2CAAoB;EAClBiB,cAAc,EAAEhB,kBAAA,CAAUkC,SAAV,CAAoB,CAAClC,kBAAA,CAAUmC,IAAX,EAAiBnC,kBAAA,CAAUI,IAA3B,EAAiCJ,kBAAA,CAAUE,MAA3C,CAApB,CADE;EAElB,eAAeF,kBAAA,CAAUE,MAFP;EAGlB,cAAcF,kBAAA,CAAUE,MAHN;EAIlBR,oCAAoC,EAAEM,kBAAA,CAAUE,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACA;EACAV,QAAQ,EAAEO,kBAAA,CAAUE,MARF;EASlBV,gBAAgB,EAAEQ,kBAAA,CAAUC;AATV,CAApB;eAYec,O"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value cm_blue_900 from colors;
|
|
3
|
+
@value cm_grey_75 from colors;
|
|
4
|
+
@value cm_grey_500 from colors;
|
|
5
|
+
@value cm_grey_700 from colors;
|
|
6
|
+
|
|
7
|
+
.textBase {
|
|
8
|
+
font-family: "Gilroy";
|
|
9
|
+
font-style: normal;
|
|
10
|
+
color: cm_blue_900;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltipContainer {
|
|
15
|
+
overflow: visible;
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 10;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
justify-self: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tooltipIconContainer {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
border: none;
|
|
27
|
+
background: cm_grey_75;
|
|
28
|
+
height: 25px;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.toolTip {
|
|
33
|
+
transition: opacity 0.8s;
|
|
34
|
+
position: absolute;
|
|
35
|
+
border-radius: 7px;
|
|
36
|
+
background-color: cm_grey_700;
|
|
37
|
+
right: -75px;
|
|
38
|
+
bottom: 32px;
|
|
39
|
+
height: auto;
|
|
40
|
+
width: 200px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.toolTip::before {
|
|
44
|
+
content: '';
|
|
45
|
+
display: inline-block;
|
|
46
|
+
visibility: inherit;
|
|
47
|
+
opacity: inherit;
|
|
48
|
+
width: 15px;
|
|
49
|
+
height: 15px;
|
|
50
|
+
transform: rotate(-45deg);
|
|
51
|
+
background-color: cm_grey_700;
|
|
52
|
+
position: inherit;
|
|
53
|
+
border-radius: 2px;
|
|
54
|
+
bottom: -5px;
|
|
55
|
+
right: 40%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tooltipContent {
|
|
59
|
+
composes: textBase;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
display: inline-block;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
word-wrap: break-word;
|
|
65
|
+
color: white;
|
|
66
|
+
padding: 8px 14px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.informationIcon {
|
|
71
|
+
color: cm_grey_500;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ----------------------- ReactToolTip exclusive classes ------------------------- */
|
|
75
|
+
.toolTipReact {
|
|
76
|
+
pointer-events: all !important;
|
|
77
|
+
background-color: cm_grey_700;
|
|
78
|
+
border-radius: 7px !important;
|
|
79
|
+
visibility: visible !important;
|
|
80
|
+
opacity: 1 !important;
|
|
81
|
+
left: 5px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* for keyboard navigation, the position can't be obtained from the mouse */
|
|
85
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact) {
|
|
86
|
+
border-radius: 7px !important;
|
|
87
|
+
top: 97px!important;
|
|
88
|
+
left: 628px!important;
|
|
89
|
+
visibility: visible !important;
|
|
90
|
+
opacity: 1!important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* same reason, arrow can't be placed effectively */
|
|
94
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact)::after {
|
|
95
|
+
content: none !important;
|
|
96
|
+
}
|
|
@@ -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":";AA4EA,iDAWC"}
|