@coorpacademy/components 11.32.49 → 11.32.50

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 (77) hide show
  1. package/es/atom/input-switch/style.css +9 -1
  2. package/es/molecule/banner/index.d.ts +5 -4
  3. package/es/molecule/banner/index.d.ts.map +1 -1
  4. package/es/molecule/banner/index.js +93 -37
  5. package/es/molecule/banner/index.js.map +1 -1
  6. package/es/molecule/banner/style.css +27 -5
  7. package/es/template/back-office/brand-update/index.d.ts +5 -4
  8. package/es/template/playlist-detail/index.d.ts +1 -0
  9. package/es/template/playlist-detail/index.d.ts.map +1 -1
  10. package/es/template/playlist-detail/index.js +6 -3
  11. package/es/template/playlist-detail/index.js.map +1 -1
  12. package/es/template/skill-detail/all-courses.css +4 -0
  13. package/es/template/skill-detail/all-courses.d.ts +1 -0
  14. package/es/template/skill-detail/all-courses.d.ts.map +1 -1
  15. package/es/template/skill-detail/all-courses.js +16 -3
  16. package/es/template/skill-detail/all-courses.js.map +1 -1
  17. package/es/template/skill-detail/index.d.ts +1 -0
  18. package/es/template/skill-detail/index.d.ts.map +1 -1
  19. package/es/template/skill-detail/index.js +6 -3
  20. package/es/template/skill-detail/index.js.map +1 -1
  21. package/es/variables/colors.d.ts +3 -0
  22. package/es/variables/colors.d.ts.map +1 -1
  23. package/es/variables/colors.js +3 -0
  24. package/es/variables/colors.js.map +1 -1
  25. package/lib/atom/input-switch/style.css +9 -1
  26. package/lib/molecule/banner/index.d.ts +5 -4
  27. package/lib/molecule/banner/index.d.ts.map +1 -1
  28. package/lib/molecule/banner/index.js +105 -38
  29. package/lib/molecule/banner/index.js.map +1 -1
  30. package/lib/molecule/banner/style.css +27 -5
  31. package/lib/template/back-office/brand-update/index.d.ts +5 -4
  32. package/lib/template/playlist-detail/index.d.ts +1 -0
  33. package/lib/template/playlist-detail/index.d.ts.map +1 -1
  34. package/lib/template/playlist-detail/index.js +6 -3
  35. package/lib/template/playlist-detail/index.js.map +1 -1
  36. package/lib/template/skill-detail/all-courses.css +4 -0
  37. package/lib/template/skill-detail/all-courses.d.ts +1 -0
  38. package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
  39. package/lib/template/skill-detail/all-courses.js +17 -3
  40. package/lib/template/skill-detail/all-courses.js.map +1 -1
  41. package/lib/template/skill-detail/index.d.ts +1 -0
  42. package/lib/template/skill-detail/index.d.ts.map +1 -1
  43. package/lib/template/skill-detail/index.js +6 -3
  44. package/lib/template/skill-detail/index.js.map +1 -1
  45. package/lib/variables/colors.d.ts +3 -0
  46. package/lib/variables/colors.d.ts.map +1 -1
  47. package/lib/variables/colors.js +3 -0
  48. package/lib/variables/colors.js.map +1 -1
  49. package/locales/bs/global.json +2 -0
  50. package/locales/cs/global.json +2 -0
  51. package/locales/de/global.json +2 -0
  52. package/locales/en/global.json +2 -0
  53. package/locales/es/global.json +2 -0
  54. package/locales/et/global.json +2 -0
  55. package/locales/fi/global.json +2 -0
  56. package/locales/fr/global.json +2 -0
  57. package/locales/hr/global.json +2 -0
  58. package/locales/hu/global.json +2 -0
  59. package/locales/hy/global.json +2 -0
  60. package/locales/it/global.json +2 -0
  61. package/locales/ja/global.json +2 -0
  62. package/locales/ko/global.json +2 -0
  63. package/locales/nl/global.json +2 -0
  64. package/locales/pl/global.json +2 -0
  65. package/locales/pt/global.json +2 -0
  66. package/locales/ro/global.json +2 -0
  67. package/locales/ru/global.json +2 -0
  68. package/locales/sk/global.json +2 -0
  69. package/locales/sl/global.json +2 -0
  70. package/locales/sv/global.json +2 -0
  71. package/locales/tl/global.json +2 -0
  72. package/locales/tr/global.json +2 -0
  73. package/locales/uk/global.json +2 -0
  74. package/locales/vi/global.json +2 -0
  75. package/locales/zh/global.json +2 -0
  76. package/locales/zh_TW/global.json +2 -0
  77. package/package.json +2 -2
@@ -69,7 +69,8 @@ const SkillDetail = (props, context) => {
69
69
  sorting,
70
70
  onBackClick,
71
71
  onReviewClick,
72
- onContinueLearningClick
72
+ onContinueLearningClick,
73
+ bannerMicrolearningRuleAction = null
73
74
  } = props;
74
75
  const descriptionRef = useRef(null);
75
76
  const {
@@ -175,7 +176,8 @@ const SkillDetail = (props, context) => {
175
176
  content: skillIncludedCourses,
176
177
  filters: filters,
177
178
  sorting: sorting,
178
- totalContents: totalContents
179
+ totalContents: totalContents,
180
+ bannerMicrolearningRuleAction: bannerMicrolearningRuleAction
179
181
  })));
180
182
  };
181
183
 
