@coorpacademy/components 11.10.3 → 11.10.4-alpha.7
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/input-switch/index.js +2 -1
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/link/index.d.ts +7 -15
- package/es/atom/link/index.d.ts.map +1 -1
- package/es/atom/link/index.js +71 -97
- package/es/atom/link/index.js.map +1 -1
- package/es/atom/provider/web-context.d.ts +2 -2
- package/es/atom/provider/web-context.d.ts.map +1 -1
- package/es/atom/provider/web-context.js +1 -4
- package/es/atom/provider/web-context.js.map +1 -1
- package/es/atom/review-header-step-item/index.d.ts.map +1 -1
- package/es/atom/review-header-step-item/index.js +8 -3
- package/es/atom/review-header-step-item/index.js.map +1 -1
- package/es/atom/tooltip/index.d.ts +7 -1
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +39 -14
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/atom/tooltip/style.css +9 -0
- package/es/molecule/answer/index.d.ts +3 -0
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +9 -3
- package/es/molecule/answer/index.js.map +1 -1
- package/es/organism/review-header/index.d.ts +23 -0
- package/es/organism/review-header/index.d.ts.map +1 -1
- package/es/organism/review-header/index.js +4 -0
- package/es/organism/review-header/index.js.map +1 -1
- package/es/organism/user-preferences/index.d.ts.map +1 -1
- package/es/organism/user-preferences/index.js +20 -19
- package/es/organism/user-preferences/index.js.map +1 -1
- package/es/organism/user-preferences/style.css +5 -56
- package/es/organism/wizard-contents/index.d.ts +2 -2
- package/es/organism/wizard-contents/index.d.ts.map +1 -1
- package/es/organism/wizard-contents/index.js +32 -13
- package/es/organism/wizard-contents/index.js.map +1 -1
- package/es/organism/wizard-contents/style.css +46 -6
- package/es/template/activity/engine-stars.d.ts +1 -0
- package/es/template/activity/engine-stars.js +2 -1
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/activity/index.d.ts +1 -0
- package/es/template/activity/index.js +2 -1
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/progression-item.d.ts +1 -1
- package/es/template/activity/progression-item.d.ts.map +1 -1
- package/es/template/activity/progression-item.js +3 -5
- 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.js +2 -1
- package/es/template/activity/stars-summary.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +2 -2
- package/es/util/render-with-context.d.ts.map +1 -1
- package/es/util/render-with-context.js +13 -6
- package/es/util/render-with-context.js.map +1 -1
- package/lib/atom/input-switch/index.js +2 -1
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/link/index.d.ts +7 -15
- package/lib/atom/link/index.d.ts.map +1 -1
- package/lib/atom/link/index.js +75 -97
- package/lib/atom/link/index.js.map +1 -1
- package/lib/atom/provider/web-context.d.ts +2 -2
- package/lib/atom/provider/web-context.d.ts.map +1 -1
- package/lib/atom/provider/web-context.js +1 -5
- package/lib/atom/provider/web-context.js.map +1 -1
- package/lib/atom/review-header-step-item/index.d.ts.map +1 -1
- package/lib/atom/review-header-step-item/index.js +12 -3
- package/lib/atom/review-header-step-item/index.js.map +1 -1
- package/lib/atom/tooltip/index.d.ts +7 -1
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +41 -14
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/atom/tooltip/style.css +9 -0
- package/lib/molecule/answer/index.d.ts +3 -0
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +9 -3
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/organism/review-header/index.d.ts +23 -0
- package/lib/organism/review-header/index.d.ts.map +1 -1
- package/lib/organism/review-header/index.js +5 -0
- package/lib/organism/review-header/index.js.map +1 -1
- package/lib/organism/user-preferences/index.d.ts.map +1 -1
- package/lib/organism/user-preferences/index.js +23 -21
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/lib/organism/user-preferences/style.css +5 -56
- package/lib/organism/wizard-contents/index.d.ts +2 -2
- package/lib/organism/wizard-contents/index.d.ts.map +1 -1
- package/lib/organism/wizard-contents/index.js +34 -13
- package/lib/organism/wizard-contents/index.js.map +1 -1
- package/lib/organism/wizard-contents/style.css +46 -6
- package/lib/template/activity/engine-stars.d.ts +1 -0
- package/lib/template/activity/engine-stars.js +2 -1
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/activity/index.d.ts +1 -0
- package/lib/template/activity/index.js +2 -1
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/progression-item.d.ts +1 -1
- package/lib/template/activity/progression-item.d.ts.map +1 -1
- package/lib/template/activity/progression-item.js +3 -5
- 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.js +2 -1
- package/lib/template/activity/stars-summary.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +2 -2
- package/lib/util/render-with-context.d.ts.map +1 -1
- package/lib/util/render-with-context.js +18 -6
- package/lib/util/render-with-context.js.map +1 -1
- package/package.json +2 -2
|
@@ -80,7 +80,8 @@ const InputSwitch = props => {
|
|
|
80
80
|
"aria-labelledby": `title-view-${dataName}`
|
|
81
81
|
}), /*#__PURE__*/React.createElement("label", {
|
|
82
82
|
htmlFor: idSwitch,
|
|
83
|
-
"data-name": "input-switch-label"
|
|
83
|
+
"data-name": "input-switch-label",
|
|
84
|
+
tabIndex: 0
|
|
84
85
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
85
86
|
className: !details ? style.alignedTextContainer : null
|
|
86
87
|
}, titlePosition === 'right' ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","idSwitch","isDisabled","handleChange","e","target","checked","titleView","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","string","bool","func","oneOf"],"sources":["../../../src/atom/input-switch/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false,\n 'data-name': dataName\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? <span className={style.title}>{`${title} `}</span> : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.default, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}${dataName}`}>\n {titlePosition === 'left' ? <div id={`title-view-${dataName}`}>{titleView} </div> : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n aria-labelledby={`title-view-${dataName}`}\n />\n <label htmlFor={idSwitch} data-name=\"input-switch-label\" />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? <div id={`title-view-${dataName}`}>{titleView} </div> : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n 'data-name': PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport default InputSwitch;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,KADI;IAEJC,IAFI;IAGJC,EAHI;IAIJC,KAJI;IAKJC,QALI;IAMJC,QAAQ,QANJ;IAOJC,WAPI;IAQJC,QAAQ,GAAG,KARP;IASJC,KAAK,GAAG,SATJ;IAUJC,aAAa,GAAG,MAVZ;IAWJC,OAAO,GAAG,EAXN;IAYJC,iBAAiB,GAAG,KAZhB;IAaJ,aAAaC;EAbT,IAcFb,KAdJ;;EAgBA,MAAMc,QAAQ,GAAGX,EAAE,IAAI,UAAS,eAAT,CAAvB;;EACA,MAAMY,UAAU,GAAGV,QAAQ,GAAG,UAAH,GAAgB,EAA3C;EACA,MAAMW,YAAY,GAAGrB,OAAO,CAAC,MAAMsB,CAAC,IAAIX,QAAQ,CAACW,CAAC,CAACC,MAAF,CAASC,OAAV,CAApB,EAAwC,CAACb,QAAD,CAAxC,CAA5B;EAEA,MAAMc,SAAS,GAAGnB,KAAK,gBAAG;IAAM,SAAS,EAAEH,KAAK,CAACG;EAAvB,GAAg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iC,QAPnB;IAQE,mBAAkB,cAAalB,QAAS;EAR1C,EADF,eAWE;IAAO,OAAO,EAAEC,QAAhB;IAA0B,aAAU;
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","getClassState","style","InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","idSwitch","isDisabled","handleChange","e","target","checked","titleView","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","string","bool","func","oneOf"],"sources":["../../../src/atom/input-switch/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false,\n 'data-name': dataName\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? <span className={style.title}>{`${title} `}</span> : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.default, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}${dataName}`}>\n {titlePosition === 'left' ? <div id={`title-view-${dataName}`}>{titleView} </div> : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n aria-labelledby={`title-view-${dataName}`}\n />\n <label htmlFor={idSwitch} data-name=\"input-switch-label\" tabIndex={0} />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? <div id={`title-view-${dataName}`}>{titleView} </div> : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n 'data-name': PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport default InputSwitch;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,KADI;IAEJC,IAFI;IAGJC,EAHI;IAIJC,KAJI;IAKJC,QALI;IAMJC,QAAQ,QANJ;IAOJC,WAPI;IAQJC,QAAQ,GAAG,KARP;IASJC,KAAK,GAAG,SATJ;IAUJC,aAAa,GAAG,MAVZ;IAWJC,OAAO,GAAG,EAXN;IAYJC,iBAAiB,GAAG,KAZhB;IAaJ,aAAaC;EAbT,IAcFb,KAdJ;;EAgBA,MAAMc,QAAQ,GAAGX,EAAE,IAAI,UAAS,eAAT,CAAvB;;EACA,MAAMY,UAAU,GAAGV,QAAQ,GAAG,UAAH,GAAgB,EAA3C;EACA,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AA4B,MAA5B,CAAhB,CAVe;EAWtB3B,OAAO,EAAEf,SAAS,CAACuC,MAXG;EAYtB,aAAavC,SAAS,CAACuC,MAZD;EAatBvB,iBAAiB,EAAEhB,SAAS,CAACwC;AAbP,CAAxB;AAeA,eAAerC,WAAf"}
|
package/es/atom/link/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default Link;
|
|
2
|
-
declare
|
|
3
|
-
|
|
2
|
+
declare function Link(props: any, legacyContext: any): JSX.Element;
|
|
3
|
+
declare namespace Link {
|
|
4
|
+
const propTypes: {
|
|
4
5
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
5
6
|
className: PropTypes.Requireable<string>;
|
|
6
7
|
href: PropTypes.Requireable<string>;
|
|
@@ -15,8 +16,8 @@ declare class Link extends React.Component<any, any, any> {
|
|
|
15
16
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
17
|
style: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
|
+
namespace contextTypes {
|
|
20
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
21
|
common: PropTypes.Requireable<{
|
|
21
22
|
[x: string]: any;
|
|
22
23
|
}>;
|
|
@@ -37,20 +38,11 @@ declare class Link extends React.Component<any, any, any> {
|
|
|
37
38
|
[x: string]: any;
|
|
38
39
|
}>;
|
|
39
40
|
}>>;
|
|
40
|
-
history: PropTypes.Requireable<PropTypes.InferProps<{
|
|
41
|
+
const history: PropTypes.Requireable<PropTypes.InferProps<{
|
|
41
42
|
createHref: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
43
|
push: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
44
|
}>>;
|
|
44
|
-
}
|
|
45
|
-
constructor(props: any);
|
|
46
|
-
state: {
|
|
47
|
-
hovered: boolean;
|
|
48
|
-
};
|
|
49
|
-
handleMouseEnter: () => void;
|
|
50
|
-
handleMouseLeave: () => void;
|
|
51
|
-
handleOnClick: (e: any) => void;
|
|
52
|
-
render(): JSX.Element;
|
|
45
|
+
}
|
|
53
46
|
}
|
|
54
|
-
import React from "react";
|
|
55
47
|
import PropTypes from "prop-types";
|
|
56
48
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA,mEA+EC"}
|
package/es/atom/link/index.js
CHANGED
|
@@ -7,107 +7,77 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
7
7
|
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
|
|
10
|
-
import React from 'react';
|
|
10
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import Provider from '../provider';
|
|
12
|
+
import Provider, { GetSkinFromContext } from '../provider';
|
|
13
13
|
import pushToHistory from '../../util/navigation';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
children
|
|
80
|
-
} = this.props;
|
|
81
|
-
const {
|
|
82
|
-
hovered
|
|
83
|
-
} = this.state;
|
|
84
|
-
|
|
85
|
-
const _style = href || onClick ? null : {
|
|
86
|
-
pointerEvents: 'none'
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const _hoverStyle = skinHover && hovered ? {
|
|
90
|
-
color: hoverColor
|
|
91
|
-
} : null;
|
|
92
|
-
|
|
93
|
-
return /*#__PURE__*/React.createElement("a", _extends({}, aProps, {
|
|
94
|
-
"data-name": dataName,
|
|
95
|
-
"aria-label": ariaLabel,
|
|
96
|
-
href: href ? createHref(href) : undefined,
|
|
97
|
-
onClick: this.handleOnClick,
|
|
98
|
-
onMouseEnter: this.handleMouseEnter,
|
|
99
|
-
onMouseLeave: this.handleMouseLeave,
|
|
100
|
-
className: className,
|
|
101
|
-
style: _extends({}, propsStyle, _style, _hoverStyle)
|
|
102
|
-
}), children);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
Link.contextTypes = {
|
|
108
|
-
skin: Provider.childContextTypes.skin,
|
|
109
|
-
history: Provider.childContextTypes.history
|
|
15
|
+
const Link = (props, legacyContext) => {
|
|
16
|
+
const skin = GetSkinFromContext(legacyContext);
|
|
17
|
+
const [hovered, setHovered] = useState(false);
|
|
18
|
+
const {
|
|
19
|
+
history: {
|
|
20
|
+
createHref = _identity
|
|
21
|
+
} = {}
|
|
22
|
+
} = legacyContext;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
skinHover,
|
|
26
|
+
hoverColor = _getOr('#00B0FF', 'common.primary', skin),
|
|
27
|
+
'data-name': dataName = 'link',
|
|
28
|
+
'aria-label': ariaLabel
|
|
29
|
+
} = props,
|
|
30
|
+
linKElementProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
href,
|
|
34
|
+
onClick = _noop,
|
|
35
|
+
className,
|
|
36
|
+
style: propsStyle,
|
|
37
|
+
children,
|
|
38
|
+
onMouseLeave = _noop,
|
|
39
|
+
onMouseEnter = _noop,
|
|
40
|
+
download
|
|
41
|
+
} = props;
|
|
42
|
+
const handleMouseEnter = useCallback(() => {
|
|
43
|
+
setHovered(true);
|
|
44
|
+
onMouseEnter();
|
|
45
|
+
}, [onMouseEnter]);
|
|
46
|
+
const handleMouseLeave = useCallback(() => {
|
|
47
|
+
setHovered(false);
|
|
48
|
+
onMouseLeave();
|
|
49
|
+
}, [onMouseLeave]);
|
|
50
|
+
const navigate = useMemo(() => pushToHistory(legacyContext)({
|
|
51
|
+
href
|
|
52
|
+
}), [href, legacyContext]);
|
|
53
|
+
const handleOnClick = useCallback(e => {
|
|
54
|
+
onClick(e);
|
|
55
|
+
|
|
56
|
+
if (!download) {
|
|
57
|
+
navigate(e);
|
|
58
|
+
}
|
|
59
|
+
}, [download, navigate, onClick]);
|
|
60
|
+
|
|
61
|
+
const _style = href || onClick ? null : {
|
|
62
|
+
pointerEvents: 'none'
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const _hoverStyle = skinHover && hovered ? {
|
|
66
|
+
color: hoverColor
|
|
67
|
+
} : null;
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/React.createElement("a", _extends({}, linKElementProps, {
|
|
70
|
+
"data-name": dataName,
|
|
71
|
+
"aria-label": ariaLabel,
|
|
72
|
+
href: href ? createHref(href) : undefined,
|
|
73
|
+
onClick: handleOnClick,
|
|
74
|
+
onMouseEnter: handleMouseEnter,
|
|
75
|
+
onMouseLeave: handleMouseLeave,
|
|
76
|
+
className: className,
|
|
77
|
+
style: _extends({}, propsStyle, _style, _hoverStyle)
|
|
78
|
+
}), children);
|
|
110
79
|
};
|
|
80
|
+
|
|
111
81
|
Link.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
112
82
|
children: PropTypes.node,
|
|
113
83
|
className: PropTypes.string,
|
|
@@ -123,5 +93,9 @@ Link.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
123
93
|
onMouseLeave: PropTypes.func,
|
|
124
94
|
style: PropTypes.shape({})
|
|
125
95
|
} : {};
|
|
96
|
+
Link.contextTypes = {
|
|
97
|
+
skin: Provider.childContextTypes.skin,
|
|
98
|
+
history: Provider.childContextTypes.history
|
|
99
|
+
};
|
|
126
100
|
export default Link;
|
|
127
101
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","PropTypes","Provider","GetSkinFromContext","pushToHistory","Link","props","legacyContext","skin","hovered","setHovered","history","createHref","skinHover","hoverColor","dataName","ariaLabel","linKElementProps","href","onClick","className","style","propsStyle","children","onMouseLeave","onMouseEnter","download","handleMouseEnter","handleMouseLeave","navigate","handleOnClick","e","_style","pointerEvents","_hoverStyle","color","undefined","propTypes","node","string","target","oneOf","bool","func","shape","contextTypes","childContextTypes"],"sources":["../../../src/atom/link/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {identity, getOr, noop} from 'lodash/fp';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport pushToHistory from '../../util/navigation';\n\nconst Link = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const [hovered, setHovered] = useState(false);\n const {history: {createHref = identity} = {}} = legacyContext;\n const {\n skinHover,\n hoverColor = getOr('#00B0FF', 'common.primary', skin),\n 'data-name': dataName = 'link',\n 'aria-label': ariaLabel,\n ...linKElementProps\n } = props;\n const {\n href,\n onClick = noop,\n className,\n style: propsStyle,\n children,\n onMouseLeave = noop,\n onMouseEnter = noop,\n download\n } = props;\n\n const handleMouseEnter = useCallback(() => {\n setHovered(true);\n\n onMouseEnter();\n }, [onMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n setHovered(false);\n\n onMouseLeave();\n }, [onMouseLeave]);\n\n const navigate = useMemo(() => pushToHistory(legacyContext)({href}), [href, legacyContext]);\n\n const handleOnClick = useCallback(\n e => {\n onClick(e);\n\n if (!download) {\n navigate(e);\n }\n },\n [download, navigate, onClick]\n );\n\n const _style =\n href || onClick\n ? null\n : {\n pointerEvents: 'none'\n };\n const _hoverStyle =\n skinHover && hovered\n ? {\n color: hoverColor\n }\n : null;\n\n return (\n <a\n {...linKElementProps}\n data-name={dataName}\n aria-label={ariaLabel}\n href={href ? createHref(href) : undefined}\n onClick={handleOnClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={className}\n style={{\n ...propsStyle,\n ..._style,\n ..._hoverStyle\n }}\n >\n {children}\n </a>\n );\n};\n\nLink.propTypes = {\n children: PropTypes.node,\n className: PropTypes.string,\n href: PropTypes.string,\n 'data-name': PropTypes.string,\n 'aria-label': PropTypes.string,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),\n skinHover: PropTypes.bool,\n hoverColor: PropTypes.string,\n download: PropTypes.bool,\n onClick: PropTypes.func,\n onMouseEnter: PropTypes.func,\n onMouseLeave: PropTypes.func,\n style: PropTypes.shape({})\n};\n\nLink.contextTypes = {\n skin: Provider.childContextTypes.skin,\n history: Provider.childContextTypes.history\n};\n\nexport default Link;\n"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ElB,SAAS,CAAC0C,IAVJ;EAWflB,YAAY,EAAExB,SAAS,CAAC0C,IAXT;EAYfnB,YAAY,EAAEvB,SAAS,CAAC0C,IAZT;EAaftB,KAAK,EAAEpB,SAAS,CAAC2C,KAAV,CAAgB,EAAhB;AAbQ,CAAjB;AAgBAvC,IAAI,CAACwC,YAAL,GAAoB;EAClBrC,IAAI,EAAEN,QAAQ,CAAC4C,iBAAT,CAA2BtC,IADf;EAElBG,OAAO,EAAET,QAAQ,CAAC4C,iBAAT,CAA2BnC;AAFlB,CAApB;AAKA,eAAeN,IAAf"}
|
|
@@ -4,9 +4,9 @@ declare type Skin = {
|
|
|
4
4
|
primary: string;
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
|
-
declare type WebContextValues = {
|
|
7
|
+
export declare type WebContextValues = {
|
|
8
8
|
skin?: Skin;
|
|
9
|
-
translate
|
|
9
|
+
translate?: (key: string, data?: Record<string, string>) => string;
|
|
10
10
|
};
|
|
11
11
|
declare type Props = WebContextValues & {
|
|
12
12
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-context.d.ts","sourceRoot":"","sources":["../../../src/atom/provider/web-context.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"web-context.d.ts","sourceRoot":"","sources":["../../../src/atom/provider/web-context.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAa,MAAM,OAAO,CAAC;AAElE,aAAK,IAAI,GAAG;IACV,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;CACpE,CAAC;AAIF,aAAK,KAAK,GAAG,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,UAAU,2BAA0B,KAAK,gBAE9C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,gBAQhC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -3,10 +3,7 @@ const _excluded = ["children"];
|
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
4
|
|
|
5
5
|
import React, { createContext, useContext } from 'react';
|
|
6
|
-
|
|
7
|
-
const Context = /*#__PURE__*/createContext({
|
|
8
|
-
translate: mockTranslate
|
|
9
|
-
});
|
|
6
|
+
const Context = /*#__PURE__*/createContext({});
|
|
10
7
|
|
|
11
8
|
const WebContext = _ref => {
|
|
12
9
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-context.js","names":["React","createContext","useContext","
|
|
1
|
+
{"version":3,"file":"web-context.js","names":["React","createContext","useContext","Context","WebContext","children","value","useWebContext","context","Error"],"sources":["../../../src/atom/provider/web-context.tsx"],"sourcesContent":["import React, {createContext, ReactNode, useContext} from 'react';\n\ntype Skin = {\n common: {\n primary: string;\n };\n};\n\nexport type WebContextValues = {\n skin?: Skin;\n translate?: (key: string, data?: Record<string, string>) => string;\n};\n\nconst Context = createContext({});\n\ntype Props = WebContextValues & {\n children: ReactNode;\n};\n\nconst WebContext = ({children, ...value}: Props) => {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useWebContext = (): WebContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error('❌ [WebContext] useWebContext must be used within a provider <WebContext>');\n }\n\n return context;\n};\n\nexport default WebContext;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,aAAf,EAAyCC,UAAzC,QAA0D,OAA1D;AAaA,MAAMC,OAAO,gBAAGF,aAAa,CAAC,EAAD,CAA7B;;AAMA,MAAMG,UAAU,GAAG,QAAiC;EAAA,IAAhC;IAACC;EAAD,CAAgC;EAAA,IAAlBC,KAAkB;;EAClD,oBAAO,oBAAC,OAAD,CAAS,QAAT;IAAkB,KAAK,EAAEA;EAAzB,GAAiCD,QAAjC,CAAP;AACD,CAFD;;AAIA,OAAO,MAAME,aAAa,GAAG,MAAwB;EACnD,MAAMC,OAAO,GAAGN,UAAU,CAACC,OAAD,CAA1B;;EAEA,IAAI,CAACK,OAAL,EAAc;IACZ,MAAM,IAAIC,KAAJ,CAAU,0EAAV,CAAN;EACD;;EAED,OAAOD,OAAP;AACD,CARM;AAUP,eAAeJ,UAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-header-step-item/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/review-header-step-item/index.tsx"],"names":[],"mappings":";AASA,OAAkB,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAsDvD,QAAA,MAAM,oBAAoB;YAAW,mBAAmB;;;;;;CAevD,CAAC;AAWF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { NovaCompositionCoorpacademyCheck as RightIcon, NovaSolidStatusClose as WrongIcon } from '@coorpacademy/nova-icons';
|
|
4
|
-
import { GetTranslateFromContext } from '../provider';
|
|
4
|
+
import Provider, { GetTranslateFromContext } from '../provider';
|
|
5
5
|
import style from './style.css';
|
|
6
6
|
import propTypes from './types';
|
|
7
7
|
|
|
8
|
-
const Content = props => {
|
|
8
|
+
const Content = (props, legacyContext) => {
|
|
9
9
|
const {
|
|
10
10
|
icon,
|
|
11
11
|
current,
|
|
12
12
|
value
|
|
13
13
|
} = props;
|
|
14
|
-
const translate = GetTranslateFromContext();
|
|
14
|
+
const translate = GetTranslateFromContext(legacyContext);
|
|
15
15
|
let child;
|
|
16
16
|
let ariaDescription;
|
|
17
17
|
|
|
@@ -67,6 +67,11 @@ const ReviewHeaderStepItem = props => {
|
|
|
67
67
|
}, /*#__PURE__*/React.createElement(Content, props));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
Content.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
71
|
+
Content.contextTypes = {
|
|
72
|
+
skin: Provider.childContextTypes.skin,
|
|
73
|
+
translate: Provider.childContextTypes.translate
|
|
74
|
+
};
|
|
70
75
|
ReviewHeaderStepItem.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
71
76
|
export default ReviewHeaderStepItem;
|
|
72
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","classnames","NovaCompositionCoorpacademyCheck","RightIcon","NovaSolidStatusClose","WrongIcon","GetTranslateFromContext","style","propTypes","Content","props","icon","current","value","translate","child","ariaDescription","headerStepValue","rightIcon","currentRightIcon","wrongIcon","currentWrongIcon","ReviewHeaderStepItem","default","right","wrong"],"sources":["../../../src/atom/review-header-step-item/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport {GetTranslateFromContext} from '../provider';\nimport style from './style.css';\nimport propTypes, {HeaderStepItemProps} from './types';\n\nconst Content = (props: HeaderStepItemProps) => {\n const {icon, current, value} = props;\n const translate = GetTranslateFromContext();\n let child;\n let ariaDescription;\n switch (icon) {\n case 'no-answer':\n child = value;\n ariaDescription = current\n ? translate('review_header_step_item.current_question', {\n headerStepValue: value\n })\n : translate('review_header_step_item.not_answered_question', {\n headerStepValue: value\n });\n break;\n\n case 'right':\n child = (\n <RightIcon className={classnames(style.rightIcon, current && style.currentRightIcon)} />\n );\n ariaDescription = translate('review_header_step_item.correct_question', {\n headerStepValue: value\n });\n break;\n\n case 'wrong':\n child = (\n <WrongIcon className={classnames(style.wrongIcon, current && style.currentWrongIcon)} />\n );\n ariaDescription = translate('review_header_step_item.incorrect_question', {\n headerStepValue: value\n });\n break;\n\n default:\n return null;\n }\n\n return (\n <span\n className={style.value}\n aria-label={translate('review_header_step_item.aria_label', {\n headerStepValue: value\n })}\n aria-describedby={ariaDescription}\n >\n {child}\n </span>\n );\n};\n\nconst ReviewHeaderStepItem = (props: HeaderStepItemProps) => {\n const {icon, current} = props;\n return (\n <div\n className={classnames(\n style.default,\n icon === 'right' && style.right,\n icon === 'wrong' && style.wrong,\n current && style.current\n )}\n data-name=\"header-step-item\"\n >\n <Content {...props} />\n </div>\n );\n};\n\nReviewHeaderStepItem.propTypes = propTypes;\n\nexport default ReviewHeaderStepItem;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SACEC,gCAAgC,IAAIC,SADtC,EAEEC,oBAAoB,IAAIC,SAF1B,QAGO,0BAHP;AAIA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","classnames","NovaCompositionCoorpacademyCheck","RightIcon","NovaSolidStatusClose","WrongIcon","Provider","GetTranslateFromContext","style","propTypes","Content","props","legacyContext","icon","current","value","translate","child","ariaDescription","headerStepValue","rightIcon","currentRightIcon","wrongIcon","currentWrongIcon","ReviewHeaderStepItem","default","right","wrong","contextTypes","skin","childContextTypes"],"sources":["../../../src/atom/review-header-step-item/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport style from './style.css';\nimport propTypes, {HeaderStepItemProps} from './types';\n\nconst Content = (props: HeaderStepItemProps, legacyContext: WebContextValues) => {\n const {icon, current, value} = props;\n const translate = GetTranslateFromContext(legacyContext);\n let child;\n let ariaDescription;\n switch (icon) {\n case 'no-answer':\n child = value;\n ariaDescription = current\n ? translate('review_header_step_item.current_question', {\n headerStepValue: value\n })\n : translate('review_header_step_item.not_answered_question', {\n headerStepValue: value\n });\n break;\n\n case 'right':\n child = (\n <RightIcon className={classnames(style.rightIcon, current && style.currentRightIcon)} />\n );\n ariaDescription = translate('review_header_step_item.correct_question', {\n headerStepValue: value\n });\n break;\n\n case 'wrong':\n child = (\n <WrongIcon className={classnames(style.wrongIcon, current && style.currentWrongIcon)} />\n );\n ariaDescription = translate('review_header_step_item.incorrect_question', {\n headerStepValue: value\n });\n break;\n\n default:\n return null;\n }\n\n return (\n <span\n className={style.value}\n aria-label={translate('review_header_step_item.aria_label', {\n headerStepValue: value\n })}\n aria-describedby={ariaDescription}\n >\n {child}\n </span>\n );\n};\n\nconst ReviewHeaderStepItem = (props: HeaderStepItemProps) => {\n const {icon, current} = props;\n return (\n <div\n className={classnames(\n style.default,\n icon === 'right' && style.right,\n icon === 'wrong' && style.wrong,\n current && style.current\n )}\n data-name=\"header-step-item\"\n >\n <Content {...props} />\n </div>\n );\n};\n\nContent.propTypes = propTypes;\n\nContent.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nReviewHeaderStepItem.propTypes = propTypes;\n\nexport default ReviewHeaderStepItem;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SACEC,gCAAgC,IAAIC,SADtC,EAEEC,oBAAoB,IAAIC,SAF1B,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,aAAhD;AAEA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,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AAIb,KAAD,IAAgC;EAC3D,MAAM;IAACE,IAAD;IAAOC;EAAP,IAAkBH,KAAxB;EACA,oBACE;IACE,SAAS,EAAEV,UAAU,CACnBO,KAAK,CAACiB,OADa,EAEnBZ,IAAI,KAAK,OAAT,IAAoBL,KAAK,CAACkB,KAFP,EAGnBb,IAAI,KAAK,OAAT,IAAoBL,KAAK,CAACmB,KAHP,EAInBb,OAAO,IAAIN,KAAK,CAACM,OAJE,CADvB;IAOE,aAAU;EAPZ,gBASE,oBAAC,OAAD,EAAaH,KAAb,CATF,CADF;AAaD,CAfD;;AAiBAD,OAAO,CAACD,SAAR,2CAAoBA,SAApB;AAEAC,OAAO,CAACkB,YAAR,GAAuB;EACrBC,IAAI,EAAEvB,QAAQ,CAACwB,iBAAT,CAA2BD,IADZ;EAErBb,SAAS,EAAEV,QAAQ,CAACwB,iBAAT,CAA2Bd;AAFjB,CAAvB;AAKAQ,oBAAoB,CAACf,SAArB,2CAAiCA,SAAjC;AAEA,eAAee,oBAAf"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
2
|
export default ToolTip;
|
|
3
|
-
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible }: {
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize }: {
|
|
4
4
|
anchorId: any;
|
|
5
5
|
TooltipContent: any;
|
|
6
6
|
"aria-label": any;
|
|
7
7
|
"data-testid": any;
|
|
8
8
|
closeToolTipInformationTextAriaLabel: any;
|
|
9
9
|
toolTipIsVisible: any;
|
|
10
|
+
iconContainerClassName: any;
|
|
11
|
+
delayHide?: number | undefined;
|
|
12
|
+
fontSize?: number | undefined;
|
|
10
13
|
}): JSX.Element;
|
|
11
14
|
declare namespace ToolTip {
|
|
12
15
|
const propTypes: {
|
|
@@ -14,6 +17,9 @@ declare namespace ToolTip {
|
|
|
14
17
|
'data-testid': PropTypes.Requireable<string>;
|
|
15
18
|
'aria-label': PropTypes.Requireable<string>;
|
|
16
19
|
closeToolTipInformationTextAriaLabel: PropTypes.Validator<string>;
|
|
20
|
+
iconContainerClassName: PropTypes.Requireable<string>;
|
|
21
|
+
delayHide: PropTypes.Requireable<number>;
|
|
22
|
+
fontSize: PropTypes.Requireable<number>;
|
|
17
23
|
anchorId: PropTypes.Requireable<string>;
|
|
18
24
|
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
19
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AAwDO,iGASN;;AAED;;;;;;;;;;gBAwFC"}
|
package/es/atom/tooltip/index.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React, { isValidElement, useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import ReactTooltip from 'react-tooltip';
|
|
4
5
|
import isString from 'lodash/fp/isString';
|
|
5
6
|
import { NovaCompositionCoorpacademyInformationIcon as InformationIcon } from '@coorpacademy/nova-icons';
|
|
6
7
|
import style from './style.css';
|
|
8
|
+
const FontSizes = {
|
|
9
|
+
12: style.tooltipContentFontSize12,
|
|
10
|
+
14: style.tooltipContentFontSize14
|
|
11
|
+
};
|
|
7
12
|
|
|
8
13
|
const ToolTipWrapper = ({
|
|
9
14
|
toolTipIsVisible,
|
|
10
15
|
anchorId,
|
|
11
16
|
closeToolTipInformationTextAriaLabel,
|
|
12
|
-
content
|
|
17
|
+
content,
|
|
18
|
+
handleContentMouseOver
|
|
13
19
|
}) => {
|
|
14
20
|
if (!toolTipIsVisible) return null;
|
|
15
21
|
|
|
@@ -26,7 +32,8 @@ const ToolTipWrapper = ({
|
|
|
26
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
33
|
className: style.toolTip,
|
|
28
34
|
"data-testid": "tooltip",
|
|
29
|
-
"aria-label": closeToolTipInformationTextAriaLabel
|
|
35
|
+
"aria-label": closeToolTipInformationTextAriaLabel,
|
|
36
|
+
onMouseOver: handleContentMouseOver
|
|
30
37
|
}, content);
|
|
31
38
|
}
|
|
32
39
|
};
|
|
@@ -35,7 +42,8 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
35
42
|
toolTipIsVisible: PropTypes.bool,
|
|
36
43
|
anchorId: PropTypes.string,
|
|
37
44
|
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
38
|
-
content: PropTypes.node
|
|
45
|
+
content: PropTypes.node,
|
|
46
|
+
handleContentMouseOver: PropTypes.func
|
|
39
47
|
} : {};
|
|
40
48
|
export const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
41
49
|
if (event.key === 'Enter') {
|
|
@@ -54,38 +62,49 @@ const ToolTip = ({
|
|
|
54
62
|
'aria-label': ariaLabel,
|
|
55
63
|
'data-testid': dataTestId,
|
|
56
64
|
closeToolTipInformationTextAriaLabel,
|
|
57
|
-
toolTipIsVisible: _toolTipIsVisible
|
|
65
|
+
toolTipIsVisible: _toolTipIsVisible,
|
|
66
|
+
iconContainerClassName,
|
|
67
|
+
delayHide = 250,
|
|
68
|
+
fontSize = 14
|
|
58
69
|
}) => {
|
|
59
70
|
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
60
71
|
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
72
|
+
const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);
|
|
61
73
|
const handleKeyPress = useCallback(event => {
|
|
62
74
|
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
|
|
63
75
|
}, [toolTipIsVisible]);
|
|
76
|
+
const handleContentMouseOver = useCallback(() => {
|
|
77
|
+
mouseLeaveTimer &&
|
|
78
|
+
/* istanbul ignore next */
|
|
79
|
+
clearTimeout(mouseLeaveTimer);
|
|
80
|
+
}, [mouseLeaveTimer]);
|
|
64
81
|
const handleMouseOver = useCallback(() => {
|
|
82
|
+
mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
|
|
65
83
|
setToolTipIsVisible(true);
|
|
66
|
-
}, []);
|
|
84
|
+
}, [mouseLeaveTimer]);
|
|
67
85
|
const handleMouseLeave = useCallback(() => {
|
|
68
|
-
setToolTipIsVisible(false);
|
|
69
|
-
}, []);
|
|
86
|
+
setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));
|
|
87
|
+
}, [delayHide]);
|
|
70
88
|
const content = useMemo(() => {
|
|
71
89
|
return isComponent ? /*#__PURE__*/React.createElement(TooltipContent, null) : /*#__PURE__*/React.createElement("p", {
|
|
72
|
-
className: style.tooltipContent
|
|
90
|
+
className: classnames([style.tooltipContent, FontSizes[fontSize]])
|
|
73
91
|
}, TooltipContent);
|
|
74
|
-
}, [TooltipContent, isComponent]);
|
|
92
|
+
}, [TooltipContent, fontSize, isComponent]);
|
|
75
93
|
return anchorId ? /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
76
94
|
toolTipIsVisible: _toolTipIsVisible,
|
|
77
95
|
anchorId: anchorId,
|
|
78
96
|
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
79
97
|
content: content,
|
|
80
98
|
onMouseLeave: handleMouseLeave,
|
|
81
|
-
onMouseOver: handleMouseOver
|
|
99
|
+
onMouseOver: handleMouseOver,
|
|
100
|
+
fontSize: fontSize
|
|
82
101
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
83
102
|
className: style.tooltipContainer,
|
|
84
103
|
onMouseLeave: handleMouseLeave,
|
|
85
104
|
onMouseOver: handleMouseOver
|
|
86
105
|
}, /*#__PURE__*/React.createElement("button", {
|
|
87
106
|
type: "button",
|
|
88
|
-
className: style.tooltipIconContainer,
|
|
107
|
+
className: classnames([style.tooltipIconContainer, iconContainerClassName]),
|
|
89
108
|
"data-testid": dataTestId,
|
|
90
109
|
onKeyDown: handleKeyPress,
|
|
91
110
|
tabIndex: 0
|
|
@@ -98,7 +117,9 @@ const ToolTip = ({
|
|
|
98
117
|
toolTipIsVisible: toolTipIsVisible,
|
|
99
118
|
anchorId: anchorId,
|
|
100
119
|
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
101
|
-
content: content
|
|
120
|
+
content: content,
|
|
121
|
+
handleContentMouseOver: handleContentMouseOver,
|
|
122
|
+
fontSize: fontSize
|
|
102
123
|
}));
|
|
103
124
|
};
|
|
104
125
|
|
|
@@ -107,8 +128,12 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
107
128
|
'data-testid': PropTypes.string,
|
|
108
129
|
'aria-label': PropTypes.string,
|
|
109
130
|
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
110
|
-
// ----------
|
|
111
|
-
|
|
131
|
+
// ---------- Regular Tooltip exclusive --------------
|
|
132
|
+
iconContainerClassName: PropTypes.string,
|
|
133
|
+
delayHide: PropTypes.number,
|
|
134
|
+
fontSize: PropTypes.oneOf([12, 14]),
|
|
135
|
+
// ---------- React Tooltip exclusive --------------
|
|
136
|
+
// externalHandling: if passed down, React Tooltip is used instead, due to limitations on
|
|
112
137
|
// parents overflow hidden controls
|
|
113
138
|
anchorId: PropTypes.string,
|
|
114
139
|
toolTipIsVisible: PropTypes.bool
|