@coorpacademy/components 11.32.48-testCLXP-193.75 → 11.32.49

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 (191) hide show
  1. package/es/atom/button-link/index.d.ts +2 -0
  2. package/es/atom/button-link/index.d.ts.map +1 -1
  3. package/es/atom/button-link/index.js +26 -4
  4. package/es/atom/button-link/index.js.map +1 -1
  5. package/es/atom/button-link/style.css +14 -0
  6. package/es/atom/button-link/types.d.ts +4 -0
  7. package/es/atom/button-link/types.d.ts.map +1 -1
  8. package/es/atom/button-link/types.js +2 -0
  9. package/es/atom/button-link/types.js.map +1 -1
  10. package/es/atom/input-switch/style.css +1 -9
  11. package/es/molecule/banner/index.d.ts +4 -5
  12. package/es/molecule/banner/index.d.ts.map +1 -1
  13. package/es/molecule/banner/index.js +37 -93
  14. package/es/molecule/banner/index.js.map +1 -1
  15. package/es/molecule/banner/style.css +5 -27
  16. package/es/molecule/base-modal/index.d.ts +1 -0
  17. package/es/molecule/base-modal/index.d.ts.map +1 -1
  18. package/es/molecule/base-modal/index.js +52 -4
  19. package/es/molecule/base-modal/index.js.map +1 -1
  20. package/es/molecule/base-modal/style.css +7 -0
  21. package/es/molecule/cm-popin/types.d.ts +4 -0
  22. package/es/molecule/cm-popin/types.d.ts.map +1 -1
  23. package/es/molecule/expandible-actionable-table/index.d.ts +2 -0
  24. package/es/molecule/expandible-actionable-table/index.d.ts.map +1 -1
  25. package/es/molecule/expandible-actionable-table/types.d.ts +2 -0
  26. package/es/molecule/expandible-actionable-table/types.d.ts.map +1 -1
  27. package/es/molecule/progress-wrapper/style.css +2 -10
  28. package/es/molecule/skill-picker-modal/index.d.ts.map +1 -1
  29. package/es/molecule/skill-picker-modal/index.js +3 -1
  30. package/es/molecule/skill-picker-modal/index.js.map +1 -1
  31. package/es/molecule/translation-modal/index.d.ts +85 -0
  32. package/es/molecule/translation-modal/index.d.ts.map +1 -0
  33. package/es/molecule/translation-modal/index.js +149 -0
  34. package/es/molecule/translation-modal/index.js.map +1 -0
  35. package/es/molecule/translation-modal/style.css +45 -0
  36. package/es/organism/list-items/index.d.ts +4 -0
  37. package/es/organism/setup-header/index.d.ts +8 -0
  38. package/es/organism/wizard-contents/index.d.ts +6 -0
  39. package/es/template/app-player/loading/index.d.ts +4 -0
  40. package/es/template/app-player/player/index.d.ts +8 -0
  41. package/es/template/app-player/player/slides/index.d.ts +4 -0
  42. package/es/template/app-player/player/slides/index.d.ts.map +1 -1
  43. package/es/template/app-player/popin-correction/index.d.ts +4 -0
  44. package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
  45. package/es/template/app-player/popin-end/index.d.ts +4 -0
  46. package/es/template/app-review/index.d.ts +4 -0
  47. package/es/template/app-review/index.d.ts.map +1 -1
  48. package/es/template/app-review/player/prop-types.d.ts +4 -0
  49. package/es/template/app-review/player/prop-types.d.ts.map +1 -1
  50. package/es/template/app-review/prop-types.d.ts +4 -0
  51. package/es/template/app-review/prop-types.d.ts.map +1 -1
  52. package/es/template/back-office/brand-create/index.d.ts +8 -0
  53. package/es/template/back-office/brand-create/index.d.ts.map +1 -1
  54. package/es/template/back-office/brand-list/index.d.ts +8 -0
  55. package/es/template/back-office/brand-list/index.d.ts.map +1 -1
  56. package/es/template/back-office/brand-update/index.d.ts +26 -5
  57. package/es/template/back-office/dashboard-preview/index.d.ts +8 -0
  58. package/es/template/back-office/layout/index.d.ts +8 -0
  59. package/es/template/back-office/layout/index.d.ts.map +1 -1
  60. package/es/template/certification-detail/index.js +2 -2
  61. package/es/template/certification-detail/index.js.map +1 -1
  62. package/es/template/common/dashboard/index.d.ts +8 -0
  63. package/es/template/common/search-page/index.d.ts +4 -0
  64. package/es/template/external-course/index.d.ts +4 -0
  65. package/es/template/playlist-detail/index.d.ts +0 -1
  66. package/es/template/playlist-detail/index.d.ts.map +1 -1
  67. package/es/template/playlist-detail/index.js +3 -6
  68. package/es/template/playlist-detail/index.js.map +1 -1
  69. package/es/template/skill-detail/all-courses.css +0 -4
  70. package/es/template/skill-detail/all-courses.d.ts +0 -1
  71. package/es/template/skill-detail/all-courses.d.ts.map +1 -1
  72. package/es/template/skill-detail/all-courses.js +2 -15
  73. package/es/template/skill-detail/all-courses.js.map +1 -1
  74. package/es/template/skill-detail/index.d.ts +0 -1
  75. package/es/template/skill-detail/index.d.ts.map +1 -1
  76. package/es/template/skill-detail/index.js +3 -6
  77. package/es/template/skill-detail/index.js.map +1 -1
  78. package/es/variables/colors.d.ts +0 -3
  79. package/es/variables/colors.d.ts.map +1 -1
  80. package/es/variables/colors.js +0 -3
  81. package/es/variables/colors.js.map +1 -1
  82. package/lib/atom/button-link/index.d.ts +2 -0
  83. package/lib/atom/button-link/index.d.ts.map +1 -1
  84. package/lib/atom/button-link/index.js +27 -4
  85. package/lib/atom/button-link/index.js.map +1 -1
  86. package/lib/atom/button-link/style.css +14 -0
  87. package/lib/atom/button-link/types.d.ts +4 -0
  88. package/lib/atom/button-link/types.d.ts.map +1 -1
  89. package/lib/atom/button-link/types.js +2 -0
  90. package/lib/atom/button-link/types.js.map +1 -1
  91. package/lib/atom/input-switch/style.css +1 -9
  92. package/lib/molecule/banner/index.d.ts +4 -5
  93. package/lib/molecule/banner/index.d.ts.map +1 -1
  94. package/lib/molecule/banner/index.js +38 -105
  95. package/lib/molecule/banner/index.js.map +1 -1
  96. package/lib/molecule/banner/style.css +5 -27
  97. package/lib/molecule/base-modal/index.d.ts +1 -0
  98. package/lib/molecule/base-modal/index.d.ts.map +1 -1
  99. package/lib/molecule/base-modal/index.js +50 -3
  100. package/lib/molecule/base-modal/index.js.map +1 -1
  101. package/lib/molecule/base-modal/style.css +7 -0
  102. package/lib/molecule/cm-popin/types.d.ts +4 -0
  103. package/lib/molecule/cm-popin/types.d.ts.map +1 -1
  104. package/lib/molecule/expandible-actionable-table/index.d.ts +2 -0
  105. package/lib/molecule/expandible-actionable-table/index.d.ts.map +1 -1
  106. package/lib/molecule/expandible-actionable-table/types.d.ts +2 -0
  107. package/lib/molecule/expandible-actionable-table/types.d.ts.map +1 -1
  108. package/lib/molecule/progress-wrapper/style.css +2 -10
  109. package/lib/molecule/skill-picker-modal/index.d.ts.map +1 -1
  110. package/lib/molecule/skill-picker-modal/index.js +3 -1
  111. package/lib/molecule/skill-picker-modal/index.js.map +1 -1
  112. package/lib/molecule/translation-modal/index.d.ts +85 -0
  113. package/lib/molecule/translation-modal/index.d.ts.map +1 -0
  114. package/lib/molecule/translation-modal/index.js +168 -0
  115. package/lib/molecule/translation-modal/index.js.map +1 -0
  116. package/lib/molecule/translation-modal/style.css +45 -0
  117. package/lib/organism/list-items/index.d.ts +4 -0
  118. package/lib/organism/setup-header/index.d.ts +8 -0
  119. package/lib/organism/wizard-contents/index.d.ts +6 -0
  120. package/lib/template/app-player/loading/index.d.ts +4 -0
  121. package/lib/template/app-player/player/index.d.ts +8 -0
  122. package/lib/template/app-player/player/slides/index.d.ts +4 -0
  123. package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
  124. package/lib/template/app-player/popin-correction/index.d.ts +4 -0
  125. package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
  126. package/lib/template/app-player/popin-end/index.d.ts +4 -0
  127. package/lib/template/app-review/index.d.ts +4 -0
  128. package/lib/template/app-review/index.d.ts.map +1 -1
  129. package/lib/template/app-review/player/prop-types.d.ts +4 -0
  130. package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
  131. package/lib/template/app-review/prop-types.d.ts +4 -0
  132. package/lib/template/app-review/prop-types.d.ts.map +1 -1
  133. package/lib/template/back-office/brand-create/index.d.ts +8 -0
  134. package/lib/template/back-office/brand-create/index.d.ts.map +1 -1
  135. package/lib/template/back-office/brand-list/index.d.ts +8 -0
  136. package/lib/template/back-office/brand-list/index.d.ts.map +1 -1
  137. package/lib/template/back-office/brand-update/index.d.ts +26 -5
  138. package/lib/template/back-office/dashboard-preview/index.d.ts +8 -0
  139. package/lib/template/back-office/layout/index.d.ts +8 -0
  140. package/lib/template/back-office/layout/index.d.ts.map +1 -1
  141. package/lib/template/certification-detail/index.js +2 -2
  142. package/lib/template/certification-detail/index.js.map +1 -1
  143. package/lib/template/common/dashboard/index.d.ts +8 -0
  144. package/lib/template/common/search-page/index.d.ts +4 -0
  145. package/lib/template/external-course/index.d.ts +4 -0
  146. package/lib/template/playlist-detail/index.d.ts +0 -1
  147. package/lib/template/playlist-detail/index.d.ts.map +1 -1
  148. package/lib/template/playlist-detail/index.js +3 -6
  149. package/lib/template/playlist-detail/index.js.map +1 -1
  150. package/lib/template/skill-detail/all-courses.css +0 -4
  151. package/lib/template/skill-detail/all-courses.d.ts +0 -1
  152. package/lib/template/skill-detail/all-courses.d.ts.map +1 -1
  153. package/lib/template/skill-detail/all-courses.js +2 -16
  154. package/lib/template/skill-detail/all-courses.js.map +1 -1
  155. package/lib/template/skill-detail/index.d.ts +0 -1
  156. package/lib/template/skill-detail/index.d.ts.map +1 -1
  157. package/lib/template/skill-detail/index.js +3 -6
  158. package/lib/template/skill-detail/index.js.map +1 -1
  159. package/lib/variables/colors.d.ts +0 -3
  160. package/lib/variables/colors.d.ts.map +1 -1
  161. package/lib/variables/colors.js +0 -3
  162. package/lib/variables/colors.js.map +1 -1
  163. package/locales/bs/global.json +2 -0
  164. package/locales/cs/global.json +2 -0
  165. package/locales/de/global.json +2 -0
  166. package/locales/en/global.json +2 -2
  167. package/locales/es/global.json +2 -0
  168. package/locales/et/global.json +2 -0
  169. package/locales/fi/global.json +2 -0
  170. package/locales/fr/global.json +2 -0
  171. package/locales/hr/global.json +2 -0
  172. package/locales/hu/global.json +2 -0
  173. package/locales/hy/global.json +2 -0
  174. package/locales/it/global.json +2 -0
  175. package/locales/ja/global.json +2 -0
  176. package/locales/ko/global.json +2 -0
  177. package/locales/nl/global.json +2 -0
  178. package/locales/pl/global.json +2 -0
  179. package/locales/pt/global.json +2 -0
  180. package/locales/ro/global.json +2 -0
  181. package/locales/ru/global.json +2 -0
  182. package/locales/sk/global.json +2 -0
  183. package/locales/sl/global.json +2 -0
  184. package/locales/sv/global.json +2 -0
  185. package/locales/tl/global.json +2 -0
  186. package/locales/tr/global.json +2 -0
  187. package/locales/uk/global.json +2 -0
  188. package/locales/vi/global.json +2 -0
  189. package/locales/zh/global.json +2 -0
  190. package/locales/zh_TW/global.json +2 -0
  191. package/package.json +2 -2