@@ -203,7 +205,8 @@ SkillDetail.propTypes = process.env.NODE_ENV !== "production" ? {
203
205
  sorting: PropTypes.shape(Select.propTypes),
204
206
  onBackClick: PropTypes.func,
205
207
  onReviewClick: PropTypes.func,
206
- onContinueLearningClick: PropTypes.func
208
+ onContinueLearningClick: PropTypes.func,
209
+ bannerMicrolearningRuleAction: PropTypes.func
207
210
  } : {};
208
211
  export default SkillDetail;
209
212
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","descriptionRef","score","questionsToReview","totalContents","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview, totalContents} = metrics;\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalContents}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number,\n totalContents: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;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CAACiC,IAlBD;EAmBtBY,aAAa,EAAE7C,SAAS,CAACiC,IAnBH;EAoBtBa,uBAAuB,EAAE9C,SAAS,CAACiC;AApBb,CAAxB;AAuBA,eAAeC,WAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useState","useRef","useEffect","PropTypes","convert","classnames","Markdown","Provider","Select","SelectOptionPropTypes","ButtonLink","ButtonLinkIcon","Icon","CardsGrid","style","AllCourses","ContinueLearningButton","props","context","ongoingCoursesAvailable","onClick","skin","translate","primarySkinColor","width","borderRadius","backgroundColor","position","faIcon","name","color","size","contextTypes","childContextTypes","propTypes","bool","func","SkillDetail","title","skillRef","description","metrics","focused","availableForReview","skillIncludedCourses","filters","sorting","onBackClick","onReviewClick","onContinueLearningClick","bannerMicrolearningRuleAction","descriptionRef","score","questionsToReview","totalContents","isDescriptionTruncated","setIsDescriptionTruncated","showMore","setShowMore","handleShowMore","current","clientHeight","scrollHeight","Description","truncate","ProgressBar","undefined","progressBarColor","inlineProgressValueStyle","progressBarWrapper","progress","backgroundContainer","container","backButton","ctaContainer","skillFocusBadge","faSize","wrapperSize","showMoreWrapper","ctaWrapper","skillInformation","skillInformationNumber","progressContainer","progressInformationNumber","toFixed","string","isRequired","shape","number","onChange","options","arrayOf"],"sources":["../../../src/template/skill-detail/index.js"],"sourcesContent":["import React, {useCallback, useState, useRef, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {convert} from 'css-color-function';\nimport classnames from 'classnames';\nimport {get, isNil} from 'lodash/fp';\nimport Markdown from 'markdown-to-jsx';\nimport Provider from '../../atom/provider';\nimport Select, {SelectOptionPropTypes} from '../../atom/select';\nimport ButtonLink from '../../atom/button-link';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport Icon from '../../atom/icon';\nimport CardsGrid from '../../organism/cards-grid';\nimport style from './style.css';\nimport AllCourses from './all-courses';\n\nexport const ContinueLearningButton = (props, context) => {\n const {ongoingCoursesAvailable, onClick} = props;\n const {skin, translate} = context;\n const primarySkinColor = get('common.primary', skin);\n\n return (\n <div>\n <ButtonLink\n label={\n ongoingCoursesAvailable ? translate('continue_learning') : translate('start_learning')\n }\n type=\"primary\"\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px',\n backgroundColor: primarySkinColor\n }}\n hoverBackgroundColor={convert(`hsl(from ${primarySkinColor} h s calc(l*(1 - 0.08)))`)}\n hoverColor=\"#FFFFFF\"\n icon={{\n position: 'left',\n faIcon: {\n name: 'play',\n color: '#FFFFFF',\n size: 16\n }\n }}\n onClick={onClick}\n />\n </div>\n );\n};\n\nContinueLearningButton.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContinueLearningButton.propTypes = {\n ongoingCoursesAvailable: PropTypes.bool,\n onClick: PropTypes.func\n};\n\nconst SkillDetail = (props, context) => {\n const {\n title,\n skillRef,\n description,\n metrics = {},\n focused,\n availableForReview,\n ongoingCoursesAvailable,\n skillIncludedCourses,\n filters,\n sorting,\n onBackClick,\n onReviewClick,\n onContinueLearningClick,\n bannerMicrolearningRuleAction = null\n } = props;\n const descriptionRef = useRef(null);\n const {score = 0, questionsToReview, totalContents} = metrics;\n const {translate} = context;\n\n const [isDescriptionTruncated, setIsDescriptionTruncated] = useState(false);\n const [showMore, setShowMore] = useState(false);\n\n const handleShowMore = useCallback(() => setShowMore(!showMore), [setShowMore, showMore]);\n\n useEffect(() => {\n if (descriptionRef.current) {\n const {clientHeight = 0, scrollHeight = 0} = descriptionRef.current;\n setIsDescriptionTruncated(scrollHeight > clientHeight);\n }\n }, [description]);\n\n const Description = useCallback(() => {\n return (\n <div\n ref={descriptionRef}\n className={classnames(style.description, !showMore && style.truncate)}\n >\n <Markdown>{description}</Markdown>\n </div>\n );\n }, [showMore, description]);\n\n const ProgressBar = useCallback(() => {\n if (score === undefined) return null;\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${score}%`\n };\n\n return (\n <div className={style.progressBarWrapper}>\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n role=\"progressbar\"\n />\n </div>\n );\n }, [score]);\n\n return (\n <div className={style.backgroundContainer}>\n <div className={style.container} data-name={skillRef}>\n {!isNil(onBackClick) ? (\n <ButtonLinkIcon\n faIcon=\"arrow-left\"\n data-name=\"back-button\"\n aria-label={translate('back')}\n onClick={onBackClick}\n className={style.backButton}\n tooltipPlacement=\"right\"\n />\n ) : null}\n <div className={style.ctaContainer}>\n <div>\n {focused ? (\n <div className={style.skillFocusBadge}>\n <Icon\n iconName=\"bullseye-arrow\"\n backgroundColor=\"#DDD1FF\"\n size={{\n faSize: 10,\n wrapperSize: 16\n }}\n />\n {translate('skill_focus')}\n </div>\n ) : null}\n <div className={style.title}>{title}</div>\n {description ? (\n <>\n <Description />\n {isDescriptionTruncated ? (\n <div className={style.showMoreWrapper} onClick={handleShowMore}>\n {showMore ? translate('Show less') : translate('Show more')}\n <Icon\n iconName={showMore ? 'chevron-up' : 'chevron-down'}\n size={{\n faSize: 14,\n wrapperSize: 16\n }}\n />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n\n <div className={style.ctaWrapper}>\n <ButtonLink\n type=\"secondary\"\n onClick={onReviewClick}\n label={translate('review_this_skill')}\n disabled={!availableForReview}\n customStyle={{\n width: 'fit-content',\n borderRadius: '12px'\n }}\n />\n <ContinueLearningButton\n ongoingCoursesAvailable={ongoingCoursesAvailable}\n onClick={onContinueLearningClick}\n />\n </div>\n </div>\n {questionsToReview > 0 ? (\n <div className={style.skillInformation} data-name=\"skill-questions\">\n <span className={style.skillInformationNumber}>{questionsToReview}</span>\n &nbsp;{translate('skill_chart_side_panel_questions_to_review')}\n </div>\n ) : null}\n <div className={style.progressContainer}>\n <ProgressBar />\n <span className={style.progressInformationNumber}>{score.toFixed(1)}%</span>\n </div>\n <AllCourses\n content={skillIncludedCourses}\n filters={filters}\n sorting={sorting}\n totalContents={totalContents}\n bannerMicrolearningRuleAction={bannerMicrolearningRuleAction}\n />\n </div>\n </div>\n );\n};\n\nSkillDetail.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nSkillDetail.propTypes = {\n title: PropTypes.string.isRequired,\n skillRef: PropTypes.string.isRequired,\n description: PropTypes.string,\n metrics: PropTypes.shape({\n score: PropTypes.number,\n questionsToReview: PropTypes.number,\n totalContents: PropTypes.number\n }),\n focused: PropTypes.bool,\n availableForReview: PropTypes.bool,\n ongoingCoursesAvailable: PropTypes.bool,\n skillIncludedCourses: PropTypes.shape(CardsGrid.propTypes),\n filters: PropTypes.shape({\n onChange: PropTypes.func,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n }),\n sorting: PropTypes.shape(Select.propTypes),\n onBackClick: PropTypes.func,\n onReviewClick: PropTypes.func,\n onContinueLearningClick: PropTypes.func,\n bannerMicrolearningRuleAction: PropTypes.func\n};\n\nexport default SkillDetail;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,QAA5B,EAAsCC,MAAtC,EAA8CC,SAA9C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,SAAP,MAAsB,2BAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AAEA,OAAO,MAAMC,sBAAsB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACxD,MAAM;IAACC,uBAAD;IAA0BC;EAA1B,IAAqCH,KAA3C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#ed3436";
4
+ readonly cm_negative_200: "#B81400";
4
5
  readonly positive: "#35CC7F";
6
+ readonly cm_positive_200: "#05944F";
5
7
  readonly white: "#ffffff";
6
8
  readonly cm_grey_800: "#171721";
7
9
  readonly cm_primary_blue: "#0061FF";
8
10
  readonly cm_grey_500: "#515161";
11
+ readonly cm_yellow_400: "#bd7e00";
9
12
  readonly brand: "#00B0FF";
10
13
  };
11
14
  export declare type Colors = typeof COLORS;
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;CAST,CAAC;AAEX,oBAAY,MAAM,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/variables/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYT,CAAC;AAEX,oBAAY,MAAM,GAAG,OAAO,MAAM,CAAC"}
@@ -1,11 +1,14 @@
1
1
  export const COLORS = {
2
2
  gray: '#EAEAEB',
3
3
  negative: '#ed3436',
4
+ cm_negative_200: '#B81400',
4
5
  positive: '#35CC7F',
6
+ cm_positive_200: '#05944F',
5
7
  white: '#ffffff',
6
8
  cm_grey_800: '#171721',
7
9
  cm_primary_blue: '#0061FF',
8
10
  cm_grey_500: '#515161',
11
+ cm_yellow_400: '#bd7e00',
9
12
  brand: '#00B0FF'
10
13
  };
11
14
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","names":["COLORS","gray","negative","positive","white","cm_grey_800","cm_primary_blue","cm_grey_500","brand"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n positive: '#35CC7F',\n white: '#ffffff',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF',\n cm_grey_500: '#515161',\n brand: '#00B0FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,QAAQ,EAAE,SAHU;EAIpBC,KAAK,EAAE,SAJa;EAKpBC,WAAW,EAAE,SALO;EAMpBC,eAAe,EAAE,SANG;EAOpBC,WAAW,EAAE,SAPO;EAQpBC,KAAK,EAAE;AARa,CAAf"}
1
+ {"version":3,"file":"colors.js","names":["COLORS","gray","negative","cm_negative_200","positive","cm_positive_200","white","cm_grey_800","cm_primary_blue","cm_grey_500","cm_yellow_400","brand"],"sources":["../../src/variables/colors.ts"],"sourcesContent":["export const COLORS = {\n gray: '#EAEAEB',\n negative: '#ed3436',\n cm_negative_200: '#B81400',\n positive: '#35CC7F',\n cm_positive_200: '#05944F',\n white: '#ffffff',\n cm_grey_800: '#171721',\n cm_primary_blue: '#0061FF',\n cm_grey_500: '#515161',\n cm_yellow_400: '#bd7e00',\n brand: '#00B0FF'\n} as const;\n\nexport type Colors = typeof COLORS;\n"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;EACpBC,IAAI,EAAE,SADc;EAEpBC,QAAQ,EAAE,SAFU;EAGpBC,eAAe,EAAE,SAHG;EAIpBC,QAAQ,EAAE,SAJU;EAKpBC,eAAe,EAAE,SALG;EAMpBC,KAAK,EAAE,SANa;EAOpBC,WAAW,EAAE,SAPO;EAQpBC,eAAe,EAAE,SARG;EASpBC,WAAW,EAAE,SATO;EAUpBC,aAAa,EAAE,SAVK;EAWpBC,KAAK,EAAE;AAXa,CAAf"}
@@ -86,6 +86,10 @@
86
86
  left: 30px;
87
87
  }
88
88
 
89
+ .coorpmanager input:checked ~ label::after {
90
+ left: 23px;
91
+ }
92
+
89
93
  .checkbox:disabled ~ label {
90
94
  background: light;
91
95
  pointer-events: none;
@@ -108,6 +112,10 @@
108
112
  min-height: 24px;
109
113
  }
110
114
 
115
+ .coorpmanager .title {
116
+ width: fit-content;
117
+ }
118
+
111
119
  .description {
112
120
  font-family: 'Gilroy';
113
121
  font-weight: 500;
@@ -126,6 +134,7 @@
126
134
  }
127
135
 
128
136
  .coorpmanager label::after, .coorpmanagerModified label::after {
137
+ top: 1px;
129
138
  width: 22px;
130
139
  height: 22px;
131
140
  }
@@ -134,7 +143,6 @@
134
143
  font-family: Gilroy;
135
144
  font-weight: bold;
136
145
  color: black;
137
- min-width: 190px;
138
146
  }
139
147
 
140
148
  .coorpmanager .checkbox:checked ~ label {
@@ -5,10 +5,11 @@ declare namespace Banner {
5
5
  const bannerKey: PropTypes.Requireable<string>;
6
6
  const type: PropTypes.Requireable<string>;
7
7
  const message: PropTypes.Validator<string>;
8
- const firstCTA: PropTypes.Requireable<(...args: any[]) => any>;
9
- const firstCTALabel: PropTypes.Requireable<string>;
10
- const secondCTALabel: PropTypes.Requireable<string>;
11
- const secondCTA: PropTypes.Requireable<(...args: any[]) => any>;
8
+ const cta: PropTypes.Requireable<(PropTypes.InferProps<{
9
+ label: PropTypes.Requireable<string>;
10
+ type: PropTypes.Requireable<string>;
11
+ action: PropTypes.Requireable<(...args: any[]) => any>;
12
+ }> | null | undefined)[]>;
12
13
  const temporary: PropTypes.Requireable<boolean>;
13
14
  const onEnd: PropTypes.Requireable<(...args: any[]) => any>;
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AAuBA,iDAmDC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/banner/index.js"],"names":[],"mappings":";AA0BA,iDAmFC"}
@@ -3,46 +3,124 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
 
6
+ var _size2 = _interopRequireDefault(require("lodash/fp/size"));
7
+
8
+ var _map2 = _interopRequireDefault(require("lodash/fp/map"));
9
+
10
+ var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
11
+
12
+ var _noop2 = _interopRequireDefault(require("lodash/fp/noop"));
13
+
6
14
  var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
7
15
 
8
- var _react = _interopRequireDefault(require("react"));
16
+ var _react = _interopRequireWildcard(require("react"));
9
17
 
10
18
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
19
 
12
20
  var _classnames = _interopRequireDefault(require("classnames"));
13
21
 
14
- var _novaIcons = require("@coorpacademy/nova-icons");
22
+ var _colors = require("../../variables/colors");
15
23
 
16
24
  var _buttonLink = _interopRequireDefault(require("../../atom/button-link"));
17
25
 
26
+ var _icon = _interopRequireDefault(require("../../atom/icon"));
27
+
28
+ var _inputSwitch = _interopRequireDefault(require("../../atom/input-switch"));
29
+
18
30
  var _style = _interopRequireDefault(require("./style.css"));
19
31
 
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
20
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
37
 
22
- const ICONS = {
23
- success: _novaIcons.NovaCompositionCoorpacademyValidate,
24
- error: _novaIcons.NovaSolidInterfaceFeedbackInterfaceAlertDiamond,
25
- warning: _novaIcons.NovaSolidInterfaceFeedbackInterfaceAlertDiamond
38
+ const uncappedMap = _map2.default.convert({
39
+ cap: false
40
+ });
41
+
42
+ const TYPES = {
43
+ success: ['circle-check', _colors.COLORS.cm_positive_200],
44
+ error: ['triangle-exclamation', _colors.COLORS.cm_negative_200],
45
+ warning: ['circle-exclamation', _colors.COLORS.cm_yellow_400],
46
+ info: ['circle-info', _colors.COLORS.cm_grey_500]
26
47
  };
27
48
  const STYLES = {
28
49
  success: _style.default.success,
29
50
  error: _style.default.error,
30
- warning: _style.default.warning
51
+ warning: _style.default.warning,
52
+ info: _style.default.info
31
53
  };
32
54
 
33
55
  const Banner = props => {
34
56
  const {
35
57
  type,
36
58
  message,
37
- firstCTA,
38
- firstCTALabel,
39
- secondCTALabel,
40
- secondCTA,
59
+ cta = [],
41
60
  temporary,
42
61
  bannerKey,
43
62
  onEnd
44
63
  } = props;
45
- const Icon = ICONS[type];
64
+ const [switchValue, setSwitchValue] = (0, _react.useState)(false);
65
+
66
+ const ButtonSeparator = /*#__PURE__*/_react.default.createElement("div", {
67
+ className: (0, _classnames.default)(_style.default.buttonsBar, STYLES[type])
68
+ });
69
+
70
+ const handleSwitchToggle = (0, _react.useCallback)(action => e => {
71
+ const newSwitchValue = !switchValue;
72
+ setSwitchValue(newSwitchValue);
73
+ action(newSwitchValue);
74
+ }, [switchValue]);
75
+
76
+ const buildButton = ({
77
+ type: buttonType = 'button',
78
+ label,
79
+ action = _noop2.default
80
+ }) => {
81
+ const commonStyle = (0, _classnames.default)(_style.default.button, STYLES[type]);
82
+
83
+ switch (buttonType) {
84
+ case 'switch':
85
+ return /*#__PURE__*/_react.default.createElement("div", {
86
+ className: commonStyle
87
+ }, /*#__PURE__*/_react.default.createElement(_inputSwitch.default, {
88
+ id: "show-microlearning-switch",
89
+ theme: "coorpmanager",
90
+ title: label,
91
+ value: switchValue,
92
+ onChange: handleSwitchToggle(action),
93
+ "data-name": `banner-switch-cta`,
94
+ "aria-label": label
95
+ }));
96
+
97
+ default:
98
+ return /*#__PURE__*/_react.default.createElement("div", {
99
+ className: commonStyle
100
+ }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
101
+ "data-name": "banner-button-cta",
102
+ "aria-label": label,
103
+ label: label,
104
+ onClick: action,
105
+ type: "text",
106
+ customStyle: {
107
+ padding: 0
108
+ }
109
+ }));
110
+ }
111
+ };
112
+
113
+ const buildCta = ctaOptions => {
114
+ return uncappedMap((options, i) => {
115
+ if ((0, _isEmpty2.default)(options)) return null;
116
+ return /*#__PURE__*/_react.default.createElement("div", {
117
+ className: _style.default.ctaWrapper,
118
+ key: i
119
+ }, i > 0 && i <= (0, _size2.default)(options) ? ButtonSeparator : null, buildButton(options));
120
+ }, ctaOptions);
121
+ };
122
+
123
+ const [iconName, iconColor] = TYPES[type];
46
124
  return /*#__PURE__*/_react.default.createElement("div", {
47
125
  key: bannerKey,
48
126
  className: (0, _classnames.default)(_style.default.banner, STYLES[type], temporary && _style.default.temporaryBanner),
@@ -51,37 +129,26 @@ const Banner = props => {
51
129
  }, /*#__PURE__*/_react.default.createElement("div", {
52
130
  "data-name": `${type}-banner-message`,
53
131
  className: _style.default.message
54
- }, /*#__PURE__*/_react.default.createElement(Icon, {
55
- className: (0, _classnames.default)(_style.default.icon, temporary && _style.default.temporaryIcon)
56
- }), message), firstCTALabel ? /*#__PURE__*/_react.default.createElement("div", {
57
- className: (0, _classnames.default)(_style.default.button, STYLES[type])
58
- }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
59
- "data-name": "first-banner-cta",
60
- "aria-label": firstCTALabel,
61
- label: firstCTALabel,
62
- onClick: firstCTA,
63
- type: "text"
64
- })) : null, firstCTALabel && secondCTALabel ? /*#__PURE__*/_react.default.createElement("div", {
65
- className: (0, _classnames.default)(_style.default.buttonsBar, STYLES[type])
66
- }) : null, secondCTALabel ? /*#__PURE__*/_react.default.createElement("div", {
67
- className: (0, _classnames.default)(_style.default.button, STYLES[type])
68
- }, /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
69
- "data-name": "second-banner-cta",
70
- onClick: secondCTA,
71
- "aria-label": secondCTALabel,
72
- label: secondCTALabel,
73
- type: "text"
74
- })) : null);
132
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
133
+ iconName: iconName,
134
+ iconColor: iconColor,
135
+ className: (0, _classnames.default)(_style.default.icon, temporary && _style.default.temporaryIcon),
136
+ customStyle: {
137
+ padding: 0
138
+ }
139
+ }), message), buildCta(cta));
75
140
  };
