@coorpacademy/components 11.32.4 → 11.32.6

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 (106) hide show
  1. package/es/atom/battle-opponent/index.d.ts.map +1 -1
  2. package/es/atom/battle-opponent/index.js +1 -1
  3. package/es/atom/battle-opponent/index.js.map +1 -1
  4. package/es/molecule/card/favorite.d.ts.map +1 -1
  5. package/es/molecule/card/favorite.js +1 -1
  6. package/es/molecule/card/favorite.js.map +1 -1
  7. package/es/molecule/discipline-associated-skills/index.d.ts +17 -0
  8. package/es/molecule/discipline-associated-skills/index.d.ts.map +1 -0
  9. package/es/molecule/discipline-associated-skills/index.js +74 -0
  10. package/es/molecule/discipline-associated-skills/index.js.map +1 -0
  11. package/es/molecule/discipline-associated-skills/style.css +70 -0
  12. package/es/molecule/learning-profile-radar-chart/index.d.ts +28 -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 +114 -27
  15. package/es/molecule/learning-profile-radar-chart/index.js.map +1 -1
  16. package/es/molecule/learning-profile-radar-chart/style.css +14 -0
  17. package/es/molecule/learning-profile-radar-chart/types.d.ts +2 -0
  18. package/es/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
  19. package/es/molecule/learning-profile-radar-chart/types.js +2 -1
  20. package/es/molecule/learning-profile-radar-chart/types.js.map +1 -1
  21. package/es/molecule/review-correction-popin/index.d.ts.map +1 -1
  22. package/es/molecule/review-correction-popin/index.js +1 -1
  23. package/es/molecule/review-correction-popin/index.js.map +1 -1
  24. package/es/organism/user-preferences/index.d.ts.map +1 -1
  25. package/es/organism/user-preferences/index.js +1 -1
  26. package/es/organism/user-preferences/index.js.map +1 -1
  27. package/es/template/activity/engine-stars.d.ts.map +1 -1
  28. package/es/template/activity/engine-stars.js +1 -1
  29. package/es/template/activity/engine-stars.js.map +1 -1
  30. package/es/template/common/discipline/index.d.ts +6 -0
  31. package/es/template/common/discipline/index.d.ts.map +1 -1
  32. package/es/template/common/discipline/index.js +17 -2
  33. package/es/template/common/discipline/index.js.map +1 -1
  34. package/es/template/common/discipline/style.css +4 -1
  35. package/es/template/my-learning/index.d.ts.map +1 -1
  36. package/es/template/my-learning/index.js +2 -1
  37. package/es/template/my-learning/index.js.map +1 -1
  38. package/es/template/my-learning/style.css +4 -0
  39. package/lib/atom/battle-opponent/index.d.ts.map +1 -1
  40. package/lib/atom/battle-opponent/index.js +1 -1
  41. package/lib/atom/battle-opponent/index.js.map +1 -1
  42. package/lib/molecule/card/favorite.d.ts.map +1 -1
  43. package/lib/molecule/card/favorite.js +1 -1
  44. package/lib/molecule/card/favorite.js.map +1 -1
  45. package/lib/molecule/discipline-associated-skills/index.d.ts +17 -0
  46. package/lib/molecule/discipline-associated-skills/index.d.ts.map +1 -0
  47. package/lib/molecule/discipline-associated-skills/index.js +95 -0
  48. package/lib/molecule/discipline-associated-skills/index.js.map +1 -0
  49. package/lib/molecule/discipline-associated-skills/style.css +70 -0
  50. package/lib/molecule/learning-profile-radar-chart/index.d.ts +28 -1
  51. package/lib/molecule/learning-profile-radar-chart/index.d.ts.map +1 -1
  52. package/lib/molecule/learning-profile-radar-chart/index.js +116 -27
  53. package/lib/molecule/learning-profile-radar-chart/index.js.map +1 -1
  54. package/lib/molecule/learning-profile-radar-chart/style.css +14 -0
  55. package/lib/molecule/learning-profile-radar-chart/types.d.ts +2 -0
  56. package/lib/molecule/learning-profile-radar-chart/types.d.ts.map +1 -1
  57. package/lib/molecule/learning-profile-radar-chart/types.js +2 -1
  58. package/lib/molecule/learning-profile-radar-chart/types.js.map +1 -1
  59. package/lib/molecule/review-correction-popin/index.d.ts.map +1 -1
  60. package/lib/molecule/review-correction-popin/index.js +1 -1
  61. package/lib/molecule/review-correction-popin/index.js.map +1 -1
  62. package/lib/organism/user-preferences/index.d.ts.map +1 -1
  63. package/lib/organism/user-preferences/index.js +1 -1
  64. package/lib/organism/user-preferences/index.js.map +1 -1
  65. package/lib/template/activity/engine-stars.d.ts.map +1 -1
  66. package/lib/template/activity/engine-stars.js +1 -1
  67. package/lib/template/activity/engine-stars.js.map +1 -1
  68. package/lib/template/common/discipline/index.d.ts +6 -0
  69. package/lib/template/common/discipline/index.d.ts.map +1 -1
  70. package/lib/template/common/discipline/index.js +18 -2
  71. package/lib/template/common/discipline/index.js.map +1 -1
  72. package/lib/template/common/discipline/style.css +4 -1
  73. package/lib/template/my-learning/index.d.ts.map +1 -1
  74. package/lib/template/my-learning/index.js +2 -1
  75. package/lib/template/my-learning/index.js.map +1 -1
  76. package/lib/template/my-learning/style.css +4 -0
  77. package/locales/bs/global.json +3 -1
  78. package/locales/cs/global.json +4 -2
  79. package/locales/de/global.json +3 -1
  80. package/locales/en/global.json +3 -1
  81. package/locales/es/global.json +3 -1
  82. package/locales/et/global.json +3 -1
  83. package/locales/fi/global.json +3 -1
  84. package/locales/fr/global.json +3 -1
  85. package/locales/hr/global.json +3 -1
  86. package/locales/hu/global.json +3 -1
  87. package/locales/hy/global.json +3 -1
  88. package/locales/it/global.json +3 -1
  89. package/locales/ja/global.json +3 -1
  90. package/locales/ko/global.json +3 -1
  91. package/locales/nl/global.json +3 -1
  92. package/locales/pl/global.json +3 -1
  93. package/locales/pt/global.json +3 -1
  94. package/locales/ro/global.json +3 -1
  95. package/locales/ru/global.json +3 -1
  96. package/locales/sk/global.json +3 -1
  97. package/locales/sl/global.json +3 -1
  98. package/locales/sv/global.json +3 -1
  99. package/locales/th/global.json +1 -1
  100. package/locales/tl/global.json +4 -2
  101. package/locales/tr/global.json +3 -1
  102. package/locales/uk/global.json +3 -1
  103. package/locales/vi/global.json +4 -2
  104. package/locales/zh/global.json +3 -1
  105. package/locales/zh_TW/global.json +3 -1
  106. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/battle-opponent/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAkB,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAG5D,QAAA,MAAM,cAAc;gHASf,mBAAmB,iBACP,gBAAgB;;;;;;;;;;;;;CA2GhC,CAAC;AAQF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/battle-opponent/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAkB,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAG5D,QAAA,MAAM,cAAc;gHASf,mBAAmB,iBACP,gBAAgB;;;;;;;;;;;;;CAyGhC,CAAC;AAQF,eAAe,cAAc,CAAC"}
