@coorpacademy/components 11.32.25 → 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/chip/index.d.ts +1 -0
- package/es/atom/chip/index.d.ts.map +1 -1
- package/es/atom/chip/index.js +8 -1
- package/es/atom/chip/index.js.map +1 -1
- package/es/atom/chip/style.css +10 -3
- 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/molecule/skill-picker-modal/index.d.ts +3 -0
- package/es/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/es/molecule/skill-picker-modal/index.js +45 -13
- package/es/molecule/skill-picker-modal/index.js.map +1 -1
- package/es/molecule/skill-picker-modal/style.css +14 -0
- 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/my-learning/index.d.ts.map +1 -1
- package/es/template/my-learning/index.js +2 -0
- package/es/template/my-learning/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/chip/index.d.ts +1 -0
- package/lib/atom/chip/index.d.ts.map +1 -1
- package/lib/atom/chip/index.js +8 -1
- package/lib/atom/chip/index.js.map +1 -1
- package/lib/atom/chip/style.css +10 -3
- 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/molecule/skill-picker-modal/index.d.ts +3 -0
- package/lib/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/lib/molecule/skill-picker-modal/index.js +47 -15
- package/lib/molecule/skill-picker-modal/index.js.map +1 -1
- package/lib/molecule/skill-picker-modal/style.css +14 -0
- 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/my-learning/index.d.ts.map +1 -1
- package/lib/template/my-learning/index.js +2 -0
- package/lib/template/my-learning/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/locales/bs/global.json +2 -0
- package/locales/cs/global.json +2 -0
- package/locales/de/global.json +2 -0
- package/locales/en/global.json +2 -0
- package/locales/es/global.json +2 -0
- package/locales/et/global.json +2 -0
- package/locales/fi/global.json +2 -0
- package/locales/fr/global.json +2 -0
- package/locales/hr/global.json +2 -0
- package/locales/hu/global.json +2 -0
- package/locales/hy/global.json +2 -0
- package/locales/it/global.json +2 -0
- package/locales/ja/global.json +2 -0
- package/locales/ko/global.json +2 -0
- package/locales/nl/global.json +2 -0
- package/locales/pl/global.json +2 -0
- package/locales/pt/global.json +2 -0
- package/locales/ro/global.json +2 -0
- package/locales/ru/global.json +2 -0
- package/locales/sk/global.json +2 -0
- package/locales/sl/global.json +2 -0
- package/locales/sv/global.json +2 -0
- package/locales/tl/global.json +2 -0
- package/locales/tr/global.json +2 -0
- package/locales/uk/global.json +2 -0
- package/locales/vi/global.json +2 -0
- package/locales/zh/global.json +2 -0
- package/locales/zh_TW/global.json +2 -0
- 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,MAAM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
|
|
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;
|
package/es/atom/chip/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare namespace Chip {
|
|
|
27
27
|
}
|
|
28
28
|
namespace propTypes {
|
|
29
29
|
const text: PropTypes.Requireable<string>;
|
|
30
|
+
const subText: PropTypes.Requireable<string>;
|
|
30
31
|
const selected: PropTypes.Requireable<boolean>;
|
|
31
32
|
const customIcon: PropTypes.Requireable<string>;
|
|
32
33
|
const backgroundColor: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"AAeO,qGAG0E;;AAGjF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"AAeO,qGAG0E;;AAGjF,6DA4DC"}
|
package/es/atom/chip/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export const calculateHoveredSelectedBgColor = (selectedBgColor, luminosityDelta
|
|
|
19
19
|
const Chip = (props, context) => {
|
|
20
20
|
const {
|
|
21
21
|
text,
|
|
22
|
+
subText,
|
|
22
23
|
selected = false,
|
|
23
24
|
customIcon,
|
|
24
25
|
onClick,
|
|
@@ -60,7 +61,12 @@ const Chip = (props, context) => {
|
|
|
60
61
|
style: selected ? {
|
|
61
62
|
color: 'white'
|
|
62
63
|
} : {}
|
|
63
|
-
}, text)
|
|
64
|
+
}, text), subText ? /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: style.subText,
|
|
66
|
+
style: selected ? {
|
|
67
|
+
color: 'white'
|
|
68
|
+
} : {}
|
|
69
|
+
}, subText) : null), /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
64
70
|
className: selected ? style.selectedIconWrapper : style.unselectedIconWrapper,
|
|
65
71
|
icon: customIcon ? `fa-${customIcon}` : defaultIcon,
|
|
66
72
|
fontSize: ICON_SIZE
|
|
@@ -72,6 +78,7 @@ Chip.contextTypes = {
|
|
|
72
78
|
};
|
|
73
79
|
Chip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
74
80
|
text: PropTypes.string,
|
|
81
|
+
subText: PropTypes.string,
|
|
75
82
|
selected: PropTypes.bool,
|
|
76
83
|
customIcon: PropTypes.string,
|
|
77
84
|
backgroundColor: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","PropTypes","classnames","get","convert","FontAwesomeIcon","Provider","COLORS","style","LUMINOSITY_DELTA","cm_primary_blue","DEFAULT_BACKGROUND_COLOR","ICON_SIZE","calculateHoveredSelectedBgColor","selectedBgColor","luminosityDelta","Chip","props","context","text","selected","customIcon","onClick","backgroundColor","skin","skinColor","hoveredSelectedBgColor","isHovered","setIsHovered","handleClick","handleMouseEnter","handleMouseLeave","hoverStyle","defaultIcon","container","unselected","textZone","color","selectedIconWrapper","unselectedIconWrapper","contextTypes","childContextTypes","propTypes","string","bool","func"],"sources":["../../../src/atom/chip/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\n\nimport get from 'lodash/fp/get';\nimport {convert} from 'css-color-function';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport Provider from '../provider';\nimport {COLORS} from '../../variables/colors';\nimport style from './style.css';\n\nconst LUMINOSITY_DELTA = 0.08;\nconst {cm_primary_blue: DEFAULT_BACKGROUND_COLOR} = COLORS;\nconst ICON_SIZE = '12px';\n\nexport const calculateHoveredSelectedBgColor = (\n selectedBgColor,\n luminosityDelta = LUMINOSITY_DELTA\n) => convert(`hsl(from ${selectedBgColor} h s calc(l*(1 - ${luminosityDelta})))`);\n// note: luminosity decrease is relative to the selected color\n\nconst Chip = (props, context) => {\n const {\n text,\n selected = false,\n customIcon,\n onClick,\n backgroundColor = DEFAULT_BACKGROUND_COLOR\n } = props;\n const {skin} = context;\n const skinColor = get('common.primary', skin);\n const selectedBgColor = backgroundColor === 'skin' && skinColor ? skinColor : backgroundColor;\n const hoveredSelectedBgColor = calculateHoveredSelectedBgColor(selectedBgColor);\n\n const [isHovered, setIsHovered] = useState(false);\n\n const handleClick = useMemo(() => onClick, [onClick]);\n\n const handleMouseEnter = useCallback(() => {\n setIsHovered(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHovered(false);\n }, []);\n\n const hoverStyle = isHovered ? {backgroundColor: hoveredSelectedBgColor} : {};\n\n const defaultIcon = selected ? 'fa-check' : 'fa-plus';\n\n return (\n <div\n className={classnames(style.container, !selected && style.unselected)}\n style={{\n ...(selected && selectedBgColor ? {backgroundColor: selectedBgColor} : {}),\n ...(selected && hoverStyle)\n }}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-label={text}\n data-name={text}\n >\n <div className={style.textZone} title={text}>\n <span className={style.text} style={selected ? {color: 'white'} : {}}>\n {text}\n </span>\n </div>\n <FontAwesomeIcon\n className={selected ? style.selectedIconWrapper : style.unselectedIconWrapper}\n icon={customIcon ? `fa-${customIcon}` : defaultIcon}\n fontSize={ICON_SIZE}\n />\n </div>\n );\n};\n\nChip.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nChip.propTypes = {\n text: PropTypes.string,\n selected: PropTypes.bool,\n customIcon: PropTypes.string,\n backgroundColor: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport default Chip;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,EAAkCC,WAAlC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,SAAQC,eAAR,QAA8B,gCAA9B;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,gBAAgB,GAAG,IAAzB;AACA,MAAM;EAACC,eAAe,EAAEC;AAAlB,IAA8CJ,MAApD;AACA,MAAMK,SAAS,GAAG,MAAlB;AAEA,OAAO,MAAMC,+BAA+B,GAAG,CAC7CC,eAD6C,EAE7CC,eAAe,GAAGN,gBAF2B,KAG1CL,OAAO,CAAE,YAAWU,eAAgB,oBAAmBC,eAAgB,KAAhE,CAHL,C,CAIP;;AAEA,MAAMC,IAAI,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC/B,MAAM;IACJC,IADI;IAEJC,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","PropTypes","classnames","get","convert","FontAwesomeIcon","Provider","COLORS","style","LUMINOSITY_DELTA","cm_primary_blue","DEFAULT_BACKGROUND_COLOR","ICON_SIZE","calculateHoveredSelectedBgColor","selectedBgColor","luminosityDelta","Chip","props","context","text","subText","selected","customIcon","onClick","backgroundColor","skin","skinColor","hoveredSelectedBgColor","isHovered","setIsHovered","handleClick","handleMouseEnter","handleMouseLeave","hoverStyle","defaultIcon","container","unselected","textZone","color","selectedIconWrapper","unselectedIconWrapper","contextTypes","childContextTypes","propTypes","string","bool","func"],"sources":["../../../src/atom/chip/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\n\nimport get from 'lodash/fp/get';\nimport {convert} from 'css-color-function';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport Provider from '../provider';\nimport {COLORS} from '../../variables/colors';\nimport style from './style.css';\n\nconst LUMINOSITY_DELTA = 0.08;\nconst {cm_primary_blue: DEFAULT_BACKGROUND_COLOR} = COLORS;\nconst ICON_SIZE = '12px';\n\nexport const calculateHoveredSelectedBgColor = (\n selectedBgColor,\n luminosityDelta = LUMINOSITY_DELTA\n) => convert(`hsl(from ${selectedBgColor} h s calc(l*(1 - ${luminosityDelta})))`);\n// note: luminosity decrease is relative to the selected color\n\nconst Chip = (props, context) => {\n const {\n text,\n subText,\n selected = false,\n customIcon,\n onClick,\n backgroundColor = DEFAULT_BACKGROUND_COLOR\n } = props;\n const {skin} = context;\n const skinColor = get('common.primary', skin);\n const selectedBgColor = backgroundColor === 'skin' && skinColor ? skinColor : backgroundColor;\n const hoveredSelectedBgColor = calculateHoveredSelectedBgColor(selectedBgColor);\n\n const [isHovered, setIsHovered] = useState(false);\n\n const handleClick = useMemo(() => onClick, [onClick]);\n\n const handleMouseEnter = useCallback(() => {\n setIsHovered(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHovered(false);\n }, []);\n\n const hoverStyle = isHovered ? {backgroundColor: hoveredSelectedBgColor} : {};\n\n const defaultIcon = selected ? 'fa-check' : 'fa-plus';\n\n return (\n <div\n className={classnames(style.container, !selected && style.unselected)}\n style={{\n ...(selected && selectedBgColor ? {backgroundColor: selectedBgColor} : {}),\n ...(selected && hoverStyle)\n }}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-label={text}\n data-name={text}\n >\n <div className={style.textZone} title={text}>\n <span className={style.text} style={selected ? {color: 'white'} : {}}>\n {text}\n </span>\n {subText ? (\n <span className={style.subText} style={selected ? {color: 'white'} : {}}>\n {subText}\n </span>\n ) : null}\n </div>\n <FontAwesomeIcon\n className={selected ? style.selectedIconWrapper : style.unselectedIconWrapper}\n icon={customIcon ? `fa-${customIcon}` : defaultIcon}\n fontSize={ICON_SIZE}\n />\n </div>\n );\n};\n\nChip.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nChip.propTypes = {\n text: PropTypes.string,\n subText: PropTypes.string,\n selected: PropTypes.bool,\n customIcon: PropTypes.string,\n backgroundColor: PropTypes.string,\n onClick: PropTypes.func\n};\n\nexport default Chip;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,EAAkCC,WAAlC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,SAAQC,eAAR,QAA8B,gCAA9B;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,gBAAgB,GAAG,IAAzB;AACA,MAAM;EAACC,eAAe,EAAEC;AAAlB,IAA8CJ,MAApD;AACA,MAAMK,SAAS,GAAG,MAAlB;AAEA,OAAO,MAAMC,+BAA+B,GAAG,CAC7CC,eAD6C,EAE7CC,eAAe,GAAGN,gBAF2B,KAG1CL,OAAO,CAAE,YAAWU,eAAgB,oBAAmBC,eAAgB,KAAhE,CAHL,C,CAIP;;AAEA,MAAMC,IAAI,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC/B,MAAM;IACJC,IADI;IAEJC,OAFI;IAGJC,QAAQ,GAAG,KAHP;IAIJC,UAJI;IAKJC,OALI;IAMJC,eAAe,GAAGb;EANd,IAOFM,KAPJ;EAQA,MAAM;IAACQ;EAAD,IAASP,OAAf;EACA,MAAMQ,SAAS,GAAGvB,GAAG,CAAC,gBAAD,EAAmBsB,IAAnB,CAArB;EACA,MAAMX,eAAe,GAAGU,eAAe,KAAK,MAApB,IAA8BE,SAA9B,GAA0CA,SAA1C,GAAsDF,eAA9E;EACA,MAAMG,sBAAsB,GAAGd,+BAA+B,CAACC,eAAD,CAA9D;EAEA,MAAM,CAACc,SAAD,EAAYC,YAAZ,IAA4B9B,QAAQ,CAAC,KAAD,CAA1C;EAEA,M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,EAAEC,QAAQ,GAAGb,KAAK,CAAC+B,mBAAT,GAA+B/B,KAAK,CAACgC,qBAD1D;IAEE,IAAI,EAAElB,UAAU,GAAI,MAAKA,UAAW,EAApB,GAAwBY,WAF1C;IAGE,QAAQ,EAAEtB;EAHZ,EAtBF,CADF;AA8BD,CA5DD;;AA8DAI,IAAI,CAACyB,YAAL,GAAoB;EAClBhB,IAAI,EAAEnB,QAAQ,CAACoC,iBAAT,CAA2BjB;AADf,CAApB;AAIAT,IAAI,CAAC2B,SAAL,2CAAiB;EACfxB,IAAI,EAAElB,SAAS,CAAC2C,MADD;EAEfxB,OAAO,EAAEnB,SAAS,CAAC2C,MAFJ;EAGfvB,QAAQ,EAAEpB,SAAS,CAAC4C,IAHL;EAIfvB,UAAU,EAAErB,SAAS,CAAC2C,MAJP;EAKfpB,eAAe,EAAEvB,SAAS,CAAC2C,MALZ;EAMfrB,OAAO,EAAEtB,SAAS,CAAC6C;AANJ,CAAjB;AASA,eAAe9B,IAAf"}
|
package/es/atom/chip/style.css
CHANGED
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
.container {
|
|
10
10
|
width: fit-content;
|
|
11
|
-
height: 44px;
|
|
12
11
|
border-radius: 10px;
|
|
13
|
-
padding:
|
|
12
|
+
padding: 12px 16px;
|
|
14
13
|
position: relative;
|
|
15
14
|
display: flex;
|
|
16
15
|
align-items: center;
|
|
@@ -38,17 +37,25 @@
|
|
|
38
37
|
width: calc(100% - 32px);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
.text
|
|
40
|
+
.text,
|
|
41
|
+
.subText {
|
|
42
42
|
font-family: 'Gilroy';
|
|
43
43
|
font-style: normal;
|
|
44
44
|
font-weight: 600;
|
|
45
45
|
font-size: 14px;
|
|
46
|
+
line-height: 20px;
|
|
46
47
|
text-overflow: ellipsis;
|
|
47
48
|
white-space: nowrap;
|
|
48
49
|
overflow: hidden;
|
|
49
50
|
display: block;
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
.subText {
|
|
54
|
+
font-weight: 500;
|
|
55
|
+
font-size: 10px;
|
|
56
|
+
line-height: 12px;
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
.icon{
|
|
53
60
|
position: absolute;
|
|
54
61
|
right: 18px;
|
|
@@ -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,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Q,EAAEhC,QAPZ;IAQE,gBAAgB,EAAEC,gBARpB;IASE,iBAAiB,EAAE,CAAClB,KAAK,CAACkD,aAAD;EAT3B,EANF,CAXF;AA8BD,CAxGD;;AA0GAR,OAAO,CAACjB,SAAR,2CAAoB;EAClBkB,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,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AL,CAAhB,CAZQ;EAalBf,QAAQ,EAAErB,SAAS,CAACoC,KAAV,CAAgB/B,IAAI,CAACO,SAAD,CAApB,CAbQ;EAclB;EACA;EACA;EACA;EACAK,QAAQ,EAAEjB,SAAS,CAACgC,MAlBF;EAmBlBhB,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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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',
|