@coorpacademy/components 11.12.1 → 11.12.2
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/drag-and-drop/index.d.ts +2 -0
- package/es/atom/drag-and-drop/index.d.ts.map +1 -1
- package/es/atom/drag-and-drop/index.js +26 -2
- package/es/atom/drag-and-drop/index.js.map +1 -1
- package/es/atom/drag-and-drop/style.css +21 -5
- package/es/atom/image-upload/index.d.ts +5 -1
- package/es/atom/image-upload/index.d.ts.map +1 -1
- package/es/atom/image-upload/index.js +8 -10
- package/es/atom/image-upload/index.js.map +1 -1
- package/es/atom/video-upload/index.d.ts +2 -0
- package/es/molecule/brand-form-group/index.d.ts +4 -0
- package/es/molecule/card/favorite.d.ts +14 -9
- package/es/molecule/card/favorite.d.ts.map +1 -1
- package/es/molecule/card/favorite.js +51 -65
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
- package/es/molecule/drag-and-drop-wrapper/style.css +1 -1
- package/es/molecule/setup-slide/index.d.ts +2 -0
- package/es/molecule/setup-slider/index.d.ts +2 -0
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +2 -0
- package/es/organism/brand-form/index.d.ts +4 -0
- package/es/organism/list-item/index.d.ts +1 -0
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +5 -3
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-items/index.d.ts +4 -1
- package/es/organism/list-items/index.d.ts.map +1 -1
- package/es/organism/list-items/index.js +6 -3
- package/es/organism/list-items/index.js.map +1 -1
- package/es/organism/rewards-form/index.d.ts +2 -0
- package/es/organism/wizard-contents/index.d.ts +6 -0
- package/es/template/back-office/brand-update/index.d.ts +12 -0
- package/es/template/back-office/brand-update/index.js +2 -1
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/cockpit/jw-uploader/index.d.ts +2 -0
- package/es/util/button-icons.d.ts +1 -0
- package/es/util/button-icons.d.ts.map +1 -1
- package/es/util/button-icons.js +3 -2
- package/es/util/button-icons.js.map +1 -1
- package/es/util/proptypes.d.ts.map +1 -1
- package/es/util/proptypes.js +2 -2
- package/es/util/proptypes.js.map +1 -1
- package/lib/atom/drag-and-drop/index.d.ts +2 -0
- package/lib/atom/drag-and-drop/index.d.ts.map +1 -1
- package/lib/atom/drag-and-drop/index.js +26 -2
- package/lib/atom/drag-and-drop/index.js.map +1 -1
- package/lib/atom/drag-and-drop/style.css +21 -5
- package/lib/atom/image-upload/index.d.ts +5 -1
- package/lib/atom/image-upload/index.d.ts.map +1 -1
- package/lib/atom/image-upload/index.js +8 -11
- package/lib/atom/image-upload/index.js.map +1 -1
- package/lib/atom/video-upload/index.d.ts +2 -0
- package/lib/molecule/brand-form-group/index.d.ts +4 -0
- package/lib/molecule/card/favorite.d.ts +14 -9
- package/lib/molecule/card/favorite.d.ts.map +1 -1
- package/lib/molecule/card/favorite.js +55 -65
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
- package/lib/molecule/drag-and-drop-wrapper/style.css +1 -1
- package/lib/molecule/setup-slide/index.d.ts +2 -0
- package/lib/molecule/setup-slider/index.d.ts +2 -0
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +2 -0
- package/lib/organism/brand-form/index.d.ts +4 -0
- package/lib/organism/list-item/index.d.ts +1 -0
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +5 -3
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-items/index.d.ts +4 -1
- package/lib/organism/list-items/index.d.ts.map +1 -1
- package/lib/organism/list-items/index.js +6 -3
- package/lib/organism/list-items/index.js.map +1 -1
- package/lib/organism/rewards-form/index.d.ts +2 -0
- package/lib/organism/wizard-contents/index.d.ts +6 -0
- package/lib/template/back-office/brand-update/index.d.ts +12 -0
- package/lib/template/back-office/brand-update/index.js +2 -1
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/cockpit/jw-uploader/index.d.ts +2 -0
- package/lib/util/button-icons.d.ts +1 -0
- package/lib/util/button-icons.d.ts.map +1 -1
- package/lib/util/button-icons.js +2 -1
- package/lib/util/button-icons.js.map +1 -1
- package/lib/util/proptypes.d.ts.map +1 -1
- package/lib/util/proptypes.js +2 -2
- package/lib/util/proptypes.js.map +1 -1
- package/package.json +2 -2
- package/locales/.mtslconfig.json +0 -1
|
@@ -18,6 +18,8 @@ declare class DragAndDrop extends React.Component<any, any, any> {
|
|
|
18
18
|
error: PropTypes.Requireable<string>;
|
|
19
19
|
buttonAriaLabel: PropTypes.Requireable<string>;
|
|
20
20
|
errorButtonLabel: PropTypes.Requireable<string>;
|
|
21
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
22
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
21
23
|
};
|
|
22
24
|
constructor(props: any);
|
|
23
25
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/drag-and-drop/index.js"],"names":[],"mappings":";AAgBA;IACE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/drag-and-drop/index.js"],"names":[],"mappings":";AAgBA;IACE;;;;;;;;;;;;;;;;;;;;MAoBE;IAEF,wBASC;IANC;;MAEC;IAMH,wBAIC;IAED,uBAIC;IAED,sBAsKC;CACF"}
|
|
@@ -53,7 +53,9 @@ class DragAndDrop extends React.Component {
|
|
|
53
53
|
error = '',
|
|
54
54
|
buttonAriaLabel = '',
|
|
55
55
|
errorButtonLabel = '',
|
|
56
|
-
disabled = false
|
|
56
|
+
disabled = false,
|
|
57
|
+
pdfButtonLabel,
|
|
58
|
+
pdfButtonAriaLabel
|
|
57
59
|
} = this.props;
|
|
58
60
|
const {
|
|
59
61
|
dragging
|
|
@@ -74,6 +76,26 @@ class DragAndDrop extends React.Component {
|
|
|
74
76
|
src: previewContent.src,
|
|
75
77
|
type: "video/*"
|
|
76
78
|
}));
|
|
79
|
+
} else if (previewContent && previewContent.type === 'pdf') {
|
|
80
|
+
previewView = /*#__PURE__*/React.createElement("div", {
|
|
81
|
+
className: style.previewPdf
|
|
82
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
83
|
+
className: style.previewLabelPdf
|
|
84
|
+
}, previewLabel), /*#__PURE__*/React.createElement(Button, {
|
|
85
|
+
type: "secondary",
|
|
86
|
+
link: {
|
|
87
|
+
href: previewContent.src,
|
|
88
|
+
target: '_blank',
|
|
89
|
+
download: false
|
|
90
|
+
},
|
|
91
|
+
label: pdfButtonLabel,
|
|
92
|
+
"aria-label": pdfButtonAriaLabel,
|
|
93
|
+
"data-name": "default-button-pdf",
|
|
94
|
+
icon: {
|
|
95
|
+
position: 'left',
|
|
96
|
+
type: 'pdf'
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
77
99
|
} else if (loading) {
|
|
78
100
|
previewView = /*#__PURE__*/React.createElement("div", {
|
|
79
101
|
className: style.loaderWrapper
|
|
@@ -179,7 +201,9 @@ DragAndDrop.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
179
201
|
onReset: PropTypes.func,
|
|
180
202
|
error: PropTypes.string,
|
|
181
203
|
buttonAriaLabel: PropTypes.string,
|
|
182
|
-
errorButtonLabel: PropTypes.string
|
|
204
|
+
errorButtonLabel: PropTypes.string,
|
|
205
|
+
pdfButtonLabel: PropTypes.string,
|
|
206
|
+
pdfButtonAriaLabel: PropTypes.string
|
|
183
207
|
} : {};
|
|
184
208
|
export default DragAndDrop;
|
|
185
209
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","NovaSolidStatusClose","Close","NovaSolidFilesBasicFileUpload2","FileUploadIcon","NovaSolidFilesBasicFileBlock2","FileUploadBlockedIcon","classnames","Loader","Button","getClassState","style","constantNull","DragAndDrop","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","error","buttonAriaLabel","errorButtonLabel","disabled","previewView","type","preview","src","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","position","button","previewContainer","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","string","shape","bool","func"],"sources":["../../../src/atom/drag-and-drop/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, constant, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as Close,\n NovaSolidFilesBasicFileUpload2 as FileUploadIcon,\n NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport Loader from '../loader';\nimport Button from '../button-link';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string,\n label: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func,\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null,\n error = '',\n buttonAriaLabel = '',\n errorButtonLabel = '',\n disabled = false\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.preview}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={style.preview}>\n <video controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loaderWrapper}>\n <div className={style.loadingCancel}>\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n <div className={style.loader}>\n <Loader theme=\"coorpmanager\" />\n </div>\n <span className={style.loaderText}>Uploading</span>\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src ? (\n <div className={classnames(style.resetUploadWrapper, disabled && style.disabled)}>\n <div className={style.resetSrcLabel}>\n {previewContent.label ? previewContent.label : previewContent.src}\n </div>\n {onReset ? (\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n ) : null}\n </div>\n ) : null;\n\n const buildButton = () => {\n const defaultButtonProps = {\n label: uploadLabel,\n 'aria-label': buttonAriaLabel,\n 'data-name': 'default-button',\n icon: {\n position: 'left',\n type: 'folders'\n }\n };\n if (dragging) {\n return null;\n } else if (error) {\n return <Button {...defaultButtonProps} label={errorButtonLabel} icon={{}} />;\n } else {\n return <Button {...defaultButtonProps} />;\n }\n };\n\n const button = buildButton(dragging, error);\n\n const previewContainer = getClassState(\n style.previewContainer,\n style.modifiedPreviewContainer,\n null,\n modified,\n error\n );\n const inputWrapper = getClassState(\n style.inputWrapper,\n style.modifiedInputWrapper,\n style.errorInputWrapper,\n modified,\n error\n );\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n {!isEmpty(previewContent) || loading ? (\n <div className={classnames(previewContainer, disabled && style.disabled)}>\n {previewView}\n </div>\n ) : (\n <div\n className={classnames(\n dragging ? style.dragging : inputWrapper,\n disabled && style.disabled\n )}\n id={idBox}\n data-name=\"drag-and-drop-box\"\n >\n <div className={style.infosContainer}>\n {error ? (\n <FileUploadBlockedIcon className={style.iconError} />\n ) : (\n <FileUploadIcon className={style.icon} />\n )}\n {description ? <div className={style.description}>{description}</div> : null}\n {error ? null : <div className={style.dragAndDropLabel}>{'Drag & Drop here'}</div>}\n </div>\n {button}\n <div>{children(this.handleDragStart, this.handleDragStop)}</div>\n </div>\n )}\n {error ? (\n <span className={classnames(style.errorMessage, disabled && style.disabled)}>\n {error}\n </span>\n ) : (\n resetContent\n )}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,oBAAoB,IAAIC,KAD1B,EAEEC,8BAA8B,IAAIC,cAFpC,EAGEC,6BAA6B,IAAIC,qBAHnC,QAIO,0BAJP;AAKA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,MAAP,MAAmB,gBAAnB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,YAAY,GAAG,UAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0Bd,KAAK,CAACe,SAAhC,CAA0C;EAqBxCC,WAAW,CAACC,KAAD,EAAQ;IACjB,MAAMA,KAAN;IAEA,KAAKC,KAAL,GAAa;MACXC,QAAQ,EAAE;IADC,CAAb;IAIA,KAAKC,eAAL,GAAuB,KAAKA,eAAL,CAAqBC,IAArB,CAA0B,IAA1B,CAAvB;IACA,KAAKC,cAAL,GAAsB,KAAKA,cAAL,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1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","NovaSolidStatusClose","Close","NovaSolidFilesBasicFileUpload2","FileUploadIcon","NovaSolidFilesBasicFileBlock2","FileUploadBlockedIcon","classnames","Loader","Button","getClassState","style","constantNull","DragAndDrop","Component","constructor","props","state","dragging","handleDragStart","bind","handleDragStop","setState","render","idBox","children","title","description","uploadLabel","previewLabel","previewContent","loading","modified","onReset","error","buttonAriaLabel","errorButtonLabel","disabled","pdfButtonLabel","pdfButtonAriaLabel","previewView","type","preview","src","previewPdf","previewLabelPdf","href","target","download","position","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","button","previewContainer","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","string","shape","bool","func"],"sources":["../../../src/atom/drag-and-drop/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {uniqueId, constant, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as Close,\n NovaSolidFilesBasicFileUpload2 as FileUploadIcon,\n NovaSolidFilesBasicFileBlock2 as FileUploadBlockedIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport Loader from '../loader';\nimport Button from '../button-link';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst constantNull = constant(null);\n\nclass DragAndDrop extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n uploadLabel: PropTypes.string,\n previewLabel: PropTypes.string,\n previewContent: PropTypes.shape({\n type: PropTypes.string,\n src: PropTypes.string,\n label: PropTypes.string\n }),\n loading: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n children: PropTypes.func,\n onReset: PropTypes.func,\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string,\n pdfButtonLabel: PropTypes.string,\n pdfButtonAriaLabel: PropTypes.string\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n dragging: false\n };\n\n this.handleDragStart = this.handleDragStart.bind(this);\n this.handleDragStop = this.handleDragStop.bind(this);\n }\n\n handleDragStart() {\n this.setState({\n dragging: true\n });\n }\n\n handleDragStop() {\n this.setState({\n dragging: false\n });\n }\n\n render() {\n const idBox = uniqueId('drop-box-');\n const {\n children = constantNull,\n title,\n description,\n uploadLabel,\n previewLabel = '',\n previewContent,\n loading = false,\n modified = false,\n onReset = null,\n error = '',\n buttonAriaLabel = '',\n errorButtonLabel = '',\n disabled = false,\n pdfButtonLabel,\n pdfButtonAriaLabel\n } = this.props;\n const {dragging} = this.state;\n\n let previewView = null;\n\n if (previewContent && previewContent.type === 'image') {\n previewView = (\n <div className={style.preview}>\n <img src={previewContent.src} />\n </div>\n );\n } else if (previewContent && previewContent.type === 'video') {\n previewView = (\n <div className={style.preview}>\n <video controls src={previewContent.src} type=\"video/*\" />\n </div>\n );\n } else if (previewContent && previewContent.type === 'pdf') {\n previewView = (\n <div className={style.previewPdf}>\n <p className={style.previewLabelPdf}>{previewLabel}</p>\n <Button\n type=\"secondary\"\n link={{href: previewContent.src, target: '_blank', download: false}}\n label={pdfButtonLabel}\n aria-label={pdfButtonAriaLabel}\n data-name=\"default-button-pdf\"\n icon={{\n position: 'left',\n type: 'pdf'\n }}\n />\n </div>\n );\n } else if (loading) {\n previewView = (\n <div className={style.loaderWrapper}>\n <div className={style.loadingCancel}>\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n </div>\n <div className={style.loader}>\n <Loader theme=\"coorpmanager\" />\n </div>\n <span className={style.loaderText}>Uploading</span>\n </div>\n );\n } else {\n previewView = <span>{previewLabel}</span>;\n }\n\n const resetContent =\n previewContent && previewContent.src ? (\n <div className={classnames(style.resetUploadWrapper, disabled && style.disabled)}>\n <div className={style.resetSrcLabel}>\n {previewContent.label ? previewContent.label : previewContent.src}\n </div>\n {onReset ? (\n <Close\n data-name=\"reset-content-icon\"\n height={12}\n width={12}\n className={style.closeIcon}\n onClick={onReset}\n />\n ) : null}\n </div>\n ) : null;\n\n const buildButton = () => {\n const defaultButtonProps = {\n label: uploadLabel,\n 'aria-label': buttonAriaLabel,\n 'data-name': 'default-button',\n icon: {\n position: 'left',\n type: 'folders'\n }\n };\n if (dragging) {\n return null;\n } else if (error) {\n return <Button {...defaultButtonProps} label={errorButtonLabel} icon={{}} />;\n } else {\n return <Button {...defaultButtonProps} />;\n }\n };\n\n const button = buildButton(dragging, error);\n\n const previewContainer = getClassState(\n style.previewContainer,\n style.modifiedPreviewContainer,\n null,\n modified,\n error\n );\n const inputWrapper = getClassState(\n style.inputWrapper,\n style.modifiedInputWrapper,\n style.errorInputWrapper,\n modified,\n error\n );\n\n return (\n <div className={style.wrapper} data-name=\"drag-and-drop-wrapper\">\n <div className={style.title}>{title}</div>\n {!isEmpty(previewContent) || loading ? (\n <div className={classnames(previewContainer, disabled && style.disabled)}>\n {previewView}\n </div>\n ) : (\n <div\n className={classnames(\n dragging ? style.dragging : inputWrapper,\n disabled && style.disabled\n )}\n id={idBox}\n data-name=\"drag-and-drop-box\"\n >\n <div className={style.infosContainer}>\n {error ? (\n <FileUploadBlockedIcon className={style.iconError} />\n ) : (\n <FileUploadIcon className={style.icon} />\n )}\n {description ? <div className={style.description}>{description}</div> : null}\n {error ? null : <div className={style.dragAndDropLabel}>{'Drag & Drop here'}</div>}\n </div>\n {button}\n <div>{children(this.handleDragStart, this.handleDragStop)}</div>\n </div>\n )}\n {error ? (\n <span className={classnames(style.errorMessage, disabled && style.disabled)}>\n {error}\n </span>\n ) : (\n resetContent\n )}\n </div>\n );\n }\n}\n\nexport default DragAndDrop;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SACEC,oBAAoB,IAAIC,KAD1B,EAEEC,8BAA8B,IAAIC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 +78,31 @@
|
|
|
78
78
|
background-color: white;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
.preview img,
|
|
81
|
+
.preview img,
|
|
82
|
+
video {
|
|
82
83
|
max-width: 100%;
|
|
83
84
|
max-height: 100%;
|
|
84
85
|
margin: auto;
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
.previewPdf {
|
|
89
|
+
composes: preview;
|
|
90
|
+
min-height: 150px;
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
justify-content: space-evenly;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.previewLabelPdf {
|
|
97
|
+
text-align: center;
|
|
98
|
+
font-family: "Gilroy";
|
|
99
|
+
color: cm_grey_300;
|
|
100
|
+
padding: 0px 4px;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
text-overflow: ellipsis;
|
|
103
|
+
max-width: 90%;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
87
106
|
.infosContainer {
|
|
88
107
|
width: 100%;
|
|
89
108
|
height: 100%;
|
|
@@ -152,7 +171,7 @@
|
|
|
152
171
|
align-items: center;
|
|
153
172
|
justify-content: space-between;
|
|
154
173
|
margin-top: 16px;
|
|
155
|
-
padding:
|
|
174
|
+
padding: 8px 14px 8px 1px;
|
|
156
175
|
font-size: 12px;
|
|
157
176
|
font-weight: 400;
|
|
158
177
|
position: relative;
|
|
@@ -164,9 +183,6 @@
|
|
|
164
183
|
text-overflow: ellipsis;
|
|
165
184
|
white-space: nowrap;
|
|
166
185
|
flex-wrap: nowrap;
|
|
167
|
-
position: absolute;
|
|
168
|
-
left: 0;
|
|
169
|
-
right: 15px;
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
.closeIcon {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ImageUpload;
|
|
2
|
-
declare function ImageUpload({ title, description, previewLabel, previewContent, uploadLabel, loading, modified, disabled, onChange, onReset, name, labelLink, labelButtonLink, hrefLink, imageTypes, error, buttonAriaLabel, errorButtonLabel }: {
|
|
2
|
+
declare function ImageUpload({ title, description, previewLabel, previewContent, uploadLabel, loading, modified, disabled, onChange, onReset, name, labelLink, labelButtonLink, hrefLink, imageTypes, error, buttonAriaLabel, errorButtonLabel, pdfButtonLabel, pdfButtonAriaLabel }: {
|
|
3
3
|
title: any;
|
|
4
4
|
description: any;
|
|
5
5
|
previewLabel: any;
|
|
@@ -18,6 +18,8 @@ declare function ImageUpload({ title, description, previewLabel, previewContent,
|
|
|
18
18
|
error?: string | undefined;
|
|
19
19
|
buttonAriaLabel: any;
|
|
20
20
|
errorButtonLabel: any;
|
|
21
|
+
pdfButtonLabel: any;
|
|
22
|
+
pdfButtonAriaLabel: any;
|
|
21
23
|
}): JSX.Element;
|
|
22
24
|
declare namespace ImageUpload {
|
|
23
25
|
const propTypes: {
|
|
@@ -43,6 +45,8 @@ declare namespace ImageUpload {
|
|
|
43
45
|
modified: PropTypes.Requireable<boolean>;
|
|
44
46
|
disabled: PropTypes.Requireable<boolean>;
|
|
45
47
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
49
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
52
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/image-upload/index.js"],"names":[],"mappings":";AAQA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/image-upload/index.js"],"names":[],"mappings":";AAQA;;;;;;;;;;;;;;;;;;;;;gBAkFC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import _isNil from "lodash/fp/isNil";
|
|
2
|
-
import _pipe from "lodash/fp/pipe";
|
|
3
|
-
import _map from "lodash/fp/map";
|
|
4
|
-
import _join from "lodash/fp/join";
|
|
5
2
|
|
|
6
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); }
|
|
7
4
|
|
|
@@ -24,23 +21,22 @@ const ImageUpload = ({
|
|
|
24
21
|
onChange,
|
|
25
22
|
onReset = null,
|
|
26
23
|
name,
|
|
27
|
-
// See ImagePropType for accepted values
|
|
28
24
|
labelLink,
|
|
29
25
|
labelButtonLink,
|
|
30
26
|
hrefLink,
|
|
27
|
+
// See ImagePropType for accepted values
|
|
31
28
|
imageTypes = ['*'],
|
|
32
29
|
error = '',
|
|
33
30
|
buttonAriaLabel,
|
|
34
|
-
errorButtonLabel
|
|
31
|
+
errorButtonLabel,
|
|
32
|
+
pdfButtonLabel,
|
|
33
|
+
pdfButtonAriaLabel
|
|
35
34
|
}) => {
|
|
36
35
|
const handleReset = useCallback(e => {
|
|
37
36
|
if (_isNil(onReset)) return;
|
|
38
37
|
e.preventDefault();
|
|
39
38
|
return onReset(e);
|
|
40
39
|
}, [onReset]);
|
|
41
|
-
|
|
42
|
-
const acceptedImages = _pipe(_map(t => `image/${t}`), _join(','))(imageTypes);
|
|
43
|
-
|
|
44
40
|
const linkCustomStyle = {
|
|
45
41
|
width: '40px',
|
|
46
42
|
color: 'red'
|
|
@@ -57,11 +53,13 @@ const ImageUpload = ({
|
|
|
57
53
|
error: error,
|
|
58
54
|
disabled: disabled,
|
|
59
55
|
buttonAriaLabel: buttonAriaLabel,
|
|
60
|
-
errorButtonLabel: errorButtonLabel
|
|
56
|
+
errorButtonLabel: errorButtonLabel,
|
|
57
|
+
pdfButtonLabel: pdfButtonLabel,
|
|
58
|
+
pdfButtonAriaLabel: pdfButtonAriaLabel
|
|
61
59
|
}, (onDragStart, onDragStop) => /*#__PURE__*/React.createElement("input", {
|
|
62
60
|
type: "file",
|
|
63
61
|
name: name,
|
|
64
|
-
accept:
|
|
62
|
+
accept: imageTypes,
|
|
65
63
|
disabled: loading || disabled,
|
|
66
64
|
className: style.input,
|
|
67
65
|
onChange: onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","DragAndDrop","ImagePropType","Link","style","ImageUpload","title","description","previewLabel","previewContent","uploadLabel","loading","modified","disabled","onChange","onReset","name","labelLink","labelButtonLink","hrefLink","imageTypes","error","buttonAriaLabel","errorButtonLabel","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","PropTypes","DragAndDrop","ImagePropType","Link","style","ImageUpload","title","description","previewLabel","previewContent","uploadLabel","loading","modified","disabled","onChange","onReset","name","labelLink","labelButtonLink","hrefLink","imageTypes","error","buttonAriaLabel","errorButtonLabel","pdfButtonLabel","pdfButtonAriaLabel","handleReset","e","preventDefault","linkCustomStyle","width","color","onDragStart","onDragStop","input","templateLink","href","download","propTypes","string","func","arrayOf"],"sources":["../../../src/atom/image-upload/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isNil} from 'lodash/fp';\nimport DragAndDrop from '../drag-and-drop';\nimport {ImagePropType} from '../../util/proptypes';\nimport Link from '../button-link';\nimport style from './style.css';\n\nconst ImageUpload = ({\n title,\n description,\n previewLabel,\n previewContent,\n uploadLabel,\n loading,\n modified,\n disabled = false,\n onChange,\n onReset = null,\n name,\n labelLink,\n labelButtonLink,\n hrefLink,\n // See ImagePropType for accepted values\n imageTypes = ['*'],\n error = '',\n buttonAriaLabel,\n errorButtonLabel,\n pdfButtonLabel,\n pdfButtonAriaLabel\n}) => {\n const handleReset = useCallback(\n e => {\n if (isNil(onReset)) return;\n e.preventDefault();\n return onReset(e);\n },\n [onReset]\n );\n\n const linkCustomStyle = {\n width: '40px',\n color: 'red'\n };\n\n return (\n <div>\n <DragAndDrop\n title={title}\n description={description}\n previewLabel={previewLabel}\n previewContent={previewContent}\n uploadLabel={uploadLabel}\n loading={loading}\n modified={modified}\n onReset={handleReset}\n error={error}\n disabled={disabled}\n buttonAriaLabel={buttonAriaLabel}\n errorButtonLabel={errorButtonLabel}\n pdfButtonLabel={pdfButtonLabel}\n pdfButtonAriaLabel={pdfButtonAriaLabel}\n >\n {(onDragStart, onDragStop) => (\n <input\n type=\"file\"\n name={name}\n accept={imageTypes}\n disabled={loading || disabled}\n className={style.input}\n onChange={onChange}\n onDragEnter={onDragStart}\n onDrop={onDragStop}\n onDragLeave={onDragStop}\n />\n )}\n </DragAndDrop>\n {labelLink && hrefLink ? (\n <div className={style.templateLink}>\n {labelLink}\n <Link\n type=\"text\"\n customStyle={linkCustomStyle}\n link={{href: hrefLink, download: true}}\n label={labelButtonLink}\n />\n </div>\n ) : null}\n </div>\n );\n};\n\nImageUpload.propTypes = {\n ...DragAndDrop.propTypes,\n name: PropTypes.string,\n onChange: PropTypes.func,\n onReset: PropTypes.func,\n imageTypes: PropTypes.arrayOf(ImagePropType),\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string,\n labelLink: PropTypes.string,\n hrefLink: PropTypes.string\n};\n\nexport default ImageUpload;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,SAAQC,aAAR,QAA4B,sBAA5B;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,WAAW,GAAG,CAAC;EACnBC,KADmB;EAEnBC,WAFmB;EAGnBC,YAHmB;EAInBC,cAJmB;EAKnBC,WALmB;EAMnBC,OANmB;EAOnBC,QAPmB;EAQnBC,QAAQ,GAAG,KARQ;EASnBC,QATmB;EAUnBC,OAAO,GAAG,IAVS;EAWnBC,IAXmB;EAYnBC,SAZmB;EAanBC,eAbmB;EAcnBC,QAdmB;EAenB;EACAC,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ACE,IAAI,EAAC,MADP;IAEE,WAAW,EAAEY,eAFf;IAGE,IAAI,EAAE;MAACO,IAAI,EAAEjB,QAAP;MAAiBkB,QAAQ,EAAE;IAA3B,CAHR;IAIE,KAAK,EAAEnB;EAJT,EAFF,CADD,GAUG,IAzCN,CADF;AA6CD,CAlFD;;AAoFAb,WAAW,CAACiC,SAAZ,wDACKrC,WAAW,CAACqC,SADjB;EAEEtB,IAAI,EAAEhB,SAAS,CAACuC,MAFlB;EAGEzB,QAAQ,EAAEd,SAAS,CAACwC,IAHtB;EAIEzB,OAAO,EAAEf,SAAS,CAACwC,IAJrB;EAKEpB,UAAU,EAAEpB,SAAS,CAACyC,OAAV,CAAkBvC,aAAlB,CALd;EAMEmB,KAAK,EAAErB,SAAS,CAACuC,MANnB;EAOEjB,eAAe,EAAEtB,SAAS,CAACuC,MAP7B;EAQEhB,gBAAgB,EAAEvB,SAAS,CAACuC,MAR9B;EASEtB,SAAS,EAAEjB,SAAS,CAACuC,MATvB;EAUEpB,QAAQ,EAAEnB,SAAS,CAACuC;AAVtB;AAaA,eAAelC,WAAf"}
|
|
@@ -31,6 +31,8 @@ declare namespace VideoUpload {
|
|
|
31
31
|
error: PropTypes.Requireable<string>;
|
|
32
32
|
buttonAriaLabel: PropTypes.Requireable<string>;
|
|
33
33
|
errorButtonLabel: PropTypes.Requireable<string>;
|
|
34
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
35
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
38
|
import PropTypes from "prop-types";
|
|
@@ -148,6 +148,8 @@ declare namespace BrandFormGroup {
|
|
|
148
148
|
modified: PropTypes.Requireable<boolean>;
|
|
149
149
|
disabled: PropTypes.Requireable<boolean>;
|
|
150
150
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
151
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
152
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
151
153
|
}> | PropTypes.InferProps<{
|
|
152
154
|
type: PropTypes.Requireable<string>;
|
|
153
155
|
tabProps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
@@ -266,6 +268,8 @@ declare namespace BrandFormGroup {
|
|
|
266
268
|
modified: PropTypes.Requireable<boolean>;
|
|
267
269
|
disabled: PropTypes.Requireable<boolean>;
|
|
268
270
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
271
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
272
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
269
273
|
}> | PropTypes.InferProps<{
|
|
270
274
|
type: PropTypes.Requireable<string>;
|
|
271
275
|
title: PropTypes.Validator<string>;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export default Favorite;
|
|
2
|
-
declare
|
|
3
|
-
|
|
2
|
+
declare function Favorite({ favorite, addFavoriteToolTip, removeFavoriteToolTip, className, "aria-label": ariaLabel, onFavoriteClick, disabled }: {
|
|
3
|
+
favorite: any;
|
|
4
|
+
addFavoriteToolTip: any;
|
|
5
|
+
removeFavoriteToolTip: any;
|
|
6
|
+
className: any;
|
|
7
|
+
"aria-label"?: {} | undefined;
|
|
8
|
+
onFavoriteClick?: import("lodash/fp").LodashNoop | undefined;
|
|
9
|
+
disabled: any;
|
|
10
|
+
}, legacyContext: any): JSX.Element;
|
|
11
|
+
declare namespace Favorite {
|
|
12
|
+
const propTypes: {
|
|
4
13
|
className: PropTypes.Requireable<string>;
|
|
5
14
|
favorite: PropTypes.Requireable<boolean>;
|
|
6
15
|
disabled: PropTypes.Requireable<boolean>;
|
|
@@ -13,8 +22,8 @@ declare class Favorite extends React.Component<any, any, any> {
|
|
|
13
22
|
removeFromFavorite: PropTypes.Requireable<string>;
|
|
14
23
|
}>>;
|
|
15
24
|
};
|
|
16
|
-
|
|
17
|
-
skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
25
|
+
namespace contextTypes {
|
|
26
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
27
|
common: PropTypes.Requireable<{
|
|
19
28
|
[x: string]: any;
|
|
20
29
|
}>;
|
|
@@ -35,11 +44,7 @@ declare class Favorite extends React.Component<any, any, any> {
|
|
|
35
44
|
[x: string]: any;
|
|
36
45
|
}>;
|
|
37
46
|
}>>;
|
|
38
|
-
}
|
|
39
|
-
constructor(props: any, context: any);
|
|
40
|
-
handleFavoviteClick(e: any): void;
|
|
41
|
-
render(): JSX.Element;
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
|
-
import React from "react";
|
|
44
49
|
import PropTypes from "prop-types";
|
|
45
50
|
//# sourceMappingURL=favorite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAWA
|
|
1
|
+
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAWA;;;;;;;;oCAoEC"}
|
|
@@ -1,84 +1,67 @@
|
|
|
1
1
|
import _noop from "lodash/fp/noop";
|
|
2
2
|
import _isEmpty from "lodash/fp/isEmpty";
|
|
3
3
|
import _get from "lodash/fp/get";
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { NovaCompositionNavigationMore as MoreIcon, NovaCompositionCoorpacademyCheck as CheckIcon } from '@coorpacademy/nova-icons';
|
|
8
|
-
import Provider from '../../atom/provider';
|
|
8
|
+
import Provider, { GetSkinFromContext } from '../../atom/provider';
|
|
9
9
|
import style from './favorite.css';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const Favorite = ({
|
|
12
|
+
favorite,
|
|
13
|
+
addFavoriteToolTip,
|
|
14
|
+
removeFavoriteToolTip,
|
|
15
|
+
className,
|
|
16
|
+
'aria-label': ariaLabel = {},
|
|
17
|
+
onFavoriteClick = _noop,
|
|
18
|
+
disabled
|
|
19
|
+
}, legacyContext) => {
|
|
20
|
+
const skin = GetSkinFromContext(legacyContext);
|
|
21
|
+
const handleFavoriteClick = useCallback(e => {
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
if (!disabled) onFavoriteClick(e);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
render() {
|
|
28
|
-
const {
|
|
29
|
-
skin
|
|
30
|
-
} = this.context;
|
|
31
|
-
const {
|
|
32
|
-
favorite,
|
|
33
|
-
addFavoriteToolTip,
|
|
34
|
-
removeFavoriteToolTip,
|
|
35
|
-
className,
|
|
36
|
-
'aria-label': ariaLabel = {}
|
|
37
|
-
} = this.props;
|
|
38
|
-
|
|
39
|
-
const primaryColor = _get('common.primary', skin);
|
|
25
|
+
}, [disabled, onFavoriteClick]);
|
|
40
26
|
|
|
41
|
-
|
|
27
|
+
const primaryColor = _get('common.primary', skin);
|
|
42
28
|
|
|
43
|
-
|
|
29
|
+
const darkColor = _get('common.dark', skin);
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
className: style.showToolTip
|
|
47
|
-
}, /*#__PURE__*/React.createElement("span", null, favorite ? removeFavoriteToolTip : addFavoriteToolTip)) : null;
|
|
48
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: style.blocFavorite
|
|
50
|
-
}, toolTipView, /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
"data-name": "favorite",
|
|
52
|
-
"aria-label": ariaLabel.favorite,
|
|
53
|
-
className: classnames(style.favorite, className, favorite && style.selected),
|
|
54
|
-
onClick: this.handleFavoviteClick,
|
|
55
|
-
style: {
|
|
56
|
-
color: primaryColor
|
|
57
|
-
}
|
|
58
|
-
}, favorite ? /*#__PURE__*/React.createElement(CheckIcon, {
|
|
59
|
-
className: style.checkIcon,
|
|
60
|
-
style: {
|
|
61
|
-
color: brandColor
|
|
62
|
-
},
|
|
63
|
-
width: 13,
|
|
64
|
-
height: 13,
|
|
65
|
-
"aria-label": ariaLabel.removeFromFavorite
|
|
66
|
-
}) : /*#__PURE__*/React.createElement(MoreIcon, {
|
|
67
|
-
className: style.moreIcon,
|
|
68
|
-
style: {
|
|
69
|
-
color: darkColor
|
|
70
|
-
},
|
|
71
|
-
width: 13,
|
|
72
|
-
height: 13,
|
|
73
|
-
"aria-label": ariaLabel.addToFavorite
|
|
74
|
-
})));
|
|
75
|
-
}
|
|
31
|
+
const brandColor = _get('common.brand', skin);
|
|
76
32
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
33
|
+
const toolTipView = useMemo(() => !_isEmpty(removeFavoriteToolTip) && !_isEmpty(addFavoriteToolTip) ? /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: style.showToolTip
|
|
35
|
+
}, /*#__PURE__*/React.createElement("span", null, favorite ? removeFavoriteToolTip : addFavoriteToolTip)) : null, [addFavoriteToolTip, favorite, removeFavoriteToolTip]);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: style.blocFavorite
|
|
38
|
+
}, toolTipView, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
"data-name": "favorite",
|
|
40
|
+
"aria-label": ariaLabel.favorite,
|
|
41
|
+
className: classnames(style.favorite, className, favorite && style.selected),
|
|
42
|
+
onClick: handleFavoriteClick,
|
|
43
|
+
style: {
|
|
44
|
+
color: primaryColor
|
|
45
|
+
}
|
|
46
|
+
}, favorite ? /*#__PURE__*/React.createElement(CheckIcon, {
|
|
47
|
+
className: style.checkIcon,
|
|
48
|
+
style: {
|
|
49
|
+
color: brandColor
|
|
50
|
+
},
|
|
51
|
+
width: 13,
|
|
52
|
+
height: 13,
|
|
53
|
+
"aria-label": ariaLabel.removeFromFavorite
|
|
54
|
+
}) : /*#__PURE__*/React.createElement(MoreIcon, {
|
|
55
|
+
className: style.moreIcon,
|
|
56
|
+
style: {
|
|
57
|
+
color: darkColor
|
|
58
|
+
},
|
|
59
|
+
width: 13,
|
|
60
|
+
height: 13,
|
|
61
|
+
"aria-label": ariaLabel.addToFavorite
|
|
62
|
+
})));
|
|
81
63
|
};
|
|
64
|
+
|
|
82
65
|
Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
83
66
|
className: PropTypes.string,
|
|
84
67
|
favorite: PropTypes.bool,
|
|
@@ -92,5 +75,8 @@ Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
92
75
|
removeFromFavorite: PropTypes.string
|
|
93
76
|
})
|
|
94
77
|
} : {};
|
|
78
|
+
Favorite.contextTypes = {
|
|
79
|
+
skin: Provider.childContextTypes.skin
|
|
80
|
+
};
|
|
95
81
|
export default Favorite;
|
|
96
82
|
//# sourceMappingURL=favorite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.js","names":["React","PropTypes","classnames","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","
|
|
1
|
+
{"version":3,"file":"favorite.js","names":["React","useCallback","useMemo","PropTypes","classnames","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","GetSkinFromContext","style","Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","disabled","legacyContext","skin","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","toolTipView","showToolTip","blocFavorite","selected","color","checkIcon","removeFromFavorite","moreIcon","addToFavorite","propTypes","string","bool","func","shape","contextTypes","childContextTypes"],"sources":["../../../src/molecule/card/favorite.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationMore as MoreIcon,\n NovaCompositionCoorpacademyCheck as CheckIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport style from './favorite.css';\n\nconst Favorite = (\n {\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n className,\n 'aria-label': ariaLabel = {},\n onFavoriteClick = noop,\n disabled\n },\n legacyContext\n) => {\n const skin = GetSkinFromContext(legacyContext);\n const handleFavoriteClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n if (!disabled) onFavoriteClick(e);\n },\n [disabled, onFavoriteClick]\n );\n\n const primaryColor = get('common.primary', skin);\n const darkColor = get('common.dark', skin);\n const brandColor = get('common.brand', skin);\n\n const toolTipView = useMemo(\n () =>\n !isEmpty(removeFavoriteToolTip) && !isEmpty(addFavoriteToolTip) ? (\n <div className={style.showToolTip}>\n <span>{favorite ? removeFavoriteToolTip : addFavoriteToolTip}</span>\n </div>\n ) : null,\n [addFavoriteToolTip, favorite, removeFavoriteToolTip]\n );\n\n return (\n <div className={style.blocFavorite}>\n {toolTipView}\n <div\n data-name=\"favorite\"\n aria-label={ariaLabel.favorite}\n className={classnames(style.favorite, className, favorite && style.selected)}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n >\n {favorite ? (\n <CheckIcon\n className={style.checkIcon}\n style={{color: brandColor}}\n width={13}\n height={13}\n aria-label={ariaLabel.removeFromFavorite}\n />\n ) : (\n <MoreIcon\n className={style.moreIcon}\n style={{color: darkColor}}\n width={13}\n height={13}\n aria-label={ariaLabel.addToFavorite}\n />\n )}\n </div>\n </div>\n );\n};\n\nFavorite.propTypes = {\n className: PropTypes.string,\n favorite: PropTypes.bool,\n disabled: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onFavoriteClick: PropTypes.func,\n 'aria-label': PropTypes.shape({\n favorite: PropTypes.string,\n addToFavorite: PropTypes.string,\n removeFromFavorite: PropTypes.string\n })\n};\n\nFavorite.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default Favorite;\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,QAA0C,OAA1C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,6BAA6B,IAAIC,QADnC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,qBAA3C;AACA,OAAOC,KAAP,MAAkB,gBAAlB;;AAEA,MAAMC,QAAQ,GAAG,CACf;EACEC,QADF;EAEEC,kBAFF;EAGEC,qBAHF;EAIEC,SAJF;EAKE,cAAcC,SAAS,GAAG,EAL5B;EAMEC,eAAe,QANjB;EAOEC;AAPF,CADe,EAUfC,aAVe,KAWZ;EACH,MAAMC,IAAI,GAAGX,kBAAkB,CAACU,aAAD,CAA/B;EACA,MAAME,mBAAmB,GAAGrB,WAAW,CACrCsB,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,IAAI,CAACN,QAAL,EAAeD,eAAe,CAACK,CAAD,CAAf;EAChB,CALoC,EAMrC,CAACJ,QAAD,EAAWD,eAAX,CANqC,CAAvC;;EASA,MAAMQ,YAAY,GAAG,KAAI,gBAAJ,EAAsBL,IAAtB,CAArB;;EACA,MAAMM,SAAS,GAAG,KAAI,aAAJ,EAAmBN,IAAnB,CAAlB;;EACA,MAAMO,UAAU,GAAG,KAAI,cAAJ,EAAoBP,IAApB,CAAnB;;EAEA,MAAMQ,WAAW,GAAG3B,OAAO,CACzB,MACE,CAAC,SAAQa,qBAAR,CAAD,IAAmC,CAAC,SAAQD,kBAAR,CAApC,gBACE;IAAK,SAAS,EAAEH,KAAK,CAACmB;EAAtB,gBACE,kCAAOjB,QAAQ,GAAGE,qBAAH,GAA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,SAAS,CAACoC,MAFG;IAG5BJ,kBAAkB,EAAEhC,SAAS,CAACoC;EAHF,CAAhB;AAPK,CAArB;AAcA3B,QAAQ,CAAC+B,YAAT,GAAwB;EACtBtB,IAAI,EAAEZ,QAAQ,CAACmC,iBAAT,CAA2BvB;AADX,CAAxB;AAIA,eAAeT,QAAf"}
|
|
@@ -25,6 +25,8 @@ declare namespace DragAndDropWrapper {
|
|
|
25
25
|
modified: PropTypes.Requireable<boolean>;
|
|
26
26
|
disabled: PropTypes.Requireable<boolean>;
|
|
27
27
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
29
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
28
30
|
}> | null | undefined)[]>;
|
|
29
31
|
'data-name': PropTypes.Requireable<string>;
|
|
30
32
|
};
|
|
@@ -105,6 +105,8 @@ declare namespace SetupSlide {
|
|
|
105
105
|
modified: PropTypes.Requireable<boolean>;
|
|
106
106
|
disabled: PropTypes.Requireable<boolean>;
|
|
107
107
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
108
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
109
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
108
110
|
}> | PropTypes.InferProps<{
|
|
109
111
|
type: PropTypes.Requireable<string>;
|
|
110
112
|
title: PropTypes.Validator<string>;
|
|
@@ -118,6 +118,8 @@ declare namespace SetupSlider {
|
|
|
118
118
|
modified: PropTypes.Requireable<boolean>;
|
|
119
119
|
disabled: PropTypes.Requireable<boolean>;
|
|
120
120
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
121
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
122
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
121
123
|
}> | PropTypes.InferProps<{
|
|
122
124
|
type: PropTypes.Requireable<string>;
|
|
123
125
|
title: PropTypes.Validator<string>;
|
|
@@ -65,6 +65,8 @@ declare namespace TitleAndCheckBoxWrapper {
|
|
|
65
65
|
modified: PropTypes.Requireable<boolean>;
|
|
66
66
|
disabled: PropTypes.Requireable<boolean>;
|
|
67
67
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
69
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
68
70
|
}> | null | undefined)[]>;
|
|
69
71
|
'data-name': PropTypes.Requireable<string>;
|
|
70
72
|
}> | null | undefined>>;
|
|
@@ -178,6 +178,8 @@ declare namespace BrandForm {
|
|
|
178
178
|
modified: PropTypes.Requireable<boolean>;
|
|
179
179
|
disabled: PropTypes.Requireable<boolean>;
|
|
180
180
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
181
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
182
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
181
183
|
}> | PropTypes.InferProps<{
|
|
182
184
|
type: PropTypes.Requireable<string>;
|
|
183
185
|
tabProps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
@@ -296,6 +298,8 @@ declare namespace BrandForm {
|
|
|
296
298
|
modified: PropTypes.Requireable<boolean>;
|
|
297
299
|
disabled: PropTypes.Requireable<boolean>;
|
|
298
300
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
301
|
+
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
302
|
+
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
299
303
|
}> | PropTypes.InferProps<{
|
|
300
304
|
type: PropTypes.Requireable<string>;
|
|
301
305
|
title: PropTypes.Validator<string>;
|