@@ -90,7 +90,7 @@ const BattleOpponent = ({
90
90
  anchorId: battleOpponentInfoId,
91
91
  toolTipIsVisible: toolTipIsVisible,
92
92
  TooltipContent: TooltipContent,
93
- closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text')
93
+ closeToolTipInformationTextAriaLabel: translate('close_tooltip_information')
94
94
  }))) : /*#__PURE__*/React.createElement(ArrowRight, {
95
95
  className: style.rightArrow,
96
96
  width: 16,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useRef","classnames","v5","uuidV5","has","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyInformationIcon","InformationIcon","ToolTip","toggleStateOnKeyPress","Provider","GetTranslateFromContext","propTypes","style","BattleOpponent","isAlreadyEngaged","isRandom","userAvatarSrc","onClick","displayName","tooltipText","ariaLabel","legacyContext","translate","wrapperClassnames","card","random","displayNameClassnames","name","alreadyEngaged","mouseLeaveTimer","setMouseLeaveTimer","undefined","toolTipIsVisible","setToolTipIsVisible","battleOpponentInfoId","URL","buttonRef","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","TooltipContent","_props","avatar","tooltipIconContainer","informationIcon","toolTipWrapper","rightArrow","contextTypes","childContextTypes"],"sources":["../../../src/atom/battle-opponent/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useRef} from 'react';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport has from 'lodash/fp/has';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyInformationIcon as InformationIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip, {toggleStateOnKeyPress} from '../tooltip';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport propTypes, {BattleOpponentProps} from './prop-types';\nimport style from './style.css';\n\nconst BattleOpponent = (\n {\n isAlreadyEngaged,\n isRandom,\n userAvatarSrc,\n onClick,\n displayName,\n tooltipText,\n 'aria-label': ariaLabel\n }: BattleOpponentProps,\n legacyContext: WebContextValues\n) => {\n const translate: Required<WebContextValues>['translate'] = GetTranslateFromContext(legacyContext);\n const wrapperClassnames = useMemo(\n () => classnames(style.card, style['opponent-card'], isRandom ? style.random : null),\n [isRandom]\n );\n\n const displayNameClassnames = useMemo(\n () => classnames(style.name, isAlreadyEngaged ? style.alreadyEngaged : null),\n [isAlreadyEngaged]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState<number | undefined>(undefined);\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n // to be replaced by useId when React17 is bumped to React18\n const [battleOpponentInfoId] = useState(\n isAlreadyEngaged ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const buttonRef = useRef(null);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n // @ts-expect-error (error: focus does not exists on type never)\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) as unknown as number\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const TooltipContent = useCallback(\n _props => (\n <p\n {..._props}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-testid=\"battle-opponent-tooltip-content\"\n >\n {tooltipText}\n </p>\n ),\n [handleMouseLeave, handleMouseOver, tooltipText]\n );\n\n return (\n <li\n {...(!isAlreadyEngaged && {onClick})}\n className={wrapperClassnames}\n data-testid=\"battle-opponent-wrapper\"\n tabIndex={0}\n >\n <div className={style.avatar}>{isRandom ? null : <img src={userAvatarSrc} alt=\"\" />}</div>\n <p className={displayNameClassnames} tabIndex={0}>\n {displayName}\n </p>\n {isAlreadyEngaged ? (\n <>\n <button\n ref={buttonRef}\n tabIndex={0}\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid=\"battle-engaged-opponent-information-button\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n data-for={battleOpponentInfoId}\n data-tooltip-place=\"left\"\n data-tip={isAlreadyEngaged}\n aria-label={ariaLabel}\n >\n <InformationIcon className={style.informationIcon} width={20} height={20} />\n </button>\n <span className={style.toolTipWrapper}>\n <ToolTip\n fontSize={12}\n anchorId={battleOpponentInfoId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n />\n </span>\n </>\n ) : (\n <ArrowRight className={style.rightArrow} width={16} height={16} />\n )}\n </li>\n );\n};\n\nBattleOpponent.propTypes = propTypes;\n\nBattleOpponent.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default BattleOpponent;\n"],"mappings":";;AAAA,OAAO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cAAc,CAACwC,YAAf,GAA8B;EAC5B/B,SAAS,EAAEb,QAAQ,CAAC6C,iBAAT,CAA2BhC;AADV,CAA9B;AAIA,eAAeT,cAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useRef","classnames","v5","uuidV5","has","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyInformationIcon","InformationIcon","ToolTip","toggleStateOnKeyPress","Provider","GetTranslateFromContext","propTypes","style","BattleOpponent","isAlreadyEngaged","isRandom","userAvatarSrc","onClick","displayName","tooltipText","ariaLabel","legacyContext","translate","wrapperClassnames","card","random","displayNameClassnames","name","alreadyEngaged","mouseLeaveTimer","setMouseLeaveTimer","undefined","toolTipIsVisible","setToolTipIsVisible","battleOpponentInfoId","URL","buttonRef","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","TooltipContent","_props","avatar","tooltipIconContainer","informationIcon","toolTipWrapper","rightArrow","contextTypes","childContextTypes"],"sources":["../../../src/atom/battle-opponent/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useRef} from 'react';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport has from 'lodash/fp/has';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyInformationIcon as InformationIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip, {toggleStateOnKeyPress} from '../tooltip';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport propTypes, {BattleOpponentProps} from './prop-types';\nimport style from './style.css';\n\nconst BattleOpponent = (\n {\n isAlreadyEngaged,\n isRandom,\n userAvatarSrc,\n onClick,\n displayName,\n tooltipText,\n 'aria-label': ariaLabel\n }: BattleOpponentProps,\n legacyContext: WebContextValues\n) => {\n const translate: Required<WebContextValues>['translate'] = GetTranslateFromContext(legacyContext);\n const wrapperClassnames = useMemo(\n () => classnames(style.card, style['opponent-card'], isRandom ? style.random : null),\n [isRandom]\n );\n\n const displayNameClassnames = useMemo(\n () => classnames(style.name, isAlreadyEngaged ? style.alreadyEngaged : null),\n [isAlreadyEngaged]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState<number | undefined>(undefined);\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n // to be replaced by useId when React17 is bumped to React18\n const [battleOpponentInfoId] = useState(\n isAlreadyEngaged ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const buttonRef = useRef(null);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n // @ts-expect-error (error: focus does not exists on type never)\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) as unknown as number\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const TooltipContent = useCallback(\n _props => (\n <p\n {..._props}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-testid=\"battle-opponent-tooltip-content\"\n >\n {tooltipText}\n </p>\n ),\n [handleMouseLeave, handleMouseOver, tooltipText]\n );\n\n return (\n <li\n {...(!isAlreadyEngaged && {onClick})}\n className={wrapperClassnames}\n data-testid=\"battle-opponent-wrapper\"\n tabIndex={0}\n >\n <div className={style.avatar}>{isRandom ? null : <img src={userAvatarSrc} alt=\"\" />}</div>\n <p className={displayNameClassnames} tabIndex={0}>\n {displayName}\n </p>\n {isAlreadyEngaged ? (\n <>\n <button\n ref={buttonRef}\n tabIndex={0}\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid=\"battle-engaged-opponent-information-button\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n data-for={battleOpponentInfoId}\n data-tooltip-place=\"left\"\n data-tip={isAlreadyEngaged}\n aria-label={ariaLabel}\n >\n <InformationIcon className={style.informationIcon} width={20} height={20} />\n </button>\n <span className={style.toolTipWrapper}>\n <ToolTip\n fontSize={12}\n anchorId={battleOpponentInfoId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={translate('close_tooltip_information')}\n />\n </span>\n </>\n ) : (\n <ArrowRight className={style.rightArrow} width={16} height={16} />\n )}\n </li>\n );\n};\n\nBattleOpponent.propTypes = propTypes;\n\nBattleOpponent.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default BattleOpponent;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,EAA+CC,MAA/C,QAA4D,OAA5D;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SACEC,mCAAmC,IAAIC,UADzC,EAEEC,0CAA0C,IAAIC,eAFhD,QAGO,0BAHP;AAIA,OAAOC,OAAP,IAAiBC,qBAAjB,QAA6C,YAA7C;AACA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,aAAhD;AAEA,OAAOC,SAAP,MAA6C,cAA7C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,cAAc,GAAG,CACrB;EACEC,gBADF;EAEEC,QAFF;EAGEC,aAHF;EAIEC,OAJF;EAKEC,WALF;EAMEC,WANF;EAOE,cAAcC;AAPhB,CADqB,EAUrBC,aAVqB,KAWlB;EACH,MAAMC,SAAkD,GAAGZ,uBAAuB,CAACW,aAAD,CAAlF;EACA,MAAME,i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YM;EAZd,gBAcE,oBAAC,eAAD;IAAiB,SAAS,EAAER,KAAK,CAACsC,eAAlC;IAAmD,KAAK,EAAE,EAA1D;IAA8D,MAAM,EAAE;EAAtE,EAdF,CADF,eAiBE;IAAM,SAAS,EAAEtC,KAAK,CAACuC;EAAvB,gBACE,oBAAC,OAAD;IACE,QAAQ,EAAE,EADZ;IAEE,QAAQ,EAAEjB,oBAFZ;IAGE,gBAAgB,EAAEF,gBAHpB;IAIE,cAAc,EAAEc,cAJlB;IAKE,oCAAoC,EAAExB,SAAS,CAAC,2BAAD;EALjD,EADF,CAjBF,CADe,gBA6Bf,oBAAC,UAAD;IAAY,SAAS,EAAEV,KAAK,CAACwC,UAA7B;IAAyC,KAAK,EAAE,EAAhD;IAAoD,MAAM,EAAE;EAA5D,EAvCJ,CADF;AA4CD,CAnHD;;AAqHAvC,cAAc,CAACF,SAAf,2CAA2BA,SAA3B;AAEAE,cAAc,CAACwC,YAAf,GAA8B;EAC5B/B,SAAS,EAAEb,QAAQ,CAAC6C,iBAAT,CAA2BhC;AADV,CAA9B;AAIA,eAAeT,cAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAcA;;;;;;;;oCA0IC"}
1
+ {"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAcA;;;;;;;;oCAwIC"}
@@ -111,7 +111,7 @@ const Favorite = ({
111
111
  anchorId: favoriteButtonAnchorId,
112
112
  toolTipIsVisible: toolTipIsVisible,
113
113
  TooltipContent: toolTipContent,
114
- closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text'),
114
+ closeToolTipInformationTextAriaLabel: translate('close_tooltip_information'),
115
115
  stickyOnKeyboardNavigation: true
116
116
  }));
117
117
  };
@@ -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","disabled","legacyContext","skin","translate","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","buttonRef","allowToolTip","favoriteButtonAnchorId","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","iconWrapperClassName","selected","icon","checkIcon","color","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","propTypes","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(\n 'Press the escape key to close the information text'\n )}\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,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,MAArC,EAA6CC,QAA7C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AAEA,SACEC,6BAA6B,IAAIC,QADnC,EAEEC,gCAAgC,IAAIC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IAiBE,QAAQ,EAAE,CAjBZ;IAkBE,YAAY,MAlBd;IAmBE,UAAU,EAAE;EAnBd,GAqBGW,IArBH,CADF,eAwBE,oBAAC,OAAD;IACE,QAAQ,EAAE,EADZ;IAEE,QAAQ,EAAEnB,sBAFZ;IAGE,gBAAgB,EAAEM,gBAHpB;IAIE,cAAc,EAAEH,cAJlB;IAKE,oCAAoC,EAAEb,SAAS,CAC7C,oDAD6C,CALjD;IAQE,0BAA0B;EAR5B,EAxBF,CADF;AAqCD,CA1ID;;AA4IAV,QAAQ,CAAC8C,SAAT,2CAAqB;EACnB1C,SAAS,EAAEnB,SAAS,CAAC8D,MADF;EAEnB9C,QAAQ,EAAEhB,SAAS,CAAC+D,IAFD;EAGnBzC,QAAQ,EAAEtB,SAAS,CAAC+D,IAHD;EAInB9C,kBAAkB,EAAEjB,SAAS,CAAC8D,MAJX;EAKnB5C,qBAAqB,EAAElB,SAAS,CAAC8D,MALd;EAMnBzC,eAAe,EAAErB,SAAS,CAACgE,IANR;EAOnB,cAAchE,SAAS,CAACiE,KAAV,CAAgB;IAC5BjD,QAAQ,EAAEhB,SAAS,CAAC8D,MADQ;IAE5BH,aAAa,EAAE3D,SAAS,CAAC8D,MAFG;IAG5BL,kBAAkB,EAAEzD,SAAS,CAAC8D;EAHF,CAAhB;AAPK,CAArB;AAcA/C,QAAQ,CAACmD,YAAT,GAAwB;EACtB1C,IAAI,EAAEhB,QAAQ,CAAC2D,iBAAT,CAA2B3C,IADX;EAEtBC,SAAS,EAAEjB,QAAQ,CAAC2D,iBAAT,CAA2B1C;AAFhB,CAAxB;AAKA,eAAeV,QAAf"}
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","disabled","legacyContext","skin","translate","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","buttonRef","allowToolTip","favoriteButtonAnchorId","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","iconWrapperClassName","selected","icon","checkIcon","color","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","propTypes","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,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,MAArC,EAA6CC,QAA7C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AAEA,SACEC,6BAA6B,IAAIC,QADnC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,kBAAlB,EAAsCC,uBAAtC,QAAoE,qBAApE;AACA,OAAOC,OAAP,IAAiBC,qBAAjB,QAA6C,oBAA7C;AACA,OAAOC,MAAP,MAAmB,mBAA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IAGE,gBAAgB,EAAEM,gBAHpB;IAIE,cAAc,EAAEH,cAJlB;IAKE,oCAAoC,EAAEb,SAAS,CAAC,2BAAD,CALjD;IAME,0BAA0B;EAN5B,EAxBF,CADF;AAmCD,CAxID;;AA0IAV,QAAQ,CAAC8C,SAAT,2CAAqB;EACnB1C,SAAS,EAAEnB,SAAS,CAAC8D,MADF;EAEnB9C,QAAQ,EAAEhB,SAAS,CAAC+D,IAFD;EAGnBzC,QAAQ,EAAEtB,SAAS,CAAC+D,IAHD;EAInB9C,kBAAkB,EAAEjB,SAAS,CAAC8D,MAJX;EAKnB5C,qBAAqB,EAAElB,SAAS,CAAC8D,MALd;EAMnBzC,eAAe,EAAErB,SAAS,CAACgE,IANR;EAOnB,cAAchE,SAAS,CAACiE,KAAV,CAAgB;IAC5BjD,QAAQ,EAAEhB,SAAS,CAAC8D,MADQ;IAE5BH,aAAa,EAAE3D,SAAS,CAAC8D,MAFG;IAG5BL,kBAAkB,EAAEzD,SAAS,CAAC8D;EAHF,CAAhB;AAPK,CAArB;AAcA/C,QAAQ,CAACmD,YAAT,GAAwB;EACtB1C,IAAI,EAAEhB,QAAQ,CAAC2D,iBAAT,CAA2B3C,IADX;EAEtBC,SAAS,EAAEjB,QAAQ,CAAC2D,iBAAT,CAA2B1C;AAFhB,CAAxB;AAKA,eAAeV,QAAf"}
@@ -0,0 +1,17 @@
1
+ export default DisciplineAssociatedSkills;
2
+ declare function DisciplineAssociatedSkills(props: any, context: any): JSX.Element | null;
3
+ declare namespace DisciplineAssociatedSkills {
4
+ namespace contextTypes {
5
+ const translate: PropTypes.Requireable<(...args: any[]) => any>;
6
+ }
7
+ namespace propTypes {
8
+ const skills: PropTypes.Requireable<(PropTypes.InferProps<{
9
+ ref: PropTypes.Requireable<string>;
10
+ locale: PropTypes.Requireable<string>;
11
+ focused: PropTypes.Requireable<boolean>;
12
+ }> | null | undefined)[]>;
13
+ const onSkillClick: PropTypes.Requireable<(...args: any[]) => any>;
14
+ }
15
+ }
16
+ import PropTypes from "prop-types";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/discipline-associated-skills/index.js"],"names":[],"mappings":";AAUA,0FA2DC"}
@@ -0,0 +1,74 @@
1
+ import _uniqueId from "lodash/fp/uniqueId";
2
+ import _isEmpty from "lodash/fp/isEmpty";
3
+ import React, { useCallback } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import classnames from 'classnames';
6
+ import Icon from '../../atom/icon';
7
+ import ToolTip from '../../atom/tooltip';
8
+ import Provider from '../../atom/provider';
9
+ import CatalogSection from '../../atom/catalog-section';
10
+ import style from './style.css';
11
+
12
+ const DisciplineAssociatedSkills = (props, context) => {
13
+ const {
14
+ translate
15
+ } = context;
16
+ const {
17
+ skills = [],
18
+ onSkillClick
19
+ } = props;
20
+ const AnchorElement = useCallback(skill => /*#__PURE__*/React.createElement("div", {
21
+ className: style.chipFocusedContent
22
+ }, /*#__PURE__*/React.createElement(Icon, {
23
+ iconName: "bullseye-arrow",
24
+ backgroundColor: "#DDD1FF",
25
+ size: {
26
+ faSize: 12,
27
+ wrapperSize: 12
28
+ }
29
+ }), skill), []);
30
+ return !_isEmpty(skills) ? /*#__PURE__*/React.createElement("div", {
31
+ "data-name": "discipline-associated-skills",
32
+ className: style.associatedSkillsWrapper
33
+ }, /*#__PURE__*/React.createElement(CatalogSection, {
34
+ title: translate('associated_skills')
35
+ }, /*#__PURE__*/React.createElement("div", {
36
+ className: style.chipsWrapper
37
+ }, skills.map(skill => {
38
+ function handleSkillClick() {
39
+ return onSkillClick(skill.ref);
40
+ }
41
+
42
+ function handleAnchorElement() {
43
+ return AnchorElement(skill.locale);
44
+ }
45
+
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ key: _uniqueId(),
48
+ className: classnames(style.chipWrapper, skill.focused && style.chipWrapperFocused),
49
+ onClick: handleSkillClick
50
+ }, skill.focused ? /*#__PURE__*/React.createElement(ToolTip, {
51
+ AnchorElement: handleAnchorElement,
52
+ fontSize: 12,
53
+ delayHide: 0,
54
+ iconContainerClassName: style.infoIconTooltip,
55
+ tooltipClassName: style.tooltip,
56
+ TooltipContent: translate('skill_focused_chip_tooltip'),
57
+ closeToolTipInformationTextAriaLabel: translate('close_tooltip_information')
58
+ }) : skill.locale);
59
+ })))) : null;
60
+ };
61
+
62
+ DisciplineAssociatedSkills.contextTypes = {
63
+ translate: Provider.childContextTypes.translate
64
+ };
65
+ DisciplineAssociatedSkills.propTypes = process.env.NODE_ENV !== "production" ? {
66
+ skills: PropTypes.arrayOf(PropTypes.shape({
67
+ ref: PropTypes.string,
68
+ locale: PropTypes.string,
69
+ focused: PropTypes.bool
70
+ })),
71
+ onSkillClick: PropTypes.func
72
+ } : {};
73
+ export default DisciplineAssociatedSkills;
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","useCallback","PropTypes","classnames","Icon","ToolTip","Provider","CatalogSection","style","DisciplineAssociatedSkills","props","context","translate","skills","onSkillClick","AnchorElement","skill","chipFocusedContent","faSize","wrapperSize","associatedSkillsWrapper","chipsWrapper","map","handleSkillClick","ref","handleAnchorElement","locale","chipWrapper","focused","chipWrapperFocused","infoIconTooltip","tooltip","contextTypes","childContextTypes","propTypes","arrayOf","shape","string","bool","func"],"sources":["../../../src/molecule/discipline-associated-skills/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isEmpty, uniqueId} from 'lodash/fp';\nimport Icon from '../../atom/icon';\nimport ToolTip from '../../atom/tooltip';\nimport Provider from '../../atom/provider';\nimport CatalogSection from '../../atom/catalog-section';\nimport style from './style.css';\n\nconst DisciplineAssociatedSkills = (props, context) => {\n const {translate} = context;\n\n const {skills = [], onSkillClick} = props;\n\n const AnchorElement = useCallback(\n skill => (\n <div className={style.chipFocusedContent}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 12,\n wrapperSize: 12\n }}\n />\n {skill}\n </div>\n ),\n []\n );\n\n return !isEmpty(skills) ? (\n <div data-name=\"discipline-associated-skills\" className={style.associatedSkillsWrapper}>\n <CatalogSection title={translate('associated_skills')}>\n <div className={style.chipsWrapper}>\n {skills.map(skill => {\n function handleSkillClick() {\n return onSkillClick(skill.ref);\n }\n function handleAnchorElement() {\n return AnchorElement(skill.locale);\n }\n return (\n <div\n key={uniqueId()}\n className={classnames(style.chipWrapper, skill.focused && style.chipWrapperFocused)}\n onClick={handleSkillClick}\n >\n {skill.focused ? (\n <ToolTip\n AnchorElement={handleAnchorElement}\n fontSize={12}\n delayHide={0}\n iconContainerClassName={style.infoIconTooltip}\n tooltipClassName={style.tooltip}\n TooltipContent={translate('skill_focused_chip_tooltip')}\n closeToolTipInformationTextAriaLabel={translate('close_tooltip_information')}\n />\n ) : (\n skill.locale\n )}\n </div>\n );\n })}\n </div>\n </CatalogSection>\n </div>\n ) : null;\n};\n\nDisciplineAssociatedSkills.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nDisciplineAssociatedSkills.propTypes = {\n skills: PropTypes.arrayOf(\n PropTypes.shape({\n ref: PropTypes.string,\n locale: PropTypes.string,\n focused: PropTypes.bool\n })\n ),\n onSkillClick: PropTypes.func\n};\n\nexport default DisciplineAssociatedSkills;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,cAAP,MAA2B,4BAA3B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,0BAA0B,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACrD,MAAM;IAAC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AEA,SAAS,CAAC,2BAAD;IAPjD,EADD,GAWCI,KAAK,CAACU,MAhBV,CADF;EAqBD,CA5BA,CADH,CADF,CADF,CADK,GAoCH,IApCJ;AAqCD,CA3DD;;AA6DAjB,0BAA0B,CAACuB,YAA3B,GAA0C;EACxCpB,SAAS,EAAEN,QAAQ,CAAC2B,iBAAT,CAA2BrB;AADE,CAA1C;AAIAH,0BAA0B,CAACyB,SAA3B,2CAAuC;EACrCrB,MAAM,EAAEX,SAAS,CAACiC,OAAV,CACNjC,SAAS,CAACkC,KAAV,CAAgB;IACdZ,GAAG,EAAEtB,SAAS,CAACmC,MADD;IAEdX,MAAM,EAAExB,SAAS,CAACmC,MAFJ;IAGdT,OAAO,EAAE1B,SAAS,CAACoC;EAHL,CAAhB,CADM,CAD6B;EAQrCxB,YAAY,EAAEZ,SAAS,CAACqC;AARa,CAAvC;AAWA,eAAe9B,0BAAf"}
@@ -0,0 +1,70 @@
1
+ @value colors: "../../variables/colors.css";
2
+ @value breakpoints: "../../variables/breakpoints.css";
3
+ @value desktop from breakpoints;
4
+ @value cm_grey_100 from colors;
5
+ @value cm_grey_200 from colors;
6
+ @value cm_grey_700 from colors;
7
+
8
+ .associatedSkillsWrapper {
9
+ margin-bottom: 12px;
10
+ }
11
+
12
+ .chipsWrapper {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ gap: 8px;
16
+ }
17
+
18
+ .chipWrapper {
19
+ width: fit-content;
20
+ border-radius: 8px;
21
+ padding: 4px 8px;
22
+ background-color: cm_grey_200;
23
+ color: cm_grey_700;
24
+ font-family: 'Gilroy';
25
+ font-style: normal;
26
+ font-weight: 600;
27
+ line-height: 20px;
28
+ font-size: 14px;
29
+ text-overflow: ellipsis;
30
+ white-space: nowrap;
31
+ }
32
+
33
+ .chipWrapperFocused {
34
+ background-color: #DDD1FF;
35
+ color: #3900D6;
36
+ }
37
+
38
+ .chipFocusedContent {
39
+ display: flex;
40
+ align-items: center;
41
+ gap: 4px;
42
+
43
+ div {
44
+ padding: 0 !important;
45
+ }
46
+ }
47
+
48
+ .infoIconTooltip {
49
+ background-color: transparent;
50
+ }
51
+
52
+ .tooltip {
53
+ width: fit-content;
54
+ color: #FFF;
55
+ font-size: 12px;
56
+ font-style: normal;
57
+ line-height: 16px;
58
+ top: -48px;
59
+
60
+ p {
61
+ padding: 8px 8px;
62
+ margin: 0;
63
+ }
64
+ }
65
+
66
+ @media desktop {
67
+ .associatedSkillsWrapper {
68
+ margin-top: 24px;
69
+ }
70
+ }
@@ -1,10 +1,35 @@
1
1
  /// <reference types="react" />
