@coorpacademy/components 11.38.1-alpha.12 → 11.38.1-alpha.3

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.
Files changed (62) hide show
  1. package/es/molecule/card/favorite.d.ts.map +1 -1
  2. package/es/molecule/card/favorite.js +0 -5
  3. package/es/molecule/card/favorite.js.map +1 -1
  4. package/es/molecule/card/index.d.ts.map +1 -1
  5. package/es/molecule/card/index.js +11 -29
  6. package/es/molecule/card/index.js.map +1 -1
  7. package/es/molecule/card/style.css +13 -15
  8. package/es/molecule/card-content/index.d.ts.map +1 -1
  9. package/es/molecule/card-content/index.js +36 -77
  10. package/es/molecule/card-content/index.js.map +1 -1
  11. package/es/molecule/card-content/style.css +22 -20
  12. package/es/molecule/external-content-button/style.css +0 -1
  13. package/es/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
  14. package/es/molecule/learning-profile-radar-chart/index.js +2 -1
  15. package/es/molecule/learning-profile-radar-chart/index.js.map +1 -1
  16. package/es/organism/mooc-header/index.d.ts.map +1 -1
  17. package/es/organism/mooc-header/index.js +2 -1
  18. package/es/organism/mooc-header/index.js.map +1 -1
  19. package/es/util/check-is-mobile.d.ts +1 -1
  20. package/es/util/check-is-mobile.d.ts.map +1 -1
  21. package/es/util/check-is-mobile.js +6 -1
  22. package/es/util/check-is-mobile.js.map +1 -1
  23. package/es/util/external-content.d.ts +4 -38
  24. package/es/util/external-content.d.ts.map +1 -1
  25. package/es/util/external-content.js +4 -33
  26. package/es/util/external-content.js.map +1 -1
  27. package/es/variables/colors.d.ts +0 -5
  28. package/es/variables/colors.d.ts.map +1 -1
  29. package/es/variables/colors.js +1 -6
  30. package/es/variables/colors.js.map +1 -1
  31. package/lib/molecule/card/favorite.d.ts.map +1 -1
  32. package/lib/molecule/card/favorite.js +0 -5
  33. package/lib/molecule/card/favorite.js.map +1 -1
  34. package/lib/molecule/card/index.d.ts.map +1 -1
  35. package/lib/molecule/card/index.js +10 -28
  36. package/lib/molecule/card/index.js.map +1 -1
  37. package/lib/molecule/card/style.css +13 -15
  38. package/lib/molecule/card-content/index.d.ts.map +1 -1
  39. package/lib/molecule/card-content/index.js +34 -75
  40. package/lib/molecule/card-content/index.js.map +1 -1
  41. package/lib/molecule/card-content/style.css +22 -20
  42. package/lib/molecule/external-content-button/style.css +0 -1
  43. package/lib/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
  44. package/lib/molecule/learning-profile-radar-chart/index.js +2 -1
  45. package/lib/molecule/learning-profile-radar-chart/index.js.map +1 -1
  46. package/lib/organism/mooc-header/index.d.ts.map +1 -1
  47. package/lib/organism/mooc-header/index.js +2 -1
  48. package/lib/organism/mooc-header/index.js.map +1 -1
  49. package/lib/util/check-is-mobile.d.ts +1 -1
  50. package/lib/util/check-is-mobile.d.ts.map +1 -1
  51. package/lib/util/check-is-mobile.js +6 -1
  52. package/lib/util/check-is-mobile.js.map +1 -1
  53. package/lib/util/external-content.d.ts +4 -38
  54. package/lib/util/external-content.d.ts.map +1 -1
  55. package/lib/util/external-content.js +5 -34
  56. package/lib/util/external-content.js.map +1 -1
  57. package/lib/variables/colors.d.ts +0 -5
  58. package/lib/variables/colors.d.ts.map +1 -1
  59. package/lib/variables/colors.js +1 -6
  60. package/lib/variables/colors.js.map +1 -1
  61. package/locales/en/global.json +4 -4
  62. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAcA;;;;;;;;oCA6IC"}
