@coorpacademy/components 11.9.2-alpha.1 → 11.9.2

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 (98) hide show
  1. package/es/atom/drag-and-drop/style.css +14 -9
  2. package/es/atom/image-upload/index.d.ts +6 -1
  3. package/es/atom/image-upload/index.d.ts.map +1 -1
  4. package/es/atom/image-upload/index.js +24 -4
  5. package/es/atom/image-upload/index.js.map +1 -1
  6. package/es/atom/image-upload/style.css +7 -0
  7. package/es/atom/review-presentation/index.d.ts.map +1 -1
  8. package/es/atom/review-presentation/index.js +62 -12
  9. package/es/atom/review-presentation/index.js.map +1 -1
  10. package/es/atom/review-presentation/style.css +67 -7
  11. package/es/atom/title/index.d.ts +1 -0
  12. package/es/atom/title/index.d.ts.map +1 -1
  13. package/es/atom/title/index.js +14 -5
  14. package/es/atom/title/index.js.map +1 -1
  15. package/es/atom/title/style.css +6 -0
  16. package/es/molecule/brand-form-group/index.d.ts +5 -0
  17. package/es/molecule/brand-form-group/index.d.ts.map +1 -1
  18. package/es/molecule/brand-form-group/index.js +4 -1
  19. package/es/molecule/brand-form-group/index.js.map +1 -1
  20. package/es/molecule/brand-form-group/style.css +9 -10
  21. package/es/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
  22. package/es/molecule/setup-slide/index.d.ts +2 -0
  23. package/es/molecule/setup-slider/index.d.ts +2 -0
  24. package/es/molecule/title-and-checkbox-wrapper/index.d.ts +3 -0
  25. package/es/organism/brand-form/index.d.ts +5 -0
  26. package/es/organism/rewards-form/index.d.ts +3 -0
  27. package/es/organism/wizard-contents/index.d.ts +8 -0
  28. package/es/template/activity/engine-stars.css +33 -16
  29. package/es/template/activity/engine-stars.d.ts +17 -15
  30. package/es/template/activity/engine-stars.d.ts.map +1 -1
  31. package/es/template/activity/engine-stars.js +115 -128
  32. package/es/template/activity/engine-stars.js.map +1 -1
  33. package/es/template/activity/index.d.ts +0 -1
  34. package/es/template/activity/index.d.ts.map +1 -1
  35. package/es/template/activity/index.js +9 -18
  36. package/es/template/activity/index.js.map +1 -1
  37. package/es/template/activity/progression-item.js +1 -1
  38. package/es/template/activity/progression-item.js.map +1 -1
  39. package/es/template/activity/stars-summary.d.ts +0 -1
  40. package/es/template/activity/stars-summary.d.ts.map +1 -1
  41. package/es/template/activity/stars-summary.js +5 -10
  42. package/es/template/activity/stars-summary.js.map +1 -1
  43. package/es/template/back-office/brand-update/index.d.ts +13 -0
  44. package/lib/atom/drag-and-drop/style.css +14 -9
  45. package/lib/atom/image-upload/index.d.ts +6 -1
  46. package/lib/atom/image-upload/index.d.ts.map +1 -1
  47. package/lib/atom/image-upload/index.js +25 -4
  48. package/lib/atom/image-upload/index.js.map +1 -1
  49. package/lib/atom/image-upload/style.css +7 -0
  50. package/lib/atom/review-presentation/index.d.ts.map +1 -1
  51. package/lib/atom/review-presentation/index.js +66 -13
  52. package/lib/atom/review-presentation/index.js.map +1 -1
  53. package/lib/atom/review-presentation/style.css +67 -7
  54. package/lib/atom/title/index.d.ts +1 -0
  55. package/lib/atom/title/index.d.ts.map +1 -1
  56. package/lib/atom/title/index.js +14 -5
  57. package/lib/atom/title/index.js.map +1 -1
  58. package/lib/atom/title/style.css +6 -0
  59. package/lib/molecule/brand-form-group/index.d.ts +5 -0
  60. package/lib/molecule/brand-form-group/index.d.ts.map +1 -1
  61. package/lib/molecule/brand-form-group/index.js +4 -1
  62. package/lib/molecule/brand-form-group/index.js.map +1 -1
  63. package/lib/molecule/brand-form-group/style.css +9 -10
  64. package/lib/molecule/drag-and-drop-wrapper/index.d.ts +2 -0
  65. package/lib/molecule/setup-slide/index.d.ts +2 -0
  66. package/lib/molecule/setup-slider/index.d.ts +2 -0
  67. package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +3 -0
  68. package/lib/organism/brand-form/index.d.ts +5 -0
  69. package/lib/organism/rewards-form/index.d.ts +3 -0
  70. package/lib/organism/wizard-contents/index.d.ts +8 -0
  71. package/lib/template/activity/engine-stars.css +33 -16
  72. package/lib/template/activity/engine-stars.d.ts +17 -15
  73. package/lib/template/activity/engine-stars.d.ts.map +1 -1
  74. package/lib/template/activity/engine-stars.js +116 -135
  75. package/lib/template/activity/engine-stars.js.map +1 -1
  76. package/lib/template/activity/index.d.ts +0 -1
  77. package/lib/template/activity/index.d.ts.map +1 -1
  78. package/lib/template/activity/index.js +9 -21
  79. package/lib/template/activity/index.js.map +1 -1
  80. package/lib/template/activity/progression-item.js +1 -1
  81. package/lib/template/activity/progression-item.js.map +1 -1
  82. package/lib/template/activity/stars-summary.d.ts +0 -1
  83. package/lib/template/activity/stars-summary.d.ts.map +1 -1
  84. package/lib/template/activity/stars-summary.js +5 -10
  85. package/lib/template/activity/stars-summary.js.map +1 -1
  86. package/lib/template/back-office/brand-update/index.d.ts +13 -0
  87. package/locales/en/global.json +0 -1
  88. package/package.json +3 -4
  89. package/es/atom/tooltip/index.d.ts +0 -22
  90. package/es/atom/tooltip/index.d.ts.map +0 -1
  91. package/es/atom/tooltip/index.js +0 -117
  92. package/es/atom/tooltip/index.js.map +0 -1
  93. package/es/atom/tooltip/style.css +0 -96
  94. package/lib/atom/tooltip/index.d.ts +0 -22
  95. package/lib/atom/tooltip/index.d.ts.map +0 -1
  96. package/lib/atom/tooltip/index.js +0 -137
  97. package/lib/atom/tooltip/index.js.map +0 -1
  98. package/lib/atom/tooltip/style.css +0 -96
