@coorpacademy/components 11.32.0 → 11.32.1-alpha.19
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 +1 -0
- package/es/atom/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +6 -5
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-link/types.d.ts +3 -0
- package/es/atom/button-link/types.d.ts.map +1 -1
- package/es/atom/button-link/types.js +1 -0
- package/es/atom/button-link/types.js.map +1 -1
- package/es/atom/chip/index.d.ts +1 -1
- package/es/atom/chip/index.d.ts.map +1 -1
- package/es/atom/chip/index.js +2 -6
- package/es/atom/chip/index.js.map +1 -1
- package/es/atom/chip/style.css +2 -2
- package/es/atom/icon/index.d.ts +1 -1
- package/es/atom/icon/index.d.ts.map +1 -1
- package/es/atom/icon/index.js +6 -4
- package/es/atom/icon/index.js.map +1 -1
- package/es/molecule/base-modal/index.d.ts +33 -0
- package/es/molecule/base-modal/index.d.ts.map +1 -0
- package/es/molecule/base-modal/index.js +142 -0
- package/es/molecule/base-modal/index.js.map +1 -0
- package/es/molecule/base-modal/style.css +125 -0
- package/es/molecule/cm-popin/types.d.ts +2 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/index.d.ts +1 -0
- package/es/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/types.d.ts +1 -0
- package/es/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.d.ts +2 -0
- package/es/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/es/molecule/learner-skill-card/index.js +9 -4
- package/es/molecule/learner-skill-card/index.js.map +1 -1
- package/es/molecule/learning-profile-radar-chart/index.d.ts +1 -1
- package/es/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
- package/es/molecule/learning-profile-radar-chart/index.js +20 -11
- package/es/molecule/learning-profile-radar-chart/index.js.map +1 -1
- package/es/molecule/learning-profile-radar-chart/types.d.ts +7 -1
- package/es/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
- package/es/molecule/learning-profile-radar-chart/types.js.map +1 -1
- package/es/molecule/skill-picker-modal/index.d.ts +23 -0
- package/es/molecule/skill-picker-modal/index.d.ts.map +1 -0
- package/es/molecule/skill-picker-modal/index.js +138 -0
- package/es/molecule/skill-picker-modal/index.js.map +1 -0
- package/es/molecule/skill-picker-modal/style.css +28 -0
- package/es/molecule/skills-chart-side-information-item/index.d.ts +1 -1
- package/es/molecule/skills-chart-side-information-item/index.js +1 -1
- package/es/molecule/skills-chart-side-information-item/index.js.map +1 -1
- package/es/molecule/skills-chart-side-information-panel/index.d.ts +1 -1
- package/es/molecule/skills-chart-side-information-panel/style.css +18 -9
- package/es/organism/list-items/index.d.ts +2 -0
- package/es/organism/setup-header/index.d.ts +4 -0
- package/es/organism/wizard-contents/index.d.ts +3 -0
- package/es/template/app-player/loading/index.d.ts +2 -0
- package/es/template/app-player/player/index.d.ts +4 -0
- package/es/template/app-player/player/slides/index.d.ts +2 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +2 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +2 -0
- package/es/template/app-review/index.d.ts +2 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +2 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +2 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-create/index.d.ts +4 -0
- package/es/template/back-office/brand-create/index.d.ts.map +1 -1
- package/es/template/back-office/brand-list/index.d.ts +4 -0
- package/es/template/back-office/brand-list/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +11 -0
- package/es/template/back-office/dashboard-preview/index.d.ts +4 -0
- package/es/template/back-office/layout/index.d.ts +4 -0
- package/es/template/back-office/layout/index.d.ts.map +1 -1
- package/es/template/common/dashboard/index.d.ts +4 -0
- package/es/template/common/search-page/index.d.ts +2 -0
- package/es/template/external-course/index.d.ts +2 -0
- package/es/template/my-learning/index.d.ts +34 -0
- package/es/template/my-learning/index.d.ts.map +1 -0
- package/es/template/my-learning/index.js +352 -0
- package/es/template/my-learning/index.js.map +1 -0
- package/es/template/my-learning/style.css +196 -0
- package/lib/atom/button-link/index.d.ts +1 -0
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +6 -5
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-link/types.d.ts +3 -0
- package/lib/atom/button-link/types.d.ts.map +1 -1
- package/lib/atom/button-link/types.js +1 -0
- package/lib/atom/button-link/types.js.map +1 -1
- package/lib/atom/chip/index.d.ts +1 -1
- package/lib/atom/chip/index.d.ts.map +1 -1
- package/lib/atom/chip/index.js +3 -6
- package/lib/atom/chip/index.js.map +1 -1
- package/lib/atom/chip/style.css +2 -2
- package/lib/atom/icon/index.d.ts +1 -1
- package/lib/atom/icon/index.d.ts.map +1 -1
- package/lib/atom/icon/index.js +6 -4
- package/lib/atom/icon/index.js.map +1 -1
- package/lib/molecule/base-modal/index.d.ts +33 -0
- package/lib/molecule/base-modal/index.d.ts.map +1 -0
- package/lib/molecule/base-modal/index.js +158 -0
- package/lib/molecule/base-modal/index.js.map +1 -0
- package/lib/molecule/base-modal/style.css +125 -0
- package/lib/molecule/cm-popin/types.d.ts +2 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/index.d.ts +1 -0
- package/lib/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/types.d.ts +1 -0
- package/lib/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.d.ts +2 -0
- package/lib/molecule/learner-skill-card/index.d.ts.map +1 -1
- package/lib/molecule/learner-skill-card/index.js +9 -4
- package/lib/molecule/learner-skill-card/index.js.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/index.d.ts +1 -1
- package/lib/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/index.js +20 -11
- package/lib/molecule/learning-profile-radar-chart/index.js.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/types.d.ts +7 -1
- package/lib/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
- package/lib/molecule/learning-profile-radar-chart/types.js.map +1 -1
- package/lib/molecule/skill-picker-modal/index.d.ts +23 -0
- package/lib/molecule/skill-picker-modal/index.d.ts.map +1 -0
- package/lib/molecule/skill-picker-modal/index.js +156 -0
- package/lib/molecule/skill-picker-modal/index.js.map +1 -0
- package/lib/molecule/skill-picker-modal/style.css +28 -0
- package/lib/molecule/skills-chart-side-information-item/index.d.ts +1 -1
- package/lib/molecule/skills-chart-side-information-item/index.js +1 -1
- package/lib/molecule/skills-chart-side-information-item/index.js.map +1 -1
- package/lib/molecule/skills-chart-side-information-panel/index.d.ts +1 -1
- package/lib/molecule/skills-chart-side-information-panel/style.css +18 -9
- package/lib/organism/list-items/index.d.ts +2 -0
- package/lib/organism/setup-header/index.d.ts +4 -0
- package/lib/organism/wizard-contents/index.d.ts +3 -0
- package/lib/template/app-player/loading/index.d.ts +2 -0
- package/lib/template/app-player/player/index.d.ts +4 -0
- package/lib/template/app-player/player/slides/index.d.ts +2 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +2 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +2 -0
- package/lib/template/app-review/index.d.ts +2 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +2 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +2 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-create/index.d.ts +4 -0
- package/lib/template/back-office/brand-create/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-list/index.d.ts +4 -0
- package/lib/template/back-office/brand-list/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +11 -0
- package/lib/template/back-office/dashboard-preview/index.d.ts +4 -0
- package/lib/template/back-office/layout/index.d.ts +4 -0
- package/lib/template/back-office/layout/index.d.ts.map +1 -1
- package/lib/template/common/dashboard/index.d.ts +4 -0
- package/lib/template/common/search-page/index.d.ts +2 -0
- package/lib/template/external-course/index.d.ts +2 -0
- package/lib/template/my-learning/index.d.ts +34 -0
- package/lib/template/my-learning/index.d.ts.map +1 -0
- package/lib/template/my-learning/index.js +373 -0
- package/lib/template/my-learning/index.js.map +1 -0
- package/lib/template/my-learning/style.css +196 -0
- package/locales/en/global.json +25 -0
- package/locales/sl/global.json +1 -1
- package/package.json +3 -3
|
@@ -5,6 +5,7 @@ declare const ButtonLink: {
|
|
|
5
5
|
propTypes: {
|
|
6
6
|
type: import("prop-types").Requireable<string>;
|
|
7
7
|
label: import("prop-types").Requireable<string>;
|
|
8
|
+
content: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
8
9
|
'aria-label': import("prop-types").Requireable<string>;
|
|
9
10
|
'data-name': import("prop-types").Requireable<string>;
|
|
10
11
|
'data-testid': import("prop-types").Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AAwC7D,QAAA,MAAM,UAAU;YAAW,eAAe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AAwC7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;CAsEzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { ICONS } from '../../util/button-icons';
|
|
|
10
10
|
import propTypes from './types';
|
|
11
11
|
import style from './style.css';
|
|
12
12
|
|
|
13
|
-
const getButtonContent = (icon,
|
|
13
|
+
const getButtonContent = (icon, content) => {
|
|
14
14
|
const {
|
|
15
15
|
type,
|
|
16
16
|
faIcon,
|
|
@@ -26,7 +26,7 @@ const getButtonContent = (icon, label) => {
|
|
|
26
26
|
className: style.buttonContent
|
|
27
27
|
}, /*#__PURE__*/React.createElement("span", {
|
|
28
28
|
className: style.label
|
|
29
|
-
},
|
|
29
|
+
}, content));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const iconComponent = faIcon ? /*#__PURE__*/React.createElement(FaIcon, {
|
|
@@ -43,15 +43,16 @@ const getButtonContent = (icon, label) => {
|
|
|
43
43
|
});
|
|
44
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
45
|
className: style.buttonContent
|
|
46
|
-
}, position === 'left' ? iconComponent : null,
|
|
46
|
+
}, position === 'left' ? iconComponent : null, content ? /*#__PURE__*/React.createElement("span", {
|
|
47
47
|
className: style.label
|
|
48
|
-
},
|
|
48
|
+
}, content) : null, position === 'right' ? iconComponent : null);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const ButtonLink = props => {
|
|
52
52
|
const {
|
|
53
53
|
type,
|
|
54
54
|
label,
|
|
55
|
+
content,
|
|
55
56
|
disabled,
|
|
56
57
|
icon,
|
|
57
58
|
'data-name': dataName,
|
|
@@ -64,7 +65,7 @@ const ButtonLink = props => {
|
|
|
64
65
|
customStyle,
|
|
65
66
|
useTitle = true
|
|
66
67
|
} = props;
|
|
67
|
-
const contentView = getButtonContent(icon, label);
|
|
68
|
+
const contentView = getButtonContent(icon, content ?? label);
|
|
68
69
|
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);
|
|
69
70
|
const handleOnClick = useCallback(() => onClick(), [onClick]);
|
|
70
71
|
const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","classnames","Link","FaIcon","ICONS","propTypes","style","getButtonContent","icon","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","classnames","Link","FaIcon","ICONS","propTypes","style","getButtonContent","icon","content","type","faIcon","position","Icon","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","ButtonLink","props","disabled","dataName","dataTestId","ariaLabel","link","onClick","onKeyDown","className","customStyle","useTitle","contentView","styleButton","button","primary","secondary","tertiary","text","dangerous","handleOnClick","handleOnKeyDown","event","title"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback} 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 = (icon?: IconType, content?: string | React.ReactNode) => {\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: faIcon.color,\n backgroundColor: faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n }\n }}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n label,\n content,\n disabled,\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 contentView = getButtonContent(icon, content ?? label);\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 handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n style={customStyle}\n className={styleButton}\n data-name={dataName}\n data-testid={dataTestId}\n aria-label={ariaLabel || label}\n >\n {contentView}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n type=\"button\"\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n tabIndex={0}\n >\n {contentView}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,QAAiC,OAAjC;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,CAACC,IAAD,EAAkBC,OAAlB,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,cAAYe,SAAS,IAAIf,KAL3B;IAME,aAAWa,QANb;IAOE,eAAaC,UAPf;IAQE,KAAK,EAAEM,WART;IASE,SAAS,EAAEG,WATb;IAUE,OAAO,EAAEO,aAVX;IAWE,SAAS,EAAEC,eAXb;IAYE,QAAQ,EAAE;EAZZ,IAcGT,WAdH,CADF;AAkBD,CAtED;;AAwEAZ,UAAU,CAACpB,SAAX,2CAAuBA,SAAvB;AAEA,eAAeoB,UAAf"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import { ICONS } from '../../util/button-icons';
|
|
3
4
|
declare const propTypes: {
|
|
4
5
|
type: PropTypes.Requireable<string>;
|
|
5
6
|
label: PropTypes.Requireable<string>;
|
|
7
|
+
content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
6
8
|
'aria-label': PropTypes.Requireable<string>;
|
|
7
9
|
'data-name': PropTypes.Requireable<string>;
|
|
8
10
|
'data-testid': PropTypes.Requireable<string>;
|
|
@@ -34,6 +36,7 @@ export declare type IconType = {
|
|
|
34
36
|
export declare type ButtonLinkProps = {
|
|
35
37
|
type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';
|
|
36
38
|
label?: string;
|
|
39
|
+
content?: React.ReactNode;
|
|
37
40
|
'aria-label'?: string;
|
|
38
41
|
'data-name'?: string;
|
|
39
42
|
'data-testid'?: string;
|
|
@@ -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,C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CAAC;CACpB,CAAC;AAEF,oBAAY,OAAO,GAAG;IAAC,KAAK,EAAE,eAAe,CAAA;CAAC,CAAC;AAE/C,eAAe,SAAS,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { ICONS } from '../../util/button-icons';
|
|
|
4
4
|
const propTypes = {
|
|
5
5
|
type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),
|
|
6
6
|
label: PropTypes.string,
|
|
7
|
+
content: PropTypes.node,
|
|
7
8
|
'aria-label': PropTypes.string,
|
|
8
9
|
'data-name': PropTypes.string,
|
|
9
10
|
'data-testid': PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","label","string","icon","shape","position","onClick","func","link","href","download","bool","target","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n label: PropTypes.string,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n disabled: PropTypes.bool,\n className: PropTypes.string,\n customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n label?: string;\n 'aria-label'?: string;\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACM,MAFD;
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ICONS","propTypes","type","oneOf","label","string","content","node","icon","shape","position","onClick","func","link","href","download","bool","target","disabled","className","customStyle"],"sources":["../../../src/atom/button-link/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {keys} from 'lodash/fp';\nimport {ICONS} from '../../util/button-icons';\n\nconst propTypes = {\n type: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n label: PropTypes.string,\n content: PropTypes.node,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n 'data-testid': PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.oneOf(['right', 'left']),\n type: PropTypes.oneOf(keys(ICONS))\n }),\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n disabled: PropTypes.bool,\n className: PropTypes.string,\n customStyle: PropTypes.shape({})\n};\n\nexport type FaIcontype = {\n name: string;\n color?: string;\n backgroundColor?: string;\n size?: number;\n};\n\nexport type IconType = {\n position: 'right' | 'left';\n type?: keyof typeof ICONS;\n faIcon?: FaIcontype;\n};\nexport type ButtonLinkProps = {\n type?: 'primary' | 'secondary' | 'tertiary' | 'text' | 'dangerous';\n label?: string;\n content?: React.ReactNode;\n 'aria-label'?: string;\n 'data-name'?: string;\n 'data-testid'?: string;\n icon?: IconType;\n onClick?: () => void;\n onKeyDown?: () => void;\n link?: {\n href?: string;\n download?: boolean;\n target?: '_self' | '_blank' | '_parent' | '_top';\n };\n disabled?: boolean;\n className?: string;\n customStyle?: Record<string, unknown>;\n useTitle?: boolean;\n};\n\nexport type Fixture = {props: ButtonLinkProps};\n\nexport default propTypes;\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,YAAtB;AAEA,SAAQC,KAAR,QAAoB,yBAApB;AAEA,MAAMC,SAAS,GAAG;EAChBC,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,MAArC,EAA6C,WAA7C,CAAhB,CADU;EAEhBC,KAAK,EAAEL,SAAS,CAACM,MAFD;EAGhBC,OAAO,EAAEP,SAAS,CAACQ,IAHH;EAIhB,cAAcR,SAAS,CAACM,MAJR;EAKhB,aAAaN,SAAS,CAACM,MALP;EAMhB,eAAeN,SAAS,CAACM,MANT;EAOhBG,IAAI,EAAET,SAAS,CAACU,KAAV,CAAgB;IACpBC,QAAQ,EAAEX,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CADU;IAEpBD,IAAI,EAAEH,SAAS,CAACI,KAAV,CAAgB,MAAKH,KAAL,CAAhB;EAFc,CAAhB,CAPU;EAWhBW,OAAO,EAAEZ,SAAS,CAACa,IAXH;EAYhBC,IAAI,EAAEd,SAAS,CAACU,KAAV,CAAgB;IACpBK,IAAI,EAAEf,SAAS,CAACM,MADI;IAEpBU,QAAQ,EAAEhB,SAAS,CAACiB,IAFA;IAGpBC,MAAM,EAAElB,SAAS,CAACI,KAAV,CAAgB,CAAC,OAAD,EAAU,QAAV,EAAoB,SAApB,EAA+B,MAA/B,CAAhB;EAHY,CAAhB,CAZU;EAiBhBe,QAAQ,EAAEnB,SAAS,CAACiB,IAjBJ;EAkBhBG,SAAS,EAAEpB,SAAS,CAACM,MAlBL;EAmBhBe,WAAW,EAAErB,SAAS,CAACU,KAAV,CAAgB,EAAhB;AAnBG,CAAlB;AAyDA,eAAeR,SAAf"}
|
package/es/atom/chip/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function calculateHoveredSelectedBgColor(selectedBgColor: any, luminosityDelta?: number):
|
|
1
|
+
export function calculateHoveredSelectedBgColor(selectedBgColor: any, luminosityDelta?: number): any;
|
|
2
2
|
export default Chip;
|
|
3
3
|
declare function Chip(props: any, context: any): JSX.Element;
|
|
4
4
|
declare namespace Chip {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"AAeO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"AAeO,qGAG0E;;AAGjF,6DAsDC"}
|
package/es/atom/chip/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import React, { useMemo, useState, useCallback } from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import get from 'lodash/fp/get';
|
|
7
|
-
import
|
|
7
|
+
import { convert } from 'css-color-function';
|
|
8
8
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
9
9
|
import Provider from '../provider';
|
|
10
10
|
import { COLORS } from '../../variables/colors';
|
|
@@ -14,11 +14,7 @@ const {
|
|
|
14
14
|
cm_primary_blue: DEFAULT_BACKGROUND_COLOR
|
|
15
15
|
} = COLORS;
|
|
16
16
|
const ICON_SIZE = '12px';
|
|
17
|
-
export const calculateHoveredSelectedBgColor = (selectedBgColor, luminosityDelta = LUMINOSITY_DELTA) => {
|
|
18
|
-
return new Color(selectedBgColor).to('hsl').set({
|
|
19
|
-
l: l => l * (1 - luminosityDelta)
|
|
20
|
-
}).toString();
|
|
21
|
-
};
|
|
17
|
+
export const calculateHoveredSelectedBgColor = (selectedBgColor, luminosityDelta = LUMINOSITY_DELTA) => convert(`hsl(from ${selectedBgColor} h s calc(l*(1 - ${luminosityDelta})))`); // note: luminosity decrease is relative to the selected color
|
|
22
18
|
|
|
23
19
|
const Chip = (props, context) => {
|
|
24
20
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","PropTypes","classnames","get","
|
|
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,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,EAAEpB,SAAS,CAAC0C,MAHP;EAIfpB,eAAe,EAAEtB,SAAS,CAAC0C,MAJZ;EAKfrB,OAAO,EAAErB,SAAS,CAAC4C;AALJ,CAAjB;AAQA,eAAe7B,IAAf"}
|
package/es/atom/chip/style.css
CHANGED
package/es/atom/icon/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DEFAULT_ICON_COLOR: "hsl(0, 0%, 32%)";
|
|
2
|
-
export function getForegroundColor(backgroundColor: any):
|
|
2
|
+
export function getForegroundColor(backgroundColor: any): any;
|
|
3
3
|
export default Icon;
|
|
4
4
|
declare const Icon: React.NamedExoticComponent<object>;
|
|
5
5
|
import React from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAiBA,mDAAoD;AAiB7C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAiBA,mDAAoD;AAiB7C,8DAC8D;;AAGrE,uDAkCG"}
|
package/es/atom/icon/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { library } from '@fortawesome/fontawesome-svg-core';
|
|
|
6
6
|
import toLower from 'lodash/fp/toLower';
|
|
7
7
|
import merge from 'lodash/fp/merge';
|
|
8
8
|
import getOr from 'lodash/fp/getOr';
|
|
9
|
-
import
|
|
9
|
+
import { convert } from 'css-color-function';
|
|
10
10
|
import style from './style.css';
|
|
11
11
|
library.add(fas);
|
|
12
12
|
const DEFAULT_PRESET = 'm';
|
|
@@ -28,13 +28,13 @@ const SIZE_CONFIGS = {
|
|
|
28
28
|
wrapperSize: 48
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
export const getForegroundColor = backgroundColor =>
|
|
32
|
-
|
|
33
|
-
}).toString();
|
|
31
|
+
export const getForegroundColor = backgroundColor => convert(`color(${backgroundColor} lightness(${ICON_LUMINOSITY}%))`); // set lightness to 32%
|
|
32
|
+
|
|
34
33
|
const Icon = /*#__PURE__*/React.memo(function Icon({
|
|
35
34
|
iconName,
|
|
36
35
|
iconColor,
|
|
37
36
|
backgroundColor,
|
|
37
|
+
borderRadius,
|
|
38
38
|
preset = DEFAULT_PRESET,
|
|
39
39
|
size
|
|
40
40
|
}) {
|
|
@@ -43,6 +43,7 @@ const Icon = /*#__PURE__*/React.memo(function Icon({
|
|
|
43
43
|
const wrapperSize = effectiveSize.wrapperSize - ICON_PADDING * 2;
|
|
44
44
|
const iconWrapperStyle = {
|
|
45
45
|
backgroundColor,
|
|
46
|
+
borderRadius,
|
|
46
47
|
width: wrapperSize,
|
|
47
48
|
height: wrapperSize,
|
|
48
49
|
padding: ICON_PADDING
|
|
@@ -60,6 +61,7 @@ Icon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
60
61
|
iconName: PropTypes.string.isRequired,
|
|
61
62
|
iconColor: PropTypes.string,
|
|
62
63
|
backgroundColor: PropTypes.string,
|
|
64
|
+
borderRadius: PropTypes.string,
|
|
63
65
|
preset: PropTypes.oneOf(['s', 'm', 'xl']),
|
|
64
66
|
size: PropTypes.shape({
|
|
65
67
|
faSize: number,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","number","FontAwesomeIcon","fas","library","toLower","merge","getOr","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","number","FontAwesomeIcon","fas","library","toLower","merge","getOr","convert","style","add","DEFAULT_PRESET","ICON_LUMINOSITY","DEFAULT_WRAPPER_SIZE","ICON_PADDING","DEFAULT_ICON_COLOR","SIZE_CONFIGS","s","faSize","wrapperSize","m","xl","getForegroundColor","backgroundColor","Icon","memo","iconName","iconColor","borderRadius","preset","size","effectiveIconColor","effectiveSize","iconWrapperStyle","width","height","padding","iconWrapper","propTypes","string","isRequired","oneOf","shape"],"sources":["../../../src/atom/icon/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes, {number} from 'prop-types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {fas} from '@fortawesome/pro-solid-svg-icons';\nimport {library} from '@fortawesome/fontawesome-svg-core';\nimport toLower from 'lodash/fp/toLower';\nimport merge from 'lodash/fp/merge';\nimport getOr from 'lodash/fp/getOr';\nimport {convert} from 'css-color-function';\nimport style from './style.css';\n\nlibrary.add(fas);\n\nconst DEFAULT_PRESET = 'm';\nconst ICON_LUMINOSITY = 32;\nconst DEFAULT_WRAPPER_SIZE = 40;\nconst ICON_PADDING = 8;\nexport const DEFAULT_ICON_COLOR = 'hsl(0, 0%, 32%)';\n\nconst SIZE_CONFIGS = {\n s: {\n faSize: 12,\n wrapperSize: 32\n },\n m: {\n faSize: 16,\n wrapperSize: DEFAULT_WRAPPER_SIZE\n },\n xl: {\n faSize: 20,\n wrapperSize: 48\n }\n};\n\nexport const getForegroundColor = backgroundColor =>\n convert(`color(${backgroundColor} lightness(${ICON_LUMINOSITY}%))`);\n// set lightness to 32%\n\nconst Icon = React.memo(function Icon({\n iconName,\n iconColor,\n backgroundColor,\n borderRadius,\n preset = DEFAULT_PRESET,\n size\n}) {\n const effectiveIconColor =\n iconColor || (backgroundColor ? getForegroundColor(backgroundColor) : DEFAULT_ICON_COLOR);\n\n const effectiveSize = size\n ? merge(SIZE_CONFIGS[DEFAULT_PRESET], size)\n : getOr(SIZE_CONFIGS[DEFAULT_PRESET], toLower(preset), SIZE_CONFIGS);\n\n const wrapperSize = effectiveSize.wrapperSize - ICON_PADDING * 2;\n\n const iconWrapperStyle = {\n backgroundColor,\n borderRadius,\n width: wrapperSize,\n height: wrapperSize,\n padding: ICON_PADDING\n };\n\n return (\n <div className={style.iconWrapper} style={iconWrapperStyle}>\n <FontAwesomeIcon\n icon={`fa-${iconName}`}\n color={effectiveIconColor}\n fontSize={effectiveSize.faSize}\n />\n </div>\n );\n});\n\nIcon.propTypes = {\n iconName: PropTypes.string.isRequired,\n iconColor: PropTypes.string,\n backgroundColor: PropTypes.string,\n borderRadius: PropTypes.string,\n preset: PropTypes.oneOf(['s', 'm', 'xl']),\n size: PropTypes.shape({\n faSize: number,\n wrapperSize: PropTypes.number\n })\n};\n\nexport default Icon;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,IAAmBC,MAAnB,QAAgC,YAAhC;AACA,SAAQC,eAAR,QAA8B,gCAA9B;AACA,SAAQC,GAAR,QAAkB,kCAAlB;AACA,SAAQC,OAAR,QAAsB,mCAAtB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEAL,OAAO,CAACM,GAAR,CAAYP,GAAZ;AAEA,MAAMQ,cAAc,GAAG,GAAvB;AACA,MAAMC,eAAe,GAAG,EAAxB;AACA,MAAMC,oBAAoB,GAAG,EAA7B;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,OAAO,MAAMC,kBAAkB,GAAG,iBAA3B;AAEP,MAAMC,YAAY,GAAG;EACnBC,CAAC,EAAE;IACDC,MAAM,EAAE,EADP;IAEDC,WAAW,EAAE;EAFZ,CADgB;EAKnBC,CAAC,EAAE;IACDF,MAAM,EAAE,EADP;IAEDC,WAAW,EAAEN;EAFZ,CALgB;EASnBQ,EAAE,EAAE;IACFH,MAAM,EAAE,EADN;IAEFC,WAAW,EAAE;EAFX;AATe,CAArB;AAeA,OAAO,MAAMG,kBAAkB,GAAGC,eAAe,IAC/Cf,OAAO,CAAE,SAAQe,eAAgB,cAAaX,eAAgB,KAAvD,CADF,C,CAEP;;AAEA,MAAMY,IAAI,gBAAGzB,KAAK,CAAC0B,IAAN,CAAW,SAASD,IAAT,CAAc;EACpCE,QADoC;EAEpCC,SAFoC;EAGpCJ,eAHoC;EAIpCK,YAJoC;EAKpCC,MAAM,GAAGlB,c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AAhB;AANS,CAAjB;AAYA,eAAeuB,IAAf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default BaseModal;
|
|
2
|
+
declare function BaseModal(props: any): JSX.Element | null;
|
|
3
|
+
declare namespace BaseModal {
|
|
4
|
+
namespace propTypes {
|
|
5
|
+
const title: PropTypes.Requireable<string>;
|
|
6
|
+
const headerIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
+
name: PropTypes.Requireable<string>;
|
|
8
|
+
color: PropTypes.Requireable<string>;
|
|
9
|
+
backgroundColor: PropTypes.Requireable<string>;
|
|
10
|
+
}>>;
|
|
11
|
+
const description: PropTypes.Requireable<string>;
|
|
12
|
+
const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
13
|
+
const isOpen: PropTypes.Requireable<boolean>;
|
|
14
|
+
const footer: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
|
|
15
|
+
text: PropTypes.Requireable<string>;
|
|
16
|
+
isError: any;
|
|
17
|
+
cancelButton: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
+
label: PropTypes.Requireable<string>;
|
|
19
|
+
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
+
}>>;
|
|
22
|
+
confirmButton: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
|
+
label: PropTypes.Requireable<string>;
|
|
24
|
+
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
iconName: PropTypes.Requireable<string>;
|
|
26
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
27
|
+
}>>;
|
|
28
|
+
}> | null | undefined>>;
|
|
29
|
+
const onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
import PropTypes from "prop-types";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/base-modal/index.js"],"names":[],"mappings":";AAOA,2DAmGC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import _isEmpty from "lodash/fp/isEmpty";
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import Icon from '../../atom/icon';
|
|
8
|
+
import ButtonLink from '../../atom/button-link';
|
|
9
|
+
import style from './style.css';
|
|
10
|
+
|
|
11
|
+
const BaseModal = props => {
|
|
12
|
+
const {
|
|
13
|
+
title,
|
|
14
|
+
description,
|
|
15
|
+
headerIcon,
|
|
16
|
+
children,
|
|
17
|
+
isOpen,
|
|
18
|
+
footer,
|
|
19
|
+
onClose
|
|
20
|
+
} = props;
|
|
21
|
+
const Footer = useCallback(() => {
|
|
22
|
+
if (_isEmpty(footer)) return null;
|
|
23
|
+
if (typeof footer === 'function') return footer();
|
|
24
|
+
const {
|
|
25
|
+
cancelButton,
|
|
26
|
+
confirmButton,
|
|
27
|
+
text,
|
|
28
|
+
isError
|
|
29
|
+
} = footer;
|
|
30
|
+
const {
|
|
31
|
+
label: cancelLabel,
|
|
32
|
+
onCancel,
|
|
33
|
+
disabled: cancelDisabled
|
|
34
|
+
} = cancelButton || {};
|
|
35
|
+
const {
|
|
36
|
+
label: confirmLabel,
|
|
37
|
+
onConfirm,
|
|
38
|
+
disabled: confirmDisabled,
|
|
39
|
+
iconName
|
|
40
|
+
} = confirmButton || {};
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: style.footer
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: style.footerCTAWrapper
|
|
45
|
+
}, onCancel && cancelLabel ? /*#__PURE__*/React.createElement(ButtonLink, {
|
|
46
|
+
className: style.footerCancelButton,
|
|
47
|
+
type: 'secondary',
|
|
48
|
+
onClick: onCancel,
|
|
49
|
+
label: cancelLabel,
|
|
50
|
+
disabled: cancelDisabled
|
|
51
|
+
}) : null, onConfirm && confirmLabel ? /*#__PURE__*/React.createElement(ButtonLink, _extends({
|
|
52
|
+
className: style.footerConfirmButton,
|
|
53
|
+
type: 'primary',
|
|
54
|
+
onClick: onConfirm,
|
|
55
|
+
label: confirmLabel,
|
|
56
|
+
disabled: confirmDisabled
|
|
57
|
+
}, iconName ? {
|
|
58
|
+
icon: {
|
|
59
|
+
position: 'left',
|
|
60
|
+
faIcon: {
|
|
61
|
+
name: iconName,
|
|
62
|
+
color: '#FFFFFF',
|
|
63
|
+
size: 16
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} : {})) : null), text ? /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: `${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`
|
|
68
|
+
}, text) : null);
|
|
69
|
+
}, [footer]);
|
|
70
|
+
if (!isOpen || !title || !children) return null;
|
|
71
|
+
|
|
72
|
+
function handleOnClose(e) {
|
|
73
|
+
e?.stopPropagation();
|
|
74
|
+
onClose();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: style.modalWrapper
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: style.modal
|
|
81
|
+
}, /*#__PURE__*/React.createElement("header", {
|
|
82
|
+
className: style.header
|
|
83
|
+
}, headerIcon?.name ? /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: style.headerIcon
|
|
85
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
86
|
+
iconName: headerIcon.name,
|
|
87
|
+
iconColor: headerIcon.color,
|
|
88
|
+
backgroundColor: headerIcon.backgroundColor,
|
|
89
|
+
size: {
|
|
90
|
+
faSize: 20,
|
|
91
|
+
wrapperSize: 48
|
|
92
|
+
}
|
|
93
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
className: style.headerContent
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: style.headerTitle
|
|
97
|
+
}, title), description ? /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: style.headerDescription
|
|
99
|
+
}, description) : null), /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: style.headerCloseIcon,
|
|
101
|
+
onClick: handleOnClose
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
103
|
+
iconName: "close",
|
|
104
|
+
backgroundColor: "#F4F4F5",
|
|
105
|
+
size: {
|
|
106
|
+
faSize: 14,
|
|
107
|
+
wrapperSize: 28
|
|
108
|
+
}
|
|
109
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: style.body
|
|
111
|
+
}, children), /*#__PURE__*/React.createElement(Footer, null)));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
BaseModal.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
115
|
+
title: PropTypes.string,
|
|
116
|
+
headerIcon: PropTypes.shape({
|
|
117
|
+
name: PropTypes.string,
|
|
118
|
+
color: PropTypes.string,
|
|
119
|
+
backgroundColor: PropTypes.string
|
|
120
|
+
}),
|
|
121
|
+
description: PropTypes.string,
|
|
122
|
+
children: PropTypes.node,
|
|
123
|
+
isOpen: PropTypes.bool,
|
|
124
|
+
footer: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
125
|
+
text: PropTypes.string,
|
|
126
|
+
isError: PropTypes.boolean,
|
|
127
|
+
cancelButton: PropTypes.shape({
|
|
128
|
+
label: PropTypes.string,
|
|
129
|
+
onCancel: PropTypes.func,
|
|
130
|
+
disabled: PropTypes.bool
|
|
131
|
+
}),
|
|
132
|
+
confirmButton: PropTypes.shape({
|
|
133
|
+
label: PropTypes.string,
|
|
134
|
+
onConfirm: PropTypes.func,
|
|
135
|
+
iconName: PropTypes.string,
|
|
136
|
+
disabled: PropTypes.bool
|
|
137
|
+
})
|
|
138
|
+
})]),
|
|
139
|
+
onClose: PropTypes.func
|
|
140
|
+
} : {};
|
|
141
|
+
export default BaseModal;
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","Icon","ButtonLink","style","BaseModal","props","title","description","headerIcon","children","isOpen","footer","onClose","Footer","cancelButton","confirmButton","text","isError","label","cancelLabel","onCancel","disabled","cancelDisabled","confirmLabel","onConfirm","confirmDisabled","iconName","footerCTAWrapper","className","footerCancelButton","type","onClick","footerConfirmButton","icon","position","faIcon","name","color","size","footerDescription","footerDescriptionError","handleOnClose","e","stopPropagation","modalWrapper","modal","header","backgroundColor","faSize","wrapperSize","headerContent","headerTitle","headerDescription","headerCloseIcon","body","propTypes","string","shape","node","bool","oneOfType","func","boolean"],"sources":["../../../src/molecule/base-modal/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty} from 'lodash/fp';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst BaseModal = props => {\n const {title, description, headerIcon, children, isOpen, footer, onClose} = props;\n\n const Footer = useCallback(() => {\n if (isEmpty(footer)) return null;\n if (typeof footer === 'function') return footer();\n\n const {cancelButton, confirmButton, text, isError} = footer;\n const {label: cancelLabel, onCancel, disabled: cancelDisabled} = cancelButton || {};\n const {\n label: confirmLabel,\n onConfirm,\n disabled: confirmDisabled,\n iconName\n } = confirmButton || {};\n\n return (\n <div className={style.footer}>\n <div className={style.footerCTAWrapper}>\n {onCancel && cancelLabel ? (\n <ButtonLink\n {...{\n className: style.footerCancelButton,\n type: 'secondary',\n onClick: onCancel,\n label: cancelLabel,\n disabled: cancelDisabled\n }}\n />\n ) : null}\n {onConfirm && confirmLabel ? (\n <ButtonLink\n {...{\n className: style.footerConfirmButton,\n type: 'primary',\n onClick: onConfirm,\n label: confirmLabel,\n disabled: confirmDisabled,\n ...(iconName\n ? {\n icon: {\n position: 'left',\n faIcon: {\n name: iconName,\n color: '#FFFFFF',\n size: 16\n }\n }\n }\n : {})\n }}\n />\n ) : null}\n </div>\n {text ? (\n <div\n className={`${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`}\n >\n {text}\n </div>\n ) : null}\n </div>\n );\n }, [footer]);\n\n if (!isOpen || !title || !children) return null;\n\n function handleOnClose(e) {\n e?.stopPropagation();\n onClose();\n }\n\n return (\n <div className={style.modalWrapper}>\n <div className={style.modal}>\n <header className={style.header}>\n {headerIcon?.name ? (\n <div className={style.headerIcon}>\n <Icon\n iconName={headerIcon.name}\n iconColor={headerIcon.color}\n backgroundColor={headerIcon.backgroundColor}\n size={{faSize: 20, wrapperSize: 48}}\n />\n </div>\n ) : null}\n <div className={style.headerContent}>\n <div className={style.headerTitle}>{title}</div>\n {description ? <div className={style.headerDescription}>{description}</div> : null}\n </div>\n <div className={style.headerCloseIcon} onClick={handleOnClose}>\n <Icon iconName=\"close\" backgroundColor=\"#F4F4F5\" size={{faSize: 14, wrapperSize: 28}} />\n </div>\n </header>\n <div className={style.body}>{children}</div>\n <Footer />\n </div>\n </div>\n );\n};\n\nBaseModal.propTypes = {\n title: PropTypes.string,\n headerIcon: PropTypes.shape({\n name: PropTypes.string,\n color: PropTypes.string,\n backgroundColor: PropTypes.string\n }),\n description: PropTypes.string,\n children: PropTypes.node,\n isOpen: PropTypes.bool,\n footer: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n text: PropTypes.string,\n isError: PropTypes.boolean,\n cancelButton: PropTypes.shape({\n label: PropTypes.string,\n onCancel: PropTypes.func,\n disabled: PropTypes.bool\n }),\n confirmButton: PropTypes.shape({\n label: PropTypes.string,\n onConfirm: PropTypes.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