@coorpacademy/components 11.32.20-alpha.39 → 11.32.21
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/index.d.ts +2 -0
- package/es/atom/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +22 -8
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-link/types.d.ts +4 -0
- package/es/atom/button-link/types.d.ts.map +1 -1
- package/es/atom/button-link/types.js +2 -0
- package/es/atom/button-link/types.js.map +1 -1
- package/es/molecule/base-modal/index.d.ts.map +1 -1
- package/es/molecule/base-modal/index.js +6 -10
- package/es/molecule/base-modal/index.js.map +1 -1
- package/es/molecule/cm-popin/types.d.ts +4 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/dashboard/cards-list/index.d.ts +0 -1
- package/es/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/es/molecule/dashboard/cards-list/index.js +3 -2
- package/es/molecule/dashboard/cards-list/index.js.map +1 -1
- package/es/molecule/expandible-actionable-table/index.d.ts +2 -0
- package/es/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/types.d.ts +2 -0
- package/es/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.js +7 -10
- package/es/molecule/learner-skill-card/index.js.map +1 -1
- package/es/molecule/learning-priority-card/index.d.ts +0 -1
- package/es/molecule/learning-priority-card/index.d.ts.map +1 -1
- package/es/molecule/learning-priority-card/index.js +7 -10
- package/es/molecule/learning-priority-card/index.js.map +1 -1
- package/es/molecule/learning-priority-card/types.d.ts +0 -2
- package/es/molecule/learning-priority-card/types.d.ts.map +1 -1
- package/es/molecule/learning-priority-card/types.js +1 -2
- package/es/molecule/learning-priority-card/types.js.map +1 -1
- package/es/molecule/skill-card/index.d.ts.map +1 -1
- package/es/molecule/skill-card/index.js +5 -8
- package/es/molecule/skill-card/index.js.map +1 -1
- package/es/organism/list-items/index.d.ts +4 -0
- package/es/organism/setup-header/index.d.ts +8 -0
- package/es/organism/wizard-contents/index.d.ts +6 -0
- package/es/template/app-player/loading/index.d.ts +4 -0
- package/es/template/app-player/player/index.d.ts +8 -0
- package/es/template/app-player/player/slides/index.d.ts +4 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +4 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +4 -1
- package/es/template/app-player/popin-end/summary.d.ts +0 -1
- package/es/template/app-review/index.d.ts +4 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +4 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +4 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-create/index.d.ts +8 -0
- package/es/template/back-office/brand-create/index.d.ts.map +1 -1
- package/es/template/back-office/brand-list/index.d.ts +8 -0
- package/es/template/back-office/brand-list/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +22 -0
- package/es/template/back-office/dashboard-preview/index.d.ts +8 -0
- package/es/template/back-office/layout/index.d.ts +8 -0
- package/es/template/back-office/layout/index.d.ts.map +1 -1
- package/es/template/common/dashboard/index.d.ts +8 -0
- package/es/template/common/dashboard/index.d.ts.map +1 -1
- package/es/template/common/dashboard/index.js +0 -1
- package/es/template/common/dashboard/index.js.map +1 -1
- package/es/template/common/search-page/index.d.ts +4 -1
- package/es/template/external-course/index.d.ts +4 -0
- package/es/template/my-learning/index.d.ts +0 -2
- package/es/template/my-learning/index.d.ts.map +1 -1
- package/es/template/my-learning/index.js +12 -19
- package/es/template/my-learning/index.js.map +1 -1
- package/es/template/my-learning/style.css +1 -1
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +4 -8
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/template/teams-dashboard/index.d.ts +0 -1
- package/lib/atom/button-link/index.d.ts +2 -0
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +21 -7
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-link/types.d.ts +4 -0
- package/lib/atom/button-link/types.d.ts.map +1 -1
- package/lib/atom/button-link/types.js +2 -0
- package/lib/atom/button-link/types.js.map +1 -1
- package/lib/molecule/base-modal/index.d.ts.map +1 -1
- package/lib/molecule/base-modal/index.js +5 -9
- package/lib/molecule/base-modal/index.js.map +1 -1
- package/lib/molecule/cm-popin/types.d.ts +4 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.d.ts +0 -1
- package/lib/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.js +3 -2
- package/lib/molecule/dashboard/cards-list/index.js.map +1 -1
- package/lib/molecule/expandible-actionable-table/index.d.ts +2 -0
- package/lib/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/types.d.ts +2 -0
- package/lib/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.js +6 -9
- package/lib/molecule/learner-skill-card/index.js.map +1 -1
- package/lib/molecule/learning-priority-card/index.d.ts +0 -1
- package/lib/molecule/learning-priority-card/index.d.ts.map +1 -1
- package/lib/molecule/learning-priority-card/index.js +7 -10
- package/lib/molecule/learning-priority-card/index.js.map +1 -1
- package/lib/molecule/learning-priority-card/types.d.ts +0 -2
- package/lib/molecule/learning-priority-card/types.d.ts.map +1 -1
- package/lib/molecule/learning-priority-card/types.js +1 -2
- package/lib/molecule/learning-priority-card/types.js.map +1 -1
- package/lib/molecule/skill-card/index.d.ts.map +1 -1
- package/lib/molecule/skill-card/index.js +4 -7
- package/lib/molecule/skill-card/index.js.map +1 -1
- package/lib/organism/list-items/index.d.ts +4 -0
- package/lib/organism/setup-header/index.d.ts +8 -0
- package/lib/organism/wizard-contents/index.d.ts +6 -0
- package/lib/template/app-player/loading/index.d.ts +4 -0
- package/lib/template/app-player/player/index.d.ts +8 -0
- package/lib/template/app-player/player/slides/index.d.ts +4 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +4 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +4 -1
- package/lib/template/app-player/popin-end/summary.d.ts +0 -1
- package/lib/template/app-review/index.d.ts +4 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +4 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +4 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-create/index.d.ts +8 -0
- package/lib/template/back-office/brand-create/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-list/index.d.ts +8 -0
- package/lib/template/back-office/brand-list/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +22 -0
- package/lib/template/back-office/dashboard-preview/index.d.ts +8 -0
- package/lib/template/back-office/layout/index.d.ts +8 -0
- package/lib/template/back-office/layout/index.d.ts.map +1 -1
- package/lib/template/common/dashboard/index.d.ts +8 -0
- package/lib/template/common/dashboard/index.d.ts.map +1 -1
- package/lib/template/common/dashboard/index.js +0 -1
- package/lib/template/common/dashboard/index.js.map +1 -1
- package/lib/template/common/search-page/index.d.ts +4 -1
- package/lib/template/external-course/index.d.ts +4 -0
- package/lib/template/my-learning/index.d.ts +0 -2
- package/lib/template/my-learning/index.d.ts.map +1 -1
- package/lib/template/my-learning/index.js +13 -19
- package/lib/template/my-learning/index.js.map +1 -1
- package/lib/template/my-learning/style.css +1 -1
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +4 -8
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/template/teams-dashboard/index.d.ts +0 -1
- package/package.json +2 -2
|
@@ -19,6 +19,8 @@ declare const ButtonLink: {
|
|
|
19
19
|
download: import("prop-types").Requireable<boolean>;
|
|
20
20
|
target: import("prop-types").Requireable<string>;
|
|
21
21
|
}>>;
|
|
22
|
+
hoverBackgroundColor: import("prop-types").Requireable<string>;
|
|
23
|
+
hoverColor: import("prop-types").Requireable<string>;
|
|
22
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
23
25
|
className: import("prop-types").Requireable<string>;
|
|
24
26
|
customStyle: import("prop-types").Requireable<import("prop-types").InferProps<{}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AA+C7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CA4FzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -2,7 +2,7 @@ import _noop from "lodash/fp/noop";
|
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
4
|
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
5
|
+
import React, { useCallback, useState, useMemo } from 'react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import Link from '../link';
|
|
8
8
|
import FaIcon from '../icon';
|
|
@@ -10,7 +10,7 @@ import { ICONS } from '../../util/button-icons';
|
|
|
10
10
|
import propTypes from './types';
|
|
11
11
|
import style from './style.css';
|
|
12
12
|
|
|
13
|
-
const getButtonContent = (icon, content) => {
|
|
13
|
+
const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverColor) => {
|
|
14
14
|
const {
|
|
15
15
|
type,
|
|
16
16
|
faIcon,
|
|
@@ -20,6 +20,7 @@ const getButtonContent = (icon, content) => {
|
|
|
20
20
|
position: ''
|
|
21
21
|
};
|
|
22
22
|
const Icon = type && ICONS[type];
|
|
23
|
+
const isApplyHover = hovered && hoverBackgroundColor && hoverColor;
|
|
23
24
|
|
|
24
25
|
if (!Icon && !faIcon) {
|
|
25
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -31,8 +32,8 @@ const getButtonContent = (icon, content) => {
|
|
|
31
32
|
|
|
32
33
|
const iconComponent = faIcon ? /*#__PURE__*/React.createElement(FaIcon, {
|
|
33
34
|
iconName: faIcon.name,
|
|
34
|
-
iconColor: faIcon.color,
|
|
35
|
-
backgroundColor: faIcon.backgroundColor,
|
|
35
|
+
iconColor: isApplyHover ? hoverColor : faIcon.color,
|
|
36
|
+
backgroundColor: isApplyHover ? hoverBackgroundColor : faIcon.backgroundColor,
|
|
36
37
|
size: {
|
|
37
38
|
faSize: faIcon.size,
|
|
38
39
|
wrapperSize: faIcon.size
|
|
@@ -53,6 +54,8 @@ const ButtonLink = props => {
|
|
|
53
54
|
type,
|
|
54
55
|
label,
|
|
55
56
|
content,
|
|
57
|
+
hoverBackgroundColor,
|
|
58
|
+
hoverColor,
|
|
56
59
|
disabled = false,
|
|
57
60
|
icon,
|
|
58
61
|
'data-name': dataName,
|
|
@@ -65,10 +68,19 @@ const ButtonLink = props => {
|
|
|
65
68
|
customStyle,
|
|
66
69
|
useTitle = true
|
|
67
70
|
} = props;
|
|
68
|
-
const contentView = getButtonContent(icon, content ?? label);
|
|
69
71
|
const styleButton = classnames(className, style.button, type === 'primary' && style.primary, type === 'secondary' && style.secondary, type === 'tertiary' && style.tertiary, type === 'text' && style.text, type === 'dangerous' && style.dangerous, link && style.link, disabled && style.disabled);
|
|
72
|
+
const [hovered, setHovered] = useState(false);
|
|
70
73
|
const handleOnClick = useCallback(() => onClick(), [onClick]);
|
|
71
74
|
const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);
|
|
75
|
+
const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);
|
|
76
|
+
const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
|
|
77
|
+
|
|
78
|
+
const _customStyle = useMemo(() => {
|
|
79
|
+
return _extends({}, customStyle, (hoverBackgroundColor || hoverColor) && hovered ? {
|
|
80
|
+
backgroundColor: hoverBackgroundColor,
|
|
81
|
+
color: hoverColor
|
|
82
|
+
} : null);
|
|
83
|
+
}, [hoverBackgroundColor, hoverColor, hovered, customStyle]);
|
|
72
84
|
|
|
73
85
|
if (link) {
|
|
74
86
|
return /*#__PURE__*/React.createElement(Link, _extends({}, link, useTitle && {
|
|
@@ -79,7 +91,7 @@ const ButtonLink = props => {
|
|
|
79
91
|
"data-name": dataName,
|
|
80
92
|
"data-testid": dataTestId,
|
|
81
93
|
"aria-label": ariaLabel || label
|
|
82
|
-
}),
|
|
94
|
+
}), getButtonContent(icon, content ?? label));
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
return /*#__PURE__*/React.createElement("button", _extends({}, useTitle && {
|
|
@@ -89,13 +101,15 @@ const ButtonLink = props => {
|
|
|
89
101
|
"aria-label": ariaLabel || label,
|
|
90
102
|
"data-name": dataName,
|
|
91
103
|
"data-testid": dataTestId,
|
|
92
|
-
style:
|
|
104
|
+
style: _customStyle,
|
|
93
105
|
className: styleButton,
|
|
94
106
|
onClick: handleOnClick,
|
|
95
107
|
onKeyDown: handleOnKeyDown,
|
|
108
|
+
onMouseOver: handleMouseOver,
|
|
109
|
+
onMouseLeave: handleMouseLeave,
|
|
96
110
|
tabIndex: 0,
|
|
97
111
|
disabled: disabled
|
|
98
|
-
}),
|
|
112
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor));
|
|
99
113
|
};
|
|
100
114
|
|
|
101
115
|
ButtonLink.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","classnames","Link","FaIcon","ICONS","propTypes","style","getButtonContent","icon","content","type","faIcon","position","Icon","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","ButtonLink","props","disabled","dataName","dataTestId","ariaLabel","link","onClick","onKeyDown","className","customStyle","useTitle","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useMemo","classnames","Link","FaIcon","ICONS","propTypes","style","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","type","faIcon","position","Icon","isApplyHover","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","ButtonLink","props","disabled","dataName","dataTestId","ariaLabel","link","onClick","onKeyDown","className","customStyle","useTitle","styleButton","button","primary","secondary","tertiary","text","dangerous","setHovered","handleOnClick","handleOnKeyDown","event","handleMouseOver","handleMouseLeave","_customStyle","title"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n const isApplyHover = hovered && hoverBackgroundColor && hoverColor;\n\n if (!Icon && !faIcon) {\n return (\n <div className={style.buttonContent}>\n <span className={style.label}>{content}</span>\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...{\n iconName: faIcon.name,\n iconColor: isApplyHover ? hoverColor : faIcon.color,\n backgroundColor: isApplyHover ? hoverBackgroundColor : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n }\n }}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true\n } = props;\n const styleButton = classnames(\n className,\n style.button,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n link && style.link,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n style={customStyle}\n className={styleButton}\n data-name={dataName}\n data-testid={dataTestId}\n aria-label={ariaLabel || label}\n >\n {getButtonContent(icon, content ?? label)}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n type=\"button\"\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAoD,OAApD;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,MAAP,MAAmB,SAAnB;AACA,SAAQC,KAAR,QAAoB,yBAApB;AACA,OAAOC,SAAP,MAAmD,SAAnD;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CACvBC,IADuB,EAEvBC,OAFuB,EAGvBC,OAHuB,EAIvBC,oBAJuB,EAKvBC,UALuB,KAMpB;EACH,MAAM;IAACC,IAAD;IAAOC,MAAP;IAAeC;EAAf,IAA2BP,IAAI,IAAI;IAACK,IAAI,EAAE,EAAP;IAAWE,QAAQ,EAAE;EAArB,CAAzC;EACA,MAAMC,IAAI,GAAGH,IAAI,IAAIT,KAAK,CAACS,IAAD,CAA1B;EACA,MAAMI,YAAY,GAAGP,OAAO,IAAIC,oBAAX,IAAmCC,UAAxD;;EAEA,IAAI,CAACI,IAAD,IAAS,CAACF,MAAd,EAAsB;IACpB,oBACE;MAAK,SAAS,EAAER,KAAK,CAACY;IAAtB,gBACE;MAAM,SAAS,EAAEZ,KAAK,CAACa;IAAvB,GAA+BV,OAA/B,CADF,CADF;EA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SAAS,EAAEE,WANb;MAOE,aAAWT,QAPb;MAQE,eAAaC,UARf;MASE,cAAYC,SAAS,IAAIf;IAT3B,IAWGZ,gBAAgB,CAACC,IAAD,EAAOC,OAAO,IAAIU,KAAlB,CAXnB,CADF;EAeD;;EAED,oBACE,2CACOqB,QAAQ,IAAI;IACfe,KAAK,EAAErB,SAAS,IAAIf;EADL,CADnB;IAIE,IAAI,EAAC,QAJP;IAKE,cAAYe,SAAS,IAAIf,KAL3B;IAME,aAAWa,QANb;IAOE,eAAaC,UAPf;IAQE,KAAK,EAAEqB,YART;IASE,SAAS,EAAEb,WATb;IAUE,OAAO,EAAEQ,aAVX;IAWE,SAAS,EAAEC,eAXb;IAYE,WAAW,EAAEE,eAZf;IAaE,YAAY,EAAEC,gBAbhB;IAcE,QAAQ,EAAE,CAdZ;IAeE,QAAQ,EAAEtB;EAfZ,IAiBGxB,gBAAgB,CAACC,IAAD,EAAOC,OAAO,IAAIU,KAAlB,EAAyBT,OAAzB,EAAkCC,oBAAlC,EAAwDC,UAAxD,CAjBnB,CADF;AAqBD,CA5FD;;AA8FAiB,UAAU,CAACxB,SAAX,2CAAuBA,SAAvB;AAEA,eAAewB,UAAf"}
|
|
@@ -18,6 +18,8 @@ declare const propTypes: {
|
|
|
18
18
|
download: PropTypes.Requireable<boolean>;
|
|
19
19
|
target: PropTypes.Requireable<string>;
|
|
20
20
|
}>>;
|
|
21
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
22
|
+
hoverColor: PropTypes.Requireable<string>;
|
|
21
23
|
disabled: PropTypes.Requireable<boolean>;
|
|
22
24
|
className: PropTypes.Requireable<string>;
|
|
23
25
|
customStyle: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
@@ -48,6 +50,8 @@ export declare type ButtonLinkProps = {
|
|
|
48
50
|
download?: boolean;
|
|
49
51
|
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
50
52
|
};
|
|
53
|
+
hoverBackgroundColor?: string;
|
|
54
|
+
hoverColor?: string;
|
|
51
55
|
disabled?: boolean;
|
|
52
56
|
className?: string;
|
|
53
57
|
customStyle?: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAE9C,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAE9C,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;CAsBd,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AACF,oBAAY,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;KAClD,CAAC;IACF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,oBAAY,OAAO,GAAG;IAAC,KAAK,EAAE,eAAe,CAAA;CAAC,CAAC;AAE/C,eAAe,SAAS,CAAC"}
|
|
@@ -18,6 +18,8 @@ const propTypes = {
|
|
|
18
18
|
download: PropTypes.bool,
|
|
19
19
|
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])
|
|
20
20
|
}),
|
|
21
|
+
hoverBackgroundColor: PropTypes.string,
|
|
22
|
+
hoverColor: PropTypes.string,
|
|
21
23
|
disabled: PropTypes.bool,
|
|
22
24
|
className: PropTypes.string,
|
|
23
25
|
customStyle: PropTypes.shape({})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","label","string","content","node","icon","shape","position","onClick","func","link","href","download","bool","target","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n label: PropTypes.string,\n content: PropTypes.node,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\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 customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n label?: string;\n content?: React.ReactNode;\n 'aria-label'?: string;\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACM,MAFD;EAGhBC,OAAO,EAAEP,SAAS,CAACQ,IAHH;EAIhB,cAAcR,SAAS,CAACM,MAJR;EAKhB,aAAaN,SAAS,CAACM,MALP;EAMhB,eAAeN,SAAS,CAACM,MANT;EAOhBG,IAAI,EAAET,SAAS,CAACU,KAAV,CAAgB;IACpBC,QAAQ,EAAEX,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CADU;IAEpBD,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,MAAKH,KAAL,CAAhB;EAFc,CAAhB,CAPU;EAWhBW,OAAO,EAAEZ,SAAS,CAACa,IAXH;EAYhBC,IAAI,EAAEd,SAAS,CAACU,KAAV,CAAgB;IACpBK,IAAI,EAAEf,SAAS,CAACM,MADI;IAEpBU,QAAQ,EAAEhB,SAAS,CAACiB,IAFA;IAGpBC,MAAM,EAAElB,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB;EAHY,CAAhB,CAZU;EAiBhBe,
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","label","string","content","node","icon","shape","position","onClick","func","link","href","download","bool","target","hoverBackgroundColor","hoverColor","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n label: PropTypes.string,\n content: PropTypes.node,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\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 hoverBackgroundColor: PropTypes.string,\n hoverColor: PropTypes.string,\n disabled: PropTypes.bool,\n className: PropTypes.string,\n customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n label?: string;\n content?: React.ReactNode;\n 'aria-label'?: string;\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n hoverBackgroundColor?: string;\n hoverColor?: string;\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACM,MAFD;EAGhBC,OAAO,EAAEP,SAAS,CAACQ,IAHH;EAIhB,cAAcR,SAAS,CAACM,MAJR;EAKhB,aAAaN,SAAS,CAACM,MALP;EAMhB,eAAeN,SAAS,CAACM,MANT;EAOhBG,IAAI,EAAET,SAAS,CAACU,KAAV,CAAgB;IACpBC,QAAQ,EAAEX,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CADU;IAEpBD,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,MAAKH,KAAL,CAAhB;EAFc,CAAhB,CAPU;EAWhBW,OAAO,EAAEZ,SAAS,CAACa,IAXH;EAYhBC,IAAI,EAAEd,SAAS,CAACU,KAAV,CAAgB;IACpBK,IAAI,EAAEf,SAAS,CAACM,MADI;IAEpBU,QAAQ,EAAEhB,SAAS,CAACiB,IAFA;IAGpBC,MAAM,EAAElB,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB;EAHY,CAAhB,CAZU;EAiBhBe,oBAAoB,EAAEnB,SAAS,CAACM,MAjBhB;EAkBhBc,UAAU,EAAEpB,SAAS,CAACM,MAlBN;EAmBhBe,QAAQ,EAAErB,SAAS,CAACiB,IAnBJ;EAoBhBK,SAAS,EAAEtB,SAAS,CAACM,MApBL;EAqBhBiB,WAAW,EAAEvB,SAAS,CAACU,KAAV,CAAgB,EAAhB;AArBG,CAAlB;AA6DA,eAAeR,SAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/base-modal/index.js"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/base-modal/index.js"],"names":[],"mappings":";AASA,yEA4GC"}
|
|
@@ -3,7 +3,7 @@ import _isEmpty from "lodash/fp/isEmpty";
|
|
|
3
3
|
|
|
4
4
|
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); }
|
|
5
5
|
|
|
6
|
-
import React, { useCallback
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { convert } from 'css-color-function';
|
|
9
9
|
import Provider from '../../atom/provider';
|
|
@@ -24,9 +24,6 @@ const BaseModal = (props, context) => {
|
|
|
24
24
|
const {
|
|
25
25
|
skin
|
|
26
26
|
} = context;
|
|
27
|
-
const [hovered, setHovered] = useState(false);
|
|
28
|
-
const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);
|
|
29
|
-
const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
|
|
30
27
|
const Footer = useCallback(() => {
|
|
31
28
|
if (_isEmpty(footer)) return null;
|
|
32
29
|
if (typeof footer === 'function') return footer();
|
|
@@ -60,13 +57,12 @@ const BaseModal = (props, context) => {
|
|
|
60
57
|
onClick: onCancel,
|
|
61
58
|
label: cancelLabel,
|
|
62
59
|
disabled: cancelDisabled
|
|
63
|
-
}) : null, onConfirm && confirmLabel ? /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
onMouseOver: handleMouseOver,
|
|
65
|
-
onMouseLeave: handleMouseLeave
|
|
66
|
-
}, /*#__PURE__*/React.createElement(ButtonLink, _extends({
|
|
60
|
+
}) : null, onConfirm && confirmLabel ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ButtonLink, _extends({
|
|
67
61
|
customStyle: {
|
|
68
|
-
backgroundColor:
|
|
62
|
+
backgroundColor: primarySkinColor
|
|
69
63
|
},
|
|
64
|
+
hoverBackgroundColor: convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`),
|
|
65
|
+
hoverColor: '#FFFFFF',
|
|
70
66
|
className: style.footerConfirmButton,
|
|
71
67
|
type: 'primary',
|
|
72
68
|
onClick: onConfirm,
|
|
@@ -84,7 +80,7 @@ const BaseModal = (props, context) => {
|
|
|
84
80
|
} : {}))) : null), text ? /*#__PURE__*/React.createElement("div", {
|
|
85
81
|
className: `${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`
|
|
86
82
|
}, text) : null);
|
|
87
|
-
}, [footer,
|
|
83
|
+
}, [footer, skin, style, convert, _get, _isEmpty]);
|
|
88
84
|
if (!isOpen || !title || !children) return null;
|
|
89
85
|
|
|
90
86
|
function handleOnClose(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","convert","Provider","Icon","ButtonLink","style","BaseModal","props","context","title","description","headerIcon","children","isOpen","footer","onClose","skin","hovered","setHovered","handleMouseOver","handleMouseLeave","Footer","cancelButton","confirmButton","text","isError","label","cancelLabel","onCancel","disabled","cancelDisabled","confirmLabel","onConfirm","confirmDisabled","iconName","primarySkinColor","footerCTAWrapper","className","footerCancelButton","type","onClick","customStyle","backgroundColor","footerConfirmButton","icon","position","faIcon","name","color","size","footerDescription","footerDescriptionError","handleOnClose","e","stopPropagation","modalWrapper","modal","header","faSize","wrapperSize","headerContent","headerTitle","headerDescription","headerCloseIcon","body","contextTypes","childContextTypes","propTypes","string","shape","node","bool","oneOfType","func","boolean"],"sources":["../../../src/molecule/base-modal/index.js"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, get} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../atom/provider';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst BaseModal = (props, context) => {\n const {title, description, headerIcon, children, isOpen, footer, onClose} = props;\n const {skin} = context;\n\n const [hovered, setHovered] = useState(false);\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const Footer = useCallback(() => {\n if (isEmpty(footer)) return null;\n if (typeof footer === 'function') return footer();\n\n const {cancelButton, confirmButton, text, isError} = footer;\n const {label: cancelLabel, onCancel, disabled: cancelDisabled} = cancelButton || {};\n const {\n label: confirmLabel,\n onConfirm,\n disabled: confirmDisabled,\n iconName\n } = confirmButton || {};\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div className={style.footer}>\n <div className={style.footerCTAWrapper}>\n {onCancel && cancelLabel ? (\n <ButtonLink\n {...{\n className: style.footerCancelButton,\n type: 'secondary',\n onClick: onCancel,\n label: cancelLabel,\n disabled: cancelDisabled\n }}\n />\n ) : null}\n {onConfirm && confirmLabel ? (\n <div onMouseOver={handleMouseOver} onMouseLeave={handleMouseLeave}>\n <ButtonLink\n {...{\n customStyle: {\n backgroundColor: hovered\n ? convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)\n : primarySkinColor\n },\n className: style.footerConfirmButton,\n type: 'primary',\n onClick: onConfirm,\n label: confirmLabel,\n disabled: confirmDisabled,\n ...(iconName\n ? {\n icon: {\n position: 'left',\n faIcon: {\n name: iconName,\n color: '#FFFFFF',\n size: 16\n }\n }\n }\n : {})\n }}\n />\n </div>\n ) : null}\n </div>\n {text ? (\n <div\n className={`${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`}\n >\n {text}\n </div>\n ) : null}\n </div>\n );\n }, [footer, hovered, handleMouseOver, handleMouseLeave, skin]);\n\n if (!isOpen || !title || !children) return null;\n\n function handleOnClose(e) {\n e?.stopPropagation();\n onClose();\n }\n\n return (\n <div className={style.modalWrapper}>\n <div className={style.modal}>\n <header className={style.header}>\n {headerIcon?.name ? (\n <div className={style.headerIcon}>\n <Icon\n iconName={headerIcon.name}\n iconColor={headerIcon.color}\n backgroundColor={headerIcon.backgroundColor}\n size={{faSize: 20, wrapperSize: 48}}\n />\n </div>\n ) : null}\n <div className={style.headerContent}>\n <div className={style.headerTitle}>{title}</div>\n {description ? <div className={style.headerDescription}>{description}</div> : null}\n </div>\n <div className={style.headerCloseIcon} onClick={handleOnClose}>\n <Icon iconName=\"close\" backgroundColor=\"#F4F4F5\" size={{faSize: 14, wrapperSize: 28}} />\n </div>\n </header>\n <div className={style.body}>{children}</div>\n <Footer />\n </div>\n </div>\n );\n};\n\nBaseModal.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBaseModal.propTypes = {\n title: PropTypes.string,\n headerIcon: PropTypes.shape({\n name: PropTypes.string,\n color: PropTypes.string,\n backgroundColor: PropTypes.string\n }),\n description: PropTypes.string,\n children: PropTypes.node,\n isOpen: PropTypes.bool,\n footer: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n text: PropTypes.string,\n isError: PropTypes.boolean,\n cancelButton: PropTypes.shape({\n label: PropTypes.string,\n onCancel: PropTypes.func,\n disabled: PropTypes.bool\n }),\n confirmButton: PropTypes.shape({\n label: PropTypes.string,\n onConfirm: PropTypes.func,\n iconName: PropTypes.string,\n disabled: PropTypes.bool\n })\n })\n ]),\n onClose: PropTypes.func\n};\n\nexport default BaseModal;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,SAAS,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACpC,MAAM;IAACC,KAAD;IAAQC,WAAR;IAAqBC,UAArB;IAAiCC,QAAjC;IAA2CC,MAA3C;IAAmDC,MAAnD;IAA2DC;EAA3D,IAAsER,KAA5E;EACA,MAAM;IAACS;EAAD,IAASR,OAAf;EAEA,MAAM,CAACS,OAAD,EAAUC,UAAV,IAAwBnB,QAAQ,CAAC,KAAD,CAAtC;EACA,MAAMoB,eAAe,GAAGrB,WAAW,CAAC,MAAMoB,UAAU,CAAC,IAAD,CAAjB,EAAyB,CAACA,UAAD,CAAzB,CAAnC;EACA,MAAME,gBAAgB,GAAGtB,WAAW,CAAC,MAAMoB,UAAU,CAAC,KAAD,CAAjB,EAA0B,CAACA,UAAD,CAA1B,CAApC;EAEA,MAAMG,MAAM,GAAGvB,WAAW,CAAC,MAAM;IAC/B,IAAI,SAAQgB,MAAR,CAAJ,EAAqB,OAAO,IAAP;IACrB,IAAI,OAAOA,MAAP,KAAkB,UAAtB,EAAkC,OAAOA,MAAM,EAAb;IAElC,MAAM;MAACQ,YAAD;MAAeC,aAAf;MAA8BC,IAA9B;MAAoCC;IAApC,IAA+CX,MAArD;IACA,MAAM;MAACY,KAAK,EAAEC,WAAR;MAAqBC,QAArB;MAA+BC,QAAQ,EAAEC;IAAzC,IAA2DR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AAhB;EARD,CAAhB,CAF0B,CAApB,CAVY;EA4BpBxD,OAAO,EAAEf,SAAS,CAACyE;AA5BC,CAAtB;AA+BA,eAAenE,SAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","convert","Provider","Icon","ButtonLink","style","BaseModal","props","context","title","description","headerIcon","children","isOpen","footer","onClose","skin","Footer","cancelButton","confirmButton","text","isError","label","cancelLabel","onCancel","disabled","cancelDisabled","confirmLabel","onConfirm","confirmDisabled","iconName","primarySkinColor","footerCTAWrapper","className","footerCancelButton","type","onClick","customStyle","backgroundColor","hoverBackgroundColor","hoverColor","footerConfirmButton","icon","position","faIcon","name","color","size","footerDescription","footerDescriptionError","handleOnClose","e","stopPropagation","modalWrapper","modal","header","faSize","wrapperSize","headerContent","headerTitle","headerDescription","headerCloseIcon","body","contextTypes","childContextTypes","propTypes","string","shape","node","bool","oneOfType","func","boolean"],"sources":["../../../src/molecule/base-modal/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, get} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../atom/provider';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst BaseModal = (props, context) => {\n const {title, description, headerIcon, children, isOpen, footer, onClose} = props;\n const {skin} = context;\n\n const Footer = useCallback(() => {\n if (isEmpty(footer)) return null;\n if (typeof footer === 'function') return footer();\n\n const {cancelButton, confirmButton, text, isError} = footer;\n const {label: cancelLabel, onCancel, disabled: cancelDisabled} = cancelButton || {};\n const {\n label: confirmLabel,\n onConfirm,\n disabled: confirmDisabled,\n iconName\n } = confirmButton || {};\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div className={style.footer}>\n <div className={style.footerCTAWrapper}>\n {onCancel && cancelLabel ? (\n <ButtonLink\n {...{\n className: style.footerCancelButton,\n type: 'secondary',\n onClick: onCancel,\n label: cancelLabel,\n disabled: cancelDisabled\n }}\n />\n ) : null}\n {onConfirm && confirmLabel ? (\n <div>\n <ButtonLink\n {...{\n customStyle: {backgroundColor: primarySkinColor},\n hoverBackgroundColor: convert(\n `hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`\n ),\n hoverColor: '#FFFFFF',\n className: style.footerConfirmButton,\n type: 'primary',\n onClick: onConfirm,\n label: confirmLabel,\n disabled: confirmDisabled,\n ...(iconName\n ? {\n icon: {\n position: 'left',\n faIcon: {\n name: iconName,\n color: '#FFFFFF',\n size: 16\n }\n }\n }\n : {})\n }}\n />\n </div>\n ) : null}\n </div>\n {text ? (\n <div\n className={`${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`}\n >\n {text}\n </div>\n ) : null}\n </div>\n );\n }, [footer, skin, style, convert, get, isEmpty]);\n\n if (!isOpen || !title || !children) return null;\n\n function handleOnClose(e) {\n e?.stopPropagation();\n onClose();\n }\n\n return (\n <div className={style.modalWrapper}>\n <div className={style.modal}>\n <header className={style.header}>\n {headerIcon?.name ? (\n <div className={style.headerIcon}>\n <Icon\n iconName={headerIcon.name}\n iconColor={headerIcon.color}\n backgroundColor={headerIcon.backgroundColor}\n size={{faSize: 20, wrapperSize: 48}}\n />\n </div>\n ) : null}\n <div className={style.headerContent}>\n <div className={style.headerTitle}>{title}</div>\n {description ? <div className={style.headerDescription}>{description}</div> : null}\n </div>\n <div className={style.headerCloseIcon} onClick={handleOnClose}>\n <Icon iconName=\"close\" backgroundColor=\"#F4F4F5\" size={{faSize: 14, wrapperSize: 28}} />\n </div>\n </header>\n <div className={style.body}>{children}</div>\n <Footer />\n </div>\n </div>\n );\n};\n\nBaseModal.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBaseModal.propTypes = {\n title: PropTypes.string,\n headerIcon: PropTypes.shape({\n name: PropTypes.string,\n color: PropTypes.string,\n backgroundColor: PropTypes.string\n }),\n description: PropTypes.string,\n children: PropTypes.node,\n isOpen: PropTypes.bool,\n footer: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n text: PropTypes.string,\n isError: PropTypes.boolean,\n cancelButton: PropTypes.shape({\n label: PropTypes.string,\n onCancel: PropTypes.func,\n disabled: PropTypes.bool\n }),\n confirmButton: PropTypes.shape({\n label: PropTypes.string,\n onConfirm: PropTypes.func,\n iconName: PropTypes.string,\n disabled: PropTypes.bool\n })\n })\n ]),\n onClose: PropTypes.func\n};\n\nexport default BaseModal;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,SAAS,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACpC,MAAM;IAACC,KAAD;IAAQC,WAAR;IAAqBC,UAArB;IAAiCC,QAAjC;IAA2CC,MAA3C;IAAmDC,MAAnD;IAA2DC;EAA3D,IAAsER,KAA5E;EACA,MAAM;IAACS;EAAD,IAASR,OAAf;EAEA,MAAMS,MAAM,GAAGlB,WAAW,CAAC,MAAM;IAC/B,IAAI,SAAQe,MAAR,CAAJ,EAAqB,OAAO,IAAP;IACrB,IAAI,OAAOA,MAAP,KAAkB,UAAtB,EAAkC,OAAOA,MAAM,EAAb;IAElC,MAAM;MAACI,YAAD;MAAeC,aAAf;MAA8BC,IAA9B;MAAoCC;IAApC,IAA+CP,MAArD;IACA,MAAM;MAACQ,KAAK,EAAEC,WAAR;MAAqBC,QAArB;MAA+BC,QAAQ,EAAEC;IAAzC,IAA2DR,YAAY,IAAI,EAAjF;IACA,MAAM;MACJI,KAAK,EAAEK,YADH;MAEJC,SAFI;MAGJH,QAAQ,EAAEI,eAHN;MAIJC;IAJI,IAKFX,aAAa,IAAI,EALrB;;IAMA,MAAMY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Types.Requireable<string>;
|
|
105
105
|
}>>;
|
|
106
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
107
|
+
hoverColor: PropTypes.Requireable<string>;
|
|
106
108
|
disabled: PropTypes.Requireable<boolean>;
|
|
107
109
|
className: PropTypes.Requireable<string>;
|
|
108
110
|
customStyle: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
@@ -235,6 +237,8 @@ declare const propTypes: {
|
|
|
235
237
|
download: PropTypes.Requireable<boolean>;
|
|
236
238
|
target: PropTypes.Requireable<string>;
|
|
237
239
|
}>>;
|
|
240
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
241
|
+
hoverColor: PropTypes.Requireable<string>;
|
|
238
242
|
disabled: PropTypes.Requireable<boolean>;
|
|
239
243
|
className: PropTypes.Requireable<string>;
|
|
240
244
|
customStyle: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/cm-popin/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/cm-popin/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;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AAS,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;KACtD,CAAC;IACF,IAAI,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;CACpD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -65,7 +65,6 @@ declare class CardsList extends React.PureComponent<any, any, any> {
|
|
|
65
65
|
tagLabel: PropTypes.Requireable<string>;
|
|
66
66
|
progression: PropTypes.Requireable<number>;
|
|
67
67
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
-
type: PropTypes.Requireable<string>;
|
|
69
68
|
}> | null | undefined> | null | undefined)[]>;
|
|
70
69
|
customStyle: PropTypes.Requireable<{
|
|
71
70
|
[x: string]: string | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"names":[],"mappings":";AAuFA;IACE;;;OAGG;IACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"names":[],"mappings":";AAuFA;IACE;;;OAGG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqBE;IAEF;;;;;;;;;;;;;;;;;;;;;;;MAGE;IAEF,wBAkCC;IA/BC;;;;;;;;MAQC;IAED,0DAAgE;IAsHlE,qBAiBC;IAED,qBAGC;IAED,sBAGC;IAED,0BASC;IAvJC,uEAA6D;IAyJ/D,mCAIC;IA5DD,oCAMC;IAGD,sCAIC;IA5DD,qBAGC;IAnCD,0BAMC;IAED,2BAYC;IAED,6BAOC;IASD,wCAuCC;IAGC,kBAA2B;IA6D7B,sBAuGC;CACF"}
|
|
@@ -306,7 +306,8 @@ class CardsList extends React.PureComponent {
|
|
|
306
306
|
onShowMore,
|
|
307
307
|
dataName,
|
|
308
308
|
contentType,
|
|
309
|
-
'arrows-aria-label': ariaLabel = {}
|
|
309
|
+
'arrows-aria-label': ariaLabel = {},
|
|
310
|
+
type
|
|
310
311
|
} = this.props;
|
|
311
312
|
const {
|
|
312
313
|
skin
|
|
@@ -323,7 +324,7 @@ class CardsList extends React.PureComponent {
|
|
|
323
324
|
return /*#__PURE__*/React.createElement("div", {
|
|
324
325
|
className: style.card,
|
|
325
326
|
key: key
|
|
326
|
-
}, card &&
|
|
327
|
+
}, card && type === 'learningPrioritiesCards' ? /*#__PURE__*/React.createElement(LearningPriorityCard, _extends({}, card, {
|
|
327
328
|
dataName: `${dataName}-${key}`
|
|
328
329
|
})) : /*#__PURE__*/React.createElement(Card, _extends({}, card, {
|
|
329
330
|
dataName: `${dataName}-${key}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","NovaSolidContentContentBook1","LearnerIcon","NovaCompositionCoorpacademyTimer","TimerIcon","Provider","Card","cardPropTypes","LearningPriorityCard","Icon","style","ShowMoreLink","props","onShowMore","showMore","className","contextTypes","skin","childContextTypes","propTypes","func","string","IconView","context","contentType","ICONS","chapter","course","dark","IconType","color","icon","computeWidth","card","type","nextPage","page","maxPages","CardsList","PureComponent","constructor","state","actualPage","scrollLeft","offsetWidth","possiblePositions","possiblePages","cardsWidth","handleScroll_","handleScroll","bind","handleOnLeft","handleOnRight","scrollTo","updateState","updatePages","setCardsWrapper","getScrollWidth","handleResize","testingSizes","componentDidMount","cardsWrapper","addEventListener","window","componentDidUpdate","cards","newCardsWidth","updatePaginationState","setState","componentWillUnmount","removeEventListener","cancel","wrapperWidth","wrapperScrollLeft","cardWidths","cardPositions","accWidth","cardWidth","acc","pageIndex","accPageWidth","pageWidth","skip","position","element","index","onScroll","leftBound","rightBound","leftIndex","rightIndex","limit","indexOfNextFirstCard","indexOf","nextPosition","render","title","customStyle","dataName","ariaLabel","titleStyle","titleLink","cardsView","key","arrowIconProps","preset","borderRadius","showMoreOnLeftAriaLabel","arrows","arrowsWrapper","arrow","titleView","titleNode","hasPages","showMoreView","showMoreBar","switchPagesView","pagingWrapper","wrapper","list","header","translate","oneOfType","node","arrayOf","shape","objectOf","showMoreOnRightAriaLabel","oneOf","any"],"sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"sourcesContent":["import React from 'react';\nimport {\n debounce,\n throttle,\n get,\n getOr,\n map,\n sum,\n last,\n pipe,\n toPairs,\n reduce,\n head,\n findIndex,\n findLastIndex\n} from 'lodash/fp';\nimport PropTypes from 'prop-types';\nimport {\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport Provider from '../../../atom/provider';\nimport Card, {cardPropTypes} from '../../card';\nimport LearningPriorityCard from '../../learning-priority-card';\nimport Icon from '../../../atom/icon';\nimport style from './style.css';\n\nconst ShowMoreLink = props => {\n const {onShowMore, showMore, className} = props;\n return (\n <div className={className} onClick={onShowMore}>\n {showMore}\n </div>\n );\n};\n\nShowMoreLink.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nShowMoreLink.propTypes = {\n onShowMore: PropTypes.func,\n showMore: PropTypes.string,\n className: PropTypes.string\n};\n\nconst IconView = (props, context) => {\n const {skin} = context;\n const {contentType} = props;\n const ICONS = {\n chapter: TimerIcon,\n course: LearnerIcon\n };\n\n if (!contentType) {\n return null;\n }\n\n const dark = get('common.dark', skin);\n const IconType = ICONS[contentType];\n\n return (\n <div>\n <IconType style={{color: dark}} className={style.icon} data-contenttype={contentType} />\n </div>\n );\n};\n\nconst computeWidth = card => {\n switch (card && card.type) {\n case 'chapter':\n return 219;\n default:\n return 272;\n }\n};\n\nconst nextPage = (page, maxPages) => {\n if (page < 0) return maxPages;\n if (page > maxPages) return 0;\n return page;\n};\n\nIconView.propTypes = {\n contentType: PropTypes.string\n};\n\nclass CardsList extends React.PureComponent {\n /**\n * IMPORTANT: update prop-types.ts too, 1st a migration of tests\n * is intended, then, a TS + functional refactor is planned.\n */\n static propTypes = {\n contentType: PropTypes.string,\n dataName: PropTypes.string,\n title: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),\n showMore: PropTypes.string,\n cards: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(cardPropTypes),\n PropTypes.shape(LearningPriorityCard.propTypes)\n ])\n ),\n customStyle: PropTypes.objectOf(PropTypes.string),\n onScroll: PropTypes.func,\n onShowMore: PropTypes.func,\n 'arrows-aria-label': PropTypes.shape({\n showMoreOnLeftAriaLabel: PropTypes.string,\n showMoreOnRightAriaLabel: PropTypes.string\n }),\n type: PropTypes.oneOf(['cards', 'learningPrioritiesCards']),\n // eslint-disable-next-line react/forbid-prop-types\n testingSizes: PropTypes.any\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n actualPage: 0,\n maxPages: 0,\n scrollLeft: 0,\n offsetWidth: 0,\n possiblePositions: [],\n possiblePages: [],\n cardsWidth: 0\n };\n\n this.handleScroll_ = throttle(200, this.handleScroll.bind(this));\n this.handleScroll = this.handleScroll.bind(this);\n this.handleOnLeft = this.handleOnLeft.bind(this);\n this.handleOnRight = this.handleOnRight.bind(this);\n this.scrollTo = this.scrollTo.bind(this);\n this.updateState = debounce(200, this.updatePages.bind(this));\n this.updatePages = this.updatePages.bind(this);\n this.setCardsWrapper = this.setCardsWrapper.bind(this);\n this.getScrollWidth = this.getScrollWidth.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n // for testing purposes only - no other way to test this polluted component\n if (props.testingSizes) {\n const {offsetWidth, scrollLeft, maxPages, possiblePages, possiblePositions} =\n props.testingSizes;\n this.state.offsetWidth = offsetWidth;\n this.state.scrollLeft = scrollLeft;\n this.state.maxPages = maxPages;\n this.state.possiblePages = possiblePages;\n this.state.possiblePositions = possiblePositions;\n }\n }\n\n componentDidMount() {\n this.cardsWrapper.addEventListener('scroll', this.handleScroll_);\n\n if (window) {\n window.addEventListener('resize', this.handleResize);\n }\n }\n\n componentDidUpdate() {\n const {cards = []} = this.props;\n const {offsetWidth, cardsWidth} = this.state;\n const newCardsWidth = pipe(map(computeWidth), sum)(cards);\n\n if (newCardsWidth !== cardsWidth && offsetWidth !== 0) {\n this.updatePaginationState(cards);\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n cardsWidth: newCardsWidth\n });\n }\n }\n\n componentWillUnmount() {\n this.cardsWrapper.removeEventListener('scroll', this.handleScroll_);\n\n if (window) {\n window.removeEventListener('resize', this.handleResize);\n }\n this.updateState.cancel();\n }\n\n /* istanbul ignore next */\n handleResize() {\n const {cards = []} = this.props;\n this.updatePaginationState(cards);\n }\n\n /* istanbul ignore next */\n updatePaginationState(cards) {\n const {offsetWidth: wrapperWidth, scrollLeft: wrapperScrollLeft} = this.state;\n\n const cardWidths = map(computeWidth)(cards);\n\n const possiblePositions = pipe(\n reduce(\n ([cardPositions, accWidth], cardWidth) => [\n [...cardPositions, accWidth],\n cardWidth + accWidth\n ],\n [[], 0]\n ),\n head\n )(cardWidths);\n\n const possiblePages = pipe(\n reduce(\n ([acc, pageIndex, accPageWidth], cardWidth) => {\n const pageWidth = accPageWidth + cardWidth;\n if (pageWidth > wrapperWidth) {\n return [[...acc, pageIndex + 1], pageIndex + 1, cardWidth];\n }\n return [[...acc, pageIndex], pageIndex, pageWidth];\n },\n [[], 0, 0]\n ),\n head\n )(cardWidths);\n\n const skip = findIndex(position => position >= wrapperScrollLeft, possiblePositions);\n const actualPage = possiblePages[skip + 1];\n\n this.setState({\n possiblePositions,\n possiblePages,\n maxPages: last(possiblePages),\n actualPage\n });\n }\n\n setCardsWrapper(element) {\n this.cardsWrapper = element;\n this.setState({\n scrollLeft: this.cardsWrapper?.scrollLeft,\n offsetWidth: this.cardsWrapper?.offsetWidth\n });\n }\n\n /* istanbul ignore next */\n getScrollWidth(index) {\n const {cards = []} = this.props;\n const card = cards[index];\n return computeWidth(card);\n }\n\n /* istanbul ignore next */\n handleScroll() {\n const scrollLeft = this.cardsWrapper?.scrollLeft;\n this.setState({scrollLeft});\n\n const {possiblePositions, offsetWidth} = this.state;\n const {onScroll} = this.props;\n if (onScroll) {\n const leftBound = scrollLeft;\n const rightBound = scrollLeft + offsetWidth;\n\n const leftIndex = findIndex(position => position > leftBound, possiblePositions) - 1;\n const rightIndex = findLastIndex(position => position < rightBound, possiblePositions);\n const skip = leftIndex;\n const limit = rightIndex - skip + 1;\n\n onScroll(skip, limit);\n }\n }\n\n handleOnLeft() {\n const {actualPage, maxPages} = this.state;\n this.scrollTo(nextPage(actualPage - 1, maxPages));\n }\n\n handleOnRight() {\n const {actualPage, maxPages} = this.state;\n this.scrollTo(nextPage(actualPage + 1, maxPages));\n }\n\n scrollTo(page) {\n const {possiblePages, possiblePositions} = this.state;\n const indexOfNextFirstCard = possiblePages.indexOf(page);\n const nextPosition = possiblePositions[indexOfNextFirstCard];\n this.cardsWrapper.scrollLeft = nextPosition;\n this.updatePages(page);\n this.setState({\n scrollLeft: nextPosition\n });\n }\n\n updatePages(actualPage) {\n this.setState({\n actualPage\n });\n }\n\n render() {\n const {\n title,\n showMore,\n cards,\n customStyle = {},\n onShowMore,\n dataName,\n contentType,\n 'arrows-aria-label': ariaLabel = {}\n } = this.props;\n const {skin} = this.context;\n const {maxPages} = this.state;\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const titleStyle = onShowMore ? style.titleLink : style.title;\n const cardsView = pipe(\n toPairs,\n map(([key, card]) => {\n return (\n <div className={style.card} key={key}>\n {card && card.type === 'learningPriority' ? (\n <LearningPriorityCard {...card} dataName={`${dataName}-${key}`} />\n ) : (\n <Card {...card} dataName={`${dataName}-${key}`} />\n )}\n </div>\n );\n })\n )(cards);\n\n const arrowIconProps = {\n color: dark,\n preset: 's',\n borderRadius: '8px',\n ariaLabel: ariaLabel.showMoreOnLeftAriaLabel\n };\n\n const arrows = (\n <div className={style.arrowsWrapper}>\n <div className={style.arrow} onClick={this.handleOnLeft} data-name=\"card-list-left-arrow\">\n <Icon {...arrowIconProps} iconName=\"arrow-left\" />\n </div>\n <div className={style.arrow} onClick={this.handleOnRight} data-name=\"card-list-right-arrow\">\n <Icon {...arrowIconProps} iconName=\"arrow-right\" />\n </div>\n </div>\n );\n\n const titleView =\n typeof title === 'string' ? (\n <span data-name=\"title\" className={titleStyle} onClick={onShowMore}>\n <IconView contentType={contentType} />\n <span>{title}</span>\n </span>\n ) : (\n <span className={style.titleNode}>{title}</span>\n );\n\n const hasPages = maxPages > 0;\n const showMoreView =\n hasPages && showMore && onShowMore ? (\n <ShowMoreLink\n className={hasPages ? style.showMoreBar : style.showMore}\n onShowMore={onShowMore}\n showMore={showMore}\n />\n ) : null;\n\n const switchPagesView = hasPages ? (\n <div className={style.pagingWrapper}>\n {showMoreView}\n {arrows}\n </div>\n ) : null;\n\n return (\n <div\n className={style.wrapper}\n style={customStyle}\n data-name=\"cardsList\"\n data-max-pages={`${maxPages}`}\n // eslint-disable-next-line react/destructuring-assignment\n data-actual-page={`${this.state.actualPage}`}\n data-scroll-left={this.cardsWrapper?.scrollLeft}\n >\n <div className={style.list}>\n <div>\n <div data-name=\"header\" className={style.header}>\n {titleView}\n {switchPagesView}\n </div>\n <div\n className={style.cards}\n data-testid=\"cards-view-wrapper\"\n ref={this.setCardsWrapper}\n >\n {cardsView}\n </div>\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default CardsList;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAgBA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,4BAA4B,IAAIC,WADlC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,IAAP,IAAcC,aAAd,QAAkC,YAAlC;AACA,OAAOC,oBAAP,MAAiC,8BAAjC;AACA,OAAOC,IAAP,MAAiB,oBAAjB;AACA,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BGtB,Y,GAAe;EACpBC,IAAI,EAAEZ,QAAQ,CAACa,iBAAT,CAA2BD,IADb;EAEpBwG,SAAS,EAAEpH,QAAQ,CAACa,iBAAT,CAA2BuG;AAFlB,C;AA5BlBnF,S,CAKGnB,S,2CAAY;EACjBK,WAAW,EAAExB,SAAS,CAACqB,MADN;EAEjB6E,QAAQ,EAAElG,SAAS,CAACqB,MAFH;EAGjB2E,KAAK,EAAEhG,SAAS,CAAC0H,SAAV,CAAoB,CAAC1H,SAAS,CAAC2H,IAAX,EAAiB3H,SAAS,CAACqB,MAA3B,CAApB,CAHU;EAIjBP,QAAQ,EAAEd,SAAS,CAACqB,MAJH;EAKjB4C,KAAK,EAAEjE,SAAS,CAAC4H,OAAV,CACL5H,SAAS,CAAC0H,SAAV,CAAoB,CAClB1H,SAAS,CAAC6H,KAAV,CAAgBtH,aAAhB,CADkB,EAElBP,SAAS,CAAC6H,KAAV,CAAgBrH,oBAAoB,CAACW,SAArC,CAFkB,CAApB,CADK,CALU;EAWjB8E,WAAW,EAAEjG,SAAS,CAAC8H,QAAV,CAAmB9H,SAAS,CAACqB,MAA7B,CAXI;EAYjBiE,QAAQ,EAAEtF,SAAS,CAACoB,IAZH;EAajBP,UAAU,EAAEb,SAAS,CAACoB,IAbL;EAcjB,qBAAqBpB,SAAS,CAAC6H,KAAV,CAAgB;IACnClB,uBAAuB,EAAE3G,SAAS,CAACqB,MADA;IAEnC0G,wBAAwB,EAAE/H,SAAS,CAACqB;EAFD,CAAhB,CAdJ;EAkBjBa,IAAI,EAAElC,SAAS,CAACgI,KAAV,CAAgB,CAAC,OAAD,EAAU,yBAAV,CAAhB,CAlBW;EAmBjB;EACArE,YAAY,EAAE3D,SAAS,CAACiI;AApBP,C;AAsTrB,eAAe3F,SAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","NovaSolidContentContentBook1","LearnerIcon","NovaCompositionCoorpacademyTimer","TimerIcon","Provider","Card","cardPropTypes","LearningPriorityCard","Icon","style","ShowMoreLink","props","onShowMore","showMore","className","contextTypes","skin","childContextTypes","propTypes","func","string","IconView","context","contentType","ICONS","chapter","course","dark","IconType","color","icon","computeWidth","card","type","nextPage","page","maxPages","CardsList","PureComponent","constructor","state","actualPage","scrollLeft","offsetWidth","possiblePositions","possiblePages","cardsWidth","handleScroll_","handleScroll","bind","handleOnLeft","handleOnRight","scrollTo","updateState","updatePages","setCardsWrapper","getScrollWidth","handleResize","testingSizes","componentDidMount","cardsWrapper","addEventListener","window","componentDidUpdate","cards","newCardsWidth","updatePaginationState","setState","componentWillUnmount","removeEventListener","cancel","wrapperWidth","wrapperScrollLeft","cardWidths","cardPositions","accWidth","cardWidth","acc","pageIndex","accPageWidth","pageWidth","skip","position","element","index","onScroll","leftBound","rightBound","leftIndex","rightIndex","limit","indexOfNextFirstCard","indexOf","nextPosition","render","title","customStyle","dataName","ariaLabel","titleStyle","titleLink","cardsView","key","arrowIconProps","preset","borderRadius","showMoreOnLeftAriaLabel","arrows","arrowsWrapper","arrow","titleView","titleNode","hasPages","showMoreView","showMoreBar","switchPagesView","pagingWrapper","wrapper","list","header","translate","oneOfType","node","arrayOf","shape","objectOf","showMoreOnRightAriaLabel","oneOf","any"],"sources":["../../../../src/molecule/dashboard/cards-list/index.js"],"sourcesContent":["import React from 'react';\nimport {\n debounce,\n throttle,\n get,\n getOr,\n map,\n sum,\n last,\n pipe,\n toPairs,\n reduce,\n head,\n findIndex,\n findLastIndex\n} from 'lodash/fp';\nimport PropTypes from 'prop-types';\nimport {\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport Provider from '../../../atom/provider';\nimport Card, {cardPropTypes} from '../../card';\nimport LearningPriorityCard from '../../learning-priority-card';\nimport Icon from '../../../atom/icon';\nimport style from './style.css';\n\nconst ShowMoreLink = props => {\n const {onShowMore, showMore, className} = props;\n return (\n <div className={className} onClick={onShowMore}>\n {showMore}\n </div>\n );\n};\n\nShowMoreLink.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nShowMoreLink.propTypes = {\n onShowMore: PropTypes.func,\n showMore: PropTypes.string,\n className: PropTypes.string\n};\n\nconst IconView = (props, context) => {\n const {skin} = context;\n const {contentType} = props;\n const ICONS = {\n chapter: TimerIcon,\n course: LearnerIcon\n };\n\n if (!contentType) {\n return null;\n }\n\n const dark = get('common.dark', skin);\n const IconType = ICONS[contentType];\n\n return (\n <div>\n <IconType style={{color: dark}} className={style.icon} data-contenttype={contentType} />\n </div>\n );\n};\n\nconst computeWidth = card => {\n switch (card && card.type) {\n case 'chapter':\n return 219;\n default:\n return 272;\n }\n};\n\nconst nextPage = (page, maxPages) => {\n if (page < 0) return maxPages;\n if (page > maxPages) return 0;\n return page;\n};\n\nIconView.propTypes = {\n contentType: PropTypes.string\n};\n\nclass CardsList extends React.PureComponent {\n /**\n * IMPORTANT: update prop-types.ts too, 1st a migration of tests\n * is intended, then, a TS + functional refactor is planned.\n */\n static propTypes = {\n contentType: PropTypes.string,\n dataName: PropTypes.string,\n title: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),\n showMore: PropTypes.string,\n cards: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(cardPropTypes),\n PropTypes.shape(LearningPriorityCard.propTypes)\n ])\n ),\n customStyle: PropTypes.objectOf(PropTypes.string),\n onScroll: PropTypes.func,\n onShowMore: PropTypes.func,\n 'arrows-aria-label': PropTypes.shape({\n showMoreOnLeftAriaLabel: PropTypes.string,\n showMoreOnRightAriaLabel: PropTypes.string\n }),\n type: PropTypes.oneOf(['cards', 'learningPrioritiesCards']),\n // eslint-disable-next-line react/forbid-prop-types\n testingSizes: PropTypes.any\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n actualPage: 0,\n maxPages: 0,\n scrollLeft: 0,\n offsetWidth: 0,\n possiblePositions: [],\n possiblePages: [],\n cardsWidth: 0\n };\n\n this.handleScroll_ = throttle(200, this.handleScroll.bind(this));\n this.handleScroll = this.handleScroll.bind(this);\n this.handleOnLeft = this.handleOnLeft.bind(this);\n this.handleOnRight = this.handleOnRight.bind(this);\n this.scrollTo = this.scrollTo.bind(this);\n this.updateState = debounce(200, this.updatePages.bind(this));\n this.updatePages = this.updatePages.bind(this);\n this.setCardsWrapper = this.setCardsWrapper.bind(this);\n this.getScrollWidth = this.getScrollWidth.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n // for testing purposes only - no other way to test this polluted component\n if (props.testingSizes) {\n const {offsetWidth, scrollLeft, maxPages, possiblePages, possiblePositions} =\n props.testingSizes;\n this.state.offsetWidth = offsetWidth;\n this.state.scrollLeft = scrollLeft;\n this.state.maxPages = maxPages;\n this.state.possiblePages = possiblePages;\n this.state.possiblePositions = possiblePositions;\n }\n }\n\n componentDidMount() {\n this.cardsWrapper.addEventListener('scroll', this.handleScroll_);\n\n if (window) {\n window.addEventListener('resize', this.handleResize);\n }\n }\n\n componentDidUpdate() {\n const {cards = []} = this.props;\n const {offsetWidth, cardsWidth} = this.state;\n const newCardsWidth = pipe(map(computeWidth), sum)(cards);\n\n if (newCardsWidth !== cardsWidth && offsetWidth !== 0) {\n this.updatePaginationState(cards);\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n cardsWidth: newCardsWidth\n });\n }\n }\n\n componentWillUnmount() {\n this.cardsWrapper.removeEventListener('scroll', this.handleScroll_);\n\n if (window) {\n window.removeEventListener('resize', this.handleResize);\n }\n this.updateState.cancel();\n }\n\n /* istanbul ignore next */\n handleResize() {\n const {cards = []} = this.props;\n this.updatePaginationState(cards);\n }\n\n /* istanbul ignore next */\n updatePaginationState(cards) {\n const {offsetWidth: wrapperWidth, scrollLeft: wrapperScrollLeft} = this.state;\n\n const cardWidths = map(computeWidth)(cards);\n\n const possiblePositions = pipe(\n reduce(\n ([cardPositions, accWidth], cardWidth) => [\n [...cardPositions, accWidth],\n cardWidth + accWidth\n ],\n [[], 0]\n ),\n head\n )(cardWidths);\n\n const possiblePages = pipe(\n reduce(\n ([acc, pageIndex, accPageWidth], cardWidth) => {\n const pageWidth = accPageWidth + cardWidth;\n if (pageWidth > wrapperWidth) {\n return [[...acc, pageIndex + 1], pageIndex + 1, cardWidth];\n }\n return [[...acc, pageIndex], pageIndex, pageWidth];\n },\n [[], 0, 0]\n ),\n head\n )(cardWidths);\n\n const skip = findIndex(position => position >= wrapperScrollLeft, possiblePositions);\n const actualPage = possiblePages[skip + 1];\n\n this.setState({\n possiblePositions,\n possiblePages,\n maxPages: last(possiblePages),\n actualPage\n });\n }\n\n setCardsWrapper(element) {\n this.cardsWrapper = element;\n this.setState({\n scrollLeft: this.cardsWrapper?.scrollLeft,\n offsetWidth: this.cardsWrapper?.offsetWidth\n });\n }\n\n /* istanbul ignore next */\n getScrollWidth(index) {\n const {cards = []} = this.props;\n const card = cards[index];\n return computeWidth(card);\n }\n\n /* istanbul ignore next */\n handleScroll() {\n const scrollLeft = this.cardsWrapper?.scrollLeft;\n this.setState({scrollLeft});\n\n const {possiblePositions, offsetWidth} = this.state;\n const {onScroll} = this.props;\n if (onScroll) {\n const leftBound = scrollLeft;\n const rightBound = scrollLeft + offsetWidth;\n\n const leftIndex = findIndex(position => position > leftBound, possiblePositions) - 1;\n const rightIndex = findLastIndex(position => position < rightBound, possiblePositions);\n const skip = leftIndex;\n const limit = rightIndex - skip + 1;\n\n onScroll(skip, limit);\n }\n }\n\n handleOnLeft() {\n const {actualPage, maxPages} = this.state;\n this.scrollTo(nextPage(actualPage - 1, maxPages));\n }\n\n handleOnRight() {\n const {actualPage, maxPages} = this.state;\n this.scrollTo(nextPage(actualPage + 1, maxPages));\n }\n\n scrollTo(page) {\n const {possiblePages, possiblePositions} = this.state;\n const indexOfNextFirstCard = possiblePages.indexOf(page);\n const nextPosition = possiblePositions[indexOfNextFirstCard];\n this.cardsWrapper.scrollLeft = nextPosition;\n this.updatePages(page);\n this.setState({\n scrollLeft: nextPosition\n });\n }\n\n updatePages(actualPage) {\n this.setState({\n actualPage\n });\n }\n\n render() {\n const {\n title,\n showMore,\n cards,\n customStyle = {},\n onShowMore,\n dataName,\n contentType,\n 'arrows-aria-label': ariaLabel = {},\n type\n } = this.props;\n const {skin} = this.context;\n const {maxPages} = this.state;\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const titleStyle = onShowMore ? style.titleLink : style.title;\n const cardsView = pipe(\n toPairs,\n map(([key, card]) => {\n return (\n <div className={style.card} key={key}>\n {card && type === 'learningPrioritiesCards' ? (\n <LearningPriorityCard {...card} dataName={`${dataName}-${key}`} />\n ) : (\n <Card {...card} dataName={`${dataName}-${key}`} />\n )}\n </div>\n );\n })\n )(cards);\n\n const arrowIconProps = {\n color: dark,\n preset: 's',\n borderRadius: '8px',\n ariaLabel: ariaLabel.showMoreOnLeftAriaLabel\n };\n\n const arrows = (\n <div className={style.arrowsWrapper}>\n <div className={style.arrow} onClick={this.handleOnLeft} data-name=\"card-list-left-arrow\">\n <Icon {...arrowIconProps} iconName=\"arrow-left\" />\n </div>\n <div className={style.arrow} onClick={this.handleOnRight} data-name=\"card-list-right-arrow\">\n <Icon {...arrowIconProps} iconName=\"arrow-right\" />\n </div>\n </div>\n );\n\n const titleView =\n typeof title === 'string' ? (\n <span data-name=\"title\" className={titleStyle} onClick={onShowMore}>\n <IconView contentType={contentType} />\n <span>{title}</span>\n </span>\n ) : (\n <span className={style.titleNode}>{title}</span>\n );\n\n const hasPages = maxPages > 0;\n const showMoreView =\n hasPages && showMore && onShowMore ? (\n <ShowMoreLink\n className={hasPages ? style.showMoreBar : style.showMore}\n onShowMore={onShowMore}\n showMore={showMore}\n />\n ) : null;\n\n const switchPagesView = hasPages ? (\n <div className={style.pagingWrapper}>\n {showMoreView}\n {arrows}\n </div>\n ) : null;\n\n return (\n <div\n className={style.wrapper}\n style={customStyle}\n data-name=\"cardsList\"\n data-max-pages={`${maxPages}`}\n // eslint-disable-next-line react/destructuring-assignment\n data-actual-page={`${this.state.actualPage}`}\n data-scroll-left={this.cardsWrapper?.scrollLeft}\n >\n <div className={style.list}>\n <div>\n <div data-name=\"header\" className={style.header}>\n {titleView}\n {switchPagesView}\n </div>\n <div\n className={style.cards}\n data-testid=\"cards-view-wrapper\"\n ref={this.setCardsWrapper}\n >\n {cardsView}\n </div>\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default CardsList;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAgBA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,4BAA4B,IAAIC,WADlC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,IAAP,IAAcC,aAAd,QAAkC,YAAlC;AACA,OAAOC,oBAAP,MAAiC,8BAAjC;AACA,OAAOC,IAAP,MAAiB,oBAAjB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAACC,UAAD;IAAaC,QAAb;IAAuBC;EAAvB,IAAoCH,KAA1C;EACA,oBACE;IAAK,SAAS,EAAEG,SAAhB;IAA2B,OAAO,EAAEF;EAApC,GACGC,QADH,CADF;AAKD,CAPD;;AASAH,YAAY,CAACK,YAAb,GAA4B;EAC1BC,IAAI,EAAEZ,QAAQ,CAACa,iBAAT,CAA2BD;AADP,CAA5B;AAIAN,YAAY,CAACQ,SAAb,2CAAyB;EACvBN,UAAU,EAAEb,SAAS,CAACoB,IADC;EAEvBN,QAAQ,EAAEd,SAAS,CAACqB,MAFG;EAGvBN,SAAS,EAAEf,SAAS,CAACqB;AAHE,CAAzB;;AAMA,MAAMC,QAAQ,GAAG,CAACV,KAAD,EAAQW,OAAR,KAAoB;EACnC,MAAM;IAACN;EAAD,IAASM,OAAf;EACA,MAAM;IAACC;EAAD,IAAgBZ,KAAtB;EACA,MAAMa,KA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AW,EAAEjG,SAAS,CAAC8H,QAAV,CAAmB9H,SAAS,CAACqB,MAA7B,CAXI;EAYjBiE,QAAQ,EAAEtF,SAAS,CAACoB,IAZH;EAajBP,UAAU,EAAEb,SAAS,CAACoB,IAbL;EAcjB,qBAAqBpB,SAAS,CAAC6H,KAAV,CAAgB;IACnClB,uBAAuB,EAAE3G,SAAS,CAACqB,MADA;IAEnC0G,wBAAwB,EAAE/H,SAAS,CAACqB;EAFD,CAAhB,CAdJ;EAkBjBa,IAAI,EAAElC,SAAS,CAACgI,KAAV,CAAgB,CAAC,OAAD,EAAU,yBAAV,CAAhB,CAlBW;EAmBjB;EACArE,YAAY,EAAE3D,SAAS,CAACiI;AApBP,C;AAuTrB,eAAe3F,SAAf"}
|
|
@@ -79,6 +79,8 @@ declare const ActionableExpandableTable: {
|
|
|
79
79
|
download: import("prop-types").Requireable<boolean>;
|
|
80
80
|
target: import("prop-types").Requireable<string>;
|
|
81
81
|
}>>;
|
|
82
|
+
hoverBackgroundColor: import("prop-types").Requireable<string>;
|
|
83
|
+
hoverColor: import("prop-types").Requireable<string>;
|
|
82
84
|
disabled: import("prop-types").Requireable<boolean>;
|
|
83
85
|
className: import("prop-types").Requireable<string>;
|
|
84
86
|
customStyle: import("prop-types").Requireable<import("prop-types").InferProps<{}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAOjE,OAAO,EAA2C,KAAK,EAAY,MAAM,SAAS,CAAC;AAqCnF,QAAA,MAAM,yBAAyB;YAAW,KAAK,iBAAiB,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAOjE,OAAO,EAA2C,KAAK,EAAY,MAAM,SAAS,CAAC;AAqCnF,QAAA,MAAM,yBAAyB;YAAW,KAAK,iBAAiB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoL/E,CAAC;AASF,eAAe,yBAAyB,CAAC"}
|
|
@@ -56,6 +56,8 @@ export declare const propTypes: {
|
|
|
56
56
|
download: PropTypes.Requireable<boolean>;
|
|
57
57
|
target: PropTypes.Requireable<string>;
|
|
58
58
|
}>>;
|
|
59
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
60
|
+
hoverColor: PropTypes.Requireable<string>;
|
|
59
61
|
disabled: PropTypes.Requireable<boolean>;
|
|
60
62
|
className: PropTypes.Requireable<string>;
|
|
61
63
|
customStyle: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,OAAO,EAAC,0BAA0B,EAAC,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,KAAK,IAAI,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AA0BzE,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,OAAO,EAAC,0BAA0B,EAAC,MAAM,mCAAm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,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,oBAAY,WAAW,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learner-skill-card/index.js"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learner-skill-card/index.js"],"names":[],"mappings":";AASA,yEAiJC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _get from "lodash/fp/get";
|
|
2
|
-
import React, { useCallback
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
3
|
import { convert } from 'css-color-function';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import Icon from '../../atom/icon';
|
|
@@ -28,7 +28,6 @@ const LearnerSkillCard = (props, context) => {
|
|
|
28
28
|
skin,
|
|
29
29
|
translate
|
|
30
30
|
} = context;
|
|
31
|
-
const [hovered, setHovered] = useState(false);
|
|
32
31
|
|
|
33
32
|
const primarySkinColor = _get('common.primary', skin);
|
|
34
33
|
|
|
@@ -38,8 +37,6 @@ const LearnerSkillCard = (props, context) => {
|
|
|
38
37
|
const questionsLocale = translate('questions');
|
|
39
38
|
const skillFocusLocale = translate('skill_focus');
|
|
40
39
|
const contentCompletedLocale = translate('courses_completed');
|
|
41
|
-
const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);
|
|
42
|
-
const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
|
|
43
40
|
const buttonReviewProps = {
|
|
44
41
|
customStyle: {
|
|
45
42
|
backgroundColor: '#FFF',
|
|
@@ -54,10 +51,12 @@ const LearnerSkillCard = (props, context) => {
|
|
|
54
51
|
};
|
|
55
52
|
const buttonExploreProps = {
|
|
56
53
|
customStyle: {
|
|
57
|
-
backgroundColor:
|
|
58
|
-
color:
|
|
54
|
+
backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),
|
|
55
|
+
color: primarySkinColor,
|
|
59
56
|
transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
|
|
60
57
|
},
|
|
58
|
+
hoverColor: '#FFFFFF',
|
|
59
|
+
hoverBackgroundColor: primarySkinColor,
|
|
61
60
|
onClick: onExploreClick,
|
|
62
61
|
'aria-label': `${skillTitle}, ${exploreLocale}`,
|
|
63
62
|
label: exploreLocale,
|
|
@@ -66,8 +65,8 @@ const LearnerSkillCard = (props, context) => {
|
|
|
66
65
|
position: 'left',
|
|
67
66
|
faIcon: {
|
|
68
67
|
name: 'compass',
|
|
69
|
-
backgroundColor:
|
|
70
|
-
color:
|
|
68
|
+
backgroundColor: convert(`color(${primarySkinColor} a(0.07))`),
|
|
69
|
+
color: primarySkinColor,
|
|
71
70
|
size: 16
|
|
72
71
|
}
|
|
73
72
|
}
|
|
@@ -137,8 +136,6 @@ const LearnerSkillCard = (props, context) => {
|
|
|
137
136
|
"data-name": "cta-wrapper"
|
|
138
137
|
}, /*#__PURE__*/React.createElement(ButtonLink, buttonReviewProps), /*#__PURE__*/React.createElement("div", {
|
|
139
138
|
className: style.buttonWrapper,
|
|
140
|
-
onMouseOver: handleMouseOver,
|
|
141
|
-
onMouseLeave: handleMouseLeave,
|
|
142
139
|
"data-name": "button-explore-wrapper"
|
|
143
140
|
}, /*#__PURE__*/React.createElement(ButtonLink, buttonExploreProps))));
|
|
144
141
|
};
|