@coorpacademy/components 10.5.7-alpha.6.5 → 10.6.0

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 (141) hide show
  1. package/es/atom/select/index.js +41 -22
  2. package/es/atom/select/index.js.map +1 -1
  3. package/es/atom/select/style.css +190 -42
  4. package/es/atom/select/test/fixtures/player.js +11 -0
  5. package/es/atom/select/test/fixtures/player.js.map +1 -0
  6. package/es/atom/select/test/fixtures.js +2 -0
  7. package/es/atom/select/test/fixtures.js.map +1 -1
  8. package/es/atom/select/test/select.js +49 -0
  9. package/es/atom/select/test/select.js.map +1 -0
  10. package/es/molecule/card/customer.js +6 -3
  11. package/es/molecule/card/customer.js.map +1 -1
  12. package/es/molecule/card/favorite.js +13 -4
  13. package/es/molecule/card/favorite.js.map +1 -1
  14. package/es/molecule/card/index.js +41 -12
  15. package/es/molecule/card/index.js.map +1 -1
  16. package/es/molecule/card/selectable.js +11 -4
  17. package/es/molecule/card/selectable.js.map +1 -1
  18. package/es/molecule/card/test/fixtures/default.js +20 -1
  19. package/es/molecule/card/test/fixtures/default.js.map +1 -1
  20. package/es/molecule/card-content/index.js +20 -7
  21. package/es/molecule/card-content/index.js.map +1 -1
  22. package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
  23. package/es/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
  24. package/es/molecule/course-sections/test/fixtures.js +15 -0
  25. package/es/molecule/course-sections/test/fixtures.js.map +1 -0
  26. package/es/molecule/draggable-list/test/fixtures.js +15 -0
  27. package/es/molecule/draggable-list/test/fixtures.js.map +1 -0
  28. package/es/molecule/questions/drop-down/index.js +1 -6
  29. package/es/molecule/questions/drop-down/index.js.map +1 -1
  30. package/es/molecule/questions/free-text/index.js +35 -15
  31. package/es/molecule/questions/free-text/index.js.map +1 -1
  32. package/es/molecule/questions/free-text/style.css +39 -15
  33. package/es/molecule/questions/free-text/test/fixtures/default.js +1 -1
  34. package/es/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  35. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +9 -0
  36. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
  37. package/es/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
  38. package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
  39. package/es/molecule/questions/free-text/test/fixtures.js +4 -2
  40. package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
  41. package/es/molecule/questions/free-text/test/free-text.js +106 -0
  42. package/es/molecule/questions/free-text/test/free-text.js.map +1 -0
  43. package/es/molecule/questions/qcm/style.css +4 -0
  44. package/es/molecule/questions/qcm-drag/index.js +53 -21
  45. package/es/molecule/questions/qcm-drag/index.js.map +1 -1
  46. package/es/molecule/questions/qcm-drag/style.css +72 -22
  47. package/es/molecule/questions/qcm-graphic/index.js +1 -0
  48. package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
  49. package/es/molecule/questions/qcm-graphic/style.css +12 -2
  50. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  51. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  52. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  53. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  54. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  55. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  56. package/es/molecule/questions/template/index.js +15 -11
  57. package/es/molecule/questions/template/index.js.map +1 -1
  58. package/es/molecule/questions/template/style.css +6 -0
  59. package/es/molecule/wizard-summary/test/fixtures.js +2 -0
  60. package/es/molecule/wizard-summary/test/fixtures.js.map +1 -1
  61. package/es/organism/wizard-contents/test/fixtures.js +2 -0
  62. package/es/organism/wizard-contents/test/fixtures.js.map +1 -1
  63. package/es/template/back-office/brand-update/test/fixtures.js +2 -0
  64. package/es/template/back-office/brand-update/test/fixtures.js.map +1 -1
  65. package/es/variables/colors.css +2 -0
  66. package/lib/atom/select/index.js +43 -19
  67. package/lib/atom/select/index.js.map +1 -1
  68. package/lib/atom/select/style.css +190 -42
  69. package/lib/atom/select/test/fixtures/player.js +21 -0
  70. package/lib/atom/select/test/fixtures/player.js.map +1 -0
  71. package/lib/atom/select/test/fixtures.js +3 -0
  72. package/lib/atom/select/test/fixtures.js.map +1 -1
  73. package/lib/atom/select/test/select.js +62 -0
  74. package/lib/atom/select/test/select.js.map +1 -0
  75. package/lib/molecule/card/customer.js +6 -3
  76. package/lib/molecule/card/customer.js.map +1 -1
  77. package/lib/molecule/card/favorite.js +13 -4
  78. package/lib/molecule/card/favorite.js.map +1 -1
  79. package/lib/molecule/card/index.js +41 -12
  80. package/lib/molecule/card/index.js.map +1 -1
  81. package/lib/molecule/card/selectable.js +11 -4
  82. package/lib/molecule/card/selectable.js.map +1 -1
  83. package/lib/molecule/card/test/fixtures/default.js +20 -1
  84. package/lib/molecule/card/test/fixtures/default.js.map +1 -1
  85. package/lib/molecule/card-content/index.js +21 -7
  86. package/lib/molecule/card-content/index.js.map +1 -1
  87. package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js +6 -1
  88. package/lib/molecule/card-content/test/fixtures/card-no-progress-bar.js.map +1 -1
  89. package/lib/molecule/course-sections/test/fixtures.js +25 -0
  90. package/lib/molecule/course-sections/test/fixtures.js.map +1 -0
  91. package/lib/molecule/draggable-list/test/fixtures.js +25 -0
  92. package/lib/molecule/draggable-list/test/fixtures.js.map +1 -0
  93. package/lib/molecule/questions/drop-down/index.js +1 -5
  94. package/lib/molecule/questions/drop-down/index.js.map +1 -1
  95. package/lib/molecule/questions/free-text/index.js +32 -14
  96. package/lib/molecule/questions/free-text/index.js.map +1 -1
  97. package/lib/molecule/questions/free-text/style.css +39 -15
  98. package/lib/molecule/questions/free-text/test/fixtures/default.js +1 -1
  99. package/lib/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  100. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +14 -0
  101. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
  102. package/lib/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
  103. package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
  104. package/lib/molecule/questions/free-text/test/fixtures.js +5 -2
  105. package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
  106. package/lib/molecule/questions/free-text/test/free-text.js +119 -0
  107. package/lib/molecule/questions/free-text/test/free-text.js.map +1 -0
  108. package/lib/molecule/questions/qcm/style.css +4 -0
  109. package/lib/molecule/questions/qcm-drag/index.js +53 -21
  110. package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
  111. package/lib/molecule/questions/qcm-drag/style.css +72 -22
  112. package/lib/molecule/questions/qcm-graphic/index.js +1 -0
  113. package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
  114. package/lib/molecule/questions/qcm-graphic/style.css +12 -2
  115. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  116. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  117. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  118. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  119. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  120. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  121. package/lib/molecule/questions/template/index.js +15 -11
  122. package/lib/molecule/questions/template/index.js.map +1 -1
  123. package/lib/molecule/questions/template/style.css +6 -0
  124. package/lib/molecule/wizard-summary/test/fixtures.js +3 -0
  125. package/lib/molecule/wizard-summary/test/fixtures.js.map +1 -1
  126. package/lib/organism/wizard-contents/test/fixtures.js +3 -0
  127. package/lib/organism/wizard-contents/test/fixtures.js.map +1 -1
  128. package/lib/template/back-office/brand-update/test/fixtures.js +3 -0
  129. package/lib/template/back-office/brand-update/test/fixtures.js.map +1 -1
  130. package/lib/variables/colors.css +2 -0
  131. package/package.json +2 -2
  132. package/es/molecule/cockpit-popin/test/fixtures.js +0 -17
  133. package/es/molecule/cockpit-popin/test/fixtures.js.map +0 -1
  134. package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
  135. package/es/molecule/search/test/fixtures.js +0 -15
  136. package/es/molecule/search/test/fixtures.js.map +0 -1
  137. package/lib/molecule/cockpit-popin/test/fixtures.js +0 -28
  138. package/lib/molecule/cockpit-popin/test/fixtures.js.map +0 -1
  139. package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
  140. package/lib/molecule/search/test/fixtures.js +0 -25
  141. package/lib/molecule/search/test/fixtures.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/molecule/card-content/index.js"],"names":["React","PropTypes","classnames","NovaCompositionCoorpacademyAdaptive","AdaptivIcon","NovaSolidStatusCheckCircle2","CheckIcon","NovaCompositionCoorpacademyTimer","TimerIcon","isExternalContent","EXTERNAL_CONTENT_ICONS","Provider","ContentBadge","innerHTML","style","MODES","HERO","CARD","THEMES","default","coorpmanager","ContentTypeInfo","mode","type","externalContent","context","translate","microLearningIcon","timerIcon","microLearninglabel","textColor","color","contentTypeInfo","contextTypes","skin","childContextTypes","propTypes","bool","string","CardTitle","title","empty","courseContent","lightTitle","darkTitle","__html","AuthorName","author","certifiedAuthor","checkIcon","authorIcon","iconShadow","darkAuthorTitle","ContentInfo","adaptiv","disabled","progress","badgeCategory","badgeLabel","theme","progressBarColor","inlineProgressValueStyle","backgroundColor","width","chapterContent","progressBar","progressWrapper","hideProgressBar","adaptiveIcon","infoWrapper","hero","card","progressBarDisabled","cardInfo","microLearningCardInfo","iconWrapper","number","category","label","oneOf"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YA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AErD,SAAS,CAACoC,IADG;AAEtBU,EAAAA,MAAM,EAAE9C,SAAS,CAACqC,MAFI;AAGtBU,EAAAA,eAAe,EAAE/C,SAAS,CAACoC,IAHL;AAItBkB,EAAAA,QAAQ,EAAEtD,SAAS,CAACoC,IAJE;AAKtBI,EAAAA,KAAK,EAAExC,SAAS,CAACoC,IALK;AAMtBmB,EAAAA,QAAQ,EAAEvD,SAAS,CAAC2E,MANE;AAOtBpC,EAAAA,KAAK,EAAEvC,SAAS,CAACqC,MAPK;AAQtBf,EAAAA,IAAI,EAAEtB,SAAS,CAACqC,MARM;AAStBhB,EAAAA,IAAI,EAAErB,SAAS,CAACqC,MATM;AAUtBmB,EAAAA,aAAa,EAAE7C,YAAY,CAACwB,SAAb,CAAuByC,QAVhB;AAWtBnB,EAAAA,UAAU,EAAE9C,YAAY,CAACwB,SAAb,CAAuB0C,KAXb;AAYtBnB,EAAAA,KAAK,EAAE1D,SAAS,CAAC8E,KAAV,CAAgB,MAAK7D,MAAL,CAAhB;AAZe,CAAxB;AAeA,eAAemC,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isNil, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyAdaptive as AdaptivIcon,\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport ContentBadge from '../../atom/content-badge';\nimport {innerHTML} from '../../atom/label/style.css';\nimport style from './style.css';\n\nexport const MODES = {\n HERO: 'hero',\n CARD: 'card'\n};\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst ContentTypeInfo = ({mode, type, externalContent}, context) => {\n const {translate} = context;\n if (mode !== MODES.CARD) {\n return null;\n }\n\n if (type === 'chapter') {\n return (\n <div className={style.microLearningIcon}>\n <TimerIcon className={style.timerIcon} />\n <span className={style.microLearninglabel}>{\"5' learning\"}</span>\n </div>\n );\n }\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const textColor = EXTERNAL_CONTENT_ICONS[type].color;\n\n return (\n <div className={style.contentTypeInfo} style={{color: textColor}}>\n {type === 'scorm' ? translate('external_content_scorm') : ''}\n {type === 'video' ? translate('external_content_video') : ''}\n {type === 'article' ? translate('external_content_article') : ''}\n {type === 'podcast' ? translate('external_content_podcast') : ''}\n </div>\n );\n }\n\n return null;\n};\n\nContentTypeInfo.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContentTypeInfo.propTypes = {\n externalContent: PropTypes.bool,\n type: PropTypes.string,\n mode: PropTypes.string\n};\n\nconst CardTitle = ({title, empty, courseContent}) => {\n return (\n <div\n className={classnames(\n style.title,\n innerHTML,\n courseContent ? style.lightTitle : style.darkTitle,\n empty ? style.empty : null\n )}\n data-name=\"title\"\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n );\n};\n\nCardTitle.propTypes = {\n title: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool\n};\n\nconst AuthorName = ({author, empty, courseContent, certifiedAuthor}) => {\n const checkIcon = certifiedAuthor ? (\n <CheckIcon\n className={classnames(style.authorIcon, courseContent ? style.iconShadow : null)}\n color=\"inherit\"\n />\n ) : null;\n\n return (\n <div\n data-name=\"author\"\n title={author}\n className={classnames(\n style.author,\n courseContent ? style.lightTitle : style.darkAuthorTitle,\n empty ? style.empty : null\n )}\n >\n <span>{author}</span>\n {checkIcon}\n </div>\n );\n};\n\nAuthorName.propTypes = {\n author: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool,\n certifiedAuthor: PropTypes.bool\n};\n\nconst ContentInfo = ({\n adaptiv,\n author,\n certifiedAuthor = false,\n disabled = false,\n empty = false,\n mode = MODES.CARD,\n progress,\n title,\n type,\n badgeCategory,\n badgeLabel,\n theme = 'default'\n}) => {\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${progress * 100}%`\n };\n const externalContent = isExternalContent(type);\n const courseContent = type === 'course';\n const chapterContent = type === 'chapter';\n\n const progressBar =\n mode === MODES.HERO || (!empty && !disabled) ? (\n <div className={!isNil(progress) ? style.progressWrapper : style.hideProgressBar}>\n {!disabled ? (\n <div data-name=\"progress\" className={style.progress} style={inlineProgressValueStyle} />\n ) : null}\n </div>\n ) : null;\n\n const adaptiveIcon = adaptiv ? (\n <div className={classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)}>\n <AdaptivIcon height={25} />\n </div>\n ) : null;\n\n return (\n <div\n data-name=\"info\"\n className={classnames(\n THEMES[theme],\n style.infoWrapper,\n mode === MODES.HERO ? style.hero : style.card,\n disabled ? style.progressBarDisabled : null,\n externalContent ? style.externalContent : null\n )}\n >\n <ContentTypeInfo mode={mode} type={type} externalContent={externalContent} />\n <div\n className={classnames(style.cardInfo, chapterContent ? style.microLearningCardInfo : null)}\n >\n <div className={style.iconWrapper}>\n {adaptiveIcon}\n {!empty && badgeLabel && badgeCategory && courseContent ? (\n <ContentBadge category={badgeCategory} label={badgeLabel} />\n ) : null}\n </div>\n <CardTitle title={title} empty={empty} courseContent={courseContent} />\n <AuthorName\n author={author}\n empty={empty}\n courseContent={courseContent}\n certifiedAuthor={certifiedAuthor}\n />\n </div>\n {progressBar}\n </div>\n );\n};\n\nContentInfo.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nContentInfo.propTypes = {\n adaptiv: PropTypes.bool,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n disabled: PropTypes.bool,\n empty: PropTypes.bool,\n progress: PropTypes.number,\n title: PropTypes.string,\n type: PropTypes.string,\n mode: PropTypes.string,\n badgeCategory: ContentBadge.propTypes.category,\n badgeLabel: ContentBadge.propTypes.label,\n theme: PropTypes.oneOf(keys(THEMES))\n};\n\nexport default ContentInfo;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/molecule/card-content/index.js"],"names":["React","PropTypes","classnames","NovaCompositionCoorpacademyAdaptive","AdaptivIcon","NovaSolidStatusCheckCircle2","CheckIcon","NovaCompositionCoorpacademyTimer","TimerIcon","isExternalContent","EXTERNAL_CONTENT_ICONS","Provider","ContentBadge","innerHTML","style","MODES","HERO","CARD","THEMES","default","coorpmanager","ContentTypeInfo","mode","type","externalContent","context","translate","microLearningIcon","timerIcon","microLearninglabel","textColor","color","contentTypeInfo","contextTypes","skin","childContextTypes","propTypes","bool","string","CardTitle","title","empty","courseContent","lightTitle","darkTitle","__html","AuthorName","author","certifiedAuthor","ariaLabel","checkIcon","authorIcon","iconShadow","darkAuthorTitle","ContentInfo","adaptiv","disabled","progress","badgeCategory","badgeLabel","theme","progressBarColor","inlineProgressValueStyle","backgroundColor","width","chapterContent","progressBar","progressWrapper","hideProgressBar","adaptiveIcon","infoWrapper","hero","card","progressBarDisabled","cardInfo","microLearningCardInfo","iconWrapper","number","category","label","oneOf","shape","progression","adaptive"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,mCAAmC,IAAIC,WADzC,EAEEC,2BAA2B,IAAIC,SAFjC,EAGEC,gCAAgC,IAAIC,SAHtC,QAIO,0BAJP;AAKA,SAAQC,iBAAR,EAA2BC,sBAA3B,QAAwD,6BAAxD;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAAQC,SAAR,QAAwB,4BAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,OAAO,MAAMC,KAAK,GAAG;AACnBC,EAAAA,IAAI,EAAE,MADa;AAEnBC,EAAAA,IAAI,EAAE;AAFa,CAAd;AAKP,OAAO,MAAMC,MAAM,GAAG;AACpBC,EAAAA,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AExC,SAAS,CAACoC,IALK;AAMtBoB,EAAAA,QAAQ,EAAExD,SAAS,CAAC4E,MANE;AAOtBrC,EAAAA,KAAK,EAAEvC,SAAS,CAACqC,MAPK;AAQtBf,EAAAA,IAAI,EAAEtB,SAAS,CAACqC,MARM;AAStBhB,EAAAA,IAAI,EAAErB,SAAS,CAACqC,MATM;AAUtBoB,EAAAA,aAAa,EAAE9C,YAAY,CAACwB,SAAb,CAAuB0C,QAVhB;AAWtBnB,EAAAA,UAAU,EAAE/C,YAAY,CAACwB,SAAb,CAAuB2C,KAXb;AAYtBnB,EAAAA,KAAK,EAAE3D,SAAS,CAAC+E,KAAV,CAAgB,MAAK9D,MAAL,CAAhB,CAZe;AAatB,gBAAcjB,SAAS,CAACgF,KAAV,CAAgB;AAC5BlC,IAAAA,MAAM,EAAE9C,SAAS,CAACqC,MADU;AAE5B4C,IAAAA,WAAW,EAAEjF,SAAS,CAACqC,MAFK;AAG5B6C,IAAAA,QAAQ,EAAElF,SAAS,CAACqC;AAHQ,GAAhB;AAbQ,CAAxB;AAoBA,eAAegB,WAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isNil, keys} from 'lodash/fp';\nimport {\n NovaCompositionCoorpacademyAdaptive as AdaptivIcon,\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon\n} from '@coorpacademy/nova-icons';\nimport {isExternalContent, EXTERNAL_CONTENT_ICONS} from '../../util/external-content';\nimport Provider from '../../atom/provider';\nimport ContentBadge from '../../atom/content-badge';\nimport {innerHTML} from '../../atom/label/style.css';\nimport style from './style.css';\n\nexport const MODES = {\n HERO: 'hero',\n CARD: 'card'\n};\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst ContentTypeInfo = ({mode, type, externalContent}, context) => {\n const {translate} = context;\n if (mode !== MODES.CARD) {\n return null;\n }\n\n if (type === 'chapter') {\n return (\n <div className={style.microLearningIcon}>\n <TimerIcon className={style.timerIcon} />\n <span className={style.microLearninglabel}>{\"5' learning\"}</span>\n </div>\n );\n }\n if (externalContent && EXTERNAL_CONTENT_ICONS[type]) {\n const textColor = EXTERNAL_CONTENT_ICONS[type].color;\n\n return (\n <div className={style.contentTypeInfo} style={{color: textColor}}>\n {type === 'scorm' ? translate('external_content_scorm') : ''}\n {type === 'video' ? translate('external_content_video') : ''}\n {type === 'article' ? translate('external_content_article') : ''}\n {type === 'podcast' ? translate('external_content_podcast') : ''}\n </div>\n );\n }\n\n return null;\n};\n\nContentTypeInfo.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nContentTypeInfo.propTypes = {\n externalContent: PropTypes.bool,\n type: PropTypes.string,\n mode: PropTypes.string\n};\n\nconst CardTitle = ({title, empty, courseContent}) => {\n return (\n <div\n className={classnames(\n style.title,\n innerHTML,\n courseContent ? style.lightTitle : style.darkTitle,\n empty ? style.empty : null\n )}\n data-name=\"title\"\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n );\n};\n\nCardTitle.propTypes = {\n title: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool\n};\n\nconst AuthorName = ({author, empty, courseContent, certifiedAuthor, 'aria-label': ariaLabel}) => {\n const checkIcon = certifiedAuthor ? (\n <CheckIcon\n className={classnames(style.authorIcon, courseContent ? style.iconShadow : null)}\n color=\"inherit\"\n />\n ) : null;\n\n return (\n <div\n data-name=\"author\"\n title={author}\n aria-label={ariaLabel}\n className={classnames(\n style.author,\n courseContent ? style.lightTitle : style.darkAuthorTitle,\n empty ? style.empty : null\n )}\n >\n <span>{author}</span>\n {checkIcon}\n </div>\n );\n};\n\nAuthorName.propTypes = {\n author: PropTypes.string,\n empty: PropTypes.bool,\n courseContent: PropTypes.bool,\n certifiedAuthor: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nconst ContentInfo = ({\n adaptiv,\n author,\n certifiedAuthor = false,\n disabled = false,\n empty = false,\n mode = MODES.CARD,\n progress,\n title,\n type,\n badgeCategory,\n badgeLabel,\n theme = 'default',\n 'aria-label': ariaLabel\n}) => {\n const progressBarColor = '#3EC483';\n const inlineProgressValueStyle = {\n backgroundColor: progressBarColor,\n width: `${progress * 100}%`\n };\n const externalContent = isExternalContent(type);\n const courseContent = type === 'course';\n const chapterContent = type === 'chapter';\n\n const progressBar =\n mode === MODES.HERO || (!empty && !disabled) ? (\n <div className={!isNil(progress) ? style.progressWrapper : style.hideProgressBar}>\n {!disabled ? (\n <div\n data-name=\"progress\"\n className={style.progress}\n style={inlineProgressValueStyle}\n aria-label={get('progression', ariaLabel)}\n />\n ) : null}\n </div>\n ) : null;\n\n const adaptiveIcon = adaptiv ? (\n <div\n className={classnames(style.adaptiveIcon, courseContent ? style.iconShadow : null)}\n aria-label={get('adaptive', ariaLabel)}\n >\n <AdaptivIcon height={25} />\n </div>\n ) : null;\n\n return (\n <div\n data-name=\"info\"\n className={classnames(\n THEMES[theme],\n style.infoWrapper,\n mode === MODES.HERO ? style.hero : style.card,\n disabled ? style.progressBarDisabled : null,\n externalContent ? style.externalContent : null\n )}\n >\n <ContentTypeInfo mode={mode} type={type} externalContent={externalContent} />\n <div\n className={classnames(style.cardInfo, chapterContent ? style.microLearningCardInfo : null)}\n >\n <div className={style.iconWrapper}>\n {adaptiveIcon}\n {!empty && badgeLabel && badgeCategory && courseContent ? (\n <ContentBadge category={badgeCategory} label={badgeLabel} />\n ) : null}\n </div>\n <CardTitle title={title} empty={empty} courseContent={courseContent} />\n <AuthorName\n author={author}\n empty={empty}\n courseContent={courseContent}\n certifiedAuthor={certifiedAuthor}\n aria-label={get('author', ariaLabel)}\n />\n </div>\n {progressBar}\n </div>\n );\n};\n\nContentInfo.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nContentInfo.propTypes = {\n adaptiv: PropTypes.bool,\n author: PropTypes.string,\n certifiedAuthor: PropTypes.bool,\n disabled: PropTypes.bool,\n empty: PropTypes.bool,\n progress: PropTypes.number,\n title: PropTypes.string,\n type: PropTypes.string,\n mode: PropTypes.string,\n badgeCategory: ContentBadge.propTypes.category,\n badgeLabel: ContentBadge.propTypes.label,\n theme: PropTypes.oneOf(keys(THEMES)),\n 'aria-label': PropTypes.shape({\n author: PropTypes.string,\n progression: PropTypes.string,\n adaptive: PropTypes.string\n })\n};\n\nexport default ContentInfo;\n"],"file":"index.js"}
@@ -3,7 +3,12 @@ export default {
3
3
  props: {
4
4
  mode: MODES.CARD,
5
5
  author: 'Coorpcademy',
6
- title: '<p align="right">From Mass Market to One to One targeting</p>'
6
+ title: '<p align="right">From Mass Market to One to One targeting</p>',
7
+ 'aria-label': {
8
+ author: 'auther name',
9
+ progression: 'you have done 65% of the course',
10
+ adaptive: 'this is an adaptive course'
11
+ }
7
12
  }
8
13
  };
9
14
  //# sourceMappingURL=card-no-progress-bar.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/molecule/card-content/test/fixtures/card-no-progress-bar.js"],"names":["MODES","props","mode","CARD","author","title"],"mappings":"AAAA,SAAQA,KAAR,QAAoB,OAApB;AAEA,eAAe;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAEF,KAAK,CAACG,IADP;AAELC,IAAAA,MAAM,EAAE,aAFH;AAGLC,IAAAA,KAAK,EAAE;AAHF;AADM,CAAf","sourcesContent":["import {MODES} from '../..';\n\nexport default {\n props: {\n mode: MODES.CARD,\n author: 'Coorpcademy',\n title: '<p align=\"right\">From Mass Market to One to One targeting</p>'\n }\n};\n"],"file":"card-no-progress-bar.js"}
1
+ {"version":3,"sources":["../../../../../src/molecule/card-content/test/fixtures/card-no-progress-bar.js"],"names":["MODES","props","mode","CARD","author","title","progression","adaptive"],"mappings":"AAAA,SAAQA,KAAR,QAAoB,OAApB;AAEA,eAAe;AACbC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAEF,KAAK,CAACG,IADP;AAELC,IAAAA,MAAM,EAAE,aAFH;AAGLC,IAAAA,KAAK,EAAE,+DAHF;AAIL,kBAAc;AACZD,MAAAA,MAAM,EAAE,aADI;AAEZE,MAAAA,WAAW,EAAE,iCAFD;AAGZC,MAAAA,QAAQ,EAAE;AAHE;AAJT;AADM,CAAf","sourcesContent":["import {MODES} from '../..';\n\nexport default {\n props: {\n mode: MODES.CARD,\n author: 'Coorpcademy',\n title: '<p align=\"right\">From Mass Market to One to One targeting</p>',\n 'aria-label': {\n author: 'auther name',\n progression: 'you have done 65% of the course',\n adaptive: 'this is an adaptive course'\n }\n }\n};\n"],"file":"card-no-progress-bar.js"}
@@ -0,0 +1,15 @@
1
+ import test from 'ava';
2
+ import forEach from 'lodash/forEach';
3
+ import renderComponentMacro from '../../../test/helpers/render-component';
4
+ import MoleculeCourseSections from '..';
5
+ import fixtureDefault from './fixtures/default';
6
+ import fixtureLoading from './fixtures/loading';
7
+ test('Molecule › MoleculeCourseSections > should have valid propTypes', t => {
8
+ t.pass();
9
+ forEach(MoleculeCourseSections.propTypes, (value, key) => {
10
+ t.not(value, undefined, `PropType for "Molecule.MoleculeCourseSections.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
11
+ });
12
+ });
13
+ test('Molecule › MoleculeCourseSections › Default › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureDefault);
14
+ test('Molecule › MoleculeCourseSections › Loading › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureLoading);
15
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/molecule/course-sections/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeCourseSections","fixtureDefault","fixtureLoading","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,sBAAP,MAAmC,IAAnC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEAL,IAAI,CAAC,iEAAD,EAAoEM,CAAC,IAAI;AAC3EA,EAAAA,CAAC,CAACC,IAAF;AACAN,EAAAA,OAAO,CAACE,sBAAsB,CAACK,SAAxB,EAAmC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACxDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,2DAA0DF,GAAI,mEAAvF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAV,IAAI,CAAC,kEAAD,EAAqEE,oBAArE,EAA2FC,sBAA3F,EAAmHC,cAAnH,CAAJ;AACAJ,IAAI,CAAC,kEAAD,EAAqEE,oBAArE,EAA2FC,sBAA3F,EAAmHE,cAAnH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeCourseSections from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLoading from './fixtures/loading';\n\ntest('Molecule › MoleculeCourseSections > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeCourseSections.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeCourseSections.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeCourseSections › Default › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureDefault);\ntest('Molecule › MoleculeCourseSections › Loading › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureLoading);\n"],"file":"fixtures.js"}
@@ -0,0 +1,15 @@
1
+ import test from 'ava';
2
+ import forEach from 'lodash/forEach';
3
+ import renderComponentMacro from '../../../test/helpers/render-component';
4
+ import MoleculeDraggableList from '..';
5
+ import fixtureCourseSections from './fixtures/course-sections';
6
+ import fixtureDashboardSections from './fixtures/dashboard-sections';
7
+ test('Molecule › MoleculeDraggableList > should have valid propTypes', t => {
8
+ t.pass();
9
+ forEach(MoleculeDraggableList.propTypes, (value, key) => {
10
+ t.not(value, undefined, `PropType for "Molecule.MoleculeDraggableList.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
11
+ });
12
+ });
13
+ test('Molecule › MoleculeDraggableList › CourseSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureCourseSections);
14
+ test('Molecule › MoleculeDraggableList › DashboardSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureDashboardSections);
15
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/molecule/draggable-list/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeDraggableList","fixtureCourseSections","fixtureDashboardSections","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,qBAAP,MAAkC,IAAlC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AAEAL,IAAI,CAAC,gEAAD,EAAmEM,CAAC,IAAI;AAC1EA,EAAAA,CAAC,CAACC,IAAF;AACAN,EAAAA,OAAO,CAACE,qBAAqB,CAACK,SAAvB,EAAkC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACvDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,0DAAyDF,GAAI,mEAAtF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAV,IAAI,CAAC,wEAAD,EAA2EE,oBAA3E,EAAiGC,qBAAjG,EAAwHC,qBAAxH,CAAJ;AACAJ,IAAI,CAAC,2EAAD,EAA8EE,oBAA9E,EAAoGC,qBAApG,EAA2HE,wBAA3H,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeDraggableList from '..';\nimport fixtureCourseSections from './fixtures/course-sections';\nimport fixtureDashboardSections from './fixtures/dashboard-sections';\n\ntest('Molecule › MoleculeDraggableList > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeDraggableList.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeDraggableList.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeDraggableList › CourseSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureCourseSections);\ntest('Molecule › MoleculeDraggableList › DashboardSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureDashboardSections);\n"],"file":"fixtures.js"}
@@ -1,7 +1,4 @@
1
1
  import _find from "lodash/fp/find";
2
-
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
-
5
2
  import React from 'react';
6
3
  import PropTypes from 'prop-types';
7
4
  import Select, { SelectOptionPropTypes } from '../../../atom/select';
@@ -29,9 +26,7 @@ const DropDown = props => {
29
26
 
30
27
  DropDown.propTypes = process.env.NODE_ENV !== "production" ? {
31
28
  onChange: Select.propTypes.onChange,
32
- options: PropTypes.arrayOf(PropTypes.shape(_extends(_extends({}, SelectOptionPropTypes), {}, {
33
- validOption: PropTypes.bool
34
- }))),
29
+ options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),
35
30
  theme: Select.propTypes.theme
36
31
  } : {};
37
32
  export default DropDown;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["React","PropTypes","Select","SelectOptionPropTypes","style","DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","wrapper","propTypes","arrayOf","shape","bool"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,sBAA5C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,OAAD;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAAK,EAAEC;AAA3B,MAAyCJ,KAA/C;;AAEA,QAAMK,gBAAgB,GAAG,MAAK,UAAL,EAAiBJ,OAAjB,CAAzB;;AACA,QAAMK,YAAY,GAChB,CAACD,gBAAD,IAAqBA,gBAAgB,CAACE,WAAjB,KAAiC,KAAtD,GAA8D,SAA9D,GAA0E,UAD5E;AAGA,QAAMJ,KAAK,GAAGC,UAAU,IAAIE,YAA5B;AAEA,sBACE;AAAK,IAAA,SAAS,EAAER,KAAK,CAACU;AAAtB,kBACE,oBAAC,MAAD;AAAQ,IAAA,KAAK,EAAEL,KAAf;AAAsB,IAAA,OAAO,EAAEF,OAA/B;AAAwC,IAAA,QAAQ,EAAEC;AAAlD,IADF,CADF;AAKD,CAdD;;AAgBAH,QAAQ,CAACU,SAAT,2CAAqB;AACnBP,EAAAA,QAAQ,EAAEN,MAAM,CAACa,SAAP,CAAiBP,QADR;AAEnBD,EAAAA,OAAO,EAAEN,SAAS,CAACe,OAAV,CACPf,SAAS,CAACgB,KAAV,uBAAoBd,qBAApB;AAA2CU,IAAAA,WAAW,EAAEZ,SAAS,CAACiB;AAAlE,KADO,CAFU;AAKnBT,EAAAA,KAAK,EAAEP,MAAM,CAACa,SAAP,CAAiBN;AALL,CAArB;AAQA,eAAeJ,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {find} from 'lodash/fp';\nimport Select, {SelectOptionPropTypes} from '../../../atom/select';\nimport style from './style.css';\n\nconst DropDown = props => {\n const {options, onChange, theme: propsTheme} = props;\n\n const currentSelection = find('selected', options);\n const defaultTheme =\n !currentSelection || currentSelection.validOption === false ? 'invalid' : 'question';\n\n const theme = propsTheme || defaultTheme;\n\n return (\n <div className={style.wrapper}>\n <Select theme={theme} options={options} onChange={onChange} />\n </div>\n );\n};\n\nDropDown.propTypes = {\n onChange: Select.propTypes.onChange,\n options: PropTypes.arrayOf(\n PropTypes.shape({...SelectOptionPropTypes, validOption: PropTypes.bool})\n ),\n theme: Select.propTypes.theme\n};\n\nexport default DropDown;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["React","PropTypes","Select","SelectOptionPropTypes","style","DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","wrapper","propTypes","arrayOf","shape"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,MAAP,IAAgBC,qBAAhB,QAA4C,sBAA5C;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,OAAD;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAAK,EAAEC;AAA3B,MAAyCJ,KAA/C;;AAEA,QAAMK,gBAAgB,GAAG,MAAK,UAAL,EAAiBJ,OAAjB,CAAzB;;AACA,QAAMK,YAAY,GAChB,CAACD,gBAAD,IAAqBA,gBAAgB,CAACE,WAAjB,KAAiC,KAAtD,GAA8D,SAA9D,GAA0E,UAD5E;AAGA,QAAMJ,KAAK,GAAGC,UAAU,IAAIE,YAA5B;AAEA,sBACE;AAAK,IAAA,SAAS,EAAER,KAAK,CAACU;AAAtB,kBACE,oBAAC,MAAD;AAAQ,IAAA,KAAK,EAAEL,KAAf;AAAsB,IAAA,OAAO,EAAEF,OAA/B;AAAwC,IAAA,QAAQ,EAAEC;AAAlD,IADF,CADF;AAKD,CAdD;;AAgBAH,QAAQ,CAACU,SAAT,2CAAqB;AACnBP,EAAAA,QAAQ,EAAEN,MAAM,CAACa,SAAP,CAAiBP,QADR;AAEnBD,EAAAA,OAAO,EAAEN,SAAS,CAACe,OAAV,CAAkBf,SAAS,CAACgB,KAAV,CAAgBd,qBAAhB,CAAlB,CAFU;AAGnBM,EAAAA,KAAK,EAAEP,MAAM,CAACa,SAAP,CAAiBN;AAHL,CAArB;AAMA,eAAeJ,QAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {find} from 'lodash/fp';\nimport Select, {SelectOptionPropTypes} from '../../../atom/select';\nimport style from './style.css';\n\nconst DropDown = props => {\n const {options, onChange, theme: propsTheme} = props;\n\n const currentSelection = find('selected', options);\n const defaultTheme =\n !currentSelection || currentSelection.validOption === false ? 'invalid' : 'question';\n\n const theme = propsTheme || defaultTheme;\n\n return (\n <div className={style.wrapper}>\n <Select theme={theme} options={options} onChange={onChange} />\n </div>\n );\n};\n\nDropDown.propTypes = {\n onChange: Select.propTypes.onChange,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n theme: Select.propTypes.theme\n};\n\nexport default DropDown;\n"],"file":"index.js"}
@@ -1,34 +1,53 @@
1
- import _get from "lodash/fp/get";
1
+ import _getOr from "lodash/fp/getOr";
2
2
  import _noop from "lodash/fp/noop";
3
- import React, { useMemo } from 'react';
3
+
4
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
5
+
6
+ import React, { useCallback, useMemo, useState } from 'react';
4
7
  import PropTypes from 'prop-types';
8
+ import { convert } from 'css-color-function';
5
9
  import Provider from '../../../atom/provider';
6
10
  import style from './style.css';
7
11
 
8
- const FreeText = (props, {
9
- skin
10
- }) => {
12
+ const FreeText = (props, context) => {
11
13
  const {
12
14
  placeholder = '',
13
15
  value = '',
14
- onChange = _noop
16
+ onChange = _noop,
17
+ 'aria-label': ariaLabel
15
18
  } = props;
16
- const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);
17
- const skinView = value ? _get('common.primary', skin) : null;
19
+ const [hovered, setHovered] = useState(false);
20
+ const handleChange = useCallback(e => onChange(e.target.value), [onChange]);
21
+
22
+ const primarySkinColor = _getOr('#00B0FF', 'skin.common.primary', context);
23
+
24
+ const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);
25
+ const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);
26
+ const shadowBoxPrimaryColor = useMemo(() => convert(`color(${primarySkinColor} a(12%))`), [primarySkinColor]);
18
27
  return /*#__PURE__*/React.createElement("div", {
19
28
  "data-name": "freeText",
20
- className: style.wrapper
29
+ className: style.wrapper,
30
+ onMouseOver: handleMouseOver,
31
+ onMouseLeave: handleMouseLeave,
32
+ style: _extends({}, value && {
33
+ boxShadow: hovered ? 'none' : `0 4px 16px ${shadowBoxPrimaryColor}`
34
+ })
21
35
  }, /*#__PURE__*/React.createElement("input", {
36
+ "data-name": "free-text-input",
22
37
  type: "text",
23
- className: style.input,
38
+ "aria-label": ariaLabel || value || placeholder,
39
+ className: style.freeText,
24
40
  placeholder: placeholder,
25
41
  value: value,
26
42
  onInput: handleChange,
27
43
  onChange: _noop,
28
- style: {
29
- color: skinView,
30
- borderColor: skinView
31
- }
44
+ style: _extends(_extends({
45
+ boxShadow: `0 4px 16px ${shadowBoxPrimaryColor}`
46
+ }, value && {
47
+ boxShadow: `0 4px 16px ${hovered ? convert(`color(${primarySkinColor} a(20%))`) : shadowBoxPrimaryColor}`
48
+ }), {}, {
49
+ color: primarySkinColor
50
+ })
32
51
  }));
33
52
  };
34
53
 
@@ -38,7 +57,8 @@ FreeText.contextTypes = {
38
57
  FreeText.propTypes = process.env.NODE_ENV !== "production" ? {
39
58
  placeholder: PropTypes.string,
40
59
  value: PropTypes.string,
41
- onChange: PropTypes.func
60
+ onChange: PropTypes.func,
61
+ 'aria-label': PropTypes.string
42
62
  } : {};
43
63
  export default FreeText;
44
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/molecule/questions/free-text/index.js"],"names":["React","useMemo","PropTypes","Provider","style","FreeText","props","skin","placeholder","value","onChange","handleChange","e","target","skinView","wrapper","input","color","borderColor","contextTypes","childContextTypes","propTypes","string","func"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQ;AAACC,EAAAA;AAAD,CAAR,KAAmB;AAClC,QAAM;AAACC,IAAAA,WAAW,GAAG,EAAf;AAAmBC,IAAAA,KAAK,GAAG,EAA3B;AAA+BC,IAAAA,QAAQ;AAAvC,MAAkDJ,KAAxD;AAEA,QAAMK,YAAY,GAAGV,OAAO,CAAC,MAAMW,CAAC,IAAIF,QAAQ,CAACE,CAAC,CAACC,MAAF,CAASJ,KAAV,CAApB,EAAsC,CAACC,QAAD,CAAtC,CAA5B;AACA,QAAMI,QAAQ,GAAGL,KAAK,GAAG,KAAI,gBAAJ,EAAsBF,IAAtB,CAAH,GAAiC,IAAvD;AAEA,sBACE;AAAK,iBAAU,UAAf;AAA0B,IAAA,SAAS,EAAEH,KAAK,CAACW;AAA3C,kBACE;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,SAAS,EAAEX,KAAK,CAACY,KAFnB;AAGE,IAAA,WAAW,EAAER,WAHf;AAIE,IAAA,KAAK,EAAEC,KAJT;AAKE,IAAA,OAAO,EAAEE,YALX;AAME,IAAA,QAAQ,OANV;AAOE,IAAA,KAAK,EAAE;AACLM,MAAAA,KAAK,EAAEH,QADF;AAELI,MAAAA,WAAW,EAAEJ;AAFR;AAPT,IADF,CADF;AAgBD,CAtBD;;AAwBAT,QAAQ,CAACc,YAAT,GAAwB;AACtBZ,EAAAA,IAAI,EAAEJ,QAAQ,CAACiB,iBAAT,CAA2Bb;AADX,CAAxB;AAIAF,QAAQ,CAACgB,SAAT,2CAAqB;AACnBb,EAAAA,WAAW,EAAEN,SAAS,CAACoB,MADJ;AAEnBb,EAAAA,KAAK,EAAEP,SAAS,CAACoB,MAFE;AAGnBZ,EAAAA,QAAQ,EAAER,SAAS,CAACqB;AAHD,CAArB;AAMA,eAAelB,QAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, get} from 'lodash/fp';\nimport Provider from '../../../atom/provider';\nimport style from './style.css';\n\nconst FreeText = (props, {skin}) => {\n const {placeholder = '', value = '', onChange = noop} = props;\n\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n const skinView = value ? get('common.primary', skin) : null;\n\n return (\n <div data-name=\"freeText\" className={style.wrapper}>\n <input\n type=\"text\"\n className={style.input}\n placeholder={placeholder}\n value={value}\n onInput={handleChange}\n onChange={noop}\n style={{\n color: skinView,\n borderColor: skinView\n }}\n />\n </div>\n );\n};\n\nFreeText.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nFreeText.propTypes = {\n placeholder: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func\n};\n\nexport default FreeText;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/molecule/questions/free-text/index.js"],"names":["React","useCallback","useMemo","useState","PropTypes","convert","Provider","style","FreeText","props","context","placeholder","value","onChange","ariaLabel","hovered","setHovered","handleChange","e","target","primarySkinColor","handleMouseOver","handleMouseLeave","shadowBoxPrimaryColor","wrapper","boxShadow","freeText","color","contextTypes","skin","childContextTypes","propTypes","string","func"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC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AKE,IAAA,WAAW,EAAEf,WALf;AAME,IAAA,KAAK,EAAEC,KANT;AAOE,IAAA,OAAO,EAAEK,YAPX;AAQE,IAAA,QAAQ,OARV;AASE,IAAA,KAAK;AACHQ,MAAAA,SAAS,EAAG,cAAaF,qBAAsB;AAD5C,OAECX,KAAK,IAAI;AACXa,MAAAA,SAAS,EAAG,cACVV,OAAO,GAAGV,OAAO,CAAE,SAAQe,gBAAiB,UAA3B,CAAV,GAAkDG,qBAC1D;AAHU,KAFV;AAOHI,MAAAA,KAAK,EAAEP;AAPJ;AATP,IAXF,CADF;AAiCD,CAhDD;;AAkDAZ,QAAQ,CAACoB,YAAT,GAAwB;AACtBC,EAAAA,IAAI,EAAEvB,QAAQ,CAACwB,iBAAT,CAA2BD;AADX,CAAxB;AAIArB,QAAQ,CAACuB,SAAT,2CAAqB;AACnBpB,EAAAA,WAAW,EAAEP,SAAS,CAAC4B,MADJ;AAEnBpB,EAAAA,KAAK,EAAER,SAAS,CAAC4B,MAFE;AAGnBnB,EAAAA,QAAQ,EAAET,SAAS,CAAC6B,IAHD;AAInB,gBAAc7B,SAAS,CAAC4B;AAJL,CAArB;AAOA,eAAexB,QAAf","sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, getOr} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../../atom/provider';\nimport style from './style.css';\n\nconst FreeText = (props, context) => {\n const {placeholder = '', value = '', onChange = noop, 'aria-label': ariaLabel} = props;\n const [hovered, setHovered] = useState(false);\n\n const handleChange = useCallback(e => onChange(e.target.value), [onChange]);\n const primarySkinColor = getOr('#00B0FF', 'skin.common.primary', context);\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const shadowBoxPrimaryColor = useMemo(() => convert(`color(${primarySkinColor} a(12%))`), [\n primarySkinColor\n ]);\n\n return (\n <div\n data-name=\"freeText\"\n className={style.wrapper}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n style={{\n ...(value && {\n boxShadow: hovered ? 'none' : `0 4px 16px ${shadowBoxPrimaryColor}`\n })\n }}\n >\n <input\n data-name=\"free-text-input\"\n type=\"text\"\n aria-label={ariaLabel || value || placeholder}\n className={style.freeText}\n placeholder={placeholder}\n value={value}\n onInput={handleChange}\n onChange={noop}\n style={{\n boxShadow: `0 4px 16px ${shadowBoxPrimaryColor}`,\n ...(value && {\n boxShadow: `0 4px 16px ${\n hovered ? convert(`color(${primarySkinColor} a(20%))`) : shadowBoxPrimaryColor\n }`\n }),\n color: primarySkinColor\n }}\n />\n </div>\n );\n};\n\nFreeText.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nFreeText.propTypes = {\n placeholder: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n 'aria-label': PropTypes.string\n};\n\nexport default FreeText;\n"],"file":"index.js"}
@@ -1,41 +1,65 @@
1
1
  @value breakpoints: "../../../variables/breakpoints.css";
2
2
  @value mobile from breakpoints;
3
3
  @value colors: "../../../variables/colors.css";
4
- @value medium from colors;
5
- @value black from colors;
4
+ @value box_shadow_light_dark from colors;
5
+ @value cm_blue_900 from colors;
6
6
 
7
- .input {
7
+
8
+ .freeText {
9
+ border: unset;
10
+ border-width: 0;
8
11
  font-family: "Gilroy";
9
12
  font-weight: 700;
10
13
  text-transform: none;
11
- padding: 0 15px;
12
- border: solid 1px;
13
- border-color: color(black lightness(85%));
14
14
  height: 50px;
15
- border-radius: 2px;
15
+ border-radius: 8px;
16
16
  font-size: 14px;
17
- width: 230px;
17
+ max-width: calc(100% - 24px);
18
+ width: 100%;
18
19
  outline: none;
20
+ padding-left: 12px;
21
+ padding-right: 12px;
22
+ }
23
+
24
+ .freeText::placeholder {
25
+ color: color(cm_blue_900 a(0.3));
26
+ }
27
+
28
+ .freeText:-ms-input-placeholder {
29
+ color: color(cm_blue_900 a(0.3))!important;
19
30
  }
20
31
 
21
- .input::placeholder {
22
- color: medium;
32
+ .freeText:focus {
33
+ outline: none;
23
34
  }
24
35
 
25
- .input:focus {
36
+ .freeText:hover {
26
37
  outline: none;
27
38
  }
28
39
 
40
+ .wrapper {
41
+ border-radius: 8px;
42
+ box-shadow: 0px 4px 16px box_shadow_light_dark;
43
+ margin: 0 15px;
44
+ overflow: hidden;
45
+ width: 230px;
46
+ }
47
+
48
+ .wrapper:hover {
49
+ box-shadow: none;
50
+ overflow: visible;
51
+ }
52
+
29
53
  @media mobile {
30
54
  .wrapper {
31
- width: 304px;
55
+ max-width: calc(100% - 30px);
56
+ width: auto;
32
57
  box-sizing: border-box;
33
- max-width: 100%;
34
58
  }
35
59
 
36
- .input {
60
+ .freeText {
61
+ min-width: fit-content;
37
62
  width: 100%;
38
- margin: 0;
39
63
  box-sizing: border-box;
40
64
  }
41
65
  }
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  props: {
3
3
  placeholder: 'Type your answer here',
4
- defaultValue: null
4
+ value: undefined
5
5
  }
6
6
  };
7
7
  //# sourceMappingURL=default.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/default.js"],"names":["props","placeholder","defaultValue"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,YAAY,EAAE;AAFT;AADM,CAAf","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n defaultValue: null\n }\n};\n"],"file":"default.js"}
1
+ {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/default.js"],"names":["props","placeholder","value","undefined"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADM,CAAf","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: undefined\n }\n};\n"],"file":"default.js"}
@@ -0,0 +1,9 @@
1
+ export default {
2
+ props: {
3
+ placeholder: 'Type your answer here',
4
+ value: 'plop!',
5
+ onChange: () => {},
6
+ 'aria-label': 'aria input'
7
+ }
8
+ };
9
+ //# sourceMappingURL=with-value-on-change.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value-on-change.js"],"names":["props","placeholder","value","onChange"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAE,OAFF;AAGLC,IAAAA,QAAQ,EAAE,MAAM,CAAE,CAHb;AAIL,kBAAc;AAJT;AADM,CAAf","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: 'plop!',\n onChange: () => {},\n 'aria-label': 'aria input'\n }\n};\n"],"file":"with-value-on-change.js"}
@@ -1,7 +1,7 @@
1
1
  export default {
2
2
  props: {
3
3
  placeholder: 'Type your answer here',
4
- defaultValue: 'plop!'
4
+ value: 'plop!'
5
5
  }
6
6
  };
7
- //# sourceMappingURL=with-default-value.js.map
7
+ //# sourceMappingURL=with-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value.js"],"names":["props","placeholder","value"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAE;AAFF;AADM,CAAf","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: 'plop!'\n }\n};\n"],"file":"with-value.js"}
@@ -3,7 +3,8 @@ import forEach from 'lodash/forEach';
3
3
  import renderComponentMacro from '../../../../test/helpers/render-component';
4
4
  import MoleculeQuestionsFreeText from '..';
5
5
  import fixtureDefault from './fixtures/default';
6
- import fixtureWithDefaultValue from './fixtures/with-default-value';
6
+ import fixtureWithValueOnChange from './fixtures/with-value-on-change';
7
+ import fixtureWithValue from './fixtures/with-value';
7
8
  test('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {
8
9
  t.pass();
9
10
  forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {
@@ -11,5 +12,6 @@ test('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTy
11
12
  });
12
13
  });
13
14
  test('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);
14
- test('MoleculeQuestions › MoleculeQuestionsFreeText › WithDefaultValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithDefaultValue);
15
+ test('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValueOnChange);
16
+ test('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValue);
15
17
  //# sourceMappingURL=fixtures.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuestionsFreeText","fixtureDefault","fixtureWithDefaultValue","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,2CAAjC;AACA,OAAOC,yBAAP,MAAsC,IAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEAL,IAAI,CAAC,6EAAD,EAAgFM,CAAC,IAAI;AACvFA,EAAAA,CAAC,CAACC,IAAF;AACAN,EAAAA,OAAO,CAACE,yBAAyB,CAACK,SAA3B,EAAsC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC3DJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uEAAsEF,GAAI,mEAAnG;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAV,IAAI,CAAC,8EAAD,EAAiFE,oBAAjF,EAAuGC,yBAAvG,EAAkIC,cAAlI,CAAJ;AACAJ,IAAI,CAAC,uFAAD,EAA0FE,oBAA1F,EAAgHC,yBAAhH,EAA2IE,uBAA3I,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../../test/helpers/render-component';\nimport MoleculeQuestionsFreeText from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWithDefaultValue from './fixtures/with-default-value';\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"MoleculeQuestions.MoleculeQuestionsFreeText.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithDefaultValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithDefaultValue);\n"],"file":"fixtures.js"}
1
+ {"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuestionsFreeText","fixtureDefault","fixtureWithValueOnChange","fixtureWithValue","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,2CAAjC;AACA,OAAOC,yBAAP,MAAsC,IAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,wBAAP,MAAqC,iCAArC;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AAEAN,IAAI,CAAC,6EAAD,EAAgFO,CAAC,IAAI;AACvFA,EAAAA,CAAC,CAACC,IAAF;AACAP,EAAAA,OAAO,CAACE,yBAAyB,CAACM,SAA3B,EAAsC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC3DJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uEAAsEF,GAAI,mEAAnG;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAX,IAAI,CAAC,8EAAD,EAAiFE,oBAAjF,EAAuGC,yBAAvG,EAAkIC,cAAlI,CAAJ;AACAJ,IAAI,CAAC,wFAAD,EAA2FE,oBAA3F,EAAiHC,yBAAjH,EAA4IE,wBAA5I,CAAJ;AACAL,IAAI,CAAC,gFAAD,EAAmFE,oBAAnF,EAAyGC,yBAAzG,EAAoIG,gBAApI,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../../test/helpers/render-component';\nimport MoleculeQuestionsFreeText from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWithValueOnChange from './fixtures/with-value-on-change';\nimport fixtureWithValue from './fixtures/with-value';\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"MoleculeQuestions.MoleculeQuestionsFreeText.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValueOnChange);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValue);\n"],"file":"fixtures.js"}
@@ -0,0 +1,106 @@
1
+ import _identity from "lodash/fp/identity";
2
+
3
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ import browserEnv from 'browser-env';
6
+ import test from 'ava';
7
+ import React from 'react';
8
+ import { shallow, mount, configure } from 'enzyme';
9
+ import Adapter from 'enzyme-adapter-react-16';
10
+ import FreeText from '..';
11
+ import defaultFixture from './fixtures/default';
12
+ import withValueFixture from './fixtures/with-value';
13
+ import withValueOnChangeFixture from './fixtures/with-value-on-change';
14
+ browserEnv();
15
+ configure({
16
+ adapter: new Adapter()
17
+ });
18
+ const translate = _identity;
19
+ test('onInput should be reachable and replace onChange, onChange should not trigger value changes, should use aria-label', t => {
20
+ t.plan(7);
21
+ let onInputWasTriggered = false;
22
+
23
+ const props = _extends(_extends({}, withValueOnChangeFixture.props), {}, {
24
+ onChange: value => {
25
+ onInputWasTriggered = true;
26
+ t.is(value, 'new value');
27
+ }
28
+ });
29
+
30
+ const wrapper = shallow( /*#__PURE__*/React.createElement(FreeText, props), {
31
+ context: {
32
+ translate
33
+ }
34
+ });
35
+ let freeText = wrapper.find('[data-name="free-text-input"]');
36
+ t.true(freeText.at(0).exists());
37
+ t.is(freeText.at(0).props()['aria-label'], 'aria input');
38
+ t.is(freeText.at(0).props().value, 'plop!'); // should not trigger a value change with onChange
39
+
40
+ freeText.at(0).simulate('change', {
41
+ target: {
42
+ value: 'new value'
43
+ }
44
+ });
45
+ wrapper.update(); // should not update the trigger flag with onChange
46
+
47
+ t.false(onInputWasTriggered);
48
+ freeText.at(0).simulate('input', {
49
+ target: {
50
+ value: 'new value'
51
+ }
52
+ });
53
+ wrapper.update();
54
+ freeText = wrapper.find('[data-name="free-text-input"]');
55
+ t.true(onInputWasTriggered);
56
+ t.pass();
57
+ });
58
+ test('should set: boxShadow (hover & not hovered variants) && color for the input if a value is provided', t => {
59
+ const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, withValueFixture.props));
60
+ let freeTextWrapper = wrapper.find('[data-name="freeText"]');
61
+ t.true(freeTextWrapper.at(0).exists());
62
+ t.deepEqual(freeTextWrapper.at(0).props().style, {
63
+ boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
64
+ });
65
+ let freeText = wrapper.find('[data-name="free-text-input"]');
66
+ t.true(freeText.at(0).exists());
67
+ t.is(freeText.at(0).props().value, 'plop!');
68
+ t.deepEqual(freeTextWrapper.at(0).props().style, {
69
+ boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
70
+ });
71
+ freeTextWrapper.simulate('mouseover');
72
+ wrapper.update();
73
+ freeText = wrapper.find('[data-name="free-text-input"]');
74
+ freeTextWrapper = wrapper.find('[data-name="freeText"]'); // hovered
75
+
76
+ t.deepEqual(freeText.at(0).props().style, {
77
+ boxShadow: '0 4px 16px rgba(0, 176, 255, 0.2)',
78
+ color: '#00B0FF'
79
+ });
80
+ t.deepEqual(freeTextWrapper.at(0).props().style, {
81
+ boxShadow: 'none'
82
+ });
83
+ freeTextWrapper.simulate('mouseleave');
84
+ wrapper.update();
85
+ freeText = wrapper.find('[data-name="free-text-input"]');
86
+ t.deepEqual(freeText.at(0).props().style, {
87
+ boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)',
88
+ color: '#00B0FF'
89
+ });
90
+ t.pass();
91
+ });
92
+ test('should use value as default aria-label if no aria-label is provided', t => {
93
+ const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, withValueFixture.props));
94
+ const freeText = wrapper.find('[data-name="free-text-input"]');
95
+ t.true(freeText.at(0).exists());
96
+ t.is(freeText.at(0).props()['aria-label'], 'plop!');
97
+ t.pass();
98
+ });
99
+ test('should use placeholder as default aria-label if no aria-label is provided and no value is present', t => {
100
+ const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, defaultFixture.props));
101
+ const freeText = wrapper.find('[data-name="free-text-input"]');
102
+ t.true(freeText.at(0).exists());
103
+ t.is(freeText.at(0).props()['aria-label'], 'Type your answer here');
104
+ t.pass();
105
+ });
106
+ //# sourceMappingURL=free-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/free-text.js"],"names":["browserEnv","test","React","shallow","mount","configure","Adapter","FreeText","defaultFixture","withValueFixture","withValueOnChangeFixture","adapter","translate","t","plan","onInputWasTriggered","props","onChange","value","is","wrapper","context","freeText","find","true","at","exists","simulate","target","update","false","pass","freeTextWrapper","deepEqual","style","boxShadow","color"],"mappings":";;;;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,KAAjB,EAAwBC,SAAxB,QAAwC,QAAxC;AAEA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,QAAP,MAAqB,IAArB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AACA,OAAOC,wBAAP,MAAqC,iCAArC;AAEAV,UAAU;AACVK,SAAS,CAAC;AAACM,EAAAA,OAAO,EAAE,IAAIL,OAAJ;AAAV,CAAD,CAAT;AACA,MAAMM,SAAS,YAAf;AAEAX,IAAI,CAAC,oHAAD,EAAuHY,CAAC,IAAI;AAC9HA,EAAAA,CAAC,CAACC,IAAF,CAAO,CAAP;AACA,MAAIC,mBAAmB,GAAG,KAA1B;;AACA,QAAMC,KAAK,yBACNN,wBAAwB,CAACM,KADnB;AAETC,IAAAA,QAAQ,EAAEC,KAAK,IAAI;AACjBH,MAAAA,mBAAmB,GAAG,IAAtB;AACAF,MAAAA,CAAC,CAACM,EAAF,CAAKD,KAAL,EAAY,WAAZ;AACD;AALQ,IAAX;;AAOA,QAAME,OAAO,GAAGjB,OAAO,eAAC,oBAAC,QAAD,EAAca,KAAd,CAAD,EAA0B;AAC/CK,IAAAA,OAAO,EAAE;AAACT,MAAAA;AAAD;AADsC,GAA1B,C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B,YAAvB,CAAL,EAA2C,uBAA3C;AACAH,EAAAA,CAAC,CAACkB,IAAF;AACD,CANG,CAAJ","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {shallow, mount, configure} from 'enzyme';\nimport {identity} from 'lodash/fp';\nimport Adapter from 'enzyme-adapter-react-16';\nimport FreeText from '..';\nimport defaultFixture from './fixtures/default';\nimport withValueFixture from './fixtures/with-value';\nimport withValueOnChangeFixture from './fixtures/with-value-on-change';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\nconst translate = identity;\n\ntest('onInput should be reachable and replace onChange, onChange should not trigger value changes, should use aria-label', t => {\n t.plan(7);\n let onInputWasTriggered = false;\n const props = {\n ...withValueOnChangeFixture.props,\n onChange: value => {\n onInputWasTriggered = true;\n t.is(value, 'new value');\n }\n };\n const wrapper = shallow(<FreeText {...props} />, {\n context: {translate}\n });\n let freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'aria input');\n t.is(freeText.at(0).props().value, 'plop!');\n // should not trigger a value change with onChange\n freeText.at(0).simulate('change', {target: {value: 'new value'}});\n wrapper.update();\n // should not update the trigger flag with onChange\n t.false(onInputWasTriggered);\n freeText.at(0).simulate('input', {target: {value: 'new value'}});\n wrapper.update();\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(onInputWasTriggered);\n t.pass();\n});\n\ntest('should set: boxShadow (hover & not hovered variants) && color for the input if a value is provided', t => {\n const wrapper = mount(<FreeText {...withValueFixture.props} />);\n let freeTextWrapper = wrapper.find('[data-name=\"freeText\"]');\n t.true(freeTextWrapper.at(0).exists());\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'\n });\n\n let freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props().value, 'plop!');\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'\n });\n freeTextWrapper.simulate('mouseover');\n wrapper.update();\n\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n freeTextWrapper = wrapper.find('[data-name=\"freeText\"]');\n // hovered\n t.deepEqual(freeText.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.2)',\n color: '#00B0FF'\n });\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: 'none'\n });\n\n freeTextWrapper.simulate('mouseleave');\n wrapper.update();\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.deepEqual(freeText.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)',\n color: '#00B0FF'\n });\n\n t.pass();\n});\n\ntest('should use value as default aria-label if no aria-label is provided', t => {\n const wrapper = mount(<FreeText {...withValueFixture.props} />);\n const freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'plop!');\n t.pass();\n});\n\ntest('should use placeholder as default aria-label if no aria-label is provided and no value is present', t => {\n const wrapper = mount(<FreeText {...defaultFixture.props} />);\n const freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'Type your answer here');\n t.pass();\n});\n"],"file":"free-text.js"}
@@ -48,6 +48,10 @@
48
48
  .answerText {
49
49
  position: relative;
50
50
  color: cm_blue_900;
51
+ hyphens: auto;
52
+ -ms-word-break: break-all;
53
+ word-break: break-all;
54
+ word-break: break-word;
51
55
  }
52
56
 
53
57
  .selectedAnswer .answerText {