2
+ import { WebContextValues } from '../../atom/provider/web-context';
2
3
  import { FormatedDataType, LearningProfileRadarChartPropTypes } from './types';
3
4
  export declare const formatData: (legend: {
4
5
  [ref: string]: string;
5
6
  }, data_: LearningProfileRadarChartPropTypes['data']) => FormatedDataType[];
6
7
  export declare const LearningProfileRadarChart: {
7
- ({ data, legend, totalDataset, colors: colorsProps, onClick, width, height, margin }: LearningProfileRadarChartPropTypes): JSX.Element;
8
+ ({ data, legend, totalDataset, colors: colorsProps, onClick, onExploreClick, width, height, margin }: LearningProfileRadarChartPropTypes, legacyContext: WebContextValues): JSX.Element;
9
+ contextTypes: {
10
+ skin: import("prop-types").Requireable<import("prop-types").InferProps<{
11
+ common: import("prop-types").Requireable<{
12
+ [x: string]: any;
13
+ }>;
14
+ images: import("prop-types").Requireable<import("prop-types").InferProps<{
15
+ 'logo-mobile': import("prop-types").Requireable<any>;
16
+ logo: import("prop-types").Requireable<any>;
17
+ 'logo-email': import("prop-types").Requireable<any>;
18
+ login: import("prop-types").Requireable<any>;
19
+ }>>;
20
+ icons: import("prop-types").Requireable<{
21
+ [x: string]: any;
22
+ }>;
23
+ mod: import("prop-types").Requireable<{
24
+ [x: string]: any;
25
+ }>;
26
+ courses: import("prop-types").Requireable<any[]>;
27
+ texts: import("prop-types").Requireable<{
28
+ [x: string]: any;
29
+ }>;
30
+ }>>;
31
+ translate: import("prop-types").Requireable<(...args: any[]) => any>;
32
+ };
8
33
  propTypes: {
9
34
  data: import("prop-types").Validator<{
10
35
  [x: string]: NonNullable<number | (number | null | undefined)[] | null | undefined> | null | undefined;
@@ -26,6 +51,7 @@ export declare const LearningProfileRadarChart: {
26
51
  }> | null | undefined)[]>;
27
52
  width: import("prop-types").Requireable<number>;
28
53
  height: import("prop-types").Requireable<number>;
54
+ onExploreClick: import("prop-types").Requireable<(...args: any[]) => any>;
29
55
  };
30
56
  };
