@coorpacademy/components 11.32.48-alpha.78 → 11.32.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/button-link/index.d.ts +2 -0
- package/es/atom/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +26 -4
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-link/style.css +14 -0
- package/es/atom/button-link/types.d.ts +4 -0
- package/es/atom/button-link/types.d.ts.map +1 -1
- package/es/atom/button-link/types.js +2 -0
- package/es/atom/button-link/types.js.map +1 -1
- package/es/atom/input-switch/style.css +1 -9
- package/es/molecule/banner/index.d.ts +4 -5
- package/es/molecule/banner/index.d.ts.map +1 -1
- package/es/molecule/banner/index.js +36 -84
- package/es/molecule/banner/index.js.map +1 -1
- package/es/molecule/banner/style.css +3 -12
- package/es/molecule/base-modal/index.d.ts +1 -0
- package/es/molecule/base-modal/index.d.ts.map +1 -1
- package/es/molecule/base-modal/index.js +52 -4
- package/es/molecule/base-modal/index.js.map +1 -1
- package/es/molecule/base-modal/style.css +7 -0
- package/es/molecule/cm-popin/types.d.ts +4 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/index.d.ts +2 -0
- package/es/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/types.d.ts +2 -0
- package/es/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/es/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/es/molecule/skill-picker-modal/index.js +3 -1
- package/es/molecule/skill-picker-modal/index.js.map +1 -1
- package/es/molecule/translation-modal/index.d.ts +85 -0
- package/es/molecule/translation-modal/index.d.ts.map +1 -0
- package/es/molecule/translation-modal/index.js +149 -0
- package/es/molecule/translation-modal/index.js.map +1 -0
- package/es/molecule/translation-modal/style.css +45 -0
- package/es/organism/list-items/index.d.ts +4 -0
- package/es/organism/setup-header/index.d.ts +8 -0
- package/es/organism/wizard-contents/index.d.ts +6 -0
- package/es/template/app-player/loading/index.d.ts +4 -0
- package/es/template/app-player/player/index.d.ts +8 -0
- package/es/template/app-player/player/slides/index.d.ts +4 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +4 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +4 -0
- package/es/template/app-review/index.d.ts +4 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +4 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +4 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-create/index.d.ts +8 -0
- package/es/template/back-office/brand-create/index.d.ts.map +1 -1
- package/es/template/back-office/brand-list/index.d.ts +8 -0
- package/es/template/back-office/brand-list/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +26 -5
- package/es/template/back-office/dashboard-preview/index.d.ts +8 -0
- package/es/template/back-office/layout/index.d.ts +8 -0
- package/es/template/back-office/layout/index.d.ts.map +1 -1
- package/es/template/common/dashboard/index.d.ts +8 -0
- package/es/template/common/search-page/index.d.ts +4 -0
- package/es/template/external-course/index.d.ts +4 -0
- package/es/template/playlist-detail/index.d.ts +0 -1
- package/es/template/playlist-detail/index.d.ts.map +1 -1
- package/es/template/playlist-detail/index.js +3 -6
- package/es/template/playlist-detail/index.js.map +1 -1
- package/es/template/skill-detail/all-courses.css +0 -4
- package/es/template/skill-detail/all-courses.d.ts +0 -1
- package/es/template/skill-detail/all-courses.d.ts.map +1 -1
- package/es/template/skill-detail/all-courses.js +2 -15
- package/es/template/skill-detail/all-courses.js.map +1 -1
- package/es/template/skill-detail/index.d.ts +0 -1
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +3 -6
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/variables/colors.d.ts +0 -3
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +0 -3
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/button-link/index.d.ts +2 -0
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +27 -4
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-link/style.css +14 -0
- package/lib/atom/button-link/types.d.ts +4 -0
- package/lib/atom/button-link/types.d.ts.map +1 -1
- package/lib/atom/button-link/types.js +2 -0
- package/lib/atom/button-link/types.js.map +1 -1
- package/lib/atom/input-switch/style.css +1 -9
- package/lib/molecule/banner/index.d.ts +4 -5
- package/lib/molecule/banner/index.d.ts.map +1 -1
- package/lib/molecule/banner/index.js +37 -94
- package/lib/molecule/banner/index.js.map +1 -1
- package/lib/molecule/banner/style.css +3 -12
- package/lib/molecule/base-modal/index.d.ts +1 -0
- package/lib/molecule/base-modal/index.d.ts.map +1 -1
- package/lib/molecule/base-modal/index.js +50 -3
- package/lib/molecule/base-modal/index.js.map +1 -1
- package/lib/molecule/base-modal/style.css +7 -0
- package/lib/molecule/cm-popin/types.d.ts +4 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/index.d.ts +2 -0
- package/lib/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/types.d.ts +2 -0
- package/lib/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/lib/molecule/skill-picker-modal/index.d.ts.map +1 -1
- package/lib/molecule/skill-picker-modal/index.js +3 -1
- package/lib/molecule/skill-picker-modal/index.js.map +1 -1
- package/lib/molecule/translation-modal/index.d.ts +85 -0
- package/lib/molecule/translation-modal/index.d.ts.map +1 -0
- package/lib/molecule/translation-modal/index.js +168 -0
- package/lib/molecule/translation-modal/index.js.map +1 -0
- package/lib/molecule/translation-modal/style.css +45 -0
- package/lib/organism/list-items/index.d.ts +4 -0
- package/lib/organism/setup-header/index.d.ts +8 -0
- package/lib/organism/wizard-contents/index.d.ts +6 -0
- package/lib/template/app-player/loading/index.d.ts +4 -0
- package/lib/template/app-player/player/index.d.ts +8 -0
- package/lib/template/app-player/player/slides/index.d.ts +4 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +4 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +4 -0
- package/lib/template/app-review/index.d.ts +4 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +4 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +4 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-create/index.d.ts +8 -0
- package/lib/template/back-office/brand-create/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-list/index.d.ts +8 -0
- package/lib/template/back-office/brand-list/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +26 -5
- package/lib/template/back-office/dashboard-preview/index.d.ts +8 -0
- package/lib/template/back-office/layout/index.d.ts +8 -0
- package/lib/template/back-office/layout/index.d.ts.map +1 -1
- package/lib/template/common/dashboard/index.d.ts +8 -0
- package/lib/template/common/search-page/index.d.ts +4 -0
- package/lib/template/external-course/index.d.ts +4 -0
- package/lib/template/playlist-detail/index.d.ts +0 -1
- package/lib/template/playlist-detail/index.d.ts.map +1 -1
- package/lib/template/playlist-detail/index.js +3 -6
- package/lib/template/playlist-detail/index.js.map +1 -1
- package/lib/template/skill-detail/all-courses.css +0 -4
- package/lib/template/skill-detail/all-courses.d.ts +0 -1
- package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
- package/lib/template/skill-detail/all-courses.js +2 -16
- package/lib/template/skill-detail/all-courses.js.map +1 -1
- package/lib/template/skill-detail/index.d.ts +0 -1
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +3 -6
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/variables/colors.d.ts +0 -3
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +0 -3
- package/lib/variables/colors.js.map +1 -1
- 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 -2
- 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
|
@@ -8,6 +8,8 @@ declare const ButtonLink: {
|
|
|
8
8
|
label: import("prop-types").Requireable<string>;
|
|
9
9
|
content: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
10
10
|
'aria-label': import("prop-types").Requireable<string>;
|
|
11
|
+
tooltipText: import("prop-types").Requireable<string>;
|
|
12
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
11
13
|
'data-name': import("prop-types").Requireable<string>;
|
|
12
14
|
'data-testid': import("prop-types").Requireable<string>;
|
|
13
15
|
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAOA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AAoD7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmIzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -7,6 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
import Link from '../link';
|
|
8
8
|
import FaIcon from '../icon';
|
|
9
9
|
import { ICONS } from '../../util/button-icons';
|
|
10
|
+
import ToolTip from '../tooltip';
|
|
10
11
|
import propTypes from './types';
|
|
11
12
|
import style from './style.css';
|
|
12
13
|
|
|
@@ -63,6 +64,8 @@ const ButtonLink = props => {
|
|
|
63
64
|
'data-name': dataName,
|
|
64
65
|
'data-testid': dataTestId = 'button-link',
|
|
65
66
|
'aria-label': ariaLabel,
|
|
67
|
+
tooltipText,
|
|
68
|
+
tooltipPlacement = 'left',
|
|
66
69
|
link,
|
|
67
70
|
onClick = _noop,
|
|
68
71
|
onKeyDown = _noop,
|
|
@@ -70,7 +73,7 @@ const ButtonLink = props => {
|
|
|
70
73
|
customStyle,
|
|
71
74
|
useTitle = true
|
|
72
75
|
} = props;
|
|
73
|
-
const styleButton = classnames(className, style.button, type === 'primary' && style.primary, type === 'secondary' && style.secondary, type === 'tertiary' && style.tertiary, type === 'text' && style.text, type === 'dangerous' && style.dangerous, link && style.link, disabled && style.disabled);
|
|
76
|
+
const styleButton = classnames(className, style.button, !label && style.iconButton, type === 'primary' && style.primary, type === 'secondary' && style.secondary, type === 'tertiary' && style.tertiary, type === 'text' && style.text, type === 'dangerous' && style.dangerous, link && style.link, disabled && style.disabled);
|
|
74
77
|
const [hovered, setHovered] = useState(false);
|
|
75
78
|
const handleOnClick = useCallback(event => onClick(event), [onClick]);
|
|
76
79
|
const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);
|
|
@@ -78,6 +81,22 @@ const ButtonLink = props => {
|
|
|
78
81
|
setHovered(true);
|
|
79
82
|
}, [setHovered]);
|
|
80
83
|
const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
|
|
84
|
+
const TooltipContent = useCallback(() => /*#__PURE__*/React.createElement("span", {
|
|
85
|
+
className: style.tooltipContentWrapper
|
|
86
|
+
}, tooltipText || ariaLabel), [tooltipText, ariaLabel]);
|
|
87
|
+
|
|
88
|
+
const renderToolTip = () => {
|
|
89
|
+
const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;
|
|
90
|
+
if (!closeToolTipInformationTextAriaLabel) return null;
|
|
91
|
+
return /*#__PURE__*/React.createElement(ToolTip, {
|
|
92
|
+
fontSize: 12,
|
|
93
|
+
anchorId: "button-icon",
|
|
94
|
+
toolTipIsVisible: hovered,
|
|
95
|
+
placement: tooltipPlacement,
|
|
96
|
+
TooltipContent: TooltipContent,
|
|
97
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel
|
|
98
|
+
});
|
|
99
|
+
};
|
|
81
100
|
|
|
82
101
|
const _customStyle = useMemo(() => {
|
|
83
102
|
return _extends({}, customStyle, (hoverBackgroundColor || hoverColor) && hovered ? {
|
|
@@ -99,12 +118,15 @@ const ButtonLink = props => {
|
|
|
99
118
|
hoverBackgroundColor: hoverBackgroundColor,
|
|
100
119
|
onMouseEnter: handleMouseOver,
|
|
101
120
|
onMouseLeave: handleMouseLeave
|
|
102
|
-
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor));
|
|
121
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor), renderToolTip());
|
|
103
122
|
}
|
|
104
123
|
|
|
105
124
|
return /*#__PURE__*/React.createElement("button", _extends({}, useTitle && {
|
|
106
125
|
title: ariaLabel || label
|
|
107
|
-
}, {
|
|
126
|
+
}, ariaLabel && !label ? {
|
|
127
|
+
'data-for': 'button-icon',
|
|
128
|
+
'data-tip': hovered
|
|
129
|
+
} : {}, {
|
|
108
130
|
// eslint-disable-next-line react/button-has-type
|
|
109
131
|
type: usage,
|
|
110
132
|
"aria-label": ariaLabel || label,
|
|
@@ -118,7 +140,7 @@ const ButtonLink = props => {
|
|
|
118
140
|
onMouseLeave: handleMouseLeave,
|
|
119
141
|
tabIndex: 0,
|
|
120
142
|
disabled: disabled
|
|
121
|
-
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor));
|
|
143
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor), renderToolTip());
|
|
122
144
|
};
|
|
123
145
|
|
|
124
146
|
ButtonLink.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","useMemo","classnames","Link","FaIcon","ICONS","propTypes","style","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","type","faIcon","position","Icon","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","customStyle","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","link","onClick","onKeyDown","className","useTitle","styleButton","button","primary","secondary","tertiary","text","dangerous","setHovered","handleOnClick","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","_customStyle","title"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={style.buttonContent}>\n <span className={style.label}>{content}</span>\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...{\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? 'transparent'\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n }}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true\n } = props;\n const styleButton = classnames(\n className,\n style.button,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n link && style.link,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n style={customStyle}\n className={styleButton}\n data-name={dataName}\n data-testid={dataTestId}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAoD,OAApD;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,MAAP,MAAmB,SAAnB;AACA,SAAQC,KAAR,QAAoB,yBAApB;AACA,OAAOC,SAAP,MAAmD,SAAnD;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CACvBC,IADuB,EAEvBC,OAFuB,EAGvBC,OAHuB,EAIvBC,oBAJuB,EAKvBC,UALuB,KAMpB;EACH,MAAM;IAACC,IAAD;IAAOC,MAAP;IAAeC;EAAf,IAA2BP,IAAI,IAAI;IAACK,IAAI,EAAE,EAAP;IAAWE,QAAQ,EAAE;EAArB,CAAzC;EACA,MAAMC,IAAI,GAAGH,IAAI,IAAIT,KAAK,CAACS,IAAD,CAA1B;;EA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BA,SAAvB;AAEA,eAAewB,UAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useMemo","classnames","Link","FaIcon","ICONS","ToolTip","propTypes","style","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","type","faIcon","position","Icon","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","customStyle","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","tooltipText","tooltipPlacement","link","onClick","onKeyDown","className","useTitle","styleButton","button","iconButton","primary","secondary","tertiary","text","dangerous","setHovered","handleOnClick","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","TooltipContent","tooltipContentWrapper","renderToolTip","closeToolTipInformationTextAriaLabel","_customStyle","title"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport ToolTip from '../tooltip';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={style.buttonContent}>\n <span className={style.label}>{content}</span>\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...{\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? 'transparent'\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n }}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n tooltipText,\n tooltipPlacement = 'left',\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true\n } = props;\n const styleButton = classnames(\n className,\n style.button,\n !label && style.iconButton,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n link && style.link,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{tooltipText || ariaLabel}</span>,\n [tooltipText, ariaLabel]\n );\n\n const renderToolTip = () => {\n const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;\n if (!closeToolTipInformationTextAriaLabel) return null;\n return (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={hovered}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n />\n );\n };\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n style={customStyle}\n className={styleButton}\n data-name={dataName}\n data-testid={dataTestId}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n {renderToolTip()}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n {...(ariaLabel && !label\n ? {\n 'data-for': 'button-icon',\n 'data-tip': hovered\n }\n : {})}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n {renderToolTip()}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAoD,OAApD;AAEA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,MAAP,MAAmB,SAAnB;AACA,SAAQC,KAAR,QAAoB,yBAApB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,SAAP,MAAmD,SAAnD;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CACvBC,IADuB,EAEvBC,OAFuB,EAGvBC,OAHuB,EAIvBC,oBAJuB,EAKvBC,UALuB,KAMpB;EACH,MAAM;IAACC,IAAD;IAAOC,MAAP;IAAeC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,oBAXxB;MAYE,YAAY,EAAE4C,eAZhB;MAaE,YAAY,EAAEC;IAbhB,IAeGjD,gBAAgB,CAACC,IAAD,EAAOC,OAAO,IAAIS,KAAlB,EAAyBR,OAAzB,EAAkCC,oBAAlC,EAAwDC,UAAxD,CAfnB,EAgBG+C,aAAa,EAhBhB,CADF;EAoBD;;EAED,oBACE,2CACOjB,QAAQ,IAAI;IACfoB,KAAK,EAAE3B,SAAS,IAAIjB;EADL,CADnB,EAIOiB,SAAS,IAAI,CAACjB,KAAd,GACD;IACE,YAAY,aADd;IAEE,YAAYR;EAFd,CADC,GAKD,EATN;IAUE;IACA,IAAI,EAAEqB,KAXR;IAYE,cAAYI,SAAS,IAAIjB,KAZ3B;IAaE,aAAWe,QAbb;IAcE,eAAaC,UAdf;IAeE,KAAK,EAAE2B,YAfT;IAgBE,SAAS,EAAElB,WAhBb;IAiBE,OAAO,EAAES,aAjBX;IAkBE,SAAS,EAAEE,eAlBb;IAmBE,WAAW,EAAEC,eAnBf;IAoBE,YAAY,EAAEC,gBApBhB;IAqBE,QAAQ,EAAE,CArBZ;IAsBE,QAAQ,EAAExB;EAtBZ,IAwBGzB,gBAAgB,CAACC,IAAD,EAAOC,OAAO,IAAIS,KAAlB,EAAyBR,OAAzB,EAAkCC,oBAAlC,EAAwDC,UAAxD,CAxBnB,EAyBG+C,aAAa,EAzBhB,CADF;AA6BD,CAnID;;AAqIA9B,UAAU,CAACxB,SAAX,2CAAuBA,SAAvB;AAEA,eAAewB,UAAf"}
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
user-select: none;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
.iconButton {
|
|
31
|
+
composes: button;
|
|
32
|
+
padding: 0px 14px;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
.disabled {
|
|
31
36
|
opacity: 0.4;
|
|
32
37
|
pointer-events: none;
|
|
@@ -96,3 +101,12 @@
|
|
|
96
101
|
border-radius: 0px;
|
|
97
102
|
height: auto;
|
|
98
103
|
}
|
|
104
|
+
|
|
105
|
+
.tooltipContentWrapper {
|
|
106
|
+
text-align: left;
|
|
107
|
+
width: max-content;
|
|
108
|
+
font-family: Gilroy;
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
line-height: 16px;
|
|
112
|
+
}
|
|
@@ -7,6 +7,8 @@ declare const propTypes: {
|
|
|
7
7
|
label: PropTypes.Requireable<string>;
|
|
8
8
|
content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
9
9
|
'aria-label': PropTypes.Requireable<string>;
|
|
10
|
+
tooltipText: PropTypes.Requireable<string>;
|
|
11
|
+
tooltipPlacement: PropTypes.Requireable<string>;
|
|
10
12
|
'data-name': PropTypes.Requireable<string>;
|
|
11
13
|
'data-testid': PropTypes.Requireable<string>;
|
|
12
14
|
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -43,6 +45,8 @@ export declare type ButtonLinkProps = {
|
|
|
43
45
|
label?: string;
|
|
44
46
|
content?: React.ReactNode;
|
|
45
47
|
'aria-label'?: string;
|
|
48
|
+
tooltipText?: string;
|
|
49
|
+
tooltipPlacement?: 'left' | 'right' | 'top' | 'bottom';
|
|
46
50
|
'data-name'?: string;
|
|
47
51
|
'data-testid'?: string;
|
|
48
52
|
icon?: IconType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAE9C,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/types.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,yBAAyB,CAAC;AAE9C,QAAA,MAAM,S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IACF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,oBAAY,OAAO,GAAG;IAAC,KAAK,EAAE,eAAe,CAAA;CAAC,CAAC;AAE/C,eAAe,SAAS,CAAC"}
|
|
@@ -7,6 +7,8 @@ const propTypes = {
|
|
|
7
7
|
label: PropTypes.string,
|
|
8
8
|
content: PropTypes.node,
|
|
9
9
|
'aria-label': PropTypes.string,
|
|
10
|
+
tooltipText: PropTypes.string,
|
|
11
|
+
tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
|
|
10
12
|
'data-name': PropTypes.string,
|
|
11
13
|
'data-testid': PropTypes.string,
|
|
12
14
|
icon: PropTypes.shape({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","usage","label","string","content","node","icon","shape","position","onClick","func","link","href","download","bool","target","hoverBackgroundColor","hoverColor","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n usage: PropTypes.oneOf(['button', 'submit', 'reset']),\n label: PropTypes.string,\n content: PropTypes.node,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n hoverBackgroundColor: PropTypes.string,\n hoverColor: PropTypes.string,\n disabled: PropTypes.bool,\n className: PropTypes.string,\n customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n customStyle?: Record<string, unknown>;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n usage?: 'button' | 'submit' | 'reset';\n label?: string;\n content?: React.ReactNode;\n 'aria-label'?: string;\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n hoverBackgroundColor?: string;\n hoverColor?: string;\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACI,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,EAAqB,OAArB,CAAhB,CAFS;EAGhBE,KAAK,EAAEN,SAAS,CAACO,MAHD;EAIhBC,OAAO,EAAER,SAAS,CAACS,IAJH;EAKhB,cAAcT,SAAS,CAACO,MALR;
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","usage","label","string","content","node","tooltipText","tooltipPlacement","icon","shape","position","onClick","func","link","href","download","bool","target","hoverBackgroundColor","hoverColor","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n usage: PropTypes.oneOf(['button', 'submit', 'reset']),\n label: PropTypes.string,\n content: PropTypes.node,\n 'aria-label': PropTypes.string,\n tooltipText: PropTypes.string,\n tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom']),\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n hoverBackgroundColor: PropTypes.string,\n hoverColor: PropTypes.string,\n disabled: PropTypes.bool,\n className: PropTypes.string,\n customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n customStyle?: Record<string, unknown>;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n usage?: 'button' | 'submit' | 'reset';\n label?: string;\n content?: React.ReactNode;\n 'aria-label'?: string;\n tooltipText?: string;\n tooltipPlacement?: 'left' | 'right' | 'top' | 'bottom';\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n hoverBackgroundColor?: string;\n hoverColor?: string;\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACI,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,EAAqB,OAArB,CAAhB,CAFS;EAGhBE,KAAK,EAAEN,SAAS,CAACO,MAHD;EAIhBC,OAAO,EAAER,SAAS,CAACS,IAJH;EAKhB,cAAcT,SAAS,CAACO,MALR;EAMhBG,WAAW,EAAEV,SAAS,CAACO,MANP;EAOhBI,gBAAgB,EAAEX,SAAS,CAACI,KAAV,CAAgB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,CAAhB,CAPF;EAQhB,aAAaJ,SAAS,CAACO,MARP;EAShB,eAAeP,SAAS,CAACO,MATT;EAUhBK,IAAI,EAAEZ,SAAS,CAACa,KAAV,CAAgB;IACpBC,QAAQ,EAAEd,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CADU;IAEpBD,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,MAAKH,KAAL,CAAhB;EAFc,CAAhB,CAVU;EAchBc,OAAO,EAAEf,SAAS,CAACgB,IAdH;EAehBC,IAAI,EAAEjB,SAAS,CAACa,KAAV,CAAgB;IACpBK,IAAI,EAAElB,SAAS,CAACO,MADI;IAEpBY,QAAQ,EAAEnB,SAAS,CAACoB,IAFA;IAGpBC,MAAM,EAAErB,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB;EAHY,CAAhB,CAfU;EAoBhBkB,oBAAoB,EAAEtB,SAAS,CAACO,MApBhB;EAqBhBgB,UAAU,EAAEvB,SAAS,CAACO,MArBN;EAsBhBiB,QAAQ,EAAExB,SAAS,CAACoB,IAtBJ;EAuBhBK,SAAS,EAAEzB,SAAS,CAACO,MAvBL;EAwBhBmB,WAAW,EAAE1B,SAAS,CAACa,KAAV,CAAgB,EAAhB;AAxBG,CAAlB;AAoEA,eAAeX,SAAf"}
|
|
@@ -86,10 +86,6 @@
|
|
|
86
86
|
left: 30px;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
.coorpmanager input:checked ~ label::after {
|
|
90
|
-
left: 23px;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
89
|
.checkbox:disabled ~ label {
|
|
94
90
|
background: light;
|
|
95
91
|
pointer-events: none;
|
|
@@ -112,10 +108,6 @@
|
|
|
112
108
|
min-height: 24px;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
|
-
.coorpmanager .title {
|
|
116
|
-
width: fit-content;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
111
|
.description {
|
|
120
112
|
font-family: 'Gilroy';
|
|
121
113
|
font-weight: 500;
|
|
@@ -134,7 +126,6 @@
|
|
|
134
126
|
}
|
|
135
127
|
|
|
136
128
|
.coorpmanager label::after, .coorpmanagerModified label::after {
|
|
137
|
-
top: 1px;
|
|
138
129
|
width: 22px;
|
|
139
130
|
height: 22px;
|
|
140
131
|
}
|
|
@@ -143,6 +134,7 @@
|
|
|
143
134
|
font-family: Gilroy;
|
|
144
135
|
font-weight: bold;
|
|
145
136
|
color: black;
|
|
137
|
+
min-width: 190px;
|
|
146
138
|
}
|
|
147
139
|
|
|
148
140
|
.coorpmanager .checkbox:checked ~ label {
|
|
@@ -5,11 +5,10 @@ declare namespace Banner {
|
|
|
5
5
|
const bannerKey: PropTypes.Requireable<string>;
|
|
6
6
|
const type: PropTypes.Requireable<string>;
|
|
7
7
|
const message: PropTypes.Validator<string>;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}> | null | undefined)[]>;
|
|
8
|
+
const firstCTA: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
+
const firstCTALabel: PropTypes.Requireable<string>;
|
|
10
|
+
const secondCTALabel: PropTypes.Requireable<string>;
|
|
11
|
+
const secondCTA: PropTypes.Requireable<(...args: any[]) => any>;
|
|
13
12
|
const temporary: PropTypes.Requireable<boolean>;
|
|
14
13
|
const onEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AAuBA,iDAmDC"}
|
|
@@ -1,96 +1,34 @@
|
|
|
1
|
-
import _map from "lodash/fp/map";
|
|
2
|
-
import _isEmpty from "lodash/fp/isEmpty";
|
|
3
|
-
import _noop from "lodash/fp/noop";
|
|
4
1
|
import _keys from "lodash/fp/keys";
|
|
5
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
6
3
|
import PropTypes from 'prop-types';
|
|
7
4
|
import classnames from 'classnames';
|
|
8
|
-
import {
|
|
5
|
+
import { NovaSolidInterfaceFeedbackInterfaceAlertDiamond as QuestionIcon, NovaCompositionCoorpacademyValidate as ValidateIcon } from '@coorpacademy/nova-icons';
|
|
9
6
|
import ButtonLink from '../../atom/button-link';
|
|
10
|
-
import Icon from '../../atom/icon';
|
|
11
|
-
import InputSwitch from '../../atom/input-switch';
|
|
12
7
|
import style from './style.css';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const TYPES = {
|
|
19
|
-
success: ['circle-check', COLORS.cm_positive_200],
|
|
20
|
-
error: ['triangle-exclamation', COLORS.cm_negative_200],
|
|
21
|
-
warning: ['circle-exclamation', COLORS.cm_yellow_400],
|
|
22
|
-
info: ['circle-info', COLORS.cm_grey_500]
|
|
8
|
+
const ICONS = {
|
|
9
|
+
success: ValidateIcon,
|
|
10
|
+
error: QuestionIcon,
|
|
11
|
+
warning: QuestionIcon
|
|
23
12
|
};
|
|
24
13
|
const STYLES = {
|
|
25
14
|
success: style.success,
|
|
26
15
|
error: style.error,
|
|
27
|
-
warning: style.warning
|
|
28
|
-
info: style.info
|
|
16
|
+
warning: style.warning
|
|
29
17
|
};
|
|
30
18
|
|
|
31
19
|
const Banner = props => {
|
|
32
20
|
const {
|
|
33
21
|
type,
|
|
34
22
|
message,
|
|
35
|
-
|
|
23
|
+
firstCTA,
|
|
24
|
+
firstCTALabel,
|
|
25
|
+
secondCTALabel,
|
|
26
|
+
secondCTA,
|
|
36
27
|
temporary,
|
|
37
28
|
bannerKey,
|
|
38
29
|
onEnd
|
|
39
30
|
} = props;
|
|
40
|
-
const
|
|
41
|
-
const ButtonSeparator = /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: classnames(style.buttonsBar, STYLES[type])
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const buildButton = ({
|
|
46
|
-
type: buttonType = 'button',
|
|
47
|
-
label,
|
|
48
|
-
action = _noop
|
|
49
|
-
}) => {
|
|
50
|
-
const handleSwitchToggle = useCallback(() => {
|
|
51
|
-
console.log('handleSwitchToggle new test 2');
|
|
52
|
-
const newSwitchValue = !switchValue;
|
|
53
|
-
setSwitchValue(newSwitchValue);
|
|
54
|
-
action(newSwitchValue);
|
|
55
|
-
}, [switchValue, setSwitchValue]);
|
|
56
|
-
|
|
57
|
-
switch (buttonType) {
|
|
58
|
-
case 'switch':
|
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: classnames(style.button, STYLES[type])
|
|
61
|
-
}, /*#__PURE__*/React.createElement(InputSwitch, {
|
|
62
|
-
id: "show-microlearning-switch",
|
|
63
|
-
theme: "coorpmanager",
|
|
64
|
-
title: label,
|
|
65
|
-
value: switchValue,
|
|
66
|
-
onChange: handleSwitchToggle,
|
|
67
|
-
"data-name": `banner-switch-cta`,
|
|
68
|
-
"aria-label": label
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
default:
|
|
72
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className: classnames(style.button, STYLES[type])
|
|
74
|
-
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
75
|
-
"data-name": "banner-button-cta",
|
|
76
|
-
"aria-label": label,
|
|
77
|
-
label: label,
|
|
78
|
-
onClick: action,
|
|
79
|
-
type: "text"
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const buildCta = ctaOptions => {
|
|
85
|
-
return uncappedMap((options, i) => {
|
|
86
|
-
if (_isEmpty(options)) return null;
|
|
87
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
88
|
-
key: i
|
|
89
|
-
}, i > 0 ? ButtonSeparator : null, buildButton(options));
|
|
90
|
-
}, ctaOptions);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const [iconName, iconColor] = TYPES[type];
|
|
31
|
+
const Icon = ICONS[type];
|
|
94
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
33
|
key: bannerKey,
|
|
96
34
|
className: classnames(style.banner, STYLES[type], temporary && style.temporaryBanner),
|
|
@@ -100,22 +38,36 @@ const Banner = props => {
|
|
|
100
38
|
"data-name": `${type}-banner-message`,
|
|
101
39
|
className: style.message
|
|
102
40
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
103
|
-
iconName: iconName,
|
|
104
|
-
iconColor: iconColor,
|
|
105
41
|
className: classnames(style.icon, temporary && style.temporaryIcon)
|
|
106
|
-
}), message),
|
|
42
|
+
}), message), firstCTALabel ? /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: classnames(style.button, STYLES[type])
|
|
44
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
45
|
+
"data-name": "first-banner-cta",
|
|
46
|
+
"aria-label": firstCTALabel,
|
|
47
|
+
label: firstCTALabel,
|
|
48
|
+
onClick: firstCTA,
|
|
49
|
+
type: "text"
|
|
50
|
+
})) : null, firstCTALabel && secondCTALabel ? /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: classnames(style.buttonsBar, STYLES[type])
|
|
52
|
+
}) : null, secondCTALabel ? /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: classnames(style.button, STYLES[type])
|
|
54
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
55
|
+
"data-name": "second-banner-cta",
|
|
56
|
+
onClick: secondCTA,
|
|
57
|
+
"aria-label": secondCTALabel,
|
|
58
|
+
label: secondCTALabel,
|
|
59
|
+
type: "text"
|
|
60
|
+
})) : null);
|
|
107
61
|
};
|
|
108
62
|
|
|
109
|
-
const ctaPropTypes = process.env.NODE_ENV !== "production" ? PropTypes.shape({
|
|
110
|
-
label: PropTypes.string,
|
|
111
|
-
type: PropTypes.oneOf(['button', 'switch']),
|
|
112
|
-
action: PropTypes.func
|
|
113
|
-
}) : {};
|
|
114
63
|
Banner.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
115
64
|
bannerKey: PropTypes.string,
|
|
116
|
-
type: PropTypes.oneOf(_keys(
|
|
65
|
+
type: PropTypes.oneOf(_keys(ICONS)),
|
|
117
66
|
message: PropTypes.string.isRequired,
|
|
118
|
-
|
|
67
|
+
firstCTA: PropTypes.func,
|
|
68
|
+
firstCTALabel: PropTypes.string,
|
|
69
|
+
secondCTALabel: PropTypes.string,
|
|
70
|
+
secondCTA: PropTypes.func,
|
|
119
71
|
temporary: PropTypes.bool,
|
|
120
72
|
onEnd: PropTypes.func
|
|
121
73
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classnames","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","QuestionIcon","NovaCompositionCoorpacademyValidate","ValidateIcon","ButtonLink","style","ICONS","success","error","warning","STYLES","Banner","props","type","message","firstCTA","firstCTALabel","secondCTALabel","secondCTA","temporary","bannerKey","onEnd","Icon","banner","temporaryBanner","icon","temporaryIcon","button","buttonsBar","propTypes","string","oneOf","isRequired","func","bool"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys} from 'lodash/fp';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as QuestionIcon,\n NovaCompositionCoorpacademyValidate as ValidateIcon\n} from '@coorpacademy/nova-icons';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst ICONS = {\n success: ValidateIcon,\n error: QuestionIcon,\n warning: QuestionIcon\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning\n};\n\nconst Banner = props => {\n const {\n type,\n message,\n firstCTA,\n firstCTALabel,\n secondCTALabel,\n secondCTA,\n temporary,\n bannerKey,\n onEnd\n } = props;\n const Icon = ICONS[type];\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon className={classnames(style.icon, temporary && style.temporaryIcon)} />\n {message}\n </div>\n {firstCTALabel ? (\n <div className={classnames(style.button, STYLES[type])}>\n <ButtonLink\n data-name=\"first-banner-cta\"\n aria-label={firstCTALabel}\n label={firstCTALabel}\n onClick={firstCTA}\n type=\"text\"\n />\n </div>\n ) : null}\n {firstCTALabel && secondCTALabel ? (\n <div className={classnames(style.buttonsBar, STYLES[type])} />\n ) : null}\n {secondCTALabel ? (\n <div className={classnames(style.button, STYLES[type])}>\n <ButtonLink\n data-name=\"second-banner-cta\"\n onClick={secondCTA}\n aria-label={secondCTALabel}\n label={secondCTALabel}\n type=\"text\"\n />\n </div>\n ) : null}\n </div>\n );\n};\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(ICONS)),\n message: PropTypes.string.isRequired,\n firstCTA: PropTypes.func,\n firstCTALabel: PropTypes.string,\n secondCTALabel: PropTypes.string,\n secondCTA: PropTypes.func,\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,mCAAmC,IAAIC,YAFzC,QAGO,0BAHP;AAIA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,KAAK,GAAG;EACZC,OAAO,EAAEJ,YADG;EAEZK,KAAK,EAAEP,YAFK;EAGZQ,OAAO,EAAER;AAHG,CAAd;AAMA,MAAMS,MAAM,GAAG;EACbH,OAAO,EAAEF,KAAK,CAACE,OADF;EAEbC,KAAK,EAAEH,KAAK,CAACG,KAFA;EAGbC,OAAO,EAAEJ,KAAK,CAACI;AAHF,CAAf;;AAMA,MAAME,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IACJC,IADI;IAEJC,OAFI;IAGJC,QAHI;IAIJC,aAJI;IAKJC,cALI;IAMJC,SANI;IAOJC,SAPI;IAQJC,SARI;IASJC;EATI,IAUFT,KAVJ;EAWA,MAAMU,IAAI,GAAGhB,KAAK,CAACO,IAAD,CAAlB;EACA,oBACE;IACE,GAAG,EAAEO,SADP;IAEE,SAAS,EAAErB,UAAU,CAACM,KAAK,CAACkB,MAAP,EAAeb,MAAM,CAACG,IAAD,CAArB,EAA6BM,SAAS,IAAId,KAAK,CAACmB,eAAhD,CAFvB;IAGE,cAAc,EAAEH,KAHlB;IAIE,KAAK,EAAEP;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,SAAS,CAACgC,MANT;EAOjBZ,SAAS,EAAEpB,SAAS,CAACmC,IAPJ;EAQjBd,SAAS,EAAErB,SAAS,CAACoC,IARJ;EASjBb,KAAK,EAAEvB,SAAS,CAACmC;AATA,CAAnB;AAYA,eAAetB,MAAf"}
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
@value cm_yellow_100 from colors;
|
|
13
13
|
@value cm_yellow_200 from colors;
|
|
14
14
|
@value cm_yellow_400 from colors;
|
|
15
|
-
@value cm_grey_100 from colors;
|
|
16
|
-
@value cm_grey_700 from colors;
|
|
17
15
|
|
|
18
16
|
@keyframes fadeIn {
|
|
19
17
|
0% {
|
|
@@ -38,8 +36,8 @@
|
|
|
38
36
|
justify-content: flex-start;
|
|
39
37
|
align-items: center;
|
|
40
38
|
gap: 8px;
|
|
41
|
-
padding:
|
|
42
|
-
border-radius:
|
|
39
|
+
padding: 16px 24px;
|
|
40
|
+
border-radius: 5px;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
.banner.warning {
|
|
@@ -57,11 +55,6 @@
|
|
|
57
55
|
color: cm_positive_200;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
.banner.info {
|
|
61
|
-
background-color: cm_grey_100;
|
|
62
|
-
color: cm_grey_700;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
58
|
.temporaryBanner {
|
|
66
59
|
display: inline-flex;
|
|
67
60
|
align-items: center;
|
|
@@ -110,6 +103,7 @@
|
|
|
110
103
|
color: color(cm_positive_100 blackness(+12%));
|
|
111
104
|
}
|
|
112
105
|
|
|
106
|
+
|
|
113
107
|
.buttonsBar {
|
|
114
108
|
width: 2px;
|
|
115
109
|
align-self: stretch;
|
|
@@ -129,9 +123,6 @@
|
|
|
129
123
|
background-color: cm_positive_100;
|
|
130
124
|
}
|
|
131
125
|
|
|
132
|
-
.buttonsBar.info {
|
|
133
|
-
background-color: cm_grey_700;
|
|
134
|
-
}
|
|
135
126
|
|
|
136
127
|
.icon {
|
|
137
128
|
height: 22px;
|
|
@@ -52,6 +52,7 @@ declare namespace BaseModal {
|
|
|
52
52
|
}> | null | undefined>>;
|
|
53
53
|
const onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
54
54
|
const onScroll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
55
|
+
const detectScrollbar: PropTypes.Requireable<boolean>;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/base-modal/index.js"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/base-modal/index.js"],"names":[],"mappings":";AASA,yEA0KC"}
|