@coorpacademy/components 11.12.1-alpha.13 → 11.12.1
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 +0 -2
- package/es/atom/drag-and-drop/index.d.ts.map +1 -1
- package/es/atom/drag-and-drop/index.js +2 -26
- package/es/atom/drag-and-drop/index.js.map +1 -1
- package/es/atom/drag-and-drop/style.css +5 -21
- package/es/atom/image-upload/index.d.ts +1 -5
- package/es/atom/image-upload/index.d.ts.map +1 -1
- package/es/atom/image-upload/index.js +10 -8
- package/es/atom/image-upload/index.js.map +1 -1
- package/es/atom/video-upload/index.d.ts +0 -2
- package/es/molecule/brand-form-group/index.d.ts +0 -4
- package/es/molecule/drag-and-drop-wrapper/index.d.ts +0 -2
- package/es/molecule/drag-and-drop-wrapper/style.css +1 -1
- package/es/molecule/review-correction-popin/index.native.d.ts.map +1 -1
- package/es/molecule/review-correction-popin/index.native.js +10 -1
- package/es/molecule/review-correction-popin/index.native.js.map +1 -1
- package/es/molecule/setup-slide/index.d.ts +0 -2
- package/es/molecule/setup-slider/index.d.ts +0 -2
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +0 -2
- package/es/organism/brand-form/index.d.ts +0 -4
- package/es/organism/list-item/index.d.ts +0 -1
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +3 -5
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-items/index.d.ts +0 -1
- package/es/organism/review-skills/index.native.js +1 -1
- package/es/organism/review-skills/index.native.js.map +1 -1
- package/es/organism/review-slide/index.native.d.ts.map +1 -1
- package/es/organism/review-slide/index.native.js +3 -3
- package/es/organism/review-slide/index.native.js.map +1 -1
- package/es/organism/rewards-form/index.d.ts +0 -2
- package/es/organism/wizard-contents/index.d.ts +0 -6
- package/es/template/back-office/brand-update/index.d.ts +0 -11
- package/es/template/cockpit/jw-uploader/index.d.ts +0 -2
- package/es/util/button-icons.d.ts +0 -1
- package/es/util/button-icons.d.ts.map +1 -1
- package/es/util/button-icons.js +2 -3
- 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 +0 -2
- package/lib/atom/drag-and-drop/index.d.ts.map +1 -1
- package/lib/atom/drag-and-drop/index.js +2 -26
- package/lib/atom/drag-and-drop/index.js.map +1 -1
- package/lib/atom/drag-and-drop/style.css +5 -21
- package/lib/atom/image-upload/index.d.ts +1 -5
- package/lib/atom/image-upload/index.d.ts.map +1 -1
- package/lib/atom/image-upload/index.js +11 -8
- package/lib/atom/image-upload/index.js.map +1 -1
- package/lib/atom/video-upload/index.d.ts +0 -2
- package/lib/molecule/brand-form-group/index.d.ts +0 -4
- package/lib/molecule/drag-and-drop-wrapper/index.d.ts +0 -2
- package/lib/molecule/drag-and-drop-wrapper/style.css +1 -1
- package/lib/molecule/review-correction-popin/index.native.d.ts.map +1 -1
- package/lib/molecule/review-correction-popin/index.native.js +10 -1
- package/lib/molecule/review-correction-popin/index.native.js.map +1 -1
- package/lib/molecule/setup-slide/index.d.ts +0 -2
- package/lib/molecule/setup-slider/index.d.ts +0 -2
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +0 -2
- package/lib/organism/brand-form/index.d.ts +0 -4
- package/lib/organism/list-item/index.d.ts +0 -1
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +3 -5
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-items/index.d.ts +0 -1
- package/lib/organism/review-skills/index.native.js +1 -1
- package/lib/organism/review-skills/index.native.js.map +1 -1
- package/lib/organism/review-slide/index.native.d.ts.map +1 -1
- package/lib/organism/review-slide/index.native.js +3 -3
- package/lib/organism/review-slide/index.native.js.map +1 -1
- package/lib/organism/rewards-form/index.d.ts +0 -2
- package/lib/organism/wizard-contents/index.d.ts +0 -6
- package/lib/template/back-office/brand-update/index.d.ts +0 -11
- package/lib/template/cockpit/jw-uploader/index.d.ts +0 -2
- package/lib/util/button-icons.d.ts +0 -1
- package/lib/util/button-icons.d.ts.map +1 -1
- package/lib/util/button-icons.js +1 -2
- 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/locales/.mtslconfig.json +1 -0
- package/locales/bs/global.json +4 -1
- package/locales/cs/global.json +4 -1
- package/locales/de/global.json +4 -1
- package/locales/es/global.json +4 -1
- package/locales/et/global.json +4 -1
- package/locales/fr/global.json +4 -1
- package/locales/hr/global.json +4 -1
- package/locales/hu/global.json +4 -1
- package/locales/hy/global.json +4 -1
- package/locales/it/global.json +4 -1
- package/locales/ja/global.json +4 -1
- package/locales/ko/global.json +4 -1
- package/locales/nl/global.json +4 -1
- package/locales/pl/global.json +4 -1
- package/locales/pt/global.json +4 -1
- package/locales/ro/global.json +4 -1
- package/locales/ru/global.json +4 -1
- package/locales/sk/global.json +4 -1
- package/locales/th/global.json +4 -1
- package/locales/tl/global.json +4 -1
- package/locales/tr/global.json +4 -1
- package/locales/uk/global.json +4 -1
- package/locales/vi/global.json +4 -1
- package/locales/zh/global.json +4 -1
- package/locales/zh_TW/global.json +4 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","FlatList","StyleSheet","SkillCard","style","create","skills","paddingBottom","Item","item","ariaLabel","skillTitle","skillAriaLabel","reviseLabel","reviseAriaLabel","onClick","buttonLabel","buttonAriaLabel","isCustom","ReviewListSkills","props","listSkills"],"sources":["../../../src/organism/review-skills/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {FlatList, StyleSheet} from 'react-native';\nimport SkillCard from '../../molecule/skill-card/index.native';\nimport {SkillCardProps} from '../../molecule/skill-card/prop-types';\nimport {ReviewSkills} from './prop-types';\n\ntype ItemProps = {\n item: SkillCardProps;\n};\n\nconst style = StyleSheet.create({\n skills: {paddingBottom:
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["React","FlatList","StyleSheet","SkillCard","style","create","skills","paddingBottom","Item","item","ariaLabel","skillTitle","skillAriaLabel","reviseLabel","reviseAriaLabel","onClick","buttonLabel","buttonAriaLabel","isCustom","ReviewListSkills","props","listSkills"],"sources":["../../../src/organism/review-skills/index.native.tsx"],"sourcesContent":["import React from 'react';\nimport {FlatList, StyleSheet} from 'react-native';\nimport SkillCard from '../../molecule/skill-card/index.native';\nimport {SkillCardProps} from '../../molecule/skill-card/prop-types';\nimport {ReviewSkills} from './prop-types';\n\ntype ItemProps = {\n item: SkillCardProps;\n};\n\nconst style = StyleSheet.create({\n skills: {paddingBottom: 200}\n});\n\nconst Item = ({\n item: {\n 'aria-label': ariaLabel,\n skillTitle,\n skillAriaLabel,\n reviseLabel,\n reviseAriaLabel,\n onClick,\n buttonLabel,\n buttonAriaLabel,\n isCustom\n }\n}: ItemProps) => (\n <SkillCard\n aria-label={ariaLabel}\n skillTitle={skillTitle}\n skillAriaLabel={skillAriaLabel}\n reviseLabel={reviseLabel}\n reviseAriaLabel={reviseAriaLabel}\n onClick={onClick}\n buttonLabel={buttonLabel}\n buttonAriaLabel={buttonAriaLabel}\n isCustom={isCustom}\n />\n);\n\nconst ReviewListSkills = (props: ReviewSkills) => {\n const {listSkills} = props;\n\n return <FlatList contentContainerStyle={style.skills} data={listSkills} renderItem={Item} />;\n};\n\nexport default ReviewListSkills;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,QAAR,EAAkBC,UAAlB,QAAmC,cAAnC;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AAQA,MAAMC,KAAK,GAAGF,UAAU,CAACG,MAAX,CAAkB;EAC9BC,MAAM,EAAE;IAACC,aAAa,EAAE;EAAhB;AADsB,CAAlB,CAAd;;AAIA,MAAMC,IAAI,GAAG,CAAC;EACZC,IAAI,EAAE;IACJ,cAAcC,SADV;IAEJC,UAFI;IAGJC,cAHI;IAIJC,WAJI;IAKJC,eALI;IAMJC,OANI;IAOJC,WAPI;IAQJC,eARI;IASJC;EATI;AADM,CAAD,kBAaX,oBAAC,SAAD;EACE,cAAYR,SADd;EAEE,UAAU,EAAEC,UAFd;EAGE,cAAc,EAAEC,cAHlB;EAIE,WAAW,EAAEC,WAJf;EAKE,eAAe,EAAEC,eALnB;EAME,OAAO,EAAEC,OANX;EAOE,WAAW,EAAEC,WAPf;EAQE,eAAe,EAAEC,eARnB;EASE,QAAQ,EAAEC;AATZ,EAbF;;AA0BA,MAAMC,gBAAgB,GAAIC,KAAD,IAAyB;EAChD,MAAM;IAACC;EAAD,IAAeD,KAArB;EAEA,oBAAO,oBAAC,QAAD;IAAU,qBAAqB,EAAEhB,KAAK,CAACE,MAAvC;IAA+C,IAAI,EAAEe,UAArD;IAAiE,UAAU,EAAEb;EAA7E,EAAP;AACD,CAJD;;AAMA,eAAeW,gBAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AA0BA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/organism/review-slide/index.native.tsx"],"names":[],"mappings":";AA0BA,OAAO,EAAa,gBAAgB,EAAa,MAAM,cAAc,CAAC;AAuPtE,QAAA,MAAM,KAAK,UAAW,gBAAgB,gBAmFrC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -139,7 +139,6 @@ const createQuestionStyle = theme => StyleSheet.create({
|
|
|
139
139
|
},
|
|
140
140
|
choicesScrollContent: {
|
|
141
141
|
justifyContent: 'space-around',
|
|
142
|
-
flex: 1,
|
|
143
142
|
padding: 10
|
|
144
143
|
}
|
|
145
144
|
});
|
|
@@ -172,7 +171,9 @@ const Question = props => {
|
|
|
172
171
|
style: style.questionHelp
|
|
173
172
|
}, get('help', answerUI))), /*#__PURE__*/React.createElement(ScrollView, {
|
|
174
173
|
style: style.choicesScrollView,
|
|
175
|
-
contentContainerStyle: style.choicesScrollContent,
|
|
174
|
+
contentContainerStyle: [style.choicesScrollContent, isKeyboardVisible ? {
|
|
175
|
+
flex: 1
|
|
176
|
+
} : null],
|
|
176
177
|
centerContent: true,
|
|
177
178
|
showsHorizontalScrollIndicator: false,
|
|
178
179
|
showsVerticalScrollIndicator: false
|
|
@@ -181,7 +182,6 @@ const Question = props => {
|
|
|
181
182
|
autoplay: autoplayMedia
|
|
182
183
|
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
183
184
|
style: {
|
|
184
|
-
minHeight: 100,
|
|
185
185
|
flex: isKeyboardVisible ? 1 : 0,
|
|
186
186
|
marginTop: hasVideoOrImage ? 30 : 0
|
|
187
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["React","useCallback","useEffect","useMemo","useState","Animated","Easing","Image","Keyboard","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Answer","ReviewCorrectionPopin","useTemplateContext","Button","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","Video","Html","styles","create","mediaContainer","alignItems","justifyContent","width","height","borderRadius","overflow","image","flex","correctionPopinWrapper","position","bottom","MediaView","media","autoplay","type","uri","url","split","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","choicesScrollContent","padding","Question","props","answerUI","isKeyboardVisible","autoplayMedia","setStyle","questionStyle","hasVideoOrImage","includes","minHeight","createSlideStyle","num","screenWidth","slideWidth","hiddenBackgroundToLockActions","left","right","top","backgroundColor","slide","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","isValidated","setValidated","setKeyboardVisible","showListener","addListener","hideListener","remove","handleValidatePress","dismiss","setTimeout","slideStyle","isFirstSlide","loading","parentContentTitle","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useCallback, useEffect, useMemo, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n Keyboard,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport Html from '../../atom/html/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: 200,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media, autoplay}: {media?: Media; autoplay: boolean}) => {\n if (!media) {\n return null;\n }\n\n switch (media.type) {\n case TYPE_VIDEO:\n return (\n <View style={styles.mediaContainer}>\n <Video media={media} autoplay={autoplay} />\n </View>\n );\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={[styles.mediaContainer, styles.image]} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return null;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between',\n alignItems: 'center'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginTop: 20,\n width: '100%'\n },\n choicesScrollContent: {\n justifyContent: 'space-around',\n flex: 1,\n padding: 10\n }\n });\n\ntype QuestionProps = {\n autoplayMedia: boolean;\n answerUI: SlideProps['answerUI'];\n isKeyboardVisible: boolean;\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {\n answerUI,\n questionText,\n questionOrigin = '',\n isKeyboardVisible,\n autoplayMedia = false\n } = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n const hasVideoOrImage =\n answerUI.media?.type && [TYPE_VIDEO, TYPE_IMAGE].includes(answerUI.media.type);\n\n return (\n <>\n <View style={style.questionHeading}>\n <Html style={style.questionOrigin}>{questionOrigin}</Html>\n <Html style={style.questionText}>{questionText}</Html>\n <Html style={style.questionHelp}>{get('help', answerUI)}</Html>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={style.choicesScrollContent}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n {!isKeyboardVisible && hasVideoOrImage ? (\n <MediaView media={answerUI.media} autoplay={autoplayMedia} />\n ) : null}\n <View\n style={{\n minHeight: 100,\n flex: isKeyboardVisible ? 1 : 0,\n marginTop: hasVideoOrImage ? 30 : 0\n }}\n >\n <Answer {...answerUI} />\n </View>\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n hiddenBackgroundToLockActions: ViewStyle;\n};\n\nconst createSlideStyle = (\n num: number,\n screenWidth: number,\n isKeyboardVisible: boolean\n): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n hiddenBackgroundToLockActions: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n backgroundColor: '#00000000'\n },\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: (isKeyboardVisible ? 5 : 34) + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n const [isValidated, setValidated] = useState<boolean>(false);\n const [isKeyboardVisible, setKeyboardVisible] = useState<boolean>(false);\n\n useEffect(() => {\n const showListener = Keyboard.addListener('keyboardDidShow', () => {\n setKeyboardVisible(true);\n });\n\n const hideListener = Keyboard.addListener('keyboardDidHide', () => {\n setKeyboardVisible(false);\n });\n\n return () => {\n showListener.remove();\n hideListener.remove();\n };\n }, []);\n\n const handleValidatePress = useCallback(() => {\n Keyboard.dismiss();\n setValidated(true);\n\n // calling the onclick later, after react has rerendered, to display the locking BG as soon as possible\n setTimeout(() => {\n validateButton.onClick();\n }, 20);\n\n // only to create on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const {width} = useWindowDimensions();\n const slideStyle = useMemo(\n () => createSlideStyle(num, width, isKeyboardVisible),\n [num, width, isKeyboardVisible]\n );\n const isFirstSlide = num === 1;\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n autoplayMedia={isFirstSlide}\n isKeyboardVisible={isKeyboardVisible}\n key=\"question-container\"\n />\n {isKeyboardVisible ? null : (\n <Button\n disabled={isValidated || validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n )}\n {isValidated ? <View style={slideStyle.hiddenBackgroundToLockActions} /> : null}\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,OAAvC,EAAgDC,QAAhD,QAA+D,OAA/D;AAEA,SACEC,QADF,EAEEC,MAFF,EAGEC,KAHF,EAIEC,QAJF,EAKEC,UALF,EAMEC,UANF,EAQEC,mBARF,EASEC,IATF,QAWO,cAXP;AAYA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,UAAR,EAAoBC,UAApB,EAAgCC,UAAhC,QAAiD,kCAAjD;AACA,OAAOC,KAAP,MAAkB,iDAAlB;AAEA,OAAOC,IAAP,MAAiB,8BAAjB;AAGA,MAAMC,MAAM,GAAGf,UAAU,CAACgB,MAAX,CAAkB;EAC/BC,cAAc,EAAE;IACdC,UAAU,EAAE,QADE;IAEdC,cAAc,EAAE,QAFF;IAGdC,KAAK,EAAE,MAHO;IAIdC,MAAM,EAAE,GAJM;IAKdC,YAAY,EAAE,EALA;IAMdC,QAAQ,EAAE;EANI,CADe;EAS/BC,KAAK,E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AAxB,EAAP;EACD;;EAED,oBACE,oBAAC,QAAD,CAAU,IAAV;IAAe,KAAK,EAAE,CAACkB,UAAU,CAAClB,KAAZ,EAAmB5C,aAAnB;EAAtB,gBACE,oBAAC,QAAD;IACE,cAAc,EAAEiE,kBADlB;IAEE,YAAY,EAAEhD,YAFhB;IAGE,QAAQ,EAAEU,QAHZ;IAIE,aAAa,EAAEoC,YAJjB;IAKE,iBAAiB,EAAEnC,iBALrB;IAME,GAAG,EAAC;EANN,EADF,EASGA,iBAAiB,GAAG,IAAH,gBAChB,oBAAC,MAAD;IACE,QAAQ,EAAEwB,WAAW,IAAID,cAAc,CAACe,QAD1C;IAEE,WAAW,EAAEf,cAAc,CAAC1D,KAF9B;IAGE,OAAO,EAAEkE,mBAHX;IAIE,MAAM,EAAG,yBAAwB/E,UAAW;EAJ9C,EAVJ,EAiBGwE,WAAW,gBAAG,oBAAC,IAAD;IAAM,KAAK,EAAEU,UAAU,CAACvB;EAAxB,EAAH,GAA+D,IAjB7E,EAkBG5D,oBAAoB,gBACnB,oBAAC,eAAD;IACE,oBAAoB,EAAEA,oBADxB;IAEE,UAAU,EAAEC,UAFd;IAGE,mBAAmB,EAAEC,mBAHvB;IAIE,sBAAsB,EAAEC,sBAJ1B;IAKE,GAAG,EAAC;EALN,EADmB,GAQjB,IA1BN,CADF;AA8BD,CAnFD;;AAqFA,eAAeoE,KAAf"}
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["React","useCallback","useEffect","useMemo","useState","Animated","Easing","Image","Keyboard","ScrollView","StyleSheet","useWindowDimensions","View","get","getOr","useTranslateY","Answer","ReviewCorrectionPopin","useTemplateContext","Button","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","Video","Html","styles","create","mediaContainer","alignItems","justifyContent","width","height","borderRadius","overflow","image","flex","correctionPopinWrapper","position","bottom","MediaView","media","autoplay","type","uri","url","split","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","translateUp","fromValue","toValue","duration","easing","bezier","start","klf","undefined","information","label","message","next","onClick","_correctionPopinProps","resultLabel","style","animatedStyle","createQuestionStyle","theme","questionHeading","questionOrigin","fontSize","lineHeight","color","colors","text","primary","marginBottom","spacing","tiny","marginTop","small","textAlign","questionText","fontWeight","questionHelp","gray","medium","choicesScrollView","choicesScrollContent","padding","Question","props","answerUI","isKeyboardVisible","autoplayMedia","setStyle","questionStyle","hasVideoOrImage","includes","createSlideStyle","num","screenWidth","slideWidth","hiddenBackgroundToLockActions","left","right","top","backgroundColor","slide","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","Slide","validateButton","isValidated","setValidated","setKeyboardVisible","showListener","addListener","hideListener","remove","handleValidatePress","dismiss","setTimeout","slideStyle","isFirstSlide","loading","parentContentTitle","disabled"],"sources":["../../../src/organism/review-slide/index.native.tsx"],"sourcesContent":["import React, {useCallback, useEffect, useMemo, useState} from 'react';\n\nimport {\n Animated,\n Easing,\n Image,\n Keyboard,\n ScrollView,\n StyleSheet,\n TextStyle,\n useWindowDimensions,\n View,\n ViewStyle\n} from 'react-native';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport {useTranslateY} from '@coorpacademy/react-native-animation';\nimport Answer from '../../molecule/answer/index.native';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {Theme} from '../../variables/theme.native';\nimport Button from '../../atom/button/index.native';\nimport {TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from '../../molecule/answer/prop-types';\nimport Video from '../../molecule/video-player-mobile/index.native';\nimport {Media} from '../../molecule/questions/types';\nimport Html from '../../atom/html/index.native';\nimport {PopinProps, ReviewSlideProps, SlideProps} from './prop-types';\n\nconst styles = StyleSheet.create({\n mediaContainer: {\n alignItems: 'center',\n justifyContent: 'center',\n width: '100%',\n height: 200,\n borderRadius: 10,\n overflow: 'hidden'\n },\n image: {\n flex: 1,\n width: '100%'\n },\n correctionPopinWrapper: {\n position: 'absolute',\n bottom: 16,\n width: '105%'\n }\n});\n\nconst MediaView = ({media, autoplay}: {media?: Media; autoplay: boolean}) => {\n if (!media) {\n return null;\n }\n\n switch (media.type) {\n case TYPE_VIDEO:\n return (\n <View style={styles.mediaContainer}>\n <Video media={media} autoplay={autoplay} />\n </View>\n );\n case TYPE_IMAGE: {\n const uri = `https://${media.url?.split('//')[1]}`;\n return <Image style={[styles.mediaContainer, styles.image]} source={{uri}} />;\n }\n case TYPE_AUDIO:\n default:\n return null;\n }\n};\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}: PopinProps) => {\n const translateUp = useTranslateY({\n fromValue: 500,\n toValue: 0,\n duration: 500,\n easing: Easing.bezier(0.34, 1.36, 0.64, 1)\n });\n\n // the translation is required only once on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => translateUp.start(), []);\n\n if (!showCorrectionPopin) return null;\n\n const klf = getOr(undefined, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n const onClick = get(['next', 'onClick'], correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick,\n label: next && next.label,\n 'data-name': `next-question-button-${slideIndex}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: correctionPopinProps.type,\n resultLabel: correctionPopinProps.resultLabel\n };\n\n const style = animateCorrectionPopin\n ? [styles.correctionPopinWrapper, translateUp.animatedStyle]\n : styles.correctionPopinWrapper;\n\n return (\n <Animated.View style={style}>\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </Animated.View>\n );\n};\n\ntype StyleSheetType = {\n questionHeading: ViewStyle;\n questionOrigin: ViewStyle;\n questionText: TextStyle;\n questionHelp: ViewStyle;\n choicesScrollView: ViewStyle;\n choicesScrollContent: ViewStyle;\n};\n\nconst createQuestionStyle = (theme: Theme): StyleSheetType =>\n StyleSheet.create({\n questionHeading: {\n justifyContent: 'space-between',\n alignItems: 'center'\n },\n questionOrigin: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.text.primary,\n marginBottom: theme.spacing.tiny,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n questionText: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n color: theme.colors.text.primary,\n textAlign: 'center'\n },\n questionHelp: {\n fontSize: 12,\n lineHeight: 16,\n color: theme.colors.gray.medium,\n marginBottom: 0,\n marginTop: theme.spacing.small,\n textAlign: 'center'\n },\n choicesScrollView: {\n marginTop: 20,\n width: '100%'\n },\n choicesScrollContent: {\n justifyContent: 'space-around',\n padding: 10\n }\n });\n\ntype QuestionProps = {\n autoplayMedia: boolean;\n answerUI: SlideProps['answerUI'];\n isKeyboardVisible: boolean;\n questionText: SlideProps['questionText'];\n questionOrigin: SlideProps['parentContentTitle'];\n};\n\nconst Question = (props: QuestionProps) => {\n const {\n answerUI,\n questionText,\n questionOrigin = '',\n isKeyboardVisible,\n autoplayMedia = false\n } = props;\n const {theme} = useTemplateContext();\n const [style, setStyle] = useState<StyleSheetType>();\n\n useEffect(() => {\n const questionStyle = createQuestionStyle(theme);\n setStyle(questionStyle);\n }, [theme]);\n\n if (!answerUI || !questionText || !style) return null;\n\n const hasVideoOrImage =\n answerUI.media?.type && [TYPE_VIDEO, TYPE_IMAGE].includes(answerUI.media.type);\n\n return (\n <>\n <View style={style.questionHeading}>\n <Html style={style.questionOrigin}>{questionOrigin}</Html>\n <Html style={style.questionText}>{questionText}</Html>\n <Html style={style.questionHelp}>{get('help', answerUI)}</Html>\n </View>\n <ScrollView\n style={style.choicesScrollView}\n contentContainerStyle={[\n style.choicesScrollContent,\n isKeyboardVisible\n ? {\n flex: 1\n }\n : null\n ]}\n centerContent\n showsHorizontalScrollIndicator={false}\n showsVerticalScrollIndicator={false}\n >\n {!isKeyboardVisible && hasVideoOrImage ? (\n <MediaView media={answerUI.media} autoplay={autoplayMedia} />\n ) : null}\n <View\n style={{\n flex: isKeyboardVisible ? 1 : 0,\n marginTop: hasVideoOrImage ? 30 : 0\n }}\n >\n <Answer {...answerUI} />\n </View>\n </ScrollView>\n </>\n );\n};\n\ntype SlideStyle = {\n slide: ViewStyle;\n hiddenBackgroundToLockActions: ViewStyle;\n};\n\nconst createSlideStyle = (\n num: number,\n screenWidth: number,\n isKeyboardVisible: boolean\n): SlideStyle => {\n const slideWidth = screenWidth - 40 - num * 8;\n\n return StyleSheet.create({\n hiddenBackgroundToLockActions: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n backgroundColor: '#00000000'\n },\n slide: {\n position: 'absolute',\n left: 20 + num * 4,\n bottom: (isKeyboardVisible ? 5 : 34) + num * 5,\n backgroundColor: '#fff', // theme.colors.white\n height: '90%',\n width: slideWidth,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n }\n });\n};\n\nconst Slide = (props: ReviewSlideProps) => {\n const {animatedStyle, slide, correctionPopinProps, validateButton, num, slideIndex = '0'} = props;\n const [isValidated, setValidated] = useState<boolean>(false);\n const [isKeyboardVisible, setKeyboardVisible] = useState<boolean>(false);\n\n useEffect(() => {\n const showListener = Keyboard.addListener('keyboardDidShow', () => {\n setKeyboardVisible(true);\n });\n\n const hideListener = Keyboard.addListener('keyboardDidHide', () => {\n setKeyboardVisible(false);\n });\n\n return () => {\n showListener.remove();\n hideListener.remove();\n };\n }, []);\n\n const handleValidatePress = useCallback(() => {\n Keyboard.dismiss();\n setValidated(true);\n\n // calling the onclick later, after react has rerendered, to display the locking BG as soon as possible\n setTimeout(() => {\n validateButton.onClick();\n }, 20);\n\n // only to create on mount\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const {width} = useWindowDimensions();\n const slideStyle = useMemo(\n () => createSlideStyle(num, width, isKeyboardVisible),\n [num, width, isKeyboardVisible]\n );\n const isFirstSlide = num === 1;\n\n const {\n loading,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n if (loading) {\n return <View style={slideStyle.slide} />;\n }\n\n return (\n <Animated.View style={[slideStyle.slide, animatedStyle]}>\n <Question\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n autoplayMedia={isFirstSlide}\n isKeyboardVisible={isKeyboardVisible}\n key=\"question-container\"\n />\n {isKeyboardVisible ? null : (\n <Button\n disabled={isValidated || validateButton.disabled}\n submitValue={validateButton.label}\n onPress={handleValidatePress}\n testID={`slide-validate-button-${slideIndex}`}\n />\n )}\n {isValidated ? <View style={slideStyle.hiddenBackgroundToLockActions} /> : null}\n {correctionPopinProps ? (\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ) : null}\n </Animated.View>\n );\n};\n\nexport default Slide;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,OAAvC,EAAgDC,QAAhD,QAA+D,OAA/D;AAEA,SACEC,QADF,EAEEC,MAFF,EAGEC,KAHF,EAIEC,QAJF,EAKEC,UALF,EAMEC,UANF,EAQEC,mBARF,EASEC,IATF,QAWO,cAXP;AAYA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,aAAR,QAA4B,sCAA5B;AACA,OAAOC,MAAP,MAAmB,oCAAnB;AACA,OAAOC,qBAAP,MAAkC,qDAAlC;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAEA,OAAOC,MAAP,MAAmB,gCAAnB;AACA,SAAQC,UAAR,EAAoBC,UAApB,EAAgCC,UAAhC,QAAiD,kCAAjD;AACA,OAAOC,KAAP,M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ified: PropTypes.Requireable<boolean>;
|
|
69
69
|
disabled: PropTypes.Requireable<boolean>;
|
|
70
70
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
72
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
73
71
|
}> | null | undefined)[]>;
|
|
74
72
|
'data-name': PropTypes.Requireable<string>;
|
|
75
73
|
}> | null | undefined>>;
|
|
@@ -195,8 +195,6 @@ declare namespace WizardContents {
|
|
|
195
195
|
modified: PropTypes.Requireable<boolean>;
|
|
196
196
|
disabled: PropTypes.Requireable<boolean>;
|
|
197
197
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
198
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
199
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
200
198
|
}> | PropTypes.InferProps<{
|
|
201
199
|
type: PropTypes.Requireable<string>;
|
|
202
200
|
tabProps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
@@ -315,8 +313,6 @@ declare namespace WizardContents {
|
|
|
315
313
|
modified: PropTypes.Requireable<boolean>;
|
|
316
314
|
disabled: PropTypes.Requireable<boolean>;
|
|
317
315
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
318
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
319
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
320
316
|
}> | PropTypes.InferProps<{
|
|
321
317
|
type: PropTypes.Requireable<string>;
|
|
322
318
|
title: PropTypes.Validator<string>;
|
|
@@ -707,8 +703,6 @@ declare namespace WizardContents {
|
|
|
707
703
|
modified: PropTypes.Requireable<boolean>;
|
|
708
704
|
disabled: PropTypes.Requireable<boolean>;
|
|
709
705
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
710
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
711
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
712
706
|
}> | null | undefined)[]>;
|
|
713
707
|
'data-name': PropTypes.Requireable<string>;
|
|
714
708
|
}> | null | undefined>>;
|
|
@@ -280,8 +280,6 @@ declare namespace BrandUpdate {
|
|
|
280
280
|
modified: PropTypes.Requireable<boolean>;
|
|
281
281
|
disabled: PropTypes.Requireable<boolean>;
|
|
282
282
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
283
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
284
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
285
283
|
}> | PropTypes.InferProps<{
|
|
286
284
|
type: PropTypes.Requireable<string>;
|
|
287
285
|
tabProps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
@@ -400,8 +398,6 @@ declare namespace BrandUpdate {
|
|
|
400
398
|
modified: PropTypes.Requireable<boolean>;
|
|
401
399
|
disabled: PropTypes.Requireable<boolean>;
|
|
402
400
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
403
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
404
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
405
401
|
}> | PropTypes.InferProps<{
|
|
406
402
|
type: PropTypes.Requireable<string>;
|
|
407
403
|
title: PropTypes.Validator<string>;
|
|
@@ -938,8 +934,6 @@ declare namespace BrandUpdate {
|
|
|
938
934
|
modified: PropTypes.Requireable<boolean>;
|
|
939
935
|
disabled: PropTypes.Requireable<boolean>;
|
|
940
936
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
941
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
942
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
943
937
|
}> | PropTypes.InferProps<{
|
|
944
938
|
type: PropTypes.Requireable<string>;
|
|
945
939
|
tabProps: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
@@ -1058,8 +1052,6 @@ declare namespace BrandUpdate {
|
|
|
1058
1052
|
modified: PropTypes.Requireable<boolean>;
|
|
1059
1053
|
disabled: PropTypes.Requireable<boolean>;
|
|
1060
1054
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
1061
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
1062
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
1063
1055
|
}> | PropTypes.InferProps<{
|
|
1064
1056
|
type: PropTypes.Requireable<string>;
|
|
1065
1057
|
title: PropTypes.Validator<string>;
|
|
@@ -1450,8 +1442,6 @@ declare namespace BrandUpdate {
|
|
|
1450
1442
|
modified: PropTypes.Requireable<boolean>;
|
|
1451
1443
|
disabled: PropTypes.Requireable<boolean>;
|
|
1452
1444
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
1453
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
1454
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
1455
1445
|
}> | null | undefined)[]>;
|
|
1456
1446
|
'data-name': PropTypes.Requireable<string>;
|
|
1457
1447
|
}> | null | undefined>>;
|
|
@@ -1520,7 +1510,6 @@ declare namespace BrandUpdate {
|
|
|
1520
1510
|
title: PropTypes.Validator<string>;
|
|
1521
1511
|
order: PropTypes.Requireable<number>;
|
|
1522
1512
|
'aria-label': PropTypes.Requireable<string>;
|
|
1523
|
-
contentType: PropTypes.Requireable<string>;
|
|
1524
1513
|
}> | null | undefined)[]>;
|
|
1525
1514
|
title: PropTypes.Requireable<string>;
|
|
1526
1515
|
}> | PropTypes.InferProps<{
|
|
@@ -35,8 +35,6 @@ declare namespace JwVideoUploader {
|
|
|
35
35
|
error: PropTypes.Requireable<string>;
|
|
36
36
|
buttonAriaLabel: PropTypes.Requireable<string>;
|
|
37
37
|
errorButtonLabel: PropTypes.Requireable<string>;
|
|
38
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
39
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
40
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-icons.d.ts","sourceRoot":"","sources":["../../src/util/button-icons.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button-icons.d.ts","sourceRoot":"","sources":["../../src/util/button-icons.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;EAkBE"}
|
package/es/util/button-icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NovaSolidRemoveAddAddCircle1 as AddIcon, NovaCompositionCoorpacademyAnalytics as AnalyticsIcon, NovaSolidContentEditionBin as BinIcon, NovaCompositionCoorpacademyBulletPoint as BulletPointIcon, NovaCompositionNavigationArrowLeft as ChevronLeftIcon, NovaCompositionNavigationArrowRight as ChevronRightIcon, NovaSolidStatusClose as CloseIcon, NovaSolidContentEditionPencilWrite as EditIcon, NovaCompositionCoorpacademyEye as EyeIcon, NovaSolidContentContentViewModule1 as ListIcon, NovaSolidLoginLogout1 as LogoutIcon, NovaSolidApplicationsWindowUpload3 as PublishIcon, NovaSolidComputersSdCard as SaveIcon, NovaLineLoginKey1 as KlfIcon, NovaSolidFilesFoldersFolders as FoldersIcon, NovaSolidFilesBasicFileUpload2 as UploadIcon, NovaCompositionNavigationArrowDown as ArrowDown
|
|
1
|
+
import { NovaSolidRemoveAddAddCircle1 as AddIcon, NovaCompositionCoorpacademyAnalytics as AnalyticsIcon, NovaSolidContentEditionBin as BinIcon, NovaCompositionCoorpacademyBulletPoint as BulletPointIcon, NovaCompositionNavigationArrowLeft as ChevronLeftIcon, NovaCompositionNavigationArrowRight as ChevronRightIcon, NovaSolidStatusClose as CloseIcon, NovaSolidContentEditionPencilWrite as EditIcon, NovaCompositionCoorpacademyEye as EyeIcon, NovaSolidContentContentViewModule1 as ListIcon, NovaSolidLoginLogout1 as LogoutIcon, NovaSolidApplicationsWindowUpload3 as PublishIcon, NovaSolidComputersSdCard as SaveIcon, NovaLineLoginKey1 as KlfIcon, NovaSolidFilesFoldersFolders as FoldersIcon, NovaSolidFilesBasicFileUpload2 as UploadIcon, NovaCompositionNavigationArrowDown as ArrowDown } from '@coorpacademy/nova-icons';
|
|
2
2
|
export const ICONS = {
|
|
3
3
|
add: AddIcon,
|
|
4
4
|
analytics: AnalyticsIcon,
|
|
@@ -16,7 +16,6 @@ export const ICONS = {
|
|
|
16
16
|
see: EyeIcon,
|
|
17
17
|
folders: FoldersIcon,
|
|
18
18
|
upload: UploadIcon,
|
|
19
|
-
down: ArrowDown
|
|
20
|
-
pdf: PDF
|
|
19
|
+
down: ArrowDown
|
|
21
20
|
};
|
|
22
21
|
//# sourceMappingURL=button-icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-icons.js","names":["NovaSolidRemoveAddAddCircle1","AddIcon","NovaCompositionCoorpacademyAnalytics","AnalyticsIcon","NovaSolidContentEditionBin","BinIcon","NovaCompositionCoorpacademyBulletPoint","BulletPointIcon","NovaCompositionNavigationArrowLeft","ChevronLeftIcon","NovaCompositionNavigationArrowRight","ChevronRightIcon","NovaSolidStatusClose","CloseIcon","NovaSolidContentEditionPencilWrite","EditIcon","NovaCompositionCoorpacademyEye","EyeIcon","NovaSolidContentContentViewModule1","ListIcon","NovaSolidLoginLogout1","LogoutIcon","NovaSolidApplicationsWindowUpload3","PublishIcon","NovaSolidComputersSdCard","SaveIcon","NovaLineLoginKey1","KlfIcon","NovaSolidFilesFoldersFolders","FoldersIcon","NovaSolidFilesBasicFileUpload2","UploadIcon","NovaCompositionNavigationArrowDown","ArrowDown","
|
|
1
|
+
{"version":3,"file":"button-icons.js","names":["NovaSolidRemoveAddAddCircle1","AddIcon","NovaCompositionCoorpacademyAnalytics","AnalyticsIcon","NovaSolidContentEditionBin","BinIcon","NovaCompositionCoorpacademyBulletPoint","BulletPointIcon","NovaCompositionNavigationArrowLeft","ChevronLeftIcon","NovaCompositionNavigationArrowRight","ChevronRightIcon","NovaSolidStatusClose","CloseIcon","NovaSolidContentEditionPencilWrite","EditIcon","NovaCompositionCoorpacademyEye","EyeIcon","NovaSolidContentContentViewModule1","ListIcon","NovaSolidLoginLogout1","LogoutIcon","NovaSolidApplicationsWindowUpload3","PublishIcon","NovaSolidComputersSdCard","SaveIcon","NovaLineLoginKey1","KlfIcon","NovaSolidFilesFoldersFolders","FoldersIcon","NovaSolidFilesBasicFileUpload2","UploadIcon","NovaCompositionNavigationArrowDown","ArrowDown","ICONS","add","analytics","bin","close","edit","key","list","logout","publish","save","see","folders","upload","down"],"sources":["../../src/util/button-icons.js"],"sourcesContent":["import {\n NovaSolidRemoveAddAddCircle1 as AddIcon,\n NovaCompositionCoorpacademyAnalytics as AnalyticsIcon,\n NovaSolidContentEditionBin as BinIcon,\n NovaCompositionCoorpacademyBulletPoint as BulletPointIcon,\n NovaCompositionNavigationArrowLeft as ChevronLeftIcon,\n NovaCompositionNavigationArrowRight as ChevronRightIcon,\n NovaSolidStatusClose as CloseIcon,\n NovaSolidContentEditionPencilWrite as EditIcon,\n NovaCompositionCoorpacademyEye as EyeIcon,\n NovaSolidContentContentViewModule1 as ListIcon,\n NovaSolidLoginLogout1 as LogoutIcon,\n NovaSolidApplicationsWindowUpload3 as PublishIcon,\n NovaSolidComputersSdCard as SaveIcon,\n NovaLineLoginKey1 as KlfIcon,\n NovaSolidFilesFoldersFolders as FoldersIcon,\n NovaSolidFilesBasicFileUpload2 as UploadIcon,\n NovaCompositionNavigationArrowDown as ArrowDown\n} from '@coorpacademy/nova-icons';\n\nexport const ICONS = {\n add: AddIcon,\n analytics: AnalyticsIcon,\n bin: BinIcon,\n 'bullet-point': BulletPointIcon,\n 'chevron-left': ChevronLeftIcon,\n 'chevron-right': ChevronRightIcon,\n close: CloseIcon,\n edit: EditIcon,\n key: KlfIcon,\n list: ListIcon,\n logout: LogoutIcon,\n publish: PublishIcon,\n save: SaveIcon,\n see: EyeIcon,\n folders: FoldersIcon,\n upload: UploadIcon,\n down: ArrowDown\n};\n"],"mappings":"AAAA,SACEA,4BAA4B,IAAIC,OADlC,EAEEC,oCAAoC,IAAIC,aAF1C,EAGEC,0BAA0B,IAAIC,OAHhC,EAIEC,sCAAsC,IAAIC,eAJ5C,EAKEC,kCAAkC,IAAIC,eALxC,EAMEC,mCAAmC,IAAIC,gBANzC,EAOEC,oBAAoB,IAAIC,SAP1B,EAQEC,kCAAkC,IAAIC,QARxC,EASEC,8BAA8B,IAAIC,OATpC,EAUEC,kCAAkC,IAAIC,QAVxC,EAWEC,qBAAqB,IAAIC,UAX3B,EAYEC,kCAAkC,IAAIC,WAZxC,EAaEC,wBAAwB,IAAIC,QAb9B,EAcEC,iBAAiB,IAAIC,OAdvB,EAeEC,4BAA4B,IAAIC,WAflC,EAgBEC,8BAA8B,IAAIC,UAhBpC,EAiBEC,kCAAkC,IAAIC,SAjBxC,QAkBO,0BAlBP;AAoBA,OAAO,MAAMC,KAAK,GAAG;EACnBC,GAAG,EAAElC,OADc;EAEnBmC,SAAS,EAAEjC,aAFQ;EAGnBkC,GAAG,EAAEhC,OAHc;EAInB,gBAAgBE,eAJG;EAKnB,gBAAgBE,eALG;EAMnB,iBAAiBE,gBANE;EAOnB2B,KAAK,EAAEzB,SAPY;EAQnB0B,IAAI,EAAExB,QARa;EASnByB,GAAG,EAAEb,OATc;EAUnBc,IAAI,EAAEtB,QAVa;EAWnBuB,MAAM,EAAErB,UAXW;EAYnBsB,OAAO,EAAEpB,WAZU;EAanBqB,IAAI,EAAEnB,QAba;EAcnBoB,GAAG,EAAE5B,OAdc;EAenB6B,OAAO,EAAEjB,WAfU;EAgBnBkB,MAAM,EAAEhB,UAhBW;EAiBnBiB,IAAI,EAAEf;AAjBa,CAAd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proptypes.d.ts","sourceRoot":"","sources":["../../src/util/proptypes.js"],"names":[],"mappings":"AASA,8BAAsD;AAGtD,+BAAwD;AAExD,qDAA4E;AAErE,+
|
|
1
|
+
{"version":3,"file":"proptypes.d.ts","sourceRoot":"","sources":["../../src/util/proptypes.js"],"names":[],"mappings":"AASA,8BAAsD;AAGtD,+BAAwD;AAExD,qDAA4E;AAErE,+FAKN;AAED,gCAA4C;AAC5C,8BAAwC"}
|
package/es/util/proptypes.js
CHANGED
|
@@ -9,8 +9,8 @@ const PATH_REGEXP = /^\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/;
|
|
|
9
9
|
export const PathPropType = stringMatching(PATH_REGEXP);
|
|
10
10
|
export const SrcPropType = PropTypes.oneOfType([UrlPropType, PathPropType]);
|
|
11
11
|
export const ImagePropType = (propValue, key, componentName) => {
|
|
12
|
-
if (includes(propValue[key], ['
|
|
13
|
-
return new Error(`Invalid prop value: ${propValue[key]}, at component: ${componentName}. Expected a valid image type:
|
|
12
|
+
if (includes(propValue[key], ['jpg', 'png', 'svg+xml'])) return;
|
|
13
|
+
return new Error(`Invalid prop value: ${propValue[key]}, at component: ${componentName}. Expected a valid image type: jpg, png or svg+xml.`);
|
|
14
14
|
};
|
|
15
15
|
export const ColorPropType = _ColorPropType;
|
|
16
16
|
export const HexPropType = _HexPropType;
|
package/es/util/proptypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proptypes.js","names":["PropTypes","includes","stringMatching","_ColorPropType","_HexPropType","URL_REGEXP","UrlPropType","PATH_REGEXP","PathPropType","SrcPropType","oneOfType","ImagePropType","propValue","key","componentName","Error","ColorPropType","HexPropType"],"sources":["../../src/util/proptypes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport includes from 'lodash/fp/includes';\nimport stringMatching from 'extended-proptypes/lib/validators/stringMatching';\n\nimport _ColorPropType from 'extended-proptypes/lib/validators/color';\nimport _HexPropType from 'extended-proptypes/lib/validators/hex';\n\nconst URL_REGEXP =\n /^(http(s)?:\\/\\/.)[-a-zA-Z0-9@:%._\\\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const UrlPropType = stringMatching(URL_REGEXP);\n\nconst PATH_REGEXP = /^\\/([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const PathPropType = stringMatching(PATH_REGEXP);\n\nexport const SrcPropType = PropTypes.oneOfType([UrlPropType, PathPropType]);\n\nexport const ImagePropType = (propValue, key, componentName) => {\n if (includes(propValue[key], ['
|
|
1
|
+
{"version":3,"file":"proptypes.js","names":["PropTypes","includes","stringMatching","_ColorPropType","_HexPropType","URL_REGEXP","UrlPropType","PATH_REGEXP","PathPropType","SrcPropType","oneOfType","ImagePropType","propValue","key","componentName","Error","ColorPropType","HexPropType"],"sources":["../../src/util/proptypes.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport includes from 'lodash/fp/includes';\nimport stringMatching from 'extended-proptypes/lib/validators/stringMatching';\n\nimport _ColorPropType from 'extended-proptypes/lib/validators/color';\nimport _HexPropType from 'extended-proptypes/lib/validators/hex';\n\nconst URL_REGEXP =\n /^(http(s)?:\\/\\/.)[-a-zA-Z0-9@:%._\\\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const UrlPropType = stringMatching(URL_REGEXP);\n\nconst PATH_REGEXP = /^\\/([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)$/;\nexport const PathPropType = stringMatching(PATH_REGEXP);\n\nexport const SrcPropType = PropTypes.oneOfType([UrlPropType, PathPropType]);\n\nexport const ImagePropType = (propValue, key, componentName) => {\n if (includes(propValue[key], ['jpg', 'png', 'svg+xml'])) return;\n return new Error(\n `Invalid prop value: ${propValue[key]}, at component: ${componentName}. Expected a valid image type: jpg, png or svg+xml.`\n );\n};\n\nexport const ColorPropType = _ColorPropType;\nexport const HexPropType = _HexPropType;\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,cAAP,MAA2B,kDAA3B;AAEA,OAAOC,cAAP,MAA2B,yCAA3B;AACA,OAAOC,YAAP,MAAyB,uCAAzB;AAEA,MAAMC,UAAU,GACd,8FADF;AAEA,OAAO,MAAMC,WAAW,GAAGJ,cAAc,CAACG,UAAD,CAAlC;AAEP,MAAME,WAAW,GAAG,oCAApB;AACA,OAAO,MAAMC,YAAY,GAAGN,cAAc,CAACK,WAAD,CAAnC;AAEP,OAAO,MAAME,WAAW,GAAGT,SAAS,CAACU,SAAV,CAAoB,CAACJ,WAAD,EAAcE,YAAd,CAApB,CAApB;AAEP,OAAO,MAAMG,aAAa,GAAG,CAACC,SAAD,EAAYC,GAAZ,EAAiBC,aAAjB,KAAmC;EAC9D,IAAIb,QAAQ,CAACW,SAAS,CAACC,GAAD,CAAV,EAAiB,CAAC,KAAD,EAAQ,KAAR,EAAe,SAAf,CAAjB,CAAZ,EAAyD;EACzD,OAAO,IAAIE,KAAJ,CACJ,uBAAsBH,SAAS,CAACC,GAAD,CAAM,mBAAkBC,aAAc,qDADjE,CAAP;AAGD,CALM;AAOP,OAAO,MAAME,aAAa,GAAGb,cAAtB;AACP,OAAO,MAAMc,WAAW,GAAGb,YAApB"}
|
|
@@ -18,8 +18,6 @@ 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>;
|
|
23
21
|
};
|
|
24
22
|
constructor(props: any);
|
|
25
23
|
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;;;;;;;;;;;;;;;;;;MAkBE;IAEF,wBASC;IANC;;MAEC;IAMH,wBAIC;IAED,uBAIC;IAED,sBAmJC;CACF"}
|
|
@@ -68,9 +68,7 @@ class DragAndDrop extends _react.default.Component {
|
|
|
68
68
|
error = '',
|
|
69
69
|
buttonAriaLabel = '',
|
|
70
70
|
errorButtonLabel = '',
|
|
71
|
-
disabled = false
|
|
72
|
-
pdfButtonLabel,
|
|
73
|
-
pdfButtonAriaLabel
|
|
71
|
+
disabled = false
|
|
74
72
|
} = this.props;
|
|
75
73
|
const {
|
|
76
74
|
dragging
|
|
@@ -91,26 +89,6 @@ class DragAndDrop extends _react.default.Component {
|
|
|
91
89
|
src: previewContent.src,
|
|
92
90
|
type: "video/*"
|
|
93
91
|
}));
|
|
94
|
-
} else if (previewContent && previewContent.type === 'pdf') {
|
|
95
|
-
previewView = /*#__PURE__*/_react.default.createElement("div", {
|
|
96
|
-
className: _style.default.previewPdf
|
|
97
|
-
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
98
|
-
className: _style.default.previewLabelPdf
|
|
99
|
-
}, previewLabel), /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
|
|
100
|
-
type: "secondary",
|
|
101
|
-
link: {
|
|
102
|
-
href: previewContent.src,
|
|
103
|
-
target: '_blank',
|
|
104
|
-
download: false
|
|
105
|
-
},
|
|
106
|
-
label: pdfButtonLabel,
|
|
107
|
-
"aria-label": pdfButtonAriaLabel,
|
|
108
|
-
"data-name": "default-button-pdf",
|
|
109
|
-
icon: {
|
|
110
|
-
position: 'left',
|
|
111
|
-
type: 'pdf'
|
|
112
|
-
}
|
|
113
|
-
}));
|
|
114
92
|
} else if (loading) {
|
|
115
93
|
previewView = /*#__PURE__*/_react.default.createElement("div", {
|
|
116
94
|
className: _style.default.loaderWrapper
|
|
@@ -216,9 +194,7 @@ DragAndDrop.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
216
194
|
onReset: _propTypes.default.func,
|
|
217
195
|
error: _propTypes.default.string,
|
|
218
196
|
buttonAriaLabel: _propTypes.default.string,
|
|
219
|
-
errorButtonLabel: _propTypes.default.string
|
|
220
|
-
pdfButtonLabel: _propTypes.default.string,
|
|
221
|
-
pdfButtonAriaLabel: _propTypes.default.string
|
|
197
|
+
errorButtonLabel: _propTypes.default.string
|
|
222
198
|
} : {};
|
|
223
199
|
var _default = DragAndDrop;
|
|
224
200
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["constantNull","DragAndDrop","React","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","style","preview","src","previewPdf","previewLabelPdf","href","target","download","position","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","classnames","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","button","previewContainer","getClassState","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","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 )}\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AAQ,CAAC,KAAKN,eAAN,EAAuB,KAAKE,cAA5B,CAAd,CAlBF,CAPJ,EA4BGa,KAAK,gBACJ;MAAM,SAAS,EAAE,IAAAuB,mBAAA,EAAWf,cAAA,CAAMiC,YAAjB,EAA+BtC,QAAQ,IAAIK,cAAA,CAAML,QAAjD;IAAjB,GACGH,KADH,CADI,GAKJsB,YAjCJ,CADF;EAsCD;;AApNuC;;AAApC5C,W,CACGgE,S,2CAAY;EACjBlD,KAAK,EAAEmD,kBAAA,CAAUC,MADA;EAEjBnD,WAAW,EAAEkD,kBAAA,CAAUC,MAFN;EAGjBlD,WAAW,EAAEiD,kBAAA,CAAUC,MAHN;EAIjBjD,YAAY,EAAEgD,kBAAA,CAAUC,MAJP;EAKjBhD,cAAc,EAAE+C,kBAAA,CAAUE,KAAV,CAAgB;IAC9BtC,IAAI,EAAEoC,kBAAA,CAAUC,MADc;IAE9BlC,GAAG,EAAEiC,kBAAA,CAAUC,MAFe;IAG9BlB,KAAK,EAAEiB,kBAAA,CAAUC;EAHa,CAAhB,CALC;EAUjB/C,OAAO,EAAE8C,kBAAA,CAAUG,IAVF;EAWjBhD,QAAQ,EAAE6C,kBAAA,CAAUG,IAXH;EAYjB3C,QAAQ,EAAEwC,kBAAA,CAAUG,IAZH;EAajBvD,QAAQ,EAAEoD,kBAAA,CAAUI,IAbH;EAcjBhD,OAAO,EAAE4C,kBAAA,CAAUI,IAdF;EAejB/C,KAAK,EAAE2C,kBAAA,CAAUC,MAfA;EAgBjB3C,eAAe,EAAE0C,kBAAA,CAAUC,MAhBV;EAiBjB1C,gBAAgB,EAAEyC,kBAAA,CAAUC,MAjBX;EAkBjBxC,cAAc,EAAEuC,kBAAA,CAAUC,MAlBT;EAmBjBvC,kBAAkB,EAAEsC,kBAAA,CAAUC;AAnBb,C;eAsNNlE,W"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["constantNull","DragAndDrop","React","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","style","preview","src","loaderWrapper","loadingCancel","closeIcon","loader","loaderText","resetContent","classnames","resetUploadWrapper","resetSrcLabel","label","buildButton","defaultButtonProps","icon","position","button","previewContainer","getClassState","modifiedPreviewContainer","inputWrapper","modifiedInputWrapper","errorInputWrapper","wrapper","infosContainer","iconError","dragAndDropLabel","errorMessage","propTypes","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;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,YAAY,GAAG,wBAAS,IAAT,CAArB;;AAEA,MAAMC,WAAN,SAA0BC,cAAA,CAAMC,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,CAAoBD,IAApB,CAAyB,IAAzB,CAAtB;EACD;;EAEDD,eAAe,GAAG;IAChB,KAAKG,QAAL,CAAc;MACZJ,QAAQ,EAAE;IADE,CAAd;EAGD;;EAEDG,cAAc,GAAG;IACf,KAAKC,QAAL,CAAc;MACZJ,QAAQ,EAAE;IADE,CAAd;EAGD;;EAEDK,MAAM,GAAG;IACP,MAAMC,KAAK,GAAG,wBAAS,WAAT,CAAd;IACA,MAAM;MACJC,QAAQ,GAAGd,YADP;MAEJe,K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,KAAK,gBACJ;MAAM,SAAS,EAAE,IAAAe,mBAAA,EAAWT,cAAA,CAAM4B,YAAjB,EAA+B/B,QAAQ,IAAIG,cAAA,CAAMH,QAAjD;IAAjB,GACGH,KADH,CADI,GAKJc,YAjCJ,CADF;EAsCD;;AA/LuC;;AAApCpC,W,CACGyD,S,2CAAY;EACjB3C,KAAK,EAAE4C,kBAAA,CAAUC,MADA;EAEjB5C,WAAW,EAAE2C,kBAAA,CAAUC,MAFN;EAGjB3C,WAAW,EAAE0C,kBAAA,CAAUC,MAHN;EAIjB1C,YAAY,EAAEyC,kBAAA,CAAUC,MAJP;EAKjBzC,cAAc,EAAEwC,kBAAA,CAAUE,KAAV,CAAgB;IAC9BjC,IAAI,EAAE+B,kBAAA,CAAUC,MADc;IAE9B7B,GAAG,EAAE4B,kBAAA,CAAUC,MAFe;IAG9BnB,KAAK,EAAEkB,kBAAA,CAAUC;EAHa,CAAhB,CALC;EAUjBxC,OAAO,EAAEuC,kBAAA,CAAUG,IAVF;EAWjBzC,QAAQ,EAAEsC,kBAAA,CAAUG,IAXH;EAYjBpC,QAAQ,EAAEiC,kBAAA,CAAUG,IAZH;EAajBhD,QAAQ,EAAE6C,kBAAA,CAAUI,IAbH;EAcjBzC,OAAO,EAAEqC,kBAAA,CAAUI,IAdF;EAejBxC,KAAK,EAAEoC,kBAAA,CAAUC,MAfA;EAgBjBpC,eAAe,EAAEmC,kBAAA,CAAUC,MAhBV;EAiBjBnC,gBAAgB,EAAEkC,kBAAA,CAAUC;AAjBX,C;eAiMN3D,W"}
|
|
@@ -78,31 +78,12 @@
|
|
|
78
78
|
background-color: white;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
.preview img,
|
|
82
|
-
video {
|
|
81
|
+
.preview img, video {
|
|
83
82
|
max-width: 100%;
|
|
84
83
|
max-height: 100%;
|
|
85
84
|
margin: auto;
|
|
86
85
|
}
|
|
87
86
|
|
|
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
|
-
}
|
|
106
87
|
.infosContainer {
|
|
107
88
|
width: 100%;
|
|
108
89
|
height: 100%;
|
|
@@ -171,7 +152,7 @@ video {
|
|
|
171
152
|
align-items: center;
|
|
172
153
|
justify-content: space-between;
|
|
173
154
|
margin-top: 16px;
|
|
174
|
-
padding:
|
|
155
|
+
padding: 4px 8px;
|
|
175
156
|
font-size: 12px;
|
|
176
157
|
font-weight: 400;
|
|
177
158
|
position: relative;
|
|
@@ -183,6 +164,9 @@ video {
|
|
|
183
164
|
text-overflow: ellipsis;
|
|
184
165
|
white-space: nowrap;
|
|
185
166
|
flex-wrap: nowrap;
|
|
167
|
+
position: absolute;
|
|
168
|
+
left: 0;
|
|
169
|
+
right: 15px;
|
|
186
170
|
}
|
|
187
171
|
|
|
188
172
|
.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 }: {
|
|
3
3
|
title: any;
|
|
4
4
|
description: any;
|
|
5
5
|
previewLabel: any;
|
|
@@ -18,8 +18,6 @@ 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;
|
|
23
21
|
}): JSX.Element;
|
|
24
22
|
declare namespace ImageUpload {
|
|
25
23
|
const propTypes: {
|
|
@@ -45,8 +43,6 @@ declare namespace ImageUpload {
|
|
|
45
43
|
modified: PropTypes.Requireable<boolean>;
|
|
46
44
|
disabled: PropTypes.Requireable<boolean>;
|
|
47
45
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
-
pdfButtonLabel: PropTypes.Requireable<string>;
|
|
49
|
-
pdfButtonAriaLabel: PropTypes.Requireable<string>;
|
|
50
46
|
};
|
|
51
47
|
}
|
|
52
48
|
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;;;;;;;;;;;;;;;;;;;gBAmFC"}
|
|
@@ -5,6 +5,12 @@ exports.default = void 0;
|
|
|
5
5
|
|
|
6
6
|
var _isNil2 = _interopRequireDefault(require("lodash/fp/isNil"));
|
|
7
7
|
|
|
8
|
+
var _pipe2 = _interopRequireDefault(require("lodash/fp/pipe"));
|
|
9
|
+
|
|
10
|
+
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
|
|
11
|
+
|
|
12
|
+
var _join2 = _interopRequireDefault(require("lodash/fp/join"));
|
|
13
|
+
|
|
8
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
15
|
|
|
10
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -37,22 +43,21 @@ const ImageUpload = ({
|
|
|
37
43
|
onChange,
|
|
38
44
|
onReset = null,
|
|
39
45
|
name,
|
|
46
|
+
// See ImagePropType for accepted values
|
|
40
47
|
labelLink,
|
|
41
48
|
labelButtonLink,
|
|
42
49
|
hrefLink,
|
|
43
|
-
// See ImagePropType for accepted values
|
|
44
50
|
imageTypes = ['*'],
|
|
45
51
|
error = '',
|
|
46
52
|
buttonAriaLabel,
|
|
47
|
-
errorButtonLabel
|
|
48
|
-
pdfButtonLabel,
|
|
49
|
-
pdfButtonAriaLabel
|
|
53
|
+
errorButtonLabel
|
|
50
54
|
}) => {
|
|
51
55
|
const handleReset = (0, _react.useCallback)(e => {
|
|
52
56
|
if ((0, _isNil2.default)(onReset)) return;
|
|
53
57
|
e.preventDefault();
|
|
54
58
|
return onReset(e);
|
|
55
59
|
}, [onReset]);
|
|
60
|
+
const acceptedImages = (0, _pipe2.default)((0, _map2.default)(t => `image/${t}`), (0, _join2.default)(','))(imageTypes);
|
|
56
61
|
const linkCustomStyle = {
|
|
57
62
|
width: '40px',
|
|
58
63
|
color: 'red'
|
|
@@ -69,13 +74,11 @@ const ImageUpload = ({
|
|
|
69
74
|
error: error,
|
|
70
75
|
disabled: disabled,
|
|
71
76
|
buttonAriaLabel: buttonAriaLabel,
|
|
72
|
-
errorButtonLabel: errorButtonLabel
|
|
73
|
-
pdfButtonLabel: pdfButtonLabel,
|
|
74
|
-
pdfButtonAriaLabel: pdfButtonAriaLabel
|
|
77
|
+
errorButtonLabel: errorButtonLabel
|
|
75
78
|
}, (onDragStart, onDragStop) => /*#__PURE__*/_react.default.createElement("input", {
|
|
76
79
|
type: "file",
|
|
77
80
|
name: name,
|
|
78
|
-
accept:
|
|
81
|
+
accept: acceptedImages,
|
|
79
82
|
disabled: loading || disabled,
|
|
80
83
|
className: _style.default.input,
|
|
81
84
|
onChange: onChange,
|