31
57
  declare const ResponsiveLearningProfileRadarChart: {
@@ -51,6 +77,7 @@ declare const ResponsiveLearningProfileRadarChart: {
51
77
  }> | null | undefined)[]>;
52
78
  width: import("prop-types").Requireable<number>;
53
79
  height: import("prop-types").Requireable<number>;
80
+ onExploreClick: import("prop-types").Requireable<(...args: any[]) => any>;
54
81
  };
55
82
  };
56
83
  export default ResponsiveLearningProfileRadarChart;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learning-profile-radar-chart/index.tsx"],"names":[],"mappings":";AA6BA,OAAO,EAGL,gBAAgB,EAChB,kCAAkC,EAGnC,MAAM,SAAS,CAAC;AAkQjB,eAAO,MAAM,UAAU,EAAE,CACvB,MAAM,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,EAC/B,KAAK,EAAE,kCAAkC,CAAC,MAAM,CAAC,KAC9C,gBAAgB,EAOX,CAAC;AAEX,eAAO,MAAM,yBAAyB;0FASnC,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;CAqHpC,CAAC;AAEF,QAAA,MAAM,mCAAmC;YAAW,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;CAIrF,CAAC;AAKF,eAAe,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/learning-profile-radar-chart/index.tsx"],"names":[],"mappings":";AAiCA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAGL,gBAAgB,EAChB,kCAAkC,EAGnC,MAAM,SAAS,CAAC;AAmUjB,eAAO,MAAM,UAAU,EAAE,CACvB,MAAM,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,EAC/B,KAAK,EAAE,kCAAkC,CAAC,MAAM,CAAC,KAC9C,gBAAgB,EAOX,CAAC;AAEX,eAAO,MAAM,yBAAyB;0GAWjC,kCAAkC,iBACtB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqJhC,CAAC;AAEF,QAAA,MAAM,mCAAmC;YAAW,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;CAIrF,CAAC;AAUF,eAAe,mCAAmC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import _get from "lodash/fp/get";
