@coorpacademy/components 11.11.5-alpha.0 → 11.11.6
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/battle-opponent/index.d.ts +20 -0
- package/es/atom/battle-opponent/index.d.ts.map +1 -0
- package/es/atom/battle-opponent/index.js +104 -0
- package/es/atom/battle-opponent/index.js.map +1 -0
- package/es/atom/battle-opponent/prop-types.d.ts +21 -0
- package/es/atom/battle-opponent/prop-types.d.ts.map +1 -0
- package/es/atom/battle-opponent/prop-types.js +12 -0
- package/es/atom/battle-opponent/prop-types.js.map +1 -0
- package/es/atom/battle-opponent/style.css +133 -0
- package/es/atom/{review-header-step-item → status-item}/index.d.ts +4 -4
- package/es/atom/status-item/index.d.ts.map +1 -0
- package/es/atom/status-item/index.js +104 -0
- package/es/atom/status-item/index.js.map +1 -0
- package/es/atom/status-item/index.native.d.ts +5 -0
- package/es/atom/status-item/index.native.d.ts.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/index.native.js +2 -2
- package/es/atom/status-item/index.native.js.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/style.css +47 -0
- package/es/atom/{review-header-step-item → status-item}/types.d.ts +5 -5
- package/es/atom/status-item/types.d.ts.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/types.js +1 -1
- package/es/atom/status-item/types.js.map +1 -0
- package/es/atom/tooltip/index.d.ts +3 -1
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +18 -7
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/atom/tooltip/style.css +11 -2
- package/es/globals.d.js.map +1 -1
- package/es/molecule/battle-opponent-list/index.d.ts +18 -0
- package/es/molecule/battle-opponent-list/index.d.ts.map +1 -0
- package/es/molecule/battle-opponent-list/index.js +25 -0
- package/es/molecule/battle-opponent-list/index.js.map +1 -0
- package/es/molecule/battle-opponent-list/prop-types.d.ts +26 -0
- package/es/molecule/battle-opponent-list/prop-types.d.ts.map +1 -0
- package/es/molecule/battle-opponent-list/prop-types.js +14 -0
- package/es/molecule/battle-opponent-list/prop-types.js.map +1 -0
- package/es/molecule/battle-opponent-list/style.css +5 -0
- package/es/molecule/review-header-steps/index.js +2 -2
- package/es/molecule/review-header-steps/index.js.map +1 -1
- package/es/molecule/review-header-steps/prop-types.d.ts +2 -2
- package/es/molecule/review-header-steps/prop-types.d.ts.map +1 -1
- package/es/molecule/review-header-steps/prop-types.js +1 -1
- package/es/molecule/review-header-steps/prop-types.js.map +1 -1
- package/es/organism/mooc-footer/style.css +1 -0
- package/es/organism/mooc-header/index.d.ts +3 -0
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +39 -4
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/mooc-header/style.css +17 -1
- package/es/organism/review-header/index.native.js +1 -1
- package/es/organism/review-header/index.native.js.map +1 -1
- package/es/organism/review-header/types.d.ts +2 -2
- package/es/organism/review-header/types.d.ts.map +1 -1
- package/es/organism/review-header/types.js.map +1 -1
- package/es/organism/user-preferences/index.d.ts.map +1 -1
- package/es/organism/user-preferences/index.js +6 -3
- package/es/organism/user-preferences/index.js.map +1 -1
- package/es/variables/colors.css +2 -0
- package/lib/atom/battle-opponent/index.d.ts +20 -0
- package/lib/atom/battle-opponent/index.d.ts.map +1 -0
- package/lib/atom/battle-opponent/index.js +124 -0
- package/lib/atom/battle-opponent/index.js.map +1 -0
- package/lib/atom/battle-opponent/prop-types.d.ts +21 -0
- package/lib/atom/battle-opponent/prop-types.d.ts.map +1 -0
- package/lib/atom/battle-opponent/prop-types.js +21 -0
- package/lib/atom/battle-opponent/prop-types.js.map +1 -0
- package/lib/atom/battle-opponent/style.css +133 -0
- package/lib/atom/{review-header-step-item → status-item}/index.d.ts +4 -4
- package/lib/atom/status-item/index.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/index.js +50 -23
- package/lib/atom/status-item/index.js.map +1 -0
- package/lib/atom/status-item/index.native.d.ts +5 -0
- package/lib/atom/status-item/index.native.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/index.native.js +2 -2
- package/lib/atom/status-item/index.native.js.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/style.css +47 -0
- package/lib/atom/{review-header-step-item → status-item}/types.d.ts +5 -5
- package/lib/atom/status-item/types.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/types.js +1 -1
- package/lib/atom/status-item/types.js.map +1 -0
- package/lib/atom/tooltip/index.d.ts +3 -1
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +19 -7
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/atom/tooltip/style.css +11 -2
- package/lib/globals.d.js.map +1 -1
- package/lib/molecule/battle-opponent-list/index.d.ts +18 -0
- package/lib/molecule/battle-opponent-list/index.d.ts.map +1 -0
- package/lib/molecule/battle-opponent-list/index.js +43 -0
- package/lib/molecule/battle-opponent-list/index.js.map +1 -0
- package/lib/molecule/battle-opponent-list/prop-types.d.ts +26 -0
- package/lib/molecule/battle-opponent-list/prop-types.d.ts.map +1 -0
- package/lib/molecule/battle-opponent-list/prop-types.js +23 -0
- package/lib/molecule/battle-opponent-list/prop-types.js.map +1 -0
- package/lib/molecule/battle-opponent-list/style.css +5 -0
- package/lib/molecule/review-header-steps/index.js +2 -2
- package/lib/molecule/review-header-steps/index.js.map +1 -1
- package/lib/molecule/review-header-steps/prop-types.d.ts +2 -2
- package/lib/molecule/review-header-steps/prop-types.d.ts.map +1 -1
- package/lib/molecule/review-header-steps/prop-types.js +1 -1
- package/lib/molecule/review-header-steps/prop-types.js.map +1 -1
- package/lib/organism/mooc-footer/style.css +1 -0
- package/lib/organism/mooc-header/index.d.ts +3 -0
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +39 -4
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/mooc-header/style.css +17 -1
- package/lib/organism/review-header/index.native.js +1 -1
- package/lib/organism/review-header/index.native.js.map +1 -1
- package/lib/organism/review-header/types.d.ts +2 -2
- package/lib/organism/review-header/types.d.ts.map +1 -1
- package/lib/organism/review-header/types.js.map +1 -1
- package/lib/organism/user-preferences/index.d.ts.map +1 -1
- package/lib/organism/user-preferences/index.js +10 -3
- package/lib/organism/user-preferences/index.js.map +1 -1
- package/lib/variables/colors.css +2 -0
- package/locales/bs/global.json +8 -5
- package/locales/cs/global.json +8 -5
- package/locales/de/global.json +8 -5
- package/locales/en/global.json +8 -5
- package/locales/es/global.json +8 -5
- package/locales/et/global.json +8 -5
- package/locales/fr/global.json +8 -5
- package/locales/hr/global.json +8 -5
- package/locales/hu/global.json +8 -5
- package/locales/hy/global.json +8 -5
- package/locales/it/global.json +8 -5
- package/locales/ja/global.json +8 -5
- package/locales/ko/global.json +8 -5
- package/locales/nl/global.json +8 -5
- package/locales/pl/global.json +8 -5
- package/locales/pt/global.json +8 -5
- package/locales/ro/global.json +8 -5
- package/locales/ru/global.json +8 -5
- package/locales/sk/global.json +8 -5
- package/locales/th/global.json +8 -5
- package/locales/tl/global.json +8 -5
- package/locales/tr/global.json +8 -5
- package/locales/uk/global.json +8 -5
- package/locales/vi/global.json +8 -5
- package/locales/zh/global.json +8 -5
- package/locales/zh_TW/global.json +8 -5
- package/package.json +3 -2
- package/es/atom/review-header-step-item/index.d.ts.map +0 -1
- package/es/atom/review-header-step-item/index.js +0 -77
- package/es/atom/review-header-step-item/index.js.map +0 -1
- package/es/atom/review-header-step-item/index.native.d.ts +0 -5
- package/es/atom/review-header-step-item/index.native.d.ts.map +0 -1
- package/es/atom/review-header-step-item/index.native.js.map +0 -1
- package/es/atom/review-header-step-item/types.d.ts.map +0 -1
- package/es/atom/review-header-step-item/types.js.map +0 -1
- package/lib/atom/review-header-step-item/index.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/index.js.map +0 -1
- package/lib/atom/review-header-step-item/index.native.d.ts +0 -5
- package/lib/atom/review-header-step-item/index.native.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/index.native.js.map +0 -1
- package/lib/atom/review-header-step-item/types.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/types.js.map +0 -1
package/es/atom/tooltip/index.js
CHANGED
|
@@ -3,19 +3,25 @@ import classnames from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import ReactTooltip from 'react-tooltip';
|
|
5
5
|
import isString from 'lodash/fp/isString';
|
|
6
|
+
import keys from 'lodash/fp/keys';
|
|
6
7
|
import { NovaCompositionCoorpacademyInformationIcon as InformationIcon } from '@coorpacademy/nova-icons';
|
|
7
8
|
import style from './style.css';
|
|
8
9
|
const FontSizes = {
|
|
9
10
|
12: style.tooltipContentFontSize12,
|
|
10
11
|
14: style.tooltipContentFontSize14
|
|
11
12
|
};
|
|
13
|
+
const IconSizes = {
|
|
14
|
+
small: 12,
|
|
15
|
+
big: 20
|
|
16
|
+
};
|
|
12
17
|
|
|
13
18
|
const ToolTipWrapper = ({
|
|
14
19
|
toolTipIsVisible,
|
|
15
20
|
anchorId,
|
|
16
21
|
closeToolTipInformationTextAriaLabel,
|
|
17
22
|
content,
|
|
18
|
-
handleContentMouseOver
|
|
23
|
+
handleContentMouseOver,
|
|
24
|
+
iconSize
|
|
19
25
|
}) => {
|
|
20
26
|
if (!toolTipIsVisible) return null;
|
|
21
27
|
|
|
@@ -30,7 +36,7 @@ const ToolTipWrapper = ({
|
|
|
30
36
|
}, content);
|
|
31
37
|
} else {
|
|
32
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
-
className: style.toolTip,
|
|
39
|
+
className: classnames(style.toolTip, iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip),
|
|
34
40
|
"data-testid": "tooltip",
|
|
35
41
|
"aria-label": closeToolTipInformationTextAriaLabel,
|
|
36
42
|
onMouseOver: handleContentMouseOver
|
|
@@ -43,7 +49,8 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
43
49
|
anchorId: PropTypes.string,
|
|
44
50
|
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
45
51
|
content: PropTypes.node,
|
|
46
|
-
handleContentMouseOver: PropTypes.func
|
|
52
|
+
handleContentMouseOver: PropTypes.func,
|
|
53
|
+
iconSize: PropTypes.oneOf(keys(IconSizes))
|
|
47
54
|
} : {};
|
|
48
55
|
export const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
49
56
|
if (event.key === 'Enter') {
|
|
@@ -65,7 +72,8 @@ const ToolTip = ({
|
|
|
65
72
|
toolTipIsVisible: _toolTipIsVisible,
|
|
66
73
|
iconContainerClassName,
|
|
67
74
|
delayHide = 250,
|
|
68
|
-
fontSize = 14
|
|
75
|
+
fontSize = 14,
|
|
76
|
+
iconSize = 'small'
|
|
69
77
|
}) => {
|
|
70
78
|
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
71
79
|
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
@@ -110,8 +118,8 @@ const ToolTip = ({
|
|
|
110
118
|
tabIndex: 0
|
|
111
119
|
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
112
120
|
className: style.informationIcon,
|
|
113
|
-
width:
|
|
114
|
-
height:
|
|
121
|
+
width: IconSizes[iconSize],
|
|
122
|
+
height: IconSizes[iconSize],
|
|
115
123
|
"aria-label": ariaLabel
|
|
116
124
|
})), /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
117
125
|
toolTipIsVisible: toolTipIsVisible,
|
|
@@ -119,7 +127,8 @@ const ToolTip = ({
|
|
|
119
127
|
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
120
128
|
content: content,
|
|
121
129
|
handleContentMouseOver: handleContentMouseOver,
|
|
122
|
-
fontSize: fontSize
|
|
130
|
+
fontSize: fontSize,
|
|
131
|
+
iconSize: iconSize
|
|
123
132
|
}));
|
|
124
133
|
};
|
|
125
134
|
|
|
@@ -132,9 +141,11 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
132
141
|
iconContainerClassName: PropTypes.string,
|
|
133
142
|
delayHide: PropTypes.number,
|
|
134
143
|
fontSize: PropTypes.oneOf([12, 14]),
|
|
144
|
+
iconSize: PropTypes.oneOf(keys(IconSizes)),
|
|
135
145
|
// ---------- React Tooltip exclusive --------------
|
|
136
146
|
// externalHandling: if passed down, React Tooltip is used instead, due to limitations on
|
|
137
147
|
// parents overflow hidden controls
|
|
148
|
+
// data-for={anchorId} && data-tooltip-place="left" are needed on the anchored component
|
|
138
149
|
anchorId: PropTypes.string,
|
|
139
150
|
toolTipIsVisible: PropTypes.bool
|
|
140
151
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","toolTipReact","toolTip","propTypes","bool","string","isRequired","node","func","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number","oneOf"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\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 FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver\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 onMouseOver={handleContentMouseOver}\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 handleContentMouseOver: PropTypes.func\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 iconContainerClassName,\n delayHide = 250,\n fontSize = 14\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, 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 fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\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 handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\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 // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: 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,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,SAAS,GAAG;EAChB,IAAID,KAAK,CAACE,wBADM;EAEhB,IAAIF,KAAK,CAACG;AAFM,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC;AALsB,CAAD,KAMjB;EACJ,IAAI,CAACJ,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,oBAAC,YAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEN,KAAK,CAACU,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYH;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAER,KAAK,CAACW,OADnB;MAEE,eAAY,SAFd;MAGE,cAAYJ,oCAHd;MAIE,WAAW,EAAEE;IAJf,GAMGD,OANH,CADF;EAUD;AACF,CAjCD;;AAmCAJ,cAAc,CAACQ,SAAf,2CAA2B;EACzBP,gBAAgB,EAAEV,SAAS,CAACkB,IADH;EAEzBP,QAAQ,EAAEX,SAAS,CAACmB,MA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IAAI,EAAC,QADP;IAEE,SAAS,EAAEjD,UAAU,CAAC,CAACM,KAAK,CAACgD,oBAAP,EAA6Bf,sBAA7B,CAAD,CAFvB;IAGE,eAAaF,UAHf;IAIE,SAAS,EAAEU,cAJb;IAKE,QAAQ,EAAE;EALZ,gBAOE,oBAAC,eAAD;IACE,SAAS,EAAEzC,KAAK,CAACiD,eADnB;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYnB;EAJd,EAPF,CALF,eAmBE,oBAAC,cAAD;IACE,gBAAgB,EAAEzB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC,OAJX;IAKE,sBAAsB,EAAEC,sBAL1B;IAME,QAAQ,EAAE0B;EANZ,EAnBF,CAXF;AAwCD,CAxFD;;AA0FAP,OAAO,CAAChB,SAAR,2CAAoB;EAClBiB,cAAc,EAAElC,SAAS,CAACuD,SAAV,CAAoB,CAACvD,SAAS,CAACsB,IAAX,EAAiBtB,SAAS,CAACqB,IAA3B,EAAiCrB,SAAS,CAACmB,MAA3C,CAApB,CADE;EAElB,eAAenB,SAAS,CAACmB,MAFP;EAGlB,cAAcnB,SAAS,CAACmB,MAHN;EAIlBP,oCAAoC,EAAEZ,SAAS,CAACmB,MAAV,CAAiBC,UAJrC;EAKlB;EACAkB,sBAAsB,EAAEtC,SAAS,CAACmB,MANhB;EAOlBoB,SAAS,EAAEvC,SAAS,CAACwD,MAPH;EAQlBhB,QAAQ,EAAExC,SAAS,CAACyD,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlB;EACA;EACA;EACA9C,QAAQ,EAAEX,SAAS,CAACmB,MAZF;EAalBT,gBAAgB,EAAEV,SAAS,CAACkB;AAbV,CAApB;AAgBA,eAAee,OAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","toolTipReact","toolTip","bigIconToolTip","smallIconToolTip","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize\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={classnames(\n style.toolTip,\n iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n )}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\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 handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes))\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 iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small'\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, 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 fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\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 // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n // data-for={anchorId} && data-tooltip-place=\"left\" are needed on the anchored component\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE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AAC8B,KAAV,CAAgB3B,IAAI,CAACO,SAAD,CAApB,CATQ;EAUlB;EACA;EACA;EACA;EACAK,QAAQ,EAAEf,SAAS,CAAC0B,MAdF;EAelBZ,gBAAgB,EAAEd,SAAS,CAACyB;AAfV,CAApB;AAkBA,eAAegB,OAAf"}
|
|
@@ -34,12 +34,20 @@
|
|
|
34
34
|
position: absolute;
|
|
35
35
|
border-radius: 7px;
|
|
36
36
|
background-color: cm_grey_700;
|
|
37
|
-
right: -75px;
|
|
38
|
-
bottom: 32px;
|
|
39
37
|
height: auto;
|
|
40
38
|
width: 200px;
|
|
41
39
|
}
|
|
42
40
|
|
|
41
|
+
.bigIconToolTip {
|
|
42
|
+
right: -71px;
|
|
43
|
+
bottom: 31px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.smallIconToolTip {
|
|
47
|
+
right: -75px;
|
|
48
|
+
bottom: 32px;
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
.toolTip::before {
|
|
44
52
|
content: '';
|
|
45
53
|
display: inline-block;
|
|
@@ -88,6 +96,7 @@
|
|
|
88
96
|
visibility: visible !important;
|
|
89
97
|
opacity: 1 !important;
|
|
90
98
|
left: 5px;
|
|
99
|
+
max-width: 400px;
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
/* for keyboard navigation, the position can't be obtained from the mouse */
|
package/es/globals.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module 'react-native/*';\ndeclare module 'color';\ndeclare module 'classnames';\ndeclare module '*.css';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module 'browser-env';\ndeclare module 'react-native/*';\ndeclare module 'color';\ndeclare module 'classnames';\ndeclare module '*.css';\n"],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BattleOpponentListProps } from './prop-types';
|
|
3
|
+
declare const BattleOpponentList: {
|
|
4
|
+
({ opponents }: BattleOpponentListProps): JSX.Element;
|
|
5
|
+
propTypes: {
|
|
6
|
+
opponents: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
7
|
+
isAlreadyEngaged: import("prop-types").Requireable<boolean>;
|
|
8
|
+
isRandom: import("prop-types").Requireable<boolean>;
|
|
9
|
+
photo: import("prop-types").Requireable<string>;
|
|
10
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
11
|
+
displayName: import("prop-types").Requireable<string>;
|
|
12
|
+
tooltipText: import("prop-types").Requireable<string>;
|
|
13
|
+
user_id: import("prop-types").Requireable<string>;
|
|
14
|
+
}> | null | undefined)[]>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default BattleOpponentList;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/battle-opponent-list/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,uBAAuB,EAAC,MAAM,cAAc,CAAC;AAGhE,QAAA,MAAM,kBAAkB;oBAAiB,uBAAuB;;;;;;;;;;;;CAiB/D,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import get from 'lodash/fp/get';
|
|
5
|
+
import map from 'lodash/fp/map';
|
|
6
|
+
import { v5 as uuidV5 } from 'uuid';
|
|
7
|
+
import BattleOpponent from '../../atom/battle-opponent';
|
|
8
|
+
import propTypes from './prop-types';
|
|
9
|
+
import style from './style.css';
|
|
10
|
+
|
|
11
|
+
const BattleOpponentList = ({
|
|
12
|
+
opponents
|
|
13
|
+
}) => {
|
|
14
|
+
const opponentList = useMemo(() => map(opponent => /*#__PURE__*/React.createElement(BattleOpponent, _extends({}, opponent, {
|
|
15
|
+
key: uuidV5('battle-', uuidV5.URL),
|
|
16
|
+
userAvatarSrc: get('photo', opponent)
|
|
17
|
+
})), opponents), [opponents]);
|
|
18
|
+
return /*#__PURE__*/React.createElement("ul", {
|
|
19
|
+
className: style.opponentList
|
|
20
|
+
}, opponentList);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
BattleOpponentList.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
24
|
+
export default BattleOpponentList;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","get","map","v5","uuidV5","BattleOpponent","propTypes","style","BattleOpponentList","opponents","opponentList","opponent","URL"],"sources":["../../../src/molecule/battle-opponent-list/index.tsx"],"sourcesContent":["import React, {useMemo} from 'react';\nimport get from 'lodash/fp/get';\nimport map from 'lodash/fp/map';\nimport {v5 as uuidV5} from 'uuid';\nimport BattleOpponent from '../../atom/battle-opponent';\nimport propTypes, {BattleOpponentListProps} from './prop-types';\nimport style from './style.css';\n\nconst BattleOpponentList = ({opponents}: BattleOpponentListProps) => {\n const opponentList = useMemo(\n () =>\n map(\n opponent => (\n <BattleOpponent\n {...opponent}\n key={uuidV5('battle-', uuidV5.URL)}\n userAvatarSrc={get('photo', opponent)}\n />\n ),\n opponents\n ),\n [opponents]\n );\n\n return <ul className={style.opponentList}>{opponentList}</ul>;\n};\n\nBattleOpponentList.propTypes = propTypes;\n\nexport default BattleOpponentList;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AACA,OAAOC,cAAP,MAA2B,4BAA3B;AACA,OAAOC,SAAP,MAAiD,cAAjD;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,kBAAkB,GAAG,CAAC;EAACC;AAAD,CAAD,KAA0C;EACnE,MAAMC,YAAY,GAAGV,OAAO,CAC1B,MACEE,GAAG,CACDS,QAAQ,iBACN,oBAAC,cAAD,eACMA,QADN;IAEE,GAAG,EAAEP,MAAM,CAAC,SAAD,EAAYA,MAAM,CAACQ,GAAnB,CAFb;IAGE,aAAa,EAAEX,GAAG,CAAC,OAAD,EAAUU,QAAV;EAHpB,GAFD,EAQDF,SARC,CAFqB,EAY1B,CAACA,SAAD,CAZ0B,CAA5B;EAeA,oBAAO;IAAI,SAAS,EAAEF,KAAK,CAACG;EAArB,GAAoCA,YAApC,CAAP;AACD,CAjBD;;AAmBAF,kBAAkB,CAACF,SAAnB,2CAA+BA,SAA/B;AAEA,eAAeE,kBAAf"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
declare const propTypes: {
|
|
3
|
+
opponents: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
4
|
+
isAlreadyEngaged: PropTypes.Requireable<boolean>;
|
|
5
|
+
isRandom: PropTypes.Requireable<boolean>;
|
|
6
|
+
photo: PropTypes.Requireable<string>;
|
|
7
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
|
+
displayName: PropTypes.Requireable<string>;
|
|
9
|
+
tooltipText: PropTypes.Requireable<string>;
|
|
10
|
+
user_id: PropTypes.Requireable<string>;
|
|
11
|
+
}> | null | undefined)[]>;
|
|
12
|
+
};
|
|
13
|
+
declare type MoocBattleOpponent = {
|
|
14
|
+
isAlreadyEngaged?: boolean;
|
|
15
|
+
isRandom?: boolean;
|
|
16
|
+
photo?: string;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
displayName: string;
|
|
19
|
+
tooltipText: string;
|
|
20
|
+
user_id: string;
|
|
21
|
+
};
|
|
22
|
+
export declare type BattleOpponentListProps = {
|
|
23
|
+
opponents: MoocBattleOpponent[];
|
|
24
|
+
};
|
|
25
|
+
export default propTypes;
|
|
26
|
+
//# sourceMappingURL=prop-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/battle-opponent-list/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,QAAA,MAAM,SAAS;;;;;;;;;;CAYd,CAAC;AAEF,aAAK,kBAAkB,GAAG;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,uBAAuB,GAAG;IAAC,SAAS,EAAE,kBAAkB,EAAE,CAAA;CAAC,CAAC;AAExE,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
const propTypes = {
|
|
3
|
+
opponents: PropTypes.arrayOf(PropTypes.shape({
|
|
4
|
+
isAlreadyEngaged: PropTypes.bool,
|
|
5
|
+
isRandom: PropTypes.bool,
|
|
6
|
+
photo: PropTypes.string,
|
|
7
|
+
onClick: PropTypes.func,
|
|
8
|
+
displayName: PropTypes.string,
|
|
9
|
+
tooltipText: PropTypes.string,
|
|
10
|
+
user_id: PropTypes.string
|
|
11
|
+
}))
|
|
12
|
+
};
|
|
13
|
+
export default propTypes;
|
|
14
|
+
//# sourceMappingURL=prop-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-types.js","names":["PropTypes","propTypes","opponents","arrayOf","shape","isAlreadyEngaged","bool","isRandom","photo","string","onClick","func","displayName","tooltipText","user_id"],"sources":["../../../src/molecule/battle-opponent-list/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst propTypes = {\n opponents: PropTypes.arrayOf(\n PropTypes.shape({\n isAlreadyEngaged: PropTypes.bool,\n isRandom: PropTypes.bool,\n photo: PropTypes.string,\n onClick: PropTypes.func,\n displayName: PropTypes.string,\n tooltipText: PropTypes.string,\n user_id: PropTypes.string\n })\n )\n};\n\ntype MoocBattleOpponent = {\n isAlreadyEngaged?: boolean;\n isRandom?: boolean;\n photo?: string;\n onClick?: () => void;\n displayName: string;\n tooltipText: string;\n user_id: string;\n};\n\nexport type BattleOpponentListProps = {opponents: MoocBattleOpponent[]};\n\nexport default propTypes;\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,MAAMC,SAAS,GAAG;EAChBC,SAAS,EAAEF,SAAS,CAACG,OAAV,CACTH,SAAS,CAACI,KAAV,CAAgB;IACdC,gBAAgB,EAAEL,SAAS,CAACM,IADd;IAEdC,QAAQ,EAAEP,SAAS,CAACM,IAFN;IAGdE,KAAK,EAAER,SAAS,CAACS,MAHH;IAIdC,OAAO,EAAEV,SAAS,CAACW,IAJL;IAKdC,WAAW,EAAEZ,SAAS,CAACS,MALT;IAMdI,WAAW,EAAEb,SAAS,CAACS,MANT;IAOdK,OAAO,EAAEd,SAAS,CAACS;EAPL,CAAhB,CADS;AADK,CAAlB;AA0BA,eAAeR,SAAf"}
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import map from 'lodash/fp/map';
|
|
5
|
-
import
|
|
5
|
+
import StatusItem from '../../atom/status-item';
|
|
6
6
|
import style from './style.css';
|
|
7
7
|
import propTypes from './prop-types';
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ const ReviewHeaderSteps = props => {
|
|
|
12
12
|
} = props;
|
|
13
13
|
const items = map.convert({
|
|
14
14
|
cap: false
|
|
15
|
-
})((step, index) => /*#__PURE__*/React.createElement(
|
|
15
|
+
})((step, index) => /*#__PURE__*/React.createElement(StatusItem, _extends({}, step, {
|
|
16
16
|
key: index
|
|
17
17
|
})), steps);
|
|
18
18
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","map","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","map","StatusItem","style","propTypes","ReviewHeaderSteps","props","steps","items","convert","cap","step","index","wrapper"],"sources":["../../../src/molecule/review-header-steps/index.js"],"sourcesContent":["import React from 'react';\nimport map from 'lodash/fp/map';\nimport StatusItem from '../../atom/status-item';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst ReviewHeaderSteps = props => {\n const {steps} = props;\n\n const items = map.convert({cap: false})(\n (step, index) => <StatusItem {...step} key={index} />,\n steps\n );\n\n return (\n <div className={style.wrapper} data-name=\"header-steps\">\n {items}\n </div>\n );\n};\n\nReviewHeaderSteps.propTypes = propTypes;\n\nexport default ReviewHeaderSteps;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,MAAsB,cAAtB;;AAEA,MAAMC,iBAAiB,GAAGC,KAAK,IAAI;EACjC,MAAM;IAACC;EAAD,IAAUD,KAAhB;EAEA,MAAME,KAAK,GAAGP,GAAG,CAACQ,OAAJ,CAAY;IAACC,GAAG,EAAE;EAAN,CAAZ,EACZ,CAACC,IAAD,EAAOC,KAAP,kBAAiB,oBAAC,UAAD,eAAgBD,IAAhB;IAAsB,GAAG,EAAEC;EAA3B,GADL,EAEZL,KAFY,CAAd;EAKA,oBACE;IAAK,SAAS,EAAEJ,KAAK,CAACU,OAAtB;IAA+B,aAAU;EAAzC,GACGL,KADH,CADF;AAKD,CAbD;;AAeAH,iBAAiB,CAACD,SAAlB,2CAA8BA,SAA9B;AAEA,eAAeC,iBAAf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import {
|
|
2
|
+
import { StatusItemProps } from '../../atom/status-item/types';
|
|
3
3
|
declare const propTypes: {
|
|
4
4
|
steps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
5
5
|
current: PropTypes.Requireable<boolean>;
|
|
@@ -9,6 +9,6 @@ declare const propTypes: {
|
|
|
9
9
|
};
|
|
10
10
|
export default propTypes;
|
|
11
11
|
export declare type ReviewHeaderStepsProps = {
|
|
12
|
-
steps:
|
|
12
|
+
steps: StatusItemProps[];
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=prop-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/review-header-steps/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAsC,
|
|
1
|
+
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/review-header-steps/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAsC,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE5F,QAAA,MAAM,SAAS;;;;;;CAEd,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import ReviewHeaderStepItemPropTypes from '../../atom/
|
|
2
|
+
import ReviewHeaderStepItemPropTypes from '../../atom/status-item/types';
|
|
3
3
|
const propTypes = {
|
|
4
4
|
steps: PropTypes.arrayOf(PropTypes.shape(ReviewHeaderStepItemPropTypes))
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","names":["PropTypes","ReviewHeaderStepItemPropTypes","propTypes","steps","arrayOf","shape"],"sources":["../../../src/molecule/review-header-steps/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nimport ReviewHeaderStepItemPropTypes, {
|
|
1
|
+
{"version":3,"file":"prop-types.js","names":["PropTypes","ReviewHeaderStepItemPropTypes","propTypes","steps","arrayOf","shape"],"sources":["../../../src/molecule/review-header-steps/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nimport ReviewHeaderStepItemPropTypes, {StatusItemProps} from '../../atom/status-item/types';\n\nconst propTypes = {\n steps: PropTypes.arrayOf(PropTypes.shape(ReviewHeaderStepItemPropTypes))\n};\n\nexport default propTypes;\n\nexport type ReviewHeaderStepsProps = {\n steps: StatusItemProps[];\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,OAAOC,6BAAP,MAA6D,8BAA7D;AAEA,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAEH,SAAS,CAACI,OAAV,CAAkBJ,SAAS,CAACK,KAAV,CAAgBJ,6BAAhB,CAAlB;AADS,CAAlB;AAIA,eAAeC,SAAf"}
|
|
@@ -139,6 +139,7 @@ declare class MoocHeader extends React.Component<any, any, any> {
|
|
|
139
139
|
isMenuOpen: boolean;
|
|
140
140
|
isFocus: boolean;
|
|
141
141
|
isToolTipOpen: boolean;
|
|
142
|
+
hovered: boolean;
|
|
142
143
|
};
|
|
143
144
|
handleSettingsToggle(): void;
|
|
144
145
|
handleMenuToggle(): void;
|
|
@@ -156,6 +157,8 @@ declare class MoocHeader extends React.Component<any, any, any> {
|
|
|
156
157
|
handleKeyPress(event: any): void;
|
|
157
158
|
componentDidUpdate(prevProps: any, prevState: any, prevContext: any): void;
|
|
158
159
|
menuSettings: any;
|
|
160
|
+
handleMouseEnter: () => void;
|
|
161
|
+
handleMouseLeave: () => void;
|
|
159
162
|
render(): JSX.Element | null;
|
|
160
163
|
}
|
|
161
164
|
import React from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/mooc-header/index.js"],"names":[],"mappings":";AAyBA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6FE;IAEF;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/mooc-header/index.js"],"names":[],"mappings":";AAyBA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6FE;IAEF;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,wBAwBC;IAtBC;;;;;;MAMC;IAgDH,6BAIC;IAED,yBAGC;IAxBD,qCAQC;IAED,wBAGC;IAjBD,+BAEC;IA4BD,2BAKC;IAED,0BAKC;IAED,sBAIC;IAED,qBAIC;IAED,yBAQC;IAED,0BAQC;IAED,0BAIC;IAED,2BAIC;IAED,iCAUC;IA7GD,2EASC;IAGC,kBAAsB;IAmGxB,6BAIE;IAEF,6BAIE;IAEF,6BAscC;CACF"}
|
|
@@ -21,11 +21,25 @@ import style from './style.css';
|
|
|
21
21
|
class MoocHeader extends React.Component {
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
|
+
|
|
25
|
+
this.handleMouseEnter = () => {
|
|
26
|
+
this.setState({
|
|
27
|
+
hovered: true
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
this.handleMouseLeave = () => {
|
|
32
|
+
this.setState({
|
|
33
|
+
hovered: false
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
24
37
|
this.state = {
|
|
25
38
|
isSettingsOpen: false,
|
|
26
39
|
isMenuOpen: false,
|
|
27
40
|
isFocus: false,
|
|
28
|
-
isToolTipOpen: false
|
|
41
|
+
isToolTipOpen: false,
|
|
42
|
+
hovered: false
|
|
29
43
|
};
|
|
30
44
|
this.handleSettingsToggle = this.handleSettingsToggle.bind(this);
|
|
31
45
|
this.handleMenuToggle = this.handleMenuToggle.bind(this);
|
|
@@ -289,8 +303,21 @@ class MoocHeader extends React.Component {
|
|
|
289
303
|
onClick: this.handleLinkClick,
|
|
290
304
|
skinHover: true,
|
|
291
305
|
style: _extends({}, activeColor)
|
|
292
|
-
}, item.title
|
|
306
|
+
}, item.title, /*#__PURE__*/React.createElement("span", {
|
|
307
|
+
className: style.line,
|
|
308
|
+
style: {
|
|
309
|
+
backgroundColor: primaryColor
|
|
310
|
+
}
|
|
311
|
+
}));
|
|
293
312
|
});
|
|
313
|
+
const {
|
|
314
|
+
hovered
|
|
315
|
+
} = this.state;
|
|
316
|
+
|
|
317
|
+
const _hoverStyle = hovered ? {
|
|
318
|
+
color: primaryColor
|
|
319
|
+
} : null;
|
|
320
|
+
|
|
294
321
|
pagesView = /*#__PURE__*/React.createElement("div", {
|
|
295
322
|
className: search.value || isFocus ? style.noItems : style.items
|
|
296
323
|
}, displayedPages, /*#__PURE__*/React.createElement("div", {
|
|
@@ -298,14 +325,22 @@ class MoocHeader extends React.Component {
|
|
|
298
325
|
}, /*#__PURE__*/React.createElement("div", {
|
|
299
326
|
className: style.currentOption,
|
|
300
327
|
"aria-haspopup": "true",
|
|
301
|
-
"data-name": "item-more"
|
|
328
|
+
"data-name": "item-more",
|
|
329
|
+
onMouseEnter: this.handleMouseEnter,
|
|
330
|
+
onMouseLeave: this.handleMouseLeave,
|
|
331
|
+
style: _extends({}, _hoverStyle)
|
|
302
332
|
}, moreAriaLabel, /*#__PURE__*/React.createElement(ArrowDown, {
|
|
303
333
|
style: {
|
|
304
334
|
color: mediumColor
|
|
305
335
|
},
|
|
306
336
|
className: style.caret,
|
|
307
337
|
"aria-label": moreAriaLabel
|
|
308
|
-
})), /*#__PURE__*/React.createElement("
|
|
338
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
339
|
+
className: style.bar,
|
|
340
|
+
style: {
|
|
341
|
+
backgroundColor: primaryColor
|
|
342
|
+
}
|
|
343
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
309
344
|
className: style.optionsGroup
|
|
310
345
|
}, optionsView)));
|
|
311
346
|
}
|