@coorpacademy/components 11.32.42 → 11.32.44-alpha.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +12 -6
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/cta/index.js +2 -2
- package/es/atom/cta/index.js.map +1 -1
- package/es/atom/icon/index.d.ts +1 -0
- package/es/atom/icon/index.d.ts.map +1 -1
- package/es/atom/icon/index.js +8 -1
- package/es/atom/icon/index.js.map +1 -1
- package/es/atom/input-file-draggable/index.js +2 -2
- package/es/atom/input-file-draggable/index.js.map +1 -1
- package/es/atom/link/index.d.ts +2 -2
- package/es/atom/link/index.d.ts.map +1 -1
- package/es/atom/link/index.js +38 -46
- package/es/atom/link/index.js.map +1 -1
- package/es/atom/select-icon/index.d.ts +17 -0
- package/es/atom/select-icon/index.d.ts.map +1 -0
- package/es/atom/select-icon/index.js +93 -0
- package/es/atom/select-icon/index.js.map +1 -0
- package/es/atom/select-icon/style.css +73 -0
- package/es/molecule/banner/index.js +3 -3
- package/es/molecule/banner/index.js.map +1 -1
- package/es/molecule/certification-card/index.d.ts +4 -0
- package/es/molecule/certification-card/index.d.ts.map +1 -1
- package/es/molecule/certification-card/index.js +18 -12
- package/es/molecule/certification-card/index.js.map +1 -1
- package/es/molecule/certification-card/style.css +23 -7
- package/es/molecule/cm-popin/types.d.ts +14 -2
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/draggable-list/index.d.ts +12 -0
- package/es/molecule/progress-wrapper/index.d.ts.map +1 -1
- package/es/molecule/progress-wrapper/index.js +22 -12
- package/es/molecule/progress-wrapper/index.js.map +1 -1
- package/es/molecule/progress-wrapper/style.css +1 -0
- package/es/organism/accordion/coorp-manager/part/index.js +2 -1
- package/es/organism/accordion/coorp-manager/part/index.js.map +1 -1
- package/es/organism/brand-learning-priorities/index.d.ts +12 -0
- package/es/organism/list-item/index.d.ts +16 -1
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +58 -9
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-item/style.css +25 -11
- package/es/organism/list-items/index.d.ts +12 -0
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +2 -3
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/sidebar/index.d.ts +28 -3
- package/es/organism/sidebar/index.d.ts.map +1 -1
- package/es/organism/sidebar/index.js +7 -3
- package/es/organism/sidebar/index.js.map +1 -1
- package/es/template/app-player/loading/index.d.ts +14 -2
- package/es/template/app-player/player/index.d.ts +28 -4
- package/es/template/app-player/player/slides/index.d.ts +14 -2
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +18 -6
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +16 -4
- package/es/template/app-player/popin-end/summary.d.ts +2 -2
- package/es/template/app-player/popin-header/index.d.ts +2 -2
- package/es/template/app-review/index.d.ts +14 -2
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +14 -2
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +14 -2
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +38 -2
- package/es/template/certification-detail/index.d.ts +2 -1
- package/es/template/certification-detail/index.d.ts.map +1 -1
- package/es/template/certification-detail/index.js +19 -6
- package/es/template/certification-detail/index.js.map +1 -1
- package/es/template/certification-detail/style.css +0 -1
- package/es/template/certifications/index.d.ts +6 -0
- package/es/template/certifications/index.d.ts.map +1 -1
- package/es/template/certifications/index.js +28 -12
- package/es/template/certifications/index.js.map +1 -1
- package/es/template/certifications/style.css +8 -1
- package/es/template/common/dashboard/index.d.ts +28 -4
- package/es/template/common/search-page/index.d.ts +14 -2
- package/es/template/external-course/index.d.ts +14 -2
- package/es/template/playlist-detail/index.d.ts.map +1 -1
- package/es/template/playlist-detail/index.js +15 -4
- package/es/template/playlist-detail/index.js.map +1 -1
- package/es/template/playlist-detail/style.css +0 -1
- package/es/template/skill-detail/index.d.ts +1 -1
- package/es/template/skill-detail/index.d.ts.map +1 -1
- package/es/template/skill-detail/index.js +20 -8
- package/es/template/skill-detail/index.js.map +1 -1
- package/es/variables/colors.d.ts +1 -0
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +1 -0
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +12 -6
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/cta/index.js +2 -2
- package/lib/atom/cta/index.js.map +1 -1
- package/lib/atom/icon/index.d.ts +1 -0
- package/lib/atom/icon/index.d.ts.map +1 -1
- package/lib/atom/icon/index.js +12 -2
- package/lib/atom/icon/index.js.map +1 -1
- package/lib/atom/input-file-draggable/index.js.map +1 -1
- package/lib/atom/link/index.d.ts +2 -2
- package/lib/atom/link/index.d.ts.map +1 -1
- package/lib/atom/link/index.js +38 -47
- package/lib/atom/link/index.js.map +1 -1
- package/lib/atom/select-icon/index.d.ts +17 -0
- package/lib/atom/select-icon/index.d.ts.map +1 -0
- package/lib/atom/select-icon/index.js +111 -0
- package/lib/atom/select-icon/index.js.map +1 -0
- package/lib/atom/select-icon/style.css +73 -0
- package/lib/molecule/banner/index.js.map +1 -1
- package/lib/molecule/certification-card/index.d.ts +4 -0
- package/lib/molecule/certification-card/index.d.ts.map +1 -1
- package/lib/molecule/certification-card/index.js +18 -12
- package/lib/molecule/certification-card/index.js.map +1 -1
- package/lib/molecule/certification-card/style.css +23 -7
- package/lib/molecule/cm-popin/types.d.ts +14 -2
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/draggable-list/index.d.ts +12 -0
- package/lib/molecule/progress-wrapper/index.d.ts.map +1 -1
- package/lib/molecule/progress-wrapper/index.js +26 -13
- package/lib/molecule/progress-wrapper/index.js.map +1 -1
- package/lib/molecule/progress-wrapper/style.css +1 -0
- package/lib/organism/accordion/coorp-manager/part/index.js +3 -1
- package/lib/organism/accordion/coorp-manager/part/index.js.map +1 -1
- package/lib/organism/brand-learning-priorities/index.d.ts +12 -0
- package/lib/organism/list-item/index.d.ts +16 -1
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +56 -5
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-item/style.css +25 -11
- package/lib/organism/list-items/index.d.ts +12 -0
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +2 -3
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/sidebar/index.d.ts +28 -3
- package/lib/organism/sidebar/index.d.ts.map +1 -1
- package/lib/organism/sidebar/index.js +7 -3
- package/lib/organism/sidebar/index.js.map +1 -1
- package/lib/template/app-player/loading/index.d.ts +14 -2
- package/lib/template/app-player/player/index.d.ts +28 -4
- package/lib/template/app-player/player/slides/index.d.ts +14 -2
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +18 -6
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +16 -4
- package/lib/template/app-player/popin-end/summary.d.ts +2 -2
- package/lib/template/app-player/popin-header/index.d.ts +2 -2
- package/lib/template/app-review/index.d.ts +14 -2
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +14 -2
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +14 -2
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +38 -2
- package/lib/template/certification-detail/index.d.ts +2 -1
- package/lib/template/certification-detail/index.d.ts.map +1 -1
- package/lib/template/certification-detail/index.js +18 -6
- package/lib/template/certification-detail/index.js.map +1 -1
- package/lib/template/certification-detail/style.css +0 -1
- package/lib/template/certifications/index.d.ts +6 -0
- package/lib/template/certifications/index.d.ts.map +1 -1
- package/lib/template/certifications/index.js +30 -14
- package/lib/template/certifications/index.js.map +1 -1
- package/lib/template/certifications/style.css +8 -1
- package/lib/template/common/dashboard/index.d.ts +28 -4
- package/lib/template/common/search-page/index.d.ts +14 -2
- package/lib/template/external-course/index.d.ts +14 -2
- package/lib/template/playlist-detail/index.d.ts.map +1 -1
- package/lib/template/playlist-detail/index.js +14 -4
- package/lib/template/playlist-detail/index.js.map +1 -1
- package/lib/template/playlist-detail/style.css +0 -1
- package/lib/template/skill-detail/index.d.ts +1 -1
- package/lib/template/skill-detail/index.d.ts.map +1 -1
- package/lib/template/skill-detail/index.js +19 -7
- package/lib/template/skill-detail/index.js.map +1 -1
- package/lib/variables/colors.d.ts +1 -0
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +1 -0
- package/lib/variables/colors.js.map +1 -1
- package/locales/bs/global.json +10 -8
- package/locales/cs/global.json +10 -8
- package/locales/de/global.json +10 -8
- package/locales/en/global.json +3 -1
- package/locales/es/global.json +10 -8
- package/locales/et/global.json +10 -8
- package/locales/fi/global.json +10 -8
- package/locales/fr/global.json +10 -8
- package/locales/hr/global.json +10 -8
- package/locales/hu/global.json +10 -8
- package/locales/hy/global.json +10 -8
- package/locales/it/global.json +10 -8
- package/locales/ja/global.json +10 -8
- package/locales/ko/global.json +10 -8
- package/locales/nl/global.json +10 -8
- package/locales/pl/global.json +10 -8
- package/locales/pt/global.json +10 -8
- package/locales/ro/global.json +10 -8
- package/locales/ru/global.json +10 -8
- package/locales/sk/global.json +10 -8
- package/locales/sl/global.json +10 -8
- package/locales/sv/global.json +10 -8
- package/locales/tl/global.json +8 -6
- package/locales/tr/global.json +10 -8
- package/locales/uk/global.json +10 -8
- package/locales/vi/global.json +10 -8
- package/locales/zh/global.json +10 -8
- package/locales/zh_TW/global.json +10 -8
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","totalCourses","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","score","questionsToReview","showMore","setShowMore","handleShowMore","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","length","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n totalCourses,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick\n } = props;\n const {score = 0, questionsToReview} = metrics;\n const {translate} = context;\n\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n const Description = useCallback(() => {\n return (\n <div className={classnames(style.description, !showMore && style.truncate)}>\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label=\"Back\"\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {description.length >= 226 ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n {translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalCourses}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n totalCourses: PropTypes.number,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACxD,MAAM;IAACC,uBAAD;IAA0BC;EAA1B,IAAqCH,KAA3C;EACA,MAAM;IAACI,IAAD;IAAOC;EAAP,IAAoBJ,OAA1B;;EACA,MAAMK,gBAAgB,GAAG,KAAI,gBAAJ,EAAsBF,IAAtB,CAAzB;;EAEA,oBACE,8CACE,oBAAC,UAAD;IACE,KAAK,EACHF,uBAAuB,GAAGG,SAAS,CAAC,mBAAD,CAAZ,GAAoCA,SAAS,CAAC,gBAAD,CAFxE;IAIE,IAAI,EAAC,SAJP;IAKE,WAAW,EAAE;MACXE,KAAK,EAAE,aADI;MAEXC,YAAY,EAAE,MAFH;MAGXC,eAAe,EAAEH;IAHN,CALf;IAUE,oBAAoB,EAAEnB,OAAO,CAAE,YAAWmB,gBAAiB,0BAA9B,CAV/B;IAWE,UAAU,EAAC,SAXb;IAYE,IAAI,EA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EAkBtBc,WAAW,EAAE7C,SAAS,CAACiC,IAlBD;EAmBtBa,aAAa,EAAE9C,SAAS,CAACiC,IAnBH;EAoBtBc,uBAAuB,EAAE/C,SAAS,CAACiC;AApBb,CAAxB;AAuBA,eAAeC,WAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","descriptionRef","score","questionsToReview","totalContents","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview, totalContents} = metrics;\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n {translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalContents}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number,\n totalContents: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACxD,MAAM;IAACC,uBAAD;IAA0BC;EAA1B,IAAqCH,KAA3C;EACA,MAAM;IAACI,IAAD;IAAOC;EAAP,IAAoBJ,OAA1B;;EACA,MAAMK,gBAAgB,GAA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AiBC,UADF;EAEtB9C,QAAQ,EAAEpC,SAAS,CAACiF,MAAV,CAAiBC,UAFL;EAGtB7C,WAAW,EAAErC,SAAS,CAACiF,MAHD;EAItB3C,OAAO,EAAEtC,SAAS,CAACmF,KAAV,CAAgB;IACvBnC,KAAK,EAAEhD,SAAS,CAACoF,MADM;IAEvBnC,iBAAiB,EAAEjD,SAAS,CAACoF,MAFN;IAGvBlC,aAAa,EAAElD,SAAS,CAACoF;EAHF,CAAhB,CAJa;EAStB7C,OAAO,EAAEvC,SAAS,CAACgC,IATG;EAUtBQ,kBAAkB,EAAExC,SAAS,CAACgC,IAVR;EAWtBhB,uBAAuB,EAAEhB,SAAS,CAACgC,IAXb;EAYtBS,oBAAoB,EAAEzC,SAAS,CAACmF,KAAV,CAAgBzE,SAAS,CAACqB,SAA1B,CAZA;EAatBW,OAAO,EAAE1C,SAAS,CAACmF,KAAV,CAAgB;IACvBE,QAAQ,EAAErF,SAAS,CAACiC,IADG;IAEvBqD,OAAO,EAAEtF,SAAS,CAACuF,OAAV,CAAkBvF,SAAS,CAACmF,KAAV,CAAgB7E,qBAAhB,CAAlB;EAFc,CAAhB,CAba;EAiBtBqC,OAAO,EAAE3C,SAAS,CAACmF,KAAV,CAAgB9E,MAAM,CAAC0B,SAAvB,CAjBa;EAkBtBa,WAAW,EAAE5C,SAAS,CAACiC,IAlBD;EAmBtBY,aAAa,EAAE7C,SAAS,CAACiC,IAnBH;EAoBtBa,uBAAuB,EAAE9C,SAAS,CAACiC;AApBb,CAAxB;AAuBA,eAAeC,WAAf"}
|
package/es/variables/colors.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAEX,oBAAY,MAAM,GAAG,OAAO,MAAM,CAAC"}
|
package/es/variables/colors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","names":["COLORS","gray","negative","positive","cm_grey_800","cm_primary_blue"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n positive: '#35CC7F',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,QAAQ,EAAE,SAHU;EAIpBC,
|
|
1
|
+
{"version":3,"file":"colors.js","names":["COLORS","gray","negative","positive","white","cm_grey_800","cm_primary_blue"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n positive: '#35CC7F',\n white: '#ffffff',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,QAAQ,EAAE,SAHU;EAIpBC,KAAK,EAAE,SAJa;EAKpBC,WAAW,EAAE,SALO;EAMpBC,eAAe,EAAE;AANG,CAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AAoD7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAoGzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -37,7 +37,6 @@ const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverCol
|
|
|
37
37
|
position: ''
|
|
38
38
|
};
|
|
39
39
|
const Icon = type && _buttonIcons.ICONS[type];
|
|
40
|
-
const isApplyHover = hovered && hoverBackgroundColor && hoverColor;
|
|
41
40
|
|
|
42
41
|
if (!Icon && !faIcon) {
|
|
43
42
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -49,8 +48,9 @@ const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverCol
|
|
|
49
48
|
|
|
50
49
|
const iconComponent = faIcon ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
51
50
|
iconName: faIcon.name,
|
|
52
|
-
iconColor:
|
|
53
|
-
|
|
51
|
+
iconColor: hovered && hoverColor ? hoverColor : faIcon.color,
|
|
52
|
+
// eslint-disable-next-line no-nested-ternary
|
|
53
|
+
backgroundColor: !faIcon?.backgroundColor ? 'transparent' : hovered && hoverBackgroundColor ? hoverBackgroundColor : faIcon.backgroundColor,
|
|
54
54
|
size: {
|
|
55
55
|
faSize: faIcon.size,
|
|
56
56
|
wrapperSize: faIcon.size
|
|
@@ -91,7 +91,9 @@ const ButtonLink = props => {
|
|
|
91
91
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
92
92
|
const handleOnClick = (0, _react.useCallback)(event => onClick(event), [onClick]);
|
|
93
93
|
const handleOnKeyDown = (0, _react.useCallback)(event => onKeyDown(event), [onKeyDown]);
|
|
94
|
-
const handleMouseOver = (0, _react.useCallback)(() =>
|
|
94
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
95
|
+
setHovered(true);
|
|
96
|
+
}, [setHovered]);
|
|
95
97
|
const handleMouseLeave = (0, _react.useCallback)(() => setHovered(false), [setHovered]);
|
|
96
98
|
|
|
97
99
|
const _customStyle = (0, _react.useMemo)(() => {
|
|
@@ -109,8 +111,12 @@ const ButtonLink = props => {
|
|
|
109
111
|
className: styleButton,
|
|
110
112
|
"data-name": dataName,
|
|
111
113
|
"data-testid": dataTestId,
|
|
112
|
-
"aria-label": ariaLabel || label
|
|
113
|
-
|
|
114
|
+
"aria-label": ariaLabel || label,
|
|
115
|
+
hoverColor: hoverColor,
|
|
116
|
+
hoverBackgroundColor: hoverBackgroundColor,
|
|
117
|
+
onMouseOver: handleMouseOver,
|
|
118
|
+
onMouseLeave: handleMouseLeave
|
|
119
|
+
}), getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor));
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
return /*#__PURE__*/_react.default.createElement("button", _extends({}, useTitle && {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","type","faIcon","position","Icon","ICONS","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","type","faIcon","position","Icon","ICONS","style","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","customStyle","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","link","onClick","onKeyDown","className","useTitle","styleButton","classnames","button","primary","secondary","tertiary","text","dangerous","setHovered","useState","handleOnClick","useCallback","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","_customStyle","useMemo","title","propTypes"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={style.buttonContent}>\n <span className={style.label}>{content}</span>\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...{\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? 'transparent'\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n }}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true\n } = props;\n const styleButton = classnames(\n className,\n style.button,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n link && style.link,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n style={customStyle}\n className={styleButton}\n data-name={dataName}\n data-testid={dataTestId}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,gBAAgB,GAAG,CACvBC,IADuB,EAEvBC,OAFuB,EAGvBC,OAHuB,EAIvBC,oBAJuB,EAKvBC,UALuB,KAMpB;EACH,MAAM;IAACC,IAAD;IAAOC,MAAP;IAAeC;EAAf,IAA2BP,IAAI,IAAI;IAACK,IAAI,EAAE,EAAP;IAAWE,QAAQ,EAAE;EAArB,CAAzC;EACA,MAAMC,IAAI,GAAGH,IAAI,IAAII,kBAAA,CAAMJ,IAAN,CAArB;;EAEA,IAAI,CAACG,IAAD,IAAS,CAACF,MAAd,EAAsB;IACpB,oBACE;MAAK,SAAS,EAAEI,cAAA,CAAMC;IAAtB,gBACE;MAAM,SAAS,EAAED,c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 const CTA = (props, legacyContext) => {
|
|
|
52
52
|
useButtonTag = false
|
|
53
53
|
} = props;
|
|
54
54
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
55
|
-
const
|
|
55
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
56
56
|
setHovered(true);
|
|
57
57
|
}, []);
|
|
58
58
|
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
@@ -94,7 +94,7 @@ const CTA = (props, legacyContext) => {
|
|
|
94
94
|
return /*#__PURE__*/_react.default.createElement(_link.default, {
|
|
95
95
|
href: href,
|
|
96
96
|
onClick: disabled ? _noop2.default : onClick,
|
|
97
|
-
|
|
97
|
+
onMouseOver: handleMouseOver,
|
|
98
98
|
onMouseLeave: handleMouseLeave,
|
|
99
99
|
target: target,
|
|
100
100
|
className: (0, _classnames.default)(_style.default.button, disabled ? _style.default.disabled : null, small ? _style.default.smallButton : null, light ? _style.default.lightButton : null, secondary ? _style.default.secondaryButton : null, logout ? _style.default.logoutButton : null, rectangular ? _style.default.rectangularButton : null, fullWidth ? _style.default.fullWidth : null, certificationButton ? _style.default.certificationButton : null, className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CTA","props","legacyContext","skin","ariaLabel","submitValue","name","ctaName","href","target","disabled","light","small","secondary","onClick","className","logout","rectangular","fullWidth","certificationButton","useButtonTag","hovered","setHovered","useState","
|
|
1
|
+
{"version":3,"file":"index.js","names":["CTA","props","legacyContext","skin","ariaLabel","submitValue","name","ctaName","href","target","disabled","light","small","secondary","onClick","className","logout","rectangular","fullWidth","certificationButton","useButtonTag","hovered","setHovered","useState","handleMouseOver","useCallback","handleMouseLeave","getStyle","color","grey","backgroundColor","borderColor","opacity","darkenColor","convert","classnames","style","button","smallButton","lightButton","secondaryButton","logoutButton","rectangularButton","logoutWrapper","logoutIcon","propTypes","contextTypes","Provider","childContextTypes"],"sources":["../../../src/atom/cta/index.tsx"],"sourcesContent":["import React, {useCallback, useState} from 'react';\nimport {convert} from 'css-color-function';\nimport {get, noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {NovaCompositionCoorpacademyLogout as LogoutIcon} from '@coorpacademy/nova-icons';\nimport Link from '../link';\nimport type {WebContextValues} from '../provider/web-context';\nimport Provider from '../provider';\nimport style from './style.css';\nimport propTypes from './prop-types';\nimport type {CTAProps} from './prop-types';\n\nconst CTA = (props: CTAProps, legacyContext: WebContextValues) => {\n const {skin} = legacyContext;\n const {\n 'aria-label': ariaLabel,\n submitValue = 'submit',\n name: ctaName,\n href,\n target,\n disabled = false,\n light = false,\n small = false,\n secondary = false,\n onClick,\n className,\n logout = false,\n rectangular = false,\n fullWidth = false,\n certificationButton = false,\n useButtonTag = false\n } = props;\n const [hovered, setHovered] = useState(false);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setHovered(false);\n }, []);\n\n const getStyle = useCallback(() => {\n const color = get('common.primary', skin);\n const grey = get('common.grey', skin);\n\n if (logout) return;\n\n if (disabled) {\n return {\n backgroundColor: grey,\n borderColor: grey,\n opacity: '0.3'\n };\n }\n\n if (hovered) {\n const darkenColor = convert(`color(${color} blackness(+10%))`);\n return {\n backgroundColor: darkenColor,\n borderColor: darkenColor\n };\n }\n\n if (secondary)\n return {\n color,\n borderColor: color\n };\n\n if (light)\n return {\n color\n };\n\n return {\n borderColor: color,\n backgroundColor: color\n };\n }, [disabled, hovered, light, logout, secondary, skin]);\n\n return (\n <Link\n href={href}\n onClick={disabled ? noop : onClick}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n target={target}\n className={classnames(\n style.button,\n disabled ? style.disabled : null,\n small ? style.smallButton : null,\n light ? style.lightButton : null,\n secondary ? style.secondaryButton : null,\n logout ? style.logoutButton : null,\n rectangular ? style.rectangularButton : null,\n fullWidth ? style.fullWidth : null,\n certificationButton ? style.certificationButton : null,\n className\n )}\n data-name={ctaName || 'cta'}\n style={getStyle()}\n aria-label={ariaLabel}\n useButtonTag={useButtonTag}\n >\n {logout ? (\n <div className={style.logoutWrapper} data-name=\"cta-logout-label\">\n <LogoutIcon height={15} width={15} className={style.logoutIcon} />\n {submitValue}\n </div>\n ) : (\n submitValue\n )}\n </Link>\n );\n};\n\nCTA.propTypes = propTypes;\n\nCTA.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default CTA;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAGA,MAAMA,GAAG,GAAG,CAACC,KAAD,EAAkBC,aAAlB,KAAsD;EAChE,MAAM;IAACC;EAAD,IAASD,aAAf;EACA,MAAM;IACJ,cAAcE,SADV;IAEJC,WAAW,GAAG,QAFV;IAGJC,IAAI,EAAEC,OAHF;IAIJC,IAJI;IAKJC,MALI;IAMJC,QAAQ,GAAG,KANP;IAOJC,KAAK,GAAG,KAPJ;IAQJC,KAAK,GAAG,KARJ;IASJC,SAAS,GAAG,KATR;IAUJC,OAVI;IAWJC,SAXI;IAYJC,MAAM,GAAG,KAZL;IAaJC,WAAW,GAAG,KAbV;IAcJC,SAAS,GAAG,KAdR;IAeJC,mBAAmB,GAAG,KAflB;IAgBJC,YAAY,GAAG;EAhBX,IAiBFnB,KAjBJ;EAkBA,MAAM,CAACoB,OAAD,EAAUC,UAAV,IAAwB,IAAAC,eAAA,EAAS,KAAT,CAA9B;EAEA,MAAMC,eAAe,GAAG,IAAAC,kBAAA,EAAY,MAAM;IACxCH,UAAU,CAAC,IAAD,CAAV;EACD,CAFuB,EAErB,EAFqB,CAAxB;EAIA,MAAMI,gBAAgB,GAAG,IAAAD,kBAAA,EAAY,MAAM;IACzCH,UAAU,CAAC,KAAD,CAAV;EACD,CAFwB,EAEtB,EAFsB,CAAzB;EAIA,MAAMK,QAAQ,GAAG,IAAAF,kBAAA,EAAY,MAAM;IACjC,MAAMG,KAAK,GAAG,mBAAI,gBAAJ,EAAsBzB,IAAtB,CA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GmB,cAAA,CAAMM,iBAAT,GAA6B,IAP/B,EAQTxB,SAAS,GAAGkB,cAAA,CAAMlB,SAAT,GAAqB,IARrB,EASTC,mBAAmB,GAAGiB,cAAA,CAAMjB,mBAAT,GAA+B,IATzC,EAUTJ,SAVS,CANb;IAkBE,aAAWR,OAAO,IAAI,KAlBxB;IAmBE,KAAK,EAAEoB,QAAQ,EAnBjB;IAoBE,cAAYvB,SApBd;IAqBE,YAAY,EAAEgB;EArBhB,GAuBGJ,MAAM,gBACL;IAAK,SAAS,EAAEoB,cAAA,CAAMO,aAAtB;IAAqC,aAAU;EAA/C,gBACE,6BAAC,4CAAD;IAAY,MAAM,EAAE,EAApB;IAAwB,KAAK,EAAE,EAA/B;IAAmC,SAAS,EAAEP,cAAA,CAAMQ;EAApD,EADF,EAEGvC,WAFH,CADK,GAMLA,WA7BJ,CADF;AAkCD,CAvGD;;AAyGAL,GAAG,CAAC6C,SAAJ,2CAAgBA,kBAAhB;AAEA7C,GAAG,CAAC8C,YAAJ,GAAmB;EACjB3C,IAAI,EAAE4C,iBAAA,CAASC,iBAAT,CAA2B7C;AADhB,CAAnB;eAIeH,G"}
|
package/lib/atom/icon/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAiBA,mDAAoD;AAiB7C,8DAC8D;;AAGrE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAiBA,mDAAoD;AAiB7C,iEAIN;AAEM,8DAC8D;;AAGrE,uDAoCG"}
|
package/lib/atom/icon/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.getForegroundColor = exports.default = exports.DEFAULT_ICON_COLOR = void 0;
|
|
4
|
+
exports.getForegroundColor = exports.default = exports.createGradientBackground = exports.DEFAULT_ICON_COLOR = void 0;
|
|
5
5
|
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
|
|
@@ -54,6 +54,14 @@ const SIZE_CONFIGS = {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
const createGradientBackground = baseColor => {
|
|
58
|
+
const startColor = (0, _cssColorFunction.convert)(`color(${baseColor} lightness(91%))`);
|
|
59
|
+
const endColor = (0, _cssColorFunction.convert)(`color(${baseColor} lightness(81%))`);
|
|
60
|
+
return `linear-gradient(180deg, ${startColor} 0%, ${endColor} 100%)`;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.createGradientBackground = createGradientBackground;
|
|
64
|
+
|
|
57
65
|
const getForegroundColor = backgroundColor => (0, _cssColorFunction.convert)(`color(${backgroundColor} lightness(${ICON_LUMINOSITY}%))`); // set lightness to 32%
|
|
58
66
|
|
|
59
67
|
|
|
@@ -63,6 +71,7 @@ const Icon = /*#__PURE__*/_react.default.memo(function Icon({
|
|
|
63
71
|
iconName,
|
|
64
72
|
iconColor,
|
|
65
73
|
backgroundColor,
|
|
74
|
+
gradientBackground,
|
|
66
75
|
borderRadius,
|
|
67
76
|
preset = DEFAULT_PRESET,
|
|
68
77
|
size,
|
|
@@ -72,7 +81,7 @@ const Icon = /*#__PURE__*/_react.default.memo(function Icon({
|
|
|
72
81
|
const effectiveSize = size ? (0, _merge.default)(SIZE_CONFIGS[DEFAULT_PRESET], size) : (0, _getOr.default)(SIZE_CONFIGS[DEFAULT_PRESET], (0, _toLower.default)(preset), SIZE_CONFIGS);
|
|
73
82
|
const wrapperSize = effectiveSize.wrapperSize - ICON_PADDING * 2;
|
|
74
83
|
const iconWrapperStyle = {
|
|
75
|
-
backgroundColor,
|
|
84
|
+
background: gradientBackground ? createGradientBackground(effectiveIconColor) : backgroundColor,
|
|
76
85
|
borderRadius,
|
|
77
86
|
width: wrapperSize,
|
|
78
87
|
height: wrapperSize,
|
|
@@ -92,6 +101,7 @@ Icon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
92
101
|
iconName: _propTypes.default.string.isRequired,
|
|
93
102
|
iconColor: _propTypes.default.string,
|
|
94
103
|
backgroundColor: _propTypes.default.string,
|
|
104
|
+
gradientBackground: _propTypes.default.bool,
|
|
95
105
|
borderRadius: _propTypes.default.string,
|
|
96
106
|
preset: _propTypes.default.oneOf(['s', 'm', 'xl']),
|
|
97
107
|
size: _propTypes.default.shape({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["library","add","fas","DEFAULT_PRESET","ICON_LUMINOSITY","DEFAULT_WRAPPER_SIZE","ICON_PADDING","DEFAULT_ICON_COLOR","SIZE_CONFIGS","s","faSize","wrapperSize","m","xl","
|
|
1
|
+
{"version":3,"file":"index.js","names":["library","add","fas","DEFAULT_PRESET","ICON_LUMINOSITY","DEFAULT_WRAPPER_SIZE","ICON_PADDING","DEFAULT_ICON_COLOR","SIZE_CONFIGS","s","faSize","wrapperSize","m","xl","createGradientBackground","baseColor","startColor","convert","endColor","getForegroundColor","backgroundColor","Icon","React","memo","iconName","iconColor","gradientBackground","borderRadius","preset","size","customStyle","effectiveIconColor","effectiveSize","merge","getOr","toLower","iconWrapperStyle","background","width","height","padding","style","iconWrapper","propTypes","PropTypes","string","isRequired","bool","oneOf","shape","number","objectOf","oneOfType"],"sources":["../../../src/atom/icon/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes, {number} from 'prop-types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {fas} from '@fortawesome/pro-solid-svg-icons';\nimport {library} from '@fortawesome/fontawesome-svg-core';\nimport toLower from 'lodash/fp/toLower';\nimport merge from 'lodash/fp/merge';\nimport getOr from 'lodash/fp/getOr';\nimport {convert} from 'css-color-function';\nimport style from './style.css';\n\nlibrary.add(fas);\n\nconst DEFAULT_PRESET = 'm';\nconst ICON_LUMINOSITY = 32;\nconst DEFAULT_WRAPPER_SIZE = 40;\nconst ICON_PADDING = 8;\nexport const DEFAULT_ICON_COLOR = 'hsl(0, 0%, 32%)';\n\nconst SIZE_CONFIGS = {\n s: {\n faSize: 12,\n wrapperSize: 32\n },\n m: {\n faSize: 16,\n wrapperSize: DEFAULT_WRAPPER_SIZE\n },\n xl: {\n faSize: 20,\n wrapperSize: 48\n }\n};\n\nexport const createGradientBackground = baseColor => {\n const startColor = convert(`color(${baseColor} lightness(91%))`);\n const endColor = convert(`color(${baseColor} lightness(81%))`);\n return `linear-gradient(180deg, ${startColor} 0%, ${endColor} 100%)`;\n};\n\nexport const getForegroundColor = backgroundColor =>\n convert(`color(${backgroundColor} lightness(${ICON_LUMINOSITY}%))`);\n// set lightness to 32%\n\nconst Icon = React.memo(function Icon({\n iconName,\n iconColor,\n backgroundColor,\n gradientBackground,\n borderRadius,\n preset = DEFAULT_PRESET,\n size,\n customStyle\n}) {\n const effectiveIconColor =\n iconColor || (backgroundColor ? getForegroundColor(backgroundColor) : DEFAULT_ICON_COLOR);\n\n const effectiveSize = size\n ? merge(SIZE_CONFIGS[DEFAULT_PRESET], size)\n : getOr(SIZE_CONFIGS[DEFAULT_PRESET], toLower(preset), SIZE_CONFIGS);\n\n const wrapperSize = effectiveSize.wrapperSize - ICON_PADDING * 2;\n\n const iconWrapperStyle = {\n background: gradientBackground ? createGradientBackground(effectiveIconColor) : backgroundColor,\n borderRadius,\n width: wrapperSize,\n height: wrapperSize,\n padding: ICON_PADDING\n };\n\n return (\n <div className={style.iconWrapper} style={{...iconWrapperStyle, ...customStyle}}>\n <FontAwesomeIcon\n icon={`fa-${iconName}`}\n color={effectiveIconColor}\n fontSize={effectiveSize.faSize}\n />\n </div>\n );\n});\n\nIcon.propTypes = {\n iconName: PropTypes.string.isRequired,\n iconColor: PropTypes.string,\n backgroundColor: PropTypes.string,\n gradientBackground: PropTypes.bool,\n borderRadius: PropTypes.string,\n preset: PropTypes.oneOf(['s', 'm', 'xl']),\n size: PropTypes.shape({\n faSize: number,\n wrapperSize: PropTypes.number\n }),\n customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n};\n\nexport default Icon;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEAA,2BAAA,CAAQC,GAAR,CAAYC,qBAAZ;;AAEA,MAAMC,cAAc,GAAG,GAAvB;AACA,MAAMC,eAAe,GAAG,EAAxB;AACA,MAAMC,oBAAoB,GAAG,EAA7B;AACA,MAAMC,YAAY,GAAG,CAArB;AACO,MAAMC,kBAAkB,GAAG,iBAA3B;;AAEP,MAAMC,YAAY,GAAG;EACnBC,CAAC,EAAE;IACDC,MAAM,EAAE,EADP;IAEDC,WAAW,EAAE;EAFZ,CADgB;EAKnBC,CAAC,EAAE;IACDF,MAAM,EAAE,EADP;IAEDC,WAAW,EAAEN;EAFZ,CALgB;EASnBQ,EAAE,EAAE;IACFH,MAAM,EAAE,EADN;IAEFC,WAAW,EAAE;EAFX;AATe,CAArB;;AAeO,MAAMG,wBAAwB,GAAGC,SAAS,IAAI;EACnD,MAAMC,UAAU,GAAG,IAAAC,yBAAA,EAAS,SAAQF,SAAU,kBAA3B,CAAnB;EACA,MAAMG,QAAQ,GAAG,IAAAD,yBAAA,EAAS,SAAQF,SAAU,kBAA3B,CAAjB;EACA,OAAQ,2BAA0BC,UAAW,QAAOE,QAAS,QAA7D;AACD,CAJM;;;;AAMA,MAAMC,kBAAkB,GAAGC,eAAe,IAC/C,IAAAH,yBAAA,EAAS,SAAQG,eAAgB,cAAahB,eAAgB,KAA9D,CADK,C,CAEP;;;;;AAEA,MAAMiB,IAAI,gBAAGC,cAAA,CAAMC,IAAN,CAAW,SAASF,IAAT,CAAc;EACpCG,QADoC;EAEpCC,SAFoC;EAGpCL,eAHoC;EAIpCM,kBAJoC;EAKpCC,YALoC;EAMpCC,MAAM,GAAGzB,cAN2B;EAOpC0B,IAPoC;EAQ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AD,EAAM,GAAN,EAAW,IAAX,CAAhB,CANO;EAOfnB,IAAI,EAAEe,kBAAA,CAAUK,KAAV,CAAgB;IACpBvC,MAAM,EAAEwC,iBADY;IAEpBvC,WAAW,EAAEiC,kBAAA,CAAUM;EAFH,CAAhB,CAPS;EAWfpB,WAAW,EAAEc,kBAAA,CAAUO,QAAV,CAAmBP,kBAAA,CAAUQ,SAAV,CAAoB,CAACR,kBAAA,CAAUC,MAAX,EAAmBD,kBAAA,CAAUM,MAA7B,CAApB,CAAnB;AAXE,CAAjB;eAce7B,I"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["InputFileDraggable","title","description","previewLabel","previewContent","uploadLabel","loading","modified","disabled","disableHoverTooltip","onChange","onReset","name","labelLink","labelButtonLink","hrefLink","filesTypes","error","buttonAriaLabel","errorButtonLabel","pdfButtonLabel","pdfButtonAriaLabel","filesNumber","multiple","required","onClick","handleReset","useCallback","e","preventDefault","linkCustomStyle","width","color","onClick_","onDragStart","onDragStop","style","input","templateLink","href","download","multipleFilesContainer","icon","seeDetailsButton","seeIcon","propTypes","DragAndDrop","PropTypes","bool","string","func","FilesPropType"],"sources":["../../../src/atom/input-file-draggable/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isNil} from 'lodash/fp';\nimport {\n NovaSolidFilesBasicFileLines as FileLinesIcon,\n NovaCompositionCoorpacademyEye as EyeIcon\n} from '@coorpacademy/nova-icons';\nimport DragAndDrop from '../drag-and-drop';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":["InputFileDraggable","title","description","previewLabel","previewContent","uploadLabel","loading","modified","disabled","disableHoverTooltip","onChange","onReset","name","labelLink","labelButtonLink","hrefLink","filesTypes","error","buttonAriaLabel","errorButtonLabel","pdfButtonLabel","pdfButtonAriaLabel","filesNumber","multiple","required","onClick","handleReset","useCallback","e","preventDefault","linkCustomStyle","width","color","onClick_","onDragStart","onDragStop","style","input","templateLink","href","download","multipleFilesContainer","icon","seeDetailsButton","seeIcon","propTypes","DragAndDrop","PropTypes","bool","string","func","FilesPropType"],"sources":["../../../src/atom/input-file-draggable/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isNil} from 'lodash/fp';\nimport {\n NovaSolidFilesBasicFileLines as FileLinesIcon,\n NovaCompositionCoorpacademyEye as EyeIcon\n} from '@coorpacademy/nova-icons';\nimport DragAndDrop from '../drag-and-drop';\nimport ButtonLink from '../button-link';\nimport {FilesPropType} from '../../util/proptypes';\nimport style from './style.css';\n\nconst InputFileDraggable = ({\n title,\n description,\n previewLabel,\n previewContent,\n uploadLabel,\n loading,\n modified,\n disabled = false,\n disableHoverTooltip = false,\n onChange,\n onReset = null,\n name,\n labelLink,\n labelButtonLink,\n hrefLink,\n filesTypes = '',\n error = '',\n buttonAriaLabel,\n errorButtonLabel,\n pdfButtonLabel,\n pdfButtonAriaLabel,\n filesNumber = 0,\n multiple = false,\n required = false,\n onClick\n}) => {\n const handleReset = useCallback(\n e => {\n if (isNil(onReset)) return;\n e.preventDefault();\n return onReset(e);\n },\n [onReset]\n );\n\n const linkCustomStyle = {\n width: '40px',\n color: '#FF541F'\n };\n\n const onClick_ = useCallback(\n e => {\n e.preventDefault();\n return onClick(e);\n },\n [onClick]\n );\n\n return (\n <>\n <DragAndDrop\n title={title}\n description={description}\n previewLabel={previewLabel}\n previewContent={previewContent}\n uploadLabel={uploadLabel}\n loading={loading}\n modified={modified}\n onReset={handleReset}\n error={error}\n disabled={disabled}\n disableHoverTooltip={disableHoverTooltip}\n buttonAriaLabel={buttonAriaLabel}\n errorButtonLabel={errorButtonLabel}\n pdfButtonLabel={pdfButtonLabel}\n pdfButtonAriaLabel={pdfButtonAriaLabel}\n multiple={multiple}\n >\n {(onDragStart, onDragStop) => (\n <input\n {...(disableHoverTooltip ? {title: ''} : {})}\n type=\"file\"\n name={name}\n accept={filesTypes}\n disabled={loading || disabled}\n className={style.input}\n onChange={onChange}\n onDragEnter={onDragStart}\n onDrop={onDragStop}\n onDragLeave={onDragStop}\n multiple={multiple}\n required={required}\n />\n )}\n </DragAndDrop>\n {labelLink && hrefLink ? (\n <div className={style.templateLink}>\n {labelLink}\n <ButtonLink\n type=\"text\"\n customStyle={linkCustomStyle}\n link={{href: hrefLink, download: true}}\n label={labelButtonLink}\n />\n </div>\n ) : null}\n {multiple && filesNumber > 0 ? (\n <div className={style.multipleFilesContainer}>\n <div className={style.filesNumber}>\n <FileLinesIcon className={style.icon} />\n <div>{filesNumber} files</div>\n </div>\n <div className={style.seeDetailsButton} onClick={onClick_}>\n <EyeIcon className={style.seeIcon} />\n <div>See details</div>\n </div>\n </div>\n ) : null}\n </>\n );\n};\n\nInputFileDraggable.propTypes = {\n ...DragAndDrop.propTypes,\n disableHoverTooltip: PropTypes.bool,\n name: PropTypes.string,\n onChange: PropTypes.func,\n onReset: PropTypes.func,\n filesTypes: FilesPropType,\n error: PropTypes.string,\n buttonAriaLabel: PropTypes.string,\n errorButtonLabel: PropTypes.string,\n labelLink: PropTypes.string,\n hrefLink: PropTypes.string\n};\n\nexport default InputFileDraggable;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,kBAAkB,GAAG,CAAC;EAC1BC,KAD0B;EAE1BC,WAF0B;EAG1BC,YAH0B;EAI1BC,cAJ0B;EAK1BC,WAL0B;EAM1BC,OAN0B;EAO1BC,QAP0B;EAQ1BC,QAAQ,GAAG,KARe;EAS1BC,mBAAmB,GAAG,KATI;EAU1BC,QAV0B;EAW1BC,OAAO,GAAG,IAXgB;EAY1BC,IAZ0B;EAa1BC,SAb0B;EAc1BC,eAd0B;EAe1BC,QAf0B;EAgB1BC,UAAU,GAAG,EAhBa;EAiB1BC,KAAK,GAAG,EAjBkB;EAkB1BC,eAlB0B;EAmB1BC,gBAnB0B;EAoB1BC,cApB0B;EAqB1BC,kBArB0B;EAsB1BC,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APnB;EAQE/B,eAAe,EAAE6B,kBAAA,CAAUE,MAR7B;EASE9B,gBAAgB,EAAE4B,kBAAA,CAAUE,MAT9B;EAUEpC,SAAS,EAAEkC,kBAAA,CAAUE,MAVvB;EAWElC,QAAQ,EAAEgC,kBAAA,CAAUE;AAXtB;eAcejD,kB"}
|
package/lib/atom/link/index.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ declare namespace Link {
|
|
|
9
9
|
'aria-label': PropTypes.Requireable<string>;
|
|
10
10
|
title: PropTypes.Requireable<string>;
|
|
11
11
|
target: PropTypes.Requireable<string>;
|
|
12
|
-
skinHover: PropTypes.Requireable<boolean>;
|
|
13
12
|
hoverColor: PropTypes.Requireable<string>;
|
|
13
|
+
hoverBackgroundColor: PropTypes.Requireable<string>;
|
|
14
14
|
download: PropTypes.Requireable<boolean>;
|
|
15
15
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
|
|
16
|
+
onMouseOver: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
17
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
18
|
useButtonTag: PropTypes.Requireable<boolean>;
|
|
19
19
|
style: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/link/index.js"],"names":[],"mappings":";AAMA,mEAwEC"}
|
package/lib/atom/link/index.js
CHANGED
|
@@ -5,19 +5,17 @@ exports.default = void 0;
|
|
|
5
5
|
|
|
6
6
|
var _noop2 = _interopRequireDefault(require("lodash/fp/noop"));
|
|
7
7
|
|
|
8
|
-
var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
|
|
9
|
-
|
|
10
8
|
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
11
9
|
|
|
12
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
11
|
|
|
14
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
13
|
|
|
16
|
-
var _provider =
|
|
14
|
+
var _provider = _interopRequireDefault(require("../provider"));
|
|
17
15
|
|
|
18
16
|
var _navigation = _interopRequireDefault(require("../../util/navigation"));
|
|
19
17
|
|
|
20
|
-
const _excluded = ["
|
|
18
|
+
const _excluded = ["hoverColor", "hoverBackgroundColor", "data-name", "useButtonTag", "href", "onClick", "style", "children", "onMouseOver", "onMouseLeave", "download", "disabled"];
|
|
21
19
|
|
|
22
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
21
|
|
|
@@ -30,7 +28,6 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
30
28
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
29
|
|
|
32
30
|
const Link = (props, legacyContext) => {
|
|
33
|
-
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
34
31
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
35
32
|
const {
|
|
36
33
|
history: {
|
|
@@ -39,66 +36,60 @@ const Link = (props, legacyContext) => {
|
|
|
39
36
|
} = legacyContext;
|
|
40
37
|
|
|
41
38
|
const {
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
hoverColor,
|
|
40
|
+
hoverBackgroundColor,
|
|
44
41
|
'data-name': dataName = 'link',
|
|
45
|
-
|
|
46
|
-
useButtonTag = false
|
|
47
|
-
} = props,
|
|
48
|
-
linKElementProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
49
|
-
|
|
50
|
-
const {
|
|
42
|
+
useButtonTag = false,
|
|
51
43
|
href,
|
|
52
44
|
onClick = _noop2.default,
|
|
53
|
-
|
|
54
|
-
style: propsStyle,
|
|
45
|
+
style: customStyle,
|
|
55
46
|
children,
|
|
47
|
+
onMouseOver = _noop2.default,
|
|
56
48
|
onMouseLeave = _noop2.default,
|
|
57
|
-
onMouseEnter = _noop2.default,
|
|
58
49
|
download,
|
|
59
50
|
disabled
|
|
60
|
-
} = props
|
|
61
|
-
|
|
51
|
+
} = props,
|
|
52
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
53
|
+
|
|
54
|
+
const navigate = (0, _react.useMemo)(() => (0, _navigation.default)(legacyContext)({
|
|
55
|
+
href
|
|
56
|
+
}), [href, legacyContext]);
|
|
57
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
62
58
|
setHovered(true);
|
|
63
|
-
|
|
64
|
-
}, [
|
|
59
|
+
onMouseOver();
|
|
60
|
+
}, [onMouseOver]);
|
|
65
61
|
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
66
62
|
setHovered(false);
|
|
67
63
|
onMouseLeave();
|
|
68
64
|
}, [onMouseLeave]);
|
|
69
|
-
const navigate = (0, _react.useMemo)(() => (0, _navigation.default)(legacyContext)({
|
|
70
|
-
href
|
|
71
|
-
}), [href, legacyContext]);
|
|
72
65
|
const handleOnClick = (0, _react.useCallback)(e => {
|
|
73
66
|
onClick(e);
|
|
74
|
-
|
|
75
|
-
if (!download) {
|
|
76
|
-
navigate(e);
|
|
77
|
-
}
|
|
67
|
+
if (!download) navigate(e);
|
|
78
68
|
}, [download, navigate, onClick]);
|
|
79
69
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const _hoverStyle = (0, _react.useMemo)(() => skinHover && hovered ? {
|
|
70
|
+
const style = _extends({}, customStyle, hovered && hoverBackgroundColor ? {
|
|
71
|
+
backgroundColor: hoverBackgroundColor
|
|
72
|
+
} : undefined, hovered && hoverColor ? {
|
|
85
73
|
color: hoverColor
|
|
86
|
-
} :
|
|
74
|
+
} : undefined, {
|
|
75
|
+
pointerEvents: disabled || !href ? 'none' : undefined
|
|
76
|
+
});
|
|
87
77
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
return useButtonTag ? /*#__PURE__*/_react.default.createElement("button", _extends({}, restProps, {
|
|
79
|
+
"data-name": dataName,
|
|
80
|
+
type: "button",
|
|
81
|
+
onClick: disabled ? _noop2.default : handleOnClick,
|
|
82
|
+
style: style,
|
|
83
|
+
onMouseOver: handleMouseOver,
|
|
84
|
+
onMouseLeave: handleMouseLeave
|
|
85
|
+
}), children) : /*#__PURE__*/_react.default.createElement("a", _extends({}, restProps, {
|
|
86
|
+
"data-name": dataName,
|
|
91
87
|
href: disabled || !href ? undefined : createHref(href),
|
|
92
88
|
onClick: disabled ? _noop2.default : handleOnClick,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}), [_hoverStyle, _style, ariaLabel, className, dataName, handleMouseEnter, handleMouseLeave, handleOnClick, href, disabled, createHref, linKElementProps, propsStyle]);
|
|
98
|
-
|
|
99
|
-
return useButtonTag ? /*#__PURE__*/_react.default.createElement("button", _extends({}, _props, {
|
|
100
|
-
type: "button"
|
|
101
|
-
}), children) : /*#__PURE__*/_react.default.createElement("a", _props, children);
|
|
89
|
+
style: style,
|
|
90
|
+
onMouseOver: handleMouseOver,
|
|
91
|
+
onMouseLeave: handleMouseLeave
|
|
92
|
+
}), children);
|
|
102
93
|
};
|
|
103
94
|
|
|
104
95
|
Link.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -109,11 +100,11 @@ Link.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
109
100
|
'aria-label': _propTypes.default.string,
|
|
110
101
|
title: _propTypes.default.string,
|
|
111
102
|
target: _propTypes.default.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
112
|
-
skinHover: _propTypes.default.bool,
|
|
113
103
|
hoverColor: _propTypes.default.string,
|
|
104
|
+
hoverBackgroundColor: _propTypes.default.string,
|
|
114
105
|
download: _propTypes.default.bool,
|
|
115
106
|
onClick: _propTypes.default.func,
|
|
116
|
-
|
|
107
|
+
onMouseOver: _propTypes.default.func,
|
|
117
108
|
onMouseLeave: _propTypes.default.func,
|
|
118
109
|
useButtonTag: _propTypes.default.bool,
|
|
119
110
|
style: _propTypes.default.shape({}),
|