1
2
  import _findKey from "lodash/fp/findKey";
2
3
  import _flatten from "lodash/fp/flatten";
3
4
  import _times from "lodash/fp/times";
@@ -20,10 +21,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
20
21
 
21
22
  import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
22
23
  import { Radar, RadarChart, PolarGrid, PolarAngleAxis, ResponsiveContainer, Tooltip, PolarRadiusAxis } from 'recharts';
24
+ import { convert } from 'css-color-function';
23
25
  import classnames from 'classnames';
24
26
  import { isMobile as getIsMobile } from '../../util/check-is-mobile';
25
- import style from './style.css';
27
+ import ButtonLink from '../../atom/button-link';
28
+ import Provider, { GetSkinFromContext, GetTranslateFromContext } from '../../atom/provider';
26
29
  import { learningProfileRadarChartPropTypes } from './types';
30
+ import style from './style.css';
27
31
 
28
32
  /* TICK_POSITIONS */
29
33
  const top = {
@@ -154,6 +158,7 @@ const CustomDot = ({
154
158
  cx,
155
159
  cy,
156
160
  payload,
161
+ onDotHover,
157
162
  onDotClick,
158
163
  stroke,
159
164
  activeDot,
@@ -171,10 +176,15 @@ const CustomDot = ({
171
176
  if (!payload?.name) return;
172
177
  onDotClick(payload.name);
173
178
  },
179
+ onMouseOver: () => {
180
+ if (!payload?.name) return;
181
+ onDotHover(payload.name);
182
+ },
183
+ onMouseLeave: () => onDotHover(''),
174
184
  'data-name': dataName
175
185
  }));
176
186
 
177
- const buildRadars = (totalDataset, handleOnDotClick, activeDot) => _times(index => {
187
+ const buildRadars = (totalDataset, handleDotHover, handleOnDotClick, activeDot) => _times(index => {
178
188
  const datakey = `value${index + 1}`;
179
189
  const dataset = `dataset-${index + 1}`;
180
190
  return /*#__PURE__*/React.createElement(Radar, _extends({}, RADAR_DEFAULT_PROPS, {
@@ -190,6 +200,7 @@ const buildRadars = (totalDataset, handleOnDotClick, activeDot) => _times(index
190
200
  // use with the tooltip component
191
201
  ,
192
202
  dot: /*#__PURE__*/React.createElement(CustomDot, {
203
+ onDotHover: handleDotHover,
193
204
  onDotClick: handleOnDotClick,
194
205
  activeDot: activeDot,
195
206
  dataKey: datakey,
@@ -199,7 +210,7 @@ const buildRadars = (totalDataset, handleOnDotClick, activeDot) => _times(index
199
210
  }));
200
211
  }, totalDataset);
201
212
 
202
- const buildCustomLabel = ({
213
+ const CustomLabel = ({
203
214
  index,
204
215
  x,
205
216
  y,
@@ -208,8 +219,13 @@ const buildCustomLabel = ({
208
219
  activeDot,
209
220
  chartType,
210
221
  formatedColors,
211
- onClick
222
+ primarySkinColor,
223
+ exploreLocale,
224
+ hoveredDot,
225
+ onClick,
226
+ onExploreClick
212
227
  }) => {
228
+ const [hovered, setHovered] = useState(false);
213
229
  const isCurrentDotActive = activeDot?.label === label;
214
230
 
215
231
  const _CHART_CONFIGS$chartT = CHART_CONFIGS[chartType].ticks[index],
@@ -227,16 +243,44 @@ const buildCustomLabel = ({
227
243
  onClick(label);
228
244
  }
229
245
 
246
+ function handleExploreClick() {
247
+ onExploreClick(label);
248
+ }
249
+
250
+ const buttonExploreProps = {
251
+ customStyle: {
252
+ height: '36px',
253
+ backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),
254
+ color: hovered ? '#FFFFFF' : primarySkinColor,
255
+ transition: 'background-color 0.15s ease-in-out, color 0.15s ease-in-out'
256
+ },
257
+ onClick: handleExploreClick,
258
+ 'aria-label': `${label}, ${exploreLocale}`,
259
+ label: exploreLocale,
260
+ 'data-name': 'learner-skill-card-explore-button',
261
+ icon: {
262
+ position: 'left',
263
+ faIcon: {
264
+ name: 'compass',
265
+ backgroundColor: hovered ? primarySkinColor : convert(`color(${primarySkinColor} a(0.07))`),
266
+ color: hovered ? '#FFFFFF' : primarySkinColor,
267
+ size: 16
268
+ }
269
+ }
270
+ };
271
+ const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);
272
+ const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
273
+ const extraOffsetY = isCurrentDotActive && index === 0 ? -25 : 0;
230
274
  return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("foreignObject", {
231
275
  className: style.tickeForeignObject,
232
276
  x: x + offsetX,
233
- y: y + offsetY,
277
+ y: y + offsetY + extraOffsetY,
234
278
  width: "200",
235
279
  height: "65"
236
280
  }, /*#__PURE__*/React.createElement("div", {
237
281
  "data-name": label,
238
282
  onClick: onLabelClick,
239
- className: classnames(style.tickWrapper, isCurrentDotActive && style.tickWrapperFocus),
283
+ className: classnames(style.tickWrapper, isCurrentDotActive && style.tickWrapperFocus, hoveredDot === label && style.tickWrapperHover),
240
284
  style: _extends({}, rest, {
241
285
  alignItems: alignment,
242
286
  textAlign: alignment,
@@ -263,7 +307,12 @@ const buildCustomLabel = ({
263
307
  style: {
264
308
  color: colorLabel
265
309
  }
266
- }, label))))));
310
+ }, label))), isCurrentDotActive ? /*#__PURE__*/React.createElement("div", {
311
+ className: style.buttonWrapper,
312
+ onMouseOver: handleMouseOver,
313
+ onMouseLeave: handleMouseLeave,
314
+ "data-name": "button-explore-wrapper"
315
+ }, /*#__PURE__*/React.createElement(ButtonLink, buttonExploreProps)) : null)));
267
316
  };
268
317
  /* UTILS */
269
318
 
@@ -283,12 +332,18 @@ export const LearningProfileRadarChart = ({
283
332
  totalDataset,
284
333
  colors: colorsProps,
285
334
  onClick,
335
+ onExploreClick,
286
336
  width,
287
337
  height,
288
338
  margin
289
- }) => {
339
+ }, legacyContext) => {
290
340
  const [isMobile, setIsMobile] = useState(false);
291
341
  const [activeDot, setActiveDot] = useState();
342
+ const [hoveredDot, setHoveredDot] = useState('');
343
+ const skin = GetSkinFromContext(legacyContext);
344
+ const translate = GetTranslateFromContext(legacyContext);
345
+
346
+ const primarySkinColor = _get('common.primary', skin);
292
347
 
293
348
  const formatedColors = _times(i => {
294
349
  if (!colorsProps?.length) return DEFAULT_COLORS;
@@ -329,7 +384,17 @@ export const LearningProfileRadarChart = ({
329
384
  };
330
385
  }, [activeDot, onClick, setActiveDot]);
331
386
 
387
+ function handleOnActiveDotClick() {
388
+ setActiveDot(undefined);
389
+ onClick(undefined);
390
+ }
391
+
332
392
  function handleOnDotClick(label) {
393
+ if (!_isEmpty(activeDot) && activeDot?.label === label) {
394
+ handleOnActiveDotClick();
395
+ return;
396
+ }
397
+
333
398
  const payload = formatedData.find(({
334
399
  subject
335
400
  }) => subject === label);
@@ -349,30 +414,48 @@ export const LearningProfileRadarChart = ({
349
414
  }
350
415
  }
351
416
 
352
- function renderCustomLabel({
353
- x,
354
- y,
355
- payload: {
356
- value: label
357
- },
358
- index
359
- }) {
360
- const currentData = formatedData.find(({
417
+ function handleExploreClick(label) {
418
+ const payload = formatedData.find(({
361
419
  subject
362
420
  }) => subject === label);
421
+ if (!payload) return;
363
422
 
364
- const percentagesValues = _pipe(_omit('subject'), _mapValues(value => `${value}%`), _values)(currentData);
423
+ const skillRef = _findKey(val => val === payload?.subject, legend);
424
+
425
+ if (skillRef) {
426
+ onExploreClick(skillRef);
427
+ }
428
+ }
365
429
 
366
- return buildCustomLabel({
367
- index,
430
+ function renderCustomLabel(props) {
431
+ const {
368
432
  x,
369
433
  y,
370
- percentagesValues,
371
- label,
372
- activeDot,
373
- chartType,
374
- formatedColors,
375
- onClick: handleOnDotClick
434
+ payload: {
435
+ value: label
436
+ },
437
+ index
438
+ } = props;
439
+ const currentData = formatedData.find(({
440
+ subject
441
+ }) => subject === label);
442
+
443
+ const percentagesValues = _pipe(_omit('subject'), _mapValues(value => `${value}%`), _values)(currentData);
444
+
445
+ return /*#__PURE__*/React.createElement(CustomLabel, {
446
+ index: index,
447
+ x: x,
448
+ y: y,
449
+ percentagesValues: percentagesValues,
450
+ label: label,
451
+ activeDot: activeDot,
452
+ chartType: chartType,
453
+ formatedColors: formatedColors,
454
+ primarySkinColor: primarySkinColor,
455
+ exploreLocale: translate('Explore'),
456
+ hoveredDot: hoveredDot,
457
+ onClick: handleOnDotClick,
458
+ onExploreClick: handleExploreClick
376
459
  });
377
460
  }
378
461
 
@@ -400,7 +483,7 @@ export const LearningProfileRadarChart = ({
400
483
  tick: false,
401
484
  axisLine: false,
402
485
  domain: [0, 100]
403
- }), buildRadars(totalDataset, handleOnDotClick, activeDot), isMobile ? /*#__PURE__*/React.createElement(Tooltip, {
486
+ }), buildRadars(totalDataset, setHoveredDot, handleOnDotClick, activeDot), isMobile ? /*#__PURE__*/React.createElement(Tooltip, {
404
487
  cursor: false,
405
488
  content: /*#__PURE__*/React.createElement(CustomTooltip, null)
406
489
  }) : null);
@@ -411,6 +494,10 @@ const ResponsiveLearningProfileRadarChart = props => /*#__PURE__*/React.createEl
411
494
  height: "100%"
412
495
  }, /*#__PURE__*/React.createElement(LearningProfileRadarChart, props));
413
496
 
497
+ LearningProfileRadarChart.contextTypes = {
498
+ skin: Provider.childContextTypes.skin,
499
+ translate: Provider.childContextTypes.translate
500
+ };
414
501
  LearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? learningProfileRadarChartPropTypes : {};
415
502
  ResponsiveLearningProfileRadarChart.propTypes = process.env.NODE_ENV !== "production" ? learningProfileRadarChartPropTypes : {};
416
503
  export default ResponsiveLearningProfileRadarChart;