@coorpacademy/components 11.34.2-alpha.94 → 11.34.2
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/button-link-icon/index.js +1 -1
- package/es/atom/button-link-icon/index.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.js +24 -9
- package/es/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/types.d.ts +1 -1
- package/es/molecule/bullet-point-menu-button/types.d.ts.map +1 -1
- package/es/molecule/bullet-point-menu-button/types.js.map +1 -1
- package/es/molecule/learner-skill-card/index.d.ts +40 -25
- package/es/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.js +95 -92
- package/es/molecule/learner-skill-card/index.js.map +1 -1
- package/es/molecule/learner-skill-card/style.css +40 -61
- package/es/template/my-learning/index.d.ts +1 -0
- package/es/template/my-learning/index.d.ts.map +1 -1
- package/es/template/my-learning/index.js +23 -27
- package/es/template/my-learning/index.js.map +1 -1
- package/es/template/my-learning/style.css +6 -9
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +3 -4
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/variables/colors.css +0 -5
- package/es/variables/colors.d.ts +0 -6
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +1 -7
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/button-link-icon/index.js +1 -1
- package/lib/atom/button-link-icon/index.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.js +23 -8
- package/lib/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/types.d.ts +1 -1
- package/lib/molecule/bullet-point-menu-button/types.d.ts.map +1 -1
- package/lib/molecule/bullet-point-menu-button/types.js.map +1 -1
- package/lib/molecule/learner-skill-card/index.d.ts +40 -25
- package/lib/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.js +95 -95
- package/lib/molecule/learner-skill-card/index.js.map +1 -1
- package/lib/molecule/learner-skill-card/style.css +40 -61
- package/lib/template/my-learning/index.d.ts +1 -0
- package/lib/template/my-learning/index.d.ts.map +1 -1
- package/lib/template/my-learning/index.js +23 -27
- package/lib/template/my-learning/index.js.map +1 -1
- package/lib/template/my-learning/style.css +6 -9
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +3 -4
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/variables/colors.css +0 -5
- package/lib/variables/colors.d.ts +0 -6
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +1 -7
- package/lib/variables/colors.js.map +1 -1
- package/locales/cs/global.json +13 -13
- package/locales/de/global.json +13 -13
- package/locales/en/global.json +0 -1
- package/locales/es/global.json +13 -13
- package/locales/et/global.json +13 -13
- package/locales/fi/global.json +13 -13
- package/locales/hr/global.json +13 -13
- package/locales/hu/global.json +13 -13
- package/locales/it/global.json +13 -13
- package/locales/ja/global.json +13 -13
- package/locales/ko/global.json +13 -13
- package/locales/nl/global.json +13 -13
- package/locales/pl/global.json +13 -13
- package/locales/pt/global.json +13 -13
- package/locales/ro/global.json +13 -13
- package/locales/ru/global.json +13 -13
- package/locales/sk/global.json +13 -13
- package/locales/sl/global.json +13 -13
- package/locales/sv/global.json +13 -13
- package/locales/tl/global.json +12 -12
- package/locales/tr/global.json +13 -13
- package/locales/uk/global.json +13 -13
- package/locales/vi/global.json +13 -13
- package/locales/zh_TW/global.json +8 -8
- package/package.json +2 -2
- package/es/molecule/learner-skill-card/prop-types.d.ts +0 -37
- package/es/molecule/learner-skill-card/prop-types.d.ts.map +0 -1
- package/es/molecule/learner-skill-card/prop-types.js +0 -20
- package/es/molecule/learner-skill-card/prop-types.js.map +0 -1
- package/lib/molecule/learner-skill-card/prop-types.d.ts +0 -37
- package/lib/molecule/learner-skill-card/prop-types.d.ts.map +0 -1
- package/lib/molecule/learner-skill-card/prop-types.js +0 -25
- package/lib/molecule/learner-skill-card/prop-types.js.map +0 -1
|
@@ -52,7 +52,7 @@ const ButtonLinkIcon = props => {
|
|
|
52
52
|
const timer = useRef();
|
|
53
53
|
const contentView = getButtonContent(icon, faIcon);
|
|
54
54
|
const styleButton = classnames(getSizeStyle(size), link && style.link, disabled && style.disabled, className);
|
|
55
|
-
const handleOnClick = useCallback(
|
|
55
|
+
const handleOnClick = useCallback(event => onClick(event), [onClick]);
|
|
56
56
|
const handleMouseOver = useCallback(() => {
|
|
57
57
|
timer.current && clearTimeout(timer.current);
|
|
58
58
|
timer.current = setTimeout(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","defaultStyle","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","_extends","onMouseEnter","onMouseLeave","type","onMouseOver","Fragment","fontSize","anchorId","placement","closeToolTipInformationTextAriaLabel","propTypes","process","env","NODE_ENV","oneOf","string","_keys","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, keys} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {ICONS} from '../../util/button-icons';\nimport FaIcon from '../icon';\nimport Link from '../link';\nimport ToolTip from '../tooltip';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst getButtonContent = (icon, faIcon) => {\n const Icon = getOr(null, icon, ICONS);\n\n if (!Icon && !faIcon) {\n return <div className={style.buttonContent} />;\n }\n\n return (\n <div className={style.buttonContent}>\n {faIcon ? <FaIcon iconName={faIcon} /> : <Icon className={style.icon} />}\n </div>\n );\n};\n\nconst getSizeStyle = size => {\n switch (size) {\n case 'small':\n return style.small;\n case 'responsive':\n return style.responsive;\n default:\n return style.defaultStyle;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName = 'button-icon',\n 'aria-label': ariaLabel,\n link,\n onClick,\n className,\n tooltipPlacement = 'left'\n } = props;\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const timer = useRef();\n\n const contentView = getButtonContent(icon, faIcon);\n const styleButton = classnames(\n getSizeStyle(size),\n link && style.link,\n disabled && style.disabled,\n className\n );\n\n const handleOnClick = useCallback(
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","defaultStyle","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","event","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","_extends","onMouseEnter","onMouseLeave","type","onMouseOver","Fragment","fontSize","anchorId","placement","closeToolTipInformationTextAriaLabel","propTypes","process","env","NODE_ENV","oneOf","string","_keys","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, keys} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {ICONS} from '../../util/button-icons';\nimport FaIcon from '../icon';\nimport Link from '../link';\nimport ToolTip from '../tooltip';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst getButtonContent = (icon, faIcon) => {\n const Icon = getOr(null, icon, ICONS);\n\n if (!Icon && !faIcon) {\n return <div className={style.buttonContent} />;\n }\n\n return (\n <div className={style.buttonContent}>\n {faIcon ? <FaIcon iconName={faIcon} /> : <Icon className={style.icon} />}\n </div>\n );\n};\n\nconst getSizeStyle = size => {\n switch (size) {\n case 'small':\n return style.small;\n case 'responsive':\n return style.responsive;\n default:\n return style.defaultStyle;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName = 'button-icon',\n 'aria-label': ariaLabel,\n link,\n onClick,\n className,\n tooltipPlacement = 'left'\n } = props;\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const timer = useRef();\n\n const contentView = getButtonContent(icon, faIcon);\n const styleButton = classnames(\n getSizeStyle(size),\n link && style.link,\n disabled && style.disabled,\n className\n );\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleMouseOver = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setToolTipIsVisible(true);\n timer.current = undefined;\n }, 300);\n }, [timer, setToolTipIsVisible]);\n\n const handleMouseLeave = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n setToolTipIsVisible(false);\n }, [timer, setToolTipIsVisible]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{ariaLabel}</span>,\n [ariaLabel]\n );\n\n const Button = useCallback(\n () =>\n link ? (\n <Link\n {...link}\n {...(ariaLabel\n ? {\n 'data-for': dataName,\n 'data-tip': toolTipIsVisible\n }\n : {})}\n className={styleButton}\n data-name={dataName}\n aria-label={ariaLabel}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {contentView}\n </Link>\n ) : (\n <button\n {...(ariaLabel\n ? {\n 'data-for': dataName,\n 'data-tip': toolTipIsVisible\n }\n : {})}\n type=\"button\"\n aria-label={ariaLabel}\n data-name={dataName}\n data-testid={`button-${dataName}-${className}`}\n className={styleButton}\n onClick={handleOnClick}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n disabled={disabled}\n >\n {contentView}\n </button>\n ),\n [\n link,\n ariaLabel,\n className,\n contentView,\n dataName,\n disabled,\n handleMouseLeave,\n handleMouseOver,\n handleOnClick,\n styleButton,\n toolTipIsVisible\n ]\n );\n\n return (\n <>\n <Button />\n {ariaLabel ? (\n <ToolTip\n fontSize={12}\n anchorId={dataName}\n toolTipIsVisible={toolTipIsVisible}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={ariaLabel}\n />\n ) : null}\n </>\n );\n};\n\nButtonLinkIcon.propTypes = {\n size: PropTypes.oneOf(['default', 'small', 'responsive']),\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n icon: PropTypes.oneOf(keys(ICONS)),\n faIcon: PropTypes.string,\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n disabled: PropTypes.bool,\n className: PropTypes.string,\n tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])\n};\n\nexport default ButtonLinkIcon;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAGC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAO,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,OAAOC,MAAM,MAAM,SAAS;AAC5B,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,OAAO,MAAM,YAAY;AAChC;AACA,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CAACC,IAAI,EAAEC,MAAM,KAAK;EACzC,MAAMC,IAAI,GAAGC,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AAER,SAAS,CAAC2D,KAAK,CAACE,KAAA,CAAK3D,KAAK,CAAC,CAAC;EAClCO,MAAM,EAAET,SAAS,CAAC4D,MAAM;EACxBjC,OAAO,EAAE3B,SAAS,CAAC8D,IAAI;EACvBpC,IAAI,EAAE1B,SAAS,CAAC+D,KAAK,CAAC;IACpBC,IAAI,EAAEhE,SAAS,CAAC4D,MAAM;IACtBK,QAAQ,EAAEjE,SAAS,CAACkE,IAAI;IACxBC,MAAM,EAAEnE,SAAS,CAAC2D,KAAK,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC;EAChE,CAAC,CAAC;EACFpC,QAAQ,EAAEvB,SAAS,CAACkE,IAAI;EACxBrD,SAAS,EAAEb,SAAS,CAAC4D,MAAM;EAC3BhC,gBAAgB,EAAE5B,SAAS,CAAC2D,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;AACtE,CAAC;AAED,eAAetC,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,0BAA0B,EAAC,MAAM,SAAS,CAAC;AAG9D,QAAA,MAAM,qBAAqB;YAAW,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,0BAA0B,EAAC,MAAM,SAAS,CAAC;AAG9D,QAAA,MAAM,qBAAqB;YAAW,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF/D,CAAC;AAIF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _noop from "lodash/fp/noop";
|
|
2
|
-
import React, { useCallback, useState, useEffect } from 'react';
|
|
2
|
+
import React, { useCallback, useState, useEffect, useRef } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import ButtonLinkIcon from '../../atom/button-link-icon';
|
|
5
5
|
import ButtonMenu from '../../atom/button-menu';
|
|
@@ -17,17 +17,31 @@ const BulletPointMenuButton = props => {
|
|
|
17
17
|
'data-name': dataName = 'bullet-point-button'
|
|
18
18
|
} = props;
|
|
19
19
|
const [visible, setVisible] = useState(false);
|
|
20
|
-
const
|
|
20
|
+
const wrapperRef = useRef(null);
|
|
21
|
+
const handleOnClick = useCallback(event => {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
event.preventDefault();
|
|
21
24
|
onClick();
|
|
22
|
-
setVisible(
|
|
23
|
-
}, [onClick]);
|
|
25
|
+
setVisible(!visible);
|
|
26
|
+
}, [onClick, visible]);
|
|
24
27
|
useEffect(() => {
|
|
25
|
-
const
|
|
26
|
-
|
|
28
|
+
const handleClick = clickEvent => {
|
|
29
|
+
if (wrapperRef && wrapperRef.current && !wrapperRef.current.contains(clickEvent.target)) {
|
|
30
|
+
setVisible(false);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (visible) {
|
|
34
|
+
document.addEventListener('click', handleClick);
|
|
35
|
+
document.addEventListener('touchstart', handleClick);
|
|
36
|
+
} else {
|
|
37
|
+
document.removeEventListener('click', handleClick);
|
|
38
|
+
document.removeEventListener('touchstart', handleClick);
|
|
39
|
+
}
|
|
27
40
|
return () => {
|
|
28
|
-
document.removeEventListener('
|
|
41
|
+
document.removeEventListener('click', handleClick);
|
|
42
|
+
document.removeEventListener('touchstart', handleClick);
|
|
29
43
|
};
|
|
30
|
-
}, []);
|
|
44
|
+
}, [visible]);
|
|
31
45
|
const menuProps = {
|
|
32
46
|
'data-name': 'button-menu',
|
|
33
47
|
buttons
|
|
@@ -36,7 +50,8 @@ const BulletPointMenuButton = props => {
|
|
|
36
50
|
const menu = visible ? /*#__PURE__*/React.createElement("div", {
|
|
37
51
|
className: menuStyle,
|
|
38
52
|
"data-name": "menu-wrapper",
|
|
39
|
-
"aria-label": menuAriaLabel
|
|
53
|
+
"aria-label": menuAriaLabel,
|
|
54
|
+
ref: wrapperRef
|
|
40
55
|
}, /*#__PURE__*/React.createElement(ButtonMenu, menuProps)) : null;
|
|
41
56
|
const bulletPointButtonProps = {
|
|
42
57
|
size: 'default',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","classnames","ButtonLinkIcon","ButtonMenu","propTypes","style","BulletPointMenuButton","props","disabled","buttonAriaLabel","menuAriaLabel","onClick","_noop","buttons","menuButtonClassName","isBulkMenu","dataName","visible","setVisible","handleOnClick","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","useRef","classnames","ButtonLinkIcon","ButtonMenu","propTypes","style","BulletPointMenuButton","props","disabled","buttonAriaLabel","menuAriaLabel","onClick","_noop","buttons","menuButtonClassName","isBulkMenu","dataName","visible","setVisible","wrapperRef","handleOnClick","event","stopPropagation","preventDefault","handleClick","clickEvent","current","contains","target","document","addEventListener","removeEventListener","menuProps","menuStyle","bulletPointMenu","bulkBulletPointMenu","menu","createElement","className","ref","bulletPointButtonProps","size","icon","bulletPointWrapper","process","env","NODE_ENV"],"sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useEffect, useRef} from 'react';\nimport classnames from 'classnames';\nimport {noop} from 'lodash/fp';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport ButtonMenu from '../../atom/button-menu';\nimport propTypes, {BulletPointMenuButtonProps} from './types';\nimport style from './style.css';\n\nconst BulletPointMenuButton = (props: BulletPointMenuButtonProps) => {\n const {\n disabled = false,\n buttonAriaLabel,\n menuAriaLabel,\n onClick = noop,\n buttons,\n menuButtonClassName,\n isBulkMenu,\n 'data-name': dataName = 'bullet-point-button'\n } = props;\n const [visible, setVisible] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const handleOnClick = useCallback(\n (event: React.MouseEvent | React.TouchEvent) => {\n event.stopPropagation();\n event.preventDefault();\n onClick();\n setVisible(!visible);\n },\n [onClick, visible]\n );\n\n useEffect(() => {\n const handleClick = (clickEvent: MouseEvent | TouchEvent) => {\n if (\n wrapperRef &&\n wrapperRef.current &&\n !wrapperRef.current.contains(clickEvent.target as Node)\n ) {\n setVisible(false);\n }\n };\n if (visible) {\n document.addEventListener('click', handleClick);\n document.addEventListener('touchstart', handleClick);\n } else {\n document.removeEventListener('click', handleClick);\n document.removeEventListener('touchstart', handleClick);\n }\n return () => {\n document.removeEventListener('click', handleClick);\n document.removeEventListener('touchstart', handleClick);\n };\n }, [visible]);\n\n const menuProps = {\n 'data-name': 'button-menu',\n buttons\n };\n\n const menuStyle = classnames(\n style.bulletPointMenu,\n isBulkMenu && style.bulkBulletPointMenu,\n style.visible\n );\n\n const menu = visible ? (\n <div className={menuStyle} data-name=\"menu-wrapper\" aria-label={menuAriaLabel} ref={wrapperRef}>\n <ButtonMenu {...menuProps} />\n </div>\n ) : null;\n\n const bulletPointButtonProps = {\n size: 'default',\n 'aria-label': buttonAriaLabel,\n 'data-name': dataName,\n icon: 'bullet-point',\n onClick: handleOnClick,\n disabled,\n className: menuButtonClassName\n };\n\n return (\n <div className={style.bulletPointWrapper} data-name=\"bullet-point-wrapper\">\n <ButtonLinkIcon {...bulletPointButtonProps} />\n {menu}\n </div>\n );\n};\n\nBulletPointMenuButton.propTypes = propTypes;\n\nexport default BulletPointMenuButton;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAO,OAAO;AACrE,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,cAAc,MAAM,6BAA6B;AACxD,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,SAAS,MAAoC,SAAS;AAC7D,OAAOC,KAAK,MAA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CAACE,mBAAmB,CAAC,YAAY,EAAEP,WAAW,CAAC;IACzD,CAAC;EACH,CAAC,EAAE,CAACP,OAAO,CAAC,CAAC;EAEb,MAAMe,SAAS,GAAG;IAChB,WAAW,EAAE,aAAa;IAC1BnB;EACF,CAAC;EAED,MAAMoB,SAAS,GAAGhC,UAAU,CAC1BI,KAAK,CAAC6B,eAAe,EACrBnB,UAAU,IAAIV,KAAK,CAAC8B,mBAAmB,EACvC9B,KAAK,CAACY,OACR,CAAC;EAED,MAAMmB,IAAI,GAAGnB,OAAO,gBAClBrB,KAAA,CAAAyC,aAAA;IAAKC,SAAS,EAAEL,SAAU;IAAC,aAAU,cAAc;IAAC,cAAYvB,aAAc;IAAC6B,GAAG,EAAEpB;EAAW,gBAC7FvB,KAAA,CAAAyC,aAAA,CAAClC,UAAU,EAAK6B,SAAY,CACzB,CAAC,GACJ,IAAI;EAER,MAAMQ,sBAAsB,GAAG;IAC7BC,IAAI,EAAE,SAAS;IACf,YAAY,EAAEhC,eAAe;IAC7B,WAAW,EAAEO,QAAQ;IACrB0B,IAAI,EAAE,cAAc;IACpB/B,OAAO,EAAES,aAAa;IACtBZ,QAAQ;IACR8B,SAAS,EAAExB;EACb,CAAC;EAED,oBACElB,KAAA,CAAAyC,aAAA;IAAKC,SAAS,EAAEjC,KAAK,CAACsC,kBAAmB;IAAC,aAAU;EAAsB,gBACxE/C,KAAA,CAAAyC,aAAA,CAACnC,cAAc,EAAKsC,sBAAyB,CAAC,EAC7CJ,IACE,CAAC;AAEV,CAAC;AAED9B,qBAAqB,CAACF,SAAS,GAAAwC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG1C,SAAS;AAE3C,eAAeE,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASd,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASd,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,iCAAiC,GAAG;IAAC,KAAK,EAAE,0BAA0B,CAAA;CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ButtonMenu","propTypes","string","disabled","bool","buttonAriaLabel","menuAriaLabel","buttons","onClick","func","menuButtonClassName","isBulkMenu"],"sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ButtonMenu from '../../atom/button-menu';\nimport {ButtonProps} from '../../atom/button-menu/types';\n\nconst propTypes = {\n 'data-name': PropTypes.string,\n disabled: PropTypes.bool,\n buttonAriaLabel: PropTypes.string,\n menuAriaLabel: PropTypes.string,\n buttons: ButtonMenu.propTypes.buttons,\n onClick: PropTypes.func,\n menuButtonClassName: PropTypes.string,\n isBulkMenu: PropTypes.bool\n};\n\nexport default propTypes;\n\nexport type BulletPointMenuButtonProps = {\n 'data-name'?: string;\n disabled?: boolean;\n buttonAriaLabel?: string;\n menuAriaLabel?: string;\n buttons: ButtonProps[];\n onClick
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ButtonMenu","propTypes","string","disabled","bool","buttonAriaLabel","menuAriaLabel","buttons","onClick","func","menuButtonClassName","isBulkMenu"],"sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ButtonMenu from '../../atom/button-menu';\nimport {ButtonProps} from '../../atom/button-menu/types';\n\nconst propTypes = {\n 'data-name': PropTypes.string,\n disabled: PropTypes.bool,\n buttonAriaLabel: PropTypes.string,\n menuAriaLabel: PropTypes.string,\n buttons: ButtonMenu.propTypes.buttons,\n onClick: PropTypes.func,\n menuButtonClassName: PropTypes.string,\n isBulkMenu: PropTypes.bool\n};\n\nexport default propTypes;\n\nexport type BulletPointMenuButtonProps = {\n 'data-name'?: string;\n disabled?: boolean;\n buttonAriaLabel?: string;\n menuAriaLabel?: string;\n buttons: ButtonProps[];\n onClick?: () => void;\n menuButtonClassName?: string;\n isBulkMenu?: boolean;\n};\n\nexport type BulletPointMenuButtonPropsFixture = {props: BulletPointMenuButtonProps};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,wBAAwB;AAG/C,MAAMC,SAAS,GAAG;EAChB,WAAW,EAAEF,SAAS,CAACG,MAAM;EAC7BC,QAAQ,EAAEJ,SAAS,CAACK,IAAI;EACxBC,eAAe,EAAEN,SAAS,CAACG,MAAM;EACjCI,aAAa,EAAEP,SAAS,CAACG,MAAM;EAC/BK,OAAO,EAAEP,UAAU,CAACC,SAAS,CAACM,OAAO;EACrCC,OAAO,EAAET,SAAS,CAACU,IAAI;EACvBC,mBAAmB,EAAEX,SAAS,CAACG,MAAM;EACrCS,UAAU,EAAEZ,SAAS,CAACK;AACxB,CAAC;AAED,eAAeH,SAAS","ignoreList":[]}
|
|
@@ -1,29 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
export default LearnerSkillCard;
|
|
2
|
+
declare function LearnerSkillCard(props: any, context: any): JSX.Element;
|
|
3
|
+
declare namespace LearnerSkillCard {
|
|
4
|
+
namespace contextTypes {
|
|
5
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
+
common: PropTypes.Requireable<{
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}>;
|
|
9
|
+
images: PropTypes.Requireable<PropTypes.InferProps<{
|
|
10
|
+
'logo-mobile': PropTypes.Requireable<any>;
|
|
11
|
+
logo: PropTypes.Requireable<any>;
|
|
12
|
+
'logo-email': PropTypes.Requireable<any>;
|
|
13
|
+
login: PropTypes.Requireable<any>;
|
|
14
|
+
}>>;
|
|
15
|
+
icons: PropTypes.Requireable<{
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}>;
|
|
18
|
+
mod: PropTypes.Requireable<{
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
}>;
|
|
21
|
+
courses: PropTypes.Requireable<any[]>;
|
|
22
|
+
texts: PropTypes.Requireable<{
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}>;
|
|
20
25
|
}>>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
const translate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
+
}
|
|
28
|
+
const propTypes: {
|
|
29
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
30
|
+
skillTitle: PropTypes.Requireable<string>;
|
|
31
|
+
skillAriaLabel: PropTypes.Requireable<string>;
|
|
32
|
+
focus: PropTypes.Requireable<boolean>;
|
|
33
|
+
metrics: PropTypes.Requireable<PropTypes.InferProps<{
|
|
34
|
+
score: PropTypes.Requireable<number>;
|
|
35
|
+
content: PropTypes.Requireable<number>;
|
|
36
|
+
questionsToReview: PropTypes.Requireable<number>;
|
|
24
37
|
}>>;
|
|
25
|
-
|
|
38
|
+
review: PropTypes.Requireable<boolean>;
|
|
39
|
+
onReviewClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
+
onExploreClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
41
|
};
|
|
27
|
-
}
|
|
28
|
-
|
|
42
|
+
}
|
|
43
|
+
import PropTypes from "prop-types";
|
|
29
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learner-skill-card/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learner-skill-card/index.js"],"names":[],"mappings":";AAaA,yEAiHC"}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _get from "lodash/fp/get";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { convert } from 'css-color-function';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Icon from '../../atom/icon';
|
|
6
|
+
import ButtonLink from '../../atom/button-link';
|
|
7
|
+
import Provider from '../../atom/provider';
|
|
3
8
|
import ProgressBar from '../progress-bar';
|
|
4
9
|
import { COLORS } from '../../variables/colors';
|
|
5
|
-
import { createGradientBackground } from '../../util/get-background-gradient-color';
|
|
6
|
-
import FaIcon from '../../atom/icon';
|
|
7
|
-
import propTypes from './prop-types';
|
|
8
10
|
import style from './style.css';
|
|
9
11
|
const MAX_SCORE = 100;
|
|
10
|
-
export const updateBackgroundImage = (ref, background) => {
|
|
11
|
-
if (ref.current) {
|
|
12
|
-
ref.current.style.backgroundImage = background;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
12
|
const LearnerSkillCard = (props, context) => {
|
|
16
13
|
const {
|
|
17
14
|
'aria-label': ariaLabel,
|
|
18
|
-
cardIndex,
|
|
19
15
|
skillTitle,
|
|
20
16
|
skillAriaLabel,
|
|
21
|
-
focus,
|
|
17
|
+
focus = false,
|
|
22
18
|
metrics,
|
|
23
|
-
|
|
19
|
+
review = false,
|
|
20
|
+
onReviewClick,
|
|
24
21
|
onExploreClick
|
|
25
22
|
} = props;
|
|
26
23
|
const {
|
|
@@ -28,95 +25,76 @@ const LearnerSkillCard = (props, context) => {
|
|
|
28
25
|
content,
|
|
29
26
|
questionsToReview = 0
|
|
30
27
|
} = metrics;
|
|
31
|
-
const translate = GetTranslateFromContext(context);
|
|
32
28
|
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} =
|
|
29
|
+
skin,
|
|
30
|
+
translate
|
|
31
|
+
} = context;
|
|
32
|
+
const primarySkinColor = _get('common.primary', skin);
|
|
33
|
+
const reviewLocale = translate('Review');
|
|
34
|
+
const exploreLocale = translate('Explore');
|
|
36
35
|
const questionsLocale = translate('skill_chart_side_panel_questions_to_review');
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [focusBackground]);
|
|
44
|
-
const handleMouseLeave = useCallback(() => {
|
|
45
|
-
updateBackgroundImage(headerBackgroundRef, defaultBackground);
|
|
46
|
-
}, [defaultBackground]);
|
|
47
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
"data-testid": `learner-skill-card-wrapper-${cardIndex}`,
|
|
49
|
-
onClick: onExploreClick,
|
|
50
|
-
className: style.learnerSkillCardContainer,
|
|
51
|
-
"aria-label": ariaLabel,
|
|
52
|
-
onMouseEnter: handleMouseEnter,
|
|
53
|
-
onMouseLeave: handleMouseLeave
|
|
54
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
-
"data-testid": "learner-skill-card-icon-header-wrapper",
|
|
56
|
-
ref: headerBackgroundRef,
|
|
57
|
-
className: style.iconHeaderWrapper,
|
|
58
|
-
style: {
|
|
59
|
-
backgroundImage: defaultBackground,
|
|
60
|
-
color: tagTextColor
|
|
61
|
-
}
|
|
62
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: style.iconWrapper,
|
|
64
|
-
"data-testid": "learner-skill-card-icon-wrapper"
|
|
65
|
-
}, /*#__PURE__*/React.createElement(FaIcon, {
|
|
66
|
-
iconName: name,
|
|
67
|
-
iconColor: color,
|
|
68
|
-
size: {
|
|
69
|
-
faSize: 20,
|
|
70
|
-
wrapperSize: 44
|
|
36
|
+
const skillFocusLocale = translate('skill_focus');
|
|
37
|
+
const buttonReviewProps = {
|
|
38
|
+
customStyle: {
|
|
39
|
+
backgroundColor: '#FFF',
|
|
40
|
+
transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',
|
|
41
|
+
padding: '0px'
|
|
71
42
|
},
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
disabled: !review,
|
|
44
|
+
onClick: onReviewClick,
|
|
45
|
+
'aria-label': `${skillTitle}, ${reviewLocale}`,
|
|
46
|
+
label: reviewLocale,
|
|
47
|
+
'data-name': 'learner-skill-card-review-button'
|
|
48
|
+
};
|
|
49
|
+
const buttonExploreProps = {
|
|
74
50
|
customStyle: {
|
|
75
|
-
|
|
51
|
+
backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),
|
|
52
|
+
color: primarySkinColor,
|
|
53
|
+
transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
|
|
54
|
+
},
|
|
55
|
+
hoverColor: '#FFFFFF',
|
|
56
|
+
hoverBackgroundColor: primarySkinColor,
|
|
57
|
+
onClick: onExploreClick,
|
|
58
|
+
'aria-label': `${skillTitle}, ${exploreLocale}`,
|
|
59
|
+
label: exploreLocale,
|
|
60
|
+
'data-name': 'learner-skill-card-explore-button',
|
|
61
|
+
icon: {
|
|
62
|
+
position: 'left',
|
|
63
|
+
faIcon: {
|
|
64
|
+
name: 'compass',
|
|
65
|
+
backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),
|
|
66
|
+
color: primarySkinColor,
|
|
67
|
+
size: 16
|
|
68
|
+
}
|
|
76
69
|
}
|
|
77
|
-
}
|
|
78
|
-
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: style.learnerSkillCardWrapper,
|
|
73
|
+
"data-name": "learner-skill-card-wrapper",
|
|
74
|
+
"aria-label": ariaLabel
|
|
75
|
+
}, questionsToReview ? /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: style.skillQuestionsWrapper
|
|
79
77
|
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: style.skillInformation,
|
|
79
|
+
"data-name": "skill-questions"
|
|
80
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
className: style.skillInformationNumber
|
|
82
|
+
}, questionsToReview), "\xA0", questionsLocale)) : null, /*#__PURE__*/React.createElement("div", {
|
|
80
83
|
className: style.skillTitleWrapper
|
|
81
84
|
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
|
|
83
|
-
style: {
|
|
84
|
-
backgroundColor: tagBackgroundColor,
|
|
85
|
-
color: tagTextColor
|
|
86
|
-
}
|
|
87
|
-
}, /*#__PURE__*/React.createElement(FaIcon, {
|
|
88
|
-
iconName: badgeIconName,
|
|
89
|
-
backgroundColor: tagBackgroundColor,
|
|
90
|
-
size: {
|
|
91
|
-
faSize: 10,
|
|
92
|
-
wrapperSize: 16
|
|
93
|
-
}
|
|
94
|
-
}), badgeLocale), /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: style.questionWrapper
|
|
96
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
-
"data-name": "skill-card-title",
|
|
85
|
+
"data-name": "skill-title",
|
|
98
86
|
className: style.skillTitle,
|
|
99
87
|
"aria-label": skillAriaLabel || skillTitle
|
|
100
|
-
}, skillTitle), /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
className: style.
|
|
102
|
-
}, /*#__PURE__*/React.createElement(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
className: style.skillInformation,
|
|
106
|
-
"data-name": "learner-skill-card-skill-questions-wrapper"
|
|
107
|
-
}, /*#__PURE__*/React.createElement(FaIcon, {
|
|
108
|
-
iconName: 'circle',
|
|
109
|
-
iconColor: COLORS.cm_grey_400,
|
|
88
|
+
}, skillTitle), focus ? /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
className: style.skillFocusBadge
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
91
|
+
iconName: "bullseye-arrow",
|
|
92
|
+
backgroundColor: "#DDD1FF",
|
|
110
93
|
size: {
|
|
111
|
-
faSize:
|
|
112
|
-
|
|
113
|
-
customStyle: {
|
|
114
|
-
padding: 0,
|
|
115
|
-
height: 'auto'
|
|
94
|
+
faSize: 10,
|
|
95
|
+
wrapperSize: 16
|
|
116
96
|
}
|
|
117
|
-
}), /*#__PURE__*/React.createElement("
|
|
118
|
-
"data-name": "learner-skill-card-questions-to-review"
|
|
119
|
-
}, questionsToReview), "\xA0", questionsLocale) : null)))), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
}), skillFocusLocale) : null), content ? /*#__PURE__*/React.createElement("div", {
|
|
120
98
|
className: style.progressInformations
|
|
121
99
|
}, /*#__PURE__*/React.createElement(ProgressBar, {
|
|
122
100
|
value: score,
|
|
@@ -126,11 +104,36 @@ const LearnerSkillCard = (props, context) => {
|
|
|
126
104
|
style: {
|
|
127
105
|
backgroundColor: COLORS.positive
|
|
128
106
|
}
|
|
129
|
-
})
|
|
107
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: style.progressInformation,
|
|
109
|
+
"data-name": "completed-percentage"
|
|
110
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
111
|
+
className: style.progressInformationNumber
|
|
112
|
+
}, score, "%"))) : null, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: style.ctaWrapper,
|
|
114
|
+
"data-name": "cta-wrapper"
|
|
115
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, buttonReviewProps), /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: style.buttonWrapper,
|
|
117
|
+
"data-name": "button-explore-wrapper"
|
|
118
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, buttonExploreProps))));
|
|
130
119
|
};
|
|
131
120
|
LearnerSkillCard.contextTypes = {
|
|
121
|
+
skin: Provider.childContextTypes.skin,
|
|
132
122
|
translate: Provider.childContextTypes.translate
|
|
133
123
|
};
|
|
134
|
-
LearnerSkillCard.propTypes = process.env.NODE_ENV !== "production" ?
|
|
124
|
+
LearnerSkillCard.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
125
|
+
'aria-label': PropTypes.string,
|
|
126
|
+
skillTitle: PropTypes.string,
|
|
127
|
+
skillAriaLabel: PropTypes.string,
|
|
128
|
+
focus: PropTypes.bool,
|
|
129
|
+
metrics: PropTypes.shape({
|
|
130
|
+
score: PropTypes.number,
|
|
131
|
+
content: PropTypes.number,
|
|
132
|
+
questionsToReview: PropTypes.number
|
|
133
|
+
}),
|
|
134
|
+
review: PropTypes.bool,
|
|
135
|
+
onReviewClick: PropTypes.func,
|
|
136
|
+
onExploreClick: PropTypes.func
|
|
137
|
+
} : {};
|
|
135
138
|
export default LearnerSkillCard;
|
|
136
139
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","useRef","Provider","GetTranslateFromContext","ProgressBar","COLORS","createGradientBackground","FaIcon","propTypes","style","MAX_SCORE","updateBackgroundImage","ref","background","current","backgroundImage","LearnerSkillCard","props","context","ariaLabel","cardIndex","skillTitle","skillAriaLabel","focus","metrics","icon","onExploreClick","score","content","questionsToReview","translate","color","name","questionsLocale","badgeIconName","badgeLocale","tagTextColor","tagBackgroundColor","purple_700","purple_100","cm_grey_500","gray","headerBackgroundRef","defaultBackground","focusBackground","handleMouseEnter","handleMouseLeave","createElement","onClick","className","learnerSkillCardContainer","onMouseEnter","onMouseLeave","iconHeaderWrapper","iconWrapper","iconName","iconColor","size","faSize","wrapperSize","borderRadius","gradientBackground","customStyle","border","learnerSkillCardContent","skillTitleWrapper","skillFocusBadge","backgroundColor","questionWrapper","contentAndQuestionsWrapper","skillInformation","cm_grey_400","padding","height","progressInformations","value","displayInfo","max","progressWrapper","positive","contextTypes","childContextTypes","process","env","NODE_ENV"],"sources":["../../../src/molecule/learner-skill-card/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useRef} from 'react';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport ProgressBar from '../progress-bar';\nimport {COLORS} from '../../variables/colors';\nimport {createGradientBackground} from '../../util/get-background-gradient-color';\nimport FaIcon from '../../atom/icon';\nimport propTypes, {LearnerSkillCardProps} from './prop-types';\nimport style from './style.css';\n\nconst MAX_SCORE = 100;\n\nexport const updateBackgroundImage = (ref: React.RefObject<HTMLDivElement>, background: string) => {\n if (ref.current) {\n ref.current.style.backgroundImage = background;\n }\n};\n\nconst LearnerSkillCard = (props: LearnerSkillCardProps, context: WebContextValues) => {\n const {\n 'aria-label': ariaLabel,\n cardIndex,\n skillTitle,\n skillAriaLabel,\n focus,\n metrics,\n icon,\n onExploreClick\n } = props;\n const {score, content, questionsToReview = 0} = metrics;\n const translate = GetTranslateFromContext(context);\n const {color, name} = icon;\n const questionsLocale = translate('skill_chart_side_panel_questions_to_review') as string;\n const [badgeIconName, badgeLocale, tagTextColor, tagBackgroundColor] = focus\n ? ['bullseye-arrow', translate('skill_focus') as string, COLORS.purple_700, COLORS.purple_100]\n : ['shapes', translate('skill') as string, COLORS.cm_grey_500, COLORS.gray];\n const headerBackgroundRef = useRef<HTMLDivElement | null>(null);\n const defaultBackground = useMemo(() => createGradientBackground(color, '93%', '100%'), [color]);\n const focusBackground = useMemo(() => createGradientBackground(color, '83%', '100%'), [color]);\n const handleMouseEnter = useCallback(() => {\n updateBackgroundImage(headerBackgroundRef, focusBackground);\n }, [focusBackground]);\n const handleMouseLeave = useCallback(() => {\n updateBackgroundImage(headerBackgroundRef, defaultBackground);\n }, [defaultBackground]);\n return (\n <div\n data-testid={`learner-skill-card-wrapper-${cardIndex}`}\n onClick={onExploreClick}\n className={style.learnerSkillCardContainer}\n aria-label={ariaLabel}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <div\n data-testid=\"learner-skill-card-icon-header-wrapper\"\n ref={headerBackgroundRef}\n className={style.iconHeaderWrapper}\n style={{backgroundImage: defaultBackground, color: tagTextColor}}\n >\n <div className={style.iconWrapper} data-testid=\"learner-skill-card-icon-wrapper\">\n <FaIcon\n {...{\n iconName: name,\n iconColor: color,\n size: {\n faSize: 20,\n wrapperSize: 44\n },\n borderRadius: '12px',\n gradientBackground: true,\n customStyle: {border: '4px solid white'}\n }}\n />\n </div>\n </div>\n <div className={style.learnerSkillCardContent}>\n <div className={style.skillTitleWrapper}>\n <div\n className={style.skillFocusBadge}\n style={{\n backgroundColor: tagBackgroundColor,\n color: tagTextColor\n }}\n >\n <FaIcon\n {...{\n iconName: badgeIconName,\n backgroundColor: tagBackgroundColor,\n size: {\n faSize: 10,\n wrapperSize: 16\n }\n }}\n />\n {badgeLocale}\n </div>\n\n <div className={style.questionWrapper}>\n <div\n data-name=\"skill-card-title\"\n className={style.skillTitle}\n aria-label={skillAriaLabel || skillTitle}\n >\n {skillTitle}\n </div>\n <div className={style.contentAndQuestionsWrapper}>\n <div data-name=\"learner-skill-card-skill-content-number\">\n {content} {translate('content')}\n </div>\n {questionsToReview ? (\n <div\n className={style.skillInformation}\n data-name=\"learner-skill-card-skill-questions-wrapper\"\n >\n <FaIcon\n {...{\n iconName: 'circle',\n iconColor: COLORS.cm_grey_400,\n size: {faSize: 4},\n customStyle: {padding: 0, height: 'auto'}\n }}\n />\n <span data-name=\"learner-skill-card-questions-to-review\">\n {questionsToReview}\n </span>\n {questionsLocale}\n </div>\n ) : null}\n </div>\n </div>\n </div>\n </div>\n <div className={style.progressInformations}>\n <ProgressBar\n value={score}\n displayInfo={false}\n max={MAX_SCORE}\n className={style.progressWrapper}\n style={{backgroundColor: COLORS.positive}}\n />\n </div>\n </div>\n );\n};\n\nLearnerSkillCard.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nLearnerSkillCard.propTypes = propTypes;\n\nexport default LearnerSkillCard;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAO,OAAO;AACzD,OAAOC,QAAQ,IAAGC,uBAAuB,QAAO,qBAAqB;AAErE,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,SAAQC,wBAAwB,QAAO,0CAA0C;AACjF,OAAOC,MAAM,MAAM,iBAAiB;AACpC,OAAOC,SAAS,MAA+B,cAAc;AAC7D,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,SAAS,GAAG,GAAG;AAErB,OAAO,MAAMC,qBAAqB,GAAGA,CAACC,GAAoC,EAAEC,UAAkB,KAAK;EACjG,IAAID,GAAG,CAACE,OAAO,EAAE;IACfF,GAAG,CAACE,OAAO,CAACL,KAAK,CAACM,eAAe,GAAGF,UAAU;EAChD;AACF,CAAC;AA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EhD,KAAM;IACbiD,WAAW,EAAE,KAAM;IACnBC,GAAG,EAAEnE,SAAU;IACfuC,SAAS,EAAExC,KAAK,CAACqE,eAAgB;IACjCrE,KAAK,EAAE;MAAC0D,eAAe,EAAE9D,MAAM,CAAC0E;IAAQ;EAAE,CAC3C,CACE,CACF,CAAC;AAEV,CAAC;AAED/D,gBAAgB,CAACgE,YAAY,GAAG;EAC9BlD,SAAS,EAAE5B,QAAQ,CAAC+E,iBAAiB,CAACnD;AACxC,CAAC;AAEDd,gBAAgB,CAACR,SAAS,GAAA0E,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG5E,SAAS;AAEtC,eAAeQ,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","convert","PropTypes","Icon","ButtonLink","Provider","ProgressBar","COLORS","style","MAX_SCORE","LearnerSkillCard","props","context","ariaLabel","skillTitle","skillAriaLabel","focus","metrics","review","onReviewClick","onExploreClick","score","content","questionsToReview","skin","translate","primarySkinColor","_get","reviewLocale","exploreLocale","questionsLocale","skillFocusLocale","buttonReviewProps","customStyle","backgroundColor","transition","padding","disabled","onClick","label","buttonExploreProps","color","hoverColor","hoverBackgroundColor","icon","position","faIcon","name","size","createElement","className","learnerSkillCardWrapper","skillQuestionsWrapper","skillInformation","skillInformationNumber","skillTitleWrapper","skillFocusBadge","iconName","faSize","wrapperSize","progressInformations","value","displayInfo","max","progressWrapper","positive","progressInformation","progressInformationNumber","ctaWrapper","buttonWrapper","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","string","bool","shape","number","func"],"sources":["../../../src/molecule/learner-skill-card/index.js"],"sourcesContent":["import React from 'react';\nimport {convert} from 'css-color-function';\nimport {get} from 'lodash/fp';\nimport PropTypes from 'prop-types';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport Provider from '../../atom/provider';\nimport ProgressBar from '../progress-bar';\nimport {COLORS} from '../../variables/colors';\nimport style from './style.css';\n\nconst MAX_SCORE = 100;\n\nconst LearnerSkillCard = (props, context) => {\n const {\n 'aria-label': ariaLabel,\n skillTitle,\n skillAriaLabel,\n focus = false,\n metrics,\n review = false,\n onReviewClick,\n onExploreClick\n } = props;\n const {score, content, questionsToReview = 0} = metrics;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n const reviewLocale = translate('Review');\n const exploreLocale = translate('Explore');\n const questionsLocale = translate('skill_chart_side_panel_questions_to_review');\n const skillFocusLocale = translate('skill_focus');\n\n const buttonReviewProps = {\n customStyle: {\n backgroundColor: '#FFF',\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out',\n padding: '0px'\n },\n disabled: !review,\n onClick: onReviewClick,\n 'aria-label': `${skillTitle}, ${reviewLocale}`,\n label: reviewLocale,\n 'data-name': 'learner-skill-card-review-button'\n };\n\n const buttonExploreProps = {\n customStyle: {\n backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),\n color: primarySkinColor,\n transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'\n },\n hoverColor: '#FFFFFF',\n hoverBackgroundColor: primarySkinColor,\n onClick: onExploreClick,\n 'aria-label': `${skillTitle}, ${exploreLocale}`,\n label: exploreLocale,\n 'data-name': 'learner-skill-card-explore-button',\n icon: {\n position: 'left',\n faIcon: {\n name: 'compass',\n backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),\n color: primarySkinColor,\n size: 16\n }\n }\n };\n return (\n <div\n className={style.learnerSkillCardWrapper}\n data-name=\"learner-skill-card-wrapper\"\n aria-label={ariaLabel}\n >\n {questionsToReview ? (\n <div className={style.skillQuestionsWrapper}>\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n {questionsLocale}\n </div>\n </div>\n ) : null}\n <div className={style.skillTitleWrapper}>\n <div\n data-name=\"skill-title\"\n className={style.skillTitle}\n aria-label={skillAriaLabel || skillTitle}\n >\n {skillTitle}\n </div>\n {focus ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {skillFocusLocale}\n </div>\n ) : null}\n </div>\n {content ? (\n <div className={style.progressInformations}>\n <ProgressBar\n value={score}\n displayInfo={false}\n max={MAX_SCORE}\n className={style.progressWrapper}\n style={{backgroundColor: COLORS.positive}}\n />\n <div className={style.progressInformation} data-name=\"completed-percentage\">\n <span className={style.progressInformationNumber}>{score}%</span>\n </div>\n </div>\n ) : null}\n <div className={style.ctaWrapper} data-name=\"cta-wrapper\">\n <ButtonLink {...buttonReviewProps} />\n <div className={style.buttonWrapper} data-name=\"button-explore-wrapper\">\n <ButtonLink {...buttonExploreProps} />\n </div>\n </div>\n </div>\n );\n};\n\nLearnerSkillCard.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nLearnerSkillCard.propTypes = {\n 'aria-label': PropTypes.string,\n skillTitle: PropTypes.string,\n skillAriaLabel: PropTypes.string,\n focus: PropTypes.bool,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n content: PropTypes.number,\n questionsToReview: PropTypes.number\n }),\n review: PropTypes.bool,\n onReviewClick: PropTypes.func,\n onExploreClick: PropTypes.func\n};\n\nexport default LearnerSkillCard;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,OAAO,QAAO,oBAAoB;AAE1C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,SAAS,GAAG,GAAG;AAErB,MAAMC,gBAAgB,GAAGA,CAACC,KAAK,EAAEC,OAAO,KAAK;EAC3C,MAA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