1
+ {"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAcA;;;;;;;;oCAwIC"}
@@ -33,16 +33,11 @@ const Favorite = ({
33
33
  const buttonRef = useRef(null);
34
34
  const allowToolTip = useMemo(() => !_isEmpty(removeFavoriteToolTip) && !_isEmpty(addFavoriteToolTip), [addFavoriteToolTip, removeFavoriteToolTip]);
35
35
 
36
- // eslint-disable-next-line no-console
37
- console.log('🚀 ~ favorite.js:49 ~ allowToolTip:', allowToolTip);
38
-
39
36
  // to be replaced by useId when React17 is bumped to React18
40
37
  const [favoriteButtonAnchorId] = useState(allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined);
41
38
  const toolTipContent = useMemo(
42
39
  // eslint-disable-next-line no-nested-ternary
43
40
  () => allowToolTip ? favorite ? removeFavoriteToolTip : addFavoriteToolTip : null, [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]);
44
- // eslint-disable-next-line no-console
45
- console.log('🚀 ~ favorite.js:63 ~ toolTipContent:', toolTipContent);
46
41
  const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);
47
42
  const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
48
43
  const handleMouseOver = useCallback(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"favorite.js","names":["React","useCallback","useMemo","useRef","useState","PropTypes","classnames","v5","uuidV5","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","GetSkinFromContext","GetTranslateFromContext","ToolTip","toggleStateOnKeyPress","Button","style","Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","_noop","disabled","legacyContext","skin","translate","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","_get","darkColor","brandColor","buttonRef","allowToolTip","_isEmpty","console","log","favoriteButtonAnchorId","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","_has","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","iconWrapperClassName","selected","icon","createElement","checkIcon","color","width","height","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","type","buttonContentClassName","onClick","onKeyDown","onMouseLeave","onMouseOver","tabIndex","useButtonTag","useWrapper","fontSize","anchorId","TooltipContent","closeToolTipInformationTextAriaLabel","stickyOnKeyboardNavigation","propTypes","process","env","NODE_ENV","string","bool","func","shape","contextTypes","childContextTypes"],"sources":["../../../src/molecule/card/favorite.js"],"sourcesContent":["import React, {useCallback, useMemo, useRef, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport {get, has, isEmpty, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationMore as MoreIcon,\n NovaCompositionCoorpacademyCheck as CheckIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Button from '../../atom/button';\nimport style from './favorite.css';\n\nconst Favorite = (\n {\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n className,\n 'aria-label': ariaLabel = {},\n onFavoriteClick = noop,\n disabled\n },\n legacyContext\n) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const handleFavoriteClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n if (!disabled) onFavoriteClick(e);\n },\n [disabled, onFavoriteClick]\n );\n\n const primaryColor = get('common.primary', skin);\n const darkColor = get('common.dark', skin);\n const brandColor = get('common.brand', skin);\n\n const buttonRef = useRef(null);\n\n const allowToolTip = useMemo(\n () => !isEmpty(removeFavoriteToolTip) && !isEmpty(addFavoriteToolTip),\n [addFavoriteToolTip, removeFavoriteToolTip]\n );\n\n // eslint-disable-next-line no-console\n console.log('🚀 ~ favorite.js:49 ~ allowToolTip:', allowToolTip);\n\n // to be replaced by useId when React17 is bumped to React18\n const [favoriteButtonAnchorId] = useState(\n allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const toolTipContent = useMemo(\n // eslint-disable-next-line no-nested-ternary\n () => (allowToolTip ? (favorite ? removeFavoriteToolTip : addFavoriteToolTip) : null),\n [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]\n );\n // eslint-disable-next-line no-console\n console.log('🚀 ~ favorite.js:63 ~ toolTipContent:', toolTipContent);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n /* istanbul ignore next */ has(['current', 'focus'], buttonRef) && buttonRef.current.focus();\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(\n setTimeout(() => {\n setToolTipIsVisible(false);\n // @ts-expect-error (error: blur does not exists on type never)\n /* istanbul ignore next */ has(['current', 'blur'], buttonRef) && buttonRef.current.blur();\n }, 500)\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const iconWrapperClassName = useMemo(\n () => classnames(style.favorite, className, favorite && style.selected),\n [className, favorite]\n );\n const icon = useMemo(\n () =>\n favorite ? (\n <CheckIcon\n // eslint-disable-next-line css-modules/no-undef-class\n className={style.checkIcon}\n style={{color: brandColor}}\n width={13}\n height={13}\n data-testid=\"favorite-check-icon\"\n aria-label={ariaLabel.removeFromFavorite}\n />\n ) : (\n <MoreIcon\n className={style.moreIcon}\n style={{color: darkColor}}\n width={13}\n height={13}\n data-testid=\"favorite-add-icon\"\n aria-label={ariaLabel.addToFavorite}\n />\n ),\n [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]\n );\n\n return (\n <div className={style.favoriteWrapper} data-testid=\"favorite-wrapper\">\n <Button\n buttonRef={buttonRef}\n type=\"button\"\n data-for={favoriteButtonAnchorId}\n data-tooltip-place=\"left\"\n data-tip={allowToolTip}\n data-name=\"favorite\"\n data-testid=\"favorite-button\"\n aria-label={ariaLabel.favorite}\n buttonContentClassName={iconWrapperClassName}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n tabIndex={0}\n useButtonTag\n useWrapper={false}\n >\n {icon}\n </Button>\n <ToolTip\n fontSize={12}\n anchorId={favoriteButtonAnchorId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={toolTipContent}\n closeToolTipInformationTextAriaLabel={translate('close_tooltip_information')}\n stickyOnKeyboardNavigation\n />\n </div>\n );\n};\n\nFavorite.propTypes = {\n className: PropTypes.string,\n favorite: PropTypes.bool,\n disabled: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onFavoriteClick: PropTypes.func,\n 'aria-label': PropTypes.shape({\n favorite: PropTypes.string,\n addToFavorite: PropTypes.string,\n removeFromFavorite: PropTypes.string\n })\n};\n\nFavorite.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default Favorite;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AACnE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AAEjC,SACEC,6BAA6B,IAAIC,QAAQ,EACzCC,gCAAgC,IAAIC,SAAS,QACxC,0BAA0B;AACjC,OAAOC,QAAQ,IAAGC,kBAAkB,EAAEC,uBAAuB,QAAO,qBAAqB;AACzF,OAAOC,OAAO,IAAGC,qBAAqB,QAAO,oBAAoB;AACjE,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,KAAK,MAAM,gBAAgB;AAElC,MAAMC,QAAQ,GAAGA,CACf;EACEC,QAAQ;EACRC,kBAAkB;EAClBC,qBAAqB;EACrBC,SAAS;EACT,YAAY,EAAEC,SAAS,GAAG,CAAC,CAAC;EAC5BC,eA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EAAE,CAAE;IACZC,YAAY;IACZC,UAAU,EAAE;EAAM,GAEjBlB,IACK,CAAC,eACTjE,KAAA,CAAAkE,aAAA,CAAClD,OAAO;IACNoE,QAAQ,EAAE,EAAG;IACbC,QAAQ,EAAExC,sBAAuB;IACjCM,gBAAgB,EAAEA,gBAAiB;IACnCmC,cAAc,EAAEtC,cAAe;IAC/BuC,oCAAoC,EAAExD,SAAS,CAAC,2BAA2B,CAAE;IAC7EyD,0BAA0B;EAAA,CAC3B,CACE,CAAC;AAEV,CAAC;AAEDpE,QAAQ,CAACqE,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG;EACnBpE,SAAS,EAAEnB,SAAS,CAACwF,MAAM;EAC3BxE,QAAQ,EAAEhB,SAAS,CAACyF,IAAI;EACxBlE,QAAQ,EAAEvB,SAAS,CAACyF,IAAI;EACxBxE,kBAAkB,EAAEjB,SAAS,CAACwF,MAAM;EACpCtE,qBAAqB,EAAElB,SAAS,CAACwF,MAAM;EACvCnE,eAAe,EAAErB,SAAS,CAAC0F,IAAI;EAC/B,YAAY,EAAE1F,SAAS,CAAC2F,KAAK,CAAC;IAC5B3E,QAAQ,EAAEhB,SAAS,CAACwF,MAAM;IAC1BpB,aAAa,EAAEpE,SAAS,CAACwF,MAAM;IAC/BtB,kBAAkB,EAAElE,SAAS,CAACwF;EAChC,CAAC;AACH,CAAC;AAEDzE,QAAQ,CAAC6E,YAAY,GAAG;EACtBnE,IAAI,EAAEjB,QAAQ,CAACqF,iBAAiB,CAACpE,IAAI;EACrCC,SAAS,EAAElB,QAAQ,CAACqF,iBAAiB,CAACnE;AACxC,CAAC;AAED,eAAeX,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"favorite.js","names":["React","useCallback","useMemo","useRef","useState","PropTypes","classnames","v5","uuidV5","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","GetSkinFromContext","GetTranslateFromContext","ToolTip","toggleStateOnKeyPress","Button","style","Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","_noop","disabled","legacyContext","skin","translate","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","_get","darkColor","brandColor","buttonRef","allowToolTip","_isEmpty","favoriteButtonAnchorId","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","_has","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","iconWrapperClassName","selected","icon","createElement","checkIcon","color","width","height","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","type","buttonContentClassName","onClick","onKeyDown","onMouseLeave","onMouseOver","tabIndex","useButtonTag","useWrapper","fontSize","anchorId","TooltipContent","closeToolTipInformationTextAriaLabel","stickyOnKeyboardNavigation","propTypes","process","env","NODE_ENV","string","bool","func","shape","contextTypes","childContextTypes"],"sources":["../../../src/molecule/card/favorite.js"],"sourcesContent":["import React, {useCallback, useMemo, useRef, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport {get, has, isEmpty, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationMore as MoreIcon,\n NovaCompositionCoorpacademyCheck as CheckIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Button from '../../atom/button';\nimport style from './favorite.css';\n\nconst Favorite = (\n {\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n className,\n 'aria-label': ariaLabel = {},\n onFavoriteClick = noop,\n disabled\n },\n legacyContext\n) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const handleFavoriteClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n if (!disabled) onFavoriteClick(e);\n },\n [disabled, onFavoriteClick]\n );\n\n const primaryColor = get('common.primary', skin);\n const darkColor = get('common.dark', skin);\n const brandColor = get('common.brand', skin);\n\n const buttonRef = useRef(null);\n\n const allowToolTip = useMemo(\n () => !isEmpty(removeFavoriteToolTip) && !isEmpty(addFavoriteToolTip),\n [addFavoriteToolTip, removeFavoriteToolTip]\n );\n\n // to be replaced by useId when React17 is bumped to React18\n const [favoriteButtonAnchorId] = useState(\n allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const toolTipContent = useMemo(\n // eslint-disable-next-line no-nested-ternary\n () => (allowToolTip ? (favorite ? removeFavoriteToolTip : addFavoriteToolTip) : null),\n [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n /* istanbul ignore next */ has(['current', 'focus'], buttonRef) && buttonRef.current.focus();\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(\n setTimeout(() => {\n setToolTipIsVisible(false);\n // @ts-expect-error (error: blur does not exists on type never)\n /* istanbul ignore next */ has(['current', 'blur'], buttonRef) && buttonRef.current.blur();\n }, 500)\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const iconWrapperClassName = useMemo(\n () => classnames(style.favorite, className, favorite && style.selected),\n [className, favorite]\n );\n const icon = useMemo(\n () =>\n favorite ? (\n <CheckIcon\n // eslint-disable-next-line css-modules/no-undef-class\n className={style.checkIcon}\n style={{color: brandColor}}\n width={13}\n height={13}\n data-testid=\"favorite-check-icon\"\n aria-label={ariaLabel.removeFromFavorite}\n />\n ) : (\n <MoreIcon\n className={style.moreIcon}\n style={{color: darkColor}}\n width={13}\n height={13}\n data-testid=\"favorite-add-icon\"\n aria-label={ariaLabel.addToFavorite}\n />\n ),\n [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]\n );\n\n return (\n <div className={style.favoriteWrapper} data-testid=\"favorite-wrapper\">\n <Button\n buttonRef={buttonRef}\n type=\"button\"\n data-for={favoriteButtonAnchorId}\n data-tooltip-place=\"left\"\n data-tip={allowToolTip}\n data-name=\"favorite\"\n data-testid=\"favorite-button\"\n aria-label={ariaLabel.favorite}\n buttonContentClassName={iconWrapperClassName}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n tabIndex={0}\n useButtonTag\n useWrapper={false}\n >\n {icon}\n </Button>\n <ToolTip\n fontSize={12}\n anchorId={favoriteButtonAnchorId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={toolTipContent}\n closeToolTipInformationTextAriaLabel={translate('close_tooltip_information')}\n stickyOnKeyboardNavigation\n />\n </div>\n );\n};\n\nFavorite.propTypes = {\n className: PropTypes.string,\n favorite: PropTypes.bool,\n disabled: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onFavoriteClick: PropTypes.func,\n 'aria-label': PropTypes.shape({\n favorite: PropTypes.string,\n addToFavorite: PropTypes.string,\n removeFromFavorite: PropTypes.string\n })\n};\n\nFavorite.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default Favorite;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AACnE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,EAAE,IAAIC,MAAM,QAAO,MAAM;AAEjC,SACEC,6BAA6B,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AQ,CAACmF,iBAAiB,CAACjE;AACxC,CAAC;AAED,eAAeX,QAAQ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/index.js"],"names":[],"mappings":";;;;;AA8QA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;;;AAnKF,uDA+HG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/index.js"],"names":[],"mappings":";;;;;AA2PA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;;;AAlKF,uDA8HG"}
@@ -8,11 +8,9 @@ import React, { useMemo, memo } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import classnames from 'classnames';
10
10
  import { NovaCompositionCoorpacademyPadlock as LockIcon, NovaCompositionCoorpacademyPictures as PicturesIcon } from '@coorpacademy/nova-icons';
11
- import { isExternalContent, ICONS_TYPES, EXTERNAL_CONTENT_ICONS } from '../../util/external-content';
11
+ import { isExternalContent, EXTERNAL_CONTENT_ICONS } from '../../util/external-content';
12
12
  import Provider from '../../atom/provider';
13
13
  import CardContentInfo, { MODES } from '../card-content';
14
- import FaIcon from '../../atom/icon';
15
- import { COLORS } from '../../variables/colors';
16
14
  import Customer from './customer';
17
15
  import Favorite from './favorite';
18
16
  import Selectable from './selectable';
@@ -22,7 +20,6 @@ export const THEMES = {
22
20
  default: null,
23
21
  coorpmanager: style.coorpmanager
24
22
  };
25
- const ICON_SIZE = '28px';
26
23
  const CardBackground = ({
27
24
  type,
28
25
  image,
@@ -34,35 +31,22 @@ const CardBackground = ({
34
31
  const externalContent = isExternalContent(type);
35
32
  const primaryColor = _get('common.primary', skin);
36
33
  const whiteColor = _get('common.white', skin);
37
- if (externalContent && EXTERNAL_CONTENT_ICONS[type] || type === 'chapter') {
38
- const {
39
- iconName,
40
- iconColor
41
- } = ICONS_TYPES[type];
34
+ if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {
35
+ const IconType = EXTERNAL_CONTENT_ICONS[type].icon;
36
+ const iconColor = EXTERNAL_CONTENT_ICONS[type].color;
42
37
  const backgroundIcon = /*#__PURE__*/React.createElement("div", {
43
- className: classnames(style.externalIconCircleWrapper, style.externalIconCircleWithImageWrapper)
44
- }, /*#__PURE__*/React.createElement(FaIcon, {
45
- iconName: iconName,
46
- customStyle: {
47
- color: COLORS.white,
48
- height: ICON_SIZE,
49
- width: ICON_SIZE
50
- }
38
+ className: style.externalIconCircleWrapper
39
+ }, /*#__PURE__*/React.createElement(IconType, {
40
+ className: style.externalIcon
51
41
  }));
52
42
  if (image) {
53
43
  const _backgroundIcon = /*#__PURE__*/React.createElement("div", {
54
44
  className: classnames(style.externalIconCircleWrapper, style.externalIconCircleWithImageWrapper),
55
45
  style: {
56
46
  backgroundColor: iconColor
57
- },
58
- "data-testid": "card-background-image"
59
- }, /*#__PURE__*/React.createElement(FaIcon, {
60
- iconName: iconName,
61
- customStyle: {
62
- color: COLORS.white,
63
- height: ICON_SIZE,
64
- width: ICON_SIZE
65
47
  }
48
+ }, /*#__PURE__*/React.createElement(IconType, {
49
+ className: style.externalIconWithImage
66
50
  }));
67
51
  return /*#__PURE__*/React.createElement("div", {
68
52
  className: style.imageWrapper
@@ -94,7 +78,7 @@ const CardBackground = ({
94
78
  }
95
79
  }) : null;
96
80
  return /*#__PURE__*/React.createElement("div", {
97
- className: style.imageWrapper
81
+ className: classnames(style.imageWrapper, type === 'chapter' ? style.chapterImageWrapper : null)
98
82
  }, /*#__PURE__*/React.createElement("div", {
99
83
  "data-name": "cover",
100
84
  "aria-label": ariaLabel,
@@ -151,7 +135,7 @@ const Card = /*#__PURE__*/memo(function Card(props, context) {
151
135
  } = props;
152
136
  const empty = _isEmpty(_pick(['title', 'type', 'author', 'image'], props));
153
137
  const primaryColor = _get('common.primary', skin);
154
- const cardStyle = classnames(THEMES[theme], style.course, title ? null : style.lazy, style.grid, empty ? style.empty : null);
138
+ const cardStyle = classnames(THEMES[theme], type === 'chapter' ? style.chapter : style.course, title ? null : style.lazy, style.grid, empty ? style.empty : null);
155
139
  const disabled = hidden && (!isSelected || _isUndefined(isSelected));
156
140
  const handleClick = useMemo(() => e => onClick(e), [onClick]);
157
141
  const lock = disabled ? /*#__PURE__*/React.createElement("div", {
@@ -180,8 +164,6 @@ const Card = /*#__PURE__*/memo(function Card(props, context) {
180
164
  return contentType;
181
165
  }
182
166
  };
183
- // eslint-disable-next-line no-console
184
- console.log('type of card', type, 'favorite', favorite);
185
167
  return /*#__PURE__*/React.createElement("div", {
186
168
  className: cardStyle,
187
169
  "data-name": "card",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useMemo","memo","PropTypes","classnames","NovaCompositionCoorpacademyPadlock","LockIcon","NovaCompositionCoorpacademyPictures","PicturesIcon","isExternalContent","ICONS_TYPES","EXTERNAL_CONTENT_ICONS","Provider","CardContentInfo","MODES","FaIcon","COLORS","Customer","Favorite","Selectable","Notification","style","THEMES","default","coorpmanager","ICON_SIZE","CardBackground","type","image","empty","ariaLabel","skin","externalContent","primaryColor","_get","whiteColor","iconName","iconColor","backgroundIcon","createElement","className","externalIconCircleWrapper","externalIconCircleWithImageWrapper","customStyle","color","white","height","width","_backgroundIcon","backgroundColor","imageWrapper","backgroundImage","externalContentHeader","externalBackground","emptyIcon","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","string","bool","Card","props","context","badge","adaptiv","disabled","hidden","title","author","customer","certifiedAuthor","progress","favorite","addFavoriteToolTip","removeFavoriteToolTip","onClick","onFavoriteClick","isSelected","notification","badgeCategory","badgeLabel","theme","disabledContent","cardArialabel","backgroundAriaLabel","favoriteAriaLabel","selectableAriaLabel","customerAriaLabel","badgeAriaLabel","disabledArialabel","cardContentLabelAriaLabel","_isEmpty","_pick","cardStyle","course","lazy","grid","_isUndefined","handleClick","e","lock","lockContent","lockIcon","dangerouslySetInnerHTML","__html","inlineBadgeStyle","getType","contentType","console","log","_extends","mode","CARD","lockWrapper","cardPropTypes","shape","number","func","oneOf","_keys"],"sources":["../../../src/molecule/card/index.js"],"sourcesContent":["import React, {useMemo, memo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, isUndefined, pick, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyPadlock as LockIcon,\n NovaCompositionCoorpacademyPictures as PicturesIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, ICONS_TYPES, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport CardContentInfo, {MODES} from '../card-content';\nimport FaIcon from '../../atom/icon';\nimport {COLORS} from '../../variables/colors';\nimport Customer from './customer';\nimport Favorite from './favorite';\nimport Selectable from './selectable';\nimport Notification from './notification';\nimport style from './style.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst ICON_SIZE = '28px';\n\nconst CardBackground = ({type, image, empty, 'aria-label': ariaLabel}, {skin}) => {\n const externalContent = isExternalContent(type);\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n\n if ((externalContent && EXTERNAL_CONTENT_ICONS[type]) || type === 'chapter') {\n const {iconName, iconColor} = ICONS_TYPES[type];\n const backgroundIcon = (\n <div\n className={classnames(\n style.externalIconCircleWrapper,\n style.externalIconCircleWithImageWrapper\n )}\n >\n <FaIcon\n iconName={iconName}\n customStyle={{\n color: COLORS.white,\n height: ICON_SIZE,\n width: ICON_SIZE\n }}\n />\n </div>\n );\n\n if (image) {\n const _backgroundIcon = (\n <div\n className={classnames(\n style.externalIconCircleWrapper,\n style.externalIconCircleWithImageWrapper\n )}\n style={{\n backgroundColor: iconColor\n }}\n data-testid=\"card-background-image\"\n >\n <FaIcon\n iconName={iconName}\n customStyle={{\n color: COLORS.white,\n height: ICON_SIZE,\n width: ICON_SIZE\n }}\n />\n </div>\n );\n\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor,\n backgroundImage: `url('${image}')`\n }}\n className={classnames(style.externalContentHeader, style.externalBackground)}\n >\n {_backgroundIcon}\n </div>\n </div>\n );\n }\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor\n }}\n className={style.externalContentHeader}\n >\n {backgroundIcon}\n </div>\n </div>\n );\n }\n\n const emptyIcon = empty ? (\n <PicturesIcon className={style.emptyIcon} style={{color: whiteColor}} />\n ) : null;\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n className={style.image}\n style={{\n backgroundColor: primaryColor,\n backgroundImage: image ? `url('${image}')` : 'none'\n }}\n >\n {emptyIcon}\n </div>\n </div>\n );\n};\n\nCardBackground.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCardBackground.propTypes = {\n type: PropTypes.string,\n image: PropTypes.string,\n empty: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst Card = memo(function Card(props, context) {\n const {skin} = context;\n const {\n image,\n badge,\n adaptiv,\n disabled: hidden = false,\n type = 'course',\n title,\n author,\n customer,\n certifiedAuthor,\n progress,\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n onClick,\n onFavoriteClick,\n isSelected,\n notification,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n disabledContent,\n 'aria-label': cardArialabel,\n 'background-aria-label': backgroundAriaLabel,\n 'favorite-aria-label': favoriteAriaLabel,\n 'selectable-aria-label': selectableAriaLabel,\n 'customer-aria-label': customerAriaLabel,\n 'badge-aria-label': badgeAriaLabel,\n 'disabled-aria-label': disabledArialabel,\n 'card-content-aria-label': cardContentLabelAriaLabel\n } = props;\n const empty = isEmpty(pick(['title', 'type', 'author', 'image'], props));\n const primaryColor = get('common.primary', skin);\n const cardStyle = classnames(\n THEMES[theme],\n style.course,\n title ? null : style.lazy,\n style.grid,\n empty ? style.empty : null\n );\n const disabled = hidden && (!isSelected || isUndefined(isSelected));\n const handleClick = useMemo(() => e => onClick(e), [onClick]);\n const lock = disabled ? (\n <div className={style.lockContent}>\n <LockIcon className={style.lockIcon} height={48} />\n <span\n aria-label={disabledArialabel}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: disabledContent}}\n />\n </div>\n ) : null;\n const inlineBadgeStyle = {color: primaryColor};\n const getType = contentType => {\n switch (contentType) {\n case 'chapter':\n return 'microlearning';\n case 'course':\n return 'learner';\n default:\n return contentType;\n }\n };\n // eslint-disable-next-line no-console\n console.log('type of card', type, 'favorite', favorite);\n return (\n <div\n className={cardStyle}\n data-name=\"card\"\n data-lock={disabled}\n data-type={getType(type)}\n disabled={disabled}\n onClick={handleClick}\n aria-label={cardArialabel}\n >\n <CardBackground type={type} image={image} empty={empty} aria-label={backgroundAriaLabel} />\n {isUndefined(isSelected) && !isUndefined(favorite) ? (\n <Favorite\n className={style.favorite}\n favorite={favorite}\n disabled={disabled}\n onFavoriteClick={onFavoriteClick}\n addFavoriteToolTip={addFavoriteToolTip}\n removeFavoriteToolTip={removeFavoriteToolTip}\n aria-label={favoriteAriaLabel}\n />\n ) : null}\n <Selectable isSelected={isSelected} hidden={hidden} aria-label={selectableAriaLabel} />\n {notification ? <Notification {...notification} /> : null}\n {customer ? (\n <Customer\n {...customer}\n theme={theme}\n type={type}\n disabled={disabled}\n aria-label={customerAriaLabel}\n />\n ) : null}\n <CardContentInfo\n mode={MODES.CARD}\n adaptiv={adaptiv}\n author={author}\n certifiedAuthor={certifiedAuthor}\n disabled={disabled}\n empty={empty}\n progress={progress}\n title={title}\n type={type}\n badgeCategory={badgeCategory}\n badgeLabel={badgeLabel}\n theme={theme}\n aria-label={cardContentLabelAriaLabel}\n />\n {badge ? (\n <div className={style.badge} style={inlineBadgeStyle} aria-label={badgeAriaLabel}>\n {badge}\n </div>\n ) : null}\n {disabled ? (\n <div className={style.lockWrapper} aria-label={disabledArialabel}>\n {lock}\n </div>\n ) : null}\n </div>\n );\n});\n\nCard.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport const cardPropTypes = {\n badge: PropTypes.string,\n image: PropTypes.string,\n disabled: PropTypes.bool,\n adaptiv: PropTypes.bool,\n type: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n customer: PropTypes.shape(Customer.propTypes),\n progress: PropTypes.number,\n favorite: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onClick: PropTypes.func,\n onFavoriteClick: PropTypes.func,\n isSelected: PropTypes.bool,\n notification: PropTypes.shape(Notification.propTypes),\n badgeCategory: CardContentInfo.propTypes.badgeCategory,\n badgeLabel: CardContentInfo.propTypes.badgeLabel,\n theme: PropTypes.oneOf(keys(THEMES)),\n disabledContent: PropTypes.string,\n 'aria-label': PropTypes.string,\n 'background-aria-label': PropTypes.string,\n 'favorite-aria-label': Favorite.propTypes['aria-label'],\n 'selectable-aria-label': Selectable.propTypes['aria-label'],\n 'customer-aria-label': Customer.propTypes['aria-label'],\n 'badge-aria-label': PropTypes.string,\n 'disabled-aria-label': PropTypes.string,\n 'card-content-aria-label': CardContentInfo.propTypes['aria-label']\n};\n\nCard.propTypes = cardPropTypes;\n\nexport default Card;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,IAAI,QAAO,OAAO;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,kCAAkC,IAAIC,QAAQ,EAC9CC,mCAAmC,IAAIC,YAAY,QAC9C,0BAA0B;AACjC,SAAQC,iBAAiB,EAAEC,WAAW,EAAEC,sBAAsB,QAAO,6BAA6B;AAClG,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,OAAOC,eAAe,IAAGC,KAAK,QAAO,iBAAiB;AACtD,OAAOC,MAAM,MAAM,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eAAe,CAAC4C,SAAS,CAAC,YAAY;AACnE,CAAC;AAEDM,IAAI,CAACN,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGyD,aAAa;AAE9B,eAAetD,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useMemo","memo","PropTypes","classnames","NovaCompositionCoorpacademyPadlock","LockIcon","NovaCompositionCoorpacademyPictures","PicturesIcon","isExternalContent","EXTERNAL_CONTENT_ICONS","Provider","CardContentInfo","MODES","Customer","Favorite","Selectable","Notification","style","THEMES","default","coorpmanager","CardBackground","type","image","empty","ariaLabel","skin","externalContent","primaryColor","_get","whiteColor","IconType","icon","iconColor","color","backgroundIcon","createElement","className","externalIconCircleWrapper","externalIcon","_backgroundIcon","externalIconCircleWithImageWrapper","backgroundColor","externalIconWithImage","imageWrapper","backgroundImage","externalContentHeader","externalBackground","emptyIcon","chapterImageWrapper","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","string","bool","Card","props","context","badge","adaptiv","disabled","hidden","title","author","customer","certifiedAuthor","progress","favorite","addFavoriteToolTip","removeFavoriteToolTip","onClick","onFavoriteClick","isSelected","notification","badgeCategory","badgeLabel","theme","disabledContent","cardArialabel","backgroundAriaLabel","favoriteAriaLabel","selectableAriaLabel","customerAriaLabel","badgeAriaLabel","disabledArialabel","cardContentLabelAriaLabel","_isEmpty","_pick","cardStyle","chapter","course","lazy","grid","_isUndefined","handleClick","e","lock","lockContent","lockIcon","height","dangerouslySetInnerHTML","__html","inlineBadgeStyle","getType","contentType","_extends","mode","CARD","lockWrapper","cardPropTypes","shape","number","func","oneOf","_keys"],"sources":["../../../src/molecule/card/index.js"],"sourcesContent":["import React, {useMemo, memo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, isUndefined, pick, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyPadlock as LockIcon,\n NovaCompositionCoorpacademyPictures as PicturesIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport CardContentInfo, {MODES} from '../card-content';\nimport Customer from './customer';\nimport Favorite from './favorite';\nimport Selectable from './selectable';\nimport Notification from './notification';\nimport style from './style.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst CardBackground = ({type, image, empty, 'aria-label': ariaLabel}, {skin}) => {\n const externalContent = isExternalContent(type);\n const primaryColor = get('common.primary', skin);\n const whiteColor = get('common.white', skin);\n\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const IconType = EXTERNAL_CONTENT_ICONS[type].icon;\n const iconColor = EXTERNAL_CONTENT_ICONS[type].color;\n const backgroundIcon = (\n <div className={style.externalIconCircleWrapper}>\n <IconType className={style.externalIcon} />\n </div>\n );\n\n if (image) {\n const _backgroundIcon = (\n <div\n className={classnames(\n style.externalIconCircleWrapper,\n style.externalIconCircleWithImageWrapper\n )}\n style={{\n backgroundColor: iconColor\n }}\n >\n <IconType className={style.externalIconWithImage} />\n </div>\n );\n\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor,\n backgroundImage: `url('${image}')`\n }}\n className={classnames(style.externalContentHeader, style.externalBackground)}\n >\n {_backgroundIcon}\n </div>\n </div>\n );\n }\n return (\n <div className={style.imageWrapper}>\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n style={{\n backgroundColor: iconColor\n }}\n className={style.externalContentHeader}\n >\n {backgroundIcon}\n </div>\n </div>\n );\n }\n\n const emptyIcon = empty ? (\n <PicturesIcon className={style.emptyIcon} style={{color: whiteColor}} />\n ) : null;\n return (\n <div\n className={classnames(\n style.imageWrapper,\n type === 'chapter' ? style.chapterImageWrapper : null\n )}\n >\n <div\n data-name=\"cover\"\n aria-label={ariaLabel}\n className={style.image}\n style={{\n backgroundColor: primaryColor,\n backgroundImage: image ? `url('${image}')` : 'none'\n }}\n >\n {emptyIcon}\n </div>\n </div>\n );\n};\n\nCardBackground.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCardBackground.propTypes = {\n type: PropTypes.string,\n image: PropTypes.string,\n empty: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst Card = memo(function Card(props, context) {\n const {skin} = context;\n const {\n image,\n badge,\n adaptiv,\n disabled: hidden = false,\n type = 'course',\n title,\n author,\n customer,\n certifiedAuthor,\n progress,\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n onClick,\n onFavoriteClick,\n isSelected,\n notification,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n disabledContent,\n 'aria-label': cardArialabel,\n 'background-aria-label': backgroundAriaLabel,\n 'favorite-aria-label': favoriteAriaLabel,\n 'selectable-aria-label': selectableAriaLabel,\n 'customer-aria-label': customerAriaLabel,\n 'badge-aria-label': badgeAriaLabel,\n 'disabled-aria-label': disabledArialabel,\n 'card-content-aria-label': cardContentLabelAriaLabel\n } = props;\n const empty = isEmpty(pick(['title', 'type', 'author', 'image'], props));\n const primaryColor = get('common.primary', skin);\n const cardStyle = classnames(\n THEMES[theme],\n type === 'chapter' ? style.chapter : style.course,\n title ? null : style.lazy,\n style.grid,\n empty ? style.empty : null\n );\n const disabled = hidden && (!isSelected || isUndefined(isSelected));\n const handleClick = useMemo(() => e => onClick(e), [onClick]);\n const lock = disabled ? (\n <div className={style.lockContent}>\n <LockIcon className={style.lockIcon} height={48} />\n <span\n aria-label={disabledArialabel}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: disabledContent}}\n />\n </div>\n ) : null;\n const inlineBadgeStyle = {color: primaryColor};\n const getType = contentType => {\n switch (contentType) {\n case 'chapter':\n return 'microlearning';\n case 'course':\n return 'learner';\n default:\n return contentType;\n }\n };\n\n return (\n <div\n className={cardStyle}\n data-name=\"card\"\n data-lock={disabled}\n data-type={getType(type)}\n disabled={disabled}\n onClick={handleClick}\n aria-label={cardArialabel}\n >\n <CardBackground type={type} image={image} empty={empty} aria-label={backgroundAriaLabel} />\n {isUndefined(isSelected) && !isUndefined(favorite) ? (\n <Favorite\n className={style.favorite}\n favorite={favorite}\n disabled={disabled}\n onFavoriteClick={onFavoriteClick}\n addFavoriteToolTip={addFavoriteToolTip}\n removeFavoriteToolTip={removeFavoriteToolTip}\n aria-label={favoriteAriaLabel}\n />\n ) : null}\n <Selectable isSelected={isSelected} hidden={hidden} aria-label={selectableAriaLabel} />\n {notification ? <Notification {...notification} /> : null}\n {customer ? (\n <Customer\n {...customer}\n theme={theme}\n type={type}\n disabled={disabled}\n aria-label={customerAriaLabel}\n />\n ) : null}\n <CardContentInfo\n mode={MODES.CARD}\n adaptiv={adaptiv}\n author={author}\n certifiedAuthor={certifiedAuthor}\n disabled={disabled}\n empty={empty}\n progress={progress}\n title={title}\n type={type}\n badgeCategory={badgeCategory}\n badgeLabel={badgeLabel}\n theme={theme}\n aria-label={cardContentLabelAriaLabel}\n />\n {badge ? (\n <div className={style.badge} style={inlineBadgeStyle} aria-label={badgeAriaLabel}>\n {badge}\n </div>\n ) : null}\n {disabled ? (\n <div className={style.lockWrapper} aria-label={disabledArialabel}>\n {lock}\n </div>\n ) : null}\n </div>\n );\n});\n\nCard.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport const cardPropTypes = {\n badge: PropTypes.string,\n image: PropTypes.string,\n disabled: PropTypes.bool,\n adaptiv: PropTypes.bool,\n type: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n customer: PropTypes.shape(Customer.propTypes),\n progress: PropTypes.number,\n favorite: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onClick: PropTypes.func,\n onFavoriteClick: PropTypes.func,\n isSelected: PropTypes.bool,\n notification: PropTypes.shape(Notification.propTypes),\n badgeCategory: CardContentInfo.propTypes.badgeCategory,\n badgeLabel: CardContentInfo.propTypes.badgeLabel,\n theme: PropTypes.oneOf(keys(THEMES)),\n disabledContent: PropTypes.string,\n 'aria-label': PropTypes.string,\n 'background-aria-label': PropTypes.string,\n 'favorite-aria-label': Favorite.propTypes['aria-label'],\n 'selectable-aria-label': Selectable.propTypes['aria-label'],\n 'customer-aria-label': Customer.propTypes['aria-label'],\n 'badge-aria-label': PropTypes.string,\n 'disabled-aria-label': PropTypes.string,\n 'card-content-aria-label': CardContentInfo.propTypes['aria-label']\n};\n\nCard.propTypes = cardPropTypes;\n\nexport default Card;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,IAAI,QAAO,OAAO;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,kCAAkC,IAAIC,QAAQ,EAC9CC,mCAAmC,IAAIC,YAAY,QAC9C,0BAA0B;AACjC,SAAQC,iBAAiB,EAAEC,sBAAsB,QAAO,6BAA6B;AACrF,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,OAAOC,eAAe,IAAGC,KAAK,QAAO,iBAAiB;AACtD,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,KAAK,MAAM,aAAa;AAE/B,OAAO,MAAMC,MAAM,GAAG;EACpBC,OAAO,EAAE,IAAI;EACbC,YAAY,EAAEH,KAAK,CAACG;AACtB,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAC;EAACC,IAAI;EAAEC,KAAK;EAAEC,KAAK;EAAE,YAAY,EAAEC;AAAS,CAAC,EAAE;EAACC;AAAI,CAAC,KAAK;EAChF,MAAMC,eAAe,GAAGnB,iBAAiB,CAACc,IAAI,CAAC;EAC/C,MAAMM,YAAY,GAAGC,IAAA,CAAI,gBAAgB,EAAEH,IAAI,CAAC;EAChD,MAAMI,UAAU,GAA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ACsD,MAAM;EACjC,YAAY,EAAEtD,SAAS,CAACsD,MAAM;EAC9B,uBAAuB,EAAEtD,SAAS,CAACsD,MAAM;EACzC,qBAAqB,EAAE1C,QAAQ,CAACsC,SAAS,CAAC,YAAY,CAAC;EACvD,uBAAuB,EAAErC,UAAU,CAACqC,SAAS,CAAC,YAAY,CAAC;EAC3D,qBAAqB,EAAEvC,QAAQ,CAACuC,SAAS,CAAC,YAAY,CAAC;EACvD,kBAAkB,EAAElD,SAAS,CAACsD,MAAM;EACpC,qBAAqB,EAAEtD,SAAS,CAACsD,MAAM;EACvC,yBAAyB,EAAE7C,eAAe,CAACyC,SAAS,CAAC,YAAY;AACnE,CAAC;AAEDM,IAAI,CAACN,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGyD,aAAa;AAE9B,eAAetD,IAAI","ignoreList":[]}
@@ -31,14 +31,12 @@
31
31
  animation: fadeIn 1s ease-out forwards;
32
32
  cursor: pointer;
33
33
  box-shadow: 0 0 13px 0 rgba(0, 0, 0, 0.11);
34
- border: 2px solid white;
35
34
  }
36
35
 
37
36
  .defaultStyle[disabled] .favorite {
38
37
  z-index: 0;
39
38
  }
40
39
 
41
-
42
40
  .grid.empty {
43
41
  padding-bottom: 25px;
44
42
  opacity: 0.6;
@@ -51,12 +49,12 @@
51
49
  height: 297px;
52
50
  }
53
51
 
54
- /* .chapter {
52
+ .chapter {
55
53
  composes: defaultStyle;
56
54
  border-radius: 8px;
57
55
  width: 203px;
58
56
  height: 297px;
59
- } */
57
+ }
60
58
 
61
59
  .coorpmanager.course {
62
60
  border-radius: 5px;
@@ -64,11 +62,11 @@
64
62
  height: 201px;
65
63
  }
66
64
 
67
- /* .coorpmanager.chapter {
65
+ .coorpmanager.chapter {
68
66
  border-radius: 5px;
69
67
  width: 138px;
70
68
  height: 201px;
71
- } */
69
+ }
72
70
 
73
71
  .course .imageWrapper {
74
72
  width: 100%;
@@ -78,7 +76,7 @@
78
76
  left: 0;
79
77
  }
80
78
 
81
- /* .chapter .chapterImageWrapper {
79
+ .chapter .chapterImageWrapper {
82
80
  max-height: 77px;
83
81
  width: 100%;
84
82
  position: absolute;
@@ -88,7 +86,7 @@
88
86
 
89
87
  .coorpmanager.chapter .chapterImageWrapper {
90
88
  max-height: 52px;
91
- } */
89
+ }
92
90
 
93
91
  .defaultStyle .image {
94
92
  overflow: hidden;
@@ -159,7 +157,8 @@
159
157
  }
160
158
 
161
159
  .course .defaultStyle:hover,
162
- .defaultStyle:hover {
160
+ .chapter .defaultStyle:hover {
161
+ background: light;
163
162
  cursor: pointer;
164
163
  transition: background 0.25s ease-in-out;
165
164
  }
@@ -274,8 +273,6 @@
274
273
  border-bottom-right-radius: 7px;
275
274
  z-index: 1;
276
275
  user-select: none;
277
- /* border-color: transparent;
278
- border-top-left-radius: 2px; */
279
276
  }
280
277
 
281
278
  .coorpmanager .badge {
@@ -364,7 +361,7 @@
364
361
  transition: transform 0.25s ease-in-out;
365
362
  }
366
363
 
367
- /* .externalIcon {
364
+ .externalIcon {
368
365
  color: white;
369
366
  width: 45px;
370
367
  height: 45px;
@@ -374,7 +371,7 @@
374
371
  color: white;
375
372
  width: 23px;
376
373
  height: 23px;
377
- } */
374
+ }
378
375
 
379
376
  .externalIconCircleWrapper::after {
380
377
  animation: pulse 3s linear 0s infinite;
@@ -434,7 +431,7 @@
434
431
  margin-top: 20px;
435
432
  }
436
433
 
437
- /* .coorpmanager .externalIconWithImage {
434
+ .coorpmanager .externalIconWithImage {
438
435
  color: white;
439
436
  width: 25px;
440
437
  height: 25px;
@@ -445,7 +442,7 @@
445
442
  color: white;
446
443
  width: 28px;
447
444
  height: 28px;
448
- } */
445
+ }
449
446
 
450
447
  .externalIconCircleWithImageWrapper::after,
451
448
  .externalIconCircleWithImageWrapper::before {
@@ -455,6 +452,7 @@
455
452
  top: 0;
456
453
  left: 0;
457
454
  position: absolute;
455
+
458
456
  border-radius: 50%;
459
457
  transform: scale(1);
460
458
  opacity: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card-content/index.js"],"names":[],"mappings":";;;;;;;;;;AAgIA;;;;;;;;;;;;;;gBA4EC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/card-content/index.js"],"names":[],"mappings":";;;;;;;;;;AAsHA;;;;;;;;;;;;;;gBA8EC"}
@@ -4,12 +4,10 @@ import _get from "lodash/fp/get";
4
4
  import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import classnames from 'classnames';
7
- import { NovaCompositionCoorpacademyAdaptive as AdaptivIcon, NovaSolidStatusCheckCircle2 as CheckIcon } from '@coorpacademy/nova-icons';
8
- import { isExternalContent } from '../../util/external-content';
7
+ import { NovaCompositionCoorpacademyAdaptive as AdaptivIcon, NovaSolidStatusCheckCircle2 as CheckIcon, NovaCompositionCoorpacademyTimer as TimerIcon } from '@coorpacademy/nova-icons';
8
+ import { isExternalContent, EXTERNAL_CONTENT_ICONS } from '../../util/external-content';
9
9
  import Provider from '../../atom/provider';
10
10
  import ContentBadge from '../../atom/content-badge';
11
- import Tag from '../../atom/tag';
12
- import { COLORS } from '../../variables/colors';
13
11
  import style from './style.css';
14
12
  export const MODES = {
15
13
  HERO: 'hero',
@@ -19,86 +17,45 @@ export const THEMES = {
19
17
  default: null,
20
18
  coorpmanager: style.coorpmanager
21
19
  };
22
- const getCardInfo = (contentType, translate) => {
23
- switch (contentType) {
24
- case 'chapter':
25
- return {
26
- label: "5'learning",
27
- iconName: 'stopwatch'
28
- };
29
- case 'scorm':
30
- return {
31
- label: translate('external_content_scorm'),
32
- iconName: 'rectangle-history'
33
- };
34
- case 'video':
35
- return {
36
- label: translate('external_content_video'),
37
- iconName: 'circle-play'
38
- };
39
- case 'article':
40
- return {
41
- label: translate('external_content_article'),
42
- iconName: 'file-lines'
43
- };
44
- case 'podcast':
45
- return {
46
- label: translate('external_content_podcast'),
47
- iconName: 'microphone-lines'
48
- };
49
- default:
50
- return {
51
- label: 'Course',
52
- iconName: 'book-open'
53
- };
54
- }
55
- };
56
20
  const ContentTypeInfo = ({
57
21
  mode,
58
22
  type,
59
- adaptiv,
60
- ariaLabel,
61
- isCourse,
62
- empty,
63
- theme
23
+ externalContent
64
24
  }, context) => {
65
25
  const {
66
26
  translate
67
27
  } = context;
68
- if (mode !== MODES.CARD || empty || theme === 'coorpmanager') {
28
+ if (mode !== MODES.CARD) {
69
29
  return null;
70
30
  }
71
- const {
72
- label,
73
- iconName
74
- } = getCardInfo(type, translate);
75
- return /*#__PURE__*/React.createElement("div", {
76
- className: style.contentTypeInfos
77
- }, /*#__PURE__*/React.createElement(Tag, {
78
- size: "S",
79
- label: label,
80
- icon: {
81
- iconName
82
- }
83
- }), adaptiv ? /*#__PURE__*/React.createElement("div", {
84
- className: classnames(style.adaptiveIcon, isCourse ? style.iconShadow : null)
85
- }, /*#__PURE__*/React.createElement(AdaptivIcon, {
86
- height: 25,
87
- "aria-label": _get('adaptive', ariaLabel)
88
- })) : null);
31
+ if (type === 'chapter') {
32
+ return /*#__PURE__*/React.createElement("div", {
33
+ className: style.microLearningIcon
34
+ }, /*#__PURE__*/React.createElement(TimerIcon, {
35
+ className: style.timerIcon
36
+ }), /*#__PURE__*/React.createElement("span", {
37
+ className: style.microLearninglabel
38
+ }, "5' learning"));
39
+ }
40
+ if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {
41
+ const textColor = EXTERNAL_CONTENT_ICONS[type].color;
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: style.contentTypeInfo,
44
+ style: {
45
+ color: textColor
46
+ }
47
+ }, type === 'scorm' ? translate('external_content_scorm') : '', type === 'video' ? translate('external_content_video') : '', type === 'article' ? translate('external_content_article') : '', type === 'podcast' ? translate('external_content_podcast') : '');
48
+ }
49
+ return null;
89
50
  };
90
51
  ContentTypeInfo.contextTypes = {
91
52
  skin: Provider.childContextTypes.skin,
92
53
  translate: Provider.childContextTypes.translate
93
54
  };
94
55
  ContentTypeInfo.propTypes = process.env.NODE_ENV !== "production" ? {
56
+ externalContent: PropTypes.bool,
95
57
  type: PropTypes.string,
96
- mode: PropTypes.string,
97
- adaptiv: PropTypes.bool,
98
- ariaLabel: PropTypes.string,
99
- isCourse: PropTypes.bool,
100
- empty: PropTypes.bool,
101
- theme: PropTypes.oneOf(_keys(THEMES))
58
+ mode: PropTypes.string
102
59
  } : {};
103
60
  const CardTitle = ({
104
61
  title,
@@ -160,7 +117,7 @@ const ContentInfo = ({
160
117
  theme = 'default',
161
118
  'aria-label': ariaLabel
162
119
  }) => {
163
- const progressBarColor = COLORS.cm_positive_500;
120
+ const progressBarColor = '#3EC483';
164
121
  const inlineProgressValueStyle = {
165
122
  backgroundColor: progressBarColor,
166
123
  width: `${progress * 100}%`
@@ -177,22 +134,24 @@ const ContentInfo = ({
177
134
  role: "progressbar",
178
135
  "aria-label": _get('progression', ariaLabel)
179
136
  }) : null) : null;
137
+ const adaptiveIcon = adaptiv ? /*#__PURE__*/React.createElement("div", {
138
+ className: classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)
139
+ }, /*#__PURE__*/React.createElement(AdaptivIcon, {
140
+ height: 25,
141
+ "aria-label": _get('adaptive', ariaLabel)
142
+ })) : null;
180
143
  return /*#__PURE__*/React.createElement("div", {
181
144
  "data-name": "info",
182
- className: classnames(THEMES[theme], style.infoWrapper, mode === MODES.HERO ? style.hero : style.card, disabled ? style.progressBarDisabled : null, externalContent || chapterContent || courseContent ? style.externalContent : null // generalize css class name
183
- )
145
+ className: classnames(THEMES[theme], style.infoWrapper, mode === MODES.HERO ? style.hero : style.card, disabled ? style.progressBarDisabled : null, externalContent ? style.externalContent : null)
184
146
  }, /*#__PURE__*/React.createElement(ContentTypeInfo, {
185
147
  mode: mode,
186
148
  type: type,
187
- adaptiv: adaptiv,
188
- isCourse: courseContent,
189
- empty: empty,
190
- theme: theme
149
+ externalContent: externalContent
191
150
  }), /*#__PURE__*/React.createElement("div", {
192
- className: style.cardInfo
151
+ className: classnames(style.cardInfo, chapterContent ? style.microLearningCardInfo : null)
193
152
  }, /*#__PURE__*/React.createElement("div", {
194
153
  className: style.iconWrapper
195
- }, !empty && badgeLabel && badgeCategory && courseContent ? /*#__PURE__*/React.createElement(ContentBadge, {
154
+ }, adaptiveIcon, !empty && badgeLabel && badgeCategory && courseContent ? /*#__PURE__*/React.createElement(ContentBadge, {
196
155
  category: badgeCategory,
197
156
  label: badgeLabel
198
157
  }) : null), /*#__PURE__*/React.createElement(CardTitle, {