76
141
 
142
+ const ctaPropTypes = process.env.NODE_ENV !== "production" ? _propTypes.default.shape({
143
+ label: _propTypes.default.string,
144
+ type: _propTypes.default.oneOf(['button', 'switch']),
145
+ action: _propTypes.default.func
146
+ }) : {};
77
147
  Banner.propTypes = process.env.NODE_ENV !== "production" ? {
78
148
  bannerKey: _propTypes.default.string,
79
- type: _propTypes.default.oneOf((0, _keys2.default)(ICONS)),
149
+ type: _propTypes.default.oneOf((0, _keys2.default)(TYPES)),
80
150
  message: _propTypes.default.string.isRequired,
81
- firstCTA: _propTypes.default.func,
82
- firstCTALabel: _propTypes.default.string,
83
- secondCTALabel: _propTypes.default.string,
84
- secondCTA: _propTypes.default.func,
151
+ cta: _propTypes.default.arrayOf(ctaPropTypes),
85
152
  temporary: _propTypes.default.bool,
86
153
  onEnd: _propTypes.default.func
87
154
  } : {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ICONS","success","ValidateIcon","error","QuestionIcon","warning","STYLES","style","Banner","props","type","message","firstCTA","firstCTALabel","secondCTALabel","secondCTA","temporary","bannerKey","onEnd","Icon","classnames","banner","temporaryBanner","icon","temporaryIcon","button","buttonsBar","propTypes","PropTypes","string","oneOf","isRequired","func","bool"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys} from 'lodash/fp';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as QuestionIcon,\n NovaCompositionCoorpacademyValidate as ValidateIcon\n} from '@coorpacademy/nova-icons';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst ICONS = {\n success: ValidateIcon,\n error: QuestionIcon,\n warning: QuestionIcon\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning\n};\n\nconst Banner = props => {\n const {\n type,\n message,\n firstCTA,\n firstCTALabel,\n secondCTALabel,\n secondCTA,\n temporary,\n bannerKey,\n onEnd\n } = props;\n const Icon = ICONS[type];\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon className={classnames(style.icon, temporary && style.temporaryIcon)} />\n {message}\n </div>\n {firstCTALabel ? (\n <div className={classnames(style.button, STYLES[type])}>\n <ButtonLink\n data-name=\"first-banner-cta\"\n aria-label={firstCTALabel}\n label={firstCTALabel}\n onClick={firstCTA}\n type=\"text\"\n />\n </div>\n ) : null}\n {firstCTALabel && secondCTALabel ? (\n <div className={classnames(style.buttonsBar, STYLES[type])} />\n ) : null}\n {secondCTALabel ? (\n <div className={classnames(style.button, STYLES[type])}>\n <ButtonLink\n data-name=\"second-banner-cta\"\n onClick={secondCTA}\n aria-label={secondCTALabel}\n label={secondCTALabel}\n type=\"text\"\n />\n </div>\n ) : null}\n </div>\n );\n};\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(ICONS)),\n message: PropTypes.string.isRequired,\n firstCTA: PropTypes.func,\n firstCTALabel: PropTypes.string,\n secondCTALabel: PropTypes.string,\n secondCTA: PropTypes.func,\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;;;AAEA,MAAMA,KAAK,GAAG;EACZC,OAAO,EAAEC,8CADG;EAEZC,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A,EAAWb,cAAA,CAAMmB,UAAjB,EAA6BpB,MAAM,CAACI,IAAD,CAAnC;EAAhB,EADD,GAEG,IAvBN,EAwBGI,cAAc,gBACb;IAAK,SAAS,EAAE,IAAAM,mBAAA,EAAWb,cAAA,CAAMkB,MAAjB,EAAyBnB,MAAM,CAACI,IAAD,CAA/B;EAAhB,gBACE,6BAAC,mBAAD;IACE,aAAU,mBADZ;IAEE,OAAO,EAAEK,SAFX;IAGE,cAAYD,cAHd;IAIE,KAAK,EAAEA,cAJT;IAKE,IAAI,EAAC;EALP,EADF,CADa,GAUX,IAlCN,CADF;AAsCD,CAnDD;;AAqDAN,MAAM,CAACmB,SAAP,2CAAmB;EACjBV,SAAS,EAAEW,kBAAA,CAAUC,MADJ;EAEjBnB,IAAI,EAAEkB,kBAAA,CAAUE,KAAV,CAAgB,oBAAK9B,KAAL,CAAhB,CAFW;EAGjBW,OAAO,EAAEiB,kBAAA,CAAUC,MAAV,CAAiBE,UAHT;EAIjBnB,QAAQ,EAAEgB,kBAAA,CAAUI,IAJH;EAKjBnB,aAAa,EAAEe,kBAAA,CAAUC,MALR;EAMjBf,cAAc,EAAEc,kBAAA,CAAUC,MANT;EAOjBd,SAAS,EAAEa,kBAAA,CAAUI,IAPJ;EAQjBhB,SAAS,EAAEY,kBAAA,CAAUK,IARJ;EASjBf,KAAK,EAAEU,kBAAA,CAAUI;AATA,CAAnB;eAYexB,M"}