@@ -1,9 +1,10 @@
1
+ import _debounce from "lodash/fp/debounce";
1
2
  import _get from "lodash/fp/get";
2
3
  import _isEmpty from "lodash/fp/isEmpty";
3
4
 
4
5
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
 
6
- import React, { useCallback } from 'react';
7
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
7
8
  import PropTypes from 'prop-types';
8
9
  import { convert } from 'css-color-function';
9
10
  import Provider from '../../atom/provider';
@@ -20,11 +21,56 @@ const BaseModal = (props, context) => {
20
21
  isOpen,
21
22
  footer,
22
23
  onClose,
23
- onScroll
24
+ onScroll,
25
+ detectScrollbar = false
24
26
  } = props;
25
27
  const {
26
28
  skin
27
29
  } = context;
30
+ const bodyRef = useRef(null);
31
+ const [isScrollbarVisible, setIsScrollbarVisible] = useState(!detectScrollbar);
32
+
33
+ const checkScrollbar = () => {
34
+ const bodyElement = bodyRef.current;
35
+
36
+ if (bodyElement) {
37
+ setIsScrollbarVisible(bodyElement.scrollHeight > bodyElement.clientHeight);
38
+ }
39
+ };
40
+
41
+ useEffect(() => {
42
+ if (!detectScrollbar) return;
43
+ const bodyElement = bodyRef.current;
44
+ if (!bodyElement) return;
45
+
46
+ const debouncedCheckScrollbar = _debounce(100, () => {
47
+ checkScrollbar();
48
+ }); // Observer of the body content
49
+
50
+
51
+ const mutationObserver = new MutationObserver(() => {
52
+ debouncedCheckScrollbar();
53
+ });
54
+ mutationObserver.observe(bodyElement, {
55
+ childList: true,
56
+ subtree: true
57
+ }); // Observer of the body size
58
+
59
+ const resizeObserver = new ResizeObserver(() => {
60
+ debouncedCheckScrollbar();
61
+ });
62
+
63
+ if (bodyRef.current) {
64
+ resizeObserver.observe(bodyRef.current);
65
+ }
66
+
67
+ checkScrollbar();
68
+ return () => {
69
+ mutationObserver.disconnect();
70
+ resizeObserver.disconnect();
71
+ debouncedCheckScrollbar.cancel();
72
+ };
73
+ }, [children, detectScrollbar]);
28
74
  const Footer = useCallback(() => {
29
75
  if (_isEmpty(footer)) return null;
30
76
  if (typeof footer === 'function') return footer();
@@ -124,7 +170,8 @@ const BaseModal = (props, context) => {
124
170
  wrapperSize: 28
125
171
  }
126
172
  }))), /*#__PURE__*/React.createElement("div", {
127
- className: style.body,
173
+ ref: bodyRef,
174
+ className: isScrollbarVisible ? style.body : style.bodyWithoutScrollbar,
128
175
  onScroll: onScroll,
129
176
  "data-testid": "modal-body"
130
177
  }, children), /*#__PURE__*/React.createElement(Footer, null)));
@@ -160,7 +207,8 @@ BaseModal.propTypes = process.env.NODE_ENV !== "production" ? {
160
207
  })
161
208
  })]),
162
209
  onClose: PropTypes.func,
163
- onScroll: PropTypes.func
210
+ onScroll: PropTypes.func,
211
+ detectScrollbar: PropTypes.bool
164
212
  } : {};
165
213
  export default BaseModal;
