@coorpacademy/components 10.22.25 → 10.22.27-alpha.0
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/provider/web-context.js +6 -1
- package/es/atom/provider/web-context.js.map +1 -1
- package/es/organism/review-slide/index.js +1 -1
- package/es/organism/review-slide/index.js.map +1 -1
- package/es/organism/review-stacked-slides/prop-types.js +6 -6
- package/es/organism/review-stacked-slides/prop-types.js.map +1 -1
- package/es/util/proptypes.js +2 -2
- package/es/util/proptypes.js.map +1 -1
- package/lib/atom/provider/web-context.js +6 -1
- package/lib/atom/provider/web-context.js.map +1 -1
- package/lib/organism/review-slide/index.js +1 -1
- package/lib/organism/review-slide/index.js.map +1 -1
- package/lib/organism/review-stacked-slides/prop-types.js +5 -5
- package/lib/organism/review-stacked-slides/prop-types.js.map +1 -1
- package/lib/util/proptypes.js +5 -5
- package/lib/util/proptypes.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,9 +6,14 @@ const Context = createContext({
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const WebContext = ({
|
|
9
|
-
|
|
9
|
+
skin,
|
|
10
|
+
translate,
|
|
10
11
|
children
|
|
11
12
|
}) => {
|
|
13
|
+
const values = {
|
|
14
|
+
skin,
|
|
15
|
+
translate
|
|
16
|
+
};
|
|
12
17
|
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
13
18
|
value: _extends({}, values)
|
|
14
19
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/provider/web-context.tsx"],"names":["React","createContext","useContext","Context","translate","key","WebContext","
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/provider/web-context.tsx"],"names":["React","createContext","useContext","Context","translate","key","WebContext","skin","children","values","useWebContext","context","Error"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,aAAf,EAA8BC,UAA9B,QAA+C,OAA/C;AAaA,MAAMC,OAAO,GAAGF,aAAa,CAAC;AAC5BG,EAAAA,SAAS,EAAGC,GAAD,IAAiBA;AADA,CAAD,CAA7B;;AAQA,MAAMC,UAAU,GAAG,CAAC;AAACC,EAAAA,IAAD;AAAOH,EAAAA,SAAP;AAAkBI,EAAAA;AAAlB,CAAD,KAAwC;AACzD,QAAMC,MAAM,GAAG;AAACF,IAAAA,IAAD;AAAOH,IAAAA;AAAP,GAAf;AACA,sBAAO,oBAAC,OAAD,CAAS,QAAT;AAAkB,IAAA,KAAK,eAAMK,MAAN;AAAvB,KAAuCD,QAAvC,CAAP;AACD,CAHD;;AAKA,OAAO,MAAME,aAAa,GAAG,MAAwB;AACnD,QAAMC,OAAO,GAAGT,UAAU,CAACC,OAAD,CAA1B;;AAEA,MAAI,CAACQ,OAAL,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,0EAAV,CAAN;AACD;;AAED,SAAOD,OAAP;AACD,CARM;AAUP,eAAeL,UAAf","sourcesContent":["import React, {createContext, useContext} from 'react';\n\ntype Skin = {\n common: {\n primary: string;\n };\n};\n\ntype WebContextValues = {\n skin?: Skin;\n translate: (key: string) => string;\n};\n\nconst Context = createContext({\n translate: (key: string) => key\n});\n\ntype Props = WebContextValues & {\n children: any;\n};\n\nconst WebContext = ({skin, translate, children}: Props) => {\n const values = {skin, translate};\n return <Context.Provider value={{...values}}>{children}</Context.Provider>;\n};\n\nexport const useWebContext = (): WebContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error('❌ [WebContext] useWebContext must be used within a provider <WebContext>');\n }\n\n return context;\n};\n\nexport default WebContext;\n"],"file":"web-context.js"}
|
|
@@ -168,7 +168,7 @@ const ReviewSlide = props => {
|
|
|
168
168
|
questionOrigin: parentContentTitle,
|
|
169
169
|
questionText: questionText,
|
|
170
170
|
answerUI: answerUI,
|
|
171
|
-
disableContent:
|
|
171
|
+
disableContent: showCorrectionPopin,
|
|
172
172
|
key: "question-container"
|
|
173
173
|
}), /*#__PURE__*/React.createElement(ValidateButton, {
|
|
174
174
|
slideIndex: slideIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["React","useMemo","PropTypes","classnames","get","getOr","Answer","ButtonLink","Loader","ReviewCorrectionPopin","GetSkinFromContext","propTypes","style","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","correctionPopinWrapper","popinAnimation","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,qBAAP,MAAkC,wCAAlC;AACA,SAAQC,kBAAR,QAAiC,qBAAjC;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GAAG,GAAGb,KAAK,CAAC,EAAD,EAAK,KAAL,EAAYS,oBAAZ,CAAjB;AACA,QAAMK,WAAW,GAAGd,KAAK,CAAC;AAACe,IAAAA,KA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AAAA,mBANI;AAOJC,IAAAA;AAPI,MAQFsC,KARJ;AAUA,sBACE;AAAK,iBAAY,iBAAjB;AAAmC,IAAA,SAAS,EAAE3C,KAAK,CAAC2C;AAApD,KACGG,OAAO,gBACN,oBAAC,MAAD;AAAQ,IAAA,SAAS,EAAE9C,KAAK,CAACiD,MAAzB;AAAiC,IAAA,KAAK,EAAC,SAAvC;AAAiD,kBAAYF;AAA7D,IADM,GAGN,cACE,oBAAC,iBAAD;AACE,IAAA,cAAc,EAAEC,kBADlB;AAEE,IAAA,YAAY,EAAEf,YAFhB;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,cAAc,EAAE,CAAC5B,mBAJnB;AAKE,IAAA,GAAG,EAAC;AALN,IADF,eAQE,oBAAC,cAAD;AACE,IAAA,UAAU,EAAED,UADd;AAEE,IAAA,cAAc,EAAEmB,cAFlB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,GAAG,EAAC;AAJN,IARF,eAcE,oBAAC,eAAD;AACE,IAAA,oBAAoB,EAAErB,oBADxB;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,mBAAmB,EAAEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAdF,CAJJ,CADF;AA8BD,CA7CD;;AA+CAuC,WAAW,CAAC7C,SAAZ,2CAAwBA,SAAxB;AAEA,eAAe6C,WAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport {GetSkinFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\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 return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': label,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n /*\n slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = props => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext();\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n [\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={!showCorrectionPopin}\n key=\"question-container\"\n />,\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n />,\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ]\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nexport default ReviewSlide;\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["React","useMemo","PropTypes","classnames","get","getOr","Answer","ButtonLink","Loader","ReviewCorrectionPopin","GetSkinFromContext","propTypes","style","CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","correctionPopinWrapper","popinAnimation","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,MAAP,MAAmB,uBAAnB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,qBAAP,MAAkC,wCAAlC;AACA,SAAQC,kBAAR,QAAiC,qBAAjC;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GAAG,GAAGb,KAAK,CAAC,EAAD,EAAK,KAAL,EAAYS,oBAAZ,CAAjB;AACA,QAAMK,WAAW,GAAGd,KAAK,CAAC;AAACe,IAAAA,KAAK,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAA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,sBACE;AAAK,iBAAY,iBAAjB;AAAmC,IAAA,SAAS,EAAE3C,KAAK,CAAC2C;AAApD,KACGG,OAAO,gBACN,oBAAC,MAAD;AAAQ,IAAA,SAAS,EAAE9C,KAAK,CAACiD,MAAzB;AAAiC,IAAA,KAAK,EAAC,SAAvC;AAAiD,kBAAYF;AAA7D,IADM,GAGN,cACE,oBAAC,iBAAD;AACE,IAAA,cAAc,EAAEC,kBADlB;AAEE,IAAA,YAAY,EAAEf,YAFhB;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,cAAc,EAAE5B,mBAJlB;AAKE,IAAA,GAAG,EAAC;AALN,IADF,eAQE,oBAAC,cAAD;AACE,IAAA,UAAU,EAAED,UADd;AAEE,IAAA,cAAc,EAAEmB,cAFlB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,GAAG,EAAC;AAJN,IARF,eAcE,oBAAC,eAAD;AACE,IAAA,oBAAoB,EAAErB,oBADxB;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,mBAAmB,EAAEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAdF,CAJJ,CADF;AA8BD,CA7CD;;AA+CAuC,WAAW,CAAC7C,SAAZ,2CAAwBA,SAAxB;AAEA,eAAe6C,WAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport {GetSkinFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\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 return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': label,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n /*\n slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = props => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext();\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n [\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={showCorrectionPopin}\n key=\"question-container\"\n />,\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n />,\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ]\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nexport default ReviewSlide;\n"],"file":"index.js"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import ReviewSlideProps, {
|
|
2
|
+
import ReviewSlideProps, { SlidePropsTypes } from '../review-slide/prop-types';
|
|
3
3
|
const propTypes = {
|
|
4
4
|
validateButton: ReviewSlideProps.validateButton,
|
|
5
5
|
correctionPopinProps: ReviewSlideProps.correctionPopinProps,
|
|
6
6
|
slides: PropTypes.shape({
|
|
7
|
-
'0':
|
|
8
|
-
'1':
|
|
9
|
-
'2':
|
|
10
|
-
'3':
|
|
11
|
-
'4':
|
|
7
|
+
'0': SlidePropsTypes,
|
|
8
|
+
'1': SlidePropsTypes,
|
|
9
|
+
'2': SlidePropsTypes,
|
|
10
|
+
'3': SlidePropsTypes,
|
|
11
|
+
'4': SlidePropsTypes
|
|
12
12
|
}).isRequired,
|
|
13
13
|
endReview: PropTypes.bool
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/organism/review-stacked-slides/prop-types.ts"],"names":["PropTypes","ReviewSlideProps","
|
|
1
|
+
{"version":3,"sources":["../../../src/organism/review-stacked-slides/prop-types.ts"],"names":["PropTypes","ReviewSlideProps","SlidePropsTypes","propTypes","validateButton","correctionPopinProps","slides","shape","isRequired","endReview","bool"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,gBAAP,IAA0BC,eAA1B,QAAgD,4BAAhD;AAEA,MAAMC,SAAS,GAAG;AAChBC,EAAAA,cAAc,EAAEH,gBAAgB,CAACG,cADjB;AAEhBC,EAAAA,oBAAoB,EAAEJ,gBAAgB,CAACI,oBAFvB;AAGhBC,EAAAA,MAAM,EAAEN,SAAS,CAACO,KAAV,CAAgB;AACtB,SAAKL,eADiB;AAEtB,SAAKA,eAFiB;AAGtB,SAAKA,eAHiB;AAItB,SAAKA,eAJiB;AAKtB,SAAKA;AALiB,GAAhB,EAMLM,UATa;AAUhBC,EAAAA,SAAS,EAAET,SAAS,CAACU;AAVL,CAAlB;AAaA,eAAeP,SAAf","sourcesContent":["import PropTypes from 'prop-types';\nimport ReviewSlideProps, {SlidePropsTypes} from '../review-slide/prop-types';\n\nconst propTypes = {\n validateButton: ReviewSlideProps.validateButton,\n correctionPopinProps: ReviewSlideProps.correctionPopinProps,\n slides: PropTypes.shape({\n '0': SlidePropsTypes,\n '1': SlidePropsTypes,\n '2': SlidePropsTypes,\n '3': SlidePropsTypes,\n '4': SlidePropsTypes\n }).isRequired,\n endReview: PropTypes.bool\n};\n\nexport default propTypes;\n\nexport type Props = PropTypes.InferProps<typeof propTypes>;\n"],"file":"prop-types.js"}
|
package/es/util/proptypes.js
CHANGED
|
@@ -2,9 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import includes from 'lodash/fp/includes';
|
|
3
3
|
import stringMatching from 'extended-proptypes/lib/validators/stringMatching';
|
|
4
4
|
import _ColorPropType from 'extended-proptypes/lib/validators/color';
|
|
5
|
-
export { _ColorPropType as ColorPropType };
|
|
6
5
|
import _HexPropType from 'extended-proptypes/lib/validators/hex';
|
|
7
|
-
export { _HexPropType as HexPropType };
|
|
8
6
|
const URL_REGEXP = /^(http(s)?:\/\/.)[-a-zA-Z0-9@:%._\\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/;
|
|
9
7
|
export const UrlPropType = stringMatching(URL_REGEXP);
|
|
10
8
|
const PATH_REGEXP = /^\/([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/;
|
|
@@ -14,4 +12,6 @@ export const ImagePropType = (propValue, key, componentName) => {
|
|
|
14
12
|
if (includes(propValue[key], ['jpg', 'png', 'svg+xml'])) return;
|
|
15
13
|
return new Error(`Invalid prop value: ${propValue[key]}, at component: ${componentName}. Expected a valid image type: jpg, png or svg+xml.`);
|
|
16
14
|
};
|
|
15
|
+
export const ColorPropType = _ColorPropType;
|
|
16
|
+
export const HexPropType = _HexPropType;
|
|
17
17
|
//# sourceMappingURL=proptypes.js.map
|
package/es/util/proptypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/proptypes.js"],"names":["PropTypes","includes","stringMatching","
|
|
1
|
+
{"version":3,"sources":["../../src/util/proptypes.js"],"names":["PropTypes","includes","stringMatching","_ColorPropType","_HexPropType","URL_REGEXP","UrlPropType","PATH_REGEXP","PathPropType","SrcPropType","oneOfType","ImagePropType","propValue","key","componentName","Error","ColorPropType","HexPropType"],"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,GAAG,8FAAnB;AACA,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;AAC9D,MAAIb,QAAQ,CAACW,SAAS,CAACC,GAAD,CAAV,EAAiB,CAAC,KAAD,EAAQ,KAAR,EAAe,SAAf,CAAjB,CAAZ,EAAyD;AACzD,SAAO,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","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 = /^(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"],"file":"proptypes.js"}
|
|
@@ -16,9 +16,14 @@ const Context = (0, _react.createContext)({
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
const WebContext = ({
|
|
19
|
-
|
|
19
|
+
skin,
|
|
20
|
+
translate,
|
|
20
21
|
children
|
|
21
22
|
}) => {
|
|
23
|
+
const values = {
|
|
24
|
+
skin,
|
|
25
|
+
translate
|
|
26
|
+
};
|
|
22
27
|
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
23
28
|
value: _extends({}, values)
|
|
24
29
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/provider/web-context.tsx"],"names":["Context","translate","key","WebContext","
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/provider/web-context.tsx"],"names":["Context","translate","key","WebContext","skin","children","values","useWebContext","context","Error"],"mappings":";;;;;AAAA;;;;;;;;AAaA,MAAMA,OAAO,GAAG,0BAAc;AAC5BC,EAAAA,SAAS,EAAGC,GAAD,IAAiBA;AADA,CAAd,CAAhB;;AAQA,MAAMC,UAAU,GAAG,CAAC;AAACC,EAAAA,IAAD;AAAOH,EAAAA,SAAP;AAAkBI,EAAAA;AAAlB,CAAD,KAAwC;AACzD,QAAMC,MAAM,GAAG;AAACF,IAAAA,IAAD;AAAOH,IAAAA;AAAP,GAAf;AACA,sBAAO,6BAAC,OAAD,CAAS,QAAT;AAAkB,IAAA,KAAK,eAAMK,MAAN;AAAvB,KAAuCD,QAAvC,CAAP;AACD,CAHD;;AAKO,MAAME,aAAa,GAAG,MAAwB;AACnD,QAAMC,OAAO,GAAG,uBAAWR,OAAX,CAAhB;;AAEA,MAAI,CAACQ,OAAL,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,0EAAV,CAAN;AACD;;AAED,SAAOD,OAAP;AACD,CARM;;;eAUQL,U","sourcesContent":["import React, {createContext, useContext} from 'react';\n\ntype Skin = {\n common: {\n primary: string;\n };\n};\n\ntype WebContextValues = {\n skin?: Skin;\n translate: (key: string) => string;\n};\n\nconst Context = createContext({\n translate: (key: string) => key\n});\n\ntype Props = WebContextValues & {\n children: any;\n};\n\nconst WebContext = ({skin, translate, children}: Props) => {\n const values = {skin, translate};\n return <Context.Provider value={{...values}}>{children}</Context.Provider>;\n};\n\nexport const useWebContext = (): WebContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error('❌ [WebContext] useWebContext must be used within a provider <WebContext>');\n }\n\n return context;\n};\n\nexport default WebContext;\n"],"file":"web-context.js"}
|
|
@@ -190,7 +190,7 @@ const ReviewSlide = props => {
|
|
|
190
190
|
questionOrigin: parentContentTitle,
|
|
191
191
|
questionText: questionText,
|
|
192
192
|
answerUI: answerUI,
|
|
193
|
-
disableContent:
|
|
193
|
+
disableContent: showCorrectionPopin,
|
|
194
194
|
key: "question-container"
|
|
195
195
|
}), /*#__PURE__*/_react.default.createElement(ValidateButton, {
|
|
196
196
|
slideIndex: slideIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","style","correctionPopinWrapper","popinAnimation","propTypes","PropTypes","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GAAG,GAAG,oBAAM,EAAN,EAAU,KAAV,EAAiBJ,oBAAjB,CAAZ;AACA,QAAMK,WAAW,GAAG,oBAAM;AAACC,IAAAA,KAAK,EAAE,EAAR;AAAYC,IAAAA,OAAO,EAAE;AAArB,GAAN,EAAgC,aAAhC,EAA+CP,oBAA/C,CAApB;AACA,QAAMQ,IAAI,GAAG,kBAAI,MAAJ,EAAYR,oBAAZ,CAAb;AAEA,QAAMS,qBAAqB,GAAG;AAC5BD,IAAAA,IAAI,EAAE;AACJE,MAAAA,OAAO,EAAE,MAAM;AACb;AACAC,QAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD,OAJG;AAKJN,MAAAA,KAAK,EAAEE,IAAI,IAAIA,IAAI,CAACF,KALhB;AAMJ,mBAAc,wBAAuBL,UAAW,EAN5C;AAOJ,oBAAcO,IAAI,IAAIA,IAAI,CAAC,YAAD;AAPtB,KADsB;AAU5BJ,IAAAA,GAV4B;AAW5BC,IAAAA,WAX4B;AAY5BQ,IAAAA,IAAI,EAAEb,oBAAoB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AEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAdF,CAJJ,CADF;AA8BD,CA7CD;;AA+CA0C,WAAW,CAAC3B,SAAZ,2CAAwBA,mBAAxB;eAEe2B,W","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport {GetSkinFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\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 return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': label,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n /*\n slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = props => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext();\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n [\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={!showCorrectionPopin}\n key=\"question-container\"\n />,\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n />,\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ]\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nexport default ReviewSlide;\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/organism/review-slide/index.js"],"names":["CorrectionPopin","correctionPopinProps","slideIndex","showCorrectionPopin","animateCorrectionPopin","klf","information","label","message","next","_correctionPopinProps","onClick","console","log","type","resultLabel","style","correctionPopinWrapper","popinAnimation","propTypes","PropTypes","string","bool","ValidateButton","validateButton","primarySkinColor","disabled","validateButtonProps","className","customStyle","backgroundColor","validateButtonWrapper","QuestionContainer","props","answerUI","questionText","questionOrigin","disableContent","slideContentContainer","disabledSlideContent","question","__html","help","answerContainer","shape","slide","ReviewSlide","skin","loading","loadingAriaLabel","parentContentTitle","loader"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC;AACvBC,EAAAA,oBADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA;AAJuB,CAAD,KAKlB;AACJ,MAAI,CAACD,mBAAL,EAA0B,OAAO,IAAP;AAE1B,QAAME,GAAG,GAAG,oBAAM,EAAN,EAAU,KAAV,EAAiBJ,oBAAjB,CAAZ;AAC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,OAAO,gBACN,6BAAC,eAAD;AAAQ,IAAA,SAAS,EAAEhC,eAAMmC,MAAzB;AAAiC,IAAA,KAAK,EAAC,SAAvC;AAAiD,kBAAYF;AAA7D,IADM,GAGN,cACE,6BAAC,iBAAD;AACE,IAAA,cAAc,EAAEC,kBADlB;AAEE,IAAA,YAAY,EAAEf,YAFhB;AAGE,IAAA,QAAQ,EAAED,QAHZ;AAIE,IAAA,cAAc,EAAE/B,mBAJlB;AAKE,IAAA,GAAG,EAAC;AALN,IADF,eAQE,6BAAC,cAAD;AACE,IAAA,UAAU,EAAED,UADd;AAEE,IAAA,cAAc,EAAEsB,cAFlB;AAGE,IAAA,gBAAgB,EAAEC,gBAHpB;AAIE,IAAA,GAAG,EAAC;AAJN,IARF,eAcE,6BAAC,eAAD;AACE,IAAA,oBAAoB,EAAExB,oBADxB;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,mBAAmB,EAAEC,mBAHvB;AAIE,IAAA,sBAAsB,EAAEC,sBAJ1B;AAKE,IAAA,GAAG,EAAC;AALN,IAdF,CAJJ,CADF;AA8BD,CA7CD;;AA+CA0C,WAAW,CAAC3B,SAAZ,2CAAwBA,mBAAxB;eAEe2B,W","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport Answer from '../../molecule/answer';\nimport ButtonLink from '../../atom/button-link';\nimport Loader from '../../atom/loader';\nimport ReviewCorrectionPopin from '../../molecule/review-correction-popin';\nimport {GetSkinFromContext} from '../../atom/provider';\nimport propTypes from './prop-types';\nimport style from './style.css';\n\nconst CorrectionPopin = ({\n correctionPopinProps,\n slideIndex,\n showCorrectionPopin,\n animateCorrectionPopin\n}) => {\n if (!showCorrectionPopin) return null;\n\n const klf = getOr({}, 'klf', correctionPopinProps);\n const information = getOr({label: '', message: ''}, 'information', correctionPopinProps);\n const next = get('next', correctionPopinProps);\n\n const _correctionPopinProps = {\n next: {\n onClick: () => {\n // eslint-disable-next-line no-console\n console.log('Next Slide');\n },\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 return (\n <div\n className={classnames(\n style.correctionPopinWrapper,\n animateCorrectionPopin ? style.popinAnimation : null\n )}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n );\n};\n\nCorrectionPopin.propTypes = {\n slideIndex: PropTypes.string,\n showCorrectionPopin: PropTypes.bool,\n animateCorrectionPopin: PropTypes.bool,\n correctionPopinProps: propTypes.correctionPopinProps\n};\n\nconst ValidateButton = ({slideIndex, validateButton, primarySkinColor}) => {\n const {label, onClick, disabled} = validateButton;\n const validateButtonProps = {\n type: 'primary',\n label,\n 'aria-label': label,\n 'data-name': `slide-validate-button-${slideIndex}`,\n onClick,\n disabled,\n className: style.validateButton,\n customStyle: {\n backgroundColor: primarySkinColor\n }\n /*\n slide validation action, this will trigger the correction popin\n (with the useEffect that fires the dispatchers, if there is a nextContent content,\n it will be loaded here) but will not trigger any animations unless the endReview\n signal is received (all slide will disappear, also fired in a useEffect),\n\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n onClick: async () => {\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n },\n */\n };\n\n return (\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n );\n};\n\nValidateButton.propTypes = {\n slideIndex: PropTypes.string,\n validateButton: propTypes.validateButton,\n primarySkinColor: PropTypes.string\n};\n\nconst QuestionContainer = props => {\n const {answerUI, questionText, questionOrigin, disableContent} = props;\n if (!answerUI || !questionText) return null;\n\n return (\n <div\n key=\"content-container\"\n className={classnames(\n style.slideContentContainer,\n disableContent ? style.disabledSlideContent : null\n )}\n >\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div\n key=\"title\"\n className={style.question}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: questionText}}\n />\n <div key=\"help\" className={style.help}>\n {get('help', answerUI)}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerUI} key=\"answer\" />\n </div>\n </div>\n );\n};\n\nQuestionContainer.propTypes = {\n answerUI: PropTypes.shape(propTypes.slide.answerUI),\n questionText: PropTypes.string,\n questionOrigin: PropTypes.string,\n disableContent: PropTypes.bool\n};\n\nconst ReviewSlide = props => {\n const {slide, validateButton, correctionPopinProps, slideIndex = '0'} = props;\n\n const skin = GetSkinFromContext();\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const {\n loading,\n loadingAriaLabel,\n parentContentTitle,\n questionText,\n answerUI,\n showCorrectionPopin,\n animateCorrectionPopin\n } = slide;\n\n return (\n <div data-name={`slide-container`} className={style.slide}>\n {loading ? (\n <Loader className={style.loader} theme=\"default\" aria-label={loadingAriaLabel} />\n ) : (\n [\n <QuestionContainer\n questionOrigin={parentContentTitle}\n questionText={questionText}\n answerUI={answerUI}\n disableContent={showCorrectionPopin}\n key=\"question-container\"\n />,\n <ValidateButton\n slideIndex={slideIndex}\n validateButton={validateButton}\n primarySkinColor={primarySkinColor}\n key=\"validate-button\"\n />,\n <CorrectionPopin\n correctionPopinProps={correctionPopinProps}\n slideIndex={slideIndex}\n showCorrectionPopin={showCorrectionPopin}\n animateCorrectionPopin={animateCorrectionPopin}\n key=\"correction-popin\"\n />\n ]\n )}\n </div>\n );\n};\n\nReviewSlide.propTypes = propTypes;\n\nexport default ReviewSlide;\n"],"file":"index.js"}
|
|
@@ -17,11 +17,11 @@ const propTypes = {
|
|
|
17
17
|
validateButton: _propTypes2.default.validateButton,
|
|
18
18
|
correctionPopinProps: _propTypes2.default.correctionPopinProps,
|
|
19
19
|
slides: _propTypes.default.shape({
|
|
20
|
-
'0': _propTypes2.
|
|
21
|
-
'1': _propTypes2.
|
|
22
|
-
'2': _propTypes2.
|
|
23
|
-
'3': _propTypes2.
|
|
24
|
-
'4': _propTypes2.
|
|
20
|
+
'0': _propTypes2.SlidePropsTypes,
|
|
21
|
+
'1': _propTypes2.SlidePropsTypes,
|
|
22
|
+
'2': _propTypes2.SlidePropsTypes,
|
|
23
|
+
'3': _propTypes2.SlidePropsTypes,
|
|
24
|
+
'4': _propTypes2.SlidePropsTypes
|
|
25
25
|
}).isRequired,
|
|
26
26
|
endReview: _propTypes.default.bool
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/organism/review-stacked-slides/prop-types.ts"],"names":["propTypes","validateButton","ReviewSlideProps","correctionPopinProps","slides","PropTypes","shape","
|
|
1
|
+
{"version":3,"sources":["../../../src/organism/review-stacked-slides/prop-types.ts"],"names":["propTypes","validateButton","ReviewSlideProps","correctionPopinProps","slides","PropTypes","shape","SlidePropsTypes","isRequired","endReview","bool"],"mappings":";;;;;AAAA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;AAChBC,EAAAA,cAAc,EAAEC,oBAAiBD,cADjB;AAEhBE,EAAAA,oBAAoB,EAAED,oBAAiBC,oBAFvB;AAGhBC,EAAAA,MAAM,EAAEC,mBAAUC,KAAV,CAAgB;AACtB,SAAKC,2BADiB;AAEtB,SAAKA,2BAFiB;AAGtB,SAAKA,2BAHiB;AAItB,SAAKA,2BAJiB;AAKtB,SAAKA;AALiB,GAAhB,EAMLC,UATa;AAUhBC,EAAAA,SAAS,EAAEJ,mBAAUK;AAVL,CAAlB;eAaeV,S","sourcesContent":["import PropTypes from 'prop-types';\nimport ReviewSlideProps, {SlidePropsTypes} from '../review-slide/prop-types';\n\nconst propTypes = {\n validateButton: ReviewSlideProps.validateButton,\n correctionPopinProps: ReviewSlideProps.correctionPopinProps,\n slides: PropTypes.shape({\n '0': SlidePropsTypes,\n '1': SlidePropsTypes,\n '2': SlidePropsTypes,\n '3': SlidePropsTypes,\n '4': SlidePropsTypes\n }).isRequired,\n endReview: PropTypes.bool\n};\n\nexport default propTypes;\n\nexport type Props = PropTypes.InferProps<typeof propTypes>;\n"],"file":"prop-types.js"}
|
package/lib/util/proptypes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.ImagePropType = exports.SrcPropType = exports.PathPropType = exports.UrlPropType = void 0;
|
|
4
|
+
exports.HexPropType = exports.ColorPropType = exports.ImagePropType = exports.SrcPropType = exports.PathPropType = exports.UrlPropType = void 0;
|
|
5
5
|
|
|
6
6
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
7
|
|
|
@@ -11,12 +11,8 @@ var _stringMatching = _interopRequireDefault(require("extended-proptypes/lib/val
|
|
|
11
11
|
|
|
12
12
|
var _color = _interopRequireDefault(require("extended-proptypes/lib/validators/color"));
|
|
13
13
|
|
|
14
|
-
exports.ColorPropType = _color.default;
|
|
15
|
-
|
|
16
14
|
var _hex = _interopRequireDefault(require("extended-proptypes/lib/validators/hex"));
|
|
17
15
|
|
|
18
|
-
exports.HexPropType = _hex.default;
|
|
19
|
-
|
|
20
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
17
|
|
|
22
18
|
const URL_REGEXP = /^(http(s)?:\/\/.)[-a-zA-Z0-9@:%._\\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/;
|
|
@@ -36,4 +32,8 @@ const ImagePropType = (propValue, key, componentName) => {
|
|
|
36
32
|
};
|
|
37
33
|
|
|
38
34
|
exports.ImagePropType = ImagePropType;
|
|
35
|
+
const ColorPropType = _color.default;
|
|
36
|
+
exports.ColorPropType = ColorPropType;
|
|
37
|
+
const HexPropType = _hex.default;
|
|
38
|
+
exports.HexPropType = HexPropType;
|
|
39
39
|
//# sourceMappingURL=proptypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/proptypes.js"],"names":["URL_REGEXP","UrlPropType","PATH_REGEXP","PathPropType","SrcPropType","PropTypes","oneOfType","ImagePropType","propValue","key","componentName","Error"],"mappings":";;;;;AAAA;;AACA;;AACA
|
|
1
|
+
{"version":3,"sources":["../../src/util/proptypes.js"],"names":["URL_REGEXP","UrlPropType","PATH_REGEXP","PathPropType","SrcPropType","PropTypes","oneOfType","ImagePropType","propValue","key","componentName","Error","ColorPropType","_ColorPropType","HexPropType","_HexPropType"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,UAAU,GAAG,8FAAnB;AACO,MAAMC,WAAW,GAAG,6BAAeD,UAAf,CAApB;;AAEP,MAAME,WAAW,GAAG,oCAApB;AACO,MAAMC,YAAY,GAAG,6BAAeD,WAAf,CAArB;;;AAEA,MAAME,WAAW,GAAGC,mBAAUC,SAAV,CAAoB,CAACL,WAAD,EAAcE,YAAd,CAApB,CAApB;;;;AAEA,MAAMI,aAAa,GAAG,CAACC,SAAD,EAAYC,GAAZ,EAAiBC,aAAjB,KAAmC;AAC9D,MAAI,uBAASF,SAAS,CAACC,GAAD,CAAlB,EAAyB,CAAC,KAAD,EAAQ,KAAR,EAAe,SAAf,CAAzB,CAAJ,EAAyD;AACzD,SAAO,IAAIE,KAAJ,CACJ,uBAAsBH,SAAS,CAACC,GAAD,CAAM,mBAAkBC,aAAc,qDADjE,CAAP;AAGD,CALM;;;AAOA,MAAME,aAAa,GAAGC,cAAtB;;AACA,MAAMC,WAAW,GAAGC,YAApB","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 = /^(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"],"file":"proptypes.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "10.22.
|
|
3
|
+
"version": "10.22.27-alpha.0+03d592dab",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"webpack": "^4.43.0"
|
|
141
141
|
},
|
|
142
142
|
"author": "CoorpAcademy",
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "03d592dab8bfc42e86357300c4c066d2a288f6d4"
|
|
144
144
|
}
|