@coorpacademy/components 11.9.2-alpha.4 → 11.9.3-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/avatar/index.js +1 -0
- package/es/atom/avatar/index.js.map +1 -1
- package/es/atom/avatar/style.css +0 -1
- package/es/atom/card-image-preview/index.d.ts.map +1 -1
- package/es/atom/card-image-preview/index.js +1 -3
- package/es/atom/card-image-preview/index.js.map +1 -1
- package/es/atom/difficulty-level/index.js +8 -4
- package/es/atom/difficulty-level/index.js.map +1 -1
- package/es/atom/difficulty-level/style.css +0 -1
- package/es/atom/drag-and-drop/style.css +14 -9
- package/es/atom/image-upload/index.d.ts +6 -1
- package/es/atom/image-upload/index.d.ts.map +1 -1
- package/es/atom/image-upload/index.js +24 -4
- package/es/atom/image-upload/index.js.map +1 -1
- package/es/atom/image-upload/style.css +7 -0
- package/es/atom/input-html/index.js +2 -6
- package/es/atom/input-html/index.js.map +1 -1
- package/es/atom/life/index.js +3 -9
- package/es/atom/life/index.js.map +1 -1
- package/es/atom/resource-miniature/index.js +1 -3
- package/es/atom/resource-miniature/index.js.map +1 -1
- package/es/atom/review-presentation/index.d.ts.map +1 -1
- package/es/atom/review-presentation/index.js +12 -62
- package/es/atom/review-presentation/index.js.map +1 -1
- package/es/atom/review-presentation/style.css +7 -67
- package/es/atom/title/index.d.ts +1 -0
- package/es/atom/title/index.d.ts.map +1 -1
- package/es/atom/title/index.js +14 -5
- package/es/atom/title/index.js.map +1 -1
- package/es/atom/title/style.css +6 -0
- package/es/atom/tooltip/index.d.ts +22 -0
- package/es/atom/tooltip/index.d.ts.map +1 -0
- package/es/atom/tooltip/index.js +117 -0
- package/es/atom/tooltip/index.js.map +1 -0
- package/es/atom/tooltip/style.css +96 -0
- package/es/molecule/answer/index.d.ts.map +1 -1
- package/es/molecule/answer/index.js +6 -3
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/audio/index.js +1 -3
- package/es/molecule/audio/index.js.map +1 -1
- package/es/molecule/battle-request/index.js +1 -3
- package/es/molecule/battle-request/index.js.map +1 -1
- package/es/molecule/brand-download-box/index.js +1 -3
- package/es/molecule/brand-download-box/index.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +5 -0
- package/es/molecule/brand-form-group/index.d.ts.map +1 -1
- package/es/molecule/brand-form-group/index.js +4 -1
- package/es/molecule/brand-form-group/index.js.map +1 -1
- package/es/molecule/brand-form-group/style.css +9 -10
- package/es/molecule/brand-upload-box/index.js +1 -3
- package/es/molecule/brand-upload-box/index.js.map +1 -1
- package/es/molecule/card/favorite.js +2 -6
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/card/index.d.ts.map +1 -1
- package/es/molecule/card/index.js +2 -6
- package/es/molecule/card/index.js.map +1 -1
- package/es/molecule/card/notification.js +1 -3
- package/es/molecule/card/notification.js.map +1 -1
- package/es/molecule/card-content/index.d.ts.map +1 -1
- package/es/molecule/card-content/index.js +2 -1
- package/es/molecule/card-content/index.js.map +1 -1
- package/es/molecule/card-content/style.css +0 -1
- package/es/molecule/dashboard/cards-list/index.js +3 -9
- package/es/molecule/dashboard/cards-list/index.js.map +1 -1
- package/es/molecule/discipline-partners/index.js +1 -3
- package/es/molecule/discipline-partners/index.js.map +1 -1
- package/es/molecule/drag-and-drop/overlay.js +1 -3
- package/es/molecule/drag-and-drop/overlay.js.map +1 -1
- package/es/molecule/drag-and-drop/upload-report.js +1 -3
- package/es/molecule/drag-and-drop/upload-report.js.map +1 -1
- package/es/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
- package/es/molecule/filters/index.js +2 -6
- package/es/molecule/filters/index.js.map +1 -1
- package/es/molecule/pdf/index.js +1 -3
- package/es/molecule/pdf/index.js.map +1 -1
- package/es/molecule/resource-player/index.js +1 -3
- package/es/molecule/resource-player/index.js.map +1 -1
- package/es/molecule/search-form/index.js +1 -3
- package/es/molecule/search-form/index.js.map +1 -1
- package/es/molecule/select-multiple/index.js +2 -6
- package/es/molecule/select-multiple/index.js.map +1 -1
- package/es/molecule/setup-section/index.js +1 -3
- package/es/molecule/setup-section/index.js.map +1 -1
- package/es/molecule/setup-slide/index.d.ts +2 -0
- package/es/molecule/setup-slider/index.d.ts +2 -0
- package/es/molecule/table/index.js +2 -6
- package/es/molecule/table/index.js.map +1 -1
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +3 -0
- package/es/molecule/titled-checkbox/index.js +2 -1
- package/es/molecule/titled-checkbox/index.js.map +1 -1
- package/es/molecule/titled-checkbox/style.css +0 -1
- package/es/organism/accordion/coorp-manager/part/index.d.ts.map +1 -1
- package/es/organism/accordion/coorp-manager/part/index.js +6 -13
- package/es/organism/accordion/coorp-manager/part/index.js.map +1 -1
- package/es/organism/accordion/coorp-manager/part/style.css +0 -1
- package/es/organism/accordion/part/index.js +4 -7
- package/es/organism/accordion/part/index.js.map +1 -1
- package/es/organism/accordion/part/style.css +0 -1
- package/es/organism/brand-form/index.d.ts +5 -0
- package/es/organism/brand-form/index.js +1 -3
- package/es/organism/brand-form/index.js.map +1 -1
- package/es/organism/get-the-app/index.js +1 -3
- package/es/organism/get-the-app/index.js.map +1 -1
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +7 -21
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/rewards-form/index.d.ts +3 -0
- package/es/organism/slider/index.js +2 -6
- package/es/organism/slider/index.js.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +8 -0
- package/es/template/activity/engine-stars.css +16 -33
- package/es/template/activity/engine-stars.d.ts +15 -17
- package/es/template/activity/engine-stars.d.ts.map +1 -1
- package/es/template/activity/engine-stars.js +129 -122
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/template/activity/index.d.ts +1 -0
- package/es/template/activity/index.d.ts.map +1 -1
- package/es/template/activity/index.js +18 -9
- package/es/template/activity/index.js.map +1 -1
- package/es/template/activity/progression-item.js +5 -13
- package/es/template/activity/progression-item.js.map +1 -1
- package/es/template/activity/stars-summary.d.ts +1 -0
- package/es/template/activity/stars-summary.d.ts.map +1 -1
- package/es/template/activity/stars-summary.js +13 -14
- package/es/template/activity/stars-summary.js.map +1 -1
- package/es/template/app-player/player/slides/header/learner.css +0 -1
- package/es/template/app-player/player/slides/header/learner.js +2 -1
- package/es/template/app-player/player/slides/header/learner.js.map +1 -1
- package/es/template/app-player/player/slides/header/microlearning.css +0 -1
- package/es/template/app-player/player/slides/header/microlearning.js +2 -1
- package/es/template/app-player/player/slides/header/microlearning.js.map +1 -1
- package/es/template/app-player/popin-correction/index.js +3 -4
- package/es/template/app-player/popin-correction/index.js.map +1 -1
- package/es/template/app-player/popin-correction/style.css +0 -1
- package/es/template/app-player/popin-end/summary.js +1 -3
- package/es/template/app-player/popin-end/summary.js.map +1 -1
- package/es/template/app-player/popin-header/index.js +3 -6
- package/es/template/app-player/popin-header/index.js.map +1 -1
- package/es/template/app-player/popin-header/style.css +0 -1
- package/es/template/back-office/brand-update/index.d.ts +13 -0
- package/lib/atom/avatar/index.js +1 -0
- package/lib/atom/avatar/index.js.map +1 -1
- package/lib/atom/avatar/style.css +0 -1
- package/lib/atom/card-image-preview/index.d.ts.map +1 -1
- package/lib/atom/card-image-preview/index.js +1 -3
- package/lib/atom/card-image-preview/index.js.map +1 -1
- package/lib/atom/difficulty-level/index.js +8 -4
- package/lib/atom/difficulty-level/index.js.map +1 -1
- package/lib/atom/difficulty-level/style.css +0 -1
- package/lib/atom/drag-and-drop/style.css +14 -9
- package/lib/atom/image-upload/index.d.ts +6 -1
- package/lib/atom/image-upload/index.d.ts.map +1 -1
- package/lib/atom/image-upload/index.js +25 -4
- package/lib/atom/image-upload/index.js.map +1 -1
- package/lib/atom/image-upload/style.css +7 -0
- package/lib/atom/input-html/index.js +2 -6
- package/lib/atom/input-html/index.js.map +1 -1
- package/lib/atom/life/index.js +3 -9
- package/lib/atom/life/index.js.map +1 -1
- package/lib/atom/resource-miniature/index.js +1 -3
- package/lib/atom/resource-miniature/index.js.map +1 -1
- package/lib/atom/review-presentation/index.d.ts.map +1 -1
- package/lib/atom/review-presentation/index.js +13 -66
- package/lib/atom/review-presentation/index.js.map +1 -1
- package/lib/atom/review-presentation/style.css +7 -67
- package/lib/atom/title/index.d.ts +1 -0
- package/lib/atom/title/index.d.ts.map +1 -1
- package/lib/atom/title/index.js +14 -5
- package/lib/atom/title/index.js.map +1 -1
- package/lib/atom/title/style.css +6 -0
- package/lib/atom/tooltip/index.d.ts +22 -0
- package/lib/atom/tooltip/index.d.ts.map +1 -0
- package/lib/atom/tooltip/index.js +137 -0
- package/lib/atom/tooltip/index.js.map +1 -0
- package/lib/atom/tooltip/style.css +96 -0
- package/lib/molecule/answer/index.d.ts.map +1 -1
- package/lib/molecule/answer/index.js +6 -3
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/audio/index.js +1 -3
- package/lib/molecule/audio/index.js.map +1 -1
- package/lib/molecule/battle-request/index.js +1 -3
- package/lib/molecule/battle-request/index.js.map +1 -1
- package/lib/molecule/brand-download-box/index.js +1 -3
- package/lib/molecule/brand-download-box/index.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +5 -0
- package/lib/molecule/brand-form-group/index.d.ts.map +1 -1
- package/lib/molecule/brand-form-group/index.js +4 -1
- package/lib/molecule/brand-form-group/index.js.map +1 -1
- package/lib/molecule/brand-form-group/style.css +9 -10
- package/lib/molecule/brand-upload-box/index.js +1 -3
- package/lib/molecule/brand-upload-box/index.js.map +1 -1
- package/lib/molecule/card/favorite.js +2 -6
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/card/index.d.ts.map +1 -1
- package/lib/molecule/card/index.js +2 -6
- package/lib/molecule/card/index.js.map +1 -1
- package/lib/molecule/card/notification.js +1 -3
- package/lib/molecule/card/notification.js.map +1 -1
- package/lib/molecule/card-content/index.d.ts.map +1 -1
- package/lib/molecule/card-content/index.js +2 -1
- package/lib/molecule/card-content/index.js.map +1 -1
- package/lib/molecule/card-content/style.css +0 -1
- package/lib/molecule/dashboard/cards-list/index.js +3 -9
- package/lib/molecule/dashboard/cards-list/index.js.map +1 -1
- package/lib/molecule/discipline-partners/index.js +1 -3
- package/lib/molecule/discipline-partners/index.js.map +1 -1
- package/lib/molecule/drag-and-drop/overlay.js +1 -3
- package/lib/molecule/drag-and-drop/overlay.js.map +1 -1
- package/lib/molecule/drag-and-drop/upload-report.js +1 -3
- package/lib/molecule/drag-and-drop/upload-report.js.map +1 -1
- package/lib/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
- package/lib/molecule/filters/index.js +2 -6
- package/lib/molecule/filters/index.js.map +1 -1
- package/lib/molecule/pdf/index.js +1 -3
- package/lib/molecule/pdf/index.js.map +1 -1
- package/lib/molecule/resource-player/index.js +1 -3
- package/lib/molecule/resource-player/index.js.map +1 -1
- package/lib/molecule/search-form/index.js +1 -3
- package/lib/molecule/search-form/index.js.map +1 -1
- package/lib/molecule/select-multiple/index.js +2 -6
- package/lib/molecule/select-multiple/index.js.map +1 -1
- package/lib/molecule/setup-section/index.js +1 -3
- package/lib/molecule/setup-section/index.js.map +1 -1
- package/lib/molecule/setup-slide/index.d.ts +2 -0
- package/lib/molecule/setup-slider/index.d.ts +2 -0
- package/lib/molecule/table/index.js +2 -6
- package/lib/molecule/table/index.js.map +1 -1
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +3 -0
- package/lib/molecule/titled-checkbox/index.js +2 -1
- package/lib/molecule/titled-checkbox/index.js.map +1 -1
- package/lib/molecule/titled-checkbox/style.css +0 -1
- package/lib/organism/accordion/coorp-manager/part/index.d.ts.map +1 -1
- package/lib/organism/accordion/coorp-manager/part/index.js +6 -13
- package/lib/organism/accordion/coorp-manager/part/index.js.map +1 -1
- package/lib/organism/accordion/coorp-manager/part/style.css +0 -1
- package/lib/organism/accordion/part/index.js +4 -7
- package/lib/organism/accordion/part/index.js.map +1 -1
- package/lib/organism/accordion/part/style.css +0 -1
- package/lib/organism/brand-form/index.d.ts +5 -0
- package/lib/organism/brand-form/index.js +1 -3
- package/lib/organism/brand-form/index.js.map +1 -1
- package/lib/organism/get-the-app/index.js +1 -3
- package/lib/organism/get-the-app/index.js.map +1 -1
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +7 -21
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/rewards-form/index.d.ts +3 -0
- package/lib/organism/slider/index.js +2 -6
- package/lib/organism/slider/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +8 -0
- package/lib/template/activity/engine-stars.css +16 -33
- package/lib/template/activity/engine-stars.d.ts +15 -17
- package/lib/template/activity/engine-stars.d.ts.map +1 -1
- package/lib/template/activity/engine-stars.js +135 -122
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/template/activity/index.d.ts +1 -0
- package/lib/template/activity/index.d.ts.map +1 -1
- package/lib/template/activity/index.js +21 -9
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/activity/progression-item.js +5 -13
- package/lib/template/activity/progression-item.js.map +1 -1
- package/lib/template/activity/stars-summary.d.ts +1 -0
- package/lib/template/activity/stars-summary.d.ts.map +1 -1
- package/lib/template/activity/stars-summary.js +13 -14
- package/lib/template/activity/stars-summary.js.map +1 -1
- package/lib/template/app-player/player/slides/header/learner.css +0 -1
- package/lib/template/app-player/player/slides/header/learner.js +2 -1
- package/lib/template/app-player/player/slides/header/learner.js.map +1 -1
- package/lib/template/app-player/player/slides/header/microlearning.css +0 -1
- package/lib/template/app-player/player/slides/header/microlearning.js +2 -1
- package/lib/template/app-player/player/slides/header/microlearning.js.map +1 -1
- package/lib/template/app-player/popin-correction/index.js +3 -4
- package/lib/template/app-player/popin-correction/index.js.map +1 -1
- package/lib/template/app-player/popin-correction/style.css +0 -1
- package/lib/template/app-player/popin-end/summary.js +1 -3
- package/lib/template/app-player/popin-end/summary.js.map +1 -1
- package/lib/template/app-player/popin-header/index.js +3 -6
- package/lib/template/app-player/popin-header/index.js.map +1 -1
- package/lib/template/app-player/popin-header/style.css +0 -1
- package/lib/template/back-office/brand-update/index.d.ts +13 -0
- package/locales/cs/global.json +1 -0
- package/locales/de/global.json +1 -0
- package/locales/en/global.json +1 -0
- package/locales/es/global.json +1 -0
- package/locales/et/global.json +1 -0
- package/locales/fr/global.json +1 -0
- package/locales/hr/global.json +1 -0
- package/locales/hu/global.json +1 -0
- package/locales/it/global.json +1 -0
- package/locales/ja/global.json +1 -0
- package/locales/ko/global.json +1 -0
- package/locales/nl/global.json +1 -0
- package/locales/pl/global.json +1 -0
- package/locales/pt/global.json +1 -0
- package/locales/ro/global.json +1 -0
- package/locales/ru/global.json +1 -0
- package/locales/sk/global.json +1 -0
- package/locales/th/global.json +90 -0
- package/locales/tl/global.json +1 -0
- package/locales/zh/global.json +1 -0
- package/locales/zh_TW/global.json +1 -0
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","getOr","map","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidVoteRewardsVoteHeart","HeartIcon","NovaSolidInterfaceFeedbackInterfaceQuestionMark","QuestionIcon","NovaLineSelectionCursorsCursorArrowTarget","TargetIcon","ToolTip","style","propTypes","ICONS","skills","questions","lifes","allright","ReviewIcon","icon","Icon","labelIcon","ReviewListItemWrapper","iconKey","label","reviewListItemWrapper","reviewListText","text","tooltipText","closeToolTipInformationTextAriaLabel","moreDetailsAriaLabel","ReviewPresentation","props","ariaLabel","reviewTitle","reviewText","labelsList","reviewWrapper","__html","reviewListWrapper","convert","cap","key","reviewList","string","shape"],"sources":["../../../src/atom/review-presentation/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport getOr from 'lodash/fp/getOr';\nimport map from 'lodash/fp/map';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidVoteRewardsVoteHeart as HeartIcon,\n NovaSolidInterfaceFeedbackInterfaceQuestionMark as QuestionIcon,\n NovaLineSelectionCursorsCursorArrowTarget as TargetIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip from '../tooltip';\nimport style from './style.css';\nimport propTypes from './prop-types';\n\nconst ICONS = {\n skills: TargetIcon,\n questions: QuestionIcon,\n lifes: HeartIcon,\n allright: CheckIcon\n};\n\nconst ReviewIcon = ({icon}) => {\n const Icon = getOr(null, icon, ICONS);\n\n /* istanbul ignore next */\n if (!Icon) {\n return <div className={style.labelIcon} />;\n }\n return <Icon className={style.labelIcon} />;\n};\n\nconst ReviewListItemWrapper = ({iconKey, label}) => {\n return (\n <div className={style.reviewListItemWrapper} data-tip data-for=\"reviewListItem\" tabIndex={0}>\n <div className={style.reviewListText}>\n <ReviewIcon icon={iconKey} /> {label.text}\n </div>\n <ToolTip\n TooltipContent={label.tooltipText}\n closeToolTipInformationTextAriaLabel={label.closeToolTipInformationTextAriaLabel}\n data-testid={`review-list-item-tooltip-button-${iconKey}`}\n aria-label={label.moreDetailsAriaLabel}\n />\n </div>\n );\n};\n\nconst ReviewPresentation = props => {\n const {'aria-label': ariaLabel, reviewTitle, reviewText, labelsList} = props;\n\n return (\n <div className={style.reviewWrapper} aria-label={ariaLabel}>\n <div\n className={style.reviewTitle}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewTitle}}\n />\n <div\n className={style.reviewText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: reviewText}}\n />\n <ul className={style.reviewListWrapper}>\n {map.convert({cap: false})((label, key) => {\n return (\n <li key={`step-${key}`} className={style.reviewList}>\n <ReviewListItemWrapper\n iconKey={key}\n label={label}\n tooltipText={label.tooltipText}\n aria-label={label.moreDetailsAriaLabel}\n />\n </li>\n );\n }, labelsList)}\n </ul>\n </div>\n );\n};\n\nReviewIcon.propTypes = {\n icon: PropTypes.string\n};\n\nReviewListItemWrapper.propTypes = {\n iconKey: PropTypes.string,\n label: PropTypes.shape({\n tooltipText: ToolTip.propTypes.tooltipText,\n moreDetailsAriaLabel: ToolTip.propTypes['aria-label'],\n closeToolTipInformationTextAriaLabel: ToolTip.propTypes.closeToolTipInformationTextAriaLabel,\n text: PropTypes.string\n })\n};\n\nReviewPresentation.propTypes = propTypes;\n\nexport default ReviewPresentation;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,SACEC,2BAA2B,IAAIC,SADjC,EAEEC,6BAA6B,IAAIC,SAFnC,EAGEC,+CAA+C,IAAIC,YAHrD,EAIEC,yCAAyC,IAAIC,UAJ/C,QAKO,0BALP;AAMA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,MAAsB,cAAtB;AAEA,MAAMC,KAAK,GAAG;EACZC,MAAM,EAAEL,UADI;EAEZM,SAAS,EAAER,YAFC;EAGZS,KAAK,EAAEX,SAHK;EAIZY,QAAQ,EAAEd;AAJE,CAAd;;AAOA,MAAMe,UAAU,GAAG,CAAC;EAACC;AAAD,CAAD,KAAY;EAC7B,MAAMC,IAAI,GAAGpB,KAAK,CAAC,IAAD,EAAOmB,IAAP,EAAaN,KAAb,CAAlB;EAEA;;EACA,IAAI,CAACO,IAAL,EAAW;IACT,oBAAO;MAAK,SAAS,EAAET,KAAK,CAACU;IAAtB,EAAP;EACD;;EACD,oBAAO,oBAAC,IAAD;IAAM,SAAS,EAAEV,KAAK,CAACU;EAAvB,EAAP;AACD,CARD;;AAUA,MAAMC,qBAAqB,GAAG,CAAC;EAACC,OAAD;EAAUC;AAAV,CAAD,KAAsB;EAClD,oBACE;IAAK,SAAS,EAAEb,KAAK,CAACc,qBAAtB;IAA6C,gBAA7C;IAAsD,YAAS,gBAA/D;IAAgF,QAAQ,EAAE;EAA1F,gBACE;IAAK,SAAS,EA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AAI,EAAEpB,SAAS,CAAC6C;AADK,CAAvB;AAIAtB,qBAAqB,CAACV,SAAtB,2CAAkC;EAChCW,OAAO,EAAExB,SAAS,CAAC6C,MADa;EAEhCpB,KAAK,EAAEzB,SAAS,CAAC8C,KAAV,CAAgB;IACrBjB,WAAW,EAAElB,OAAO,CAACE,SAAR,CAAkBgB,WADV;IAErBE,oBAAoB,EAAEpB,OAAO,CAACE,SAAR,CAAkB,YAAlB,CAFD;IAGrBiB,oCAAoC,EAAEnB,OAAO,CAACE,SAAR,CAAkBiB,oCAHnC;IAIrBF,IAAI,EAAE5B,SAAS,CAAC6C;EAJK,CAAhB;AAFyB,CAAlC;AAUAb,kBAAkB,CAACnB,SAAnB,2CAA+BA,SAA/B;AAEA,eAAemB,kBAAf"}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
@value mobile from breakpoints;
|
|
4
4
|
@value colors: "../../variables/colors.css";
|
|
5
5
|
@value xtraLightGrey from colors;
|
|
6
|
-
@value cm_blue_900 from colors;
|
|
7
6
|
@value cm_grey_75 from colors;
|
|
8
|
-
@value cm_grey_500 from colors;
|
|
9
|
-
@value cm_grey_700 from colors;
|
|
10
|
-
@value white from colors;
|
|
11
7
|
|
|
8
|
+
.reviewWrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
border-radius: 16px;
|
|
11
|
+
background-color: xtraLightGrey;
|
|
12
|
+
padding-bottom: 40px;
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
.textBase {
|
|
14
16
|
font-family: "Gilroy";
|
|
@@ -17,13 +19,6 @@
|
|
|
17
19
|
user-select: none;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
.reviewWrapper {
|
|
21
|
-
width: 100%;
|
|
22
|
-
border-radius: 16px;
|
|
23
|
-
background-color: xtraLightGrey;
|
|
24
|
-
padding-bottom: 40px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
.reviewTitle {
|
|
28
23
|
composes: textBase;
|
|
29
24
|
font-weight: 700;
|
|
@@ -77,61 +72,6 @@
|
|
|
77
72
|
width: 16px;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
|
-
.informationIcon {
|
|
81
|
-
color: cm_grey_500;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.toolTip {
|
|
85
|
-
transition: opacity 0.8s;
|
|
86
|
-
position: absolute;
|
|
87
|
-
height: auto;
|
|
88
|
-
width: 200px;
|
|
89
|
-
border-radius: 7px;
|
|
90
|
-
background-color: cm_grey_700;
|
|
91
|
-
right: -81px;
|
|
92
|
-
bottom: 32px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.toolTip::before {
|
|
96
|
-
content: '';
|
|
97
|
-
display: inline-block;
|
|
98
|
-
visibility: inherit;
|
|
99
|
-
opacity: inherit;
|
|
100
|
-
width: 15px;
|
|
101
|
-
height: 15px;
|
|
102
|
-
transform: rotate(-45deg);
|
|
103
|
-
background-color: cm_grey_700;
|
|
104
|
-
position: inherit;
|
|
105
|
-
bottom: -5px;
|
|
106
|
-
right: 40%;
|
|
107
|
-
border-radius: 2px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tooltipText {
|
|
111
|
-
composes: textBase;
|
|
112
|
-
font-weight: 500;
|
|
113
|
-
font-size: 14px;
|
|
114
|
-
display: inline-block;
|
|
115
|
-
border-radius: 3px;
|
|
116
|
-
word-wrap: break-word;
|
|
117
|
-
color: white;
|
|
118
|
-
padding: 8px 14px;
|
|
119
|
-
text-align: center;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.tooltipContainer {
|
|
123
|
-
overflow: visible;
|
|
124
|
-
position: relative;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.tooltipIconContainer {
|
|
128
|
-
display: flex;
|
|
129
|
-
justify-content: flex-end;
|
|
130
|
-
border: none;
|
|
131
|
-
background: cm_grey_75;
|
|
132
|
-
height: 25px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
75
|
@media tablet {
|
|
136
76
|
.reviewWrapper{
|
|
137
77
|
width: 100%;
|
|
@@ -142,4 +82,4 @@
|
|
|
142
82
|
.reviewWrapper{
|
|
143
83
|
width: 100%;
|
|
144
84
|
}
|
|
145
|
-
}
|
|
85
|
+
}
|
package/es/atom/title/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/title/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/title/index.js"],"names":[],"mappings":";AA2BA,gDAeC"}
|
package/es/atom/title/index.js
CHANGED
|
@@ -12,13 +12,20 @@ const getTitleStype = type => {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const getSubtitleStype = type => {
|
|
15
|
+
const getSubtitleStype = (type, size) => {
|
|
16
16
|
switch (type) {
|
|
17
17
|
case 'page':
|
|
18
18
|
return style.subtitlePage;
|
|
19
19
|
|
|
20
20
|
case 'form-group':
|
|
21
|
-
|
|
21
|
+
switch (size) {
|
|
22
|
+
case 'standard':
|
|
23
|
+
return style.subtitleFormGroup;
|
|
24
|
+
|
|
25
|
+
case 'small':
|
|
26
|
+
return style.smallSubtitleFormGroup;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
}
|
|
23
30
|
};
|
|
24
31
|
|
|
@@ -27,10 +34,11 @@ const Title = props => {
|
|
|
27
34
|
title,
|
|
28
35
|
subtitle,
|
|
29
36
|
type,
|
|
30
|
-
'data-name': dataName
|
|
37
|
+
'data-name': dataName,
|
|
38
|
+
subtitleSize = 'standard'
|
|
31
39
|
} = props;
|
|
32
40
|
const titleStyle = getTitleStype(type);
|
|
33
|
-
const subtitleStyle = getSubtitleStype(type);
|
|
41
|
+
const subtitleStyle = getSubtitleStype(type, subtitleSize);
|
|
34
42
|
const subtitleSection = subtitle ? /*#__PURE__*/React.createElement("div", {
|
|
35
43
|
className: subtitleStyle
|
|
36
44
|
}, subtitle) : null;
|
|
@@ -44,7 +52,8 @@ Title.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
44
52
|
title: PropTypes.string,
|
|
45
53
|
subtitle: PropTypes.string,
|
|
46
54
|
type: PropTypes.oneOf(['page', 'form-group']),
|
|
47
|
-
'data-name': PropTypes.string
|
|
55
|
+
'data-name': PropTypes.string,
|
|
56
|
+
subtitleSize: PropTypes.string
|
|
48
57
|
} : {};
|
|
49
58
|
export default Title;
|
|
50
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","style","getTitleStype","type","titlePage","titleFormGroup","getSubtitleStype","subtitlePage","subtitleFormGroup","Title","props","title","subtitle","dataName","titleStyle","subtitleStyle","subtitleSection","propTypes","string","oneOf"],"sources":["../../../src/atom/title/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport style from './style.css';\n\nconst getTitleStype = type => {\n switch (type) {\n case 'page':\n return style.titlePage;\n case 'form-group':\n return style.titleFormGroup;\n }\n};\n\nconst getSubtitleStype = type => {\n switch (type) {\n case 'page':\n return style.subtitlePage;\n case 'form-group':\n return style.subtitleFormGroup;\n }\n};\n\nconst Title = props => {\n const {title, subtitle, type, 'data-name': dataName} = props;\n const titleStyle = getTitleStype(type);\n const subtitleStyle = getSubtitleStype(type);\n\n const subtitleSection = subtitle ? <div className={subtitleStyle}>{subtitle}</div> : null;\n\n return (\n <div>\n <div className={titleStyle} data-name={dataName}>\n {title}\n </div>\n {subtitleSection}\n </div>\n );\n};\n\nTitle.propTypes = {\n title: PropTypes.string,\n subtitle: PropTypes.string,\n type: PropTypes.oneOf(['page', 'form-group']),\n 'data-name': PropTypes.string\n};\nexport default Title;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,aAAa,GAAGC,IAAI,IAAI;EAC5B,QAAQA,IAAR;IACE,KAAK,MAAL;MACE,OAAOF,KAAK,CAACG,SAAb;;IACF,KAAK,YAAL;MACE,OAAOH,KAAK,CAACI,cAAb;EAJJ;AAMD,CAPD;;AASA,MAAMC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","style","getTitleStype","type","titlePage","titleFormGroup","getSubtitleStype","size","subtitlePage","subtitleFormGroup","smallSubtitleFormGroup","Title","props","title","subtitle","dataName","subtitleSize","titleStyle","subtitleStyle","subtitleSection","propTypes","string","oneOf"],"sources":["../../../src/atom/title/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport style from './style.css';\n\nconst getTitleStype = type => {\n switch (type) {\n case 'page':\n return style.titlePage;\n case 'form-group':\n return style.titleFormGroup;\n }\n};\n\nconst getSubtitleStype = (type, size) => {\n switch (type) {\n case 'page':\n return style.subtitlePage;\n case 'form-group':\n switch (size) {\n case 'standard':\n return style.subtitleFormGroup;\n case 'small':\n return style.smallSubtitleFormGroup;\n }\n }\n};\n\nconst Title = props => {\n const {title, subtitle, type, 'data-name': dataName, subtitleSize = 'standard'} = props;\n const titleStyle = getTitleStype(type);\n const subtitleStyle = getSubtitleStype(type, subtitleSize);\n\n const subtitleSection = subtitle ? <div className={subtitleStyle}>{subtitle}</div> : null;\n\n return (\n <div>\n <div className={titleStyle} data-name={dataName}>\n {title}\n </div>\n {subtitleSection}\n </div>\n );\n};\n\nTitle.propTypes = {\n title: PropTypes.string,\n subtitle: PropTypes.string,\n type: PropTypes.oneOf(['page', 'form-group']),\n 'data-name': PropTypes.string,\n subtitleSize: PropTypes.string\n};\nexport default Title;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,aAAa,GAAGC,IAAI,IAAI;EAC5B,QAAQA,IAAR;IACE,KAAK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,22 @@
|
|
|
1
|
+
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
|
+
export default ToolTip;
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible }: {
|
|
4
|
+
anchorId: any;
|
|
5
|
+
TooltipContent: any;
|
|
6
|
+
"aria-label": any;
|
|
7
|
+
"data-testid": any;
|
|
8
|
+
closeToolTipInformationTextAriaLabel: any;
|
|
9
|
+
toolTipIsVisible: any;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
declare namespace ToolTip {
|
|
12
|
+
const propTypes: {
|
|
13
|
+
TooltipContent: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
|
|
14
|
+
'data-testid': PropTypes.Requireable<string>;
|
|
15
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
16
|
+
closeToolTipInformationTextAriaLabel: PropTypes.Validator<string>;
|
|
17
|
+
anchorId: PropTypes.Requireable<string>;
|
|
18
|
+
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
import PropTypes from "prop-types";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { isValidElement, useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ReactTooltip from 'react-tooltip';
|
|
4
|
+
import isString from 'lodash/fp/isString';
|
|
5
|
+
import { NovaCompositionCoorpacademyInformationIcon as InformationIcon } from '@coorpacademy/nova-icons';
|
|
6
|
+
import style from './style.css';
|
|
7
|
+
|
|
8
|
+
const ToolTipWrapper = ({
|
|
9
|
+
toolTipIsVisible,
|
|
10
|
+
anchorId,
|
|
11
|
+
closeToolTipInformationTextAriaLabel,
|
|
12
|
+
content
|
|
13
|
+
}) => {
|
|
14
|
+
if (!toolTipIsVisible) return null;
|
|
15
|
+
|
|
16
|
+
if (anchorId) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(ReactTooltip, {
|
|
18
|
+
id: anchorId,
|
|
19
|
+
className: style.toolTipReact,
|
|
20
|
+
"data-event-off": "click",
|
|
21
|
+
place: "left",
|
|
22
|
+
effect: "solid",
|
|
23
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
24
|
+
}, content);
|
|
25
|
+
} else {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: style.toolTip,
|
|
28
|
+
"data-testid": "tooltip",
|
|
29
|
+
"aria-label": closeToolTipInformationTextAriaLabel
|
|
30
|
+
}, content);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
35
|
+
toolTipIsVisible: PropTypes.bool,
|
|
36
|
+
anchorId: PropTypes.string,
|
|
37
|
+
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
38
|
+
content: PropTypes.node
|
|
39
|
+
} : {};
|
|
40
|
+
export const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
41
|
+
if (event.key === 'Enter') {
|
|
42
|
+
if (ref) ref.current.focus();
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
setState(!state);
|
|
46
|
+
} else if (event.key === 'Tab' || event.key === 'Escape') {
|
|
47
|
+
setState(false);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const ToolTip = ({
|
|
52
|
+
anchorId,
|
|
53
|
+
TooltipContent,
|
|
54
|
+
'aria-label': ariaLabel,
|
|
55
|
+
'data-testid': dataTestId,
|
|
56
|
+
closeToolTipInformationTextAriaLabel,
|
|
57
|
+
toolTipIsVisible: _toolTipIsVisible
|
|
58
|
+
}) => {
|
|
59
|
+
const isComponent = useMemo(() => !isString(TooltipContent) && /*#__PURE__*/isValidElement(TooltipContent()), [TooltipContent]);
|
|
60
|
+
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
61
|
+
const handleKeyPress = useCallback(event => {
|
|
62
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
|
|
63
|
+
}, [toolTipIsVisible]);
|
|
64
|
+
const handleMouseOver = useCallback(() => {
|
|
65
|
+
setToolTipIsVisible(true);
|
|
66
|
+
}, []);
|
|
67
|
+
const handleMouseLeave = useCallback(() => {
|
|
68
|
+
setToolTipIsVisible(false);
|
|
69
|
+
}, []);
|
|
70
|
+
const content = useMemo(() => {
|
|
71
|
+
return isComponent ? /*#__PURE__*/React.createElement(TooltipContent, null) : /*#__PURE__*/React.createElement("p", {
|
|
72
|
+
className: style.tooltipContent
|
|
73
|
+
}, TooltipContent);
|
|
74
|
+
}, [TooltipContent, isComponent]);
|
|
75
|
+
return anchorId ? /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
76
|
+
toolTipIsVisible: _toolTipIsVisible,
|
|
77
|
+
anchorId: anchorId,
|
|
78
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
79
|
+
content: content,
|
|
80
|
+
onMouseLeave: handleMouseLeave,
|
|
81
|
+
onMouseOver: handleMouseOver
|
|
82
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
83
|
+
className: style.tooltipContainer,
|
|
84
|
+
onMouseLeave: handleMouseLeave,
|
|
85
|
+
onMouseOver: handleMouseOver
|
|
86
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
87
|
+
type: "button",
|
|
88
|
+
className: style.tooltipIconContainer,
|
|
89
|
+
"data-testid": dataTestId,
|
|
90
|
+
onKeyDown: handleKeyPress,
|
|
91
|
+
tabIndex: 0
|
|
92
|
+
}, /*#__PURE__*/React.createElement(InformationIcon, {
|
|
93
|
+
className: style.informationIcon,
|
|
94
|
+
width: 12,
|
|
95
|
+
height: 12,
|
|
96
|
+
"aria-label": ariaLabel
|
|
97
|
+
})), /*#__PURE__*/React.createElement(ToolTipWrapper, {
|
|
98
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
99
|
+
anchorId: anchorId,
|
|
100
|
+
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
101
|
+
content: content
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
106
|
+
TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),
|
|
107
|
+
'data-testid': PropTypes.string,
|
|
108
|
+
'aria-label': PropTypes.string,
|
|
109
|
+
closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,
|
|
110
|
+
// ---------- externalHandling --------------
|
|
111
|
+
// if passed down, React Tooltip is used instead, due to limitations on
|
|
112
|
+
// parents overflow hidden controls
|
|
113
|
+
anchorId: PropTypes.string,
|
|
114
|
+
toolTipIsVisible: PropTypes.bool
|
|
115
|
+
} : {};
|
|
116
|
+
export default ToolTip;
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","PropTypes","ReactTooltip","isString","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","toolTipReact","toolTip","propTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","setToolTipIsVisible","handleKeyPress","handleMouseOver","handleMouseLeave","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","func"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={style.toolTip}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n setToolTipIsVisible(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setToolTipIsVisible(false);\n }, []);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={style.tooltipContent}>{TooltipContent}</p>\n );\n }, [TooltipContent, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={12}\n height={12}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- externalHandling --------------\n // if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,SAAQC,0CAA0C,IAAI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EAAE/B,KAAK,CAACkC,gBADnB;IAEE,YAAY,EAAEF,gBAFhB;IAGE,WAAW,EAAED;EAHf,gBAKE;IACE,IAAI,EAAC,QADP;IAEE,SAAS,EAAE/B,KAAK,CAACmC,oBAFnB;IAGE,eAAaT,UAHf;IAIE,SAAS,EAAEI,cAJb;IAKE,QAAQ,EAAE;EALZ,gBAOE,oBAAC,eAAD;IACE,SAAS,EAAE9B,KAAK,CAACoC,eADnB;IAEE,KAAK,EAAE,EAFT;IAGE,MAAM,EAAE,EAHV;IAIE,cAAYX;EAJd,EAPF,CALF,eAmBE,oBAAC,cAAD;IACE,gBAAgB,EAAEvB,gBADpB;IAEE,QAAQ,EAAEC,QAFZ;IAGE,oCAAoC,EAAEC,oCAHxC;IAIE,OAAO,EAAEC;EAJX,EAnBF,CAVF;AAqCD,CA3ED;;AA6EAkB,OAAO,CAACf,SAAR,2CAAoB;EAClBgB,cAAc,EAAE7B,SAAS,CAAC0C,SAAV,CAAoB,CAAC1C,SAAS,CAAC2C,IAAX,EAAiB3C,SAAS,CAACiB,IAA3B,EAAiCjB,SAAS,CAACe,MAA3C,CAApB,CADE;EAElB,eAAef,SAAS,CAACe,MAFP;EAGlB,cAAcf,SAAS,CAACe,MAHN;EAIlBN,oCAAoC,EAAET,SAAS,CAACe,MAAV,CAAiBC,UAJrC;EAKlB;EACA;EACA;EACAR,QAAQ,EAAER,SAAS,CAACe,MARF;EASlBR,gBAAgB,EAAEP,SAAS,CAACc;AATV,CAApB;AAYA,eAAec,OAAf"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value cm_blue_900 from colors;
|
|
3
|
+
@value cm_grey_75 from colors;
|
|
4
|
+
@value cm_grey_500 from colors;
|
|
5
|
+
@value cm_grey_700 from colors;
|
|
6
|
+
|
|
7
|
+
.textBase {
|
|
8
|
+
font-family: "Gilroy";
|
|
9
|
+
font-style: normal;
|
|
10
|
+
color: cm_blue_900;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tooltipContainer {
|
|
15
|
+
overflow: visible;
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 10;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
justify-self: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.tooltipIconContainer {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
border: none;
|
|
27
|
+
background: cm_grey_75;
|
|
28
|
+
height: 25px;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.toolTip {
|
|
33
|
+
transition: opacity 0.8s;
|
|
34
|
+
position: absolute;
|
|
35
|
+
border-radius: 7px;
|
|
36
|
+
background-color: cm_grey_700;
|
|
37
|
+
right: -75px;
|
|
38
|
+
bottom: 32px;
|
|
39
|
+
height: auto;
|
|
40
|
+
width: 200px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.toolTip::before {
|
|
44
|
+
content: '';
|
|
45
|
+
display: inline-block;
|
|
46
|
+
visibility: inherit;
|
|
47
|
+
opacity: inherit;
|
|
48
|
+
width: 15px;
|
|
49
|
+
height: 15px;
|
|
50
|
+
transform: rotate(-45deg);
|
|
51
|
+
background-color: cm_grey_700;
|
|
52
|
+
position: inherit;
|
|
53
|
+
border-radius: 2px;
|
|
54
|
+
bottom: -5px;
|
|
55
|
+
right: 40%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tooltipContent {
|
|
59
|
+
composes: textBase;
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
display: inline-block;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
word-wrap: break-word;
|
|
65
|
+
color: white;
|
|
66
|
+
padding: 8px 14px;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.informationIcon {
|
|
71
|
+
color: cm_grey_500;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* ----------------------- ReactToolTip exclusive classes ------------------------- */
|
|
75
|
+
.toolTipReact {
|
|
76
|
+
pointer-events: all !important;
|
|
77
|
+
background-color: cm_grey_700;
|
|
78
|
+
border-radius: 7px !important;
|
|
79
|
+
visibility: visible !important;
|
|
80
|
+
opacity: 1 !important;
|
|
81
|
+
left: 5px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* for keyboard navigation, the position can't be obtained from the mouse */
|
|
85
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact) {
|
|
86
|
+
border-radius: 7px !important;
|
|
87
|
+
top: 97px!important;
|
|
88
|
+
left: 628px!important;
|
|
89
|
+
visibility: visible !important;
|
|
90
|
+
opacity: 1!important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* same reason, arrow can't be placed effectively */
|
|
94
|
+
[class*="__react_component_tooltip"]:not(.toolTipReact)::after {
|
|
95
|
+
content: none !important;
|
|
96
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/answer/index.js"],"names":[],"mappings":";AA4EA,iDAWC"}
|
|
@@ -15,7 +15,7 @@ import QcmGraphic from '../questions/qcm-graphic';
|
|
|
15
15
|
import QuestionRange from '../questions/question-range';
|
|
16
16
|
import Template from '../questions/template';
|
|
17
17
|
import Audio from '../audio';
|
|
18
|
-
import { GetTranslateFromContext } from '../../atom/provider';
|
|
18
|
+
import Provider, { GetTranslateFromContext } from '../../atom/provider';
|
|
19
19
|
import style from './style.css';
|
|
20
20
|
import propTypes, { MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO } from './prop-types';
|
|
21
21
|
|
|
@@ -64,11 +64,11 @@ MediaView.propTypes = process.env.NODE_ENV !== "production" ? MediaViewPropTypes
|
|
|
64
64
|
const Switch = ({
|
|
65
65
|
model,
|
|
66
66
|
help
|
|
67
|
-
}) => {
|
|
67
|
+
}, legacyContext) => {
|
|
68
68
|
const {
|
|
69
69
|
type
|
|
70
70
|
} = model;
|
|
71
|
-
const translate = GetTranslateFromContext();
|
|
71
|
+
const translate = GetTranslateFromContext(legacyContext);
|
|
72
72
|
|
|
73
73
|
switch (type) {
|
|
74
74
|
case 'qcmDrag':
|
|
@@ -111,6 +111,9 @@ Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
111
111
|
model: propTypes.model,
|
|
112
112
|
help: propTypes.help
|
|
113
113
|
} : {};
|
|
114
|
+
Switch.contextTypes = {
|
|
115
|
+
translate: Provider.childContextTypes.translate
|
|
116
|
+
};
|
|
114
117
|
|
|
115
118
|
const Answer = props => {
|
|
116
119
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Audio","GetTranslateFromContext","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","translate","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport {GetTranslateFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}) => {\n const {type} = model;\n const translate = GetTranslateFromContext();\n switch (type) {\n case 'qcmDrag':\n return <QcmDrag {...model} help={help} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcm':\n return <Qcm {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcmGraphic':\n return <QcmGraphic {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'freeText':\n return <FreeText {...model} />;\n case 'dropDown':\n return <DropDown {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'slider':\n return <QuestionRange {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'template':\n return <Template {...model} groupAriaLabel={translate('answer_the_question')} />;\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <form>\n <Switch model={model} help={help} />\n </form>\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","VideoPlayer","DropDown","FreeText","QcmDrag","Qcm","QcmGraphic","QuestionRange","Template","Audio","Provider","GetTranslateFromContext","style","propTypes","MediaViewPropTypes","TYPE_AUDIO","TYPE_IMAGE","TYPE_VIDEO","MediaView","media","videoId","type","childProps","backgroundImage","url","video","audio","Switch","model","help","legacyContext","translate","contextTypes","childContextTypes","Answer","props","wrapper"],"sources":["../../../src/molecule/answer/index.js"],"sourcesContent":["import React from 'react';\nimport {omit} from 'lodash/fp';\nimport VideoPlayer from '../video-player';\nimport DropDown from '../questions/drop-down';\nimport FreeText from '../questions/free-text';\nimport QcmDrag from '../questions/qcm-drag';\nimport Qcm from '../questions/qcm';\nimport QcmGraphic from '../questions/qcm-graphic';\nimport QuestionRange from '../questions/question-range';\nimport Template from '../questions/template';\nimport Audio from '../audio';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport propTypes, {MediaViewPropTypes, TYPE_AUDIO, TYPE_IMAGE, TYPE_VIDEO} from './prop-types';\n\nconst MediaView = ({media}) => {\n const {videoId, type, ...childProps} = media;\n switch (type) {\n case TYPE_IMAGE:\n return (\n <div\n className={style.media}\n style={{\n backgroundImage: `url(${media.url})`\n }}\n />\n );\n case TYPE_VIDEO:\n return (\n <div className={style.video}>\n <VideoPlayer {...omit('id', childProps)} id={videoId} height=\"100%\" width=\"100%\" />\n </div>\n );\n case TYPE_AUDIO:\n return (\n <div className={style.audio}>\n <Audio {...omit('id', childProps)} height=\"100%\" width=\"100%\" />\n </div>\n );\n default:\n return null;\n }\n};\n\nMediaView.propTypes = MediaViewPropTypes;\n\nconst Switch = ({model, help}, legacyContext) => {\n const {type} = model;\n const translate = GetTranslateFromContext(legacyContext);\n switch (type) {\n case 'qcmDrag':\n return <QcmDrag {...model} help={help} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcm':\n return <Qcm {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'qcmGraphic':\n return <QcmGraphic {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'freeText':\n return <FreeText {...model} />;\n case 'dropDown':\n return <DropDown {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'slider':\n return <QuestionRange {...model} groupAriaLabel={translate('answer_the_question')} />;\n case 'template':\n return <Template {...model} groupAriaLabel={translate('answer_the_question')} />;\n }\n};\n\nSwitch.propTypes = {\n model: propTypes.model,\n help: propTypes.help\n};\n\nSwitch.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nconst Answer = props => {\n const {model, media, help} = props;\n\n return (\n <div data-name=\"answer\" className={style.wrapper}>\n {media ? <MediaView media={media} /> : null}\n <form>\n <Switch model={model} help={help} />\n </form>\n </div>\n );\n};\n\nAnswer.propTypes = propTypes;\n\nexport default Answer;\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,uBAArB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,QAAP,IAAkBC,uBAAlB,QAAgD,qBAAhD;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,IAAmBC,kBAAnB,EAAuCC,UAAvC,EAAmDC,UAAnD,EAA+DC,UAA/D,QAAgF,cAAhF;;AAEA,MAAMC,SAAS,GAAG,CAAC;EAACC;AAAD,CAAD,KAAa;EAC7B,MAAM;IAACC,OAAD;IAAUC;EAAV,IAAiCF,KAAvC;E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58
|
-
|
|
59
|
-
color: white
|
|
60
|
-
},
|
|
58
|
+
color: white,
|
|
61
59
|
className: style.icon
|
|
62
60
|
}), description ? /*#__PURE__*/React.createElement("div", {
|
|
63
61
|
className: classnames(style.description, style.innerHTML),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","classnames","NovaCompositionCoorpacademyMicrophone","PodcastIcon","Provider","style","Audio","Component","constructor","props","context","setAudio","element","audioElement","handlePlay","bind","shouldComponentUpdate","nextProps","mediaUrl","componentDidUpdate","load","e","onPlay","render","description","poster","skin","white","frame","backgroundImage","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","classnames","NovaCompositionCoorpacademyMicrophone","PodcastIcon","Provider","style","Audio","Component","constructor","props","context","setAudio","element","audioElement","handlePlay","bind","shouldComponentUpdate","nextProps","mediaUrl","componentDidUpdate","load","e","onPlay","render","description","poster","skin","white","frame","backgroundImage","icon","innerHTML","__html","audio","contextTypes","childContextTypes","propTypes","string","func"],"sources":["../../../src/molecule/audio/index.js"],"sourcesContent":["import React from 'react';\nimport {get} from 'lodash/fp';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {NovaCompositionCoorpacademyMicrophone as PodcastIcon} from '@coorpacademy/nova-icons';\nimport Provider from '../../atom/provider';\nimport style from './style.css';\n\nclass Audio extends React.Component {\n static propTypes = {\n description: PropTypes.string,\n mediaUrl: PropTypes.string,\n poster: PropTypes.string,\n onPlay: PropTypes.func\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin\n };\n\n constructor(props, context) {\n super(props, context);\n this.handlePlay = this.handlePlay.bind(this);\n this.audioElement = null;\n this.setAudio = this.setAudio.bind(this);\n }\n\n shouldComponentUpdate(nextProps) {\n const {mediaUrl} = this.props;\n return nextProps.mediaUrl !== mediaUrl;\n }\n\n componentDidUpdate() {\n this.audioElement.load();\n }\n\n setAudio = element => {\n this.audioElement = element;\n };\n\n handlePlay(e) {\n const {onPlay} = this.props;\n if (onPlay) onPlay(e);\n }\n\n render() {\n const {description, mediaUrl, poster} = this.props;\n const {skin} = this.context;\n\n const white = get('common.white', skin);\n return (\n <div className={style.frame} style={{backgroundImage: `url(${poster})`}}>\n <PodcastIcon color={white} className={style.icon} />\n {description ? (\n <div\n className={classnames(style.description, style.innerHTML)}\n data-name=\"audioDescription\"\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: description}}\n />\n ) : null}\n <audio\n className={style.audio}\n controls\n controlsList=\"nodownload\"\n ref={this.setAudio}\n autoPlay=\"\"\n onPlay={this.handlePlay}\n name=\"media\"\n data-name=\"audio\"\n preload=\"auto\"\n >\n <source src={mediaUrl} />\n </audio>\n </div>\n );\n }\n}\n\nexport default Audio;\n"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC,qCAAqC,IAAIC,WAAjD,QAAmE,0BAAnE;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,KAAN,SAAoBP,KAAK,CAACQ,SAA1B,CAAoC;EAYlCC,WAAW,CAACC,KAAD,EAAQC,OAAR,EAAiB;IAC1B,MAAMD,KAAN,EAAaC,OAAb;;IAD0B,KAgB5BC,QAhB4B,GAgBjBC,OAAO,IAAI;MACpB,KAAKC,YAAL,GAAoBD,OAApB;IACD,CAlB2B;;IAE1B,KAAKE,UAAL,GAAkB,KAAKA,UAAL,CAAgBC,IAAhB,CAAqB,IAArB,CAAlB;IACA,KAAKF,YAAL,GAAoB,IAApB;IACA,KAAKF,QAAL,GAAgB,KAAKA,QAAL,CAAcI,IAAd,CAAmB,IAAnB,CAAhB;EACD;;EAEDC,qBAAqB,CAACC,SAAD,EAAY;IAC/B,MAAM;MAACC;IAAD,IAAa,KAAKT,KAAxB;IACA,OAAOQ,SAAS,CAACC,QAAV,K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