166
214
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","PropTypes","convert","Provider","Icon","ButtonLink","style","BaseModal","props","context","title","description","headerIcon","children","isOpen","footer","onClose","onScroll","skin","Footer","cancelButton","confirmButton","text","isError","label","cancelLabel","onCancel","disabled","cancelDisabled","confirmLabel","onConfirm","confirmDisabled","iconName","color","buttonConfirmColor","footerCTAWrapper","className","footerCancelButton","type","onClick","customStyle","backgroundColor","hoverBackgroundColor","hoverColor","footerConfirmButton","icon","position","faIcon","name","size","footerDescription","footerDescriptionError","handleOnClose","e","stopPropagation","modalWrapper","modal","header","faSize","wrapperSize","headerContent","headerTitle","headerDescription","headerCloseIcon","body","contextTypes","childContextTypes","propTypes","string","shape","node","bool","oneOfType","func","boolean"],"sources":["../../../src/molecule/base-modal/index.js"],"sourcesContent":["import React, {useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, get} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../atom/provider';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst BaseModal = (props, context) => {\n const {title, description, headerIcon, children, isOpen, footer, onClose, onScroll} = props;\n const {skin} = context;\n\n const Footer = useCallback(() => {\n if (isEmpty(footer)) return null;\n if (typeof footer === 'function') return footer();\n\n const {cancelButton, confirmButton, text, isError} = footer;\n const {label: cancelLabel, onCancel, disabled: cancelDisabled} = cancelButton || {};\n const {\n label: confirmLabel,\n onConfirm,\n disabled: confirmDisabled,\n iconName,\n color\n } = confirmButton || {};\n const buttonConfirmColor = color || get('common.primary', skin);\n\n return (\n <div className={style.footer}>\n <div className={style.footerCTAWrapper}>\n {onCancel && cancelLabel ? (\n <ButtonLink\n {...{\n className: style.footerCancelButton,\n type: 'secondary',\n onClick: onCancel,\n label: cancelLabel,\n disabled: cancelDisabled\n }}\n />\n ) : null}\n {onConfirm && confirmLabel ? (\n <div>\n <ButtonLink\n {...{\n customStyle: {backgroundColor: buttonConfirmColor},\n hoverBackgroundColor: convert(\n `hsl(from ${buttonConfirmColor} h s calc(l*(1 - 0.08)))`\n ),\n hoverColor: '#FFFFFF',\n className: style.footerConfirmButton,\n type: 'primary',\n onClick: onConfirm,\n label: confirmLabel,\n disabled: confirmDisabled,\n ...(iconName\n ? {\n icon: {\n position: 'left',\n faIcon: {\n name: iconName,\n color: '#FFFFFF',\n size: 16\n }\n }\n }\n : {})\n }}\n />\n </div>\n ) : null}\n </div>\n {text ? (\n <div\n className={`${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`}\n >\n {text}\n </div>\n ) : null}\n </div>\n );\n }, [footer, skin]);\n\n if (!isOpen || !title || !children) return null;\n\n function handleOnClose(e) {\n e?.stopPropagation();\n onClose();\n }\n\n return (\n <div className={style.modalWrapper}>\n <div className={style.modal}>\n <header className={style.header}>\n {headerIcon?.name ? (\n <div className={style.headerIcon}>\n <Icon\n iconName={headerIcon.name}\n iconColor={headerIcon.color}\n backgroundColor={headerIcon.backgroundColor}\n size={{faSize: 20, wrapperSize: 48}}\n />\n </div>\n ) : null}\n <div className={style.headerContent}>\n <div className={style.headerTitle}>{title}</div>\n {description ? <div className={style.headerDescription}>{description}</div> : null}\n </div>\n <div className={style.headerCloseIcon} onClick={handleOnClose} data-testid=\"close-icon\">\n <Icon iconName=\"close\" backgroundColor=\"#F4F4F5\" size={{faSize: 14, wrapperSize: 28}} />\n </div>\n </header>\n <div className={style.body} onScroll={onScroll} data-testid=\"modal-body\">\n {children}\n </div>\n <Footer />\n </div>\n </div>\n );\n};\n\nBaseModal.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBaseModal.propTypes = {\n title: PropTypes.string,\n headerIcon: PropTypes.shape({\n name: PropTypes.string,\n color: PropTypes.string,\n backgroundColor: PropTypes.string\n }),\n description: PropTypes.string,\n children: PropTypes.node,\n isOpen: PropTypes.bool,\n footer: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n text: PropTypes.string,\n isError: PropTypes.boolean,\n cancelButton: PropTypes.shape({\n label: PropTypes.string,\n onCancel: PropTypes.func,\n disabled: PropTypes.bool\n }),\n confirmButton: PropTypes.shape({\n label: PropTypes.string,\n onConfirm: PropTypes.func,\n iconName: PropTypes.string,\n disabled: PropTypes.bool,\n color: PropTypes.string\n })\n })\n ]),\n onClose: PropTypes.func,\n onScroll: PropTypes.func\n};\n\nexport default BaseModal;\n"],"mappings":";;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,QAA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APH;EAQpBvD,QAAQ,EAAEZ,SAAS,CAACqE,IARA;EASpBxD,MAAM,EAAEb,SAAS,CAACsE,IATE;EAUpBxD,MAAM,EAAEd,SAAS,CAACuE,SAAV,CAAoB,CAC1BvE,SAAS,CAACwE,IADgB,EAE1BxE,SAAS,CAACoE,KAAV,CAAgB;IACd/C,IAAI,EAAErB,SAAS,CAACmE,MADF;IAEd7C,OAAO,EAAEtB,SAAS,CAACyE,OAFL;IAGdtD,YAAY,EAAEnB,SAAS,CAACoE,KAAV,CAAgB;MAC5B7C,KAAK,EAAEvB,SAAS,CAACmE,MADW;MAE5B1C,QAAQ,EAAEzB,SAAS,CAACwE,IAFQ;MAG5B9C,QAAQ,EAAE1B,SAAS,CAACsE;IAHQ,CAAhB,CAHA;IAQdlD,aAAa,EAAEpB,SAAS,CAACoE,KAAV,CAAgB;MAC7B7C,KAAK,EAAEvB,SAAS,CAACmE,MADY;MAE7BtC,SAAS,EAAE7B,SAAS,CAACwE,IAFQ;MAG7BzC,QAAQ,EAAE/B,SAAS,CAACmE,MAHS;MAI7BzC,QAAQ,EAAE1B,SAAS,CAACsE,IAJS;MAK7BtC,KAAK,EAAEhC,SAAS,CAACmE;IALY,CAAhB;EARD,CAAhB,CAF0B,CAApB,CAVY;EA6BpBpD,OAAO,EAAEf,SAAS,CAACwE,IA7BC;EA8BpBxD,QAAQ,EAAEhB,SAAS,CAACwE;AA9BA,CAAtB;AAiCA,eAAelE,SAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useEffect","useRef","useState","PropTypes","convert","Provider","Icon","ButtonLink","style","BaseModal","props","context","title","description","headerIcon","children","isOpen","footer","onClose","onScroll","detectScrollbar","skin","bodyRef","isScrollbarVisible","setIsScrollbarVisible","checkScrollbar","bodyElement","current","scrollHeight","clientHeight","debouncedCheckScrollbar","mutationObserver","MutationObserver","observe","childList","subtree","resizeObserver","ResizeObserver","disconnect","cancel","Footer","cancelButton","confirmButton","text","isError","label","cancelLabel","onCancel","disabled","cancelDisabled","confirmLabel","onConfirm","confirmDisabled","iconName","color","buttonConfirmColor","footerCTAWrapper","className","footerCancelButton","type","onClick","customStyle","backgroundColor","hoverBackgroundColor","hoverColor","footerConfirmButton","icon","position","faIcon","name","size","footerDescription","footerDescriptionError","handleOnClose","e","stopPropagation","modalWrapper","modal","header","faSize","wrapperSize","headerContent","headerTitle","headerDescription","headerCloseIcon","body","bodyWithoutScrollbar","contextTypes","childContextTypes","propTypes","string","shape","node","bool","oneOfType","func","boolean"],"sources":["../../../src/molecule/base-modal/index.js"],"sourcesContent":["import React, {useCallback, useEffect, useRef, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {isEmpty, get, debounce} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../atom/provider';\nimport Icon from '../../atom/icon';\nimport ButtonLink from '../../atom/button-link';\nimport style from './style.css';\n\nconst BaseModal = (props, context) => {\n const {\n title,\n description,\n headerIcon,\n children,\n isOpen,\n footer,\n onClose,\n onScroll,\n detectScrollbar = false\n } = props;\n const {skin} = context;\n const bodyRef = useRef(null);\n const [isScrollbarVisible, setIsScrollbarVisible] = useState(!detectScrollbar);\n\n const checkScrollbar = () => {\n const bodyElement = bodyRef.current;\n if (bodyElement) {\n setIsScrollbarVisible(bodyElement.scrollHeight > bodyElement.clientHeight);\n }\n };\n\n useEffect(() => {\n if (!detectScrollbar) return;\n const bodyElement = bodyRef.current;\n\n if (!bodyElement) return;\n\n const debouncedCheckScrollbar = debounce(100, () => {\n checkScrollbar();\n });\n\n // Observer of the body content\n const mutationObserver = new MutationObserver(() => {\n debouncedCheckScrollbar();\n });\n\n mutationObserver.observe(bodyElement, {childList: true, subtree: true});\n\n // Observer of the body size\n const resizeObserver = new ResizeObserver(() => {\n debouncedCheckScrollbar();\n });\n\n if (bodyRef.current) {\n resizeObserver.observe(bodyRef.current);\n }\n\n checkScrollbar();\n\n return () => {\n mutationObserver.disconnect();\n resizeObserver.disconnect();\n debouncedCheckScrollbar.cancel();\n };\n }, [children, detectScrollbar]);\n\n const Footer = useCallback(() => {\n if (isEmpty(footer)) return null;\n if (typeof footer === 'function') return footer();\n\n const {cancelButton, confirmButton, text, isError} = footer;\n const {label: cancelLabel, onCancel, disabled: cancelDisabled} = cancelButton || {};\n const {\n label: confirmLabel,\n onConfirm,\n disabled: confirmDisabled,\n iconName,\n color\n } = confirmButton || {};\n const buttonConfirmColor = color || get('common.primary', skin);\n\n return (\n <div className={style.footer}>\n <div className={style.footerCTAWrapper}>\n {onCancel && cancelLabel ? (\n <ButtonLink\n {...{\n className: style.footerCancelButton,\n type: 'secondary',\n onClick: onCancel,\n label: cancelLabel,\n disabled: cancelDisabled\n }}\n />\n ) : null}\n {onConfirm && confirmLabel ? (\n <div>\n <ButtonLink\n {...{\n customStyle: {backgroundColor: buttonConfirmColor},\n hoverBackgroundColor: convert(\n `hsl(from ${buttonConfirmColor} h s calc(l*(1 - 0.08)))`\n ),\n hoverColor: '#FFFFFF',\n className: style.footerConfirmButton,\n type: 'primary',\n onClick: onConfirm,\n label: confirmLabel,\n disabled: confirmDisabled,\n ...(iconName\n ? {\n icon: {\n position: 'left',\n faIcon: {\n name: iconName,\n color: '#FFFFFF',\n size: 16\n }\n }\n }\n : {})\n }}\n />\n </div>\n ) : null}\n </div>\n {text ? (\n <div\n className={`${style.footerDescription} ${isError ? style.footerDescriptionError : ''}`}\n >\n {text}\n </div>\n ) : null}\n </div>\n );\n }, [footer, skin]);\n\n if (!isOpen || !title || !children) return null;\n\n function handleOnClose(e) {\n e?.stopPropagation();\n onClose();\n }\n\n return (\n <div className={style.modalWrapper}>\n <div className={style.modal}>\n <header className={style.header}>\n {headerIcon?.name ? (\n <div className={style.headerIcon}>\n <Icon\n iconName={headerIcon.name}\n iconColor={headerIcon.color}\n backgroundColor={headerIcon.backgroundColor}\n size={{faSize: 20, wrapperSize: 48}}\n />\n </div>\n ) : null}\n <div className={style.headerContent}>\n <div className={style.headerTitle}>{title}</div>\n {description ? <div className={style.headerDescription}>{description}</div> : null}\n </div>\n <div className={style.headerCloseIcon} onClick={handleOnClose} data-testid=\"close-icon\">\n <Icon iconName=\"close\" backgroundColor=\"#F4F4F5\" size={{faSize: 14, wrapperSize: 28}} />\n </div>\n </header>\n <div\n ref={bodyRef}\n className={isScrollbarVisible ? style.body : style.bodyWithoutScrollbar}\n onScroll={onScroll}\n data-testid=\"modal-body\"\n >\n {children}\n </div>\n <Footer />\n </div>\n </div>\n );\n};\n\nBaseModal.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBaseModal.propTypes = {\n title: PropTypes.string,\n headerIcon: PropTypes.shape({\n name: PropTypes.string,\n color: PropTypes.string,\n backgroundColor: PropTypes.string\n }),\n description: PropTypes.string,\n children: PropTypes.node,\n isOpen: PropTypes.bool,\n footer: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.shape({\n text: PropTypes.string,\n isError: PropTypes.boolean,\n cancelButton: PropTypes.shape({\n label: PropTypes.string,\n onCancel: PropTypes.func,\n disabled: PropTypes.bool\n }),\n confirmButton: PropTypes.shape({\n label: PropTypes.string,\n onConfirm: PropTypes.func,\n iconName: PropTypes.string,\n disabled: PropTypes.bool,\n color: PropTypes.string\n })\n })\n ]),\n onClose: PropTypes.func,\n onScroll: PropTypes.func,\n detectScrollbar: PropTypes.bool\n};\n\nexport default BaseModal;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,SAA5B,EAAuCC,MAAvC,EAA+CC,QAA/C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,OAAR,QAAsB,oBAAtB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,SAAS,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EACpC,MAAM;IACJC,KADI;IAEJC,WAFI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AAgB;IACdhD,IAAI,EAAExC,SAAS,CAACuF,MADF;IAEd9C,OAAO,EAAEzC,SAAS,CAAC6F,OAFL;IAGdvD,YAAY,EAAEtC,SAAS,CAACwF,KAAV,CAAgB;MAC5B9C,KAAK,EAAE1C,SAAS,CAACuF,MADW;MAE5B3C,QAAQ,EAAE5C,SAAS,CAAC4F,IAFQ;MAG5B/C,QAAQ,EAAE7C,SAAS,CAAC0F;IAHQ,CAAhB,CAHA;IAQdnD,aAAa,EAAEvC,SAAS,CAACwF,KAAV,CAAgB;MAC7B9C,KAAK,EAAE1C,SAAS,CAACuF,MADY;MAE7BvC,SAAS,EAAEhD,SAAS,CAAC4F,IAFQ;MAG7B1C,QAAQ,EAAElD,SAAS,CAACuF,MAHS;MAI7B1C,QAAQ,EAAE7C,SAAS,CAAC0F,IAJS;MAK7BvC,KAAK,EAAEnD,SAAS,CAACuF;IALY,CAAhB;EARD,CAAhB,CAF0B,CAApB,CAVY;EA6BpBxE,OAAO,EAAEf,SAAS,CAAC4F,IA7BC;EA8BpB5E,QAAQ,EAAEhB,SAAS,CAAC4F,IA9BA;EA+BpB3E,eAAe,EAAEjB,SAAS,CAAC0F;AA/BP,CAAtB;AAkCA,eAAepF,SAAf"}
@@ -79,6 +79,13 @@
79
79
  border-bottom: 1px solid cm_grey_150;