@@ -1 +1 @@
1
- {"version":3,"file":"stars-summary.js","names":["EngineTab","engine","engineIndex","firstItemIndex","type","state","useMemo","dataName","style","hidden","active","propTypes","PropTypes","shape","EngineStars","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","GetSkinFromContext","setFirstItemIndex","useState","totalItems","length","dark","primary","scrollTo","useCallback","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n key={type}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <button\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n type=\"button\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </button>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars} tabIndex={0}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n tabIndex={0}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n tabIndex={0}\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.skin\n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F,CANF,eAcE;IACE,SAAS,EAAEK,qBAAA,CAAMuC,kBADnB;IAEE,KAAK,EAAE;MACLC,eAAe,EAAEf;IADZ;EAFT,gBAME;IAAK,SAAS,EAAEzB,qBAAA,CAAMyC;EAAtB,gBACE,2CAAOxB,KAAK,CAACyB,KAAb,CADF,eAEE;IAAG,aAAU;EAAb,GAA6BzB,KAAK,CAAC0B,KAAnC,CAFF,eAGE;IAAK,SAAS,EAAE3C,qBAAA,CAAM4C;EAAtB,gBACE,6BAAC,0CAAD;IAAU,SAAS,EAAE5C,qBAAA,CAAM6C,UAA3B;IAAuC,KAAK,EAAEpB;EAA9C,EADF,CAHF,CANF,eAaE;IAAK,SAAS,EAAEzB,qBAAA,CAAM8C;EAAtB,GAAuCf,aAAvC,CAbF,eAcE;IAAK,SAAS,EAAE/B,qBAAA,CAAM+C;EAAtB,GAAwCb,cAAxC,CAdF,CAdF,CADF,CADF;AAmCD,CApFD;;AAsFApB,YAAY,CAACX,SAAb,2CAAyB;EACvBc,KAAK,EAAEb,kBAAA,CAAUC,KAAV,CAAgB;IACrBqC,KAAK,EAAEtC,kBAAA,CAAU4C,MAAV,CAAiBC,UADH;IAErBN,KAAK,EAAEvC,kBAAA,CAAUG,MAAV,CAAiB0C;EAFH,CAAhB,EAGJA,UAJoB;EAKvBxC,OAAO,EAAEL,kBAAA,CAAUS,OAAV,CAAkBT,kBAAA,CAAUC,KAAV,CAAgBC,oBAAA,CAAYH,SAA5B,CAAlB,EAA0D8C;AAL5C,CAAzB;AAQAnC,YAAY,CAACoC,YAAb,GAA4B;EAC1BhC,IAAI,EAAEiC,iBAAA,CAASC,iBAAT,CAA2BlC;AADP,CAA5B;eAIeJ,Y"}
1
+ {"version":3,"file":"stars-summary.js","names":["EngineTab","engine","engineIndex","firstItemIndex","type","state","useMemo","dataName","style","hidden","active","propTypes","PropTypes","shape","EngineStars","number","EngineTabs","engines","convert","cap","index","arrayOf","StarsSummary","props","legacyContext","total","skin","GetSkinFromContext","setFirstItemIndex","useState","totalItems","length","dark","primary","scrollTo","useCallback","page","handleOnLeft","handleOnRight","leftArrowView","circle","left","rightArrowView","right","myStars","myStarsWrapper","allStars","footerSummaryStars","backgroundColor","totalStars","label","stars","iconBubble","iconHeader","navigationLeft","navigationRight","string","isRequired","contextTypes","Provider","childContextTypes"],"sources":["../../../src/template/activity/stars-summary.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, getOr, isEmpty, map} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowLeft as ArrowLeft,\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyStar as StarIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport EngineStars from './engine-stars';\nimport style from './stars-summary.css';\n\nconst EngineTab = ({engine, engineIndex, firstItemIndex}) => {\n const {type} = engine;\n const state = useMemo(\n () => (engineIndex < firstItemIndex ? 'hidden' : 'active'),\n [engineIndex, firstItemIndex]\n );\n const dataName = useMemo(() => `${type}_total_${state}`, [state, type]);\n\n return (\n <li className={style[state]} key={type} data-name={dataName}>\n <EngineStars\n {...engine}\n className={engineIndex < firstItemIndex ? style.hidden : style.active}\n />\n </li>\n );\n};\nEngineTab.propTypes = {\n engine: PropTypes.shape(EngineStars.propTypes),\n engineIndex: PropTypes.number,\n firstItemIndex: PropTypes.number\n};\n\nconst EngineTabs = ({engines, firstItemIndex}) => {\n return useMemo(\n () =>\n map.convert({cap: false})(\n (engine, index) => (\n <EngineTab\n engine={engine}\n key={`engineTab_${index}`}\n firstItemIndex={firstItemIndex}\n engineIndex={index}\n />\n ),\n engines\n ),\n [engines, firstItemIndex]\n );\n};\n\nEngineTabs.propTypes = {\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)),\n firstItemIndex: PropTypes.number\n};\n\nconst StarsSummary = (props, legacyContext) => {\n const {total, engines} = props;\n const skin = GetSkinFromContext(legacyContext);\n\n const [firstItemIndex, setFirstItemIndex] = useState(0);\n const [totalItems] = useState(engines.length);\n\n const dark = getOr('#90A4AE', 'common.dark', skin);\n const primary = get('common.primary', skin);\n\n const scrollTo = useCallback(page => setFirstItemIndex(page), []);\n\n const handleOnLeft = useCallback(() => {\n scrollTo(firstItemIndex - 1);\n }, [firstItemIndex, scrollTo]);\n\n const handleOnRight = useCallback(() => {\n scrollTo(firstItemIndex + 1);\n }, [firstItemIndex, scrollTo]);\n\n if (isEmpty(engines)) {\n return null;\n }\n\n const leftArrowView =\n totalItems > 6 && firstItemIndex > 0 ? (\n <div\n className={style.circle}\n onClick={handleOnLeft}\n data-name=\"left-arrow\"\n data-testid=\"stars-summary-left-arrow\"\n >\n <ArrowLeft color={dark} className={style.left} width={10} height={10} />\n </div>\n ) : null;\n\n const rightArrowView =\n totalItems > 6 && firstItemIndex < totalItems - 6 ? (\n <div\n className={style.circle}\n onClick={handleOnRight}\n data-name=\"right-arrow\"\n data-testid=\"stars-summary-right-arrow\"\n >\n <ArrowRight color={dark} className={style.right} width={10} height={10} />\n </div>\n ) : null;\n\n return (\n <div data-name=\"myStars\" className={style.myStars}>\n <div\n data-name=\"myStars-wrapper\"\n className={style.myStarsWrapper}\n data-testid={`stars-summary-engine-index-${firstItemIndex}`}\n >\n <ul\n className={style.allStars}\n data-name=\"engineList\"\n data-testid=\"stars-summary-engine-tabs\"\n >\n <EngineTabs engines={engines} firstItemIndex={firstItemIndex} />\n </ul>\n <div\n className={style.footerSummaryStars}\n style={{\n backgroundColor: primary\n }}\n >\n <div className={style.totalStars}>\n <span>{total.label}</span>\n <p data-name=\"star-counter\">{total.stars}</p>\n <div className={style.iconBubble}>\n <StarIcon className={style.iconHeader} color={primary} />\n </div>\n </div>\n <div className={style.navigationLeft}>{leftArrowView}</div>\n <div className={style.navigationRight}>{rightArrowView}</div>\n </div>\n </div>\n </div>\n );\n};\n\nStarsSummary.propTypes = {\n total: PropTypes.shape({\n label: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired\n }).isRequired,\n engines: PropTypes.arrayOf(PropTypes.shape(EngineStars.propTypes)).isRequired\n};\n\nStarsSummary.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default StarsSummary;\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,SAAS,GAAG,CAAC;EAACC,MAAD;EAASC,WAAT;EAAsBC;AAAtB,CAAD,KAA2C;EAC3D,MAAM;IAACC;EAAD,IAASH,MAAf;EACA,MAAMI,KAAK,GAAG,IAAAC,cAAA,EACZ,MAAOJ,WAAW,GAAGC,cAAd,GAA+B,QAA/B,GAA0C,QADrC,EAEZ,CAACD,WAAD,EAAcC,cAAd,CAFY,CAAd;EAIA,MAAMI,QAAQ,GAAG,IAAAD,cAAA,EAAQ,MAAO,GAAEF,IAAK,UAASC,KAAM,EAArC,EAAwC,CAACA,KAAD,EAAQD,IAAR,CAAxC,CAAjB;EAEA,oBACE;IAAI,SAAS,EAAEI,qBAAA,CAAMH,KAAN,CAAf;IAA6B,GAAG,EAAED,IAAlC;IAAwC,aAAWG;EAAnD,gBACE,6BAAC,oBAAD,eACMN,MADN;IAEE,SAAS,EAAEC,WAAW,GAAGC,cAAd,GAA+BK,qBAAA,CAAMC,MAArC,GAA8CD,qBAAA,CAAME;EAFjE,GADF,CADF;AAQD,CAhBD;;AAiBAV,SAAS,CAACW,SAAV,2CAAsB;EACpBV,MAAM,EAAEW,kBAAA,CAAUC,KAAV,CAAgBC,oBAAA,CAAYH,SAA5B,CADY;EAEpBT,WAAW,EAAEU,kBAAA,CAAUG,MAFH;EAGpBZ,cAAc,EAAES,kBAAA,CAAUG;AAHN,CAAtB;;AAMA,MAAMC,UAAU,GAAG,CAAC;EAACC,OAAD;EAAUd;AAAV,CAAD,KAA+B;EAChD,OAAO,IAAAG,cAAA,EACL,MACE,cAAIY,OAAJ,CAAY;IAACC,GAAG,EAAE;EAAN,CAAZ,EAC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AYE;IACE,SAAS,EAAEK,qBAAA,CAAMuC,kBADnB;IAEE,KAAK,EAAE;MACLC,eAAe,EAAEf;IADZ;EAFT,gBAME;IAAK,SAAS,EAAEzB,qBAAA,CAAMyC;EAAtB,gBACE,2CAAOxB,KAAK,CAACyB,KAAb,CADF,eAEE;IAAG,aAAU;EAAb,GAA6BzB,KAAK,CAAC0B,KAAnC,CAFF,eAGE;IAAK,SAAS,EAAE3C,qBAAA,CAAM4C;EAAtB,gBACE,6BAAC,0CAAD;IAAU,SAAS,EAAE5C,qBAAA,CAAM6C,UAA3B;IAAuC,KAAK,EAAEpB;EAA9C,EADF,CAHF,CANF,eAaE;IAAK,SAAS,EAAEzB,qBAAA,CAAM8C;EAAtB,GAAuCf,aAAvC,CAbF,eAcE;IAAK,SAAS,EAAE/B,qBAAA,CAAM+C;EAAtB,GAAwCb,cAAxC,CAdF,CAZF,CADF,CADF;AAiCD,CAjFD;;AAmFApB,YAAY,CAACX,SAAb,2CAAyB;EACvBc,KAAK,EAAEb,kBAAA,CAAUC,KAAV,CAAgB;IACrBqC,KAAK,EAAEtC,kBAAA,CAAU4C,MAAV,CAAiBC,UADH;IAErBN,KAAK,EAAEvC,kBAAA,CAAUG,MAAV,CAAiB0C;EAFH,CAAhB,EAGJA,UAJoB;EAKvBxC,OAAO,EAAEL,kBAAA,CAAUS,OAAV,CAAkBT,kBAAA,CAAUC,KAAV,CAAgBC,oBAAA,CAAYH,SAA5B,CAAlB,EAA0D8C;AAL5C,CAAzB;AAQAnC,YAAY,CAACoC,YAAb,GAA4B;EAC1BhC,IAAI,EAAEiC,iBAAA,CAASC,iBAAT,CAA2BlC;AADP,CAA5B;eAIeJ,Y"}
@@ -136,6 +136,7 @@ declare namespace BrandUpdate {
136
136
  groups: PropTypes.Validator<(PropTypes.InferProps<{
137
137
  title: PropTypes.Requireable<string>;
138
138
  subtitle: PropTypes.Requireable<string>;
139
+ subtitleSize: PropTypes.Requireable<string>;
139
140
  fieldsLayout: PropTypes.Requireable<string>;
140
141
  groupLayout: PropTypes.Requireable<string>;
141
142
  fields: PropTypes.Requireable<(NonNullable<PropTypes.InferProps<{
@@ -261,6 +262,8 @@ declare namespace BrandUpdate {
261
262
  error: PropTypes.Requireable<string>;
262
263
  buttonAriaLabel: PropTypes.Requireable<string>;
263
264
  errorButtonLabel: PropTypes.Requireable<string>;
265
+ labelLink: PropTypes.Requireable<string>;
266
+ hrefLink: PropTypes.Requireable<string>;
264
267
  title: PropTypes.Requireable<string>;
265
268
  description: PropTypes.Requireable<string>;
266
269
  uploadLabel: PropTypes.Requireable<string>;
@@ -374,6 +377,8 @@ declare namespace BrandUpdate {
374
377
  error: PropTypes.Requireable<string>;
375
378
  buttonAriaLabel: PropTypes.Requireable<string>;
376
379
  errorButtonLabel: PropTypes.Requireable<string>;
380
+ labelLink: PropTypes.Requireable<string>;
381
+ hrefLink: PropTypes.Requireable<string>;
377
382
  title: PropTypes.Requireable<string>;
378
383
  description: PropTypes.Requireable<string>;
379
384
  uploadLabel: PropTypes.Requireable<string>;
@@ -777,6 +782,7 @@ declare namespace BrandUpdate {
777
782
  groups: PropTypes.Validator<(PropTypes.InferProps<{
778
783
  title: PropTypes.Requireable<string>;
779
784
  subtitle: PropTypes.Requireable<string>;
785
+ subtitleSize: PropTypes.Requireable<string>;
780
786
  fieldsLayout: PropTypes.Requireable<string>;
781
787
  groupLayout: PropTypes.Requireable<string>;
782
788
  fields: PropTypes.Requireable<(NonNullable<PropTypes.InferProps<{
@@ -902,6 +908,8 @@ declare namespace BrandUpdate {
902
908
  error: PropTypes.Requireable<string>;
903
909
  buttonAriaLabel: PropTypes.Requireable<string>;
904
910
  errorButtonLabel: PropTypes.Requireable<string>;
911
+ labelLink: PropTypes.Requireable<string>;
912
+ hrefLink: PropTypes.Requireable<string>;
905
913
  title: PropTypes.Requireable<string>;
906
914
  description: PropTypes.Requireable<string>;
907
915
  uploadLabel: PropTypes.Requireable<string>;
@@ -1015,6 +1023,8 @@ declare namespace BrandUpdate {
1015
1023
  error: PropTypes.Requireable<string>;
1016
1024
  buttonAriaLabel: PropTypes.Requireable<string>;
1017
1025
  errorButtonLabel: PropTypes.Requireable<string>;
1026
+ labelLink: PropTypes.Requireable<string>;
1027
+ hrefLink: PropTypes.Requireable<string>;
1018
1028
  title: PropTypes.Requireable<string>;
1019
1029
  description: PropTypes.Requireable<string>;
1020
1030
  uploadLabel: PropTypes.Requireable<string>;
@@ -1366,6 +1376,7 @@ declare namespace BrandUpdate {
1366
1376
  subtitle: PropTypes.Requireable<string>;
1367
1377
  type: PropTypes.Requireable<string>;
1368
1378
  'data-name': PropTypes.Requireable<string>;
1379
+ subtitleSize: PropTypes.Requireable<string>;
1369
1380
  }>>;
1370
1381
  child: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
1371
1382
  childType: PropTypes.Requireable<string>;
@@ -1400,6 +1411,8 @@ declare namespace BrandUpdate {
1400
1411
  error: PropTypes.Requireable<string>;
1401
1412
  buttonAriaLabel: PropTypes.Requireable<string>;
1402
1413
  errorButtonLabel: PropTypes.Requireable<string>;
1414
+ labelLink: PropTypes.Requireable<string>;
1415
+ hrefLink: PropTypes.Requireable<string>;
1403
1416
  title: PropTypes.Requireable<string>;
1404
1417
  description: PropTypes.Requireable<string>;
1405
1418
  uploadLabel: PropTypes.Requireable<string>;
@@ -38,7 +38,6 @@
38
38
  "payment_form_submit": "Start Coorpacademy subscription",
39
39
  "Post": "Post",
40
40
  "premium_unsubscribe_confirmation": "We confirm the cancelling of your subscription which will be effective starting from next month.\n\nIn the meantime, you can continue to enjoy our content on the Coorpacademy platform.",
41
- "Press the escape key to close the information text": "Press the escape key to close the information text",
42
41
  "product_cancel": "Cancel at any time.",
43
42
  "product_desc_battle": "Battle mode",
44
43
  "product_desc_certificates": "Coorpacademy certificates",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/components",
3
- "version": "11.9.2-alpha.1+921b4b1d4",
3
+ "version": "11.9.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -78,8 +78,7 @@
78
78
  "qs": "6.11.0",
79
79
  "react-autosuggest": "^10.0.2",
80
80
  "react-dropzone": "^9.0.0",
81
- "react-tooltip": "4.5.1",
82
- "uuid": "^9.0.0"
81
+ "react-tooltip": "^4.2.6"
83
82
  },
84
83
  "peerDependencies": {
85
84
  "react": "^17.0.2"
@@ -161,5 +160,5 @@
161
160
  "last 2 versions",
162
161
  "IE 11"
163
162
  ],
164
- "gitHead": "921b4b1d42abb1c57a2f70cea9aee082ee88e026"
163
+ "gitHead": "c2299f0e863e36f772dcec1128c4afe0ccb00be5"
165
164
  }
@@ -1,22 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
@@ -1,117 +0,0 @@
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
@@ -1 +0,0 @@
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,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC;AAJsB,CAAD,KAKjB;EACJ,IAAI,CAACH,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,oBAAC,YAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEH,KAAK,CAACM,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYF;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAEL,KAAK,CAACO,OADnB;MAEE,eAAY,SAFd;MAGE,cAAYH;IAHd,GAKGC,OALH,CADF;EASD;AACF,CA/BD;;AAiCAJ,cAAc,CAACO,SAAf,2CAA2B;EACzBN,gBAAgB,EAAEP,SAAS,CAACc,IADH;EAEzBN,QAAQ,EAAER,SAAS,CAACe,MAFK;EAGzBN,oCAAoC,EAAET,SAAS,CAACe,MAAV,CAAiBC,UAH9B;EAIzBN,OAAO,EAAEV,SAAS,CAACi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;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"}
@@ -1,96 +0,0 @@
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,22 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AA+CO,iGASN;;AAED;;;;;;;gBA2EC"}
@@ -1,137 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.toggleStateOnKeyPress = exports.default = void 0;
5
-
6
- var _react = _interopRequireWildcard(require("react"));
7
-
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
-
10
- var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
11
-
12
- var _isString = _interopRequireDefault(require("lodash/fp/isString"));
13
-
14
- var _novaIcons = require("@coorpacademy/nova-icons");
15
-
16
- var _style = _interopRequireDefault(require("./style.css"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
- const ToolTipWrapper = ({
25
- toolTipIsVisible,
26
- anchorId,
27
- closeToolTipInformationTextAriaLabel,
28
- content
29
- }) => {
30
- if (!toolTipIsVisible) return null;
31
-
32
- if (anchorId) {
33
- return /*#__PURE__*/_react.default.createElement(_reactTooltip.default, {
34
- id: anchorId,
35
- className: _style.default.toolTipReact,
36
- "data-event-off": "click",
37
- place: "left",
38
- effect: "solid",
39
- "aria-label": closeToolTipInformationTextAriaLabel
40
- }, content);
41
- } else {
42
- return /*#__PURE__*/_react.default.createElement("div", {
43
- className: _style.default.toolTip,
44
- "data-testid": "tooltip",
45
- "aria-label": closeToolTipInformationTextAriaLabel
46
- }, content);
47
- }
48
- };
49
-
50
- ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
51
- toolTipIsVisible: _propTypes.default.bool,
52
- anchorId: _propTypes.default.string,
53
- closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
54
- content: _propTypes.default.node
55
- } : {};
56
-
57
- const toggleStateOnKeyPress = (state, setState, ref) => event => {
58
- if (event.key === 'Enter') {
59
- if (ref) ref.current.focus();
60
- event.stopPropagation();
61
- event.preventDefault();
62
- setState(!state);
63
- } else if (event.key === 'Tab' || event.key === 'Escape') {
64
- setState(false);
65
- }
66
- };
67
-
68
- exports.toggleStateOnKeyPress = toggleStateOnKeyPress;
69
-
70
- const ToolTip = ({
71
- anchorId,
72
- TooltipContent,
73
- 'aria-label': ariaLabel,
74
- 'data-testid': dataTestId,
75
- closeToolTipInformationTextAriaLabel,
76
- toolTipIsVisible: _toolTipIsVisible
77
- }) => {
78
- const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
79
- const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
80
- const handleKeyPress = (0, _react.useCallback)(event => {
81
- toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);
82
- }, [toolTipIsVisible]);
83
- const handleMouseOver = (0, _react.useCallback)(() => {
84
- setToolTipIsVisible(true);
85
- }, []);
86
- const handleMouseLeave = (0, _react.useCallback)(() => {
87
- setToolTipIsVisible(false);
88
- }, []);
89
- const content = (0, _react.useMemo)(() => {
90
- return isComponent ? /*#__PURE__*/_react.default.createElement(TooltipContent, null) : /*#__PURE__*/_react.default.createElement("p", {
91
- className: _style.default.tooltipContent
92
- }, TooltipContent);
93
- }, [TooltipContent, isComponent]);
94
- return anchorId ? /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
95
- toolTipIsVisible: _toolTipIsVisible,
96
- anchorId: anchorId,
97
- closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
98
- content: content,
99
- onMouseLeave: handleMouseLeave,
100
- onMouseOver: handleMouseOver
101
- }) : /*#__PURE__*/_react.default.createElement("div", {
102
- className: _style.default.tooltipContainer,
103
- onMouseLeave: handleMouseLeave,
104
- onMouseOver: handleMouseOver
105
- }, /*#__PURE__*/_react.default.createElement("button", {
106
- type: "button",
107
- className: _style.default.tooltipIconContainer,
108
- "data-testid": dataTestId,
109
- onKeyDown: handleKeyPress,
110
- tabIndex: 0
111
- }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
112
- className: _style.default.informationIcon,
113
- width: 12,
114
- height: 12,
115
- "aria-label": ariaLabel
116
- })), /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
117
- toolTipIsVisible: toolTipIsVisible,
118
- anchorId: anchorId,
119
- closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
120
- content: content
121
- }));
122
- };
123
-
124
- ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
125
- TooltipContent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node, _propTypes.default.string]),
126
- 'data-testid': _propTypes.default.string,
127
- 'aria-label': _propTypes.default.string,
128
- closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
129
- // ---------- externalHandling --------------
130
- // if passed down, React Tooltip is used instead, due to limitations on
131
- // parents overflow hidden controls
132
- anchorId: _propTypes.default.string,
133
- toolTipIsVisible: _propTypes.default.bool
134
- } : {};
135
- var _default = ToolTip;
136
- exports.default = _default;
137
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","style","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","handleKeyPress","useCallback","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;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFs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