@coorpacademy/components 11.32.26 → 11.32.27
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-only → button-link-icon}/index.d.ts +5 -3
- package/es/atom/button-link-icon/index.d.ts.map +1 -0
- package/es/atom/button-link-icon/index.js +131 -0
- package/es/atom/button-link-icon/index.js.map +1 -0
- package/es/atom/{button-link-icon-only → button-link-icon}/style.css +9 -0
- package/es/atom/tooltip/index.d.ts +3 -1
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +9 -5
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/atom/tooltip/style.css +2 -2
- package/es/molecule/bullet-point-menu-button/index.js +2 -2
- package/es/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/es/molecule/cm-popin/index.js +2 -2
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/expandible-actionable-table/index.js +2 -2
- package/es/molecule/expandible-actionable-table/index.js.map +1 -1
- package/es/molecule/playlist-detail-cover/index.js +1 -1
- package/es/molecule/playlist-detail-cover/index.js.map +1 -1
- package/es/organism/review-header/index.js +2 -2
- package/es/organism/review-header/index.js.map +1 -1
- package/es/organism/setup-header/index.js +1 -1
- package/es/organism/setup-header/index.js.map +1 -1
- package/es/organism/wizard-contents/index.js +2 -2
- package/es/organism/wizard-contents/index.js.map +1 -1
- package/es/template/back-office/brand-update/index.js +2 -2
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/common/faq-article-page/index.js +3 -3
- package/es/template/common/faq-article-page/index.js.map +1 -1
- package/es/template/playlist-detail/index.d.ts.map +1 -1
- package/es/template/playlist-detail/index.js +9 -10
- package/es/template/playlist-detail/index.js.map +1 -1
- package/es/template/playlist-detail/style.css +1 -6
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +9 -10
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/template/skill-detail/style.css +1 -6
- package/lib/atom/{button-link-icon-only → button-link-icon}/index.d.ts +5 -3
- package/lib/atom/button-link-icon/index.d.ts.map +1 -0
- package/lib/atom/{button-link-icon-only → button-link-icon}/index.js +61 -22
- package/lib/atom/button-link-icon/index.js.map +1 -0
- package/lib/atom/{button-link-icon-only → button-link-icon}/style.css +9 -0
- package/lib/atom/tooltip/index.d.ts +3 -1
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +9 -5
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/atom/tooltip/style.css +2 -2
- package/lib/molecule/bullet-point-menu-button/index.js +2 -2
- package/lib/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +2 -2
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/expandible-actionable-table/index.js +2 -2
- package/lib/molecule/expandible-actionable-table/index.js.map +1 -1
- package/lib/molecule/playlist-detail-cover/index.js +1 -1
- package/lib/molecule/playlist-detail-cover/index.js.map +1 -1
- package/lib/organism/review-header/index.js +2 -2
- package/lib/organism/review-header/index.js.map +1 -1
- package/lib/organism/setup-header/index.js +2 -2
- package/lib/organism/setup-header/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.js +2 -2
- package/lib/organism/wizard-contents/index.js.map +1 -1
- package/lib/template/back-office/brand-update/index.js +2 -2
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/common/faq-article-page/index.js +3 -3
- package/lib/template/common/faq-article-page/index.js.map +1 -1
- package/lib/template/playlist-detail/index.d.ts.map +1 -1
- package/lib/template/playlist-detail/index.js +10 -10
- package/lib/template/playlist-detail/index.js.map +1 -1
- package/lib/template/playlist-detail/style.css +1 -6
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +10 -10
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/template/skill-detail/style.css +1 -6
- package/package.json +2 -2
- package/es/atom/button-link-icon-only/index.d.ts.map +0 -1
- package/es/atom/button-link-icon-only/index.js +0 -94
- package/es/atom/button-link-icon-only/index.js.map +0 -1
- package/lib/atom/button-link-icon-only/index.d.ts.map +0 -1
- package/lib/atom/button-link-icon-only/index.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export default
|
|
2
|
-
declare function
|
|
3
|
-
declare namespace
|
|
1
|
+
export default ButtonLinkIcon;
|
|
2
|
+
declare function ButtonLinkIcon(props: any): JSX.Element;
|
|
3
|
+
declare namespace ButtonLinkIcon {
|
|
4
4
|
const propTypes: {
|
|
5
5
|
size: PropTypes.Requireable<string>;
|
|
6
6
|
'aria-label': PropTypes.Requireable<string>;
|
|
7
7
|
'data-name': PropTypes.Requireable<string>;
|
|
8
8
|
icon: PropTypes.Requireable<string>;
|
|
9
|
+
faIcon: PropTypes.Requireable<string>;
|
|
9
10
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
11
|
link: PropTypes.Requireable<PropTypes.InferProps<{
|
|
11
12
|
href: PropTypes.Requireable<string>;
|
|
@@ -14,6 +15,7 @@ declare namespace ButtonLinkIconOnly {
|
|
|
14
15
|
}>>;
|
|
15
16
|
disabled: PropTypes.Requireable<boolean>;
|
|
16
17
|
className: PropTypes.Requireable<string>;
|
|
18
|
+
tooltipPlacement: PropTypes.Requireable<string>;
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
import PropTypes from "prop-types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link-icon/index.js"],"names":[],"mappings":";AAoCA,yDAoHC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _keys from "lodash/fp/keys";
|
|
2
|
+
import _getOr from "lodash/fp/getOr";
|
|
3
|
+
|
|
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
|
+
|
|
6
|
+
import React, { useMemo, useState, useCallback, useRef } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import classnames from 'classnames';
|
|
9
|
+
import { ICONS } from '../../util/button-icons';
|
|
10
|
+
import FaIcon from '../icon';
|
|
11
|
+
import Link from '../link';
|
|
12
|
+
import ToolTip from '../tooltip'; // eslint-disable-next-line css-modules/no-unused-class
|
|
13
|
+
|
|
14
|
+
import style from './style.css';
|
|
15
|
+
|
|
16
|
+
const getButtonContent = (icon, faIcon) => {
|
|
17
|
+
const Icon = _getOr(null, icon, ICONS);
|
|
18
|
+
|
|
19
|
+
if (!Icon && !faIcon) {
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: style.buttonContent
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: style.buttonContent
|
|
27
|
+
}, faIcon ? /*#__PURE__*/React.createElement(FaIcon, {
|
|
28
|
+
iconName: faIcon
|
|
29
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
30
|
+
className: style.icon
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getSizeStyle = size => {
|
|
35
|
+
switch (size) {
|
|
36
|
+
case 'small':
|
|
37
|
+
return style.small;
|
|
38
|
+
|
|
39
|
+
case 'responsive':
|
|
40
|
+
return style.responsive;
|
|
41
|
+
|
|
42
|
+
default:
|
|
43
|
+
return style.default;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const ButtonLinkIcon = props => {
|
|
48
|
+
const {
|
|
49
|
+
size = 'default',
|
|
50
|
+
disabled,
|
|
51
|
+
icon,
|
|
52
|
+
faIcon,
|
|
53
|
+
'data-name': dataName,
|
|
54
|
+
'aria-label': ariaLabel,
|
|
55
|
+
link,
|
|
56
|
+
onClick,
|
|
57
|
+
className,
|
|
58
|
+
tooltipPlacement = 'left'
|
|
59
|
+
} = props;
|
|
60
|
+
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
61
|
+
const timer = useRef();
|
|
62
|
+
const contentView = getButtonContent(icon, faIcon);
|
|
63
|
+
const styleButton = classnames(getSizeStyle(size), link && style.link, disabled && style.disabled, className);
|
|
64
|
+
const handleOnClick = useMemo(() => () => onClick(), [onClick]);
|
|
65
|
+
const handleMouseOver = useCallback(() => {
|
|
66
|
+
timer.current && clearTimeout(timer.current);
|
|
67
|
+
timer.current = setTimeout(() => {
|
|
68
|
+
setToolTipIsVisible(true);
|
|
69
|
+
timer.current = undefined;
|
|
70
|
+
}, 300);
|
|
71
|
+
}, [timer, setToolTipIsVisible]);
|
|
72
|
+
const handleMouseLeave = useCallback(() => {
|
|
73
|
+
timer.current && clearTimeout(timer.current);
|
|
74
|
+
setToolTipIsVisible(false);
|
|
75
|
+
}, [timer, setToolTipIsVisible]);
|
|
76
|
+
const TooltipContent = useCallback(() => /*#__PURE__*/React.createElement("span", {
|
|
77
|
+
className: style.tooltipContentWrapper
|
|
78
|
+
}, ariaLabel), [ariaLabel]);
|
|
79
|
+
const Button = useCallback(() => link ? /*#__PURE__*/React.createElement(Link, _extends({}, link, ariaLabel ? {
|
|
80
|
+
'data-for': 'button-icon',
|
|
81
|
+
'data-tip': toolTipIsVisible
|
|
82
|
+
} : {}, {
|
|
83
|
+
className: styleButton,
|
|
84
|
+
"data-name": dataName,
|
|
85
|
+
"aria-label": ariaLabel,
|
|
86
|
+
title: ariaLabel,
|
|
87
|
+
onMouseLeave: handleMouseLeave,
|
|
88
|
+
onMouseOver: handleMouseOver
|
|
89
|
+
}), contentView) : /*#__PURE__*/React.createElement("button", _extends({}, ariaLabel ? {
|
|
90
|
+
'data-for': 'button-icon',
|
|
91
|
+
'data-tip': toolTipIsVisible
|
|
92
|
+
} : {}, {
|
|
93
|
+
type: "button",
|
|
94
|
+
"aria-label": ariaLabel,
|
|
95
|
+
"data-name": dataName,
|
|
96
|
+
"data-testid": `button-${dataName}-${className}`,
|
|
97
|
+
title: ariaLabel,
|
|
98
|
+
className: styleButton,
|
|
99
|
+
onClick: handleOnClick,
|
|
100
|
+
onMouseLeave: handleMouseLeave,
|
|
101
|
+
onMouseOver: handleMouseOver,
|
|
102
|
+
disabled: disabled
|
|
103
|
+
}), contentView), [link, ariaLabel, className, contentView, dataName, disabled, handleMouseLeave, handleMouseOver, handleOnClick, styleButton, toolTipIsVisible]);
|
|
104
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, null), ariaLabel ? /*#__PURE__*/React.createElement(ToolTip, {
|
|
105
|
+
fontSize: 12,
|
|
106
|
+
anchorId: "button-icon",
|
|
107
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
108
|
+
placement: tooltipPlacement,
|
|
109
|
+
TooltipContent: TooltipContent,
|
|
110
|
+
closeToolTipInformationTextAriaLabel: ariaLabel
|
|
111
|
+
}) : null);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
ButtonLinkIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
115
|
+
size: PropTypes.oneOf(['default', 'small', 'responsive']),
|
|
116
|
+
'aria-label': PropTypes.string,
|
|
117
|
+
'data-name': PropTypes.string,
|
|
118
|
+
icon: PropTypes.oneOf(_keys(ICONS)),
|
|
119
|
+
faIcon: PropTypes.string,
|
|
120
|
+
onClick: PropTypes.func,
|
|
121
|
+
link: PropTypes.shape({
|
|
122
|
+
href: PropTypes.string,
|
|
123
|
+
download: PropTypes.bool,
|
|
124
|
+
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])
|
|
125
|
+
}),
|
|
126
|
+
disabled: PropTypes.bool,
|
|
127
|
+
className: PropTypes.string,
|
|
128
|
+
tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])
|
|
129
|
+
} : {};
|
|
130
|
+
export default ButtonLinkIcon;
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","buttonContent","getSizeStyle","size","small","responsive","default","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","className","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","propTypes","oneOf","string","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useMemo, 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.default;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName,\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 = useMemo(() => () => onClick(), [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': 'button-icon',\n 'data-tip': toolTipIsVisible\n }\n : {})}\n className={styleButton}\n data-name={dataName}\n aria-label={ariaLabel}\n title={ariaLabel}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {contentView}\n </Link>\n ) : (\n <button\n {...(ariaLabel\n ? {\n 'data-for': 'button-icon',\n 'data-tip': toolTipIsVisible\n }\n : {})}\n type=\"button\"\n aria-label={ariaLabel}\n data-name={dataName}\n data-testid={`button-${dataName}-${className}`}\n title={ariaLabel}\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=\"button-icon\"\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,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,EAAkCC,WAAlC,EAA+CC,MAA/C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,KAAR,QAAoB,yBAApB;AACA,OAAOC,MAAP,MAAmB,SAAnB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,OAAP,MAAoB,YAApB,C,CACA;;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CAACC,IAAD,EAAOC,MAAP,KAAkB;EACzC,MAAMC,IAAI,GAAG,OAAM,IAAN,EAAYF,IAAZ,EAAkBN,KAAlB,CAAb;;EAEA,IAAI,CAACQ,IAAD,IAAS,CAACD,MAAd,EAAsB;IACpB,oBAAO;MAAK,SAAS,EAAEH,KAAK,CAACK;IAAtB,EAAP;EACD;;EAED,oBACE;IAAK,SAAS,EAAEL,KAAK,CAACK;EAAtB,GACGF,MAAM,gBAAG,oBAAC,MAAD;IAAQ,QAAQ,EAAEA;EAAlB,EAAH,gBAAkC,oBAAC,IAAD;IAAM,SAAS,EAAEH,KAAK,CAACE;EAAvB,EAD3C,CADF;AAKD,CAZD;;AAcA,MAAMI,YAAY,GAAGC,IAAI,IAAI;EAC3B,QAAQA,IAAR;IACE,KAAK,OAAL;MACE,OAAOP,KAAK,CAACQ,KAAb;;IACF,KAAK,YAAL;MACE,OAAOR,KAAK,CAACS,UAAb;;IACF;MACE,OAAOT,KAAK,C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jB;EANxC,EADQ,GASN,IAXN,CADF;AAeD,CApHD;;AAsHAJ,cAAc,CAACwB,SAAf,2CAA2B;EACzB5B,IAAI,EAAEb,SAAS,CAAC0C,KAAV,CAAgB,CAAC,SAAD,EAAY,OAAZ,EAAqB,YAArB,CAAhB,CADmB;EAEzB,cAAc1C,SAAS,CAAC2C,MAFC;EAGzB,aAAa3C,SAAS,CAAC2C,MAHE;EAIzBnC,IAAI,EAAER,SAAS,CAAC0C,KAAV,CAAgB,MAAKxC,KAAL,CAAhB,CAJmB;EAKzBO,MAAM,EAAET,SAAS,CAAC2C,MALO;EAMzBpB,OAAO,EAAEvB,SAAS,CAAC4C,IANM;EAOzBtB,IAAI,EAAEtB,SAAS,CAAC6C,KAAV,CAAgB;IACpBC,IAAI,EAAE9C,SAAS,CAAC2C,MADI;IAEpBI,QAAQ,EAAE/C,SAAS,CAACgD,IAFA;IAGpBC,MAAM,EAAEjD,SAAS,CAAC0C,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB;EAHY,CAAhB,CAPmB;EAYzBvB,QAAQ,EAAEnB,SAAS,CAACgD,IAZK;EAazBxB,SAAS,EAAExB,SAAS,CAAC2C,MAbI;EAczBlB,gBAAgB,EAAEzB,SAAS,CAAC0C,KAAV,CAAgB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,CAAhB;AAdO,CAA3B;AAiBA,eAAezB,cAAf"}
|
|
@@ -68,6 +68,15 @@
|
|
|
68
68
|
border-radius: 5px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
.tooltipContentWrapper {
|
|
72
|
+
text-align: left;
|
|
73
|
+
width: max-content;
|
|
74
|
+
font-family: Gilroy;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
font-weight: 500;
|
|
77
|
+
line-height: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
71
80
|
@media tablet {
|
|
72
81
|
.responsive {
|
|
73
82
|
composes: button;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
2
|
export default ToolTip;
|
|
3
|
-
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize, iconSize, AnchorElement, tooltipClassName }: {
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize, iconSize, AnchorElement, tooltipClassName, placement }: {
|
|
4
4
|
anchorId: any;
|
|
5
5
|
TooltipContent: any;
|
|
6
6
|
"aria-label": any;
|
|
@@ -13,6 +13,7 @@ declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "d
|
|
|
13
13
|
iconSize?: string | undefined;
|
|
14
14
|
AnchorElement: any;
|
|
15
15
|
tooltipClassName: any;
|
|
16
|
+
placement?: string | undefined;
|
|
16
17
|
}): JSX.Element;
|
|
17
18
|
declare namespace ToolTip {
|
|
18
19
|
const propTypes: {
|
|
@@ -28,6 +29,7 @@ declare namespace ToolTip {
|
|
|
28
29
|
iconSize: PropTypes.Requireable<string>;
|
|
29
30
|
anchorId: PropTypes.Requireable<string>;
|
|
30
31
|
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
32
|
+
placement: PropTypes.Requireable<string>;
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA6EO,iGAUN;;AAED;;;;;;;;;;;;;;gBA0GC"}
|
package/es/atom/tooltip/index.js
CHANGED
|
@@ -25,7 +25,8 @@ const ToolTipWrapper = ({
|
|
|
25
25
|
handleContentMouseOver,
|
|
26
26
|
iconSize,
|
|
27
27
|
tooltipClassName,
|
|
28
|
-
usesAnchorElement
|
|
28
|
+
usesAnchorElement,
|
|
29
|
+
placement
|
|
29
30
|
}) => {
|
|
30
31
|
const coorpToolTipClasses = classnames(style.toolTip, tooltipClassName, // eslint-disable-next-line no-nested-ternary
|
|
31
32
|
usesAnchorElement ? null : iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip);
|
|
@@ -36,7 +37,7 @@ const ToolTipWrapper = ({
|
|
|
36
37
|
id: anchorId,
|
|
37
38
|
className: style.toolTipReact,
|
|
38
39
|
"data-event-off": "click",
|
|
39
|
-
place:
|
|
40
|
+
place: placement,
|
|
40
41
|
effect: "solid",
|
|
41
42
|
"aria-label": closeToolTipInformationTextAriaLabel
|
|
42
43
|
}, content);
|
|
@@ -83,7 +84,8 @@ const ToolTip = ({
|
|
|
83
84
|
fontSize = 14,
|
|
84
85
|
iconSize = 'small',
|
|
85
86
|
AnchorElement,
|
|
86
|
-
tooltipClassName
|
|
87
|
+
tooltipClassName,
|
|
88
|
+
placement = 'left'
|
|
87
89
|
}) => {
|
|
88
90
|
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
89
91
|
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
@@ -129,7 +131,8 @@ const ToolTip = ({
|
|
|
129
131
|
content: content,
|
|
130
132
|
onMouseLeave: handleMouseLeave,
|
|
131
133
|
onMouseOver: handleMouseOver,
|
|
132
|
-
fontSize: fontSize
|
|
134
|
+
fontSize: fontSize,
|
|
135
|
+
placement: placement
|
|
133
136
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
134
137
|
className: style.tooltipContainer,
|
|
135
138
|
onMouseLeave: handleMouseLeave,
|
|
@@ -166,7 +169,8 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
166
169
|
// parents overflow hidden controls
|
|
167
170
|
// data-for={anchorId} && data-tooltip-place="left" are needed on the anchored component
|
|
168
171
|
anchorId: PropTypes.string,
|
|
169
|
-
toolTipIsVisible: PropTypes.bool
|
|
172
|
+
toolTipIsVisible: PropTypes.bool,
|
|
173
|
+
placement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])
|
|
170
174
|
} : {};
|
|
171
175
|
export default ToolTip;
|
|
172
176
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","has","isNil","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","tooltipClassName","usesAnchorElement","coorpToolTipClasses","toolTip","bigIconToolTip","smallIconToolTip","toolTipReact","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","AnchorElement","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","anchorElement","tooltipIconContainer","informationIcon","tooltipContainer","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport has from 'lodash/fp/has';\nimport isNil from 'lodash/fp/isNil';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize,\n tooltipClassName,\n usesAnchorElement\n}) => {\n const coorpToolTipClasses = classnames(\n style.toolTip,\n tooltipClassName,\n // eslint-disable-next-line no-nested-ternary\n usesAnchorElement ? null : iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n );\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={coorpToolTipClasses}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n tooltipClassName: PropTypes.string,\n usesAnchorElement: PropTypes.bool\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (!has('key', event)) return;\n else if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small',\n AnchorElement,\n tooltipClassName\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n const anchorElement = useMemo(\n () =>\n AnchorElement ? (\n <AnchorElement onKeyDown={handleKeyPress} />\n ) : (\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n ),\n [AnchorElement, ariaLabel, dataTestId, handleKeyPress, iconContainerClassName, iconSize]\n );\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {anchorElement}\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\n tooltipClassName={tooltipClassName}\n usesAnchorElement={!isNil(AnchorElement)}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n // If using an Anchor element w/ the regular Tooltip\n AnchorElement: PropTypes.func,\n tooltipClassName: PropTypes.string,\n //\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n // data-for={anchorId} && data-tooltip-place=\"left\" are needed on the anchored component\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,O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AClBkB,cAAc,EAAE/C,SAAS,CAACsE,SAAV,CAAoB,CAACtE,SAAS,CAACkC,IAAX,EAAiBlC,SAAS,CAACiC,IAA3B,EAAiCjC,SAAS,CAAC+B,MAA3C,CAApB,CADE;EAElB,eAAe/B,SAAS,CAAC+B,MAFP;EAGlB,cAAc/B,SAAS,CAAC+B,MAHN;EAIlBb,oCAAoC,EAAElB,SAAS,CAAC+B,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACAsB,aAAa,EAAEtD,SAAS,CAACkC,IAPP;EAQlBZ,gBAAgB,EAAEtB,SAAS,CAAC+B,MARV;EASlB;EACAoB,sBAAsB,EAAEnD,SAAS,CAAC+B,MAVhB;EAWlBqB,SAAS,EAAEpD,SAAS,CAACuE,MAXH;EAYlBlB,QAAQ,EAAErD,SAAS,CAACmC,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CAZQ;EAalBd,QAAQ,EAAErB,SAAS,CAACmC,KAAV,CAAgB9B,IAAI,CAACO,SAAD,CAApB,CAbQ;EAclB;EACA;EACA;EACA;EACAK,QAAQ,EAAEjB,SAAS,CAAC+B,MAlBF;EAmBlBf,gBAAgB,EAAEhB,SAAS,CAAC8B;AAnBV,CAApB;AAsBA,eAAegB,OAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","has","isNil","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","tooltipClassName","usesAnchorElement","placement","coorpToolTipClasses","toolTip","bigIconToolTip","smallIconToolTip","toolTipReact","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","AnchorElement","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","anchorElement","tooltipIconContainer","informationIcon","tooltipContainer","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport has from 'lodash/fp/has';\nimport isNil from 'lodash/fp/isNil';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize,\n tooltipClassName,\n usesAnchorElement,\n placement\n}) => {\n const coorpToolTipClasses = classnames(\n style.toolTip,\n tooltipClassName,\n // eslint-disable-next-line no-nested-ternary\n usesAnchorElement ? null : iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n );\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place={placement}\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={coorpToolTipClasses}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n tooltipClassName: PropTypes.string,\n usesAnchorElement: PropTypes.bool\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (!has('key', event)) return;\n else if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small',\n AnchorElement,\n tooltipClassName,\n placement = 'left'\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n const anchorElement = useMemo(\n () =>\n AnchorElement ? (\n <AnchorElement onKeyDown={handleKeyPress} />\n ) : (\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n ),\n [AnchorElement, ariaLabel, dataTestId, handleKeyPress, iconContainerClassName, iconSize]\n );\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n placement={placement}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {anchorElement}\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\n tooltipClassName={tooltipClassName}\n usesAnchorElement={!isNil(AnchorElement)}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n // If using an Anchor element w/ the regular Tooltip\n AnchorElement: PropTypes.func,\n tooltipClassName: PropTypes.string,\n //\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n // data-for={anchorId} && data-tooltip-place=\"left\" are needed on the anchored component\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool,\n placement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,SAAS,GAAG;EAChB,IAAID,KAAK,CAACE,wBADM;EAEhB,IAAIF,KAAK,CAACG;AAFM,CAAlB;AAKA,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,EADS;EAEhBC,GAAG,EAAE;AAFW,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC,sBALsB;EAMtBC,QANsB;EAOtBC,gBAPsB;EAQtBC,iBARsB;EAStBC;AATsB,CAAD,KAUjB;EACJ,MAAMC,mBAAmB,GAAG1B,UAAU,CACpCS,KAAK,CAACkB,OAD8B,EAEpCJ,gBAFoC,EAGpC;EACAC,iBAAiB,GAAG,IAAH,GAAUF,QAAQ,KAAK,KAAb,GAAqBb,KAAK,CAACmB,cAA3B,GAA4CnB,KAAK,CAACoB,gBAJzC,CAAtC;EAMA,IAAI,CAACZ,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ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mBlBhB,gBAAgB,EAAEhB,SAAS,CAAC+B,IAnBV;EAoBlBP,SAAS,EAAExB,SAAS,CAACoC,KAAV,CAAgB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,CAAhB;AApBO,CAApB;AAuBA,eAAeW,OAAf"}
|
|
@@ -97,13 +97,13 @@
|
|
|
97
97
|
opacity: 1 !important;
|
|
98
98
|
left: 5px;
|
|
99
99
|
max-width: 400px;
|
|
100
|
+
padding: 8px 12px !important;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
/* for keyboard navigation, the position can't be obtained from the mouse */
|
|
103
104
|
[class*="__react_component_tooltip"]:not(.toolTipReact) {
|
|
104
105
|
border-radius: 7px !important;
|
|
105
|
-
|
|
106
|
-
left: 628px!important;
|
|
106
|
+
left: -999em !important;
|
|
107
107
|
visibility: visible !important;
|
|
108
108
|
opacity: 1!important;
|
|
109
109
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import ButtonLinkIcon from '../../atom/button-link-icon';
|
|
4
4
|
import ButtonMenu from '../../atom/button-menu';
|
|
5
5
|
import propTypes from './types';
|
|
6
6
|
import style from './style.css';
|
|
@@ -37,7 +37,7 @@ const BulletPointMenuButton = props => {
|
|
|
37
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
38
|
className: style.bulletPointWrapper,
|
|
39
39
|
"data-name": "bullet-point-wrapper"
|
|
40
|
-
}, /*#__PURE__*/React.createElement(
|
|
40
|
+
}, /*#__PURE__*/React.createElement(ButtonLinkIcon, bulletPointButtonProps), menu);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
BulletPointMenuButton.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","classnames","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","classnames","ButtonLinkIcon","ButtonMenu","propTypes","style","BulletPointMenuButton","props","disabled","buttonAriaLabel","menuAriaLabel","onClick","buttons","menuButtonClassName","isBulkMenu","handleOnClick","menuProps","menu","bulletPointMenu","bulkBulletPointMenu","bulletPointButtonProps","size","icon","className","bulletPointWrapper"],"sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"sourcesContent":["import React, {useCallback} from 'react';\nimport classnames from 'classnames';\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,\n buttons,\n menuButtonClassName,\n isBulkMenu\n } = props;\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const menuProps = {\n 'data-name': 'button-menu',\n buttons\n };\n\n const menu = (\n <div\n className={classnames(style.bulletPointMenu, isBulkMenu && style.bulkBulletPointMenu)}\n data-name=\"menu-wrapper\"\n aria-label={menuAriaLabel}\n >\n <ButtonMenu {...menuProps} />\n </div>\n );\n const bulletPointButtonProps = {\n size: 'default',\n 'aria-label': buttonAriaLabel,\n 'data-name': 'bullet-point-button',\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,KAAP,IAAeC,WAAf,QAAiC,OAAjC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,SAAP,MAAoD,SAApD;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,qBAAqB,GAAIC,KAAD,IAAuC;EACnE,MAAM;IACJC,QAAQ,GAAG,KADP;IAEJC,eAFI;IAGJC,aAHI;IAIJC,OAJI;IAKJC,OALI;IAMJC,mBANI;IAOJC;EAPI,IAQFP,KARJ;EASA,MAAMQ,aAAa,GAAGf,WAAW,CAAC,MAAMW,OAAO,EAAd,EAAkB,CAACA,OAAD,CAAlB,CAAjC;EAEA,MAAMK,SAAS,GAAG;IAChB,aAAa,aADG;IAEhBJ;EAFgB,CAAlB;EAKA,MAAMK,IAAI,gBACR;IACE,SAAS,EAAEhB,UAAU,CAACI,KAAK,CAACa,eAAP,EAAwBJ,UAAU,IAAIT,KAAK,CAACc,mBAA5C,CADvB;IAEE,aAAU,cAFZ;IAGE,cAAYT;EAHd,gBAKE,oBAAC,UAAD,EAAgBM,SAAhB,CALF,CADF;EASA,MAAMI,sBAAsB,GAAG;IAC7BC,IAAI,EAAE,SADuB;IAE7B,cAAcZ,eAFe;IAG7B,aAAa,qBAHgB;IAI7Ba,IAAI,EAAE,cAJuB;IAK7BX,OAAO,EAAEI,aALoB;IAM7BP,QAN6B;IAO7Be,SAAS,EAAEV;EAPkB,CAA/B;EAUA,oBACE;IAAK,SAAS,EAAER,KAAK,CAACmB,kBAAtB;IAA0C,aAAU;EAApD,gBACE,oBAAC,cAAD,EAAoBJ,sBAApB,CADF,EAEGH,IAFH,CADF;AAMD,CA1CD;;AA4CAX,qBAAqB,CAACF,SAAtB,2CAAkCA,SAAlC;AAEA,eAAeE,qBAAf"}
|
|
@@ -5,7 +5,7 @@ import isEmpty from 'lodash/fp/isEmpty';
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import Provider from '../../atom/provider';
|
|
7
7
|
import Cta from '../../atom/button-link';
|
|
8
|
-
import
|
|
8
|
+
import ButtonLinkIcon from '../../atom/button-link-icon';
|
|
9
9
|
import InputSwitch from '../../atom/input-switch';
|
|
10
10
|
import Title from '../../atom/title';
|
|
11
11
|
import CardsGrid from '../../organism/cards-grid';
|
|
@@ -186,7 +186,7 @@ const CMPopin = props => {
|
|
|
186
186
|
className: style.popinHeader
|
|
187
187
|
}, renderHeader(), onClose ? /*#__PURE__*/React.createElement("div", {
|
|
188
188
|
className: style.onCloseButton
|
|
189
|
-
}, /*#__PURE__*/React.createElement(
|
|
189
|
+
}, /*#__PURE__*/React.createElement(ButtonLinkIcon, {
|
|
190
190
|
onClick: handleCloseButton,
|
|
191
191
|
"data-name": 'close-icon',
|
|
192
192
|
"aria-label": 'close-icon',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useRef","useEffect","useMemo","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","NovaLineSettingsCookie","Cookie","NovaSolidSpaceMoonRocket","MoonRocket","NovaCompositionCoorpacademyPadlock","LockIcon","NovaLineStatusCheckCircle1","CheckCircle1","NovaSolidFilesBasicFileLines","FileLinesIcon","NovaSolidInterfaceFeedbackInterfaceAlertRounded","AlertIcon","map","isEmpty","classNames","Provider","Cta","ButtonLinkIconOnly","InputSwitch","Title","CardsGrid","ListItems","Link","style","propTypes","IconType","lockedContent","lockIcon","fileZipped","filesListIconContainer","filesListIcon","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","backgroundImageUrl","descriptionText","thirdButton","cookieTitle","descriptionBtnTxt","listBtnSwicth","items","link","logo","LogoComponent","backgroundImageStyle","backgroundImage","backgroundSize","handleCloseButton","nodeRef","closePopin","e","current","contains","target","handleKeyDown","key","document","addEventListener","removeEventListener","renderHeader","title","headerIcon","TopTitleIcon","headerContent","headerBackground","cookieHeader","cookieIconContainer","cookieIcon","getClassBtnSwitch","index","btnList","firstBtnSwitchContainer","length","lastBtnSwitchContainer","singleSwitchContainer","renderBtnSwitch","convert","cap","el","type","value","onChange","titlePosition","theme","details","requiredSelection","disabled","id","dataName","renderItems","list","itemsContainer","filesListContainer","wrapperPopinStyle","popinCookie","popinFilesList","popinItems","popin","background","popinHeader","onCloseButton","cookieTitleContainer","titleContainer","contentSection","message","__html","descriptionBtn","buttonContainer","largeButton","button","label","handleOnclick","customStyle","contextTypes","translate","childContextTypes"],"sources":["../../../src/molecule/cm-popin/index.js"],"sourcesContent":["import React, {useRef, useEffect, useMemo} from 'react';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond,\n NovaSolidApplicationsWindowUpload3 as WindowUpload,\n NovaLineSettingsCookie as Cookie,\n NovaSolidSpaceMoonRocket as MoonRocket,\n NovaCompositionCoorpacademyPadlock as LockIcon,\n NovaLineStatusCheckCircle1 as CheckCircle1,\n NovaSolidFilesBasicFileLines as FileLinesIcon,\n NovaSolidInterfaceFeedbackInterfaceAlertRounded as AlertIcon\n} from '@coorpacademy/nova-icons';\nimport map from 'lodash/fp/map';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport classNames from 'classnames';\nimport Provider from '../../atom/provider';\nimport Cta from '../../atom/button-link';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport InputSwitch from '../../atom/input-switch';\nimport Title from '../../atom/title';\nimport CardsGrid from '../../organism/cards-grid';\nimport ListItems from '../../organism/list-items';\nimport Link from '../../atom/link';\nimport style from './style.css';\nimport propTypes from './types';\n\nconst IconType = {\n lockedContent: <LockIcon className={style.lockIcon} />,\n fileZipped: (\n <div className={style.filesListIconContainer}>\n <FileLinesIcon className={style.filesListIcon} />\n </div>\n )\n};\n\nconst CMPopin = props => {\n const {\n content,\n mode = 'alert',\n firstButton,\n secondButton,\n onClose,\n header,\n icon,\n backgroundImageUrl,\n descriptionText,\n thirdButton,\n cookieTitle,\n descriptionBtnTxt,\n listBtnSwicth,\n items,\n link\n } = props;\n const logo = {\n AlertDiamond,\n WindowUpload,\n MoonRocket,\n CheckCircle1,\n AlertIcon\n };\n const LogoComponent = logo[icon];\n\n const backgroundImageStyle = backgroundImageUrl\n ? {\n backgroundImage: `url(${backgroundImageUrl})`,\n backgroundSize: 'cover'\n }\n : null;\n const handleCloseButton = useMemo(() => () => onClose(), [onClose]);\n const nodeRef = useRef(null);\n useEffect(() => {\n if (mode === 'items') {\n const closePopin = e => {\n if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {\n handleCloseButton();\n }\n };\n const handleKeyDown = e => {\n if (e?.key === 'Escape') {\n handleCloseButton();\n }\n };\n document.addEventListener('click', closePopin);\n document.addEventListener('touchstart', closePopin);\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('click', closePopin);\n document.removeEventListener('touchstart', closePopin);\n document.removeEventListener('keydown', handleKeyDown);\n };\n }\n }, [handleCloseButton, mode, onClose]);\n const renderHeader = () => {\n if (header) {\n const {title, headerIcon, backgroundImage} = header;\n const TopTitleIcon = IconType[headerIcon];\n\n return (\n <>\n {title ? (\n <div className={style.headerContent}>\n {TopTitleIcon}\n <Title {...title} />\n </div>\n ) : null}\n {backgroundImage ? (\n <img className={style.headerBackground} src={backgroundImage} />\n ) : null}\n </>\n );\n }\n\n if (mode === 'cookie')\n return (\n <div className={style.cookieHeader}>\n <div className={style.cookieIconContainer}>\n <Cookie className={style.cookieIcon} />\n </div>\n <div className={style.cookieTitle}>{cookieTitle}</div>\n </div>\n );\n\n return null;\n };\n\n const getClassBtnSwitch = (index, btnList) => {\n switch (index) {\n case 0:\n return style.firstBtnSwitchContainer;\n case btnList.length - 1:\n return style.lastBtnSwitchContainer;\n default:\n return style.singleSwitchContainer;\n }\n };\n\n const renderBtnSwitch = () => {\n return map.convert({cap: false})((el, index) => {\n const {\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n } = el;\n return (\n <div key={index} className={getClassBtnSwitch(index, listBtnSwicth)}>\n <InputSwitch\n {...{\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n }}\n />\n </div>\n );\n })(listBtnSwicth);\n };\n\n const renderItems = () => {\n const {type, list} = items;\n if (isEmpty(list)) return null;\n\n if (type === 'content')\n return (\n <div className={style.itemsContainer} data-name={'cm-popin-cards'}>\n <CardsGrid {...list} />\n </div>\n );\n if (type === 'list')\n return (\n <div className={style.filesListContainer}>\n <ListItems {...list} />\n </div>\n );\n\n return null;\n };\n const wrapperPopinStyle = classNames(\n mode === 'cookie' && style.popinCookie,\n mode === 'list' && style.popinFilesList,\n mode === 'items' && style.popinItems,\n style.popin\n );\n return (\n <div\n className={mode !== 'cookie' ? style.background : null}\n style={backgroundImageStyle}\n data-name={'cm-popin-container'}\n >\n <div className={wrapperPopinStyle} ref={nodeRef}>\n <header className={style.popinHeader}>\n {renderHeader()}\n {onClose ? (\n <div className={style.onCloseButton}>\n <ButtonLinkIconOnly\n onClick={handleCloseButton}\n data-name={'close-icon'}\n aria-label={'close-icon'}\n size=\"small\"\n icon=\"close\"\n />\n </div>\n ) : null}\n </header>\n {mode !== 'items' && mode !== 'list' ? (\n <div\n className={\n mode === 'cookie' || mode === 'information'\n ? style.cookieTitleContainer\n : style.titleContainer\n }\n >\n <div className={style.contentSection}>\n {LogoComponent ? <LogoComponent className={style.icon} /> : null}\n {content ? (\n <p\n className={mode === 'alert' ? style.content : style.message}\n data-name={'cm-popin-content'}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : null}\n </div>\n {descriptionText ? (\n <p\n className={style.descriptionText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: descriptionText}}\n />\n ) : null}\n {link ? <Link {...link} /> : null}\n </div>\n ) : null}\n {descriptionBtnTxt ? <div className={style.descriptionBtn}>{descriptionBtnTxt}</div> : null}\n {!isEmpty(items) ? renderItems() : null}\n {renderBtnSwitch()}\n {firstButton || secondButton || thirdButton ? (\n <div className={style.buttonContainer}>\n {firstButton ? (\n <div className={firstButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={firstButton.label}\n onClick={firstButton.handleOnclick}\n data-name={'cm-popin-cta'}\n aria-label={firstButton['aria-label']}\n type={firstButton.type}\n customStyle={firstButton.customStyle}\n />\n </div>\n ) : null}\n {secondButton ? (\n <div className={secondButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={secondButton.label}\n onClick={secondButton.handleOnclick}\n data-name={`cm-popin-cta-${secondButton.type}`}\n aria-label={secondButton['aria-label']}\n type={secondButton.type}\n customStyle={secondButton.customStyle}\n icon={secondButton.icon}\n />\n </div>\n ) : null}\n {thirdButton ? (\n <div className={thirdButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={thirdButton.label}\n onClick={thirdButton.handleOnclick}\n data-name={`cm-popin-cta-${thirdButton.type}`}\n aria-label={thirdButton['aria-label']}\n type={thirdButton.type}\n customStyle={thirdButton.customStyle}\n />\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nCMPopin.propTypes = propTypes;\nCMPopin.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default CMPopin;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,MAAf,EAAuBC,SAAvB,EAAkCC,OAAlC,QAAgD,OAAhD;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,EAGEC,sBAAsB,IAAIC,MAH5B,EAIEC,wBAAwB,IAAIC,UAJ9B,EAKEC,kCAAkC,IAAIC,QALxC,EAMEC,0BAA0B,IAAIC,YANhC,EAOEC,4BAA4B,IAAIC,aAPlC,EAQEC,+CAA+C,IAAIC,SARrD,QASO,0BATP;AAUA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AAC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ef","useEffect","useMemo","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","NovaLineSettingsCookie","Cookie","NovaSolidSpaceMoonRocket","MoonRocket","NovaCompositionCoorpacademyPadlock","LockIcon","NovaLineStatusCheckCircle1","CheckCircle1","NovaSolidFilesBasicFileLines","FileLinesIcon","NovaSolidInterfaceFeedbackInterfaceAlertRounded","AlertIcon","map","isEmpty","classNames","Provider","Cta","ButtonLinkIcon","InputSwitch","Title","CardsGrid","ListItems","Link","style","propTypes","IconType","lockedContent","lockIcon","fileZipped","filesListIconContainer","filesListIcon","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","backgroundImageUrl","descriptionText","thirdButton","cookieTitle","descriptionBtnTxt","listBtnSwicth","items","link","logo","LogoComponent","backgroundImageStyle","backgroundImage","backgroundSize","handleCloseButton","nodeRef","closePopin","e","current","contains","target","handleKeyDown","key","document","addEventListener","removeEventListener","renderHeader","title","headerIcon","TopTitleIcon","headerContent","headerBackground","cookieHeader","cookieIconContainer","cookieIcon","getClassBtnSwitch","index","btnList","firstBtnSwitchContainer","length","lastBtnSwitchContainer","singleSwitchContainer","renderBtnSwitch","convert","cap","el","type","value","onChange","titlePosition","theme","details","requiredSelection","disabled","id","dataName","renderItems","list","itemsContainer","filesListContainer","wrapperPopinStyle","popinCookie","popinFilesList","popinItems","popin","background","popinHeader","onCloseButton","cookieTitleContainer","titleContainer","contentSection","message","__html","descriptionBtn","buttonContainer","largeButton","button","label","handleOnclick","customStyle","contextTypes","translate","childContextTypes"],"sources":["../../../src/molecule/cm-popin/index.js"],"sourcesContent":["import React, {useRef, useEffect, useMemo} from 'react';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond,\n NovaSolidApplicationsWindowUpload3 as WindowUpload,\n NovaLineSettingsCookie as Cookie,\n NovaSolidSpaceMoonRocket as MoonRocket,\n NovaCompositionCoorpacademyPadlock as LockIcon,\n NovaLineStatusCheckCircle1 as CheckCircle1,\n NovaSolidFilesBasicFileLines as FileLinesIcon,\n NovaSolidInterfaceFeedbackInterfaceAlertRounded as AlertIcon\n} from '@coorpacademy/nova-icons';\nimport map from 'lodash/fp/map';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport classNames from 'classnames';\nimport Provider from '../../atom/provider';\nimport Cta from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport InputSwitch from '../../atom/input-switch';\nimport Title from '../../atom/title';\nimport CardsGrid from '../../organism/cards-grid';\nimport ListItems from '../../organism/list-items';\nimport Link from '../../atom/link';\nimport style from './style.css';\nimport propTypes from './types';\n\nconst IconType = {\n lockedContent: <LockIcon className={style.lockIcon} />,\n fileZipped: (\n <div className={style.filesListIconContainer}>\n <FileLinesIcon className={style.filesListIcon} />\n </div>\n )\n};\n\nconst CMPopin = props => {\n const {\n content,\n mode = 'alert',\n firstButton,\n secondButton,\n onClose,\n header,\n icon,\n backgroundImageUrl,\n descriptionText,\n thirdButton,\n cookieTitle,\n descriptionBtnTxt,\n listBtnSwicth,\n items,\n link\n } = props;\n const logo = {\n AlertDiamond,\n WindowUpload,\n MoonRocket,\n CheckCircle1,\n AlertIcon\n };\n const LogoComponent = logo[icon];\n\n const backgroundImageStyle = backgroundImageUrl\n ? {\n backgroundImage: `url(${backgroundImageUrl})`,\n backgroundSize: 'cover'\n }\n : null;\n const handleCloseButton = useMemo(() => () => onClose(), [onClose]);\n const nodeRef = useRef(null);\n useEffect(() => {\n if (mode === 'items') {\n const closePopin = e => {\n if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {\n handleCloseButton();\n }\n };\n const handleKeyDown = e => {\n if (e?.key === 'Escape') {\n handleCloseButton();\n }\n };\n document.addEventListener('click', closePopin);\n document.addEventListener('touchstart', closePopin);\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('click', closePopin);\n document.removeEventListener('touchstart', closePopin);\n document.removeEventListener('keydown', handleKeyDown);\n };\n }\n }, [handleCloseButton, mode, onClose]);\n const renderHeader = () => {\n if (header) {\n const {title, headerIcon, backgroundImage} = header;\n const TopTitleIcon = IconType[headerIcon];\n\n return (\n <>\n {title ? (\n <div className={style.headerContent}>\n {TopTitleIcon}\n <Title {...title} />\n </div>\n ) : null}\n {backgroundImage ? (\n <img className={style.headerBackground} src={backgroundImage} />\n ) : null}\n </>\n );\n }\n\n if (mode === 'cookie')\n return (\n <div className={style.cookieHeader}>\n <div className={style.cookieIconContainer}>\n <Cookie className={style.cookieIcon} />\n </div>\n <div className={style.cookieTitle}>{cookieTitle}</div>\n </div>\n );\n\n return null;\n };\n\n const getClassBtnSwitch = (index, btnList) => {\n switch (index) {\n case 0:\n return style.firstBtnSwitchContainer;\n case btnList.length - 1:\n return style.lastBtnSwitchContainer;\n default:\n return style.singleSwitchContainer;\n }\n };\n\n const renderBtnSwitch = () => {\n return map.convert({cap: false})((el, index) => {\n const {\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n } = el;\n return (\n <div key={index} className={getClassBtnSwitch(index, listBtnSwicth)}>\n <InputSwitch\n {...{\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n }}\n />\n </div>\n );\n })(listBtnSwicth);\n };\n\n const renderItems = () => {\n const {type, list} = items;\n if (isEmpty(list)) return null;\n\n if (type === 'content')\n return (\n <div className={style.itemsContainer} data-name={'cm-popin-cards'}>\n <CardsGrid {...list} />\n </div>\n );\n if (type === 'list')\n return (\n <div className={style.filesListContainer}>\n <ListItems {...list} />\n </div>\n );\n\n return null;\n };\n const wrapperPopinStyle = classNames(\n mode === 'cookie' && style.popinCookie,\n mode === 'list' && style.popinFilesList,\n mode === 'items' && style.popinItems,\n style.popin\n );\n return (\n <div\n className={mode !== 'cookie' ? style.background : null}\n style={backgroundImageStyle}\n data-name={'cm-popin-container'}\n >\n <div className={wrapperPopinStyle} ref={nodeRef}>\n <header className={style.popinHeader}>\n {renderHeader()}\n {onClose ? (\n <div className={style.onCloseButton}>\n <ButtonLinkIcon\n onClick={handleCloseButton}\n data-name={'close-icon'}\n aria-label={'close-icon'}\n size=\"small\"\n icon=\"close\"\n />\n </div>\n ) : null}\n </header>\n {mode !== 'items' && mode !== 'list' ? (\n <div\n className={\n mode === 'cookie' || mode === 'information'\n ? style.cookieTitleContainer\n : style.titleContainer\n }\n >\n <div className={style.contentSection}>\n {LogoComponent ? <LogoComponent className={style.icon} /> : null}\n {content ? (\n <p\n className={mode === 'alert' ? style.content : style.message}\n data-name={'cm-popin-content'}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : null}\n </div>\n {descriptionText ? (\n <p\n className={style.descriptionText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: descriptionText}}\n />\n ) : null}\n {link ? <Link {...link} /> : null}\n </div>\n ) : null}\n {descriptionBtnTxt ? <div className={style.descriptionBtn}>{descriptionBtnTxt}</div> : null}\n {!isEmpty(items) ? renderItems() : null}\n {renderBtnSwitch()}\n {firstButton || secondButton || thirdButton ? (\n <div className={style.buttonContainer}>\n {firstButton ? (\n <div className={firstButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={firstButton.label}\n onClick={firstButton.handleOnclick}\n data-name={'cm-popin-cta'}\n aria-label={firstButton['aria-label']}\n type={firstButton.type}\n customStyle={firstButton.customStyle}\n />\n </div>\n ) : null}\n {secondButton ? (\n <div className={secondButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={secondButton.label}\n onClick={secondButton.handleOnclick}\n data-name={`cm-popin-cta-${secondButton.type}`}\n aria-label={secondButton['aria-label']}\n type={secondButton.type}\n customStyle={secondButton.customStyle}\n icon={secondButton.icon}\n />\n </div>\n ) : null}\n {thirdButton ? (\n <div className={thirdButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={thirdButton.label}\n onClick={thirdButton.handleOnclick}\n data-name={`cm-popin-cta-${thirdButton.type}`}\n aria-label={thirdButton['aria-label']}\n type={thirdButton.type}\n customStyle={thirdButton.customStyle}\n />\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nCMPopin.propTypes = propTypes;\nCMPopin.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default CMPopin;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,MAAf,EAAuBC,SAAvB,EAAkCC,OAAlC,QAAgD,OAAhD;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,EAGEC,sBAAsB,IAAIC,MAH5B,EAIEC,wBAAwB,IAAIC,UAJ9B,EAKEC,kCAAkC,IAAIC,QALxC,EAMEC,0BAA0B,IAAIC,YANhC,EAOEC,4BAA4B,IAAIC,aAPlC,EAQEC,+CAA+C,IAAIC,SARrD,QASO,0BATP;AAUA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,kBAAlB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,MAAsB,SAAtB;AAEA,MAAMC,QAAQ,GAAG;EACfC,aAAa,eAAE,oBAAC,QAAD;IAAU,SAAS,EAAEH,KAAK,CAACI;EAA3B,EADA;EAEfC,UAAU,eACR;IAAK,SAAS,EAAEL,KAAK,CAACM;EAAtB,gBACE,oBAAC,aAAD;IAAe,SAAS,EAAEN,KAAK,CAACO;EAAhC,EADF;A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YAAD,CAJ1B;IAKE,IAAI,EAAEA,YAAY,CAACiD,IALrB;IAME,WAAW,EAAEjD,YAAY,CAACkF,WAN5B;IAOE,IAAI,EAAElF,YAAY,CAACG;EAPrB,EADF,CADW,GAYT,IAzBN,EA0BGG,WAAW,gBACV;IAAK,SAAS,EAAEA,WAAW,CAACwE,WAAZ,GAA0B3F,KAAK,CAAC2F,WAAhC,GAA8C3F,KAAK,CAAC4F;EAApE,gBACE,oBAAC,GAAD;IACE,KAAK,EAAEzE,WAAW,CAAC0E,KADrB;IAEE,OAAO,EAAE1E,WAAW,CAAC2E,aAFvB;IAGE,aAAY,gBAAe3E,WAAW,CAAC2C,IAAK,EAH9C;IAIE,cAAY3C,WAAW,CAAC,YAAD,CAJzB;IAKE,IAAI,EAAEA,WAAW,CAAC2C,IALpB;IAME,WAAW,EAAE3C,WAAW,CAAC4E;EAN3B,EADF,CADU,GAWR,IArCN,CADD,GAwCG,IAvFN,CALF,CADF;AAiGD,CApQD;;AAsQAvF,OAAO,CAACP,SAAR,2CAAoBA,SAApB;AACAO,OAAO,CAACwF,YAAR,GAAuB;EACrBC,SAAS,EAAEzG,QAAQ,CAAC0G,iBAAT,CAA2BD;AADjB,CAAvB;AAIA,eAAezF,OAAf"}
|
|
@@ -8,7 +8,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
8
8
|
|
|
9
9
|
import React, { useState } from 'react';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
|
-
import
|
|
11
|
+
import ButtonLinkIcon from '../../atom/button-link-icon';
|
|
12
12
|
import StatusItem from '../../atom/status-item';
|
|
13
13
|
import BulkProgressBar from '../bulk-progress-bar';
|
|
14
14
|
import Provider, { GetTranslateFromContext } from '../../atom/provider';
|
|
@@ -147,7 +147,7 @@ const ActionableExpandableTable = (props, legacyContext) => {
|
|
|
147
147
|
className: style.columFirstWrapper
|
|
148
148
|
}, /*#__PURE__*/React.createElement("div", {
|
|
149
149
|
className: style.expandButtonWrapper
|
|
150
|
-
}, isRowExpandible ? /*#__PURE__*/React.createElement(
|
|
150
|
+
}, isRowExpandible ? /*#__PURE__*/React.createElement(ButtonLinkIcon, {
|
|
151
151
|
onClick: handleExpandRow(index),
|
|
152
152
|
"data-name": `arrowUp-button-${index}`,
|
|
153
153
|
icon: "down",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","classnames","ButtonLinkIconOnly","StatusItem","BulkProgressBar","Provider","GetTranslateFromContext","BulletPointMenuButton","ButtonLink","ErrorsTable","EmptySearchResult","style","propTypes","buildField","field","componentType","statusItemWrapper","buildLastField","lastField","buildNestedRow","row","ActionableExpandableTable","props","legacyContext","columns","rows","stickyFirstColumn","stickyLastColumn","ariaDescribedby","columnWidth","isNestedTable","emptyStateFistMessage","emptyStateSecondMessage","translate","expandedRows","setExpandedRows","expandState","setExpandState","wrapper","handleExpandRow","index","isRowExpanded","newExpandedRows","filter","id","concat","expandedState","forEach","headerRow","map","column","cIndex","title","headerFirstSticky","headerFirst","header","push","headerLastSticky","headerLast","headerView","bodyView","fields","isRowExpandible","bodyRow","fIndex","cellContent","columFirstWrapper","expandButtonWrapper","columnFirstSticky","columnFirst","col","width","columnLastSticky","columnLast","inspectButton","nestedRow","nestedRowCellule","includes","length","table","theadNested","thead","contextTypes","skin","childContextTypes"],"sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport classnames from 'classnames';\nimport {get, isString, size, includes, isEmpty} from 'lodash/fp';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport StatusItem from '../../atom/status-item';\nimport BulkProgressBar from '../bulk-progress-bar';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport BulletPointMenuButton from '../bullet-point-menu-button';\nimport ButtonLink from '../../atom/button-link';\nimport ErrorsTable from '../errors-table';\nimport EmptySearchResult from '../../atom/empty-search-result';\nimport style from './style.css';\nimport {ExpandState, Field, LastField, NestedRow, Props, propTypes} from './types';\n\nconst buildField = (field: Field) => {\n if (isString(field)) return field;\n const {componentType} = field;\n switch (componentType) {\n case 'status':\n return (\n <div className={style.statusItemWrapper}>\n <StatusItem {...field} />\n </div>\n );\n case 'progress-bar':\n return <BulkProgressBar {...field} />;\n }\n};\n\nconst buildLastField = (lastField: LastField) => {\n const {componentType} = lastField;\n switch (componentType) {\n case 'menu':\n return <BulletPointMenuButton {...lastField} />;\n case 'button-link':\n return <ButtonLink {...lastField} />;\n }\n};\n\nconst buildNestedRow = (row: NestedRow) => {\n const {componentType} = row;\n switch (componentType) {\n case 'errors-table':\n return <ErrorsTable {...row} />;\n case 'expandible-errors-table':\n return <ActionableExpandableTable {...row} />;\n }\n};\n\nconst ActionableExpandableTable = (props: Props, legacyContext: WebContextValues) => {\n const {\n columns,\n rows = [],\n lastField,\n stickyFirstColumn = false,\n stickyLastColumn = false,\n ariaDescribedby,\n columnWidth = `${100 / size(columns)}%`,\n isNestedTable = false,\n emptyStateFistMessage = '',\n emptyStateSecondMessage = ''\n } = props;\n\n const translate = GetTranslateFromContext(legacyContext);\n\n /**\n * State variable to keep track of all the expanded rows\n * By default, nothing expanded. Hence initialized with empty array.\n */\n const [expandedRows, setExpandedRows] = useState<number[]>([]);\n\n /**\n * State variable to keep track which row is currently expanded.\n */\n const [expandState, setExpandState] = useState<ExpandState>({});\n\n if (isEmpty(columns))\n return (\n <div className={style.wrapper}>\n <EmptySearchResult\n firstMessage={emptyStateFistMessage}\n secondMessage={emptyStateSecondMessage}\n isBulk\n />\n </div>\n );\n\n /**\n * This function gets called when show/hide link is clicked.\n */\n const handleExpandRow = (index: number) => () => {\n const isRowExpanded = includes(index, expandedRows);\n\n /**\n * If the row is expanded, we are here to hide it. Hence remove\n * it from the state variable. Otherwise add to it.\n */\n const newExpandedRows = isRowExpanded\n ? expandedRows.filter(id => id !== index)\n : expandedRows.concat(index);\n\n setExpandedRows(newExpandedRows);\n\n /**\n * Create a new object to update the expanded state of all rows\n * Use the newExpandedRows array to set the state of all rows that are currently expanded\n */\n const expandedState: ExpandState = {};\n newExpandedRows.forEach(id => {\n expandedState[id] = true;\n });\n\n setExpandState(expandedState);\n };\n\n const headerRow = columns.map((column, cIndex) => {\n const {title} = column;\n return (\n <th\n className={\n cIndex === 0\n ? classnames(\n stickyFirstColumn ? style.headerFirstSticky : style.headerFirst,\n style.header\n )\n : style.header\n }\n key={`${title}-${cIndex}`}\n role=\"columnheader\"\n >\n {title}\n </th>\n );\n });\n\n headerRow.push(\n <th\n className={stickyLastColumn ? style.headerLastSticky : style.headerLast}\n key=\"action-header\"\n />\n );\n const headerView = [...headerRow];\n\n const bodyView = rows.map((row, index) => {\n const {fields, isRowExpandible = false} = row;\n const bodyRow = fields.map((field, fIndex) => {\n const cellContent =\n fIndex === 0 ? (\n <div className={style.columFirstWrapper}>\n <div className={style.expandButtonWrapper}>\n {isRowExpandible ? (\n <ButtonLinkIconOnly\n onClick={handleExpandRow(index)}\n data-name={`arrowUp-button-${index}`}\n icon=\"down\"\n className={expandState[index] ? 'bulkArrowUp' : 'bulkArrowDown'}\n aria-label={translate('bulk_import.show_errors')}\n />\n ) : null}\n </div>\n {buildField(field)}\n </div>\n ) : (\n buildField(field)\n );\n return (\n <td\n className={\n fIndex === 0\n ? classnames(\n stickyFirstColumn ? style.columnFirstSticky : style.columnFirst,\n style.col\n )\n : style.col\n }\n style={{width: columnWidth}}\n key={`${field}-${fIndex}`}\n >\n {cellContent}\n </td>\n );\n });\n\n bodyRow.push(\n <td\n className={stickyLastColumn ? style.columnLastSticky : style.columnLast}\n key=\"actionHeader\"\n >\n {lastField ? (\n <div\n className={classnames({\n [style.inspectButton]: get('className', lastField) === 'bulkInspectButton'\n })}\n >\n {buildLastField(lastField)}\n </div>\n ) : null}\n </td>\n );\n const nestedRow = get('nestedRow', row);\n const nestedRowCellule =\n nestedRow && expandedRows.includes(index) ? (\n <tr key={`line-${index}-error`}>\n <td className={style.nestedRowCellule} colSpan={fields.length + 2}>\n {buildNestedRow(nestedRow)}\n </td>\n </tr>\n ) : null;\n\n return nestedRowCellule\n ? [<tr key={`line-${index}`}>{bodyRow}</tr>, nestedRowCellule]\n : [<tr key={`line-${index}`}>{bodyRow}</tr>];\n });\n\n return (\n <div className={style.wrapper}>\n <table\n {...(ariaDescribedby ? {'aria-describedby': ariaDescribedby} : {})}\n className={style.table}\n data-testid=\"expandible-actionable-table\"\n data-name=\"expandible-actionable-table\"\n >\n <thead className={isNestedTable ? style.theadNested : style.thead}>\n <tr>{headerView}</tr>\n </thead>\n <tbody>{bodyView}</tbody>\n </table>\n </div>\n );\n};\n\nActionableExpandableTable.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nActionableExpandableTable.propTypes = propTypes;\n\nexport default ActionableExpandableTable;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,QAA8B,OAA9B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AAEA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,qBAAhD;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,iBAAP,MAA8B,gCAA9B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAyDC,SAAzD,QAAyE,SAAzE;;AAEA,MAAMC,UAAU,GAAIC,KAAD,IAAkB;EACnC,IAAI,UAASA,KAAT,CAAJ,EAAqB,OAAOA,KAAP;EACrB,MAAM;IAACC;EAAD,IAAkBD,KAAxB;;EACA,QAAQC,aAAR;IACE,KAAK,QAAL;MACE,oBACE;QAAK,SAAS,EAAEJ,KAAK,CAACK;MAAtB,gBACE,oBAAC,UAAD,EAAgBF,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AAyC;EACvCC,IAAI,EAAE9E,QAAQ,CAAC+E,iBAAT,CAA2BD,IADM;EAEvClD,SAAS,EAAE5B,QAAQ,CAAC+E,iBAAT,CAA2BnD;AAFC,CAAzC;AAKAZ,yBAAyB,CAACT,SAA1B,2CAAsCA,SAAtC;AAEA,eAAeS,yBAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","classnames","ButtonLinkIcon","StatusItem","BulkProgressBar","Provider","GetTranslateFromContext","BulletPointMenuButton","ButtonLink","ErrorsTable","EmptySearchResult","style","propTypes","buildField","field","componentType","statusItemWrapper","buildLastField","lastField","buildNestedRow","row","ActionableExpandableTable","props","legacyContext","columns","rows","stickyFirstColumn","stickyLastColumn","ariaDescribedby","columnWidth","isNestedTable","emptyStateFistMessage","emptyStateSecondMessage","translate","expandedRows","setExpandedRows","expandState","setExpandState","wrapper","handleExpandRow","index","isRowExpanded","newExpandedRows","filter","id","concat","expandedState","forEach","headerRow","map","column","cIndex","title","headerFirstSticky","headerFirst","header","push","headerLastSticky","headerLast","headerView","bodyView","fields","isRowExpandible","bodyRow","fIndex","cellContent","columFirstWrapper","expandButtonWrapper","columnFirstSticky","columnFirst","col","width","columnLastSticky","columnLast","inspectButton","nestedRow","nestedRowCellule","includes","length","table","theadNested","thead","contextTypes","skin","childContextTypes"],"sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"sourcesContent":["import React, {useState} from 'react';\nimport classnames from 'classnames';\nimport {get, isString, size, includes, isEmpty} from 'lodash/fp';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport StatusItem from '../../atom/status-item';\nimport BulkProgressBar from '../bulk-progress-bar';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport BulletPointMenuButton from '../bullet-point-menu-button';\nimport ButtonLink from '../../atom/button-link';\nimport ErrorsTable from '../errors-table';\nimport EmptySearchResult from '../../atom/empty-search-result';\nimport style from './style.css';\nimport {ExpandState, Field, LastField, NestedRow, Props, propTypes} from './types';\n\nconst buildField = (field: Field) => {\n if (isString(field)) return field;\n const {componentType} = field;\n switch (componentType) {\n case 'status':\n return (\n <div className={style.statusItemWrapper}>\n <StatusItem {...field} />\n </div>\n );\n case 'progress-bar':\n return <BulkProgressBar {...field} />;\n }\n};\n\nconst buildLastField = (lastField: LastField) => {\n const {componentType} = lastField;\n switch (componentType) {\n case 'menu':\n return <BulletPointMenuButton {...lastField} />;\n case 'button-link':\n return <ButtonLink {...lastField} />;\n }\n};\n\nconst buildNestedRow = (row: NestedRow) => {\n const {componentType} = row;\n switch (componentType) {\n case 'errors-table':\n return <ErrorsTable {...row} />;\n case 'expandible-errors-table':\n return <ActionableExpandableTable {...row} />;\n }\n};\n\nconst ActionableExpandableTable = (props: Props, legacyContext: WebContextValues) => {\n const {\n columns,\n rows = [],\n lastField,\n stickyFirstColumn = false,\n stickyLastColumn = false,\n ariaDescribedby,\n columnWidth = `${100 / size(columns)}%`,\n isNestedTable = false,\n emptyStateFistMessage = '',\n emptyStateSecondMessage = ''\n } = props;\n\n const translate = GetTranslateFromContext(legacyContext);\n\n /**\n * State variable to keep track of all the expanded rows\n * By default, nothing expanded. Hence initialized with empty array.\n */\n const [expandedRows, setExpandedRows] = useState<number[]>([]);\n\n /**\n * State variable to keep track which row is currently expanded.\n */\n const [expandState, setExpandState] = useState<ExpandState>({});\n\n if (isEmpty(columns))\n return (\n <div className={style.wrapper}>\n <EmptySearchResult\n firstMessage={emptyStateFistMessage}\n secondMessage={emptyStateSecondMessage}\n isBulk\n />\n </div>\n );\n\n /**\n * This function gets called when show/hide link is clicked.\n */\n const handleExpandRow = (index: number) => () => {\n const isRowExpanded = includes(index, expandedRows);\n\n /**\n * If the row is expanded, we are here to hide it. Hence remove\n * it from the state variable. Otherwise add to it.\n */\n const newExpandedRows = isRowExpanded\n ? expandedRows.filter(id => id !== index)\n : expandedRows.concat(index);\n\n setExpandedRows(newExpandedRows);\n\n /**\n * Create a new object to update the expanded state of all rows\n * Use the newExpandedRows array to set the state of all rows that are currently expanded\n */\n const expandedState: ExpandState = {};\n newExpandedRows.forEach(id => {\n expandedState[id] = true;\n });\n\n setExpandState(expandedState);\n };\n\n const headerRow = columns.map((column, cIndex) => {\n const {title} = column;\n return (\n <th\n className={\n cIndex === 0\n ? classnames(\n stickyFirstColumn ? style.headerFirstSticky : style.headerFirst,\n style.header\n )\n : style.header\n }\n key={`${title}-${cIndex}`}\n role=\"columnheader\"\n >\n {title}\n </th>\n );\n });\n\n headerRow.push(\n <th\n className={stickyLastColumn ? style.headerLastSticky : style.headerLast}\n key=\"action-header\"\n />\n );\n const headerView = [...headerRow];\n\n const bodyView = rows.map((row, index) => {\n const {fields, isRowExpandible = false} = row;\n const bodyRow = fields.map((field, fIndex) => {\n const cellContent =\n fIndex === 0 ? (\n <div className={style.columFirstWrapper}>\n <div className={style.expandButtonWrapper}>\n {isRowExpandible ? (\n <ButtonLinkIcon\n onClick={handleExpandRow(index)}\n data-name={`arrowUp-button-${index}`}\n icon=\"down\"\n className={expandState[index] ? 'bulkArrowUp' : 'bulkArrowDown'}\n aria-label={translate('bulk_import.show_errors')}\n />\n ) : null}\n </div>\n {buildField(field)}\n </div>\n ) : (\n buildField(field)\n );\n return (\n <td\n className={\n fIndex === 0\n ? classnames(\n stickyFirstColumn ? style.columnFirstSticky : style.columnFirst,\n style.col\n )\n : style.col\n }\n style={{width: columnWidth}}\n key={`${field}-${fIndex}`}\n >\n {cellContent}\n </td>\n );\n });\n\n bodyRow.push(\n <td\n className={stickyLastColumn ? style.columnLastSticky : style.columnLast}\n key=\"actionHeader\"\n >\n {lastField ? (\n <div\n className={classnames({\n [style.inspectButton]: get('className', lastField) === 'bulkInspectButton'\n })}\n >\n {buildLastField(lastField)}\n </div>\n ) : null}\n </td>\n );\n const nestedRow = get('nestedRow', row);\n const nestedRowCellule =\n nestedRow && expandedRows.includes(index) ? (\n <tr key={`line-${index}-error`}>\n <td className={style.nestedRowCellule} colSpan={fields.length + 2}>\n {buildNestedRow(nestedRow)}\n </td>\n </tr>\n ) : null;\n\n return nestedRowCellule\n ? [<tr key={`line-${index}`}>{bodyRow}</tr>, nestedRowCellule]\n : [<tr key={`line-${index}`}>{bodyRow}</tr>];\n });\n\n return (\n <div className={style.wrapper}>\n <table\n {...(ariaDescribedby ? {'aria-describedby': ariaDescribedby} : {})}\n className={style.table}\n data-testid=\"expandible-actionable-table\"\n data-name=\"expandible-actionable-table\"\n >\n <thead className={isNestedTable ? style.theadNested : style.thead}>\n <tr>{headerView}</tr>\n </thead>\n <tbody>{bodyView}</tbody>\n </table>\n </div>\n );\n};\n\nActionableExpandableTable.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nActionableExpandableTable.propTypes = propTypes;\n\nexport default ActionableExpandableTable;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,QAA8B,OAA9B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AAEA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,qBAAhD;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,iBAAP,MAA8B,gCAA9B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAyDC,SAAzD,QAAyE,SAAzE;;AAEA,MAAMC,UAAU,GAAIC,KAAD,IAAkB;EACnC,IAAI,UAASA,KAAT,CAAJ,EAAqB,OAAOA,KAAP;EACrB,MAAM;IAACC;EAAD,IAAkBD,KAAxB;;EACA,QAAQC,aAAR;IACE,KAAK,QAAL;MACE,oBACE;QAAK,SAAS,EAAEJ,KAAK,CAACK;MAAtB,gBACE,oBAAC,UAAD,EAAgBF,KAAhB,CADF,CADF;;IA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