1
+ {"version":3,"file":"index.js","names":["uncappedMap","convert","cap","TYPES","success","COLORS","cm_positive_200","error","cm_negative_200","warning","cm_yellow_400","info","cm_grey_500","STYLES","style","Banner","props","type","message","cta","temporary","bannerKey","onEnd","switchValue","setSwitchValue","useState","ButtonSeparator","classnames","buttonsBar","handleSwitchToggle","useCallback","action","e","newSwitchValue","buildButton","buttonType","label","commonStyle","button","padding","buildCta","ctaOptions","options","i","ctaWrapper","iconName","iconColor","banner","temporaryBanner","icon","temporaryIcon","ctaPropTypes","PropTypes","shape","string","oneOf","func","propTypes","isRequired","arrayOf","bool"],"sources":["../../../src/molecule/banner/index.js"],"sourcesContent":["import React, {useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys, noop, isEmpty, map, size} from 'lodash/fp';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport Icon from '../../atom/icon';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\n\nconst uncappedMap = map.convert({cap: false});\n\nconst TYPES = {\n success: ['circle-check', COLORS.cm_positive_200],\n error: ['triangle-exclamation', COLORS.cm_negative_200],\n warning: ['circle-exclamation', COLORS.cm_yellow_400],\n info: ['circle-info', COLORS.cm_grey_500]\n};\n\nconst STYLES = {\n success: style.success,\n error: style.error,\n warning: style.warning,\n info: style.info\n};\n\nconst Banner = props => {\n const {type, message, cta = [], temporary, bannerKey, onEnd} = props;\n const [switchValue, setSwitchValue] = useState(false);\n\n const ButtonSeparator = <div className={classnames(style.buttonsBar, STYLES[type])} />;\n\n const handleSwitchToggle = useCallback(\n action => e => {\n const newSwitchValue = !switchValue;\n setSwitchValue(newSwitchValue);\n action(newSwitchValue);\n },\n [switchValue]\n );\n\n const buildButton = ({type: buttonType = 'button', label, action = noop}) => {\n const commonStyle = classnames(style.button, STYLES[type]);\n\n switch (buttonType) {\n case 'switch':\n return (\n <div className={commonStyle}>\n <InputSwitch\n id=\"show-microlearning-switch\"\n theme=\"coorpmanager\"\n title={label}\n value={switchValue}\n onChange={handleSwitchToggle(action)}\n data-name={`banner-switch-cta`}\n aria-label={label}\n />\n </div>\n );\n default:\n return (\n <div className={commonStyle}>\n <ButtonLink\n data-name=\"banner-button-cta\"\n aria-label={label}\n label={label}\n onClick={action}\n type=\"text\"\n customStyle={{padding: 0}}\n />\n </div>\n );\n }\n };\n\n const buildCta = ctaOptions => {\n return uncappedMap((options, i) => {\n if (isEmpty(options)) return null;\n\n return (\n <div className={style.ctaWrapper} key={i}>\n {i > 0 && i <= size(options) ? ButtonSeparator : null}\n {buildButton(options)}\n </div>\n );\n }, ctaOptions);\n };\n\n const [iconName, iconColor] = TYPES[type];\n\n return (\n <div\n key={bannerKey}\n className={classnames(style.banner, STYLES[type], temporary && style.temporaryBanner)}\n onAnimationEnd={onEnd}\n title={message}\n >\n <div data-name={`${type}-banner-message`} className={style.message}>\n <Icon\n iconName={iconName}\n iconColor={iconColor}\n className={classnames(style.icon, temporary && style.temporaryIcon)}\n customStyle={{padding: 0}}\n />\n {message}\n </div>\n {buildCta(cta)}\n </div>\n );\n};\n\nconst ctaPropTypes = PropTypes.shape({\n label: PropTypes.string,\n type: PropTypes.oneOf(['button', 'switch']),\n action: PropTypes.func\n});\n\nBanner.propTypes = {\n bannerKey: PropTypes.string,\n type: PropTypes.oneOf(keys(TYPES)),\n message: PropTypes.string.isRequired,\n cta: PropTypes.arrayOf(ctaPropTypes),\n temporary: PropTypes.bool,\n onEnd: PropTypes.func\n};\n\nexport default Banner;\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,WAAW,GAAG,cAAIC,OAAJ,CAAY;EAACC,GAAG,EAAE;AAAN,CAAZ,CAApB;;AAEA,MAAMC,KAAK,GAAG;EACZC,OAAO,EAAE,CAAC,cAAD,EAAiBC,cAAA,CAAOC,eAAxB,CADG;EAEZC,KAAK,EAAE,CAAC,sBAAD,EAAyBF,cAAA,CAAOG,eAAhC,CAFK;EAGZC,OAAO,EAAE,CAAC,oBAAD,EAAuBJ,cAAA,CAAOK,aAA9B,CAHG;EAIZC,IAAI,EAAE,CAAC,aAAD,EAAgBN,cAAA,CAAOO,WAAvB;AAJM,CAAd;AAOA,MAAMC,MAAM,GAAG;EACbT,OAAO,EAAEU,cAAA,CAAMV,OADF;EAEbG,KAAK,EAAEO,cAAA,CAAMP,KAFA;EAGbE,OAAO,EAAEK,cAAA,CAAML,OAHF;EAIbE,IAAI,EAAEG,cAAA,CAAMH;AA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,CAfX,CADF;AAmBD,CAnFD;;AAqFA,MAAMgC,YAAN,2CAAqBC,kBAAA,CAAUC,KAAV,CAAgB;EACnCjB,KAAK,EAAEgB,kBAAA,CAAUE,MADkB;EAEnCrC,IAAI,EAAEmC,kBAAA,CAAUG,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,CAAhB,CAF6B;EAGnCxB,MAAM,EAAEqB,kBAAA,CAAUI;AAHiB,CAAhB,CAArB;AAMAzC,MAAM,CAAC0C,SAAP,2CAAmB;EACjBpC,SAAS,EAAE+B,kBAAA,CAAUE,MADJ;EAEjBrC,IAAI,EAAEmC,kBAAA,CAAUG,KAAV,CAAgB,oBAAKpD,KAAL,CAAhB,CAFW;EAGjBe,OAAO,EAAEkC,kBAAA,CAAUE,MAAV,CAAiBI,UAHT;EAIjBvC,GAAG,EAAEiC,kBAAA,CAAUO,OAAV,CAAkBR,YAAlB,CAJY;EAKjB/B,SAAS,EAAEgC,kBAAA,CAAUQ,IALJ;EAMjBtC,KAAK,EAAE8B,kBAAA,CAAUI;AANA,CAAnB;eASezC,M"}
@@ -12,6 +12,8 @@
12
12
  @value cm_yellow_100 from colors;
13
13
  @value cm_yellow_200 from colors;
14
14
  @value cm_yellow_400 from colors;
15
+ @value cm_grey_100 from colors;
16
+ @value cm_grey_700 from colors;
15
17
 
16
18
  @keyframes fadeIn {
17
19
  0% {
@@ -33,11 +35,11 @@
33
35
  .banner {
34
36
  display: flex;
35
37
  flex-direction: row;
36
- justify-content: flex-start;
37
- align-items: center;
38
+ justify-content: flex-start;
39
+ align-items: center;
38
40
  gap: 8px;
39
- padding: 16px 24px;
40
- border-radius: 5px;
41
+ padding: 16px;
42
+ border-radius: 12px;
41
43
  }
42
44
 
43
45
  .banner.warning {
@@ -55,6 +57,11 @@
55
57
  color: cm_positive_200;
56
58
  }
57
59
 
60
+ .banner.info {
61
+ background-color: cm_grey_100;
62
+ color: cm_grey_700;
63
+ }
64
+
58
65
  .temporaryBanner {
59
66
  display: inline-flex;
60
67
  align-items: center;
@@ -74,6 +81,11 @@
74
81
  transform: translateX(-50%);
75
82
  }
76
83
 
84
+ .ctaWrapper {
85
+ display: flex;
86
+ gap: 4px;
87
+ }
88
+
77
89
  .button{
78
90
  background-color: transparent;
79
91
  white-space: nowrap;
@@ -103,7 +115,6 @@
103
115
  color: color(cm_positive_100 blackness(+12%));
104
116
  }
105
117
 
106
-
107
118
  .buttonsBar {
108
119
  width: 2px;
109
120
  align-self: stretch;
@@ -123,6 +134,9 @@
123
134
  background-color: cm_positive_100;
124
135
  }
125
136
 
137
+ .buttonsBar.info {
138
+ background-color: cm_grey_700;
139
+ }
126
140
 
127
141
  .icon {
128
142
  height: 22px;
@@ -147,4 +161,12 @@
147
161
  display: flex;
148
162
  align-content: center;
149
163
  align-items: center;
164
+ gap: 16px;
150
165
  }
166
+
167
+ @media mobile {
168
+ .banner {
169
+ flex-wrap: wrap;
170
+ gap: 24px;
171
+ }
172
+ }
@@ -9,10 +9,11 @@ declare namespace BrandUpdate {
9
9
  bannerKey: PropTypes.Requireable<string>;
10
10
  type: PropTypes.Requireable<string>;
11
11
  message: PropTypes.Validator<string>;
12
- firstCTA: PropTypes.Requireable<(...args: any[]) => any>;
13
- firstCTALabel: PropTypes.Requireable<string>;
14
- secondCTALabel: PropTypes.Requireable<string>;
15
- secondCTA: PropTypes.Requireable<(...args: any[]) => any>;
12
+ cta: PropTypes.Requireable<(PropTypes.InferProps<{
13
+ label: PropTypes.Requireable<string>;
14
+ type: PropTypes.Requireable<string>;
15
+ action: PropTypes.Requireable<(...args: any[]) => any>;
16
+ }> | null | undefined)[]>;
16
17
  temporary: PropTypes.Requireable<boolean>;
17
18
  onEnd: PropTypes.Requireable<(...args: any[]) => any>;
18
19
  }> | null | undefined)[]>;
@@ -83,6 +83,7 @@ declare namespace PlaylistDetail {
83
83
  }>>;
84
84
  const onBackClick: PropTypes.Requireable<(...args: any[]) => any>;
85
85
  const onContinueLearningClick: PropTypes.Requireable<(...args: any[]) => any>;
86
+ const bannerMicrolearningRuleAction: PropTypes.Requireable<(...args: any[]) => any>;
86
87
  }
87
88
  }