80
80
  }
81
81
 
82
+ .bodyWithoutScrollbar {
83
+ overflow: auto;
84
+ background-color: white;
85
+ padding: 32px 32px 16px 32px;
86
+ min-height: 100px;
87
+ }
88
+
82
89
  .footer {
83
90
  padding: 24px;
84
91
  display: flex;
@@ -96,6 +96,8 @@ declare const propTypes: {
96
96
  label: PropTypes.Requireable<string>;
97
97
  content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
98
98
  'aria-label': PropTypes.Requireable<string>;
99
+ tooltipText: PropTypes.Requireable<string>;
100
+ tooltipPlacement: PropTypes.Requireable<string>;
99
101
  'data-name': PropTypes.Requireable<string>;
100
102
  'data-testid': PropTypes.Requireable<string>;
101
103
  icon: PropTypes.Requireable<PropTypes.InferProps<{
@@ -247,6 +249,8 @@ declare const propTypes: {
247
249
  label: PropTypes.Requireable<string>;
248
250
  content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
249
251
  'aria-label': PropTypes.Requireable<string>;
252
+ tooltipText: PropTypes.Requireable<string>;
253
+ tooltipPlacement: PropTypes.Requireable<string>;
250
254
  'data-name': PropTypes.Requireable<string>;
251
255
  'data-testid': PropTypes.Requireable<string>;
252
256
  icon: PropTypes.Requireable<PropTypes.InferProps<{
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/cm-popin/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDd,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,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,CAAC,GAChD,SAAS,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;KACtD,CAAC;IACF,IAAI,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;CACpD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -68,6 +68,8 @@ declare const ActionableExpandableTable: {
68
68
  label: import("prop-types").Requireable<string>;
69
69
  content: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
70
70
  'aria-label': import("prop-types").Requireable<string>;
71
+ tooltipText: import("prop-types").Requireable<string>;
72
+ tooltipPlacement: import("prop-types").Requireable<string>;
71
73
  'data-name': import("prop-types").Requireable<string>;
72
74
  'data-testid': import("prop-types").Requireable<string>;
73
75
  icon: import("prop-types").Requireable<import("prop-types").InferProps<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAOjE,OAAO,EAA2C,KAAK,EAAY,MAAM,SAAS,CAAC;AAqCnF,QAAA,MAAM,yBAAyB;YAAW,KAAK,iBAAiB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoL/E,CAAC;AASF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAOjE,OAAO,EAA2C,KAAK,EAAY,MAAM,SAAS,CAAC;AAqCnF,QAAA,MAAM,yBAAyB;YAAW,KAAK,iBAAiB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoL/E,CAAC;AASF,eAAe,yBAAyB,CAAC"}
@@ -45,6 +45,8 @@ export declare const propTypes: {
45
45
  label: PropTypes.Requireable<string>;
46
46
  content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
47
47
  'aria-label': PropTypes.Requireable<string>;
48
+ tooltipText: PropTypes.Requireable<string>;
49
+ tooltipPlacement: PropTypes.Requireable<string>;
48
50
  'data-name': PropTypes.Requireable<string>;
49
51
  'data-testid': PropTypes.Requireable<string>;
50
52
  icon: PropTypes.Requireable<PropTypes.InferProps<{
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/expandible-actionable-table/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,OAAO,EAAC,0BAA0B,EAAC,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAC,KAAK,IAAI,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AA0BzE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBrB,CAAC;AAEF,oBAAY,KAAK,GACb,MAAM,GACN,CAAC,eAAe,GAAG;IACjB,aAAa,EAAE,QAAQ,CAAC;CACzB,CAAC,GACF,CAAC,oBAAoB,GAAG;IACtB,aAAa,EAAE,cAAc,CAAC;CAC/B,CAAC,CAAC;AAEP,oBAAY,SAAS,GACjB,CAAC,eAAe,GAAG;IACjB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAA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AC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,oBAAY,WAAW,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC"}
@@ -68,20 +68,12 @@
68
68
  padding: 16px;
69
69
  background-color: white;
70
70
  height: 114px;
71
- }
72
-
73
- .detailsSection0 {
74
- composes: detailsSectionCommon;
75
71
  flex: 1;
76
72
  }
77
73
 
78
- .detailsSection1 {
79
- composes: detailsSection0;
80
- }
81
-
82
- .detailsSection2 {
74
+ .detailsSection0 , .detailsSection1, .detailsSection2 {
83
75
  composes: detailsSectionCommon;
84
- width: 245px;
76
+ flex: 1;
85
77
  }
86
78
 
87
79
  .detailsInfo {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/skill-picker-modal/index.js"],"names":[],"mappings":";AAUA,gFAoKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/skill-picker-modal/index.js"],"names":[],"mappings":";AAUA,gFAsKC"}
@@ -30,6 +30,7 @@ const SkillPickerModal = (props, context) => {
30
30
  const {
31
31
  translate
32
32
  } = context;
33
+ const detectScrollbar = true;
33
34
  const [sortedSkills, setSortedSkills] = useState(_sortBy(skill => skillsLocales[skill], skills));
34
35
  const [currentSort, setCurrentSort] = useState('alphabetical');
35
36
  const [selectedSkillList, setSelectedSkillList] = useState(selectedSkills);
@@ -100,7 +101,8 @@ const SkillPickerModal = (props, context) => {
100
101
  headerIcon: {
101
102
  name: 'bullseye-arrow',
102
103
  backgroundColor: '#DDD1FF'
103
- }
104
+ },
105
+ detectScrollbar: detectScrollbar
104
106
  }, /*#__PURE__*/React.createElement("div", {
105
107
  className: style.skillPickerContainer
106
108
  }, isLoading ? /*#__PURE__*/React.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","useEffect","PropTypes","BaseModal","Chip","Loader","Select","Provider","style","SkillPickerModal","props","context","skills","selectedSkills","skillsLocales","skillsScore","isOpen","isLoading","maxSelectedSkills","minSelectedSkills","onCancel","onConfirm","onClose","translate","sortedSkills","setSortedSkills","skill","currentSort","setCurrentSort","selectedSkillList","setSelectedSkillList","handleCancel","handleClose","skillProgressAvailable","skillList","map","skillTitle","skillRef","focus","includes","score","isError","length","footer","footerDescription","skillNumber","text","cancelButton","label","disabled","confirmButton","iconName","sorting","theme","options","value","name","selected","onChange","prev","backgroundColor","skillPickerContainer","loaderContainer","loader","ctaWrapper","sortWrapper","display","gap","flexWrap","index","handleChipClick","newSelectedSkillList","selectedSkill","subText","toFixed","contextTypes","childContextTypes","propTypes","arrayOf","string","objectOf","number","bool","func"],"sources":["../../../src/molecule/skill-picker-modal/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {filter, some, sortBy} from 'lodash/fp';\nimport BaseModal from '../base-modal';\nimport Chip from '../../atom/chip';\nimport Loader from '../../atom/loader';\nimport Select from '../../atom/select';\nimport Provider from '../../atom/provider';\nimport style from './style.css';\n\nconst SkillPickerModal = (props, context) => {\n const {\n skills,\n selectedSkills,\n skillsLocales,\n skillsScore,\n isOpen,\n isLoading,\n maxSelectedSkills = 6,\n minSelectedSkills = 3,\n onCancel,\n onConfirm,\n onClose\n } = props;\n const {translate} = context;\n\n const [sortedSkills, setSortedSkills] = useState(sortBy(skill => skillsLocales[skill], skills));\n const [currentSort, setCurrentSort] = useState('alphabetical');\n const [selectedSkillList, setSelectedSkillList] = useState(selectedSkills);\n\n const handleCancel = useCallback(() => {\n setSelectedSkillList(selectedSkills);\n onCancel();\n }, [setSelectedSkillList, selectedSkills, onCancel]);\n\n const handleClose = useCallback(() => {\n setSelectedSkillList(selectedSkills);\n onClose();\n }, [setSelectedSkillList, selectedSkills, onClose]);\n\n const skillProgressAvailable = some(skill => skillsScore[skill] > 0, skills);\n\n const skillList = useMemo(() => {\n return sortedSkills.map(skill => {\n return {\n skillTitle: skillsLocales[skill],\n skillRef: skill,\n focus: selectedSkillList.includes(skill),\n score: skillsScore[skill]\n };\n });\n }, [sortedSkills, selectedSkillList, skillsLocales, skillsScore]);\n\n const isError = useMemo(\n () =>\n selectedSkillList.length > maxSelectedSkills || selectedSkillList.length < minSelectedSkills,\n [selectedSkillList, maxSelectedSkills, minSelectedSkills]\n );\n\n const footer = useMemo(() => {\n const footerDescription =\n selectedSkillList.length > maxSelectedSkills\n ? translate('skill_focus_footer_error_description', {\n skillNumber: selectedSkillList.length - maxSelectedSkills\n })\n : translate('skill_focus_footer_description', {\n skillNumber: minSelectedSkills - selectedSkillList.length\n });\n return {\n text: isLoading || !isError ? '' : footerDescription,\n isError,\n cancelButton: {\n onCancel: handleCancel,\n label: translate('cancel'),\n disabled: isLoading || isError\n },\n confirmButton: {\n onConfirm: () => onConfirm(selectedSkillList),\n label: translate('confirm'),\n iconName: 'circle-check',\n disabled: isLoading || isError\n }\n };\n }, [\n isError,\n handleCancel,\n onConfirm,\n translate,\n selectedSkillList,\n isLoading,\n maxSelectedSkills,\n minSelectedSkills\n ]);\n\n const sorting = useMemo(\n () => ({\n theme: 'skillDetail',\n options: ['alphabetical', 'progress'].map(value => ({\n name: value === 'progress' ? translate('progress') : translate('alphabetical'),\n value,\n selected: currentSort === value\n })),\n onChange: value => setCurrentSort(value)\n }),\n [currentSort, translate]\n );\n\n useEffect(() => {\n // eslint-disable-next-line lodash-fp/no-extraneous-function-wrapping\n setSortedSkills(prev =>\n sortBy(\n skill => (currentSort === 'progress' ? -skillsScore[skill] : skillsLocales[skill]),\n prev\n )\n );\n }, [currentSort, skillsScore, skillsLocales, setSortedSkills]);\n\n if ((!isLoading && !skills) || !isOpen) return null;\n\n return (\n <BaseModal\n title={translate('skill_focus')}\n description={translate('skill_focus_description')}\n isOpen={isOpen}\n onClose={handleClose}\n footer={footer}\n headerIcon={{\n name: 'bullseye-arrow',\n backgroundColor: '#DDD1FF'\n }}\n >\n <div className={style.skillPickerContainer}>\n {isLoading ? (\n <div className={style.loaderContainer}>\n <Loader className={style.loader} theme=\"coorpmanager\" />\n </div>\n ) : (\n <>\n <div className={style.ctaWrapper}>\n <div>{`${selectedSkillList.length} ${translate('selected')}`}</div>\n {skillProgressAvailable ? (\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null}\n </div>\n <div style={{display: 'flex', gap: '16px', flexWrap: 'wrap'}}>\n {skillList.map((skill, index) => {\n const {skillTitle, skillRef, focus, score} = skill;\n function handleChipClick() {\n const newSelectedSkillList = focus\n ? filter(selectedSkill => selectedSkill !== skillRef, selectedSkillList)\n : [...selectedSkillList, skill.skillRef];\n setSelectedSkillList(newSelectedSkillList);\n }\n\n return (\n <Chip\n {...(skillProgressAvailable ? {subText: `${score.toFixed(1)}%`} : {})}\n text={skillTitle}\n selected={focus}\n onClick={handleChipClick}\n key={index}\n backgroundColor=\"skin\"\n />\n );\n })}\n </div>\n </>\n )}\n </div>\n </BaseModal>\n );\n};\n\nSkillPickerModal.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nSkillPickerModal.propTypes = {\n skills: PropTypes.arrayOf(PropTypes.string),\n selectedSkills: PropTypes.arrayOf(PropTypes.string),\n skillsLocales: PropTypes.objectOf(PropTypes.string),\n skillsScore: PropTypes.objectOf(PropTypes.number),\n isOpen: PropTypes.bool,\n isLoading: PropTypes.bool,\n minSelectedSkills: PropTypes.number,\n maxSelectedSkills: PropTypes.number,\n onCancel: PropTypes.func,\n onConfirm: PropTypes.func,\n onClose: PropTypes.func\n};\n\nexport default SkillPickerModal;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,QAAxB,EAAkCC,WAAlC,EAA+CC,SAA/C,QAA+D,OAA/D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;EAC3C,MAAM;IACJC,MADI;IAEJC,cAFI;IAGJC,aAHI;IAIJC,WAJI;IAKJC,MALI;IAMJC,SANI;IAOJC,iBAAiB,GAAG,CAPhB;IAQJC,iBAAiB,GAAG,CARhB;IASJC,QATI;IAUJC,SAVI;IAWJC;EAXI,IAYFZ,KAZJ;EAaA,MAAM;IAACa;EAAD,IAAcZ,OAApB;EAEA,MAAM,CAACa,YAAD,EAAeC,eAAf,IAAkC1B,QAAQ,CAAC,QAAO2B,KAAK,IAAIZ,aAAa,CAACY,KAAD,CAA7B,EAAsCd,MAAtC,CAAD,CAAhD;EACA,MAAM,CAACe,WAAD,EAAcC,cAAd,IAAgC7B,QAAQ,CAAC,cAAD,CAA9C;EACA,MAAM,CAAC8B,iBAAD,EAAoBC,oBAApB,IAA4C/B,QAAQ,CAACc,cAAD,CAA1D;EAEA,MAAMkB,YAAY,GAAG/B,WAAW,CAAC,MAAM;IACrC8B,oBAAoB,CAACjB,cAAD,CAApB;IACAO,QAAQ;EACT,CAH+B,EAG7B,CAACU,oBAAD,EAAuBjB,cAAvB,EAAuCO,QAAvC,CAH6B,CAAhC;EAK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Q,EAAElB,SAAS,CAACiF,IATO;EAU3B9D,SAAS,EAAEnB,SAAS,CAACiF,IAVM;EAW3B7D,OAAO,EAAEpB,SAAS,CAACiF;AAXQ,CAA7B;AAcA,eAAe1E,gBAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","useEffect","PropTypes","BaseModal","Chip","Loader","Select","Provider","style","SkillPickerModal","props","context","skills","selectedSkills","skillsLocales","skillsScore","isOpen","isLoading","maxSelectedSkills","minSelectedSkills","onCancel","onConfirm","onClose","translate","detectScrollbar","sortedSkills","setSortedSkills","skill","currentSort","setCurrentSort","selectedSkillList","setSelectedSkillList","handleCancel","handleClose","skillProgressAvailable","skillList","map","skillTitle","skillRef","focus","includes","score","isError","length","footer","footerDescription","skillNumber","text","cancelButton","label","disabled","confirmButton","iconName","sorting","theme","options","value","name","selected","onChange","prev","backgroundColor","skillPickerContainer","loaderContainer","loader","ctaWrapper","sortWrapper","display","gap","flexWrap","index","handleChipClick","newSelectedSkillList","selectedSkill","subText","toFixed","contextTypes","childContextTypes","propTypes","arrayOf","string","objectOf","number","bool","func"],"sources":["../../../src/molecule/skill-picker-modal/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback, useEffect} from 'react';\nimport PropTypes from 'prop-types';\nimport {filter, some, sortBy} from 'lodash/fp';\nimport BaseModal from '../base-modal';\nimport Chip from '../../atom/chip';\nimport Loader from '../../atom/loader';\nimport Select from '../../atom/select';\nimport Provider from '../../atom/provider';\nimport style from './style.css';\n\nconst SkillPickerModal = (props, context) => {\n const {\n skills,\n selectedSkills,\n skillsLocales,\n skillsScore,\n isOpen,\n isLoading,\n maxSelectedSkills = 6,\n minSelectedSkills = 3,\n onCancel,\n onConfirm,\n onClose\n } = props;\n const {translate} = context;\n\n const detectScrollbar = true;\n const [sortedSkills, setSortedSkills] = useState(sortBy(skill => skillsLocales[skill], skills));\n const [currentSort, setCurrentSort] = useState('alphabetical');\n const [selectedSkillList, setSelectedSkillList] = useState(selectedSkills);\n\n const handleCancel = useCallback(() => {\n setSelectedSkillList(selectedSkills);\n onCancel();\n }, [setSelectedSkillList, selectedSkills, onCancel]);\n\n const handleClose = useCallback(() => {\n setSelectedSkillList(selectedSkills);\n onClose();\n }, [setSelectedSkillList, selectedSkills, onClose]);\n\n const skillProgressAvailable = some(skill => skillsScore[skill] > 0, skills);\n\n const skillList = useMemo(() => {\n return sortedSkills.map(skill => {\n return {\n skillTitle: skillsLocales[skill],\n skillRef: skill,\n focus: selectedSkillList.includes(skill),\n score: skillsScore[skill]\n };\n });\n }, [sortedSkills, selectedSkillList, skillsLocales, skillsScore]);\n\n const isError = useMemo(\n () =>\n selectedSkillList.length > maxSelectedSkills || selectedSkillList.length < minSelectedSkills,\n [selectedSkillList, maxSelectedSkills, minSelectedSkills]\n );\n\n const footer = useMemo(() => {\n const footerDescription =\n selectedSkillList.length > maxSelectedSkills\n ? translate('skill_focus_footer_error_description', {\n skillNumber: selectedSkillList.length - maxSelectedSkills\n })\n : translate('skill_focus_footer_description', {\n skillNumber: minSelectedSkills - selectedSkillList.length\n });\n return {\n text: isLoading || !isError ? '' : footerDescription,\n isError,\n cancelButton: {\n onCancel: handleCancel,\n label: translate('cancel'),\n disabled: isLoading || isError\n },\n confirmButton: {\n onConfirm: () => onConfirm(selectedSkillList),\n label: translate('confirm'),\n iconName: 'circle-check',\n disabled: isLoading || isError\n }\n };\n }, [\n isError,\n handleCancel,\n onConfirm,\n translate,\n selectedSkillList,\n isLoading,\n maxSelectedSkills,\n minSelectedSkills\n ]);\n\n const sorting = useMemo(\n () => ({\n theme: 'skillDetail',\n options: ['alphabetical', 'progress'].map(value => ({\n name: value === 'progress' ? translate('progress') : translate('alphabetical'),\n value,\n selected: currentSort === value\n })),\n onChange: value => setCurrentSort(value)\n }),\n [currentSort, translate]\n );\n\n useEffect(() => {\n // eslint-disable-next-line lodash-fp/no-extraneous-function-wrapping\n setSortedSkills(prev =>\n sortBy(\n skill => (currentSort === 'progress' ? -skillsScore[skill] : skillsLocales[skill]),\n prev\n )\n );\n }, [currentSort, skillsScore, skillsLocales, setSortedSkills]);\n\n if ((!isLoading && !skills) || !isOpen) return null;\n\n return (\n <BaseModal\n title={translate('skill_focus')}\n description={translate('skill_focus_description')}\n isOpen={isOpen}\n onClose={handleClose}\n footer={footer}\n headerIcon={{\n name: 'bullseye-arrow',\n backgroundColor: '#DDD1FF'\n }}\n detectScrollbar={detectScrollbar}\n >\n <div className={style.skillPickerContainer}>\n {isLoading ? (\n <div className={style.loaderContainer}>\n <Loader className={style.loader} theme=\"coorpmanager\" />\n </div>\n ) : (\n <>\n <div className={style.ctaWrapper}>\n <div>{`${selectedSkillList.length} ${translate('selected')}`}</div>\n {skillProgressAvailable ? (\n <div className={style.sortWrapper}>\n {translate('sort_by')}\n <Select {...sorting} aria-label=\"All courses sort\" />\n </div>\n ) : null}\n </div>\n <div style={{display: 'flex', gap: '16px', flexWrap: 'wrap'}}>\n {skillList.map((skill, index) => {\n const {skillTitle, skillRef, focus, score} = skill;\n function handleChipClick() {\n const newSelectedSkillList = focus\n ? filter(selectedSkill => selectedSkill !== skillRef, selectedSkillList)\n : [...selectedSkillList, skill.skillRef];\n setSelectedSkillList(newSelectedSkillList);\n }\n\n return (\n <Chip\n {...(skillProgressAvailable ? {subText: `${score.toFixed(1)}%`} : {})}\n text={skillTitle}\n selected={focus}\n onClick={handleChipClick}\n key={index}\n backgroundColor=\"skin\"\n />\n );\n })}\n </div>\n </>\n )}\n </div>\n </BaseModal>\n );\n};\n\nSkillPickerModal.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nSkillPickerModal.propTypes = {\n skills: PropTypes.arrayOf(PropTypes.string),\n selectedSkills: PropTypes.arrayOf(PropTypes.string),\n skillsLocales: PropTypes.objectOf(PropTypes.string),\n skillsScore: PropTypes.objectOf(PropTypes.number),\n isOpen: PropTypes.bool,\n isLoading: PropTypes.bool,\n minSelectedSkills: PropTypes.number,\n maxSelectedSkills: PropTypes.number,\n onCancel: PropTyp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AAS,CAACkF,IATO;EAU3B/D,SAAS,EAAEnB,SAAS,CAACkF,IAVM;EAW3B9D,OAAO,EAAEpB,SAAS,CAACkF;AAXQ,CAA7B;AAcA,eAAe3E,gBAAf"}
@@ -0,0 +1,85 @@
1
+ export default TranslationModal;
2
+ declare function TranslationModal(props: any, context: any): JSX.Element | null;
3
+ declare namespace TranslationModal {
4
+ namespace contextTypes {
5
+ const translate: PropTypes.Requireable<(...args: any[]) => any>;
6
+ }
7
+ namespace propTypes {
8
+ const isOpen: PropTypes.Requireable<boolean>;
9
+ const onCancel: PropTypes.Requireable<(...args: any[]) => any>;
10
+ const onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
11
+ const onClose: PropTypes.Requireable<(...args: any[]) => any>;
12
+ const source: PropTypes.Requireable<PropTypes.InferProps<{
13
+ inputText: PropTypes.Requireable<PropTypes.InferProps<{
14
+ theme: PropTypes.Requireable<string>;
15
+ autoFocus: PropTypes.Requireable<boolean>;
16
+ title: PropTypes.Requireable<string>;
17
+ placeholder: PropTypes.Requireable<string>;
18
+ defaultValue: PropTypes.Requireable<string>;
19
+ disabled: PropTypes.Requireable<boolean>;
20
+ value: PropTypes.Requireable<string>;
21
+ hint: PropTypes.Requireable<string>;
22
+ error: PropTypes.Requireable<string>;
23
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
+ description: PropTypes.Requireable<string>;
25
+ modified: PropTypes.Requireable<boolean>;
26
+ type: PropTypes.Requireable<string>;
27
+ valid: PropTypes.Requireable<boolean>;
28
+ 'aria-label': PropTypes.Requireable<string>;
29
+ 'data-name': PropTypes.Requireable<string>;
30
+ }>>;
31
+ textArea: PropTypes.Requireable<PropTypes.InferProps<{
32
+ theme: PropTypes.Requireable<string>;
33
+ placeholder: PropTypes.Requireable<string>;
34
+ title: PropTypes.Requireable<string>;
35
+ name: PropTypes.Requireable<string>;
36
+ disabled: PropTypes.Requireable<boolean>;
37
+ value: PropTypes.Requireable<string>;
38
+ hint: PropTypes.Requireable<string>;
39
+ error: PropTypes.Requireable<string>;
40
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
41
+ description: PropTypes.Requireable<string>;
42
+ modified: PropTypes.Requireable<boolean>;
43
+ valid: PropTypes.Requireable<boolean>;
44
+ }>>;
45
+ inputLanguage: PropTypes.Requireable<string>;
46
+ }>>;
47
+ const target: PropTypes.Requireable<PropTypes.InferProps<{
48
+ inputText: PropTypes.Requireable<PropTypes.InferProps<{
49
+ theme: PropTypes.Requireable<string>;
50
+ autoFocus: PropTypes.Requireable<boolean>;
51
+ title: PropTypes.Requireable<string>;
52
+ placeholder: PropTypes.Requireable<string>;
53
+ defaultValue: PropTypes.Requireable<string>;
54
+ disabled: PropTypes.Requireable<boolean>;
55
+ value: PropTypes.Requireable<string>;
56
+ hint: PropTypes.Requireable<string>;
57
+ error: PropTypes.Requireable<string>;
58
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
59
+ description: PropTypes.Requireable<string>;
60
+ modified: PropTypes.Requireable<boolean>;
61
+ type: PropTypes.Requireable<string>;
62
+ valid: PropTypes.Requireable<boolean>;
63
+ 'aria-label': PropTypes.Requireable<string>;
64
+ 'data-name': PropTypes.Requireable<string>;
65
+ }>>;
66
+ textArea: PropTypes.Requireable<PropTypes.InferProps<{
67
+ theme: PropTypes.Requireable<string>;
68
+ placeholder: PropTypes.Requireable<string>;
69
+ title: PropTypes.Requireable<string>;
70
+ name: PropTypes.Requireable<string>;
71
+ disabled: PropTypes.Requireable<boolean>;
72
+ value: PropTypes.Requireable<string>;
73
+ hint: PropTypes.Requireable<string>;
74
+ error: PropTypes.Requireable<string>;
75
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
76
+ description: PropTypes.Requireable<string>;
77
+ modified: PropTypes.Requireable<boolean>;
78
+ valid: PropTypes.Requireable<boolean>;
79
+ }>>;
80
+ language: PropTypes.Requireable<string>;
81
+ }>>;
82
+ }
83
+ }
84
+ import PropTypes from "prop-types";
85
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/translation-modal/index.js"],"names":[],"mappings":";AAmBA,gFAkGC"}
@@ -0,0 +1,149 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
3
+ import React, { useMemo, useCallback, useState } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import BaseModal from '../base-modal';
6
+ import Provider from '../../atom/provider';
7
+ import { COLORS } from '../../variables/colors';
8
+ import InputText from '../../atom/input-text';
9
+ import TextArea from '../../atom/input-textarea';
10
+ import style from './style.css';
11
+
12
+ const renderInputGroup = ({
13
+ title,
14
+ inputProps,
15
+ textAreaProps,
16
+ disabled
17
+ }) => {
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: style.inputGroup
20
+ }, /*#__PURE__*/React.createElement("div", {
21
+ className: style.title
22
+ }, title), /*#__PURE__*/React.createElement(InputText, _extends({}, inputProps, {
23
+ disabled: disabled
24
+ })), /*#__PURE__*/React.createElement(TextArea, _extends({}, textAreaProps, {
25
+ disabled: disabled
26
+ })));
27
+ };
28
+
29
+ const TranslationModal = (props, context) => {
30
+ const {
31
+ isOpen,
32
+ onCancel,
33
+ onConfirm,
34
+ onClose,
35
+ source: {
36
+ inputText: sourceInputText,
37
+ textArea: sourceTextArea,
38
+ inputLanguage
39
+ },
40
+ target: {
41
+ inputText: targetInputText,
42
+ textArea: targetTextArea,
43
+ language: outputLanguage
44
+ }
45
+ } = props;
46
+ const {
47
+ translate
48
+ } = context;
49
+ const detectScrollbar = true;
50
+ const [inputValue, setInputValue] = useState(targetInputText?.value || '');
51
+ const [textAreaValue, setTextAreaValue] = useState(targetTextArea?.value || '');
52
+ const handleCancel = useCallback(() => {
53
+ onCancel();
54
+ }, [onCancel]);
55
+ const handleClose = useCallback(() => {
56
+ onClose();
57
+ }, [onClose]);
58
+ const handleInputChange = useCallback(e => {
59
+ setInputValue(e.target.value);
60
+ }, []);
61
+ const handleTextAreaChange = useCallback(e => {
62
+ setTextAreaValue(e.target.value);
63
+ }, []);
64
+ const isConfirmDisabled = useMemo(() => {
65
+ return !inputValue.trim() || !textAreaValue.trim();
66
+ }, [inputValue, textAreaValue]);
67
+ const footer = useMemo(() => {
68
+ return {
69
+ cancelButton: {
70
+ onCancel: handleCancel,
71
+ label: translate('cancel')
72
+ },
73
+ confirmButton: {
74
+ onConfirm: () => {
75
+ onConfirm();
76
+ },
77
+ label: translate('confirm'),
78
+ iconName: 'plus',
79
+ disabled: isConfirmDisabled,
80
+ color: COLORS.cm_primary_blue
81
+ }
82
+ };
83
+ }, [handleCancel, onConfirm, translate, isConfirmDisabled]);
84
+ if (!isOpen) return null;
85
+ return /*#__PURE__*/React.createElement(BaseModal, {
86
+ title: translate('translation_title'),
87
+ description: translate('translation_description'),
88
+ isOpen: isOpen,
89
+ onClose: handleClose,
90
+ footer: footer,
91
+ headerIcon: {
92
+ name: 'language',
93
+ backgroundColor: '#D6E6FF'
94
+ },
95
+ detectScrollbar: detectScrollbar
96
+ }, /*#__PURE__*/React.createElement("div", {
97
+ className: style.translationModal
98
+ }, /*#__PURE__*/React.createElement("div", {
99
+ className: style.horizontalSection
100
+ }, renderInputGroup({
101
+ title: inputLanguage,
102
+ inputProps: sourceInputText,
103
+ textAreaProps: sourceTextArea,
104
+ disabled: true
105
+ }), /*#__PURE__*/React.createElement("div", {
106
+ className: style.separator
107
+ }), renderInputGroup({
108
+ title: outputLanguage,
109
+ inputProps: _extends({}, targetInputText, {
110
+ value: inputValue,
111
+ onChange: handleInputChange
112
+ }),
113
+ textAreaProps: _extends({}, targetTextArea, {
114
+ value: textAreaValue,
115
+ onChange: handleTextAreaChange
116
+ }),
117
+ disabled: false
118
+ }))));
119
+ };
120
+
121
+ TranslationModal.contextTypes = {
122
+ translate: Provider.childContextTypes.translate
123
+ };
124
+ TranslationModal.propTypes = process.env.NODE_ENV !== "production" ? {
125
+ isOpen: PropTypes.bool,
126
+ onCancel: PropTypes.func,
127
+ onConfirm: PropTypes.func,
128
+ onClose: PropTypes.func,
129
+ source: PropTypes.shape({
130
+ inputText: PropTypes.shape(_extends({}, InputText.propTypes, {
131
+ theme: PropTypes.string
132
+ })),
133
+ textArea: PropTypes.shape(_extends({}, TextArea.propTypes, {
134
+ theme: PropTypes.string
135
+ })),
136
+ inputLanguage: PropTypes.string
137
+ }),
138
+ target: PropTypes.shape({
139
+ inputText: PropTypes.shape(_extends({}, InputText.propTypes, {
140
+ theme: PropTypes.string
141
+ })),
142
+ textArea: PropTypes.shape(_extends({}, TextArea.propTypes, {
143
+ theme: PropTypes.string
144
+ })),
145
+ language: PropTypes.string
146
+ })
147
+ } : {};
148
+ export default TranslationModal;
149
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","useMemo","useCallback","useState","PropTypes","BaseModal","Provider","COLORS","InputText","TextArea","style","renderInputGroup","title","inputProps","textAreaProps","disabled","inputGroup","TranslationModal","props","context","isOpen","onCancel","onConfirm","onClose","source","inputText","sourceInputText","textArea","sourceTextArea","inputLanguage","target","targetInputText","targetTextArea","language","outputLanguage","translate","detectScrollbar","inputValue","setInputValue","value","textAreaValue","setTextAreaValue","handleCancel","handleClose","handleInputChange","e","handleTextAreaChange","isConfirmDisabled","trim","footer","cancelButton","label","confirmButton","iconName","color","cm_primary_blue","name","backgroundColor","translationModal","horizontalSection","separator","onChange","contextTypes","childContextTypes","propTypes","bool","func","shape","theme","string"],"sources":["../../../src/molecule/translation-modal/index.js"],"sourcesContent":["import React, {useMemo, useCallback, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport BaseModal from '../base-modal';\nimport Provider from '../../atom/provider';\nimport {COLORS} from '../../variables/colors';\nimport InputText from '../../atom/input-text';\nimport TextArea from '../../atom/input-textarea';\nimport style from './style.css';\n\nconst renderInputGroup = ({title, inputProps, textAreaProps, disabled}) => {\n return (\n <div className={style.inputGroup}>\n <div className={style.title}>{title}</div>\n <InputText {...inputProps} disabled={disabled} />\n <TextArea {...textAreaProps} disabled={disabled} />\n </div>\n );\n};\n\nconst TranslationModal = (props, context) => {\n const {\n isOpen,\n onCancel,\n onConfirm,\n onClose,\n source: {inputText: sourceInputText, textArea: sourceTextArea, inputLanguage},\n target: {inputText: targetInputText, textArea: targetTextArea, language: outputLanguage}\n } = props;\n const {translate} = context;\n\n const detectScrollbar = true;\n\n const [inputValue, setInputValue] = useState(targetInputText?.value || '');\n const [textAreaValue, setTextAreaValue] = useState(targetTextArea?.value || '');\n\n const handleCancel = useCallback(() => {\n onCancel();\n }, [onCancel]);\n\n const handleClose = useCallback(() => {\n onClose();\n }, [onClose]);\n\n const handleInputChange = useCallback(e => {\n setInputValue(e.target.value);\n }, []);\n\n const handleTextAreaChange = useCallback(e => {\n setTextAreaValue(e.target.value);\n }, []);\n\n const isConfirmDisabled = useMemo(() => {\n return !inputValue.trim() || !textAreaValue.trim();\n }, [inputValue, textAreaValue]);\n\n const footer = useMemo(() => {\n return {\n cancelButton: {\n onCancel: handleCancel,\n label: translate('cancel')\n },\n confirmButton: {\n onConfirm: () => {\n onConfirm();\n },\n label: translate('confirm'),\n iconName: 'plus',\n disabled: isConfirmDisabled,\n color: COLORS.cm_primary_blue\n }\n };\n }, [handleCancel, onConfirm, translate, isConfirmDisabled]);\n\n if (!isOpen) return null;\n\n return (\n <BaseModal\n title={translate('translation_title')}\n description={translate('translation_description')}\n isOpen={isOpen}\n onClose={handleClose}\n footer={footer}\n headerIcon={{\n name: 'language',\n backgroundColor: '#D6E6FF'\n }}\n detectScrollbar={detectScrollbar}\n >\n <div className={style.translationModal}>\n <div className={style.horizontalSection}>\n {renderInputGroup({\n title: inputLanguage,\n inputProps: sourceInputText,\n textAreaProps: sourceTextArea,\n disabled: true\n })}\n\n <div className={style.separator} />\n\n {renderInputGroup({\n title: outputLanguage,\n inputProps: {\n ...targetInputText,\n value: inputValue,\n onChange: handleInputChange\n },\n textAreaProps: {\n ...targetTextArea,\n value: textAreaValue,\n onChange: handleTextAreaChange\n },\n disabled: false\n })}\n </div>\n </div>\n </BaseModal>\n );\n};\n\nTranslationModal.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nTranslationModal.propTypes = {\n isOpen: PropTypes.bool,\n onCancel: PropTypes.func,\n onConfirm: PropTypes.func,\n onClose: PropTypes.func,\n source: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propTypes,\n theme: PropTypes.string\n }),\n inputLanguage: PropTypes.string\n }),\n target: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propTypes,\n theme: PropTypes.string\n }),\n language: PropTypes.string\n })\n};\n\nexport default TranslationModal;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,EAAwBC,WAAxB,EAAqCC,QAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,SAAQC,MAAR,QAAqB,wBAArB;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,OAAOC,QAAP,MAAqB,2BAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CAAC;EAACC,KAAD;EAAQC,UAAR;EAAoBC,aAApB;EAAmCC;AAAnC,CAAD,KAAkD;EACzE,oBACE;IAAK,SAAS,EAAEL,KAAK,CAACM;EAAtB,gBACE;IAAK,SAAS,EAAEN,KAAK,CAACE;EAAtB,GAA8BA,KAA9B,CADF,eAEE,oBAAC,SAAD,eAAeC,UAAf;IAA2B,QAAQ,EAAEE;EAArC,GAFF,eAGE,oB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