88
89
  import PropTypes from "prop-types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEAqFC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/template/playlist-detail/index.js"],"names":[],"mappings":";AAgBA,uEA2FC"}
@@ -50,7 +50,8 @@ const PlaylistDetail = (props, context) => {
50
50
  filters,
51
51
  sorting,
52
52
  onBackClick,
53
- onContinueLearningClick
53
+ onContinueLearningClick,
54
+ bannerMicrolearningRuleAction = null
54
55
  } = props;
55
56
  const descriptionRef = (0, _react.useRef)(null);
56
57
  const {
@@ -113,7 +114,8 @@ const PlaylistDetail = (props, context) => {
113
114
  })))), /*#__PURE__*/_react.default.createElement(_allCourses.default, {
114
115
  content: playlistCourses,
115
116
  filters: filters,
116
- sorting: sorting
117
+ sorting: sorting,
118
+ bannerMicrolearningRuleAction: bannerMicrolearningRuleAction
117
119
  })));
118
120
  };
119
121
 
@@ -134,7 +136,8 @@ PlaylistDetail.propTypes = process.env.NODE_ENV !== "production" ? {
134
136
  }),
135
137
  sorting: _propTypes.default.shape(_select.default.propTypes),
136
138
  onBackClick: _propTypes.default.func,
137
- onContinueLearningClick: _propTypes.default.func
139
+ onContinueLearningClick: _propTypes.default.func,
140
+ bannerMicrolearningRuleAction: _propTypes.default.func
138
141
  } : {};
139
142
  var _default = PlaylistDetail;
140
143
  exports.default = _default;